Passed
Pull Request — master (#2178)
by Nico
24:52 queued 14:43
created

KnArchiveFactory::createKnArchiveItem()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2.004

Importance

Changes 0
Metric Value
cc 2
eloc 9
nc 2
nop 3
dl 0
loc 13
ccs 9
cts 10
cp 0.9
crap 2.004
rs 9.9666
c 0
b 0
f 0
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