Leaf PHP

Frame
in package

Table of Contents

Properties

$application  : bool
$comments  : array<string|int, array<string|int, mixed>>
$fileContentsCache  : string
$frame  : array<string|int, mixed>

Methods

__construct()  : mixed
addComment()  : mixed
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.
equals()  : bool
Compares Frame against one another
getArgs()  : array<string|int, mixed>
getClass()  : string|null
getComments()  : array<string|int, array<string|int, mixed>>
Returns all comments for this frame. Optionally allows a filter to only retrieve comments from a specific context.
getFile()  : string|null
getFileContents()  : string|null
Returns the full contents of the file for this frame, if it's known.
getFileLines()  : array<string|int, string>|null
Returns the contents of the file for this frame as an array of lines, and optionally as a clamped range of lines.
getFunction()  : string|null
getLine()  : int|null
getRawFrame()  : array<string|int, mixed>
Returns the array containing the raw frame data from which this Frame object was built
isApplication()  : bool
Returns whether this frame belongs to the application or not.
serialize()  : string
Implements the Serializable interface, with special steps to also save the existing comments.
setApplication()  : mixed
Mark as an frame belonging to the application.
unserialize()  : mixed
Unserializes the frame data, while also preserving any existing comment data.

Properties

$application

protected bool $application

$comments

protected array<string|int, array<string|int, mixed>> $comments = []

$fileContentsCache

protected string $fileContentsCache

$frame

protected array<string|int, mixed> $frame

Methods

__construct()

public __construct(array<string|int, mixed> $frame) : mixed
Parameters
$frame : array<string|int, mixed>

addComment()

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.

public addComment(string $comment[, string $context = 'global' ]) : mixed

An interesting use for this would be, for example, code analysis & annotations.

Parameters
$comment : string
$context : string = 'global'

Optional string identifying the origin of the comment

equals()

Compares Frame against one another

public equals(Frame $frame) : bool
Parameters
$frame : Frame
Return values
bool

getArgs()

public getArgs() : array<string|int, mixed>
Return values
array<string|int, mixed>

getClass()

public getClass() : string|null
Return values
string|null

getComments()

Returns all comments for this frame. Optionally allows a filter to only retrieve comments from a specific context.

public getComments([string $filter = null ]) : array<string|int, array<string|int, mixed>>
Parameters
$filter : string = null
Return values
array<string|int, array<string|int, mixed>>

getFile()

public getFile([bool $shortened = false ]) : string|null
Parameters
$shortened : bool = false
Return values
string|null

getFileContents()

Returns the full contents of the file for this frame, if it's known.

public getFileContents() : string|null
Return values
string|null

getFileLines()

Returns the contents of the file for this frame as an array of lines, and optionally as a clamped range of lines.

public getFileLines([int $start = 0 ][, int $length = null ]) : array<string|int, string>|null

NOTE: lines are 0-indexed

Parameters
$start : int = 0
$length : int = null
Tags
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( 9 => '...' )

throws
InvalidArgumentException

if $length is less than or equal to 0

Return values
array<string|int, string>|null

getFunction()

public getFunction() : string|null
Return values
string|null

getLine()

public getLine() : int|null
Return values
int|null

getRawFrame()

Returns the array containing the raw frame data from which this Frame object was built

public getRawFrame() : array<string|int, mixed>
Return values
array<string|int, mixed>

isApplication()

Returns whether this frame belongs to the application or not.

public isApplication() : bool
Return values
bool

serialize()

Implements the Serializable interface, with special steps to also save the existing comments.

public serialize() : string
Tags
see
Serializable::serialize
Return values
string

setApplication()

Mark as an frame belonging to the application.

public setApplication(bool $application) : mixed
Parameters
$application : bool

unserialize()

Unserializes the frame data, while also preserving any existing comment data.

public unserialize(string $serializedFrame) : mixed
Parameters
$serializedFrame : string
Tags
see
Serializable::unserialize

        
On this page

Search results