26 private static $factory = null;
33 self::$factory = $factory;
41 return self::$factory != null;
47 public static function getInstance($name, $dynamicConfiguration=[]) {
49 return self::$factory->getInstance($name, $dynamicConfiguration);
57 return self::$factory->getNewInstance($name, $dynamicConfiguration);
63 public static function getInstanceOf($class, $dynamicConfiguration=[]) {
65 return self::$factory->getInstanceOf($class, $dynamicConfiguration);
73 self::$factory->registerInstance($name, $instance);
81 self::$factory->addInterfaces($interfaces);
87 public static function clear() {
88 if (self::$factory != null) {
89 self::$factory->clear();
91 self::$factory = null;
97 private static function checkConfig() {
98 if (self::$factory == null) {
99 throw new ConfigurationException('No Factory instance provided. Do this by calling the configure() method.');
static getInstanceOf($class, $dynamicConfiguration=[])
Interface for Factory implementations.
ConfigurationException signals an exception in the configuration.
static isConfigured()
Check if the factory is configured.
static getNewInstance($name, $dynamicConfiguration=[])
static getInstance($name, $dynamicConfiguration=[])
static configure(Factory $factory)
Configure the factory.
addInterfaces($interfaces)
ObjectFactory implements the service locator pattern by wrapping a Factory instance and providing sta...
static registerInstance($name, $instance)