mirror of
https://github.com/pierre42100/comunic
synced 2025-06-21 01:25:20 +00:00
First commit
This commit is contained in:
13
developer/vendor/filp/whoops/CHANGELOG.md
vendored
Normal file
13
developer/vendor/filp/whoops/CHANGELOG.md
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
# 2.1.0
|
||||
|
||||
* Add a `SystemFacade` to allow clients to override Whoops behavior.
|
||||
* Show frame arguments in `PrettyPageHandler`.
|
||||
* Highlight the line with the error.
|
||||
* Add icons to search on Google and Stack Overflow.
|
||||
|
||||
# 2.0.0
|
||||
|
||||
Backwards compatibility breaking changes:
|
||||
|
||||
* `Run` class is now `final`. If you inherited from `Run`, please now instead use a custom `SystemFacade` injected into the `Run` constructor, or contribute your changes to our core.
|
||||
* PHP < 5.5 support dropped.
|
19
developer/vendor/filp/whoops/LICENSE.md
vendored
Normal file
19
developer/vendor/filp/whoops/LICENSE.md
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
#The MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
17
developer/vendor/filp/whoops/src/Whoops/Exception/ErrorException.php
vendored
Normal file
17
developer/vendor/filp/whoops/src/Whoops/Exception/ErrorException.php
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Exception;
|
||||
|
||||
use ErrorException as BaseErrorException;
|
||||
|
||||
/**
|
||||
* Wraps ErrorException; mostly used for typing (at least now)
|
||||
* to easily cleanup the stack trace of redundant info.
|
||||
*/
|
||||
class ErrorException extends BaseErrorException
|
||||
{
|
||||
}
|
74
developer/vendor/filp/whoops/src/Whoops/Exception/Formatter.php
vendored
Normal file
74
developer/vendor/filp/whoops/src/Whoops/Exception/Formatter.php
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Exception;
|
||||
|
||||
|
||||
class Formatter
|
||||
{
|
||||
/**
|
||||
* Returns all basic information about the exception in a simple array
|
||||
* for further convertion to other languages
|
||||
* @param Inspector $inspector
|
||||
* @param bool $shouldAddTrace
|
||||
* @return array
|
||||
*/
|
||||
public static function formatExceptionAsDataArray(Inspector $inspector, $shouldAddTrace)
|
||||
{
|
||||
$exception = $inspector->getException();
|
||||
$response = array(
|
||||
'type' => get_class($exception),
|
||||
'message' => $exception->getMessage(),
|
||||
'file' => $exception->getFile(),
|
||||
'line' => $exception->getLine(),
|
||||
);
|
||||
|
||||
if ($shouldAddTrace) {
|
||||
$frames = $inspector->getFrames();
|
||||
$frameData = array();
|
||||
|
||||
foreach ($frames as $frame) {
|
||||
/** @var Frame $frame */
|
||||
$frameData[] = array(
|
||||
'file' => $frame->getFile(),
|
||||
'line' => $frame->getLine(),
|
||||
'function' => $frame->getFunction(),
|
||||
'class' => $frame->getClass(),
|
||||
'args' => $frame->getArgs(),
|
||||
);
|
||||
}
|
||||
|
||||
$response['trace'] = $frameData;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public static function formatExceptionPlain(Inspector $inspector)
|
||||
{
|
||||
$message = $inspector->getException()->getMessage();
|
||||
$frames = $inspector->getFrames();
|
||||
|
||||
$plain = $inspector->getExceptionName();
|
||||
$plain .= ' thrown with message "';
|
||||
$plain .= $message;
|
||||
$plain .= '"'."\n\n";
|
||||
|
||||
$plain .= "Stacktrace:\n";
|
||||
foreach ($frames as $i => $frame) {
|
||||
$plain .= "#". (count($frames) - $i - 1). " ";
|
||||
$plain .= $frame->getClass() ?: '';
|
||||
$plain .= $frame->getClass() && $frame->getFunction() ? ":" : "";
|
||||
$plain .= $frame->getFunction() ?: '';
|
||||
$plain .= ' in ';
|
||||
$plain .= ($frame->getFile() ?: '<#unknown>');
|
||||
$plain .= ':';
|
||||
$plain .= (int) $frame->getLine(). "\n";
|
||||
}
|
||||
|
||||
return $plain;
|
||||
}
|
||||
}
|
269
developer/vendor/filp/whoops/src/Whoops/Exception/Frame.php
vendored
Normal file
269
developer/vendor/filp/whoops/src/Whoops/Exception/Frame.php
vendored
Normal file
@ -0,0 +1,269 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Exception;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Serializable;
|
||||
|
||||
class Frame implements Serializable
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $frame;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $fileContentsCache;
|
||||
|
||||
/**
|
||||
* @var array[]
|
||||
*/
|
||||
protected $comments = array();
|
||||
|
||||
/**
|
||||
* @param array[]
|
||||
*/
|
||||
public function __construct(array $frame)
|
||||
{
|
||||
$this->frame = $frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $shortened
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFile($shortened = false)
|
||||
{
|
||||
if (empty($this->frame['file'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$file = $this->frame['file'];
|
||||
|
||||
// Check if this frame occurred within an eval().
|
||||
// @todo: This can be made more reliable by checking if we've entered
|
||||
// eval() in a previous trace, but will need some more work on the upper
|
||||
// trace collector(s).
|
||||
if (preg_match('/^(.*)\((\d+)\) : (?:eval\(\)\'d|assert) code$/', $file, $matches)) {
|
||||
$file = $this->frame['file'] = $matches[1];
|
||||
$this->frame['line'] = (int) $matches[2];
|
||||
}
|
||||
|
||||
if ($shortened && is_string($file)) {
|
||||
// Replace the part of the path that all frames have in common, and add 'soft hyphens' for smoother line-breaks.
|
||||
$dirname = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__))))));
|
||||
$file = str_replace($dirname, "…", $file);
|
||||
$file = str_replace("/", "/­", $file);
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getLine()
|
||||
{
|
||||
return isset($this->frame['line']) ? $this->frame['line'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getClass()
|
||||
{
|
||||
return isset($this->frame['class']) ? $this->frame['class'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFunction()
|
||||
{
|
||||
return isset($this->frame['function']) ? $this->frame['function'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getArgs()
|
||||
{
|
||||
return isset($this->frame['args']) ? (array) $this->frame['args'] : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full contents of the file for this frame,
|
||||
* if it's known.
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFileContents()
|
||||
{
|
||||
if ($this->fileContentsCache === null && $filePath = $this->getFile()) {
|
||||
// Leave the stage early when 'Unknown' is passed
|
||||
// this would otherwise raise an exception when
|
||||
// open_basedir is enabled.
|
||||
if ($filePath === "Unknown") {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return null if the file doesn't actually exist.
|
||||
if (!is_file($filePath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->fileContentsCache = file_get_contents($filePath);
|
||||
}
|
||||
|
||||
return $this->fileContentsCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a comment to this frame, that can be received and
|
||||
* used by other handlers. For example, the PrettyPage handler
|
||||
* can attach these comments under the code for each frame.
|
||||
*
|
||||
* An interesting use for this would be, for example, code analysis
|
||||
* & annotations.
|
||||
*
|
||||
* @param string $comment
|
||||
* @param string $context Optional string identifying the origin of the comment
|
||||
*/
|
||||
public function addComment($comment, $context = 'global')
|
||||
{
|
||||
$this->comments[] = array(
|
||||
'comment' => $comment,
|
||||
'context' => $context,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all comments for this frame. Optionally allows
|
||||
* a filter to only retrieve comments from a specific
|
||||
* context.
|
||||
*
|
||||
* @param string $filter
|
||||
* @return array[]
|
||||
*/
|
||||
public function getComments($filter = null)
|
||||
{
|
||||
$comments = $this->comments;
|
||||
|
||||
if ($filter !== null) {
|
||||
$comments = array_filter($comments, function ($c) use ($filter) {
|
||||
return $c['context'] == $filter;
|
||||
});
|
||||
}
|
||||
|
||||
return $comments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the array containing the raw frame data from which
|
||||
* this Frame object was built
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getRawFrame()
|
||||
{
|
||||
return $this->frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contents of the file for this frame as an
|
||||
* array of lines, and optionally as a clamped range of lines.
|
||||
*
|
||||
* NOTE: lines are 0-indexed
|
||||
*
|
||||
* @example
|
||||
* Get all lines for this file
|
||||
* $frame->getFileLines(); // => array( 0 => '<?php', 1 => '...', ...)
|
||||
* @example
|
||||
* Get one line for this file, starting at line 10 (zero-indexed, remember!)
|
||||
* $frame->getFileLines(9, 1); // array( 10 => '...', 11 => '...')
|
||||
*
|
||||
* @throws InvalidArgumentException if $length is less than or equal to 0
|
||||
* @param int $start
|
||||
* @param int $length
|
||||
* @return string[]|null
|
||||
*/
|
||||
public function getFileLines($start = 0, $length = null)
|
||||
{
|
||||
if (null !== ($contents = $this->getFileContents())) {
|
||||
$lines = explode("\n", $contents);
|
||||
|
||||
// Get a subset of lines from $start to $end
|
||||
if ($length !== null) {
|
||||
$start = (int) $start;
|
||||
$length = (int) $length;
|
||||
if ($start < 0) {
|
||||
$start = 0;
|
||||
}
|
||||
|
||||
if ($length <= 0) {
|
||||
throw new InvalidArgumentException(
|
||||
"\$length($length) cannot be lower or equal to 0"
|
||||
);
|
||||
}
|
||||
|
||||
$lines = array_slice($lines, $start, $length, true);
|
||||
}
|
||||
|
||||
return $lines;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements the Serializable interface, with special
|
||||
* steps to also save the existing comments.
|
||||
*
|
||||
* @see Serializable::serialize
|
||||
* @return string
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
$frame = $this->frame;
|
||||
if (!empty($this->comments)) {
|
||||
$frame['_comments'] = $this->comments;
|
||||
}
|
||||
|
||||
return serialize($frame);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unserializes the frame data, while also preserving
|
||||
* any existing comment data.
|
||||
*
|
||||
* @see Serializable::unserialize
|
||||
* @param string $serializedFrame
|
||||
*/
|
||||
public function unserialize($serializedFrame)
|
||||
{
|
||||
$frame = unserialize($serializedFrame);
|
||||
|
||||
if (!empty($frame['_comments'])) {
|
||||
$this->comments = $frame['_comments'];
|
||||
unset($frame['_comments']);
|
||||
}
|
||||
|
||||
$this->frame = $frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares Frame against one another
|
||||
* @param Frame $frame
|
||||
* @return bool
|
||||
*/
|
||||
public function equals(Frame $frame)
|
||||
{
|
||||
if (!$this->getFile() || $this->getFile() === 'Unknown' || !$this->getLine()) {
|
||||
return false;
|
||||
}
|
||||
return $frame->getFile() === $this->getFile() && $frame->getLine() === $this->getLine();
|
||||
}
|
||||
}
|
191
developer/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php
vendored
Normal file
191
developer/vendor/filp/whoops/src/Whoops/Exception/FrameCollection.php
vendored
Normal file
@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Exception;
|
||||
|
||||
use ArrayAccess;
|
||||
use ArrayIterator;
|
||||
use Countable;
|
||||
use IteratorAggregate;
|
||||
use Serializable;
|
||||
use UnexpectedValueException;
|
||||
|
||||
/**
|
||||
* Exposes a fluent interface for dealing with an ordered list
|
||||
* of stack-trace frames.
|
||||
*/
|
||||
class FrameCollection implements ArrayAccess, IteratorAggregate, Serializable, Countable
|
||||
{
|
||||
/**
|
||||
* @var array[]
|
||||
*/
|
||||
private $frames;
|
||||
|
||||
/**
|
||||
* @param array $frames
|
||||
*/
|
||||
public function __construct(array $frames)
|
||||
{
|
||||
$this->frames = array_map(function ($frame) {
|
||||
return new Frame($frame);
|
||||
}, $frames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters frames using a callable, returns the same FrameCollection
|
||||
*
|
||||
* @param callable $callable
|
||||
* @return FrameCollection
|
||||
*/
|
||||
public function filter($callable)
|
||||
{
|
||||
$this->frames = array_filter($this->frames, $callable);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map the collection of frames
|
||||
*
|
||||
* @param callable $callable
|
||||
* @return FrameCollection
|
||||
*/
|
||||
public function map($callable)
|
||||
{
|
||||
// Contain the map within a higher-order callable
|
||||
// that enforces type-correctness for the $callable
|
||||
$this->frames = array_map(function ($frame) use ($callable) {
|
||||
$frame = call_user_func($callable, $frame);
|
||||
|
||||
if (!$frame instanceof Frame) {
|
||||
throw new UnexpectedValueException(
|
||||
"Callable to " . __METHOD__ . " must return a Frame object"
|
||||
);
|
||||
}
|
||||
|
||||
return $frame;
|
||||
}, $this->frames);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with all frames, does not affect
|
||||
* the internal array.
|
||||
*
|
||||
* @todo If this gets any more complex than this,
|
||||
* have getIterator use this method.
|
||||
* @see FrameCollection::getIterator
|
||||
* @return array
|
||||
*/
|
||||
public function getArray()
|
||||
{
|
||||
return $this->frames;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IteratorAggregate::getIterator
|
||||
* @return ArrayIterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->frames);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ArrayAccess::offsetExists
|
||||
* @param int $offset
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->frames[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ArrayAccess::offsetGet
|
||||
* @param int $offset
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->frames[$offset];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ArrayAccess::offsetSet
|
||||
* @param int $offset
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
throw new \Exception(__CLASS__ . ' is read only');
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ArrayAccess::offsetUnset
|
||||
* @param int $offset
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
throw new \Exception(__CLASS__ . ' is read only');
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Countable::count
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->frames);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Serializable::serialize
|
||||
* @return string
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return serialize($this->frames);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Serializable::unserialize
|
||||
* @param string $serializedFrames
|
||||
*/
|
||||
public function unserialize($serializedFrames)
|
||||
{
|
||||
$this->frames = unserialize($serializedFrames);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Frame[] $frames Array of Frame instances, usually from $e->getPrevious()
|
||||
*/
|
||||
public function prependFrames(array $frames)
|
||||
{
|
||||
$this->frames = array_merge($frames, $this->frames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the innermost part of stack trace that is not the same as that of outer exception
|
||||
*
|
||||
* @param FrameCollection $parentFrames Outer exception frames to compare tail against
|
||||
* @return Frame[]
|
||||
*/
|
||||
public function topDiff(FrameCollection $parentFrames)
|
||||
{
|
||||
$diff = $this->frames;
|
||||
|
||||
$parentFrames = $parentFrames->getArray();
|
||||
$p = count($parentFrames)-1;
|
||||
|
||||
for ($i = count($diff)-1; $i >= 0 && $p >= 0; $i--) {
|
||||
/** @var Frame $tailFrame */
|
||||
$tailFrame = $diff[$i];
|
||||
if ($tailFrame->equals($parentFrames[$p])) {
|
||||
unset($diff[$i]);
|
||||
}
|
||||
$p--;
|
||||
}
|
||||
return $diff;
|
||||
}
|
||||
}
|
245
developer/vendor/filp/whoops/src/Whoops/Exception/Inspector.php
vendored
Normal file
245
developer/vendor/filp/whoops/src/Whoops/Exception/Inspector.php
vendored
Normal file
@ -0,0 +1,245 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Exception;
|
||||
|
||||
use Whoops\Util\Misc;
|
||||
|
||||
class Inspector
|
||||
{
|
||||
/**
|
||||
* @var \Throwable
|
||||
*/
|
||||
private $exception;
|
||||
|
||||
/**
|
||||
* @var \Whoops\Exception\FrameCollection
|
||||
*/
|
||||
private $frames;
|
||||
|
||||
/**
|
||||
* @var \Whoops\Exception\Inspector
|
||||
*/
|
||||
private $previousExceptionInspector;
|
||||
|
||||
/**
|
||||
* @param \Throwable $exception The exception to inspect
|
||||
*/
|
||||
public function __construct($exception)
|
||||
{
|
||||
$this->exception = $exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Throwable
|
||||
*/
|
||||
public function getException()
|
||||
{
|
||||
return $this->exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getExceptionName()
|
||||
{
|
||||
return get_class($this->exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getExceptionMessage()
|
||||
{
|
||||
return $this->exception->getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the wrapped Exception has a previous Exception?
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPreviousException()
|
||||
{
|
||||
return $this->previousExceptionInspector || $this->exception->getPrevious();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Inspector for a previous Exception, if any.
|
||||
* @todo Clean this up a bit, cache stuff a bit better.
|
||||
* @return Inspector
|
||||
*/
|
||||
public function getPreviousExceptionInspector()
|
||||
{
|
||||
if ($this->previousExceptionInspector === null) {
|
||||
$previousException = $this->exception->getPrevious();
|
||||
|
||||
if ($previousException) {
|
||||
$this->previousExceptionInspector = new Inspector($previousException);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->previousExceptionInspector;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator for the inspected exception's
|
||||
* frames.
|
||||
* @return \Whoops\Exception\FrameCollection
|
||||
*/
|
||||
public function getFrames()
|
||||
{
|
||||
if ($this->frames === null) {
|
||||
$frames = $this->getTrace($this->exception);
|
||||
|
||||
// Fill empty line/file info for call_user_func_array usages (PHP Bug #44428)
|
||||
foreach ($frames as $k => $frame) {
|
||||
|
||||
if (empty($frame['file'])) {
|
||||
// Default values when file and line are missing
|
||||
$file = '[internal]';
|
||||
$line = 0;
|
||||
|
||||
$next_frame = !empty($frames[$k + 1]) ? $frames[$k + 1] : array();
|
||||
|
||||
if ($this->isValidNextFrame($next_frame)) {
|
||||
$file = $next_frame['file'];
|
||||
$line = $next_frame['line'];
|
||||
}
|
||||
|
||||
$frames[$k]['file'] = $file;
|
||||
$frames[$k]['line'] = $line;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Find latest non-error handling frame index ($i) used to remove error handling frames
|
||||
$i = 0;
|
||||
foreach ($frames as $k => $frame) {
|
||||
if ($frame['file'] == $this->exception->getFile() && $frame['line'] == $this->exception->getLine()) {
|
||||
$i = $k;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove error handling frames
|
||||
if ($i > 0) {
|
||||
array_splice($frames, 0, $i);
|
||||
}
|
||||
|
||||
$firstFrame = $this->getFrameFromException($this->exception);
|
||||
array_unshift($frames, $firstFrame);
|
||||
|
||||
$this->frames = new FrameCollection($frames);
|
||||
|
||||
if ($previousInspector = $this->getPreviousExceptionInspector()) {
|
||||
// Keep outer frame on top of the inner one
|
||||
$outerFrames = $this->frames;
|
||||
$newFrames = clone $previousInspector->getFrames();
|
||||
// I assume it will always be set, but let's be safe
|
||||
if (isset($newFrames[0])) {
|
||||
$newFrames[0]->addComment(
|
||||
$previousInspector->getExceptionMessage(),
|
||||
'Exception message:'
|
||||
);
|
||||
}
|
||||
$newFrames->prependFrames($outerFrames->topDiff($newFrames));
|
||||
$this->frames = $newFrames;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->frames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the backgrace from an exception.
|
||||
*
|
||||
* If xdebug is installed
|
||||
*
|
||||
* @param \Throwable $exception
|
||||
* @return array
|
||||
*/
|
||||
protected function getTrace($e)
|
||||
{
|
||||
$traces = $e->getTrace();
|
||||
|
||||
// Get trace from xdebug if enabled, failure exceptions only trace to the shutdown handler by default
|
||||
if (!$e instanceof \ErrorException) {
|
||||
return $traces;
|
||||
}
|
||||
|
||||
if (!Misc::isLevelFatal($e->getSeverity())) {
|
||||
return $traces;
|
||||
}
|
||||
|
||||
if (!extension_loaded('xdebug') || !xdebug_is_enabled()) {
|
||||
return array();
|
||||
}
|
||||
|
||||
// Use xdebug to get the full stack trace and remove the shutdown handler stack trace
|
||||
$stack = array_reverse(xdebug_get_function_stack());
|
||||
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
$traces = array_diff_key($stack, $trace);
|
||||
|
||||
return $traces;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an exception, generates an array in the format
|
||||
* generated by Exception::getTrace()
|
||||
* @param \Throwable $exception
|
||||
* @return array
|
||||
*/
|
||||
protected function getFrameFromException($exception)
|
||||
{
|
||||
return array(
|
||||
'file' => $exception->getFile(),
|
||||
'line' => $exception->getLine(),
|
||||
'class' => get_class($exception),
|
||||
'args' => array(
|
||||
$exception->getMessage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an error, generates an array in the format
|
||||
* generated by ErrorException
|
||||
* @param ErrorException $exception
|
||||
* @return array
|
||||
*/
|
||||
protected function getFrameFromError(ErrorException $exception)
|
||||
{
|
||||
return array(
|
||||
'file' => $exception->getFile(),
|
||||
'line' => $exception->getLine(),
|
||||
'class' => null,
|
||||
'args' => array(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the frame can be used to fill in previous frame's missing info
|
||||
* happens for call_user_func and call_user_func_array usages (PHP Bug #44428)
|
||||
*
|
||||
* @param array $frame
|
||||
* @return bool
|
||||
*/
|
||||
protected function isValidNextFrame(array $frame)
|
||||
{
|
||||
if (empty($frame['file'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($frame['line'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($frame['function']) || !stristr($frame['function'], 'call_user_func')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
52
developer/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php
vendored
Normal file
52
developer/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Handler;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Wrapper for Closures passed as handlers. Can be used
|
||||
* directly, or will be instantiated automagically by Whoops\Run
|
||||
* if passed to Run::pushHandler
|
||||
*/
|
||||
class CallbackHandler extends Handler
|
||||
{
|
||||
/**
|
||||
* @var callable
|
||||
*/
|
||||
protected $callable;
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException If argument is not callable
|
||||
* @param callable $callable
|
||||
*/
|
||||
public function __construct($callable)
|
||||
{
|
||||
if (!is_callable($callable)) {
|
||||
throw new InvalidArgumentException(
|
||||
'Argument to ' . __METHOD__ . ' must be valid callable'
|
||||
);
|
||||
}
|
||||
|
||||
$this->callable = $callable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$exception = $this->getException();
|
||||
$inspector = $this->getInspector();
|
||||
$run = $this->getRun();
|
||||
$callable = $this->callable;
|
||||
|
||||
// invoke the callable directly, to get simpler stacktraces (in comparison to call_user_func).
|
||||
// this assumes that $callable is a properly typed php-callable, which we check in __construct().
|
||||
return $callable($exception, $inspector, $run);
|
||||
}
|
||||
}
|
88
developer/vendor/filp/whoops/src/Whoops/Handler/Handler.php
vendored
Normal file
88
developer/vendor/filp/whoops/src/Whoops/Handler/Handler.php
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Handler;
|
||||
|
||||
use Whoops\Exception\Inspector;
|
||||
use Whoops\Run;
|
||||
|
||||
/**
|
||||
* Abstract implementation of a Handler.
|
||||
*/
|
||||
abstract class Handler implements HandlerInterface
|
||||
{
|
||||
/**
|
||||
* Return constants that can be returned from Handler::handle
|
||||
* to message the handler walker.
|
||||
*/
|
||||
const DONE = 0x10; // returning this is optional, only exists for
|
||||
// semantic purposes
|
||||
const LAST_HANDLER = 0x20;
|
||||
const QUIT = 0x30;
|
||||
|
||||
/**
|
||||
* @var Run
|
||||
*/
|
||||
private $run;
|
||||
|
||||
/**
|
||||
* @var Inspector $inspector
|
||||
*/
|
||||
private $inspector;
|
||||
|
||||
/**
|
||||
* @var \Throwable $exception
|
||||
*/
|
||||
private $exception;
|
||||
|
||||
/**
|
||||
* @param Run $run
|
||||
*/
|
||||
public function setRun(Run $run)
|
||||
{
|
||||
$this->run = $run;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Run
|
||||
*/
|
||||
protected function getRun()
|
||||
{
|
||||
return $this->run;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Inspector $inspector
|
||||
*/
|
||||
public function setInspector(Inspector $inspector)
|
||||
{
|
||||
$this->inspector = $inspector;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Inspector
|
||||
*/
|
||||
protected function getInspector()
|
||||
{
|
||||
return $this->inspector;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Throwable $exception
|
||||
*/
|
||||
public function setException($exception)
|
||||
{
|
||||
$this->exception = $exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Throwable
|
||||
*/
|
||||
protected function getException()
|
||||
{
|
||||
return $this->exception;
|
||||
}
|
||||
}
|
36
developer/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php
vendored
Normal file
36
developer/vendor/filp/whoops/src/Whoops/Handler/HandlerInterface.php
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Handler;
|
||||
|
||||
use Whoops\Exception\Inspector;
|
||||
use Whoops\Run;
|
||||
|
||||
interface HandlerInterface
|
||||
{
|
||||
/**
|
||||
* @return int|null A handler may return nothing, or a Handler::HANDLE_* constant
|
||||
*/
|
||||
public function handle();
|
||||
|
||||
/**
|
||||
* @param Run $run
|
||||
* @return void
|
||||
*/
|
||||
public function setRun(Run $run);
|
||||
|
||||
/**
|
||||
* @param \Throwable $exception
|
||||
* @return void
|
||||
*/
|
||||
public function setException($exception);
|
||||
|
||||
/**
|
||||
* @param Inspector $inspector
|
||||
* @return void
|
||||
*/
|
||||
public function setInspector(Inspector $inspector);
|
||||
}
|
57
developer/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php
vendored
Normal file
57
developer/vendor/filp/whoops/src/Whoops/Handler/JsonResponseHandler.php
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Handler;
|
||||
|
||||
use Whoops\Exception\Formatter;
|
||||
|
||||
/**
|
||||
* Catches an exception and converts it to a JSON
|
||||
* response. Additionally can also return exception
|
||||
* frames for consumption by an API.
|
||||
*/
|
||||
class JsonResponseHandler extends Handler
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $returnFrames = false;
|
||||
|
||||
/**
|
||||
* @param bool|null $returnFrames
|
||||
* @return bool|$this
|
||||
*/
|
||||
public function addTraceToOutput($returnFrames = null)
|
||||
{
|
||||
if (func_num_args() == 0) {
|
||||
return $this->returnFrames;
|
||||
}
|
||||
|
||||
$this->returnFrames = (bool) $returnFrames;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$response = array(
|
||||
'error' => Formatter::formatExceptionAsDataArray(
|
||||
$this->getInspector(),
|
||||
$this->addTraceToOutput()
|
||||
),
|
||||
);
|
||||
|
||||
if (\Whoops\Util\Misc::canSendHeaders()) {
|
||||
header('Content-Type: application/json');
|
||||
}
|
||||
|
||||
echo json_encode($response, defined('JSON_PARTIAL_OUTPUT_ON_ERROR') ? JSON_PARTIAL_OUTPUT_ON_ERROR : 0);
|
||||
|
||||
return Handler::QUIT;
|
||||
}
|
||||
}
|
269
developer/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php
vendored
Normal file
269
developer/vendor/filp/whoops/src/Whoops/Handler/PlainTextHandler.php
vendored
Normal file
@ -0,0 +1,269 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
* Plaintext handler for command line and logs.
|
||||
* @author Pierre-Yves Landuré <https://howto.biapy.com/>
|
||||
*/
|
||||
|
||||
namespace Whoops\Handler;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Whoops\Exception\Frame;
|
||||
|
||||
/**
|
||||
* Handler outputing plaintext error messages. Can be used
|
||||
* directly, or will be instantiated automagically by Whoops\Run
|
||||
* if passed to Run::pushHandler
|
||||
*/
|
||||
class PlainTextHandler extends Handler
|
||||
{
|
||||
const VAR_DUMP_PREFIX = ' | ';
|
||||
|
||||
/**
|
||||
* @var \Psr\Log\LoggerInterface
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $addTraceToOutput = true;
|
||||
|
||||
/**
|
||||
* @var bool|integer
|
||||
*/
|
||||
private $addTraceFunctionArgsToOutput = false;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $traceFunctionArgsOutputLimit = 1024;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $loggerOnly = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @throws InvalidArgumentException If argument is not null or a LoggerInterface
|
||||
* @param \Psr\Log\LoggerInterface|null $logger
|
||||
*/
|
||||
public function __construct($logger = null)
|
||||
{
|
||||
$this->setLogger($logger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the output logger interface.
|
||||
* @throws InvalidArgumentException If argument is not null or a LoggerInterface
|
||||
* @param \Psr\Log\LoggerInterface|null $logger
|
||||
*/
|
||||
public function setLogger($logger = null)
|
||||
{
|
||||
if (! (is_null($logger)
|
||||
|| $logger instanceof LoggerInterface)) {
|
||||
throw new InvalidArgumentException(
|
||||
'Argument to ' . __METHOD__ .
|
||||
" must be a valid Logger Interface (aka. Monolog), " .
|
||||
get_class($logger) . ' given.'
|
||||
);
|
||||
}
|
||||
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Psr\Log\LoggerInterface|null
|
||||
*/
|
||||
public function getLogger()
|
||||
{
|
||||
return $this->logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add error trace to output.
|
||||
* @param bool|null $addTraceToOutput
|
||||
* @return bool|$this
|
||||
*/
|
||||
public function addTraceToOutput($addTraceToOutput = null)
|
||||
{
|
||||
if (func_num_args() == 0) {
|
||||
return $this->addTraceToOutput;
|
||||
}
|
||||
|
||||
$this->addTraceToOutput = (bool) $addTraceToOutput;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add error trace function arguments to output.
|
||||
* Set to True for all frame args, or integer for the n first frame args.
|
||||
* @param bool|integer|null $addTraceFunctionArgsToOutput
|
||||
* @return null|bool|integer
|
||||
*/
|
||||
public function addTraceFunctionArgsToOutput($addTraceFunctionArgsToOutput = null)
|
||||
{
|
||||
if (func_num_args() == 0) {
|
||||
return $this->addTraceFunctionArgsToOutput;
|
||||
}
|
||||
|
||||
if (! is_integer($addTraceFunctionArgsToOutput)) {
|
||||
$this->addTraceFunctionArgsToOutput = (bool) $addTraceFunctionArgsToOutput;
|
||||
} else {
|
||||
$this->addTraceFunctionArgsToOutput = $addTraceFunctionArgsToOutput;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the size limit in bytes of frame arguments var_dump output.
|
||||
* If the limit is reached, the var_dump output is discarded.
|
||||
* Prevent memory limit errors.
|
||||
* @var integer
|
||||
*/
|
||||
public function setTraceFunctionArgsOutputLimit($traceFunctionArgsOutputLimit)
|
||||
{
|
||||
$this->traceFunctionArgsOutputLimit = (integer) $traceFunctionArgsOutputLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size limit in bytes of frame arguments var_dump output.
|
||||
* If the limit is reached, the var_dump output is discarded.
|
||||
* Prevent memory limit errors.
|
||||
* @return integer
|
||||
*/
|
||||
public function getTraceFunctionArgsOutputLimit()
|
||||
{
|
||||
return $this->traceFunctionArgsOutputLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only output to logger.
|
||||
* @param bool|null $loggerOnly
|
||||
* @return null|bool
|
||||
*/
|
||||
public function loggerOnly($loggerOnly = null)
|
||||
{
|
||||
if (func_num_args() == 0) {
|
||||
return $this->loggerOnly;
|
||||
}
|
||||
|
||||
$this->loggerOnly = (bool) $loggerOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if handler can output to stdout.
|
||||
* @return bool
|
||||
*/
|
||||
private function canOutput()
|
||||
{
|
||||
return !$this->loggerOnly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the frame args var_dump.
|
||||
* @param \Whoops\Exception\Frame $frame [description]
|
||||
* @param integer $line [description]
|
||||
* @return string
|
||||
*/
|
||||
private function getFrameArgsOutput(Frame $frame, $line)
|
||||
{
|
||||
if ($this->addTraceFunctionArgsToOutput() === false
|
||||
|| $this->addTraceFunctionArgsToOutput() < $line) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Dump the arguments:
|
||||
ob_start();
|
||||
var_dump($frame->getArgs());
|
||||
if (ob_get_length() > $this->getTraceFunctionArgsOutputLimit()) {
|
||||
// The argument var_dump is to big.
|
||||
// Discarded to limit memory usage.
|
||||
ob_clean();
|
||||
return sprintf(
|
||||
"\n%sArguments dump length greater than %d Bytes. Discarded.",
|
||||
self::VAR_DUMP_PREFIX,
|
||||
$this->getTraceFunctionArgsOutputLimit()
|
||||
);
|
||||
}
|
||||
|
||||
return sprintf("\n%s",
|
||||
preg_replace('/^/m', self::VAR_DUMP_PREFIX, ob_get_clean())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the exception trace as plain text.
|
||||
* @return string
|
||||
*/
|
||||
private function getTraceOutput()
|
||||
{
|
||||
if (! $this->addTraceToOutput()) {
|
||||
return '';
|
||||
}
|
||||
$inspector = $this->getInspector();
|
||||
$frames = $inspector->getFrames();
|
||||
|
||||
$response = "\nStack trace:";
|
||||
|
||||
$line = 1;
|
||||
foreach ($frames as $frame) {
|
||||
/** @var Frame $frame */
|
||||
$class = $frame->getClass();
|
||||
|
||||
$template = "\n%3d. %s->%s() %s:%d%s";
|
||||
if (! $class) {
|
||||
// Remove method arrow (->) from output.
|
||||
$template = "\n%3d. %s%s() %s:%d%s";
|
||||
}
|
||||
|
||||
$response .= sprintf(
|
||||
$template,
|
||||
$line,
|
||||
$class,
|
||||
$frame->getFunction(),
|
||||
$frame->getFile(),
|
||||
$frame->getLine(),
|
||||
$this->getFrameArgsOutput($frame, $line)
|
||||
);
|
||||
|
||||
$line++;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$exception = $this->getException();
|
||||
|
||||
$response = sprintf("%s: %s in file %s on line %d%s\n",
|
||||
get_class($exception),
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$this->getTraceOutput()
|
||||
);
|
||||
|
||||
if ($this->getLogger()) {
|
||||
$this->getLogger()->error($response);
|
||||
}
|
||||
|
||||
if (! $this->canOutput()) {
|
||||
return Handler::DONE;
|
||||
}
|
||||
|
||||
if (\Whoops\Util\Misc::canSendHeaders()) {
|
||||
header('Content-Type: text/plain');
|
||||
}
|
||||
|
||||
echo $response;
|
||||
|
||||
return Handler::QUIT;
|
||||
}
|
||||
}
|
556
developer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php
vendored
Normal file
556
developer/vendor/filp/whoops/src/Whoops/Handler/PrettyPageHandler.php
vendored
Normal file
@ -0,0 +1,556 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Handler;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\VarDumper\Cloner\AbstractCloner;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use UnexpectedValueException;
|
||||
use Whoops\Exception\Formatter;
|
||||
use Whoops\Util\Misc;
|
||||
use Whoops\Util\TemplateHelper;
|
||||
|
||||
class PrettyPageHandler extends Handler
|
||||
{
|
||||
/**
|
||||
* Search paths to be scanned for resources, in the reverse
|
||||
* order they're declared.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $searchPaths = array();
|
||||
|
||||
/**
|
||||
* Fast lookup cache for known resource locations.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $resourceCache = array();
|
||||
|
||||
/**
|
||||
* The name of the custom css file.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $customCss = null;
|
||||
|
||||
/**
|
||||
* @var array[]
|
||||
*/
|
||||
private $extraTables = array();
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $handleUnconditionally = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $pageTitle = "Whoops! There was an error.";
|
||||
|
||||
/**
|
||||
* A string identifier for a known IDE/text editor, or a closure
|
||||
* that resolves a string that can be used to open a given file
|
||||
* in an editor. If the string contains the special substrings
|
||||
* %file or %line, they will be replaced with the correct data.
|
||||
*
|
||||
* @example
|
||||
* "txmt://open?url=%file&line=%line"
|
||||
* @var mixed $editor
|
||||
*/
|
||||
protected $editor;
|
||||
|
||||
/**
|
||||
* A list of known editor strings
|
||||
* @var array
|
||||
*/
|
||||
protected $editors = array(
|
||||
"sublime" => "subl://open?url=file://%file&line=%line",
|
||||
"textmate" => "txmt://open?url=file://%file&line=%line",
|
||||
"emacs" => "emacs://open?url=file://%file&line=%line",
|
||||
"macvim" => "mvim://open/?url=file://%file&line=%line",
|
||||
"phpstorm" => "phpstorm://open?file=%file&line=%line",
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
if (ini_get('xdebug.file_link_format') || extension_loaded('xdebug')) {
|
||||
// Register editor using xdebug's file_link_format option.
|
||||
$this->editors['xdebug'] = function ($file, $line) {
|
||||
return str_replace(array('%f', '%l'), array($file, $line), ini_get('xdebug.file_link_format'));
|
||||
};
|
||||
}
|
||||
|
||||
// Add the default, local resource search path:
|
||||
$this->searchPaths[] = __DIR__ . "/../Resources";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (!$this->handleUnconditionally()) {
|
||||
// Check conditions for outputting HTML:
|
||||
// @todo: Make this more robust
|
||||
if (php_sapi_name() === 'cli') {
|
||||
// Help users who have been relying on an internal test value
|
||||
// fix their code to the proper method
|
||||
if (isset($_ENV['whoops-test'])) {
|
||||
throw new \Exception(
|
||||
'Use handleUnconditionally instead of whoops-test'
|
||||
.' environment variable'
|
||||
);
|
||||
}
|
||||
|
||||
return Handler::DONE;
|
||||
}
|
||||
}
|
||||
|
||||
// @todo: Make this more dynamic
|
||||
$helper = new TemplateHelper();
|
||||
|
||||
if (class_exists('Symfony\Component\VarDumper\Cloner\VarCloner')) {
|
||||
$cloner = new VarCloner();
|
||||
// Only dump object internals if a custom caster exists.
|
||||
$cloner->addCasters(['*' => function ($obj, $a, $stub, $isNested, $filter = 0) {
|
||||
$class = $stub->class;
|
||||
$classes = [$class => $class] + class_parents($class) + class_implements($class);
|
||||
|
||||
foreach ($classes as $class) {
|
||||
if (isset(AbstractCloner::$defaultCasters[$class])) {
|
||||
return $a;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all internals
|
||||
return [];
|
||||
}]);
|
||||
$helper->setCloner($cloner);
|
||||
}
|
||||
|
||||
$templateFile = $this->getResource("views/layout.html.php");
|
||||
$cssFile = $this->getResource("css/whoops.base.css");
|
||||
$zeptoFile = $this->getResource("js/zepto.min.js");
|
||||
$clipboard = $this->getResource("js/clipboard.min.js");
|
||||
$jsFile = $this->getResource("js/whoops.base.js");
|
||||
|
||||
if ($this->customCss) {
|
||||
$customCssFile = $this->getResource($this->customCss);
|
||||
}
|
||||
|
||||
$inspector = $this->getInspector();
|
||||
$frames = $inspector->getFrames();
|
||||
|
||||
$code = $inspector->getException()->getCode();
|
||||
|
||||
if ($inspector->getException() instanceof \ErrorException) {
|
||||
// ErrorExceptions wrap the php-error types within the "severity" property
|
||||
$code = Misc::translateErrorCode($inspector->getException()->getSeverity());
|
||||
}
|
||||
|
||||
// List of variables that will be passed to the layout template.
|
||||
$vars = array(
|
||||
"page_title" => $this->getPageTitle(),
|
||||
|
||||
// @todo: Asset compiler
|
||||
"stylesheet" => file_get_contents($cssFile),
|
||||
"zepto" => file_get_contents($zeptoFile),
|
||||
"clipboard" => file_get_contents($clipboard),
|
||||
"javascript" => file_get_contents($jsFile),
|
||||
|
||||
// Template paths:
|
||||
"header" => $this->getResource("views/header.html.php"),
|
||||
"frame_list" => $this->getResource("views/frame_list.html.php"),
|
||||
"frame_code" => $this->getResource("views/frame_code.html.php"),
|
||||
"env_details" => $this->getResource("views/env_details.html.php"),
|
||||
|
||||
"title" => $this->getPageTitle(),
|
||||
"name" => explode("\\", $inspector->getExceptionName()),
|
||||
"message" => $inspector->getException()->getMessage(),
|
||||
"code" => $code,
|
||||
"plain_exception" => Formatter::formatExceptionPlain($inspector),
|
||||
"frames" => $frames,
|
||||
"has_frames" => !!count($frames),
|
||||
"handler" => $this,
|
||||
"handlers" => $this->getRun()->getHandlers(),
|
||||
|
||||
"tables" => array(
|
||||
"GET Data" => $_GET,
|
||||
"POST Data" => $_POST,
|
||||
"Files" => $_FILES,
|
||||
"Cookies" => $_COOKIE,
|
||||
"Session" => isset($_SESSION) ? $_SESSION : array(),
|
||||
"Server/Request Data" => $_SERVER,
|
||||
"Environment Variables" => $_ENV,
|
||||
),
|
||||
);
|
||||
|
||||
if (isset($customCssFile)) {
|
||||
$vars["stylesheet"] .= file_get_contents($customCssFile);
|
||||
}
|
||||
|
||||
// Add extra entries list of data tables:
|
||||
// @todo: Consolidate addDataTable and addDataTableCallback
|
||||
$extraTables = array_map(function ($table) {
|
||||
return $table instanceof \Closure ? $table() : $table;
|
||||
}, $this->getDataTables());
|
||||
$vars["tables"] = array_merge($extraTables, $vars["tables"]);
|
||||
|
||||
if (\Whoops\Util\Misc::canSendHeaders()) {
|
||||
header('Content-Type: text/html');
|
||||
}
|
||||
|
||||
$helper->setVariables($vars);
|
||||
$helper->render($templateFile);
|
||||
|
||||
return Handler::QUIT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an entry to the list of tables displayed in the template.
|
||||
* The expected data is a simple associative array. Any nested arrays
|
||||
* will be flattened with print_r
|
||||
* @param string $label
|
||||
* @param array $data
|
||||
*/
|
||||
public function addDataTable($label, array $data)
|
||||
{
|
||||
$this->extraTables[$label] = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lazily adds an entry to the list of tables displayed in the table.
|
||||
* The supplied callback argument will be called when the error is rendered,
|
||||
* it should produce a simple associative array. Any nested arrays will
|
||||
* be flattened with print_r.
|
||||
*
|
||||
* @throws InvalidArgumentException If $callback is not callable
|
||||
* @param string $label
|
||||
* @param callable $callback Callable returning an associative array
|
||||
*/
|
||||
public function addDataTableCallback($label, /* callable */ $callback)
|
||||
{
|
||||
if (!is_callable($callback)) {
|
||||
throw new InvalidArgumentException('Expecting callback argument to be callable');
|
||||
}
|
||||
|
||||
$this->extraTables[$label] = function () use ($callback) {
|
||||
try {
|
||||
$result = call_user_func($callback);
|
||||
|
||||
// Only return the result if it can be iterated over by foreach().
|
||||
return is_array($result) || $result instanceof \Traversable ? $result : array();
|
||||
} catch (\Exception $e) {
|
||||
// Don't allow failure to break the rendering of the original exception.
|
||||
return array();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the extra data tables registered with this handler.
|
||||
* Optionally accepts a 'label' parameter, to only return the data
|
||||
* table under that label.
|
||||
* @param string|null $label
|
||||
* @return array[]|callable
|
||||
*/
|
||||
public function getDataTables($label = null)
|
||||
{
|
||||
if ($label !== null) {
|
||||
return isset($this->extraTables[$label]) ?
|
||||
$this->extraTables[$label] : array();
|
||||
}
|
||||
|
||||
return $this->extraTables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to disable all attempts to dynamically decide whether to
|
||||
* handle or return prematurely.
|
||||
* Set this to ensure that the handler will perform no matter what.
|
||||
* @param bool|null $value
|
||||
* @return bool|null
|
||||
*/
|
||||
public function handleUnconditionally($value = null)
|
||||
{
|
||||
if (func_num_args() == 0) {
|
||||
return $this->handleUnconditionally;
|
||||
}
|
||||
|
||||
$this->handleUnconditionally = (bool) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an editor resolver, identified by a string
|
||||
* name, and that may be a string path, or a callable
|
||||
* resolver. If the callable returns a string, it will
|
||||
* be set as the file reference's href attribute.
|
||||
*
|
||||
* @example
|
||||
* $run->addEditor('macvim', "mvim://open?url=file://%file&line=%line")
|
||||
* @example
|
||||
* $run->addEditor('remove-it', function($file, $line) {
|
||||
* unlink($file);
|
||||
* return "http://stackoverflow.com";
|
||||
* });
|
||||
* @param string $identifier
|
||||
* @param string $resolver
|
||||
*/
|
||||
public function addEditor($identifier, $resolver)
|
||||
{
|
||||
$this->editors[$identifier] = $resolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the editor to use to open referenced files, by a string
|
||||
* identifier, or a callable that will be executed for every
|
||||
* file reference, with a $file and $line argument, and should
|
||||
* return a string.
|
||||
*
|
||||
* @example
|
||||
* $run->setEditor(function($file, $line) { return "file:///{$file}"; });
|
||||
* @example
|
||||
* $run->setEditor('sublime');
|
||||
*
|
||||
* @throws InvalidArgumentException If invalid argument identifier provided
|
||||
* @param string|callable $editor
|
||||
*/
|
||||
public function setEditor($editor)
|
||||
{
|
||||
if (!is_callable($editor) && !isset($this->editors[$editor])) {
|
||||
throw new InvalidArgumentException(
|
||||
"Unknown editor identifier: $editor. Known editors:" .
|
||||
implode(",", array_keys($this->editors))
|
||||
);
|
||||
}
|
||||
|
||||
$this->editor = $editor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a string file path, and an integer file line,
|
||||
* executes the editor resolver and returns, if available,
|
||||
* a string that may be used as the href property for that
|
||||
* file reference.
|
||||
*
|
||||
* @throws InvalidArgumentException If editor resolver does not return a string
|
||||
* @param string $filePath
|
||||
* @param int $line
|
||||
* @return string|bool
|
||||
*/
|
||||
public function getEditorHref($filePath, $line)
|
||||
{
|
||||
$editor = $this->getEditor($filePath, $line);
|
||||
|
||||
if (!$editor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that the editor is a string, and replace the
|
||||
// %line and %file placeholders:
|
||||
if (!isset($editor['url']) || !is_string($editor['url'])) {
|
||||
throw new UnexpectedValueException(
|
||||
__METHOD__ . " should always resolve to a string or a valid editor array; got something else instead."
|
||||
);
|
||||
}
|
||||
|
||||
$editor['url'] = str_replace("%line", rawurlencode($line), $editor['url']);
|
||||
$editor['url'] = str_replace("%file", rawurlencode($filePath), $editor['url']);
|
||||
|
||||
return $editor['url'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a boolean if the editor link should
|
||||
* act as an Ajax request. The editor must be a
|
||||
* valid callable function/closure
|
||||
*
|
||||
* @throws UnexpectedValueException If editor resolver does not return a boolean
|
||||
* @param string $filePath
|
||||
* @param int $line
|
||||
* @return bool
|
||||
*/
|
||||
public function getEditorAjax($filePath, $line)
|
||||
{
|
||||
$editor = $this->getEditor($filePath, $line);
|
||||
|
||||
// Check that the ajax is a bool
|
||||
if (!isset($editor['ajax']) || !is_bool($editor['ajax'])) {
|
||||
throw new UnexpectedValueException(
|
||||
__METHOD__ . " should always resolve to a bool; got something else instead."
|
||||
);
|
||||
}
|
||||
return $editor['ajax'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a boolean if the editor link should
|
||||
* act as an Ajax request. The editor must be a
|
||||
* valid callable function/closure
|
||||
*
|
||||
* @throws UnexpectedValueException If editor resolver does not return a boolean
|
||||
* @param string $filePath
|
||||
* @param int $line
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getEditor($filePath, $line)
|
||||
{
|
||||
if ($this->editor === null && !is_string($this->editor) && !is_callable($this->editor))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(is_string($this->editor) && isset($this->editors[$this->editor]) && !is_callable($this->editors[$this->editor]))
|
||||
{
|
||||
return array(
|
||||
'ajax' => false,
|
||||
'url' => $this->editors[$this->editor],
|
||||
);
|
||||
}
|
||||
else if(is_callable($this->editor) || (isset($this->editors[$this->editor]) && is_callable($this->editors[$this->editor])))
|
||||
{
|
||||
if(is_callable($this->editor))
|
||||
{
|
||||
$callback = call_user_func($this->editor, $filePath, $line);
|
||||
}
|
||||
else
|
||||
{
|
||||
$callback = call_user_func($this->editors[$this->editor], $filePath, $line);
|
||||
}
|
||||
|
||||
return array(
|
||||
'ajax' => isset($callback['ajax']) ? $callback['ajax'] : false,
|
||||
'url' => (is_array($callback) ? $callback['url'] : $callback),
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
* @return void
|
||||
*/
|
||||
public function setPageTitle($title)
|
||||
{
|
||||
$this->pageTitle = (string) $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPageTitle()
|
||||
{
|
||||
return $this->pageTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a path to the list of paths to be searched for
|
||||
* resources.
|
||||
*
|
||||
* @throws InvalidArgumnetException If $path is not a valid directory
|
||||
*
|
||||
* @param string $path
|
||||
* @return void
|
||||
*/
|
||||
public function addResourcePath($path)
|
||||
{
|
||||
if (!is_dir($path)) {
|
||||
throw new InvalidArgumentException(
|
||||
"'$path' is not a valid directory"
|
||||
);
|
||||
}
|
||||
|
||||
array_unshift($this->searchPaths, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a custom css file to be loaded.
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function addCustomCss($name)
|
||||
{
|
||||
$this->customCss = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getResourcePaths()
|
||||
{
|
||||
return $this->searchPaths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a resource, by its relative path, in all available search paths.
|
||||
* The search is performed starting at the last search path, and all the
|
||||
* way back to the first, enabling a cascading-type system of overrides
|
||||
* for all resources.
|
||||
*
|
||||
* @throws RuntimeException If resource cannot be found in any of the available paths
|
||||
*
|
||||
* @param string $resource
|
||||
* @return string
|
||||
*/
|
||||
protected function getResource($resource)
|
||||
{
|
||||
// If the resource was found before, we can speed things up
|
||||
// by caching its absolute, resolved path:
|
||||
if (isset($this->resourceCache[$resource])) {
|
||||
return $this->resourceCache[$resource];
|
||||
}
|
||||
|
||||
// Search through available search paths, until we find the
|
||||
// resource we're after:
|
||||
foreach ($this->searchPaths as $path) {
|
||||
$fullPath = $path . "/$resource";
|
||||
|
||||
if (is_file($fullPath)) {
|
||||
// Cache the result:
|
||||
$this->resourceCache[$resource] = $fullPath;
|
||||
return $fullPath;
|
||||
}
|
||||
}
|
||||
|
||||
// If we got this far, nothing was found.
|
||||
throw new RuntimeException(
|
||||
"Could not find resource '$resource' in any resource paths."
|
||||
. "(searched: " . join(", ", $this->searchPaths). ")"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResourcesPath()
|
||||
{
|
||||
$allPaths = $this->getResourcePaths();
|
||||
|
||||
// Compat: return only the first path added
|
||||
return end($allPaths) ?: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* @param string $resourcesPath
|
||||
* @return void
|
||||
*/
|
||||
public function setResourcesPath($resourcesPath)
|
||||
{
|
||||
$this->addResourcePath($resourcesPath);
|
||||
}
|
||||
}
|
99
developer/vendor/filp/whoops/src/Whoops/Handler/XmlResponseHandler.php
vendored
Normal file
99
developer/vendor/filp/whoops/src/Whoops/Handler/XmlResponseHandler.php
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Handler;
|
||||
|
||||
use SimpleXMLElement;
|
||||
use Whoops\Exception\Formatter;
|
||||
|
||||
/**
|
||||
* Catches an exception and converts it to an XML
|
||||
* response. Additionally can also return exception
|
||||
* frames for consumption by an API.
|
||||
*/
|
||||
class XmlResponseHandler extends Handler
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $returnFrames = false;
|
||||
|
||||
/**
|
||||
* @param bool|null $returnFrames
|
||||
* @return bool|$this
|
||||
*/
|
||||
public function addTraceToOutput($returnFrames = null)
|
||||
{
|
||||
if (func_num_args() == 0) {
|
||||
return $this->returnFrames;
|
||||
}
|
||||
|
||||
$this->returnFrames = (bool) $returnFrames;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$response = array(
|
||||
'error' => Formatter::formatExceptionAsDataArray(
|
||||
$this->getInspector(),
|
||||
$this->addTraceToOutput()
|
||||
),
|
||||
);
|
||||
|
||||
echo $this->toXml($response);
|
||||
|
||||
return Handler::QUIT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SimpleXMLElement $node Node to append data to, will be modified in place
|
||||
* @param array|Traversable $data
|
||||
* @return SimpleXMLElement The modified node, for chaining
|
||||
*/
|
||||
private static function addDataToNode(\SimpleXMLElement $node, $data)
|
||||
{
|
||||
assert('is_array($data) || $node instanceof Traversable');
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
if (is_numeric($key)) {
|
||||
// Convert the key to a valid string
|
||||
$key = "unknownNode_". (string) $key;
|
||||
}
|
||||
|
||||
// Delete any char not allowed in XML element names
|
||||
$key = preg_replace('/[^a-z0-9\-\_\.\:]/i', '', $key);
|
||||
|
||||
if (is_array($value)) {
|
||||
$child = $node->addChild($key);
|
||||
self::addDataToNode($child, $value);
|
||||
} else {
|
||||
$value = str_replace('&', '&', print_r($value, true));
|
||||
$node->addChild($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* The main function for converting to an XML document.
|
||||
*
|
||||
* @param array|Traversable $data
|
||||
* @return string XML
|
||||
*/
|
||||
private static function toXml($data)
|
||||
{
|
||||
assert('is_array($data) || $node instanceof Traversable');
|
||||
|
||||
$node = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><root />");
|
||||
|
||||
return self::addDataToNode($node, $data)->asXML();
|
||||
}
|
||||
}
|
521
developer/vendor/filp/whoops/src/Whoops/Resources/css/whoops.base.css
vendored
Normal file
521
developer/vendor/filp/whoops/src/Whoops/Resources/css/whoops.base.css
vendored
Normal file
@ -0,0 +1,521 @@
|
||||
.cf:before, .cf:after {content: " ";display: table;} .cf:after {clear: both;} .cf {*zoom: 1;}
|
||||
body {
|
||||
font: 12px "Helvetica Neue", helvetica, arial, sans-serif;
|
||||
color: #131313;
|
||||
background: #eeeeee;
|
||||
padding:0;
|
||||
margin: 0;
|
||||
max-height: 100%;
|
||||
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.container{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
margin: 0;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.branding {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 20px;
|
||||
color: #777777;
|
||||
font-size: 10px;
|
||||
z-index: 100;
|
||||
}
|
||||
.branding a {
|
||||
color: #e95353;
|
||||
}
|
||||
|
||||
header {
|
||||
color: white;
|
||||
box-sizing: border-box;
|
||||
background-color: #2a2a2a;
|
||||
padding: 35px 40px;
|
||||
max-height: 180px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
header:hover {
|
||||
max-height: 1000px;
|
||||
}
|
||||
|
||||
.exc-title {
|
||||
margin: 0;
|
||||
color: #bebebe;
|
||||
font-size: 14px;
|
||||
}
|
||||
.exc-title-primary {
|
||||
color: #e95353;
|
||||
}
|
||||
|
||||
.exc-message {
|
||||
font-size: 20px;
|
||||
word-wrap: break-word;
|
||||
margin: 4px 0 0 0;
|
||||
color: white;
|
||||
}
|
||||
.exc-message span {
|
||||
display: block;
|
||||
}
|
||||
.exc-message-empty-notice {
|
||||
color: #a29d9d;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.stack-container {
|
||||
height: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.details-container {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
float: right;
|
||||
width: 70%;
|
||||
background: #fafafa;
|
||||
}
|
||||
.details {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.details-heading {
|
||||
color: #4288CE;
|
||||
font-weight: 300;
|
||||
padding-bottom: 10px;
|
||||
margin-bottom: 10px;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, .1);
|
||||
}
|
||||
|
||||
.details pre.sf-dump {
|
||||
white-space: pre;
|
||||
word-wrap: inherit;
|
||||
}
|
||||
|
||||
.details pre.sf-dump,
|
||||
.details pre.sf-dump .sf-dump-num,
|
||||
.details pre.sf-dump .sf-dump-const,
|
||||
.details pre.sf-dump .sf-dump-str,
|
||||
.details pre.sf-dump .sf-dump-note,
|
||||
.details pre.sf-dump .sf-dump-ref,
|
||||
.details pre.sf-dump .sf-dump-public,
|
||||
.details pre.sf-dump .sf-dump-protected,
|
||||
.details pre.sf-dump .sf-dump-private,
|
||||
.details pre.sf-dump .sf-dump-meta,
|
||||
.details pre.sf-dump .sf-dump-key,
|
||||
.details pre.sf-dump .sf-dump-index {
|
||||
color: #463C54;
|
||||
}
|
||||
|
||||
.left-panel {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
float: left;
|
||||
width: 30%;
|
||||
background: #ded8d8;
|
||||
}
|
||||
|
||||
.frames-description {
|
||||
background: rgba(0, 0, 0, .05);
|
||||
padding: 8px 15px;
|
||||
color: #a29d9d;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.frame {
|
||||
padding: 14px;
|
||||
cursor: pointer;
|
||||
transition: all 0.1s ease;
|
||||
background: #eeeeee;
|
||||
}
|
||||
.frame:not(:last-child) {
|
||||
border-bottom: 1px solid rgba(0, 0, 0, .05);
|
||||
}
|
||||
|
||||
.frame.active {
|
||||
box-shadow: inset -5px 0 0 0 #4288CE;
|
||||
color: #4288CE;
|
||||
}
|
||||
|
||||
.frame:not(.active):hover {
|
||||
background: #BEE9EA;
|
||||
}
|
||||
|
||||
.frame-method-info {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.frame-class, .frame-function, .frame-index {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.frame-index {
|
||||
font-size: 11px;
|
||||
color: #a29d9d;
|
||||
background-color: rgba(0, 0, 0, .05);
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
line-height: 18px;
|
||||
border-radius: 5px;
|
||||
padding: 0 1px 0 1px;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.frame-file {
|
||||
font-family: "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace;
|
||||
word-wrap: break-word;
|
||||
color: #a29d9d;
|
||||
}
|
||||
|
||||
.frame-file .editor-link {
|
||||
color: #a29d9d;
|
||||
}
|
||||
|
||||
.frame-line {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.frame-line:before {
|
||||
content: ":";
|
||||
}
|
||||
|
||||
.frame-code {
|
||||
padding: 5px;
|
||||
background: #303030;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.frame-code.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.frame-code .frame-file {
|
||||
color: #a29d9d;
|
||||
padding: 12px 6px;
|
||||
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.code-block {
|
||||
padding: 10px;
|
||||
margin: 0;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 3px 0 rgba(0, 0, 0, .05),
|
||||
0 10px 30px rgba(0, 0, 0, .05),
|
||||
inset 0 0 1px 0 rgba(255, 255, 255, .07);
|
||||
-moz-tab-size: 4;
|
||||
-o-tab-size: 4;
|
||||
tab-size: 4;
|
||||
}
|
||||
|
||||
.linenums {
|
||||
margin: 0;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.frame-comments {
|
||||
border-top: none;
|
||||
margin-top: 15px;
|
||||
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.frame-comments.empty {
|
||||
}
|
||||
|
||||
.frame-comments.empty:before {
|
||||
content: "No comments for this stack frame.";
|
||||
font-weight: 300;
|
||||
color: #a29d9d;
|
||||
}
|
||||
|
||||
.frame-comment {
|
||||
padding: 10px;
|
||||
color: #e3e3e3;
|
||||
border-radius: 6px;
|
||||
background-color: rgba(255, 255, 255, .05);
|
||||
}
|
||||
.frame-comment a {
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
.frame-comment a:hover {
|
||||
color: #4bb1b1;
|
||||
}
|
||||
|
||||
.frame-comment:not(:last-child) {
|
||||
border-bottom: 1px dotted rgba(0, 0, 0, .3);
|
||||
}
|
||||
|
||||
.frame-comment-context {
|
||||
font-size: 10px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.data-table-container label {
|
||||
font-size: 16px;
|
||||
color: #303030;
|
||||
font-weight: bold;
|
||||
margin: 10px 0;
|
||||
|
||||
display: block;
|
||||
|
||||
margin-bottom: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.data-table {
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.data-table tbody {
|
||||
font: 13px "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace;
|
||||
}
|
||||
|
||||
.data-table thead {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.data-table tr {
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
.data-table td:first-child {
|
||||
width: 20%;
|
||||
min-width: 130px;
|
||||
overflow: hidden;
|
||||
font-weight: bold;
|
||||
color: #463C54;
|
||||
padding-right: 5px;
|
||||
|
||||
}
|
||||
|
||||
.data-table td:last-child {
|
||||
width: 80%;
|
||||
-ms-word-break: break-all;
|
||||
word-break: break-all;
|
||||
word-break: break-word;
|
||||
-webkit-hyphens: auto;
|
||||
-moz-hyphens: auto;
|
||||
hyphens: auto;
|
||||
}
|
||||
|
||||
.data-table span.empty {
|
||||
color: rgba(0, 0, 0, .3);
|
||||
font-weight: 300;
|
||||
}
|
||||
.data-table label.empty {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.handler {
|
||||
padding: 4px 0;
|
||||
font: 14px "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace;
|
||||
}
|
||||
|
||||
/* prettify code style
|
||||
Uses the Doxy theme as a base */
|
||||
pre .str, code .str { color: #BCD42A; } /* string */
|
||||
pre .kwd, code .kwd { color: #4bb1b1; font-weight: bold; } /* keyword*/
|
||||
pre .com, code .com { color: #888; font-weight: bold; } /* comment */
|
||||
pre .typ, code .typ { color: #ef7c61; } /* type */
|
||||
pre .lit, code .lit { color: #BCD42A; } /* literal */
|
||||
pre .pun, code .pun { color: #fff; font-weight: bold; } /* punctuation */
|
||||
pre .pln, code .pln { color: #e9e4e5; } /* plaintext */
|
||||
pre .tag, code .tag { color: #4bb1b1; } /* html/xml tag */
|
||||
pre .htm, code .htm { color: #dda0dd; } /* html tag */
|
||||
pre .xsl, code .xsl { color: #d0a0d0; } /* xslt tag */
|
||||
pre .atn, code .atn { color: #ef7c61; font-weight: normal;} /* html/xml attribute name */
|
||||
pre .atv, code .atv { color: #bcd42a; } /* html/xml attribute value */
|
||||
pre .dec, code .dec { color: #606; } /* decimal */
|
||||
pre.prettyprint, code.prettyprint, .frame-args.prettyprint, .frame-args.prettyprint samp {
|
||||
font-family: "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace;
|
||||
background: #333;
|
||||
color: #e9e4e5;
|
||||
}
|
||||
pre.prettyprint {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre.prettyprint a, code.prettyprint a {
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
.linenums li {
|
||||
color: #A5A5A5;
|
||||
}
|
||||
|
||||
.linenums li.current{
|
||||
background: rgba(255, 100, 100, .07);
|
||||
padding-top: 4px;
|
||||
padding-left: 1px;
|
||||
}
|
||||
.linenums li.current.active {
|
||||
background: rgba(255, 100, 100, .17);
|
||||
}
|
||||
|
||||
#plain-exception {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#copy-button {
|
||||
cursor: pointer;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.clipboard {
|
||||
opacity: .8;
|
||||
background: none;
|
||||
|
||||
color: rgba(255, 255, 255, 0.1);
|
||||
box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
|
||||
|
||||
border-radius: 3px;
|
||||
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
.clipboard:hover {
|
||||
box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3);
|
||||
color: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
/* inspired by githubs kbd styles */
|
||||
kbd {
|
||||
-moz-border-bottom-colors: none;
|
||||
-moz-border-left-colors: none;
|
||||
-moz-border-right-colors: none;
|
||||
-moz-border-top-colors: none;
|
||||
background-color: #fcfcfc;
|
||||
border-color: #ccc #ccc #bbb;
|
||||
border-image: none;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
color: #555;
|
||||
display: inline-block;
|
||||
font-size: 11px;
|
||||
line-height: 10px;
|
||||
padding: 3px 5px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
|
||||
/* == Media queries */
|
||||
|
||||
/* Expand the spacing in the details section */
|
||||
@media (min-width: 1000px) {
|
||||
.details, .frame-code {
|
||||
padding: 20px 40px;
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.details-container {
|
||||
width: 68%;
|
||||
}
|
||||
|
||||
.frames-container {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.left-panel {
|
||||
width: 32%;
|
||||
}
|
||||
}
|
||||
|
||||
.tooltipped {
|
||||
position: relative
|
||||
}
|
||||
.tooltipped:after {
|
||||
position: absolute;
|
||||
z-index: 1000000;
|
||||
display: none;
|
||||
padding: 5px 8px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
text-shadow: none;
|
||||
text-transform: none;
|
||||
letter-spacing: normal;
|
||||
word-wrap: break-word;
|
||||
white-space: pre;
|
||||
pointer-events: none;
|
||||
content: attr(aria-label);
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
border-radius: 3px;
|
||||
-webkit-font-smoothing: subpixel-antialiased
|
||||
}
|
||||
.tooltipped:before {
|
||||
position: absolute;
|
||||
z-index: 1000001;
|
||||
display: none;
|
||||
width: 0;
|
||||
height: 0;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
pointer-events: none;
|
||||
content: "";
|
||||
border: 5px solid transparent
|
||||
}
|
||||
.tooltipped:hover:before,
|
||||
.tooltipped:hover:after,
|
||||
.tooltipped:active:before,
|
||||
.tooltipped:active:after,
|
||||
.tooltipped:focus:before,
|
||||
.tooltipped:focus:after {
|
||||
display: inline-block;
|
||||
text-decoration: none
|
||||
}
|
||||
.tooltipped-s:after {
|
||||
top: 100%;
|
||||
right: 50%;
|
||||
margin-top: 5px
|
||||
}
|
||||
.tooltipped-s:before {
|
||||
top: auto;
|
||||
right: 50%;
|
||||
bottom: -5px;
|
||||
margin-right: -5px;
|
||||
border-bottom-color: rgba(0, 0, 0, 0.8)
|
||||
}
|
||||
|
||||
pre.sf-dump {
|
||||
padding: 0px !important;
|
||||
margin: 0px !important;
|
||||
}
|
||||
|
||||
.search-for-help {
|
||||
width: 85%;
|
||||
padding: 0;
|
||||
margin: 10px 0;
|
||||
list-style-type: none;
|
||||
display: inline-block;
|
||||
}
|
||||
.search-for-help li {
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.search-for-help li:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
.search-for-help li a {
|
||||
|
||||
}
|
||||
.search-for-help li a i {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
}
|
||||
.search-for-help li a svg {
|
||||
fill: #fff;
|
||||
}
|
||||
.search-for-help li a svg path {
|
||||
background-size: contain;
|
||||
}
|
7
developer/vendor/filp/whoops/src/Whoops/Resources/js/clipboard.min.js
vendored
Normal file
7
developer/vendor/filp/whoops/src/Whoops/Resources/js/clipboard.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
128
developer/vendor/filp/whoops/src/Whoops/Resources/js/whoops.base.js
vendored
Normal file
128
developer/vendor/filp/whoops/src/Whoops/Resources/js/whoops.base.js
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
Zepto(function($) {
|
||||
// a jQuery.getScript() equivalent to asyncronously load javascript files
|
||||
// credits to http://stackoverflow.com/a/8812950/1597388
|
||||
var getScript = function(src, func) {
|
||||
var script = document.createElement('script');
|
||||
script.async = 'async';
|
||||
script.src = src;
|
||||
if (func) {
|
||||
script.onload = func;
|
||||
}
|
||||
document.getElementsByTagName('head')[0].appendChild( script );
|
||||
};
|
||||
|
||||
// load prettify asyncronously to speedup page rendering
|
||||
getScript('//cdnjs.cloudflare.com/ajax/libs/prettify/r224/prettify.js', function() {
|
||||
prettyPrint();
|
||||
});
|
||||
|
||||
var $frameContainer = $('.frames-container');
|
||||
var $container = $('.details-container');
|
||||
var $activeLine = $frameContainer.find('.frame.active');
|
||||
var $activeFrame = $container.find('.frame-code.active');
|
||||
var $ajaxEditors = $('.editor-link[data-ajax]');
|
||||
var headerHeight = $('header').height();
|
||||
|
||||
var highlightCurrentLine = function() {
|
||||
// Highlight the active and neighboring lines for this frame:
|
||||
var activeLineNumber = +($activeLine.find('.frame-line').text());
|
||||
var $lines = $activeFrame.find('.linenums li');
|
||||
var firstLine = +($lines.first().val());
|
||||
|
||||
$($lines[activeLineNumber - firstLine - 1]).addClass('current');
|
||||
$($lines[activeLineNumber - firstLine]).addClass('current active');
|
||||
$($lines[activeLineNumber - firstLine + 1]).addClass('current');
|
||||
}
|
||||
|
||||
// Highlight the active for the first frame:
|
||||
highlightCurrentLine();
|
||||
|
||||
$frameContainer.on('click', '.frame', function() {
|
||||
var $this = $(this);
|
||||
var id = /frame\-line\-([\d]*)/.exec($this.attr('id'))[1];
|
||||
var $codeFrame = $('#frame-code-' + id);
|
||||
|
||||
if ($codeFrame) {
|
||||
$activeLine.removeClass('active');
|
||||
$activeFrame.removeClass('active');
|
||||
|
||||
$this.addClass('active');
|
||||
$codeFrame.addClass('active');
|
||||
|
||||
$activeLine = $this;
|
||||
$activeFrame = $codeFrame;
|
||||
|
||||
highlightCurrentLine();
|
||||
|
||||
$container.scrollTop(0);
|
||||
}
|
||||
});
|
||||
|
||||
var clipboard = new Clipboard('.clipboard');
|
||||
var showTooltip = function(elem, msg) {
|
||||
elem.setAttribute('class', 'clipboard tooltipped tooltipped-s');
|
||||
elem.setAttribute('aria-label', msg);
|
||||
};
|
||||
|
||||
clipboard.on('success', function(e) {
|
||||
e.clearSelection();
|
||||
|
||||
showTooltip(e.trigger, 'Copied!');
|
||||
});
|
||||
|
||||
clipboard.on('error', function(e) {
|
||||
showTooltip(e.trigger, fallbackMessage(e.action));
|
||||
});
|
||||
|
||||
var btn = document.querySelector('.clipboard');
|
||||
|
||||
btn.addEventListener('mouseleave', function(e) {
|
||||
e.currentTarget.setAttribute('class', 'clipboard');
|
||||
e.currentTarget.removeAttribute('aria-label');
|
||||
});
|
||||
|
||||
function fallbackMessage(action) {
|
||||
var actionMsg = '';
|
||||
var actionKey = (action === 'cut' ? 'X' : 'C');
|
||||
|
||||
if (/Mac/i.test(navigator.userAgent)) {
|
||||
actionMsg = 'Press ⌘-' + actionKey + ' to ' + action;
|
||||
} else {
|
||||
actionMsg = 'Press Ctrl-' + actionKey + ' to ' + action;
|
||||
}
|
||||
|
||||
return actionMsg;
|
||||
}
|
||||
|
||||
$(document).on('keydown', function(e) {
|
||||
if(e.ctrlKey) {
|
||||
// CTRL+Arrow-UP/Arrow-Down support:
|
||||
// 1) select the next/prev element
|
||||
// 2) make sure the newly selected element is within the view-scope
|
||||
// 3) focus the (right) container, so arrow-up/down (without ctrl) scroll the details
|
||||
if (e.which === 38 /* arrow up */) {
|
||||
$activeLine.prev('.frame').click();
|
||||
$activeLine[0].scrollIntoView();
|
||||
$container.focus();
|
||||
e.preventDefault();
|
||||
} else if (e.which === 40 /* arrow down */) {
|
||||
$activeLine.next('.frame').click();
|
||||
$activeLine[0].scrollIntoView();
|
||||
$container.focus();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Avoid to quit the page with some protocol (e.g. IntelliJ Platform REST API)
|
||||
$ajaxEditors.on('click', function(e){
|
||||
e.preventDefault();
|
||||
$.get(this.href);
|
||||
});
|
||||
|
||||
// Symfony VarDumper: Close the by default expanded objects
|
||||
$('.sf-dump-expanded')
|
||||
.removeClass('sf-dump-expanded')
|
||||
.addClass('sf-dump-compact');
|
||||
$('.sf-dump-toggle span').html('▶');
|
||||
});
|
2
developer/vendor/filp/whoops/src/Whoops/Resources/js/zepto.min.js
vendored
Normal file
2
developer/vendor/filp/whoops/src/Whoops/Resources/js/zepto.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
42
developer/vendor/filp/whoops/src/Whoops/Resources/views/env_details.html.php
vendored
Normal file
42
developer/vendor/filp/whoops/src/Whoops/Resources/views/env_details.html.php
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
<?php /* List data-table values, i.e: $_SERVER, $_GET, .... */ ?>
|
||||
<div class="details">
|
||||
<h2 class="details-heading">Environment & details:</h2>
|
||||
|
||||
<div class="data-table-container" id="data-tables">
|
||||
<?php foreach ($tables as $label => $data): ?>
|
||||
<div class="data-table" id="sg-<?php echo $tpl->escape($tpl->slug($label)) ?>">
|
||||
<?php if (!empty($data)): ?>
|
||||
<label><?php echo $tpl->escape($label) ?></label>
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="data-table-k">Key</td>
|
||||
<td class="data-table-v">Value</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php foreach ($data as $k => $value): ?>
|
||||
<tr>
|
||||
<td><?php echo $tpl->escape($k) ?></td>
|
||||
<td><?php echo $tpl->dump($value) ?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
<label class="empty"><?php echo $tpl->escape($label) ?></label>
|
||||
<span class="empty">empty</span>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
|
||||
<?php /* List registered handlers, in order of first to last registered */ ?>
|
||||
<div class="data-table-container" id="handlers">
|
||||
<label>Registered Handlers</label>
|
||||
<?php foreach ($handlers as $i => $handler): ?>
|
||||
<div class="handler <?php echo ($handler === $handler) ? 'active' : ''?>">
|
||||
<?php echo $i ?>. <?php echo $tpl->escape(get_class($handler)) ?>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
|
||||
</div>
|
76
developer/vendor/filp/whoops/src/Whoops/Resources/views/frame_code.html.php
vendored
Normal file
76
developer/vendor/filp/whoops/src/Whoops/Resources/views/frame_code.html.php
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
<?php /* Display a code block for all frames in the stack.
|
||||
* @todo: This should PROBABLY be done on-demand, lest
|
||||
* we get 200 frames to process. */ ?>
|
||||
<div class="frame-code-container <?php echo (!$has_frames ? 'empty' : '') ?>">
|
||||
<?php foreach ($frames as $i => $frame): ?>
|
||||
<?php $line = $frame->getLine(); ?>
|
||||
<div class="frame-code <?php echo ($i == 0 ) ? 'active' : '' ?>" id="frame-code-<?php echo $i ?>">
|
||||
<div class="frame-file">
|
||||
<?php $filePath = $frame->getFile(); ?>
|
||||
<?php if ($filePath && $editorHref = $handler->getEditorHref($filePath, (int) $line)): ?>
|
||||
Open:
|
||||
<a href="<?php echo $editorHref ?>" class="editor-link"<?php echo ($handler->getEditorAjax($filePath, (int) $line) ? ' data-ajax' : '') ?>>
|
||||
<strong><?php echo $tpl->escape($filePath ?: '<#unknown>') ?></strong>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<strong><?php echo $tpl->escape($filePath ?: '<#unknown>') ?></strong>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?php
|
||||
// Do nothing if there's no line to work off
|
||||
if ($line !== null):
|
||||
|
||||
// the $line is 1-indexed, we nab -1 where needed to account for this
|
||||
$range = $frame->getFileLines($line - 10, 20);
|
||||
|
||||
// getFileLines can return null if there is no source code
|
||||
if ($range):
|
||||
$range = array_map(function ($line) { return empty($line) ? ' ' : $line;}, $range);
|
||||
$start = key($range) + 1;
|
||||
$code = join("\n", $range);
|
||||
?>
|
||||
<style>
|
||||
#frame-code-0 .linenums li:nth-child(<?= $line-$start ?>) {
|
||||
background-color: rgba(255, 100, 100, .07);
|
||||
padding: 2px;
|
||||
}
|
||||
#frame-code-0 .linenums li:nth-child(<?= $line-$start+1 ?>) {
|
||||
background-color: rgba(255, 100, 100, .17);
|
||||
padding: 2px;
|
||||
}
|
||||
#frame-code-0 .linenums li:nth-child(<?= $line-$start+2 ?>) {
|
||||
background-color: rgba(255, 100, 100, .07);
|
||||
padding: 2px;
|
||||
}
|
||||
</style>
|
||||
<pre class="code-block prettyprint linenums:<?php echo $start ?>"><?php echo $tpl->escape($code) ?></pre>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php $frameArgs = $tpl->dumpArgs($frame); ?>
|
||||
<?php if ($frameArgs): ?>
|
||||
<div class="frame-file">
|
||||
Arguments
|
||||
</div>
|
||||
<div class="code-block frame-args prettyprint">
|
||||
<?php echo $frameArgs; ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<?php
|
||||
// Append comments for this frame
|
||||
$comments = $frame->getComments();
|
||||
?>
|
||||
<div class="frame-comments <?php echo empty($comments) ? 'empty' : '' ?>">
|
||||
<?php foreach ($comments as $commentNo => $comment): ?>
|
||||
<?php extract($comment) ?>
|
||||
<div class="frame-comment" id="comment-<?php echo $i . '-' . $commentNo ?>">
|
||||
<span class="frame-comment-context"><?php echo $tpl->escape($context) ?></span>
|
||||
<?php echo $tpl->escapeButPreserveUris($comment) ?>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
</div>
|
17
developer/vendor/filp/whoops/src/Whoops/Resources/views/frame_list.html.php
vendored
Normal file
17
developer/vendor/filp/whoops/src/Whoops/Resources/views/frame_list.html.php
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
<?php /* List file names & line numbers for all stack frames;
|
||||
clicking these links/buttons will display the code view
|
||||
for that particular frame */ ?>
|
||||
<?php foreach ($frames as $i => $frame): ?>
|
||||
<div class="frame <?php echo ($i == 0 ? 'active' : '') ?>" id="frame-line-<?php echo $i ?>">
|
||||
<div class="frame-method-info">
|
||||
<span class="frame-index"><?php echo (count($frames) - $i - 1) ?></span>
|
||||
<span class="frame-class"><?php echo $tpl->escape($frame->getClass() ?: '') ?></span>
|
||||
<span class="frame-function"><?php echo $tpl->escape($frame->getFunction() ?: '') ?></span>
|
||||
</div>
|
||||
|
||||
<span class="frame-file">
|
||||
<?php echo ($frame->getFile(true) ?: '<#unknown>') ?><!--
|
||||
--><span class="frame-line"><?php echo (int) $frame->getLine() ?></span>
|
||||
</span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
50
developer/vendor/filp/whoops/src/Whoops/Resources/views/header.html.php
vendored
Normal file
50
developer/vendor/filp/whoops/src/Whoops/Resources/views/header.html.php
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
<div class="exception">
|
||||
<div class="exc-title">
|
||||
<?php foreach ($name as $i => $nameSection): ?>
|
||||
<?php if ($i == count($name) - 1): ?>
|
||||
<span class="exc-title-primary"><?php echo $tpl->escape($nameSection) ?></span>
|
||||
<?php else: ?>
|
||||
<?php echo $tpl->escape($nameSection) . ' \\' ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
<?php if ($code): ?>
|
||||
<span title="Exception Code">(<?php echo $tpl->escape($code) ?>)</span>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
<div class="exc-message">
|
||||
<?php if (!empty($message)): ?>
|
||||
<span><?php echo $tpl->escape($message) ?></span>
|
||||
<?php else: ?>
|
||||
<span class="exc-message-empty-notice">No message</span>
|
||||
<?php endif ?>
|
||||
|
||||
<ul class="search-for-help">
|
||||
<li>
|
||||
<a target="_blank" href="https://google.com/search?q=<?php echo urlencode(implode('\\', $name).' '.$message) ?>" title="Search for help on Google.">
|
||||
<!-- Google icon by Alfredo H, from https://www.iconfinder.com/alfredoh -->
|
||||
<!-- Creative Commons (Attribution 3.0 Unported) -->
|
||||
<!-- http://creativecommons.org/licenses/by/3.0/ -->
|
||||
<svg class="google" height="16" viewBox="0 0 512 512" width="16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M457.732 216.625c2.628 14.04 4.063 28.743 4.063 44.098C461.795 380.688 381.48 466 260.205 466c-116.024 0-210-93.977-210-210s93.976-210 210-210c56.703 0 104.076 20.867 140.44 54.73l-59.205 59.197v-.135c-22.046-21.002-50-31.762-81.236-31.762-69.297 0-125.604 58.537-125.604 127.84 0 69.29 56.306 127.97 125.604 127.97 62.87 0 105.653-35.966 114.46-85.313h-114.46v-81.902h197.528z"/>
|
||||
</svg>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a target="_blank" href="https://stackoverflow.com/search?q=<?php echo urlencode(implode('\\', $name).' '.$message) ?>" title="Search for help on Stack Overflow.">
|
||||
<!-- Stack Overflow icon by Picons.me, from https://www.iconfinder.com/Picons -->
|
||||
<!-- Free for commercial use -->
|
||||
<svg class="stackoverflow" height="16" viewBox="-1163 1657.697 56.693 56.693" width="16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M-1126.04 1689.533l-16.577-9.778 2.088-3.54 16.578 9.778zM-1127.386 1694.635l-18.586-4.996 1.068-3.97 18.586 4.995zM-1127.824 1700.137l-19.165-1.767.378-4.093 19.165 1.767zM-1147.263 1701.293h19.247v4.11h-19.247z"/>
|
||||
<path d="M-1121.458 1710.947s0 .96-.032.96v.016h-30.796s-.96 0-.96-.016h-.032v-20.03h3.288v16.805h25.244v-16.804h3.288v19.07zM-1130.667 1667.04l10.844 15.903-3.396 2.316-10.843-15.903zM-1118.313 1663.044l3.29 18.963-4.05.703-3.29-18.963z"/>
|
||||
</svg>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<span id="plain-exception"><?php echo $tpl->escape($plain_exception) ?></span>
|
||||
<button id="copy-button" class="clipboard" data-clipboard-text="<?php echo $tpl->escape($plain_exception) ?>" title="Copy exception details to clipboard">
|
||||
COPY
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
42
developer/vendor/filp/whoops/src/Whoops/Resources/views/layout.html.php
vendored
Normal file
42
developer/vendor/filp/whoops/src/Whoops/Resources/views/layout.html.php
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Layout template file for Whoops's pretty error output.
|
||||
*/
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title><?php echo $tpl->escape($page_title) ?></title>
|
||||
|
||||
<style><?php echo $stylesheet ?></style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="Whoops container">
|
||||
<div class="stack-container">
|
||||
<div class="left-panel cf <?php echo (!$has_frames ? 'empty' : '') ?>">
|
||||
<header>
|
||||
<?php $tpl->render($header) ?>
|
||||
</header>
|
||||
|
||||
<div class="frames-description">
|
||||
Stack frames (<?php echo count($frames) ?>):
|
||||
</div>
|
||||
|
||||
<div class="frames-container">
|
||||
<?php $tpl->render($frame_list) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="details-container cf">
|
||||
<?php $tpl->render($frame_code) ?>
|
||||
<?php $tpl->render($env_details) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script><?php echo $zepto ?></script>
|
||||
<script><?php echo $clipboard ?></script>
|
||||
<script><?php echo $javascript ?></script>
|
||||
</body>
|
||||
</html>
|
390
developer/vendor/filp/whoops/src/Whoops/Run.php
vendored
Normal file
390
developer/vendor/filp/whoops/src/Whoops/Run.php
vendored
Normal file
@ -0,0 +1,390 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Whoops\Exception\ErrorException;
|
||||
use Whoops\Exception\Inspector;
|
||||
use Whoops\Handler\CallbackHandler;
|
||||
use Whoops\Handler\Handler;
|
||||
use Whoops\Handler\HandlerInterface;
|
||||
use Whoops\Util\Misc;
|
||||
use Whoops\Util\SystemFacade;
|
||||
|
||||
final class Run implements RunInterface
|
||||
{
|
||||
private $isRegistered;
|
||||
private $allowQuit = true;
|
||||
private $sendOutput = true;
|
||||
|
||||
/**
|
||||
* @var integer|false
|
||||
*/
|
||||
private $sendHttpCode = 500;
|
||||
|
||||
/**
|
||||
* @var HandlerInterface[]
|
||||
*/
|
||||
private $handlerStack = array();
|
||||
|
||||
private $silencedPatterns = array();
|
||||
|
||||
private $system;
|
||||
|
||||
public function __construct(SystemFacade $system = null)
|
||||
{
|
||||
$this->system = $system ?: new SystemFacade;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes a handler to the end of the stack
|
||||
*
|
||||
* @throws InvalidArgumentException If argument is not callable or instance of HandlerInterface
|
||||
* @param Callable|HandlerInterface $handler
|
||||
* @return Run
|
||||
*/
|
||||
public function pushHandler($handler)
|
||||
{
|
||||
if (is_callable($handler)) {
|
||||
$handler = new CallbackHandler($handler);
|
||||
}
|
||||
|
||||
if (!$handler instanceof HandlerInterface) {
|
||||
throw new InvalidArgumentException(
|
||||
"Argument to " . __METHOD__ . " must be a callable, or instance of "
|
||||
. "Whoops\\Handler\\HandlerInterface"
|
||||
);
|
||||
}
|
||||
|
||||
$this->handlerStack[] = $handler;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the last handler in the stack and returns it.
|
||||
* Returns null if there"s nothing else to pop.
|
||||
* @return null|HandlerInterface
|
||||
*/
|
||||
public function popHandler()
|
||||
{
|
||||
return array_pop($this->handlerStack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with all handlers, in the
|
||||
* order they were added to the stack.
|
||||
* @return array
|
||||
*/
|
||||
public function getHandlers()
|
||||
{
|
||||
return $this->handlerStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all handlers in the handlerStack, including
|
||||
* the default PrettyPage handler.
|
||||
* @return Run
|
||||
*/
|
||||
public function clearHandlers()
|
||||
{
|
||||
$this->handlerStack = array();
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Throwable $exception
|
||||
* @return Inspector
|
||||
*/
|
||||
private function getInspector($exception)
|
||||
{
|
||||
return new Inspector($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an error handler.
|
||||
* @return Run
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
if (!$this->isRegistered) {
|
||||
// Workaround PHP bug 42098
|
||||
// https://bugs.php.net/bug.php?id=42098
|
||||
class_exists("\\Whoops\\Exception\\ErrorException");
|
||||
class_exists("\\Whoops\\Exception\\FrameCollection");
|
||||
class_exists("\\Whoops\\Exception\\Frame");
|
||||
class_exists("\\Whoops\\Exception\\Inspector");
|
||||
|
||||
$this->system->setErrorHandler(array($this, self::ERROR_HANDLER));
|
||||
$this->system->setExceptionHandler(array($this, self::EXCEPTION_HANDLER));
|
||||
$this->system->registerShutdownFunction(array($this, self::SHUTDOWN_HANDLER));
|
||||
|
||||
$this->isRegistered = true;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters all handlers registered by this Whoops\Run instance
|
||||
* @return Run
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
if ($this->isRegistered) {
|
||||
$this->system->restoreExceptionHandler();
|
||||
$this->system->restoreErrorHandler();
|
||||
|
||||
$this->isRegistered = false;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should Whoops allow Handlers to force the script to quit?
|
||||
* @param bool|int $exit
|
||||
* @return bool
|
||||
*/
|
||||
public function allowQuit($exit = null)
|
||||
{
|
||||
if (func_num_args() == 0) {
|
||||
return $this->allowQuit;
|
||||
}
|
||||
|
||||
return $this->allowQuit = (bool) $exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Silence particular errors in particular files
|
||||
* @param array|string $patterns List or a single regex pattern to match
|
||||
* @param int $levels Defaults to E_STRICT | E_DEPRECATED
|
||||
* @return \Whoops\Run
|
||||
*/
|
||||
public function silenceErrorsInPaths($patterns, $levels = 10240)
|
||||
{
|
||||
$this->silencedPatterns = array_merge(
|
||||
$this->silencedPatterns,
|
||||
array_map(
|
||||
function ($pattern) use ($levels) {
|
||||
return array(
|
||||
"pattern" => $pattern,
|
||||
"levels" => $levels,
|
||||
);
|
||||
},
|
||||
(array) $patterns
|
||||
)
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/*
|
||||
* Should Whoops send HTTP error code to the browser if possible?
|
||||
* Whoops will by default send HTTP code 500, but you may wish to
|
||||
* use 502, 503, or another 5xx family code.
|
||||
*
|
||||
* @param bool|int $code
|
||||
* @return int|false
|
||||
*/
|
||||
public function sendHttpCode($code = null)
|
||||
{
|
||||
if (func_num_args() == 0) {
|
||||
return $this->sendHttpCode;
|
||||
}
|
||||
|
||||
if (!$code) {
|
||||
return $this->sendHttpCode = false;
|
||||
}
|
||||
|
||||
if ($code === true) {
|
||||
$code = 500;
|
||||
}
|
||||
|
||||
if ($code < 400 || 600 <= $code) {
|
||||
throw new InvalidArgumentException(
|
||||
"Invalid status code '$code', must be 4xx or 5xx"
|
||||
);
|
||||
}
|
||||
|
||||
return $this->sendHttpCode = $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should Whoops push output directly to the client?
|
||||
* If this is false, output will be returned by handleException
|
||||
* @param bool|int $send
|
||||
* @return bool
|
||||
*/
|
||||
public function writeToOutput($send = null)
|
||||
{
|
||||
if (func_num_args() == 0) {
|
||||
return $this->sendOutput;
|
||||
}
|
||||
|
||||
return $this->sendOutput = (bool) $send;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles an exception, ultimately generating a Whoops error
|
||||
* page.
|
||||
*
|
||||
* @param \Throwable $exception
|
||||
* @return string Output generated by handlers
|
||||
*/
|
||||
public function handleException($exception)
|
||||
{
|
||||
// Walk the registered handlers in the reverse order
|
||||
// they were registered, and pass off the exception
|
||||
$inspector = $this->getInspector($exception);
|
||||
|
||||
// Capture output produced while handling the exception,
|
||||
// we might want to send it straight away to the client,
|
||||
// or return it silently.
|
||||
$this->system->startOutputBuffering();
|
||||
|
||||
// Just in case there are no handlers:
|
||||
$handlerResponse = null;
|
||||
|
||||
foreach (array_reverse($this->handlerStack) as $handler) {
|
||||
$handler->setRun($this);
|
||||
$handler->setInspector($inspector);
|
||||
$handler->setException($exception);
|
||||
|
||||
// The HandlerInterface does not require an Exception passed to handle()
|
||||
// and neither of our bundled handlers use it.
|
||||
// However, 3rd party handlers may have already relied on this parameter,
|
||||
// and removing it would be possibly breaking for users.
|
||||
$handlerResponse = $handler->handle($exception);
|
||||
|
||||
if (in_array($handlerResponse, array(Handler::LAST_HANDLER, Handler::QUIT))) {
|
||||
// The Handler has handled the exception in some way, and
|
||||
// wishes to quit execution (Handler::QUIT), or skip any
|
||||
// other handlers (Handler::LAST_HANDLER). If $this->allowQuit
|
||||
// is false, Handler::QUIT behaves like Handler::LAST_HANDLER
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$willQuit = $handlerResponse == Handler::QUIT && $this->allowQuit();
|
||||
|
||||
$output = $this->system->cleanOutputBuffer();
|
||||
|
||||
// If we're allowed to, send output generated by handlers directly
|
||||
// to the output, otherwise, and if the script doesn't quit, return
|
||||
// it so that it may be used by the caller
|
||||
if ($this->writeToOutput()) {
|
||||
// @todo Might be able to clean this up a bit better
|
||||
// If we're going to quit execution, cleanup all other output
|
||||
// buffers before sending our own output:
|
||||
if ($willQuit) {
|
||||
while ($this->system->getOutputBufferLevel() > 0) {
|
||||
$this->system->endOutputBuffering();
|
||||
}
|
||||
}
|
||||
|
||||
$this->writeToOutputNow($output);
|
||||
}
|
||||
|
||||
if ($willQuit) {
|
||||
// HHVM fix for https://github.com/facebook/hhvm/issues/4055
|
||||
$this->system->flushOutputBuffer();
|
||||
|
||||
$this->system->stopExecution(1);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts generic PHP errors to \ErrorException
|
||||
* instances, before passing them off to be handled.
|
||||
*
|
||||
* This method MUST be compatible with set_error_handler.
|
||||
*
|
||||
* @param int $level
|
||||
* @param string $message
|
||||
* @param string $file
|
||||
* @param int $line
|
||||
*
|
||||
* @return bool
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function handleError($level, $message, $file = null, $line = null)
|
||||
{
|
||||
if ($level & $this->system->getErrorReportingLevel()) {
|
||||
foreach ($this->silencedPatterns as $entry) {
|
||||
$pathMatches = (bool) preg_match($entry["pattern"], $file);
|
||||
$levelMatches = $level & $entry["levels"];
|
||||
if ($pathMatches && $levelMatches) {
|
||||
// Ignore the error, abort handling
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// XXX we pass $level for the "code" param only for BC reasons.
|
||||
// see https://github.com/filp/whoops/issues/267
|
||||
$exception = new ErrorException($message, /*code*/ $level, /*severity*/ $level, $file, $line);
|
||||
if ($this->canThrowExceptions) {
|
||||
throw $exception;
|
||||
} else {
|
||||
$this->handleException($exception);
|
||||
}
|
||||
// Do not propagate errors which were already handled by Whoops.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Propagate error to the next handler, allows error_get_last() to
|
||||
// work on silenced errors.
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Special case to deal with Fatal errors and the like.
|
||||
*/
|
||||
public function handleShutdown()
|
||||
{
|
||||
// If we reached this step, we are in shutdown handler.
|
||||
// An exception thrown in a shutdown handler will not be propagated
|
||||
// to the exception handler. Pass that information along.
|
||||
$this->canThrowExceptions = false;
|
||||
|
||||
$error = $this->system->getLastError();
|
||||
if ($error && Misc::isLevelFatal($error['type'])) {
|
||||
// If there was a fatal error,
|
||||
// it was not handled in handleError yet.
|
||||
$this->handleError(
|
||||
$error['type'],
|
||||
$error['message'],
|
||||
$error['file'],
|
||||
$error['line']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* In certain scenarios, like in shutdown handler, we can not throw exceptions
|
||||
* @var bool
|
||||
*/
|
||||
private $canThrowExceptions = true;
|
||||
|
||||
/**
|
||||
* Echo something to the browser
|
||||
* @param string $output
|
||||
* @return $this
|
||||
*/
|
||||
private function writeToOutputNow($output)
|
||||
{
|
||||
if ($this->sendHttpCode() && \Whoops\Util\Misc::canSendHeaders()) {
|
||||
$this->system->setHttpResponseCode(
|
||||
$this->sendHttpCode()
|
||||
);
|
||||
}
|
||||
|
||||
echo $output;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
131
developer/vendor/filp/whoops/src/Whoops/RunInterface.php
vendored
Normal file
131
developer/vendor/filp/whoops/src/Whoops/RunInterface.php
vendored
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Whoops\Exception\ErrorException;
|
||||
use Whoops\Handler\HandlerInterface;
|
||||
|
||||
interface RunInterface
|
||||
{
|
||||
const EXCEPTION_HANDLER = "handleException";
|
||||
const ERROR_HANDLER = "handleError";
|
||||
const SHUTDOWN_HANDLER = "handleShutdown";
|
||||
|
||||
/**
|
||||
* Pushes a handler to the end of the stack
|
||||
*
|
||||
* @throws InvalidArgumentException If argument is not callable or instance of HandlerInterface
|
||||
* @param Callable|HandlerInterface $handler
|
||||
* @return Run
|
||||
*/
|
||||
public function pushHandler($handler);
|
||||
|
||||
/**
|
||||
* Removes the last handler in the stack and returns it.
|
||||
* Returns null if there"s nothing else to pop.
|
||||
*
|
||||
* @return null|HandlerInterface
|
||||
*/
|
||||
public function popHandler();
|
||||
|
||||
/**
|
||||
* Returns an array with all handlers, in the
|
||||
* order they were added to the stack.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getHandlers();
|
||||
|
||||
/**
|
||||
* Clears all handlers in the handlerStack, including
|
||||
* the default PrettyPage handler.
|
||||
*
|
||||
* @return Run
|
||||
*/
|
||||
public function clearHandlers();
|
||||
|
||||
/**
|
||||
* Registers this instance as an error handler.
|
||||
*
|
||||
* @return Run
|
||||
*/
|
||||
public function register();
|
||||
|
||||
/**
|
||||
* Unregisters all handlers registered by this Whoops\Run instance
|
||||
*
|
||||
* @return Run
|
||||
*/
|
||||
public function unregister();
|
||||
|
||||
/**
|
||||
* Should Whoops allow Handlers to force the script to quit?
|
||||
*
|
||||
* @param bool|int $exit
|
||||
* @return bool
|
||||
*/
|
||||
public function allowQuit($exit = null);
|
||||
|
||||
/**
|
||||
* Silence particular errors in particular files
|
||||
*
|
||||
* @param array|string $patterns List or a single regex pattern to match
|
||||
* @param int $levels Defaults to E_STRICT | E_DEPRECATED
|
||||
* @return \Whoops\Run
|
||||
*/
|
||||
public function silenceErrorsInPaths($patterns, $levels = 10240);
|
||||
|
||||
/**
|
||||
* Should Whoops send HTTP error code to the browser if possible?
|
||||
* Whoops will by default send HTTP code 500, but you may wish to
|
||||
* use 502, 503, or another 5xx family code.
|
||||
*
|
||||
* @param bool|int $code
|
||||
* @return int|false
|
||||
*/
|
||||
public function sendHttpCode($code = null);
|
||||
|
||||
/**
|
||||
* Should Whoops push output directly to the client?
|
||||
* If this is false, output will be returned by handleException
|
||||
*
|
||||
* @param bool|int $send
|
||||
* @return bool
|
||||
*/
|
||||
public function writeToOutput($send = null);
|
||||
|
||||
/**
|
||||
* Handles an exception, ultimately generating a Whoops error
|
||||
* page.
|
||||
*
|
||||
* @param \Throwable $exception
|
||||
* @return string Output generated by handlers
|
||||
*/
|
||||
public function handleException($exception);
|
||||
|
||||
/**
|
||||
* Converts generic PHP errors to \ErrorException
|
||||
* instances, before passing them off to be handled.
|
||||
*
|
||||
* This method MUST be compatible with set_error_handler.
|
||||
*
|
||||
* @param int $level
|
||||
* @param string $message
|
||||
* @param string $file
|
||||
* @param int $line
|
||||
*
|
||||
* @return bool
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function handleError($level, $message, $file = null, $line = null);
|
||||
|
||||
/**
|
||||
* Special case to deal with Fatal errors and the like.
|
||||
*/
|
||||
public function handleShutdown();
|
||||
}
|
37
developer/vendor/filp/whoops/src/Whoops/Util/HtmlDumperOutput.php
vendored
Normal file
37
developer/vendor/filp/whoops/src/Whoops/Util/HtmlDumperOutput.php
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Util;
|
||||
|
||||
/**
|
||||
* Used as output callable for Symfony\Component\VarDumper\Dumper\HtmlDumper::dump()
|
||||
*
|
||||
* @see TemplateHelper::dump()
|
||||
*/
|
||||
class HtmlDumperOutput
|
||||
{
|
||||
private $output;
|
||||
|
||||
public function __invoke($line, $depth)
|
||||
{
|
||||
// A negative depth means "end of dump"
|
||||
if ($depth >= 0) {
|
||||
// Adds a two spaces indentation to the line
|
||||
$this->output .= str_repeat(' ', $depth) . $line . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
public function getOutput()
|
||||
{
|
||||
return $this->output;
|
||||
}
|
||||
|
||||
public function clear()
|
||||
{
|
||||
$this->output = null;
|
||||
}
|
||||
|
||||
}
|
77
developer/vendor/filp/whoops/src/Whoops/Util/Misc.php
vendored
Normal file
77
developer/vendor/filp/whoops/src/Whoops/Util/Misc.php
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Util;
|
||||
|
||||
class Misc
|
||||
{
|
||||
/**
|
||||
* Can we at this point in time send HTTP headers?
|
||||
*
|
||||
* Currently this checks if we are even serving an HTTP request,
|
||||
* as opposed to running from a command line.
|
||||
*
|
||||
* If we are serving an HTTP request, we check if it's not too late.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function canSendHeaders()
|
||||
{
|
||||
return isset($_SERVER["REQUEST_URI"]) && !headers_sent();
|
||||
}
|
||||
|
||||
public static function isAjaxRequest()
|
||||
{
|
||||
return (
|
||||
!empty($_SERVER['HTTP_X_REQUESTED_WITH'])
|
||||
&& strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check, if possible, that this execution was triggered by a command line.
|
||||
* @return bool
|
||||
*/
|
||||
public static function isCommandLine()
|
||||
{
|
||||
return PHP_SAPI == 'cli';
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate ErrorException code into the represented constant.
|
||||
*
|
||||
* @param int $error_code
|
||||
* @return string
|
||||
*/
|
||||
public static function translateErrorCode($error_code)
|
||||
{
|
||||
$constants = get_defined_constants(true);
|
||||
if (array_key_exists('Core' , $constants)) {
|
||||
foreach ($constants['Core'] as $constant => $value) {
|
||||
if (substr($constant, 0, 2) == 'E_' && $value == $error_code) {
|
||||
return $constant;
|
||||
}
|
||||
}
|
||||
}
|
||||
return "E_UNKNOWN";
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if an error level is fatal (halts execution)
|
||||
*
|
||||
* @param int $level
|
||||
* @return bool
|
||||
*/
|
||||
public static function isLevelFatal($level)
|
||||
{
|
||||
$errors = E_ERROR;
|
||||
$errors |= E_PARSE;
|
||||
$errors |= E_CORE_ERROR;
|
||||
$errors |= E_CORE_WARNING;
|
||||
$errors |= E_COMPILE_ERROR;
|
||||
$errors |= E_COMPILE_WARNING;
|
||||
return ($level & $errors) > 0;
|
||||
}
|
||||
}
|
137
developer/vendor/filp/whoops/src/Whoops/Util/SystemFacade.php
vendored
Normal file
137
developer/vendor/filp/whoops/src/Whoops/Util/SystemFacade.php
vendored
Normal file
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Util;
|
||||
|
||||
class SystemFacade
|
||||
{
|
||||
/**
|
||||
* Turns on output buffering.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function startOutputBuffering()
|
||||
{
|
||||
return ob_start();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable $handler
|
||||
* @param int $types
|
||||
*
|
||||
* @return callable|null
|
||||
*/
|
||||
public function setErrorHandler(callable $handler, $types = 'use-php-defaults')
|
||||
{
|
||||
// Workaround for PHP 5.5
|
||||
if ($types === 'use-php-defaults') {
|
||||
$types = E_ALL | E_STRICT;
|
||||
}
|
||||
return set_error_handler($handler, $types);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable $handler
|
||||
*
|
||||
* @return callable|null
|
||||
*/
|
||||
public function setExceptionHandler(callable $handler)
|
||||
{
|
||||
return set_exception_handler($handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function restoreExceptionHandler()
|
||||
{
|
||||
restore_exception_handler();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function restoreErrorHandler()
|
||||
{
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable $function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerShutdownFunction(callable $function)
|
||||
{
|
||||
register_shutdown_function($function);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|false
|
||||
*/
|
||||
public function cleanOutputBuffer()
|
||||
{
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getOutputBufferLevel()
|
||||
{
|
||||
return ob_get_level();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function endOutputBuffering()
|
||||
{
|
||||
return ob_end_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function flushOutputBuffer()
|
||||
{
|
||||
flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getErrorReportingLevel()
|
||||
{
|
||||
return error_reporting();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
public function getLastError()
|
||||
{
|
||||
return error_get_last();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $httpCode
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function setHttpResponseCode($httpCode)
|
||||
{
|
||||
return http_response_code($httpCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $exitStatus
|
||||
*/
|
||||
public function stopExecution($exitStatus)
|
||||
{
|
||||
exit($exitStatus);
|
||||
}
|
||||
}
|
279
developer/vendor/filp/whoops/src/Whoops/Util/TemplateHelper.php
vendored
Normal file
279
developer/vendor/filp/whoops/src/Whoops/Util/TemplateHelper.php
vendored
Normal file
@ -0,0 +1,279 @@
|
||||
<?php
|
||||
/**
|
||||
* Whoops - php errors for cool kids
|
||||
* @author Filipe Dobreira <http://github.com/filp>
|
||||
*/
|
||||
|
||||
namespace Whoops\Util;
|
||||
|
||||
use Symfony\Component\VarDumper\Caster\Caster;
|
||||
use Symfony\Component\VarDumper\Cloner\AbstractCloner;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
|
||||
use Whoops\Exception\Frame;
|
||||
|
||||
/**
|
||||
* Exposes useful tools for working with/in templates
|
||||
*/
|
||||
class TemplateHelper
|
||||
{
|
||||
/**
|
||||
* An array of variables to be passed to all templates
|
||||
* @var array
|
||||
*/
|
||||
private $variables = array();
|
||||
|
||||
/**
|
||||
* @var HtmlDumper
|
||||
*/
|
||||
private $htmlDumper;
|
||||
|
||||
/**
|
||||
* @var HtmlDumperOutput
|
||||
*/
|
||||
private $htmlDumperOutput;
|
||||
|
||||
/**
|
||||
* @var AbstractCloner
|
||||
*/
|
||||
private $cloner;
|
||||
|
||||
/**
|
||||
* Escapes a string for output in an HTML document
|
||||
*
|
||||
* @param string $raw
|
||||
* @return string
|
||||
*/
|
||||
public function escape($raw)
|
||||
{
|
||||
$flags = ENT_QUOTES;
|
||||
|
||||
// HHVM has all constants defined, but only ENT_IGNORE
|
||||
// works at the moment
|
||||
if (defined("ENT_SUBSTITUTE") && !defined("HHVM_VERSION")) {
|
||||
$flags |= ENT_SUBSTITUTE;
|
||||
} else {
|
||||
// This is for 5.3.
|
||||
// The documentation warns of a potential security issue,
|
||||
// but it seems it does not apply in our case, because
|
||||
// we do not blacklist anything anywhere.
|
||||
$flags |= ENT_IGNORE;
|
||||
}
|
||||
|
||||
return htmlspecialchars($raw, $flags, "UTF-8");
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a string for output in an HTML document, but preserves
|
||||
* URIs within it, and converts them to clickable anchor elements.
|
||||
*
|
||||
* @param string $raw
|
||||
* @return string
|
||||
*/
|
||||
public function escapeButPreserveUris($raw)
|
||||
{
|
||||
$escaped = $this->escape($raw);
|
||||
return preg_replace(
|
||||
"@([A-z]+?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@",
|
||||
"<a href=\"$1\" target=\"_blank\">$1</a>", $escaped
|
||||
);
|
||||
}
|
||||
|
||||
private function getDumper()
|
||||
{
|
||||
if (!$this->htmlDumper && class_exists('Symfony\Component\VarDumper\Cloner\VarCloner')) {
|
||||
$this->htmlDumperOutput = new HtmlDumperOutput();
|
||||
// re-use the same var-dumper instance, so it won't re-render the global styles/scripts on each dump.
|
||||
$this->htmlDumper = new HtmlDumper($this->htmlDumperOutput);
|
||||
|
||||
$styles = array(
|
||||
'default' => 'color:#FFFFFF; line-height:normal; font:12px "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace !important; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: normal',
|
||||
'num' => 'color:#BCD42A',
|
||||
'const' => 'color: #4bb1b1;',
|
||||
'str' => 'color:#BCD42A',
|
||||
'note' => 'color:#ef7c61',
|
||||
'ref' => 'color:#A0A0A0',
|
||||
'public' => 'color:#FFFFFF',
|
||||
'protected' => 'color:#FFFFFF',
|
||||
'private' => 'color:#FFFFFF',
|
||||
'meta' => 'color:#FFFFFF',
|
||||
'key' => 'color:#BCD42A',
|
||||
'index' => 'color:#ef7c61',
|
||||
);
|
||||
$this->htmlDumper->setStyles($styles);
|
||||
}
|
||||
|
||||
return $this->htmlDumper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the given value into a human readable string.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
public function dump($value)
|
||||
{
|
||||
$dumper = $this->getDumper();
|
||||
|
||||
if ($dumper) {
|
||||
// re-use the same DumpOutput instance, so it won't re-render the global styles/scripts on each dump.
|
||||
// exclude verbose information (e.g. exception stack traces)
|
||||
$dumper->dump(
|
||||
$this->getCloner()->cloneVar($value, Caster::EXCLUDE_VERBOSE),
|
||||
$this->htmlDumperOutput
|
||||
);
|
||||
|
||||
$output = $this->htmlDumperOutput->getOutput();
|
||||
$this->htmlDumperOutput->clear();
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
return print_r($value, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the args of the given Frame as a human readable html string
|
||||
*
|
||||
* @param Frame $frame
|
||||
* @return string the rendered html
|
||||
*/
|
||||
public function dumpArgs(Frame $frame)
|
||||
{
|
||||
// we support frame args only when the optional dumper is available
|
||||
if (!$this->getDumper()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$html = '';
|
||||
$numFrames = count($frame->getArgs());
|
||||
|
||||
if ($numFrames > 0) {
|
||||
$html = '<ol class="linenums">';
|
||||
foreach($frame->getArgs() as $j => $frameArg) {
|
||||
$html .= '<li>'. $this->dump($frameArg) .'</li>';
|
||||
}
|
||||
$html .= '</ol>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a string to a slug version of itself
|
||||
*
|
||||
* @param string $original
|
||||
* @return string
|
||||
*/
|
||||
public function slug($original)
|
||||
{
|
||||
$slug = str_replace(" ", "-", $original);
|
||||
$slug = preg_replace('/[^\w\d\-\_]/i', '', $slug);
|
||||
return strtolower($slug);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a template path, render it within its own scope. This
|
||||
* method also accepts an array of additional variables to be
|
||||
* passed to the template.
|
||||
*
|
||||
* @param string $template
|
||||
* @param array $additionalVariables
|
||||
*/
|
||||
public function render($template, array $additionalVariables = null)
|
||||
{
|
||||
$variables = $this->getVariables();
|
||||
|
||||
// Pass the helper to the template:
|
||||
$variables["tpl"] = $this;
|
||||
|
||||
if ($additionalVariables !== null) {
|
||||
$variables = array_replace($variables, $additionalVariables);
|
||||
}
|
||||
|
||||
call_user_func(function () {
|
||||
extract(func_get_arg(1));
|
||||
require func_get_arg(0);
|
||||
}, $template, $variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the variables to be passed to all templates rendered
|
||||
* by this template helper.
|
||||
*
|
||||
* @param array $variables
|
||||
*/
|
||||
public function setVariables(array $variables)
|
||||
{
|
||||
$this->variables = $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single template variable, by its name:
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param mixd $variableValue
|
||||
*/
|
||||
public function setVariable($variableName, $variableValue)
|
||||
{
|
||||
$this->variables[$variableName] = $variableValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single template variable, by its name, or
|
||||
* $defaultValue if the variable does not exist
|
||||
*
|
||||
* @param string $variableName
|
||||
* @param mixed $defaultValue
|
||||
* @return mixed
|
||||
*/
|
||||
public function getVariable($variableName, $defaultValue = null)
|
||||
{
|
||||
return isset($this->variables[$variableName]) ?
|
||||
$this->variables[$variableName] : $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets a single template variable, by its name
|
||||
*
|
||||
* @param string $variableName
|
||||
*/
|
||||
public function delVariable($variableName)
|
||||
{
|
||||
unset($this->variables[$variableName]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all variables for this helper
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getVariables()
|
||||
{
|
||||
return $this->variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cloner used for dumping variables.
|
||||
*
|
||||
* @param AbstractCloner $cloner
|
||||
*/
|
||||
public function setCloner($cloner)
|
||||
{
|
||||
$this->cloner = $cloner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cloner used for dumping variables.
|
||||
*
|
||||
* @return AbstractCloner
|
||||
*/
|
||||
public function getCloner()
|
||||
{
|
||||
if (!$this->cloner) {
|
||||
$this->cloner = new VarCloner();
|
||||
}
|
||||
return $this->cloner;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user