/** * @param Author $author * @return Document[] */ public function generateAuthorIndices(Author $author) { $indexes = array(); foreach ($this->getLayouts() as $layout) { $file = $layout->getBasename(); preg_match('#authors\\.(.+?)\\.twig$#', $file, $match); $format = $match[1]; $document = new Document(); $document->setLayout((string) $file); $document->setPath(sprintf('authors/%s.%s', $author->getHandle(), $format)); $document->setTitle(sprintf('Author: %s (%s)', $author->get('name'), $author->getHandle())); $document->setVars(array('author' => $author)); $indexes[] = $document; } return $indexes; }
public function testInstantiation() { $handle = 'test'; $author = new Author($handle); $this->assertSame($handle, $author->getHandle()); }
/** * @param Author $author */ public function addAuthor(Author $author) { $this->authors[$author->getHandle()] = $author; }