Issues (1783)

src/models/DbModel.php (23 issues)

1
<?php
2
/**
3
 * Retour plugin for Craft CMS
4
 *
5
 * Retour allows you to intelligently redirect legacy URLs, so that you don't
6
 * lose SEO value when rebuilding & restructuring a website
7
 *
8
 * @link      https://nystudio107.com/
0 ignored issues
show
The tag in position 1 should be the @copyright tag
Loading history...
9
 * @copyright Copyright (c) 2018 nystudio107
0 ignored issues
show
@copyright tag must contain a year and the name of the copyright holder
Loading history...
10
 */
0 ignored issues
show
PHP version not specified
Loading history...
Missing @category tag in file comment
Loading history...
Missing @package tag in file comment
Loading history...
Missing @author tag in file comment
Loading history...
Missing @license tag in file comment
Loading history...
11
12
namespace nystudio107\retour\models;
13
14
use craft\base\Model;
15
16
/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
17
 * @author    nystudio107
0 ignored issues
show
The tag in position 1 should be the @package tag
Loading history...
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
Tag value for @author tag indented incorrectly; expected 2 spaces but found 4
Loading history...
18
 * @package   Retour
0 ignored issues
show
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
19
 * @since     3.0.0
0 ignored issues
show
The tag in position 3 should be the @author tag
Loading history...
Tag value for @since tag indented incorrectly; expected 3 spaces but found 5
Loading history...
20
 */
0 ignored issues
show
Missing @category tag in class comment
Loading history...
Missing @license tag in class comment
Loading history...
Missing @link tag in class comment
Loading history...
21
class DbModel extends Model
22
{
23
    // Static Protected Methods
24
    // =========================================================================
25
26
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
Parameter $config should have a doc-comment as per coding-style.
Loading history...
27
     * @inheritdoc
28
     */
29
    public function __construct(array $config = [])
30
    {
31
        // Unset any deprecated properties
32
        self::cleanProperties(static::class, $config);
33
        parent::__construct($config);
34
    }
35
36
    // Public Methods
37
    // =========================================================================
38
39
    /**
40
     * Remove any properties that don't exist in the model
41
     *
42
     * @param string $class
0 ignored issues
show
Missing parameter comment
Loading history...
43
     * @param array $config
0 ignored issues
show
Expected 2 spaces after parameter type; 1 found
Loading history...
Missing parameter comment
Loading history...
44
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
45
    protected static function cleanProperties(string $class, array &$config): void
46
    {
47
        foreach ($config as $propName => $propValue) {
48
            if (!property_exists($class, $propName)) {
49
                unset($config[$propName]);
50
            }
51
        }
52
    }
53
}
54