PMCORE-3845 Check and made the recommend changes in the Laravel upgrade guide
This commit is contained in:
committed by
Mauricio Veliz
parent
6d1d7d752e
commit
d0c5a23d67
112
thirdparty/pake/pakeException.class.php
vendored
112
thirdparty/pake/pakeException.class.php
vendored
@@ -19,73 +19,69 @@
|
||||
*/
|
||||
class pakeException extends Exception
|
||||
{
|
||||
public static function strlen($string)
|
||||
{
|
||||
return function_exists('mb_strlen') ? mb_strlen($string) : strlen($string);
|
||||
}
|
||||
|
||||
function render($e)
|
||||
{
|
||||
$title = ' ['.get_class($e).'] ';
|
||||
$len = self::strlen($title);
|
||||
$lines = array();
|
||||
foreach (explode("\n", $e->getMessage()) as $line)
|
||||
public static function strlen($string)
|
||||
{
|
||||
$lines[] = ' '.$line.' ';
|
||||
$len = max(self::strlen($line) + 4, $len);
|
||||
}
|
||||
$messages = array(
|
||||
str_repeat(' ', $len),
|
||||
$title.str_repeat(' ', $len - self::strlen($title)),
|
||||
);
|
||||
|
||||
foreach ($lines as $line)
|
||||
{
|
||||
$messages[] = $line.str_repeat(' ', $len - self::strlen($line));
|
||||
return function_exists('mb_strlen') ? mb_strlen($string) : strlen($string);
|
||||
}
|
||||
|
||||
$messages[] = str_repeat(' ', $len);
|
||||
|
||||
fwrite(STDERR, "\n");
|
||||
foreach ($messages as $message)
|
||||
function render($e)
|
||||
{
|
||||
fwrite(STDERR, pakeColor::colorize($message, 'ERROR', STDERR)."\n");
|
||||
}
|
||||
fwrite(STDERR, "\n");
|
||||
$title = ' [' . get_class($e) . '] ';
|
||||
$len = self::strlen($title);
|
||||
$lines = array();
|
||||
foreach (explode("\n", $e->getMessage()) as $line) {
|
||||
$lines[] = ' ' . $line . ' ';
|
||||
$len = max(self::strlen($line) + 4, $len);
|
||||
}
|
||||
$messages = array(
|
||||
str_repeat(' ', $len),
|
||||
$title . str_repeat(' ', $len - self::strlen($title)),
|
||||
);
|
||||
|
||||
$pake = pakeApp::get_instance();
|
||||
foreach ($lines as $line) {
|
||||
$messages[] = $line . str_repeat(' ', $len - self::strlen($line));
|
||||
}
|
||||
|
||||
if ($pake->get_trace())
|
||||
{
|
||||
fwrite(STDERR, "exception trace:\n");
|
||||
$messages[] = str_repeat(' ', $len);
|
||||
|
||||
$trace = $this->trace($e);
|
||||
for ($i = 0, $count = count($trace); $i < $count; $i++)
|
||||
{
|
||||
$class = (isset($trace[$i]['class']) ? $trace[$i]['class'] : '');
|
||||
$type = (isset($trace[$i]['type']) ? $trace[$i]['type'] : '');
|
||||
$function = $trace[$i]['function'];
|
||||
$file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
|
||||
$line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
|
||||
$stderr = getConstant('STDERR', fopen('php://stderr', 'wb'));
|
||||
fwrite($stderr, "\n");
|
||||
foreach ($messages as $message) {
|
||||
fwrite($stderr, pakeColor::colorize($message, 'ERROR', $stderr) . "\n");
|
||||
}
|
||||
fwrite($stderr, "\n");
|
||||
|
||||
fwrite(STDERR, sprintf(" %s%s%s at %s:%s\n", $class, $type, $function, pakeColor::colorize($file, 'INFO', STDERR), pakeColor::colorize($line, 'INFO', STDERR)));
|
||||
}
|
||||
$pake = pakeApp::get_instance();
|
||||
|
||||
if ($pake->get_trace()) {
|
||||
fwrite($stderr, "exception trace:\n");
|
||||
|
||||
$trace = $this->trace($e);
|
||||
for ($i = 0, $count = count($trace); $i < $count; $i++) {
|
||||
$class = (isset($trace[$i]['class']) ? $trace[$i]['class'] : '');
|
||||
$type = (isset($trace[$i]['type']) ? $trace[$i]['type'] : '');
|
||||
$function = $trace[$i]['function'];
|
||||
$file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
|
||||
$line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
|
||||
|
||||
fwrite($stderr, sprintf(" %s%s%s at %s:%s\n", $class, $type, $function, pakeColor::colorize($file, 'INFO', $stderr), pakeColor::colorize($line, 'INFO', $stderr)));
|
||||
}
|
||||
}
|
||||
|
||||
fwrite($stderr, "\n");
|
||||
}
|
||||
|
||||
fwrite(STDERR, "\n");
|
||||
}
|
||||
function trace($exception)
|
||||
{
|
||||
// exception related properties
|
||||
$trace = $exception->getTrace();
|
||||
array_unshift($trace, array(
|
||||
'function' => '',
|
||||
'file' => ($exception->getFile() != null) ? $exception->getFile() : 'n/a',
|
||||
'line' => ($exception->getLine() != null) ? $exception->getLine() : 'n/a',
|
||||
'args' => array(),
|
||||
));
|
||||
|
||||
function trace($exception)
|
||||
{
|
||||
// exception related properties
|
||||
$trace = $exception->getTrace();
|
||||
array_unshift($trace, array(
|
||||
'function' => '',
|
||||
'file' => ($exception->getFile() != null) ? $exception->getFile() : 'n/a',
|
||||
'line' => ($exception->getLine() != null) ? $exception->getLine() : 'n/a',
|
||||
'args' => array(),
|
||||
));
|
||||
|
||||
return $trace;
|
||||
}
|
||||
return $trace;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user