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


PHP EE_Error::getMessage方法代码示例

本文整理汇总了PHP中EE_Error::getMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Error::getMessage方法的具体用法?PHP EE_Error::getMessage怎么用?PHP EE_Error::getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EE_Error的用法示例。


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

示例1: _create_object

 /**
  * _create_object
  * Attempts to instantiate the requested class via any of the
  * commonly used instantiation methods employed throughout EE.
  * The priority for instantiation is as follows:
  * 		- abstract classes or any class flagged as "load only" (no instantiation occurs)
  * 	 	- model objects via their 'new_instance_from_db' method
  * 	 	- model objects via their 'new_instance' method
  * 	 	- "singleton" classes" via their 'instance' method
  *  	- standard instantiable classes via their __constructor
  * Prior to instantiation, if the classname exists in the dependency_map,
  * then the constructor for the requested class will be examined to determine
  * if any dependencies exist, and if they can be injected.
  * If so, then those classes will be added to the array of arguments passed to the constructor
  *
  * @access protected
  * @param string $class_name
  * @param array $arguments
  * @param string $type
  * @param bool $from_db
  * @return null | object
  * @throws \EE_Error
  */
 protected function _create_object($class_name, $arguments = array(), $type = '', $from_db = false)
 {
     $class_obj = null;
     // don't give up! you gotta...
     try {
         // create reflection
         $reflector = $this->get_ReflectionClass($class_name);
         // make sure arguments are an array
         $arguments = is_array($arguments) ? $arguments : array($arguments);
         // and if arguments array is numerically and sequentially indexed, then we want it to remain as is,
         // else wrap it in an additional array so that it doesn't get split into multiple parameters
         $arguments = $this->_array_is_numerically_and_sequentially_indexed($arguments) ? $arguments : array($arguments);
         // attempt to inject dependencies ?
         if ($this->_dependency_map->has($class_name)) {
             $arguments = $this->_resolve_dependencies($reflector, $class_name, $arguments);
         }
         // instantiate the class and add to the LIB array for tracking
         // EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db)
         if ($reflector->getConstructor() === null || $reflector->isAbstract()) {
             // no constructor = static methods only... nothing to instantiate, loading file was enough
             //$instantiation_mode = "no constructor";
             $class_obj = true;
         } else {
             if ($from_db && method_exists($class_name, 'new_instance_from_db')) {
                 //$instantiation_mode = "new_instance_from_db";
                 $class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments);
             } else {
                 if (method_exists($class_name, 'new_instance')) {
                     //$instantiation_mode = "new_instance";
                     $class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments);
                 } else {
                     if (method_exists($class_name, 'instance')) {
                         //$instantiation_mode = "instance";
                         $class_obj = call_user_func_array(array($class_name, 'instance'), $arguments);
                     } else {
                         if ($reflector->isInstantiable()) {
                             //$instantiation_mode = "isInstantiable";
                             $class_obj = $reflector->newInstanceArgs($arguments);
                         } else {
                             // heh ? something's not right !
                             //$instantiation_mode = 'none';
                             throw new EE_Error(sprintf(__('The %s file %s could not be instantiated.', 'event_espresso'), $type, $class_name));
                         }
                     }
                 }
             }
         }
     } catch (Exception $e) {
         if (!$e instanceof EE_Error) {
             $e = new EE_Error($e->getMessage());
         }
         $e->get_error();
     }
     return $class_obj;
 }
开发者ID:aaronfrey,项目名称:PepperLillie-GSP,代码行数:78,代码来源:EE_Registry.core.php


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