예제 #1
0
 function it_parses_file(FileInterface $file)
 {
     $file->getPath()->shouldBeCalled();
     $file->getContent()->shouldBeCalled();
     $file->getName()->shouldBeCalled();
     $this->parseFile($file);
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function parseFile(FileInterface $file)
 {
     $path = explode('/', $file->getPath());
     $path[0] = 'root';
     $tree = $this->addChildren($path, ['label' => str_replace(['# ', '#'], '', substr($file->getContent(), 0, strpos($file->getContent(), PHP_EOL))), 'uri' => $file->getPath() . ($file->getPath() != '/' ? '/' : '') . $file->getName()]);
     $this->menu = array_merge_recursive($tree, $this->menu);
 }