UpdateContentBlockHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 16
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 6 1
1
<?php
2
3
namespace Backend\Modules\ContentBlocks\Domain\ContentBlock\Command;
4
5
use Backend\Modules\ContentBlocks\Domain\ContentBlock\ContentBlock;
6
use Backend\Modules\ContentBlocks\Domain\ContentBlock\ContentBlockRepository;
7
8
final class UpdateContentBlockHandler
9
{
10
    /** @var ContentBlockRepository */
11
    private $contentBlockRepository;
12
13
    public function __construct(ContentBlockRepository $contentBlockRepository)
14
    {
15
        $this->contentBlockRepository = $contentBlockRepository;
16
    }
17
18
    public function handle(UpdateContentBlock $updateContentBlock): void
19
    {
20
        $contentBlock = ContentBlock::fromDataTransferObject($updateContentBlock);
21
        $this->contentBlockRepository->add($contentBlock);
22
23
        $updateContentBlock->setContentBlockEntity($contentBlock);
24
    }
25
}
26