PHP Class ThumbBase, thinksns

This is the base class that all implementations must extend. It contains the core variables and functionality common to all implementations, as well as the functions that allow plugins to augment those classes.
Afficher le fichier Open project: medz/thinksns-4 Class Usage Examples

Protected Properties

Свойство Type Description
$errorMessage string The last error message raised
$fileName string This must include the path to the file (absolute paths recommended)
$format string What the file format is (mime-type)
$hasError boolean Whether or not the current instance has any errors
$imported array An array of imported plugin objects
$importedFunctions array An array of all methods added to this class by imported plugin objects
$isDataStream boolean By "raw file data" it's meant that we're actually passing the result of something like file_get_contents() or perhaps from a database blob
$remoteImage boolean Whether or not the image is hosted remotely

Méthodes publiques

Méthode Description
__call ( string $method, array $args ) Calls plugin / imported functions
__construct ( $fileName, $isDataStream = false ) : ThumbBase Class constructor
getErrorMessage ( ) Returns $errorMessage.
getFileName ( ) Returns $fileName.
getFormat ( ) Returns $format.
getHasError ( ) Returns $hasError.
getImported ( ) : array Returns $imported.
getImportedFunctions ( ) : array Returns $importedFunctions.
importPlugins ( array $registry ) Imports plugins in $registry to the class
setErrorMessage ( object $errorMessage ) Sets $errorMessage.
setFileName ( object $fileName ) Sets $fileName.
setFormat ( object $format ) Sets $format.
setHasError ( object $hasError ) Sets $hasError.

Méthodes protégées

Méthode Description
fileExistsAndReadable ( ) Checks to see if $this->fileName exists and is readable
imports ( string $object ) Imports a plugin
triggerError ( string $errorMessage ) Sets $this->errorMessage to $errorMessage and throws an exception

Method Details

__call() public méthode

This is also where a fair amount of plugins magaic happens. This magic method is called whenever an "undefined" class method is called in code, and we use that to call an imported function. You should NEVER EVER EVER invoke this function manually. The universe will implode if you do... seriously ;)
public __call ( string $method, array $args )
$method string
$args array

__construct() public méthode

Class constructor
public __construct ( $fileName, $isDataStream = false ) : ThumbBase
Résultat ThumbBase

fileExistsAndReadable() protected méthode

Checks to see if $this->fileName exists and is readable
protected fileExistsAndReadable ( )

getErrorMessage() public méthode

Returns $errorMessage.
See also: ThumbBase::$errorMessage
public getErrorMessage ( )

getFileName() public méthode

Returns $fileName.
See also: ThumbBase::$fileName
public getFileName ( )

getFormat() public méthode

Returns $format.
See also: ThumbBase::$format
public getFormat ( )

getHasError() public méthode

Returns $hasError.
See also: ThumbBase::$hasError
public getHasError ( )

getImported() public méthode

Returns $imported.
See also: ThumbBase::$imported
public getImported ( ) : array
Résultat array

getImportedFunctions() public méthode

Returns $importedFunctions.
See also: ThumbBase::$importedFunctions
public getImportedFunctions ( ) : array
Résultat array

importPlugins() public méthode

Imports plugins in $registry to the class
public importPlugins ( array $registry )
$registry array

imports() protected méthode

This is where all the plugins magic happens! This function "loads" the plugin functions, making them available as methods on the class.
protected imports ( string $object )
$object string The name of the object to import / "load"

setErrorMessage() public méthode

Sets $errorMessage.
See also: ThumbBase::$errorMessage
public setErrorMessage ( object $errorMessage )
$errorMessage object

setFileName() public méthode

Sets $fileName.
See also: ThumbBase::$fileName
public setFileName ( object $fileName )
$fileName object

setFormat() public méthode

Sets $format.
See also: ThumbBase::$format
public setFormat ( object $format )
$format object

setHasError() public méthode

Sets $hasError.
See also: ThumbBase::$hasError
public setHasError ( object $hasError )
$hasError object

triggerError() protected méthode

Also sets $this->hasError to true, so even if the exceptions are caught, we don't attempt to proceed with any other functions
protected triggerError ( string $errorMessage )
$errorMessage string

Property Details

$errorMessage protected_oe property

The last error message raised
protected string $errorMessage
Résultat string

$fileName protected_oe property

This must include the path to the file (absolute paths recommended)
protected string $fileName
Résultat string

$format protected_oe property

What the file format is (mime-type)
protected string $format
Résultat string

$hasError protected_oe property

Whether or not the current instance has any errors
protected bool $hasError
Résultat boolean

$imported protected_oe property

An array of imported plugin objects
protected array $imported
Résultat array

$importedFunctions protected_oe property

An array of all methods added to this class by imported plugin objects
protected array $importedFunctions
Résultat array

$isDataStream protected_oe property

By "raw file data" it's meant that we're actually passing the result of something like file_get_contents() or perhaps from a database blob
protected bool $isDataStream
Résultat boolean

$remoteImage protected_oe property

Whether or not the image is hosted remotely
protected bool $remoteImage
Résultat boolean