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


PHP Inspector::classes方法代码示例

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


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

示例1: _closureDef

 /**
  * Helper method for caching closure function references to help the process of building the
  * stack trace.
  *
  * @param  array $frame Backtrace information.
  * @param  callable|string $function The method related to $frame information.
  * @return string Returns either the cached or the fetched closure function reference while
  *                writing its reference to the cache array `$_closureCache`.
  */
 protected static function _closureDef($frame, $function)
 {
     $reference = '::';
     $frame += array('file' => '??', 'line' => '??');
     $cacheKey = "{$frame['file']}@{$frame['line']}";
     if (isset(static::$_closureCache[$cacheKey])) {
         return static::$_closureCache[$cacheKey];
     }
     if ($class = Inspector::classes(array('file' => $frame['file']))) {
         foreach (Inspector::methods(key($class), 'extents') as $method => $extents) {
             $line = $frame['line'];
             if (!($extents[0] <= $line && $line <= $extents[1])) {
                 continue;
             }
             $class = key($class);
             $reference = "{$class}::{$method}";
             $function = "{$reference}()::{closure}";
             break;
         }
     } else {
         $reference = $frame['file'];
         $function = "{$reference}::{closure}";
     }
     $line = static::_definition($reference, $frame['line']) ?: '?';
     $function .= " @ {$line}";
     return static::$_closureCache[$cacheKey] = $function;
 }
开发者ID:unionofrad,项目名称:lithium,代码行数:36,代码来源:Debugger.php

示例2: testClassFileIntrospection

 public function testClassFileIntrospection()
 {
     $result = Inspector::classes(array('file' => __FILE__));
     $this->assertEqual(array(__CLASS__ => __FILE__), $result);
     $result = Inspector::classes(array('file' => __FILE__, 'group' => 'files'));
     $this->assertCount(1, $result);
     $this->assertEqual(__FILE__, key($result));
     $result = Inspector::classes(array('file' => __FILE__, 'group' => 'foo'));
     $this->assertEqual(array(), $result);
 }
开发者ID:fedeisas,项目名称:lithium,代码行数:10,代码来源:InspectorTest.php


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