Файл: src/vendor/way/generators/src/Way/Generators/Syntax/Table.php
Строк: 22
<?php namespace WayGeneratorsSyntax;
use WayGeneratorsCompilersTemplateCompiler;
use WayGeneratorsFilesystemFilesystem;
abstract class Table {
/**
* @var WayGeneratorsFilesystemFilesystem
*/
protected $file;
/**
* @var WayGeneratorsCompilersTemplateCompiler
*/
protected $compiler;
/**
* @param Filesystem $file
* @param TemplateCompiler $compiler
*/
function __construct(Filesystem $file, TemplateCompiler $compiler)
{
$this->compiler = $compiler;
$this->file = $file;
}
/**
* Fetch the template of the schema
*
* @return string
*/
protected function getTemplate()
{
return $this->file->get(__DIR__.'/../templates/schema.txt');
}
/**
* Replace $FIELDS$ in the given template
* with the provided schema
*
* @param $schema
* @param $template
* @return mixed
*/
protected function replaceFieldsWith($schema, $template)
{
return str_replace('$FIELDS$', implode(PHP_EOL."ttt", $schema), $template);
}
}