ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Whoops\Exception\FrameCollection Class Reference

Exposes a fluent interface for dealing with an ordered list of stack-trace frames. More...

+ Inheritance diagram for Whoops\Exception\FrameCollection:
+ Collaboration diagram for Whoops\Exception\FrameCollection:

Public Member Functions

 __construct (array $frames)
 
 filter ($callable)
 Filters frames using a callable, returns the same FrameCollection. More...
 
 map ($callable)
 Map the collection of frames. More...
 
 getArray ()
 Returns an array with all frames, does not affect the internal array. More...
 
 getIterator ()
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 count ()
 
 serialize ()
 
 unserialize ($serializedFrames)
 
 prependFrames (array $frames)
 

Private Attributes

 $frames
 

Detailed Description

Exposes a fluent interface for dealing with an ordered list of stack-trace frames.

Definition at line 20 of file FrameCollection.php.

Constructor & Destructor Documentation

◆ __construct()

Whoops\Exception\FrameCollection::__construct ( array  $frames)
Parameters
array$frames

Definition at line 30 of file FrameCollection.php.

31 {
32 $this->frames = array_map(function ($frame) {
33 return new Frame($frame);
34 }, $frames);
35 }

References Whoops\Exception\FrameCollection\$frames.

Member Function Documentation

◆ count()

Whoops\Exception\FrameCollection::count ( )
See also
Countable::count
Returns
int

Definition at line 137 of file FrameCollection.php.

138 {
139 return count($this->frames);
140 }

References Whoops\Exception\FrameCollection\count().

Referenced by Whoops\Exception\FrameCollection\count().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ filter()

Whoops\Exception\FrameCollection::filter (   $callable)

Filters frames using a callable, returns the same FrameCollection.

Parameters
callable$callable
Returns
FrameCollection

Definition at line 43 of file FrameCollection.php.

44 {
45 $this->frames = array_filter($this->frames, $callable);
46 return $this;
47 }

◆ getArray()

Whoops\Exception\FrameCollection::getArray ( )

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 also
FrameCollection::getIterator
Returns
array

Definition at line 83 of file FrameCollection.php.

84 {
85 return $this->frames;
86 }

References Whoops\Exception\FrameCollection\$frames.

◆ getIterator()

Whoops\Exception\FrameCollection::getIterator ( )
See also
IteratorAggregate::getIterator
Returns
ArrayIterator

Definition at line 92 of file FrameCollection.php.

93 {
94 return new ArrayIterator($this->frames);
95 }

◆ map()

Whoops\Exception\FrameCollection::map (   $callable)

Map the collection of frames.

Parameters
callable$callable
Returns
FrameCollection

Definition at line 55 of file FrameCollection.php.

56 {
57 // Contain the map within a higher-order callable
58 // that enforces type-correctness for the $callable
59 $this->frames = array_map(function ($frame) use ($callable) {
60 $frame = call_user_func($callable, $frame);
61
62 if (!$frame instanceof Frame) {
63 throw new UnexpectedValueException(
64 "Callable to " . __METHOD__ . " must return a Frame object"
65 );
66 }
67
68 return $frame;
69 }, $this->frames);
70
71 return $this;
72 }

References Whoops\Exception\FrameCollection\$frames.

◆ offsetExists()

Whoops\Exception\FrameCollection::offsetExists (   $offset)
See also
ArrayAccess::offsetExists
Parameters
int$offset

Definition at line 101 of file FrameCollection.php.

102 {
103 return isset($this->frames[$offset]);
104 }

◆ offsetGet()

Whoops\Exception\FrameCollection::offsetGet (   $offset)
See also
ArrayAccess::offsetGet
Parameters
int$offset

Definition at line 110 of file FrameCollection.php.

111 {
112 return $this->frames[$offset];
113 }

◆ offsetSet()

Whoops\Exception\FrameCollection::offsetSet (   $offset,
  $value 
)
See also
ArrayAccess::offsetSet
Parameters
int$offset

Definition at line 119 of file FrameCollection.php.

120 {
121 throw new \Exception(__CLASS__ . ' is read only');
122 }

◆ offsetUnset()

Whoops\Exception\FrameCollection::offsetUnset (   $offset)
See also
ArrayAccess::offsetUnset
Parameters
int$offset

Definition at line 128 of file FrameCollection.php.

129 {
130 throw new \Exception(__CLASS__ . ' is read only');
131 }

◆ prependFrames()

Whoops\Exception\FrameCollection::prependFrames ( array  $frames)
Parameters
Frame[]$framesArray of Frame instances, usually from $e->getPrevious()

Definition at line 163 of file FrameCollection.php.

164 {
165 $this->frames = array_merge($frames, $this->frames);
166 }

References Whoops\Exception\FrameCollection\$frames.

◆ serialize()

Whoops\Exception\FrameCollection::serialize ( )
See also
Serializable::serialize
Returns
string

Definition at line 146 of file FrameCollection.php.

147 {
148 return serialize($this->frames);
149 }

References Whoops\Exception\FrameCollection\serialize().

Referenced by Whoops\Exception\FrameCollection\serialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unserialize()

Whoops\Exception\FrameCollection::unserialize (   $serializedFrames)
See also
Serializable::unserialize
Parameters
string$serializedFrames

Definition at line 155 of file FrameCollection.php.

156 {
157 $this->frames = unserialize($serializedFrames);
158 }

References Whoops\Exception\FrameCollection\unserialize().

Referenced by Whoops\Exception\FrameCollection\unserialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $frames


The documentation for this class was generated from the following file: