| Conditions | 7 |
| Paths | 12 |
| Total Lines | 26 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | public function getBreadcrumbs(AbstractNavigationNode $node = null) { |
||
| 38 | |||
| 39 | // Create the breadcrumbs. |
||
| 40 | $breadcrumbs = []; |
||
| 41 | |||
| 42 | // Correct the parameter if necessary. |
||
| 43 | if (null === $node) { |
||
| 44 | $node = $this; |
||
| 45 | } |
||
| 46 | |||
| 47 | // Check the instance. |
||
| 48 | if (true === ($node instanceof NavigationNode || $node instanceof BreadcrumbNode) && true === $node->getActive()) { |
||
| 49 | $breadcrumbs[] = $node; |
||
| 50 | } |
||
| 51 | |||
| 52 | // Handle each node. |
||
| 53 | foreach ($node->getNodes() as $current) { |
||
| 54 | if (false === ($current instanceof AbstractNavigationNode)) { |
||
| 55 | continue; |
||
| 56 | } |
||
| 57 | $breadcrumbs = array_merge($breadcrumbs, $this->getBreadcrumbs($current)); |
||
| 58 | } |
||
| 59 | |||
| 60 | // Return the breadcrumbs. |
||
| 61 | return $breadcrumbs; |
||
| 62 | } |
||
| 63 | |||
| 65 |