当前位置: 首页>>代码示例>>PHP>>正文


PHP is_subclass_of函数代码示例

本文整理汇总了PHP中is_subclass_of函数的典型用法代码示例。如果您正苦于以下问题:PHP is_subclass_of函数的具体用法?PHP is_subclass_of怎么用?PHP is_subclass_of使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_subclass_of函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: startup

 /**
  * Override startup of the Shell
  *
  * @return void
  */
 public function startup()
 {
     parent::startup();
     if (isset($this->params['connection'])) {
         $this->connection = $this->params['connection'];
     }
     $class = Configure::read('Acl.classname');
     list($plugin, $class) = pluginSplit($class, true);
     App::uses($class, $plugin . 'Controller/Component/Acl');
     if (!in_array($class, array('DbAcl', 'DB_ACL')) && !is_subclass_of($class, 'DbAcl')) {
         $out = "--------------------------------------------------\n";
         $out .= __d('cake_console', 'Error: Your current Cake configuration is set to an ACL implementation other than DB.') . "\n";
         $out .= __d('cake_console', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script') . "\n";
         $out .= "--------------------------------------------------\n";
         $out .= __d('cake_console', 'Current ACL Classname: %s', $class) . "\n";
         $out .= "--------------------------------------------------\n";
         $this->err($out);
         $this->_stop();
     }
     if ($this->command) {
         if (!config('database')) {
             $this->out(__d('cake_console', 'Your database configuration was not found. Take a moment to create one.'), true);
             $this->args = null;
             return $this->DbConfig->execute();
         }
         require_once APP . 'Config' . DS . 'database.php';
         if (!in_array($this->command, array('initdb'))) {
             $collection = new ComponentCollection();
             $this->Acl = new AclComponent($collection);
             $controller = new Controller();
             $this->Acl->startup($controller);
         }
     }
 }
开发者ID:rednazj,项目名称:Inventory,代码行数:39,代码来源:AclShell.php

示例2: handle

 /**
  * The handler which sets all the values in the dynamic definition.
  *
  * @param String $class the Controller class name
  * @param LaravelSwagger $LS the LaravelSwagger instance.
  * @throws DynamicHandlerException
  */
 public function handle($class, LaravelSwagger $LS)
 {
     /**
      *************************************
      *         Default Behaviour         *
      *************************************
      *
      * Loops through all of the linked keys
      */
     foreach ($this->method->keys() as $key) {
         /** @var mixed $value the value associated with the specific key */
         $value = ValueContainer::getValue($class, $key);
         if (is_string($value)) {
             //if its a string of a class
             //if it is a model that has been registered.
             if (is_subclass_of($value, Model::class) && $LS->hasModel($value)) {
                 $value = "#/definitions/{$value}";
             }
         }
         //if there is no value then throw an exception
         if (is_null($value)) {
             throw new DynamicHandlerException("{$key} value is NULL");
         }
         $this->method->set($key, $value);
     }
 }
开发者ID:kevupton,项目名称:laravel-swagger,代码行数:33,代码来源:DynamicHandler.php

示例3: Auth_OpenID_MDB2Store

 /**
  * This creates a new MDB2Store instance.  It requires an
  * established database connection be given to it, and it allows
  * overriding the default table names.
  *
  * @param connection $connection This must be an established
  * connection to a database of the correct type for the SQLStore
  * subclass you're using.  This must be a PEAR::MDB2 connection
  * handle.
  *
  * @param associations_table: This is an optional parameter to
  * specify the name of the table used for storing associations.
  * The default value is 'oid_associations'.
  *
  * @param nonces_table: This is an optional parameter to specify
  * the name of the table used for storing nonces.  The default
  * value is 'oid_nonces'.
  */
 function Auth_OpenID_MDB2Store($connection, $associations_table = null, $nonces_table = null)
 {
     $this->associations_table_name = "oid_associations";
     $this->nonces_table_name = "oid_nonces";
     // Check the connection object type to be sure it's a PEAR
     // database connection.
     if (!is_object($connection) || !is_subclass_of($connection, 'mdb2_driver_common')) {
         trigger_error("Auth_OpenID_MDB2Store expected PEAR connection " . "object (got " . get_class($connection) . ")", E_USER_ERROR);
         return;
     }
     $this->connection = $connection;
     // Be sure to set the fetch mode so the results are keyed on
     // column name instead of column index.
     $this->connection->setFetchMode(MDB2_FETCHMODE_ASSOC);
     if (@PEAR::isError($this->connection->loadModule('Extended'))) {
         trigger_error("Unable to load MDB2_Extended module", E_USER_ERROR);
         return;
     }
     if ($associations_table) {
         $this->associations_table_name = $associations_table;
     }
     if ($nonces_table) {
         $this->nonces_table_name = $nonces_table;
     }
     $this->max_nonce_age = 6 * 60 * 60;
 }
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:44,代码来源:MDB2Store.php

示例4: XMLAppend

 /**
  * Append any supported $content to $parent
  *
  * @param  DOMNode $parent  Node to append to
  * @param  mixed   $content Content to append
  * @return self
  */
 protected function XMLAppend(\DOMNode &$parent = null, $content = null)
 {
     if (is_null($parent)) {
         $parent = $this->root;
     }
     if (is_string($content) or is_numeric($content) or is_object($content) and method_exists($content, '__toString')) {
         $parent->appendChild($this->createTextNode("{$content}"));
     } elseif (is_object($content) and is_subclass_of($content, '\\DOMNode')) {
         $parent->appendChild($content);
     } elseif (is_array($content) or is_object($content) and $content = get_object_vars($content)) {
         array_map(function ($node, $value) use(&$parent) {
             if (is_string($node)) {
                 if (substr($node, 0, 1) === '@') {
                     $parent->setAttribute(substr($node, 1), $value);
                 } else {
                     $node = $parent->appendChild($this->createElement($node));
                     if (is_string($value)) {
                         $this->XMLAppend($node, $this->createTextNode($value));
                     } else {
                         $this->XMLAppend($node, $value);
                     }
                 }
             } else {
                 $this->XMLAppend($parent, $value);
             }
         }, array_keys($content), array_values($content));
     } elseif (is_bool($content)) {
         $parent->appendChild($this->createTextNode($content ? 'true' : 'false'));
     } else {
         throw new \InvalidArgumentException(sprintf('Unable to append unknown content [%s] to %s', get_class($content), get_class($this)));
     }
     return $this;
 }
开发者ID:KVSun,项目名称:core_api,代码行数:40,代码来源:xmlappend.php

示例5: vB_DataManager_ThreadPost

 /**
  * Constructor - checks that the registry object has been passed correctly.
  *
  * @param	vB_Registry	Instance of the vBulletin data registry object - expected to have the database object as one of its $this->db member.
  * @param	integer		One of the ERRTYPE_x constants
  */
 function vB_DataManager_ThreadPost(&$registry, $errtype = ERRTYPE_STANDARD)
 {
     if (!is_subclass_of($this, 'vB_DataManager_ThreadPost')) {
         trigger_error("Direct Instantiation of vB_DataManager_ThreadPost class prohibited.", E_USER_ERROR);
     }
     parent::vB_DataManager($registry, $errtype);
 }
开发者ID:benyamin20,项目名称:vbregistration,代码行数:13,代码来源:class_dm_threadpost.php

示例6: logQuery

 public function logQuery(Nette\Database\Connection $connection, $result)
 {
     if ($this->disabled) {
         return;
     }
     $this->count++;
     $source = NULL;
     $trace = $result instanceof \PDOException ? $result->getTrace() : debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
     foreach ($trace as $row) {
         if (isset($row['file']) && is_file($row['file']) && !Tracy\Debugger::getBluescreen()->isCollapsed($row['file'])) {
             if (isset($row['function']) && strpos($row['function'], 'call_user_func') === 0 || isset($row['class']) && is_subclass_of($row['class'], '\\Nette\\Database\\Connection')) {
                 continue;
             }
             $source = [$row['file'], (int) $row['line']];
             break;
         }
     }
     if ($result instanceof Nette\Database\ResultSet) {
         $this->totalTime += $result->getTime();
         if ($this->count < $this->maxQueries) {
             $this->queries[] = [$connection, $result->getQueryString(), $result->getParameters(), $source, $result->getTime(), $result->getRowCount(), NULL];
         }
     } elseif ($result instanceof \PDOException && $this->count < $this->maxQueries) {
         $this->queries[] = [$connection, $result->queryString, NULL, $source, NULL, NULL, $result->getMessage()];
     }
 }
开发者ID:ricco24,项目名称:database,代码行数:26,代码来源:ConnectionPanel.php

示例7: registerWidget

 /**
  * Registers widget.
  *
  * @param string $class
  * @throws \yii\base\InvalidParamException
  */
 public function registerWidget($class)
 {
     if (!is_subclass_of($class, $this->widgetBaseClass)) {
         throw new InvalidParamException("Class {$class} must extend {$this->widgetBaseClass}");
     }
     $this->_widgets[] = $class;
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:13,代码来源:LayoutManager.php

示例8: setTableDefinition

 /**
  * Set table definition for Blameable behavior
  *
  * @return void
  */
 public function setTableDefinition()
 {
     if (!$this->_options['columns']['created']['disabled']) {
         $name = $this->_options['columns']['created']['name'];
         if ($this->_options['columns']['created']['alias']) {
             $name .= ' as ' . $this->_options['columns']['created']['alias'];
         }
         $this->hasColumn($name, $this->_options['columns']['created']['type'], $this->_options['columns']['created']['length'], $this->_options['columns']['created']['options']);
     }
     if (!$this->_options['columns']['updated']['disabled']) {
         $name = $this->_options['columns']['updated']['name'];
         if ($this->_options['columns']['updated']['alias']) {
             $name .= ' as ' . $this->_options['columns']['updated']['alias'];
         }
         if ($this->_options['columns']['updated']['onInsert'] !== true && $this->_options['columns']['updated']['options']['notnull'] === true) {
             $this->_options['columns']['updated']['options']['notnull'] = false;
         }
         $this->hasColumn($name, $this->_options['columns']['updated']['type'], $this->_options['columns']['updated']['length'], $this->_options['columns']['updated']['options']);
     }
     $listener = new $this->_options['listener']($this->_options);
     if (get_class($listener) !== 'Doctrine_Template_Listener_DmBlameable' && !is_subclass_of($listener, 'Doctrine_Template_Listener_DmBlameable')) {
         throw new Exception('Invalid listener. Must be Doctrine_Template_Listener_DmBlameable or subclass');
     }
     $this->addListener($listener, 'Blameable');
 }
开发者ID:vjousse,项目名称:diem,代码行数:30,代码来源:DmBlameable.php

示例9: createWithConfig

 /**
  * {@inheritdoc}
  */
 protected function createWithConfig(ContainerInterface $container, $configKey)
 {
     $config = $this->retrieveConfig($container, $configKey, 'driver');
     if (!array_key_exists('class', $config)) {
         throw new OutOfBoundsException('Missing "class" config key');
     }
     if (!is_array($config['paths'])) {
         $config['paths'] = [$config['paths']];
     }
     if (AnnotationDriver::class === $config['class'] || is_subclass_of($config['class'], AnnotationDriver::class)) {
         $this->registerAnnotationLoader();
         $driver = new $config['class'](new CachedReader(new AnnotationReader(), $this->retrieveDependency($container, $config['cache'], 'cache', CacheFactory::class)), $config['paths']);
     } else {
         $driver = new $config['class']($config['paths']);
     }
     if (null !== $config['extension'] && $driver instanceof FileDriver) {
         $locator = $driver->getLocator();
         if (get_class($locator) !== DefaultFileLocator::class) {
             throw new Exception\DomainException(sprintf('File locator must be a concrete instance of %s, got %s', DefaultFileLocator::class, get_class($locator)));
         }
         $driver->setLocator(new DefaultFileLocator($locator->getPaths(), $config['extension']));
     }
     if ($driver instanceof MappingDriverChain) {
         foreach ($config['drivers'] as $namespace => $driverName) {
             if (null === $driverName) {
                 continue;
             }
             $driver->addDriver($this->createWithConfig($container, $driverName), $namespace);
         }
     }
     return $driver;
 }
开发者ID:dasprid,项目名称:container-interop-doctrine,代码行数:35,代码来源:DriverFactory.php

示例10: validateModel

 public function validateModel($attribute, $params)
 {
     if ($this->hasErrors('model')) {
         return;
     }
     $class = @Yii::import($this->model, true);
     if (!is_string($class) || !$this->classExists($class)) {
         $this->addError('model', "Class '{$this->model}' does not exist or has syntax error.");
     } else {
         if (!is_subclass_of($class, 'CActiveRecord')) {
             $this->addError('model', "'{$this->model}' must extend from CActiveRecord.");
         } else {
             $table = CActiveRecord::model($class)->tableSchema;
             if ($table->primaryKey === null) {
                 $this->addError('model', "Table '{$table->name}' does not have a primary key.");
             } else {
                 if (is_array($table->primaryKey)) {
                     $this->addError('model', "Table '{$table->name}' has a composite primary key which is not supported by crud generator.");
                 } else {
                     $this->_modelClass = $class;
                     $this->_table = $table;
                 }
             }
         }
     }
 }
开发者ID:israelCanul,项目名称:Bonanza_V2,代码行数:26,代码来源:CrudCode.php

示例11: init

 /**
  * 初始化分布式分发器
  * 根据分布式算法类型,获取分布式算法的处理器handler。然后根据配置文件,调用分布式算法处理器,做分布式处理的初始化工作
  *
  * @param array $clusterConfig 分布式集群的配置。你可以配置一个集群下的多个组,每个组都是由若干个主从对组成的
  *
  * @return Distributer|Modulo|DistriAbstract
  * @throws \Exception
  */
 public function init(array $clusterConfig = [])
 {
     $distriHandler = null;
     try {
         //根据分布式算法类型,初始化分布式算法处理器
         switch ($this->distriMode) {
             case DistriMode::DIS_CONSISTENT_HASHING:
                 $distriHandler = new ConsistentHashing();
                 break;
             case DistriMode::DIS_MODULO:
                 $distriHandler = new Modulo();
                 break;
         }
         //如果分布式算法处理器合法,则根据配置,做分布式算法处理的初始化工作
         if (is_object($distriHandler) && is_subclass_of($distriHandler, DistriAbstract::class)) {
             //初始化分布式算法处理器
             $distriHandler->init($clusterConfig);
             //将初始化后的分布式算法处理器,添加到当前分布式分发器的handler属性中
             $this->setDistriHandler($distriHandler);
         }
     } catch (\Exception $e) {
         throw $e;
     }
     return $this;
 }
开发者ID:donghongshuai,项目名称:leaf-distributer,代码行数:34,代码来源:Distributer.php

示例12: generateDefaultLayout

 /**
  * Generates a default layout from the desktop layout if available, or from the model's
  * fields otherwise.
  * @param string $type 'form' or 'view'
  * @param string $modelName
  * @return array
  */
 public static function generateDefaultLayout($type, $modelName)
 {
     if ($type === 'form') {
         $layout = FormLayout::model()->findByAttributes(array('model' => ucfirst($modelName), 'defaultForm' => 1, 'scenario' => 'Default'));
     } else {
         $layout = FormLayout::model()->findByAttributes(array('model' => ucfirst($modelName), 'defaultView' => 1, 'scenario' => 'Default'));
     }
     $layoutData = array();
     if ($layout) {
         $layout = CJSON::decode($layout->layout);
         if (isset($layout['sections'])) {
             foreach ($layout['sections'] as $section) {
                 foreach ($section['rows'] as $row) {
                     foreach ($row['cols'] as $col) {
                         foreach ($col['items'] as $item) {
                             if (isset($item['name'])) {
                                 $fieldName = preg_replace('/^formItem_/u', '', $item['name']);
                                 $layoutData[] = $fieldName;
                             }
                         }
                     }
                 }
             }
         }
     } elseif (is_subclass_of($modelName, 'X2Model')) {
         $layoutData = Yii::app()->db->createCommand()->select('fieldName')->from('x2_fields')->where('modelName=:modelName', array(':modelName' => $modelName))->andWhere($type === 'view' ? 'readOnly' : 'true')->queryColumn();
     }
     return $layoutData;
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:36,代码来源:MobileLayouts.php

示例13: extends

 /**
  * @param string $class
  *
  * @return $this|ProxyGuard
  */
 public function extends(string $class)
 {
     if (!is_subclass_of($this->value, $class)) {
         return new ProxyGuard(new ObjectException('%s did not extend %s', get_class($this->value), $class));
     }
     return $this;
 }
开发者ID:dgame,项目名称:php-guard,代码行数:12,代码来源:ObjectGuard.php

示例14: addMenu

    /**
     * Add default menu for module
     * @param string $module
     */
    protected function addMenu($moduleName)
    {
        $menu = array();
        // Create default menu for the module
        $menu[] = array('route' => "#{$moduleName}/create", 'label' => 'LNK_NEW_RECORD', 'acl_action' => 'create', 'acl_module' => $moduleName, 'icon' => 'fa-plus');
        // Handle link to vCard
        $bean = BeanFactory::getBean($moduleName);
        if (is_subclass_of($bean, 'Person')) {
            $vCardRoute = in_array($moduleName, $GLOBALS['bwcModules']) ? '#bwc/index.php?' . http_build_query(array('module' => $moduleName, 'action' => 'ImportVCard')) : "#{$moduleName}/vcard-import";
            $menu[] = array('route' => $vCardRoute, 'label' => 'LNK_IMPORT_VCARD', 'acl_action' => 'create', 'acl_module' => $moduleName, 'icon' => 'fa-plus');
        }
        $menu[] = array('route' => "#{$moduleName}", 'label' => 'LNK_LIST', 'acl_action' => 'list', 'acl_module' => $moduleName, 'icon' => 'fa-bars');
        if ($bean instanceof SugarBean && $bean->importable) {
            $menu[] = array('route' => '#bwc/index.php?' . http_build_query(array('module' => 'Import', 'action' => 'Step1', 'import_module' => $moduleName)), 'label' => 'LNK_IMPORT_' . strtoupper($moduleName), 'acl_action' => 'import', 'acl_module' => $moduleName, 'icon' => 'fa-arrow-circle-o-up');
        }
        $content = <<<END
<?php
/* Created by SugarUpgrader for module {$moduleName} */
\$viewdefs['{$moduleName}']['base']['menu']['header'] =
END;
        $content .= var_export($menu, true) . ";\n";
        $this->ensureDir("modules/{$moduleName}/clients/base/menus/header");
        $this->putFile("modules/{$moduleName}/clients/base/menus/header/header.php", $content);
        $this->log("Added default menu file for {$moduleName}");
    }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:29,代码来源:7_MBMenu.php

示例15: execute

 public function execute(App $app)
 {
     $argv = $app->argv;
     $script = $app->task_name;
     $script = explode('_', $script);
     $cls_file = ucfirst(strtolower(array_pop($script)));
     if (empty($cls_file)) {
         throw new Exception('task.err for run the task for :' . $this->task_name, 1033);
     }
     $path = '';
     $class = '';
     if (!empty($script)) {
         foreach ($script as $p) {
             $p = strtolower($p);
             $path .= $p . DOT;
             $class .= ucfirst($p);
         }
     }
     $class .= $cls_file;
     $path = TASK_PATH . $path;
     $file = $path . $cls_file . '.php';
     Pi::inc(PI_CORE . 'BaseTask.php');
     if (!Pi::inc($file)) {
         throw new Exception('task.err can not load the file :' . $file, 1034);
     }
     if (!class_exists($class)) {
         throw new Exception('task.err can not find the class :' . $class, 1035);
     }
     $cls = new $class();
     if (!is_subclass_of($cls, 'BaseTask')) {
         throw new Exception('task.err the class ' . $class . ' is not the subclass of BaseTask ', 1036);
     }
     $cls->execute($argv);
 }
开发者ID:xtzlyp,项目名称:newpi,代码行数:34,代码来源:TaskProcessPipe.php


注:本文中的is_subclass_of函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。