ClientDeletedDateFinderRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A findClientDeletedAtDate() 0 9 2
A __construct() 0 3 1
1
<?php
2
3
namespace App\Module\Client\Update\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
7
/**
8
 * When a client is restored, the notes with the same deleted date as the client are restored.
9
 */
10
readonly class ClientDeletedDateFinderRepository
11
{
12 11
    public function __construct(
13
        private QueryFactory $queryFactory,
14
    ) {
15 11
    }
16
17 1
    public function findClientDeletedAtDate(string|int $id): ?\DateTimeImmutable
18
    {
19 1
        $query = $this->queryFactory->selectQuery()->select(['deleted_at'])->from('client')->where(
20 1
            ['id' => $id]
21 1
        );
22
23 1
        $deletedAt = $query->execute()->fetch('assoc')['deleted_at'] ?? null;
24
25 1
        return $deletedAt !== null ? new \DateTimeImmutable($deletedAt) : null;
26
    }
27
}
28