SearchCharacteristics::execute()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 5
c 1
b 0
f 0
nc 4
nop 2
dl 0
loc 9
rs 10
1
<?php
2
3
4
namespace App\Src\UseCases\Domain\Context\Queries;
5
6
7
use App\Src\UseCases\Domain\Ports\PageRepository;
8
9
/**
10
 * Search characteristics in the wiki pages
11
 */
12
class SearchCharacteristics
13
{
14
    private $pageRepository;
15
16
    public function __construct(PageRepository $pageRepository)
17
    {
18
        $this->pageRepository = $pageRepository;
19
    }
20
21
    public function execute(string $type, string $search):array
22
    {
23
        if($type === 'farming') {
24
            $type = 'culture';
25
        }
26
        if($type === 'croppingSystem') {
27
            $type = 'label';
28
        }
29
        return $this->pageRepository->search($type, $search);
0 ignored issues
show
Bug introduced by
The method search() does not exist on App\Src\UseCases\Domain\Ports\PageRepository. It seems like you code against a sub-type of App\Src\UseCases\Domain\Ports\PageRepository such as App\Src\UseCases\Infra\Sql\PageRepositorySql. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
        return $this->pageRepository->/** @scrutinizer ignore-call */ search($type, $search);
Loading history...
30
    }
31
}
32