1 | <?php |
||
5 | class Breadcrumbs implements BreadcrumbsInterface |
||
6 | { |
||
7 | private $position = 0; |
||
8 | private $crumbs = []; |
||
9 | |||
10 | 6 | public function add(Crumb $crumb): BreadcrumbsInterface |
|
16 | |||
17 | 5 | public function isEmptyForListPage(): bool |
|
28 | |||
29 | 5 | public function isEmptyForCreatePage(): bool |
|
40 | |||
41 | 5 | public function isEmptyForEditPage(): bool |
|
52 | |||
53 | public function isEmptyForHistoryPage(): bool |
||
54 | { |
||
55 | /** @var Crumb $crumb */ |
||
56 | foreach ($this->crumbs as $crumb) { |
||
57 | if ($crumb->shouldBeShownOnHistoryPage()) { |
||
58 | return false; |
||
59 | } |
||
60 | } |
||
61 | |||
62 | return true; |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * Return the current element |
||
67 | * @link https://php.net/manual/en/iterator.current.php |
||
68 | * @return mixed Can return any type. |
||
69 | * @since 5.0.0 |
||
70 | */ |
||
71 | 1 | public function current() |
|
75 | |||
76 | /** |
||
77 | * Move forward to next element |
||
78 | * @link https://php.net/manual/en/iterator.next.php |
||
79 | * @return void Any returned value is ignored. |
||
80 | * @since 5.0.0 |
||
81 | */ |
||
82 | 1 | public function next() |
|
83 | { |
||
84 | 1 | $this->position++; |
|
85 | 1 | } |
|
86 | |||
87 | /** |
||
88 | * Return the key of the current element |
||
89 | * @link https://php.net/manual/en/iterator.key.php |
||
90 | * @return mixed scalar on success, or null on failure. |
||
|
|||
91 | * @since 5.0.0 |
||
92 | */ |
||
93 | 1 | public function key() |
|
97 | |||
98 | /** |
||
99 | * Checks if current position is valid |
||
100 | * @link https://php.net/manual/en/iterator.valid.php |
||
101 | * @return bool The return value will be casted to boolean and then evaluated. |
||
102 | * Returns true on success or false on failure. |
||
103 | * @since 5.0.0 |
||
104 | */ |
||
105 | 1 | public function valid() |
|
109 | |||
110 | /** |
||
111 | * Rewind the Iterator to the first element |
||
112 | * @link https://php.net/manual/en/iterator.rewind.php |
||
113 | * @return void Any returned value is ignored. |
||
114 | * @since 5.0.0 |
||
115 | */ |
||
116 | 1 | public function rewind() |
|
120 | } |
||
121 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.