PHP Класс Codesleeve\Stapler\Attachment

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$config Codesleeve\Stapler\AttachmentConfig An instance of the configuration class.
$instance Codesleeve\Stapler\ORM\StaplerableInterface The model instance that the attachment belongs to.
$interpolator Codesleeve\Stapler\Interfaces\Interpolator An instance of the interpolator class for processing interpolations.
$queuedForDeletion array The uploaded/resized files that have been queued up for deletion.
$queuedForWrite array The uploaded/resized files that have been queued up to be written to storage.
$resizer Codesleeve\Stapler\File\Image\Resizer An instance of the resizer library that's being used for image processing.
$storageDriver StorageInterface. An instance of the underlying storage driver that is being used.
$uploadedFile Codesleeve\Stapler\Interfaces\File The uploaded file object for the attachment.

Открытые методы

Метод Описание
__call ( string $method, array $parameters ) : mixed Handle dynamic method calls on the attachment.
__construct ( Codesleeve\Stapler\AttachmentConfig $config, Codesleeve\Stapler\Interfaces\Interpolator $interpolator, Codesleeve\Stapler\Interfaces\Resizer $resizer ) Constructor method.
__get ( string $optionName ) : mixed Handle the dynamic retrieval of attachment options.
__set ( string $name, mixed $value ) Handle the dynamic setting of attachment options.
afterDelete ( Codesleeve\Stapler\ORM\StaplerableInterface $instance ) Process the delete queue.
afterSave ( Codesleeve\Stapler\ORM\StaplerableInterface $instance ) Process the write queue.
beforeDelete ( Codesleeve\Stapler\ORM\StaplerableInterface $instance ) Queue up this attachments files for deletion.
clear ( array $stylesToClear = [] ) Queues up all or some of this attachments uploaded files/images for deletion.
clearAttributes ( ) Clear (set to null) all attachment related model attributes.
contentType ( ) : string Returns the content type of the file as originally assigned to this attachment's model.
createdAt ( ) : string Returns the creation time of the file as originally assigned to this attachment's model.
destroy ( array $stylesToClear = [] ) Removes all uploaded files (from storage) for this attachment.
getConfig ( ) : array Accessor method for the Config property.
getInstance ( ) : Codesleeve\Stapler\ORM\StaplerableInterface Accessor method for the underlying instance (model) object this attachment is defined on.
getInstanceClass ( ) : string Returns the class type of the attachment's underlying model instance.
getInterpolator ( ) : Codesleeve\Stapler\Interfaces\Interpolator Accessor method for the interpolator property.
getQueuedForDeletion ( ) : array Accessor method for the QueuedForDeletion property.
getResizer ( ) : Resizer Accessor method for the uploadedFile property.
getStorageDriver ( ) : Codesleeve\Stapler\Interfaces\Storage Accessor method for the storageDriver property.
getUploadedFile ( ) : Codesleeve\Stapler\Interfaces\File Accessor method for the uploadedFile property.
instanceWrite ( string $property, mixed $value ) Set an attachment attribute on the underlying model instance.
jsonSerialize ( ) : array Return a JSON representation of this class.
originalFilename ( ) : string Returns the name of the file as originally assigned to this attachment's model.
path ( string $styleName = '' ) : string Generates the file system path to an uploaded file (or a resized version of it).
reprocess ( ) Rebuilds the images for this attachment.
save ( ) Flushes the queuedForDeletion and queuedForWrite arrays.
setConfig ( Codesleeve\Stapler\AttachmentConfig $config ) Mutator method for the config property.
setInstance ( Codesleeve\Stapler\ORM\StaplerableInterface $instance ) Mutator method for the instance property.
setInterpolator ( Codesleeve\Stapler\Interfaces\Interpolator $interpolator ) Mutator method for the interpolator property.
setQueuedForDeletion ( array $array ) Mutator method for the QueuedForDeletion property.
setResizer ( Codesleeve\Stapler\Interfaces\Resizer $resizer ) Mutator method for the resizer property.
setStorageDriver ( Codesleeve\Stapler\Interfaces\Storage $storageDriver ) Mutator method for the storageDriver property.
setUploadedFile ( mixed $uploadedFile ) Mutator method for the uploadedFile property.
size ( ) : integer Returns the size of the file as originally assigned to this attachment's model.
updatedAt ( ) : string Returns the last modified time of the file as originally assigned to this attachment's model.
url ( string $styleName = '' ) : string Generates the url to an uploaded file (or a resized version of it).

Защищенные методы

