NoteListClientFinderRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 23
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A findClientData() 0 9 2
A __construct() 0 3 1
1
<?php
2
3
namespace App\Module\Note\List\Repository;
4
5
use App\Infrastructure\Database\QueryFactory;
0 ignored issues
show
Bug introduced by
The type App\Infrastructure\Database\QueryFactory 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...
6
use App\Module\Client\Data\ClientData;
7
8
readonly class NoteListClientFinderRepository
9
{
10 13
    public function __construct(
11
        private QueryFactory $queryFactory,
12
    ) {
13 13
    }
14
15
    /**
16
     * Return client including deleted with given id if it exists.
17
     *
18
     * @param string|int $id
19
     *
20
     * @return ClientData
21
     */
22 6
    public function findClientData(string|int $id): ClientData
23
    {
24 6
        $query = $this->queryFactory->selectQuery()->select(['*'])->from('client')->where(
25 6
            ['id' => $id]
26 6
        );
27
28 6
        $clientRow = $query->execute()->fetch('assoc') ?: [];
29
30 6
        return new ClientData($clientRow);
31
    }
32
}
33