| 1 | <?php |
||
| 12 | abstract class AbstractRenderer implements \ArrayAccess |
||
| 13 | { |
||
| 14 | protected $offset = []; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * template function. |
||
| 18 | * |
||
| 19 | * @access protected |
||
| 20 | * @abstract |
||
| 21 | * @param mixed $template |
||
| 22 | */ |
||
| 23 | abstract protected function template($template); |
||
| 24 | |||
| 25 | /** |
||
| 26 | * render function. |
||
| 27 | * |
||
| 28 | * @access public |
||
| 29 | * @abstract |
||
| 30 | * @param ResponseInterface $response |
||
| 31 | * @param mixed $template |
||
| 32 | * @param mixed $data (default: []) |
||
| 33 | * @return ResponseInterface |
||
| 34 | */ |
||
| 35 | abstract public function render(ResponseInterface $response, $template, $data = []); |
||
| 36 | |||
| 37 | /** |
||
| 38 | * mergeData function. |
||
| 39 | * |
||
| 40 | * @access protected |
||
| 41 | * @param mixed $data |
||
| 42 | * @return array |
||
| 43 | */ |
||
| 44 | protected function mergeData($data) |
||
| 45 | { |
||
| 46 | return array_merge($this->offset, $data); |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * loadConfig function. |
||
| 51 | * |
||
| 52 | * @access public |
||
| 53 | * @param array $offset |
||
| 54 | * @return $this |
||
| 55 | */ |
||
| 56 | public function loadConfig(array $offset) |
||
| 62 | |||
| 63 | /** |
||
| 64 | * ArrayAccess Implementations |
||
| 65 | */ |
||
| 66 | |||
| 67 | /** |
||
| 68 | * {@inheritdoc} |
||
| 69 | */ |
||
| 70 | public function offsetExists($key) |
||
| 74 | |||
| 75 | /** |
||
| 76 | * {@inheritdoc} |
||
| 77 | */ |
||
| 78 | public function offsetGet($key) |
||
| 82 | |||
| 83 | /** |
||
| 84 | * {@inheritdoc} |
||
| 85 | */ |
||
| 86 | public function offsetSet($key, $value) |
||
| 90 | |||
| 91 | /** |
||
| 92 | * {@inheritdoc} |
||
| 93 | */ |
||
| 94 | public function offsetUnset($key) |
||
| 98 | |||
| 99 | /** |
||
| 100 | * {@inheritdoc} |
||
| 101 | */ |
||
| 102 | public function count() |
||
| 106 | |||
| 107 | /** |
||
| 108 | * {@inheritdoc} |
||
| 109 | */ |
||
| 110 | public function getIterator() |
||
| 114 | } |
||
| 115 |