src/Managers/TemplateManager.php
public function render(DataBuilder $data_builder, string $filetype, $parameters, array $data = [])
    {
        $result = new Result();

        try {
            $bag = new Bag($parameters);

            $bag->set('content', $this->renderRaw($filetype, strval($bag->get('content')), $data));

            $result->setResources(new Collection([$bag->toArray()]));
        } catch (\Twig_Error $e) {
            $e = new Exceptions\TemplateRenderException($e->getRawMessage().' on line '.$e->getTemplateLine());

            $result->addErrors(new Collection([$e]));
        }

        return $result;
    }
public function render(DataBuilder $data_builder, string $filetype, $parameters, array $data = [])
    {
        $result = new Result();

        try {
            $bag = new Bag($parameters);

            $bag->set('content', $this->renderRaw($filetype, strval($bag->get('content')), $data));

            $result->setResources(new Collection([$bag->toArray()]));
        } catch (\Twig_Error $e) {
            $e = new Exceptions\TemplateRenderException($e->getRawMessage().' on line '.$e->getTemplateLine());

            $result->addErrors(new Collection([$e]));
        }

        return $result;
    }
public function render ( DataBuilder $ data_builder , string $ filetype , $ parameters , array $ data = [ ] ) { $ result = new Result ( ) ; try { $ bag = new Bag ( $ parameters ) ; $ bag -> set ( 'content' , $ this -> renderRaw ( $ filetype , strval ( $ bag -> get ( 'content' ) ) , $ data ) ) ; $ result -> setResources ( new Collection ( [ $ bag -> toArray ( ) ] ) ) ; } catch ( \ Twig_Error $ e ) { $ e = new Exceptions \ TemplateRenderException ( $ e -> getRawMessage ( ) . ' on line ' . $ e -> getTemplateLine ( ) ) ; $ result -> addErrors ( new Collection ( [ $ e ] ) ) ; } return $ result ; }
Render an email.

@param DataBuilder $data_builder
@param string      $filetype
@param array       $parameters
@param array       $data

@return \Railken\Lem\Contracts\ResultContract
Render an email .