PHP Class Codesleeve\Stapler\Factories\File

Show file Open project: codesleeve/stapler Class Usage Examples

Protected Properties

Property Type Description
$mimeTypeExtensionGuesser Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesserInterface A instance of Symfony's MIME type extension guesser interface.

Public Methods

Method Description
create ( mixed $file, boolean $testing = false ) : Codesleeve\Stapler\File\UploadedFile Build a Codesleeve\Stapler\UploadedFile object using various file input types.
getMimeTypeExtensionGuesserInstance ( ) : Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesserInterface Return an instance of the Symfony MIME type extension guesser.
setConfigInstance ( Codesleeve\Stapler\Interfaces\Config $config ) Set the configuration object instance.

Protected Methods

Method Description
createFromArray ( array $file, boolean $testing ) : Codesleeve\Stapler\File\File Build a Codesleeve\Stapler\File\File object from the raw php $_FILES array date. We assume here that the $_FILES array has been formated using the Stapler::arrangeFiles utility method.
createFromDataURI ( string $file ) : Codesleeve\Stapler\File\File Compose a \Codesleeve\Stapler\File\UploadedFile object from a data uri.
createFromObject ( Symfony\Component\HttpFoundation\File\UploadedFile $file ) : Codesleeve\Stapler\File\UploadedFile Compose a \Codesleeve\Stapler\File\UploadedFile object from a \Symfony\Component\HttpFoundation\File\UploadedFile object.
createFromString ( string $file ) : Codesleeve\Stapler\File\File Fetch a local file using a string location and convert it into an instance of \Codesleeve\Stapler\File\File.
createFromUrl ( string $file ) : Codesleeve\Stapler\File\File Fetch a remote file using a string URL and convert it into an instance of Codesleeve\Stapler\File\File.

Method Details

create() public static method

Build a Codesleeve\Stapler\UploadedFile object using various file input types.
public static create ( mixed $file, boolean $testing = false ) : Codesleeve\Stapler\File\UploadedFile
$file mixed
$testing boolean
return Codesleeve\Stapler\File\UploadedFile

createFromArray() protected static method

Build a Codesleeve\Stapler\File\File object from the raw php $_FILES array date. We assume here that the $_FILES array has been formated using the Stapler::arrangeFiles utility method.
protected static createFromArray ( array $file, boolean $testing ) : Codesleeve\Stapler\File\File
$file array
$testing boolean
return Codesleeve\Stapler\File\File

createFromDataURI() protected static method

Compose a \Codesleeve\Stapler\File\UploadedFile object from a data uri.
protected static createFromDataURI ( string $file ) : Codesleeve\Stapler\File\File
$file string
return Codesleeve\Stapler\File\File

createFromObject() protected static method

Compose a \Codesleeve\Stapler\File\UploadedFile object from a \Symfony\Component\HttpFoundation\File\UploadedFile object.
protected static createFromObject ( Symfony\Component\HttpFoundation\File\UploadedFile $file ) : Codesleeve\Stapler\File\UploadedFile
$file Symfony\Component\HttpFoundation\File\UploadedFile
return Codesleeve\Stapler\File\UploadedFile

createFromString() protected static method

Fetch a local file using a string location and convert it into an instance of \Codesleeve\Stapler\File\File.
protected static createFromString ( string $file ) : Codesleeve\Stapler\File\File
$file string
return Codesleeve\Stapler\File\File

createFromUrl() protected static method

Fetch a remote file using a string URL and convert it into an instance of Codesleeve\Stapler\File\File.
protected static createFromUrl ( string $file ) : Codesleeve\Stapler\File\File
$file string
return Codesleeve\Stapler\File\File

getMimeTypeExtensionGuesserInstance() public static method

Return an instance of the Symfony MIME type extension guesser.
public static getMimeTypeExtensionGuesserInstance ( ) : Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesserInterface
return Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesserInterface

setConfigInstance() public static method

Set the configuration object instance.
public static setConfigInstance ( Codesleeve\Stapler\Interfaces\Config $config )
$config Codesleeve\Stapler\Interfaces\Config

Property Details

$mimeTypeExtensionGuesser protected static property

A instance of Symfony's MIME type extension guesser interface.
protected static ExtensionGuesserInterface,Symfony\Component\HttpFoundation\File\MimeType $mimeTypeExtensionGuesser
return Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesserInterface