本文整理汇总了PHP中Cake\Error\Debugger::trimpath方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugger::trimpath方法的具体用法?PHP Debugger::trimpath怎么用?PHP Debugger::trimpath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Error\Debugger
的用法示例。
在下文中一共展示了Debugger::trimpath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
/**
* Start an benchmarking timer.
*
* @param string $name The name of the timer to start.
* @param string $message A message for your timer
* @return boolean Always true
*/
public static function start($name = null, $message = null)
{
$start = microtime(true);
if (!$name) {
$named = false;
$calledFrom = debug_backtrace();
$_name = $name = Debugger::trimpath($calledFrom[0]['file']) . ' line ' . $calledFrom[0]['line'];
} else {
$named = true;
}
if (!$message) {
$message = $name;
}
$_name = $name;
$i = 1;
while (isset(self::$_timers[$name])) {
$i++;
$name = $_name . ' #' . $i;
}
if ($i > 1) {
$message .= ' #' . $i;
}
self::$_timers[$name] = array('start' => $start, 'message' => $message, 'named' => $named);
return true;
}
示例2: record
/**
* Stores a memory point in the internal tracker.
* Takes a optional message name which can be used to identify the memory point.
* If no message is supplied a debug_backtrace will be done to identify the memory point.
*
* @param string $message Message to identify this memory point.
* @return bool
*/
public static function record($message = null)
{
$memoryUse = self::getCurrent();
if (!$message) {
$named = false;
$trace = debug_backtrace();
$message = Debugger::trimpath($trace[0]['file']) . ' line ' . $trace[0]['line'];
}
if (isset(self::$_points[$message])) {
$originalMessage = $message;
$i = 1;
while (isset(self::$_points[$message])) {
$i++;
$message = $originalMessage . ' #' . $i;
}
}
self::$_points[$message] = $memoryUse;
return true;
}