mirror of
https://github.com/retailcrm/NameCaseLib.git
synced 2025-02-06 09:09:23 +03:00
42 lines
850 B
PHP
42 lines
850 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);
|
|
}
|
|
|
|
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();
|
|
|
|
}
|
|
}
|
|
|
|
?>
|