function it_parses_file(FileInterface $file) { $file->getPath()->shouldBeCalled(); $file->getContent()->shouldBeCalled(); $file->getName()->shouldBeCalled(); $this->parseFile($file); }
/** * {@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); }