コード例 #1
0
ファイル: debugger.php プロジェクト: xicrow/php-debug
};
$stdClass = new stdClass();
function foo()
{
    Debugger::showTrace();
}
function bar()
{
    foo();
}
Debugger::debug(null);
Debugger::debug(true);
Debugger::debug(false);
Debugger::debug('string');
Debugger::debug(123);
Debugger::debug(123.123);
Debugger::debug([1, 2, 3]);
Debugger::debug($closure);
Debugger::debug($stdClass);
Debugger::debug(fopen('../README.md', 'r'));
Debugger::showTrace();
foo();
bar();
Debugger::debug(Debugger::getCalledFrom());
Debugger::debug(Debugger::getCalledFrom(1));
Debugger::reflectClass('\\Xicrow\\PhpDebug\\Debugger');
Debugger::reflectClassMethod('\\Xicrow\\PhpDebug\\Debugger', 'showTrace');
?>
	</body>
</html>
コード例 #2
0
ファイル: DebuggerTest.php プロジェクト: xicrow/php-debug
 /**
  * @test
  * @covers \Xicrow\PhpDebug\Debugger::getCalledFrom
  * @covers \Xicrow\PhpDebug\Debugger::getCalledFromTrace
  */
 public function testGetCalledFrom()
 {
     $expected = 'string';
     $result = Debugger::getCalledFrom();
     $this->assertInternalType($expected, $result);
     $expected = 'DebuggerTest->testGetCalledFrom';
     $result = Debugger::getCalledFrom(1);
     $this->assertContains($expected, $result);
     $expected = 'Unknown trace with index: 99';
     $result = Debugger::getCalledFrom(99);
     $this->assertContains($expected, $result);
     $expected = 'DebuggerTest.php line 86';
     $result = Debugger::getCalledFromTrace(['file' => __DIR__ . 'DebuggerTest.php', 'line' => 86]);
     $this->assertContains($expected, $result);
     $expected = 'DebuggerTest->testGetCalledFrom';
     $result = Debugger::getCalledFromTrace(['class' => 'DebuggerTest', 'type' => '->', 'function' => 'testGetCalledFrom']);
     $this->assertContains($expected, $result);
 }