Passed
Push — dev ( 1f861c...ab5646 )
by Janko
92:20
created

CreateMissingUserAwards   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 28.57%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 6
dl 0
loc 16
ccs 2
cts 7
cp 0.2857
rs 10
c 1
b 1
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A handle() 0 8 3
1
<?php
2
3
namespace Stu\Module\Maintenance;
4
5
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...
6
use Stu\Module\Database\Lib\CreateDatabaseEntryInterface;
7
use Stu\Orm\Repository\DatabaseCategoryRepositoryInterface;
8
use Stu\Orm\Repository\UserRepositoryInterface;
9
10
final class CreateMissingUserAwards implements MaintenanceHandlerInterface
11
{
12 1
    public function __construct(
13
        private UserRepositoryInterface $userRepository,
14
        private DatabaseCategoryRepositoryInterface $databaseCategoryRepository,
15
        private CreateDatabaseEntryInterface $createDatabaseEntry
16 1
    ) {}
17
18
    #[Override]
19
    public function handle(): void
20
    {
21
        $categories = $this->databaseCategoryRepository->findAll();
22
23
        foreach ($this->userRepository->getNonNpcList() as $user) {
24
            foreach ($categories as $category) {
25
                $this->createDatabaseEntry->checkForCategoryCompletion($user, $category);
26
            }
27
        }
28
    }
29
}
30