Exemplo n.º 1
0
 /**
  * @return array
  */
 public function getPathAsArray()
 {
     if ($this->pathArray === null) {
         if ($this->parent === null) {
             $this->pathArray = [];
         } else {
             $this->pathArray = $this->parent->getPathAsArray();
         }
         $this->pathArray[] = $this;
     }
     return $this->pathArray;
 }
Exemplo n.º 2
0
 protected function getBreadcrumbs(AbstractNode $node)
 {
     $breadcrumbs = '';
     $path = $node->getPathAsArray();
     $pathToRoot = [];
     $max = count($path);
     if ($node instanceof FileNode) {
         $max--;
     }
     for ($i = 0; $i < $max; $i++) {
         $pathToRoot[] = str_repeat('../', $i);
     }
     foreach ($path as $step) {
         if ($step !== $node) {
             $breadcrumbs .= $this->getInactiveBreadcrumb($step, array_pop($pathToRoot));
         } else {
             $breadcrumbs .= $this->getActiveBreadcrumb($step);
         }
     }
     return $breadcrumbs;
 }