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

CreateMissingUserAwards::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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