/** * @return \nochso\WriteMe\Interfaces\Placeholder[] */ public function getRelevantPlaceholders() { $placeholders = []; foreach ($this->placeholders->toArray() as $placeholder) { if (!$placeholder instanceof PlaceholderDocs) { $placeholders[] = $placeholder; } } return $placeholders; }
public function writemePlaceholderDocs(Call $call) { $classes = []; foreach ($this->placeholders->toArray() as $placeholder) { $classes[get_class($placeholder)] = ReflectionClass::createFromInstance($placeholder); } $template = new TemplateData(); $template->setHeaderStartLevel($this->options->getValue('placeholder-docs.header-depth')); $template->prepare($classes, $this->placeholders); $docs = $template->render('full.php'); $docs = (new Converter())->escape($docs); $call->replace($docs); }
public function testAddMany() { $list = [TOC::class => new TOC(), Frontmatter::class => new Frontmatter()]; $collection = new PlaceholderCollection(); $collection->addMany($list); $this->assertSame($list, $collection->toArray()); }