Completed
Push — master ( f6cc4f...20183c )
by Andrii
03:46
created

src/handlers/TypeHandler.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Automation tool mixed with code generator for easier continuous development
4
 *
5
 * @link      https://github.com/hiqdev/hidev
6
 * @package   hidev
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\handlers;
12
13
/**
14
 * Handler for typed files.
15
 *
16
 * If there is a template then renders with it.
17
 * Else renders with renderType.
18
 */
19
class TypeHandler extends TemplateHandler
20
{
21 3
    public function render($data)
22
    {
23 3
        return $this->existsTemplate() ? $this->renderTemplate($data) : $this->renderType($data);
0 ignored issues
show
Documentation Bug introduced by
The method renderType does not exist on object<hidev\handlers\TypeHandler>? Since you implemented __call, maybe consider adding a @method annotation.

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:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
24
    }
25
}
26