| Conditions | 4 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 94 | public function paging(): array |
||
| 95 | { |
||
| 96 | $nodes = []; |
||
| 97 | $count = 0; |
||
| 98 | |||
| 99 | foreach ($this->data as $node) { |
||
| 100 | ++$count; |
||
| 101 | $nodes[] = $this->decorator->decorate($node, $this->attributes); |
||
| 102 | } |
||
| 103 | |||
| 104 | if ($this->total === null && $this->data instanceof Generator) { |
||
| 105 | $this->total = $this->data->getReturn(); |
||
| 106 | } |
||
| 107 | |||
| 108 | $data = [ |
||
| 109 | '_links' => $this->getLinks($count), |
||
| 110 | 'count' => $count, |
||
| 111 | 'total' => $this->total, |
||
| 112 | 'data' => $nodes, |
||
| 113 | ]; |
||
| 114 | |||
| 115 | return $data; |
||
| 116 | } |
||
| 117 | |||
| 151 |