本文整理汇总了PHP中Loader::classExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::classExists方法的具体用法?PHP Loader::classExists怎么用?PHP Loader::classExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::classExists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getWriter
/**
* Get the instance of class "FileWriter" of the file
*
* @param boolean $append
* @return FileWriter
*/
public function getWriter($append = false)
{
if (!Loader::classExists('FileWriter')) {
Loader::load('FileWriter', 'utility');
}
$writer = new FileWriter($this->_path);
return $writer;
}
示例2: createLayout
/**
* Create and return form layout element
*
* @param string $layoutTagName
* @return FormLayoutAbstract
* @throws FileNotExistException
*/
public function createLayout($layoutTagName)
{
$layoutClassName = NameManager::toClass('form_layout_' . trim(strtolower($layoutTagName)));
if (!Loader::classExists($layoutClassName)) {
$result = Loader::load($layoutClassName, 'html', true, false);
if ($result == false) {
$result = Loader::loadLibrary($layoutClassName);
if ($result == false) {
$fileName = NameManager::toPhpFile($layoutClassName);
require_once 'exception/file_not_exist_exception.php';
throw new FileNotExistException($fileName);
}
}
}
$layoutInstance = new $layoutClassName($this);
return $layoutInstance;
}
示例3: _connect
/**
* Create connection instance that extends PDO
*
* @return DbAdapterAbstract
* @throws Exception
*/
protected static function _connect()
{
$snake = 'db_adapter_' . strtolower(self::$_config['type']);
$adapterName = NameManager::toClass($snake);
Loader::load($adapterName, 'db');
if (!Loader::classExists($adapterName)) {
throw new ClassUndefinedException($adapterName);
}
$instance = new $adapterName(self::$_config);
return $instance;
}
示例4: _searchErrorHandler
/**
* Search error handler class and return its instance
*
* @param string $subdir
* @return ErrorHandlerStandard
*/
protected function _searchErrorHandler($subdir)
{
$controllerDir = PathManager::getControllerDirectory();
$dirs = array();
if ($subdir != '') {
$dirs = explode('/', trim($subdir, '/'));
}
$handler = null;
$path = '';
while (true) {
$path = $controllerDir;
if (count($dirs) > 0) {
$path .= '/' . implode('/', $dirs);
}
if (file_exists($path . '/error_handler.php')) {
require_once $path . '/error_handler.php';
$className = NameManager::toClass(implode('_', $dirs) . '_error_handler');
if (Loader::classExists($className)) {
$handler = new $className();
break;
} else {
if (Loader::classExists('ErrorHandler')) {
$handler = new ErrorHandler();
break;
}
}
}
if ($path == $controllerDir) {
break;
}
array_pop($dirs);
}
if (!$handler instanceof ErrorHandlerStandard) {
$handler = new ErrorHandlerStandard();
}
return $handler;
}
示例5: setException
/**
* Set the exception instance
*
* @param Exception $exception
* @return void
*/
public function setException($exception)
{
$this->exception = $exception;
if (Loader::classExists('Logger') && self::$_logKey) {
Logger::except($exception, self::$_logKey);
}
}