Completed
Pull Request — master (#8)
by
unknown
09:21
created

Module.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
 * Sitemap module
4
 *
5
 * @author Serge Larin <[email protected]>
6
 * @link http://assayer.pro/
7
 * @copyright 2015 Assayer Pro Company
8
 * @license http://opensource.org/licenses/LGPL-3.0
9
 */
10
11
12
namespace assayerpro\sitemap;
13
14
/**
15
 * Class Module for sitemap
16
 *
17
 * @author Serge Larin <[email protected]>
18
 * @package app\modules\webmaster
19
 */
20
class Module extends \yii\base\Module
21
{
22
    public $cacheExpire = 0;
23
    public $enableGzip = false;
24
    protected $_components = [
25
        'generator' => [
26
            'class' => \assayerpro\sitemap\Sitemap::class,
27
        ],
28
    ];
29
    /**
30
     * The namespace that controller classes are in.
31
     *
32
     * @var string
33
     * @access public
34
     */
35
    public $controllerNamespace = 'assayerpro\sitemap\controllers';
36
37
    /**
38
     * @inheritdoc
39
     */
40
    public function init()
41
    {
42
        parent::init();
43
        $this->generator->moduleId = $this->id;
0 ignored issues
show
The property generator does not exist on object<assayerpro\sitemap\Module>. Since you implemented __get, maybe consider adding a @property annotation.

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 @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

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.

Loading history...
44
45
        // custom initialization code goes here
46
    }
47
}
48