| 1 | <?php |
||
| 14 | class Template |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * Template path. |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $template; |
||
| 22 | /** |
||
| 23 | * Variables. |
||
| 24 | * |
||
| 25 | * @var array |
||
| 26 | */ |
||
| 27 | private $variables = []; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Current locale i18n data. |
||
| 31 | * |
||
| 32 | * @var array |
||
| 33 | */ |
||
| 34 | private $locale = []; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Constructor. |
||
| 38 | */ |
||
| 39 | public function __construct(string $path, array $locale, array $variables) |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Get variable by key. |
||
| 53 | */ |
||
| 54 | public function __get(string $key) |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Render template. |
||
| 63 | */ |
||
| 64 | public function render(): string |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Trabslate locale string. |
||
| 74 | */ |
||
| 75 | public function translate(string $key): string |
||
| 83 | } |
||
| 84 |