| 1 | <?php |
||
| 28 | class Macros |
||
| 29 | { |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Replacement data list. |
||
| 33 | * |
||
| 34 | * @var array|Entity |
||
| 35 | */ |
||
| 36 | protected $_data = []; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Macros constructor. |
||
| 40 | * |
||
| 41 | * @param mixed $data |
||
| 42 | */ |
||
| 43 | public function __construct($data = []) |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Get replacement val or all list. |
||
| 56 | * |
||
| 57 | * @param null|string|int $key |
||
| 58 | * @return array |
||
| 59 | */ |
||
| 60 | public function get($key = null) |
||
| 68 | |||
| 69 | /** |
||
| 70 | * Add new value in list. |
||
| 71 | * |
||
| 72 | * @param string|int $key |
||
| 73 | * @param string|int $val |
||
| 74 | * @return $this |
||
| 75 | */ |
||
| 76 | public function set($key, $val) |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Get replacement text. |
||
| 84 | * |
||
| 85 | * @param string $text |
||
| 86 | * @return string mixed |
||
| 87 | */ |
||
| 88 | public function text($text) |
||
| 97 | } |
||
| 98 |