Метод Описание
defaultPath ( string $styleName = '' ) : string Generates the default path if no file attachment is present.
defaultUrl ( string $styleName = '' ) : string Generates the default url if no file attachment is present.
flushDeletes ( ) Process the queuedForDeletion que.
flushWrites ( ) Process the queuedForWrite que.
queueAllForDeletion ( ) Add all uploaded files (across all image styles) to the queuedForDeletion queue.
queueAllForWrite ( ) Fill the queuedForWrite que with all of this attachment's styles.
queueSomeForDeletion ( array $stylesToClear ) Add a subset (filtered via style) of the uploaded files for this attachment to the queuedForDeletion queue.

Описание методов

__call() публичный Метод

This allows us to call methods on the underlying storage driver directly via the attachment.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
Результат mixed

__construct() публичный Метод

Constructor method.
public __construct ( Codesleeve\Stapler\AttachmentConfig $config, Codesleeve\Stapler\Interfaces\Interpolator $interpolator, Codesleeve\Stapler\Interfaces\Resizer $resizer )
$config Codesleeve\Stapler\AttachmentConfig
$interpolator Codesleeve\Stapler\Interfaces\Interpolator
$resizer Codesleeve\Stapler\Interfaces\Resizer

__get() публичный Метод

Style options will be converted into a php stcClass.
public __get ( string $optionName ) : mixed
$optionName string
Результат mixed

__set() публичный Метод

Handle the dynamic setting of attachment options.
public __set ( string $name, mixed $value )
$name string
$value mixed

afterDelete() публичный Метод

Process the delete queue.
public afterDelete ( Codesleeve\Stapler\ORM\StaplerableInterface $instance )
$instance Codesleeve\Stapler\ORM\StaplerableInterface

afterSave() публичный Метод

Process the write queue.
public afterSave ( Codesleeve\Stapler\ORM\StaplerableInterface $instance )
$instance Codesleeve\Stapler\ORM\StaplerableInterface

beforeDelete() публичный Метод

Queue up this attachments files for deletion.
public beforeDelete ( Codesleeve\Stapler\ORM\StaplerableInterface $instance )
$instance Codesleeve\Stapler\ORM\StaplerableInterface

clear() публичный Метод

Queues up all or some of this attachments uploaded files/images for deletion.
public clear ( array $stylesToClear = [] )
$stylesToClear array

clearAttributes() публичный Метод

Clear (set to null) all attachment related model attributes.
public clearAttributes ( )

contentType() публичный Метод

Lives in the _content_type attribute of the model.
public contentType ( ) : string
Результат string

createdAt() публичный Метод

Lives in the _created_at attribute of the model. This attribute may conditionally exist on the model, it is not one of the four required fields.
public createdAt ( ) : string
Результат string

defaultPath() защищенный Метод

Generates the default path if no file attachment is present.
protected defaultPath ( string $styleName = '' ) : string
$styleName string
Результат string

defaultUrl() защищенный Метод

Generates the default url if no file attachment is present.
protected defaultUrl ( string $styleName = '' ) : string
$styleName string
Результат string

destroy() публичный Метод

This method does not clear out attachment attributes on the model instance.
public destroy ( array $stylesToClear = [] )
$stylesToClear array

flushDeletes() защищенный Метод

Process the queuedForDeletion que.
protected flushDeletes ( )

flushWrites() защищенный Метод

Process the queuedForWrite que.
protected flushWrites ( )

getConfig() публичный Метод

Accessor method for the Config property.
public getConfig ( ) : array
Результат array

getInstance() публичный Метод

Accessor method for the underlying instance (model) object this attachment is defined on.
public getInstance ( ) : Codesleeve\Stapler\ORM\StaplerableInterface
Результат Codesleeve\Stapler\ORM\StaplerableInterface

getInstanceClass() публичный Метод

Returns the class type of the attachment's underlying model instance.
public getInstanceClass ( ) : string
Результат string

getInterpolator() публичный Метод

Accessor method for the interpolator property.
public getInterpolator ( ) : Codesleeve\Stapler\Interfaces\Interpolator
Результат Codesleeve\Stapler\Interfaces\Interpolator

getQueuedForDeletion() публичный Метод

Accessor method for the QueuedForDeletion property.
public getQueuedForDeletion ( ) : array
Результат array

getResizer() публичный Метод

Accessor method for the uploadedFile property.
public getResizer ( ) : Resizer
Результат Resizer

getStorageDriver() публичный Метод

Accessor method for the storageDriver property.
public getStorageDriver ( ) : Codesleeve\Stapler\Interfaces\Storage
Результат Codesleeve\Stapler\Interfaces\Storage

getUploadedFile() публичный Метод

Accessor method for the uploadedFile property.
public getUploadedFile ( ) : Codesleeve\Stapler\Interfaces\File
Результат Codesleeve\Stapler\Interfaces\File

