These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace yiicod\mailqueue; |
||
4 | |||
5 | use Yii; |
||
6 | use yii\base\Component; |
||
7 | use yii\helpers\ArrayHelper; |
||
8 | use yii\console\Application; |
||
9 | |||
10 | /** |
||
11 | * Comments extension settings |
||
12 | * @author Orlov Alexey <[email protected]> |
||
13 | */ |
||
14 | class MailQueue extends Component |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * @var ARRAY table settings |
||
19 | */ |
||
20 | public $modelMap = []; |
||
21 | |||
22 | /** |
||
23 | * @var string Component name, default PhpMailer |
||
24 | */ |
||
25 | public $mailer = null; |
||
26 | |||
27 | /** |
||
28 | * @var ARRAY components settings |
||
29 | */ |
||
30 | public $components = []; |
||
31 | |||
32 | /** |
||
33 | * @var Array |
||
34 | */ |
||
35 | public $commandMap = []; |
||
36 | |||
37 | public function init() |
||
38 | { |
||
39 | parent::init(); |
||
40 | |||
41 | //Merge main extension config with local extension config |
||
42 | $config = include(dirname(__FILE__) . '/config/main.php'); |
||
43 | foreach ($config as $key => $value) { |
||
44 | if (is_array($value)) { |
||
45 | $this->{$key} = ArrayHelper::merge($value, $this->{$key}); |
||
46 | } elseif (null === $this->{$key}) { |
||
47 | $this->{$key} = $value; |
||
48 | } |
||
49 | } |
||
50 | |||
51 | if (Yii::$app instanceof Application) { |
||
52 | //Merge commands map |
||
53 | Yii::$app->controllerMap = ArrayHelper::merge($this->commandMap, Yii::$app->controllerMap); |
||
54 | Yii::$app->controllerMap = array_filter(Yii::$app->controllerMap); |
||
55 | } |
||
56 | |||
57 | Yii::$app->setComponents($this->components); |
||
58 | |||
59 | //Set components |
||
60 | if (count($this->components)) { |
||
61 | $exists = Yii::$app->getComponents(false); |
||
62 | foreach ($this->components as $component => $params) { |
||
63 | if (isset($exists[$component]) && is_object($exists[$component])) { |
||
64 | unset($this->components[$component]); |
||
65 | } elseif (isset($exists[$component])) { |
||
66 | $this->components[$component] = ArrayHelper::merge($params, $exists[$component]); |
||
67 | } |
||
68 | } |
||
69 | |||
70 | Yii::$app->setComponents( |
||
71 | $this->components, false |
||
0 ignored issues
–
show
|
|||
72 | ); |
||
73 | } |
||
74 | |||
75 | Yii::setAlias('@yiicod', realpath(dirname(__FILE__) . '/..')); |
||
76 | } |
||
77 | |||
78 | } |
||
79 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.