9use InvalidArgumentException;
12class Frame implements Serializable
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);
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[] = [
148 'context' => $context,
164 if ($filter !==
null) {
166 return $c[
'context'] == $filter;
208 if ($length !==
null) {
209 $start = (int) $start;
210 $length = (int) $length;
216 throw new InvalidArgumentException(
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']);
An exception for terminatinating execution or to throw for unit testing.
setApplication($application)
Mark as an frame belonging to the application.
getFileLines($start=0, $length=null)
addComment($comment, $context='global')
Adds a comment to this frame, that can be received and used by other handlers.
serialize()
Implements the Serializable interface, with special steps to also save the existing comments.
isApplication()
Returns whether this frame belongs to the application or not.
getFileContents()
Returns the full contents of the file for this frame, if it's known.
equals(Frame $frame)
Compares Frame against one another.
getComments($filter=null)
Returns all comments for this frame.
__construct(array $frame)
getFile($shortened=false)
unserialize($serializedFrame)
Unserializes the frame data, while also preserving any existing comment data.
getRawFrame()
Returns the array containing the raw frame data from which this Frame object was built.
Whoops - php errors for cool kids.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file