These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Yii2 Pages Module |
||
4 | * |
||
5 | * @link https://github.com/hiqdev/yii2-module-pages |
||
6 | * @package yii2-module-pages |
||
7 | * @license BSD-3-Clause |
||
8 | * @copyright Copyright (c) 2016-2017, HiQDev (http://hiqdev.com/) |
||
9 | */ |
||
10 | |||
11 | namespace hiqdev\yii2\modules\pages\models; |
||
12 | |||
13 | use hiqdev\yii2\modules\pages\Module; |
||
14 | use Yii; |
||
15 | |||
16 | class TwigPage extends AbstractPage |
||
17 | { |
||
18 | public function render(array $params = []) |
||
19 | { |
||
20 | $path = Module::getInstance()->getLocalPath($this->path); |
||
0 ignored issues
–
show
|
|||
21 | |||
22 | return Yii::$app->getView()->renderFile($path, $params); |
||
23 | } |
||
24 | |||
25 | View Code Duplication | public function extractData($path) |
|
26 | { |
||
27 | $lines = static::getModule()->readArray($path); |
||
0 ignored issues
–
show
The method
getModule() does not seem to exist on object<hiqdev\yii2\modules\pages\models\TwigPage> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
28 | $matterLines = $this->readQuotedLines($lines, '/^{#/', '/#}$/'); |
||
29 | if (empty($matterLines)) { |
||
30 | $data = []; |
||
31 | $text = $lines; |
||
32 | } else { |
||
33 | $data = $this->readFrontMatter($matterLines); |
||
34 | $text = array_slice($lines, count($matterLines)); |
||
35 | } |
||
36 | |||
37 | return [$data, implode("\n", $text)]; |
||
38 | } |
||
39 | } |
||
40 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: