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