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


PHP XPClass::detailsForClass方法代码示例

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


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

示例1: loadClass0

 /**
  * Load the class by the specified name
  *
  * @param   string class fully qualified class name io.File
  * @return  string class name
  * @throws  lang.ClassNotFoundException in case the class can not be found
  * @throws  lang.ClassFormatException in case the class format is invalud
  */
 public function loadClass0($class)
 {
     $name = strtr($class, '.', '\\');
     if (isset(\xp::$cl[$class])) {
         return $name;
     }
     // Load class
     \xp::$cl[$class] = nameof($this) . '://' . $this->path;
     \xp::$cll++;
     try {
         $r = (include $this->classUri($class));
     } catch (ClassLoadingException $e) {
         unset(\xp::$cl[$class]);
         \xp::$cll--;
         // If class was declared, but loading threw an exception it means
         // a "soft" dependency, one that is only required at runtime, was
         // not loaded, the class itself has been declared.
         if (class_exists($name, false) || interface_exists($name, false) || trait_exists($name, false)) {
             throw new ClassDependencyException($class, [$this], $e);
         }
         // If otherwise, a "hard" dependency could not be loaded, eg. the
         // base class or a required interface and thus the class could not
         // be declared.
         throw new ClassLinkageException($class, [$this], $e);
     }
     \xp::$cll--;
     if (false === $r) {
         unset(\xp::$cl[$class]);
         $e = new ClassNotFoundException($class, [$this]);
         \xp::gc(__FILE__);
         throw $e;
     } else {
         if (!class_exists($name, false) && !interface_exists($name, false) && !trait_exists($name, false)) {
             $details = XPClass::detailsForClass($class);
             $uri = $this->classUri($class);
             unset(\xp::$cl[$class]);
             if (isset($details['class'])) {
                 $reflect = new \ReflectionClass($details['class'][DETAIL_ARGUMENTS]);
                 \xp::$errors[$uri][$reflect->getStartLine()] = ['' => 1];
                 $e = new ClassFormatException('File does not declare type `' . $class . '`, but `' . strtr($reflect->getName(), '\\', '.') . '`');
                 \xp::gc($uri);
                 throw $e;
             } else {
                 throw new ClassFormatException('Loading `' . $class . '`: No types declared in ' . $this->classUri($class));
             }
         }
     }
     method_exists($name, '__static') && (\xp::$cli[] = [$name, '__static']);
     if (0 === \xp::$cll) {
         $invocations = \xp::$cli;
         \xp::$cli = [];
         foreach ($invocations as $inv) {
             $inv($name);
         }
     }
     return $name;
 }
开发者ID:xp-framework,项目名称:core,代码行数:65,代码来源:AbstractClassLoader.class.php

示例2: canBeCachedViaXpRegistry

 public function canBeCachedViaXpRegistry()
 {
     with(xp::$registry['details.' . ($fixture = 'DummyDetails')] = $details = $this->dummyDetails());
     $actual = XPClass::detailsForClass($fixture);
     unset(xp::$registry['details.' . $fixture]);
     $this->assertEquals($details, $actual);
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:7,代码来源:ClassDetailsTest.class.php


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