instanceWrite() публичный Метод

Set an attachment attribute on the underlying model instance.
public instanceWrite ( string $property, mixed $value )
$property string
$value mixed

jsonSerialize() публичный Метод

Return a JSON representation of this class.
public jsonSerialize ( ) : array
Результат array

originalFilename() публичный Метод

Lives in the _file_name attribute of the model.
public originalFilename ( ) : string
Результат string

path() публичный Метод

This is used for saving files, etc.
public path ( string $styleName = '' ) : string
$styleName string
Результат string

queueAllForDeletion() защищенный Метод

Add all uploaded files (across all image styles) to the queuedForDeletion queue.
protected queueAllForDeletion ( )

queueAllForWrite() защищенный Метод

Fill the queuedForWrite que with all of this attachment's styles.
protected queueAllForWrite ( )

queueSomeForDeletion() защищенный Метод

Add a subset (filtered via style) of the uploaded files for this attachment to the queuedForDeletion queue.
protected queueSomeForDeletion ( array $stylesToClear )
$stylesToClear array

reprocess() публичный Метод

Rebuilds the images for this attachment.
public reprocess ( )

save() публичный Метод

Flushes the queuedForDeletion and queuedForWrite arrays.
public save ( )

setConfig() публичный Метод

Mutator method for the config property.
public setConfig ( Codesleeve\Stapler\AttachmentConfig $config )
$config Codesleeve\Stapler\AttachmentConfig

setInstance() публичный Метод

This provides a mechanism for the attachment to access properties of the corresponding model instance it's attached to.
public setInstance ( Codesleeve\Stapler\ORM\StaplerableInterface $instance )
$instance Codesleeve\Stapler\ORM\StaplerableInterface

setInterpolator() публичный Метод

Mutator method for the interpolator property.
public setInterpolator ( Codesleeve\Stapler\Interfaces\Interpolator $interpolator )
$interpolator Codesleeve\Stapler\Interfaces\Interpolator

setQueuedForDeletion() публичный Метод

Mutator method for the QueuedForDeletion property.
public setQueuedForDeletion ( array $array )
$array array

setResizer() публичный Метод

Mutator method for the resizer property.
public setResizer ( Codesleeve\Stapler\Interfaces\Resizer $resizer )
$resizer Codesleeve\Stapler\Interfaces\Resizer

setStorageDriver() публичный Метод

Mutator method for the storageDriver property.
public setStorageDriver ( Codesleeve\Stapler\Interfaces\Storage $storageDriver )
$storageDriver Codesleeve\Stapler\Interfaces\Storage

setUploadedFile() публичный Метод

Accepts the following inputs: - An absolute string url (for fetching remote files). - An array (data parsed from the $_FILES array), - A Symfony uploaded file object.
public setUploadedFile ( mixed $uploadedFile )
$uploadedFile mixed

size() публичный Метод

Lives in the _file_size attribute of the model.
public size ( ) : integer
Результат integer

updatedAt() публичный Метод

Lives in the _updated_at attribute of the model.
public updatedAt ( ) : string
Результат string

url() публичный Метод

Generates the url to an uploaded file (or a resized version of it).
public url ( string $styleName = '' ) : string
$styleName string
Результат string

Описание свойств

$config защищенное свойство

An instance of the configuration class.
protected AttachmentConfig,Codesleeve\Stapler $config
Результат Codesleeve\Stapler\AttachmentConfig

$instance защищенное свойство

The model instance that the attachment belongs to.
protected StaplerableInterface,Codesleeve\Stapler\ORM $instance
Результат Codesleeve\Stapler\ORM\StaplerableInterface

$interpolator защищенное свойство

An instance of the interpolator class for processing interpolations.
protected Interpolator,Codesleeve\Stapler\Interfaces $interpolator
Результат Codesleeve\Stapler\Interfaces\Interpolator

$queuedForDeletion защищенное свойство

The uploaded/resized files that have been queued up for deletion.
protected array $queuedForDeletion
Результат array

$queuedForWrite защищенное свойство

The uploaded/resized files that have been queued up to be written to storage.
protected array $queuedForWrite
Результат array

$resizer защищенное свойство

An instance of the resizer library that's being used for image processing.
protected Resizer,Codesleeve\Stapler\File\Image $resizer
Результат Codesleeve\Stapler\File\Image\Resizer

$storageDriver защищенное свойство

An instance of the underlying storage driver that is being used.
protected StorageInterface. $storageDriver
Результат StorageInterface.

$uploadedFile защищенное свойство

The uploaded file object for the attachment.
protected File,Codesleeve\Stapler\Interfaces $uploadedFile
Результат Codesleeve\Stapler\Interfaces\File