ClientDeletedDateFinderRepository::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
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