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
Coding Style
introduced
by
![]() |
|||
9 | * @copyright Copyright (c) 2018 nystudio107 |
||
0 ignored issues
–
show
|
|||
10 | */ |
||
0 ignored issues
–
show
|
|||
11 | |||
12 | namespace nystudio107\retour\models; |
||
13 | |||
14 | use craft\base\Model; |
||
15 | |||
16 | /** |
||
0 ignored issues
–
show
|
|||
17 | * @author nystudio107 |
||
0 ignored issues
–
show
Content of the @author tag must be in the form "Display Name <[email protected]>"
![]() |
|||
18 | * @package Retour |
||
0 ignored issues
–
show
|
|||
19 | * @since 3.0.0 |
||
0 ignored issues
–
show
|
|||
20 | */ |
||
0 ignored issues
–
show
|
|||
21 | class DbModel extends Model |
||
22 | { |
||
23 | // Static Protected Methods |
||
24 | // ========================================================================= |
||
25 | |||
26 | /** |
||
0 ignored issues
–
show
|
|||
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
|
|||
43 | * @param array $config |
||
0 ignored issues
–
show
|
|||
44 | */ |
||
0 ignored issues
–
show
|
|||
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 |