本文整理汇总了PHP中lithium\analysis\Inspector::parents方法的典型用法代码示例。如果您正苦于以下问题:PHP Inspector::parents方法的具体用法?PHP Inspector::parents怎么用?PHP Inspector::parents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lithium\analysis\Inspector
的用法示例。
在下文中一共展示了Inspector::parents方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testClassParents
/**
* Tests getting a list of parent classes from an object or string class name.
*/
public function testClassParents()
{
$result = Inspector::parents($this);
$this->assertEqual('lithium\\test\\Unit', current($result));
$result2 = Inspector::parents(__CLASS__);
$this->assertEqual($result2, $result);
$this->assertFalse(Inspector::parents('lithium\\core\\Foo', array('autoLoad' => false)));
}
示例2: _reportException
/**
* Convert an exception object to an exception result array for test reporting.
*
* @param array $exception The exception data to report on. Statistics are gathered and
* added to the reporting stack contained in `Unit::$_results`.
* @param string $lineFlag
* @return void
* @todo Refactor so that reporters handle trace formatting.
*/
protected function _reportException($exception, $lineFlag = null)
{
$message = $exception['message'];
$isExpected = ($exp = end($this->_expected)) && ($exp === true || $exp === $message || Validator::isRegex($exp) && preg_match($exp, $message));
if ($isExpected) {
return array_pop($this->_expected);
}
$initFrame = current($exception['trace']) + array('class' => '-', 'function' => '-');
foreach ($exception['trace'] as $frame) {
if (isset($scopedFrame)) {
break;
}
if (!class_exists('lithium\\analysis\\Inspector')) {
continue;
}
if (isset($frame['class']) && in_array($frame['class'], Inspector::parents($this))) {
$scopedFrame = $frame;
}
}
if (class_exists('lithium\\analysis\\Debugger')) {
$exception['trace'] = Debugger::trace(array('trace' => $exception['trace'], 'format' => '{:functionRef}, line {:line}', 'includeScope' => false, 'scope' => array_filter(array('functionRef' => __NAMESPACE__ . '\\{closure}', 'line' => $lineFlag))));
}
$this->_result('exception', $exception + array('class' => $initFrame['class'], 'method' => $initFrame['function']));
}
示例3: _reportException
/**
* Convert an exception object to an exception result array for test reporting.
*
* @param object $exception The exception object to report on. Statistics are gathered and
* added to the reporting stack contained in `Unit::$_results`.
* @param string $lineFlag
* @return void
* @todo Refactor so that reporters handle trace formatting.
*/
protected function _reportException($exception, $lineFlag = null)
{
$initFrame = current($exception['trace']) + array('class' => '-', 'function' => '-');
foreach ($exception['trace'] as $frame) {
if (isset($scopedFrame)) {
break;
}
if (!class_exists('lithium\\analysis\\Inspector')) {
continue;
}
if (isset($frame['class']) && in_array($frame['class'], Inspector::parents($this))) {
$scopedFrame = $frame;
}
}
$trace = $exception['trace'];
unset($exception['trace']);
$this->_result('exception', $exception + array('class' => $initFrame['class'], 'method' => $initFrame['function'], 'trace' => Debugger::trace(array('trace' => $trace, 'format' => '{:functionRef}, line {:line}', 'includeScope' => false, 'scope' => array_filter(array('functionRef' => __NAMESPACE__ . '\\{closure}', 'line' => $lineFlag))))));
}