Checks whether or not a factory alias exists.
public static factoryExists ( string $Alias ) : boolean | ||
$Alias | string | The alias of the factory to check for. |
리턴 | boolean | Whether or not a factory definintion exists. |
/** * */ public function getImports() { if (!isset($this->Uses) || !is_array($this->Uses)) { return; } // Load any classes in the uses array and make them properties of this class foreach ($this->Uses as $Class) { if (strlen($Class) >= 4 && substr_compare($Class, 'Gdn_', 0, 4) == 0) { $Property = substr($Class, 4); } else { $Property = $Class; } // Find the class and instantiate an instance.. if (Gdn::factoryExists($Property)) { $this->{$Property} = Gdn::Factory($Property); } if (Gdn::factoryExists($Class)) { // Instantiate from the factory. $this->{$Property} = Gdn::factory($Class); } elseif (class_exists($Class)) { // Instantiate as an object. $ReflectionClass = new ReflectionClass($Class); // Is this class a singleton? if ($ReflectionClass->implementsInterface("ISingleton")) { eval('$this->' . $Property . ' = ' . $Class . '::GetInstance();'); } else { $this->{$Property} = new $Class(); } } else { trigger_error(errorMessage('The "' . $Class . '" class could not be found.', $this->ClassName, '__construct'), E_USER_ERROR); } } }