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

PmReset   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 20%

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 26
ccs 2
cts 10
cp 0.2
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A unsetAllInboxReferences() 0 8 1
A resetAllNonNpcPmFolders() 0 8 1
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