mirror of
https://github.com/retailcrm/NameCaseLib.git
synced 2024-12-05 03:16:06 +03:00
43 lines
879 B
PHP
43 lines
879 B
PHP
<?php
|
|
/**
|
|
* Description of EndingsCompiler
|
|
*
|
|
* @author seagull
|
|
*/
|
|
class EndingsCompiler
|
|
{
|
|
private $template;
|
|
private $destination = 'compiled/NCL.NameCase.ua.php';
|
|
private $sourceFile = '../../../Library/NCL.NameCase.ua.php';
|
|
|
|
private $compiled = '';
|
|
|
|
private $mode = 'endings3';
|
|
|
|
public function __construct($mode)
|
|
{
|
|
$this->template = file_get_contents($this->sourceFile);
|
|
$this->mode = $mode;
|
|
}
|
|
|
|
private function save()
|
|
{
|
|
file_put_contents($this->destination, $this->compiled);
|
|
}
|
|
|
|
public function compile($text = '')
|
|
{
|
|
if($text)
|
|
{
|
|
$text = ", '".$text."'";
|
|
}
|
|
|
|
$this->compiled = str_replace('/*{'.$this->mode.'}*/', $text , $this->template);
|
|
//$this->compiled = $this->template;
|
|
$this->save();
|
|
|
|
}
|
|
}
|
|
|
|
?>
|