Passed
Pull Request — master (#2177)
by Nico
30:59 queued 20:55
created

KnArchiveFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 91.67%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 21
ccs 11
cts 12
cp 0.9167
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createKnArchiveItem() 0 13 2
A __construct() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Component\Communication\Kn;
6
7
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...
8
use Stu\Module\Template\StatusBarFactoryInterface;
9
use Stu\Orm\Entity\KnPostArchiv;
10
use Stu\Orm\Entity\RpgPlotArchiv;
11
use Stu\Orm\Entity\User;
12
use Stu\Orm\Repository\KnCommentArchivRepositoryInterface;
13
14
final class KnArchiveFactory implements KnArchiveFactoryInterface
15
{
16 1
    public function __construct(
17
        private KnBbCodeParser $bbcodeParser,
18
        private StatusBarFactoryInterface $statusBarFactory,
19
        private KnCommentArchivRepositoryInterface $knCommentArchivRepository
20 1
    ) {}
21
22 1
    #[Override]
23
    public function createKnArchiveItem(KnPostArchiv $post, User $user, ?RpgPlotArchiv $plot = null): KnArchiveItemInterface
24
    {
25 1
        $item = new KnArchiveItem(
26 1
            $this->bbcodeParser,
27 1
            $this->statusBarFactory,
28 1
            $post,
29 1
            $this->knCommentArchivRepository
30 1
        );
31 1
        if ($plot !== null) {
32
            $item->setPlot($plot);
33
        }
34 1
        return $item;
35
    }
36
}
37