\FACTFinderLoader

Responsible for auto loading and instance creation. Please instantiate all library classes through this loader, as it automatically takes care of overriding library implementations with custom ones.

For convenience, you can alias this class with FF in your source files like: use FACTFinder\Loader as FF;

Summary

Methods
Properties
Constants
autoload()
getInstance()
getClassName()
isInstanceOf()
disableCustomClasses()
No public properties found
No constants found
No protected methods found
$classNames
$loadCustomClasses
N/A
getFilename()
No private properties found
N/A

Properties

$classNames

$classNames : 

Type

$loadCustomClasses

$loadCustomClasses : 

Type

Methods

autoload()

autoload(  $classname) 

Parameters

$classname

getInstance()

getInstance(string  $name) : object

Creates an instance of a class taking into account classes within the "FACTFinder\Custom\" namespace instead of "FACTFinder\".

Note that classes in the \Custom namespace should inherit the class they overwrite - otherwise some of the type hinting within the library might break. USE THIS method instead of the PHP "new" keyword for all classes from this library. Eg. instead of "$obj = new myclass;", you should use "$obj = FACTFinder\Loader::getInstance("myclass")"! You can also pass arguments for a constructor: Loader::getInstance('myClass', $arg1, $arg2, ..., $argN)

Parameters

string $name

Class name to instantiate

Returns

object —

A reference to the instance

getClassName()

getClassName(string  $name) : string

Expects a fully qualified class name. if the leading namespace is omitted or "FACTFinder", we first check whether there is a custom class in namespace "FACTFinder\Custom\", then we look in "FACTFinder\". If none of them exist, it also checks if the name is the class name itself.

Note that classes in the \Custom namespace should inherit the class they overwrite - otherwise some of the type hinting within the library might break.

Parameters

string $name

The class name to be resolved.

Returns

string —

The class name to be used.

isInstanceOf()

isInstanceOf(object  $object, string  $class) : boolean

This a convenient wrapper around instanceof or is_a() when dealing with library classes.

Instead of a class name it expects an identifier like getClassName() or getInstance() does, and checks that the object passed is actually of the class that is currently in use for this identifier.

Parameters

object $object

The object whose class to check.

string $class

An identifier for the class to require the object to stem from.

Returns

boolean —

True, if $object belongs to $class.

disableCustomClasses()

disableCustomClasses() 

It may happen that your application's autoloader is not compatible with this one due to the custom class loading feature.

This method disables the loading of custom classes.

getFilename()

getFilename(  $classname) 

Parameters

$classname