• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_parent_class函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: classUses

 /**
  * 
  * @param mixed $class
  * @param string $trait
  * @param boolean $recursive
  * @return boolean
  */
 public static function classUses($class, $trait, $recursive = true)
 {
     if (!\is_object($class) && !\is_string($class)) {
         return false;
     }
     $traits = \class_uses($class);
     if ($recursive) {
         $parent = \get_parent_class($class);
         while ($parent !== false) {
             $traits = \array_merge($traits, \class_uses($parent));
             $parent = \get_parent_class($parent);
         }
     }
     if (!is_array($trait)) {
         $trait = (array) $trait;
     }
     foreach ($traits as $k => $t) {
         if (\in_array($t, $trait)) {
             return true;
         }
         if (self::classUses($t, $trait)) {
             return true;
         }
         unset($traits[$k]);
     }
     return false;
 }
开发者ID:jgswift,项目名称:qtil,代码行数:34,代码来源:ReflectorUtil.php


示例2: _connectDB

 /**
  * Connect to database by using the given DSN string
  *
  * @author  copied from PEAR::Auth, Martin Jansen, slightly modified
  * @access private
  * @param  string DSN string
  * @return mixed  Object on error, otherwise bool
  */
 function _connectDB($dsn)
 {
     // only include the db if one really wants to connect
     require_once 'DB.php';
     if (is_string($dsn) || is_array($dsn)) {
         // put the dsn parameters in an array
         // DB would be confused with an additional URL-queries, like ?table=...
         // so we do it before connecting to the DB
         if (is_string($dsn)) {
             $dsn = DB::parseDSN($dsn);
         }
         $this->dbh = DB::Connect($dsn);
     } else {
         if (get_parent_class($dsn) == "db_common") {
             $this->dbh = $dsn;
         } else {
             if (is_object($dsn) && DB::isError($dsn)) {
                 return new DB_Error($dsn->code, PEAR_ERROR_DIE);
             } else {
                 return new PEAR_Error("The given dsn was not valid in file " . __FILE__ . " at line " . __LINE__, 41, PEAR_ERROR_RETURN, null, null);
             }
         }
     }
     if (DB::isError($this->dbh)) {
         return new DB_Error($this->dbh->code, PEAR_ERROR_DIE);
     }
     return true;
 }
开发者ID:Esleelkartea,项目名称:kz-adeada-talleres-electricos-,代码行数:36,代码来源:OptionsDB.php


示例3: merge

 public function merge($input1, $input2, $output = 'object')
 {
     if (method_exists($this, 'toObject') && method_exists($this, 'toArray')) {
         if (is_object($input1) && is_object($input2)) {
             $ar1 = $this->toArray($input1);
             $ar2 = $this->toArray($input2);
             $result = array_merge($ar1, $ar2);
         } elseif (is_object($input1) && is_array($input2)) {
             $ar1 = $this->toArray($input1);
             $result = array_merge($ar1, $input2);
         } elseif (is_array($input1) && is_object($input2)) {
             $ar2 = $this->toArray($input2);
             $result = array_merge($input1, $ar2);
         } elseif (is_array($input1) && is_array($input2)) {
             $result = array_merge($input1, $input2);
         }
         if (isset($result)) {
             return $output == 'object' ? $this->toObject($result) : $result;
         } else {
             throw new Exception(get_parent_class($this) . ' - SxCms_BaseMapper: merge failed! Incorrect $input1 and/or $input2');
             return null;
         }
     } else {
         throw new Exception(get_parent_class($this) . ' - SxCms_BaseMapper: methods toObject and toArray are required for merge!');
         return null;
     }
 }
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:27,代码来源:BaseMapper.php


示例4: _beforeToHtml

 protected function _beforeToHtml()
 {
     Mage::helper('wordpress')->log($this->__('%s has been deprecated; please use %s', get_class($this), get_parent_class($this)));
     $this->setTemplate('wordpress/sidebar/widget/archives.phtml');
     $this->setTitle($this->__('Archives'));
     return parent::_beforeToHtml();
 }
开发者ID:jokusafet,项目名称:MagentoSource,代码行数:7,代码来源:List.php


