Gush\Helper\TemplateHelper::bindAndRender PHP Метод

bindAndRender() публичный Метод

Like askAndRender but directly binding parameters passed not as options but as direct input argument to method.
public bindAndRender ( array $parameters, string $templateDomain, string $templateName ) : string
$parameters array
$templateDomain string Domain for the template, e.g. pull-request
$templateName string Name of the template, e.g. symfony-doc
Результат string Rendered template string
    public function bindAndRender(array $parameters, $templateDomain, $templateName)
    {
        $template = $this->getTemplate($templateDomain, $templateName);
        $template->bind($parameters);
        return $template->render();
    }

Usage Example

Пример #1
0
 /**
  * @test
  */
 public function binds_and_renders()
 {
     $this->input->setOption('test-option', 'test-option');
     $this->template->getName()->willReturn('test/foobar')->shouldBeCalled();
     $this->template->bind(['author' => 'cslucano'])->shouldBeCalled();
     $this->template->render()->willReturn('foo')->shouldBeCalled();
     $this->helper->registerTemplate($this->template->reveal());
     $res = $this->helper->bindAndRender(['author' => 'cslucano'], 'test', 'foobar');
     $this->assertEquals('foo', $res);
 }