/** * @return array */ public function testCaseProvider() { $defaultContent = ' <html> <head><?php echo $this->title(); ?></head> <body> <?php echo $this->headliner($headline); ?> <?php echo $this->paragraph(array(\'content\' => $this->content)); ?> </body> </html> '; //a anonymous function $headliner = function ($headline) { return '<h1>' . $headline . '</h1>' . PHP_EOL; }; //a template $paragraph = new RuntimeContentBasedTemplate(); $paragraph->setContent('<p>{content}</p>' . PHP_EOL); //an other template $title = new RuntimeContentBasedTemplate(array('title' => 'there is no foo without a bar'), '<title>{title}</title>'); return array('content with a callable collection' => array($defaultContent, array('headline' => 'foo', 'content' => 'bar'), array('headliner' => $headliner, 'paragraph' => $paragraph, 'title' => $title), str_replace(array('<?php echo $this->title(); ?>', '<?php echo $this->headliner($headline); ?>', '<?php echo $this->paragraph(array(\'content\' => $this->content)); ?>'), array('<title>there is no foo without a bar</title>', '<h1>foo</h1>', '<p>bar</p>'), $defaultContent))); }
/** * @param null|string $content * @return RuntimeContentBasedTemplate */ private function getNewTemplate($content = null) { $template = new RuntimeContentBasedTemplate(); if (!is_null($content)) { $template->setContent($content); } return $template; }