PhpSpec\CodeGenerator\TemplateRenderer::renderString PHP Метод

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

public renderString ( string $template, array $values = [] ) : string
$template string
$values array
Результат string
    public function renderString($template, array $values = array())
    {
        return strtr($template, $values);
    }

Usage Example

 /**
  * @param ResourceInterface $resource
  * @param array $data
  */
 public function generate(ResourceInterface $resource, array $data)
 {
     $filepath = $resource->getSrcFilename();
     if (!($content = $this->templates->render('private-constructor', array()))) {
         $content = $this->templates->renderString($this->getTemplate(), array());
     }
     $code = $this->filesystem->getFileContents($filepath);
     $code = $this->codeWriter->insertMethodFirstInClass($code, $content);
     $this->filesystem->putFileContents($filepath, $code);
     $this->io->writeln("<info>Private constructor has been created.</info>\n", 2);
 }
All Usage Examples Of PhpSpec\CodeGenerator\TemplateRenderer::renderString