| 1 | <?php |
||
| 18 | class TemplateHandler extends BaseHandler |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * {@inheritdoc} |
||
| 22 | */ |
||
| 23 | 5 | public function renderPrepared(array $data) |
|
| 24 | { |
||
| 25 | 5 | return $this->getView()->render($this->template, $data); |
|
| 26 | } |
||
| 27 | |||
| 28 | public function renderTemplate($data) |
||
| 29 | { |
||
| 30 | return $this->renderPrepared(self::prepareData($data)); |
||
| 31 | } |
||
| 32 | |||
| 33 | 5 | public function prepareData($data) |
|
| 34 | { |
||
| 35 | 5 | return array_merge([ |
|
| 36 | 5 | 'config' => Yii::$app->config, |
|
| 37 | 5 | 'this' => $this, |
|
| 38 | 5 | 'file' => $data->file, |
|
| 39 | 5 | ], parent::prepareData($data)); |
|
| 40 | } |
||
| 41 | |||
| 42 | 2 | public function existsTemplate() |
|
| 46 | } |
||
| 47 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.