Fakerino\Core\Template\TemplateInterface::render PHP Méthode

render() public méthode

public render ( array $data ) : string
$data array
Résultat string
    public function render($data);

Usage Example

 /**
  * Fakes a template file.
  *
  * @param string $file
  *
  * @return string
  */
 public function fakeTemplate($file)
 {
     $this->template->loadTemplate($file);
     $varsName = $this->template->getVariables();
     $out = '';
     $num = $this->num;
     for ($i = 0; $i < $num; $i++) {
         $fakeData = $this->num(1)->fake($varsName)->toArray();
         $data = array_combine(array_values($varsName), $fakeData);
         $out .= $this->template->render($data);
     }
     return $out;
 }