示例5: __construct

 public function __construct($config = array())
 {
     // Only run this constructor on main library load
     if (get_parent_class($this) !== FALSE) {
         return;
     }
     foreach ($config as $key => $val) {
         $this->{'_' . $key} = $val;
     }
     log_message('debug', 'Migrations class initialized');
     // Are they trying to use migrations while it is disabled?
     if ($this->_migration_enabled !== TRUE) {
         show_error('Migrations has been loaded but is disabled or set up incorrectly.');
     }
     // If not set, set it
     $this->_migration_path == '' and $this->_migration_path = APPPATH . 'migrations/';
     // Add trailing slash if not set
     $this->_migration_path = rtrim($this->_migration_path, '/') . '/';
     // Load migration language
     $this->lang->load('migration');
     // They'll probably be using dbforge
     $this->load->dbforge();
     // If the migrations table is missing, make it
     if (!$this->db->table_exists('migrations')) {
         $this->dbforge->add_field(array('version' => array('type' => 'INT', 'constraint' => 3)));
         $this->dbforge->create_table('migrations', TRUE);
         $this->db->insert('migrations', array('version' => 0));
     }
 }
开发者ID:ashanrupasinghe,项目名称:2015-12-03-from_server_all_pdf_OK,代码行数:29,代码来源:Migration.php


示例6: ADOdbDB

 function ADOdbDB($libraryPath, $dbType, $preferredResType = ANYDB_RES_ASSOC)
 {
     $par = get_parent_class($this);
     $this->{$par}($libraryPath, $dbType, $preferredResType);
     $this->_id = 'ADODB';
     require_once $this->_path . 'adodb.inc.php';
 }
开发者ID:jsan4christ,项目名称:idrc-uganda-site,代码行数:7,代码来源:ADOdbDB.php


