46 public function getFile($shortened =
false)
48 if (empty($this->frame[
'file'])) {
52 $file = $this->frame[
'file'];
58 if (preg_match(
'/^(.*)\((\d+)\) : (?:eval\(\)\'d|assert) code$/', $file, $matches)) {
59 $file = $this->frame[
'file'] = $matches[1];
60 $this->frame[
'line'] = (int) $matches[2];
63 if ($shortened && is_string($file)) {
65 $dirname = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__))))));
66 if ($dirname !==
'/') {
67 $file = str_replace($dirname,
"…", $file);
69 $file = str_replace(
"/",
"/­", $file);
80 return isset($this->frame[
'line']) ? $this->frame[
'line'] : null;
88 return isset($this->frame[
'class']) ? $this->frame[
'class'] : null;
96 return isset($this->frame[
'function']) ? $this->frame[
'function'] : null;
104 return isset($this->frame[
'args']) ? (array) $this->frame[
'args'] : [];
114 if ($this->fileContentsCache === null && $filePath = $this->
getFile()) {
118 if ($filePath ===
"Unknown") {
123 if (!is_file($filePath)) {
127 $this->fileContentsCache = file_get_contents($filePath);
146 $this->comments[] = [
164 if ($filter !== null) {
166 return $c[
'context'] == $filter;
205 $lines = explode(
"\n", $contents);
208 if ($length !== null) {
210 $length = (int) $length;
217 "\$length($length) cannot be lower or equal to 0" 221 $lines = array_slice($lines,
$start, $length,
true);
238 if (!empty($this->comments)) {
256 if (!empty(
$frame[
'_comments'])) {
257 $this->comments =
$frame[
'_comments'];
258 unset(
$frame[
'_comments']);
serialize()
Implements the Serializable interface, with special steps to also save the existing comments...
getFile($shortened=false)
setApplication($application)
Mark as an frame belonging to the application.
getRawFrame()
Returns the array containing the raw frame data from which this Frame object was built.
equals(Frame $frame)
Compares Frame against one another.
addComment($comment, $context='global')
Adds a comment to this frame, that can be received and used by other handlers.
__construct(array $frame)
Whoops - php errors for cool kids.
isApplication()
Returns whether this frame belongs to the application or not.
getFileLines($start=0, $length=null)
getComments($filter=null)
Returns all comments for this frame.
unserialize($serializedFrame)
Unserializes the frame data, while also preserving any existing comment data.
getFileContents()
Returns the full contents of the file for this frame, if it's known.