ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ()
 
 countIsApplication ()
 Count the frames that belongs to the application. More...
 
 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.

References Whoops\Exception\FrameCollection\$frames.

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

Member Function Documentation

◆ count()

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

Definition at line 137 of file FrameCollection.php.

Referenced by Whoops\Exception\FrameCollection\countIsApplication(), and Whoops\Exception\FrameCollection\prependFrames().

138  {
139  return count($this->frames);
140  }
+ Here is the caller graph for this function:

◆ countIsApplication()

Whoops\Exception\FrameCollection::countIsApplication ( )

Count the frames that belongs to the application.

Returns
int

Definition at line 147 of file FrameCollection.php.

References Whoops\Exception\FrameCollection\count(), and Whoops\Exception\Frame\isApplication().

148  {
149  return count(array_filter($this->frames, function (Frame $f) {
150  return $f->isApplication();
151  }));
152  }
+ Here is the call 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_values(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.

References Whoops\Exception\FrameCollection\$frames.

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

+ Here is the caller graph for this function:

◆ 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.

References Whoops\Exception\FrameCollection\$frames.

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  }

◆ 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[]$frames Array of Frame instances, usually from $e->getPrevious()

Definition at line 175 of file FrameCollection.php.

References Whoops\Exception\FrameCollection\$frames, $i, Whoops\Exception\FrameCollection\count(), and Whoops\Exception\FrameCollection\getArray().

176  {
177  $this->frames = array_merge($frames, $this->frames);
178  }
+ Here is the call graph for this function:

◆ serialize()

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

Definition at line 158 of file FrameCollection.php.

159  {
160  return serialize($this->frames);
161  }

◆ unserialize()

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

Definition at line 167 of file FrameCollection.php.

168  {
169  $this->frames = unserialize($serializedFrames);
170  }

Field Documentation

◆ $frames


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