示例7: __wakeup

 public function __wakeup()
 {
     $this->pluginLocator = \Magento\Framework\App\ObjectManager::getInstance();
     $this->pluginList = $this->pluginLocator->get('Magento\\Framework\\Interception\\PluginList');
     $this->chain = $this->pluginLocator->get('Magento\\Framework\\Interception\\Chain');
     $this->subjectType = get_parent_class($this);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:7,代码来源:SourceClassWithNamespaceInterceptor.php


示例8: requireDefaultRecords

 /**
  *	The process to automatically construct data object output configurations, executed on project build.
  */
 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     // Grab the list of data objects that have been completely removed.
     foreach (DB::getConn()->tableList() as $table) {
         // Delete existing output configurations for these data objects.
         if (!class_exists($table)) {
             $existing = DataObjectOutputConfiguration::get_one('DataObjectOutputConfiguration', "IsFor = '" . Convert::raw2sql($table) . "'");
             $this->deleteConfiguration($table, $existing);
         }
     }
     // Grab the list of all data object types, along with any inclusions/exclusions defined.
     $objects = ClassInfo::subclassesFor('DataObject');
     $inclusions = self::$custom_inclusions;
     $exclusions = array_unique(array_merge(self::$exclusions, self::$custom_exclusions));
     // Check existing output configurations for these data objects.
     foreach ($objects as $object) {
         $existing = DataObjectOutputConfiguration::get_one('DataObjectOutputConfiguration', "IsFor = '" . Convert::raw2sql($object) . "'");
         // Delete existing output configurations for invalid data objects, or for those excluded.
         if ($existing && (self::$disabled || get_parent_class($object) !== 'DataObject' || ClassInfo::classImplements($object, 'TestOnly') || count($inclusions) > 0 && !in_array($object, $inclusions) || count($inclusions) === 0 && in_array($object, $exclusions))) {
             $this->deleteConfiguration($object, $existing);
         } else {
             if (!$existing && !self::$disabled && get_parent_class($object) === 'DataObject' && !ClassInfo::classImplements($object, 'TestOnly') && (count($inclusions) > 0 && in_array($object, $inclusions) || count($inclusions) === 0 && !in_array($object, $exclusions))) {
                 $this->addConfiguration($object);
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:nglasl-silverstripe-apiwesome,代码行数:31,代码来源:DataObjectOutputConfiguration.php


示例9: generate_inner_html

 function generate_inner_html($links)
 {
     if (empty($links)) {
         $this->sort_by = FALSE;
     }
     $inner_template = NULL;
     switch ($this->mode) {
         case SORT_BY:
             $inner_template = PA::$blockmodule_path . '/' . (get_parent_class($this) ? get_parent_class($this) : get_class($this)) . '/cnmodule_sortby.php';
             break;
         default:
             $inner_template = PA::$blockmodule_path . '/' . (get_parent_class($this) ? get_parent_class($this) : get_class($this)) . '/cnmodule.php';
     }
     $obj_inner_template = new Template($inner_template);
     $obj_inner_template->set('links', $links);
     $obj_inner_template->set('block_name', $this->html_block_id);
     if (!empty($this->sort_by)) {
         $obj_inner_template->set('sort_by', $this->sort_by);
         $obj_inner_template->set('sorting_options', $this->sorting_options);
         $obj_inner_template->set('selected_option', $this->selected_option);
     }
     $obj_inner_template->set('current_theme_path', PA::$theme_url);
     $inner_html = $obj_inner_template->fetch();
     return $inner_html;
 }
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:25,代码来源:CNGroupModule.php


示例10: prefix

 public function prefix($model_prefix = null, $use_as_full = false)
 {
     // Se for uma string, é uma alteração de prefixo
     if (is_string($model_prefix)) {
         // Se precisar usar como prefixo completo, apenas altera
         if ($use_as_full === true) {
             $this->_prefix = $this->_prefix_full = $model_prefix;
         } else {
             $this->_prefix = $model_prefix;
             $this->_prefix_full = $this->prefix() . $model_prefix;
         }
     } else {
         // Se for necessário o prefixo completo (prefix())
         if ($model_prefix !== false) {
             // Se o prefixo completo não foi definido, define...
             if ($this->_prefix_full === null) {
                 $parent_class = get_parent_class($this);
                 // Se o parent for um core_model, retorna null
                 if ($parent_class === 'core_model') {
                     return null;
                 }
                 // Se não, será necessário carregar a classe
                 $parent_class = self::_get_instance($parent_class);
                 $this->_prefix_full = $parent_class->prefix();
             }
             return $this->_prefix_full;
         }
         // Senão, retorna somente o prefixo (prefix(false))
         return $this->_prefix;
     }
 }
开发者ID:rentalhost,项目名称:core,代码行数:31,代码来源:core_model.php


示例11: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Place the tabs and actions blocks as various tests use them.
     $this->drupalPlaceBlock('local_actions_block');
     $this->drupalPlaceBlock('local_tasks_block');
     // Collect admin permissions.
     $class = get_class($this);
     $adminPermissions = [];
     while ($class) {
         if (property_exists($class, 'adminPermissions')) {
             $adminPermissions = array_merge($adminPermissions, $class::$adminPermissions);
         }
         $class = get_parent_class($class);
     }
     // Enable a random selection of 8 countries so we're not always
     // testing with US and CA.
     $countries = \Drupal::service('country_manager')->getAvailableList();
     $country_ids = array_rand($countries, 8);
     foreach ($country_ids as $country_id) {
         // Don't use the country UI, we're not testing that here...
         Country::load($country_id)->enable()->save();
     }
     // Last one of the 8 gets to be the store default country.
     \Drupal::configFactory()->getEditable('uc_store.settings')->set('address.country', $country_id)->save();
     // Create a store administrator user account.
     $this->adminUser = $this->drupalCreateUser($adminPermissions);
     // Create a test product.
     $this->product = $this->createProduct(array('uid' => $this->adminUser->id(), 'promote' => 0));
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:33,代码来源:UbercartTestBase.php


示例12: __invoke

 /**
  * Render the output of a recommendation module.
  *
  * @param \VuFind\Recommend\RecommendInterface $recommend The recommendation
  * object to render
  *
  * @return string
  */
 public function __invoke($recommend)
 {
     // Set up the rendering context:
     $contextHelper = $this->getView()->plugin('context');
     $oldContext = $contextHelper($this->getView())->apply(['recommend' => $recommend]);
     // Get the current recommendation module's class name, then start a loop
     // in case we need to use a parent class' name to find the appropriate
     // template.
     $className = get_class($recommend);
     $resolver = $this->getView()->resolver();
     while (true) {
         // Guess the template name for the current class:
         $classParts = explode('\\', $className);
         $template = 'Recommend/' . array_pop($classParts) . '.phtml';
         if ($resolver->resolve($template)) {
             // Try to render the template....
             $html = $this->getView()->render($template);
             $contextHelper($this->getView())->restore($oldContext);
             return $html;
         } else {
             // If the template doesn't exist, let's see if we can inherit a
             // template from a parent recommendation class:
             $className = get_parent_class($className);
             if (empty($className)) {
                 // No more parent classes left to try?  Throw an exception!
                 throw new RuntimeException('Cannot find template for recommendation class: ' . get_class($recommend));
             }
         }
     }
 }
开发者ID:bbeckman,项目名称:NDL-VuFind2,代码行数:38,代码来源:Recommend.php


示例13: __construct

 public function __construct(InputInterface $input, OutputInterface $output)
 {
     parent::__construct($input, $output);
     $ref = new \ReflectionProperty(get_parent_class($this), 'lineLength');
     $ref->setAccessible(true);
     $ref->setValue($this, 120);
 }
开发者ID:christengc,项目名称:wheel,代码行数:7,代码来源:SymfonyStyleTest.php


示例14: createTable

 public function createTable($table, $fields = null, $indexes = null, $options = null, $advancedOptions = null)
 {
     $fieldSchemas = $indexSchemas = "";
     if (!empty($options[self::ID])) {
         $addOptions = $options[self::ID];
     } elseif (!empty($options[get_class($this)])) {
         Deprecation::notice('3.2', 'Use MySQLSchemaManager::ID for referencing mysql-specific table creation options');
         $addOptions = $options[get_class($this)];
     } elseif (!empty($options[get_parent_class($this)])) {
         Deprecation::notice('3.2', 'Use MySQLSchemaManager::ID for referencing mysql-specific table creation options');
         $addOptions = $options[get_parent_class($this)];
     } else {
         $addOptions = "ENGINE=InnoDB";
     }
     if (!isset($fields['ID'])) {
         $fields['ID'] = "int(11) not null auto_increment";
     }
     if ($fields) {
         foreach ($fields as $k => $v) {
             $fieldSchemas .= "\"{$k}\" {$v},\n";
         }
     }
     if ($indexes) {
         foreach ($indexes as $k => $v) {
             $indexSchemas .= $this->getIndexSqlDefinition($k, $v) . ",\n";
         }
     }
     // Switch to "CREATE TEMPORARY TABLE" for temporary tables
     $temporary = empty($options['temporary']) ? "" : "TEMPORARY";
     $this->query("CREATE {$temporary} TABLE \"{$table}\" (\n\t\t\t\t{$fieldSchemas}\n\t\t\t\t{$indexSchemas}\n\t\t\t\tprimary key (ID)\n\t\t\t) {$addOptions}");
     return $table;
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:32,代码来源:MySQLSchemaManager.php


示例15: fillClassInstance

 private function fillClassInstance($instance, $data)
 {
     $instantiator = $this;
     $valueProcessor = function ($value) use(&$valueProcessor, $instantiator) {
         if ($value instanceof ArrayedObject) {
             $value = $instantiator->instantiate($value);
         }
         if (is_array($value)) {
             foreach ($value as &$innerValue) {
                 $innerValue = $valueProcessor($innerValue);
             }
         }
         return $value;
     };
     $setObjectVarsClosure = function ($data, $class, &$valueProcessor) {
         foreach ($data as $property => $value) {
             if (property_exists($class, $property)) {
                 $value = $valueProcessor($value);
                 $this->{$property} = $value;
             }
         }
     };
     $class = get_class($instance);
     do {
         $bindedSetObjectVarsClosure = \Closure::bind($setObjectVarsClosure, $instance, $class);
         $bindedSetObjectVarsClosure($data, $class, $valueProcessor);
     } while ($class = get_parent_class($class));
 }
开发者ID:jimmyoak,项目名称:arrayed-object,代码行数:28,代码来源:ArrayedObjectInstantiator.php


示例16: __construct

 public function __construct()
 {
     if (get_parent_class()) {
         parent::__construct();
     }
     $this->callMethod('api_');
 }
开发者ID:iam-decoder,项目名称:rest_server,代码行数:7,代码来源:api.php


示例17: format_controller_methods

 private function format_controller_methods($path, $file)
 {
     $this->load->helper("url");
     $controller = array();
     // only show php files
     if (($extension = substr($file, strrpos($file, ".") + 1)) == "php") {
         // include the class
         include_once $path . "/" . $file;
         $parts = explode(".", $file);
         $class_lower = $parts["0"];
         $class = ucfirst($class_lower);
         // check if a class actually exists
         if (class_exists($class) and get_parent_class($class) == "MY_Controller") {
             // get a list of all methods
             $controller["name"] = $class;
             $controller["path"] = base_url() . $class_lower;
             $controller["methods"] = array();
             // get a list of all public methods
             foreach (get_class_methods($class) as $method) {
                 $reflect = new ReflectionMethod($class, $method);
                 if ($reflect->isPublic()) {
                     // ignore some methods
                     $object = new $class();
                     if (!in_array($method, $object->internal_methods)) {
                         $method_array = array();
                         $method_array["name"] = $method;
                         $method_array["path"] = base_url() . $class_lower . "/" . $method;
                         $controller["methods"][] = $method_array;
                     }
                 }
             }
         }
     }
     return $controller;
 }
开发者ID:MaizerGomes,项目名称:api,代码行数:35,代码来源:contents.php


示例18: __destruct

 /**
  * Saves any current addresses to session
  */
 public function __destruct()
 {
     Mage::getSingleton('avatax/session')->setAddresses($this->_cache);
     if (method_exists(get_parent_class(), '__destruct')) {
         parent::__destruct();
     }
 }
开发者ID:onepica,项目名称:avatax,代码行数:10,代码来源:Address.php


示例19: setEntity

 public function setEntity($entity)
 {
     $this->entity = $entity;
     $this->metaData = $this->manager->getClassMetadata($entity)->getMetadata()[0];
     $parent = get_parent_class($this->metaData->rootEntityName);
     $this->parentMetaData = $this->manager->getClassMetadata($parent)->getMetadata()[0];
 }
开发者ID:gcob,项目名称:esvit-ng-table-for-symfony,代码行数:7,代码来源:GenerateNgTable.php


示例20: updateEntity

 /**
  * @param EntityConfigEvent $event
  */
 public function updateEntity(EntityConfigEvent $event)
 {
     $className = $event->getClassName();
     $parentClassName = get_parent_class($className);
     if (!$parentClassName) {
         return;
     }
     if (ExtendHelper::isExtendEntityProxy($parentClassName)) {
         // When application is installed parent class will be replaced (via class_alias)
         $extendClass = $parentClassName;
     } else {
         // During install parent class is not replaced (via class_alias)
         $shortClassName = ExtendHelper::getShortClassName($className);
         if (ExtendHelper::getShortClassName($parentClassName) !== 'Extend' . $shortClassName) {
             return;
         }
         $extendClass = ExtendHelper::getExtendEntityProxyClassName($parentClassName);
     }
     $configManager = $event->getConfigManager();
     $config = $configManager->getProvider('extend')->getConfig($className);
     $hasChanges = false;
     if (!$config->is('is_extend')) {
         $config->set('is_extend', true);
         $hasChanges = true;
     }
     if (!$config->is('extend_class', $extendClass)) {
         $config->set('extend_class', $extendClass);
         $hasChanges = true;
     }
     if ($hasChanges) {
         $configManager->persist($config);
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:36,代码来源:EntityConfigListener.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_parent_contextid函数代码示例发布时间:2022-05-15
下一篇:
PHP get_parent_cats函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap