Test Failed
Pull Request — master (#355)
by Sergei
13:10 queued 02:28
created

CommonViewInjection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCommonParameters() 0 5 1
A __construct() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\ViewInjection;
6
7
use Yiisoft\Form\Widget\Field;
8
use Yiisoft\Router\UrlGeneratorInterface;
9
use Yiisoft\Yii\View\CommonParametersInjectionInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Yii\View\CommonP...etersInjectionInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
11
class CommonViewInjection implements CommonParametersInjectionInterface
12
{
13
    private UrlGeneratorInterface $url;
14
    private Field $field;
15
16
    public function __construct(
17
        UrlGeneratorInterface $url,
18
        Field $field
19
    ) {
20
        $this->url = $url;
21
        $this->field = $field;
22
    }
23
24
    public function getCommonParameters(): array
25
    {
26
        return [
27
            'field' => $this->field,
28
            'url' => $this->url,
29
        ];
30
    }
31
}
32