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