/**
  * @todo remove coupling, redo 404
  * @todo limit finder to extension set in config
  * @todo package should not rely on module
  * @return [type] [description]
  */
 public function populateRepository()
 {
     $location = $this->getBag()->get('config')->pages->location;
     if (!file_exists($location)) {
         throw new InvalidArgumentException('Page location does not exist');
     }
     $extension = $this->getBag()->get('config')->pages->extension;
     $finder = $this->getFinder()->in($location);
     $metaParser = $this->getBag()->get('metaParser');
     foreach ($finder as $f) {
         $content = $f->getContents();
         $path = str_replace($extension, '', $f->getRelativePathname());
         $p = new Page();
         $p->setLocation((string) $f);
         $p->setPath($path);
         $p->setMeta($metaParser->parse($content));
         $p->setContent($metaParser->removeMetaString());
         $p->setIsDir($f->isDir());
         $this->getPageRepository()->add($p);
     }
     // add 404
     $notFound = new Page();
     $notFound->setLocation($location . '404' . $extension);
     $notFound->setPath('404');
     $notFound->setMeta($metaParser->parse(file_get_contents($notFound->getLocation())));
     $notFound->setContent($metaParser->removeMetaString());
     $this->getPageRepository()->add($notFound);
     return $this;
 }