$classNames
$classNames :
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;
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)
| string | $name | Class name to instantiate |
A reference to the instance
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.
| string | $name | The class name to be resolved. |
The class name to be used.
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.
| object | $object | The object whose class to check. |
| string | $class | An identifier for the class to require the object to stem from. |
True, if $object belongs to $class.