$index = 0;
}
} else {
- $index = max(0, intval($input->getOption('ex')) - 1);
+ $index = \max(0, \intval($input->getOption('ex')) - 1);
}
$trace = $exception->getTrace();
- array_unshift($trace, [
+ \array_unshift($trace, [
'file' => $exception->getFile(),
'line' => $exception->getLine(),
]);
- if ($index >= count($trace)) {
+ if ($index >= \count($trace)) {
$index = 0;
}
$file = isset($trace[$index]['file']) ? $this->replaceCwd($trace[$index]['file']) : 'n/a';
$line = isset($trace[$index]['line']) ? $trace[$index]['line'] : 'n/a';
- $output->writeln(sprintf(
+ $output->writeln(\sprintf(
'From <info>%s:%d</info> at <strong>level %d</strong> of backtrace (of %d).',
OutputFormatter::escape($file),
OutputFormatter::escape($line),
$index + 1,
- count($trace)
+ \count($trace)
));
}
private function replaceCwd($file)
{
- if ($cwd = getcwd()) {
- $cwd = rtrim($cwd, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
+ if ($cwd = \getcwd()) {
+ $cwd = \rtrim($cwd, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
}
if ($cwd === false) {
return $file;
} else {
- return preg_replace('/^' . preg_quote($cwd, '/') . '/', '', $file);
+ return \preg_replace('/^' . \preg_quote($cwd, '/') . '/', '', $file);
}
}
$line = $trace[$index]['line'];
}
- if (is_file($file)) {
- $code = @file_get_contents($file);
+ if (\is_file($file)) {
+ $code = @\file_get_contents($file);
}
if (empty($code)) {
$line = $context['line'];
}
- if (is_file($file)) {
+ if (\is_file($file)) {
$vars['__file'] = $file;
if (isset($line)) {
$vars['__line'] = $line;
}
- $vars['__dir'] = dirname($file);
+ $vars['__dir'] = \dirname($file);
}
}
private function extractEvalFileAndLine($file)
{
- if (preg_match('/(.*)\\((\\d+)\\) : eval\\(\\)\'d code$/', $file, $matches)) {
+ if (\preg_match('/(.*)\\((\\d+)\\) : eval\\(\\)\'d code$/', $file, $matches)) {
return [$matches[1], $matches[2]];
}
}