Passed
Push — master ( 8387eb...5a11dc )
by Janko
07:59
created

PmReset::resetAllNonNpcPmFolders()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 8
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Component\Admin\Reset\Communication;
6
7
use Doctrine\ORM\EntityManagerInterface;
8
use Override;
0 ignored issues
show
Bug introduced by
The type Override 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...
9
use Stu\Orm\Repository\PrivateMessageFolderRepositoryInterface;
10
use Stu\Orm\Repository\PrivateMessageRepositoryInterface;
11
12
final class PmReset implements PmResetInterface
13
{
14 1
    public function __construct(
15
        private PrivateMessageFolderRepositoryInterface $privateMessageFolderRepository,
16
        private PrivateMessageRepositoryInterface $privateMessageRepository,
17
        private EntityManagerInterface $entityManager
18 1
    ) {}
19
20
    #[Override]
21
    public function unsetAllInboxReferences(): void
22
    {
23
        echo "  - unset all inbox references\n";
24
25
        $this->privateMessageRepository->unsetAllInboxReferences();
26
27
        $this->entityManager->flush();
28
    }
29
30
    #[Override]
31
    public function resetAllNonNpcPmFolders(): void
32
    {
33
        echo "  - deleting all non npc pm folders\n";
34
35
        $this->privateMessageFolderRepository->truncateAllNonNpcFolders();
36
37
        $this->entityManager->flush();
38
    }
39
}
40