Layout   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 21
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A jsonSerialize() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the zibios/sharep.
7
 *
8
 * (c) Zbigniew Ślązak
9
 */
10
11
namespace App\Slack\MessageBuilder;
12
13
use App\Slack\MessageBuilder\Block\BlockInterface;
14
15
class Layout implements MessageInterface
16
{
17
    /** @var array|BlockInterface[] */
18
    private $blocks;
19
20 3
    public function __construct(BlockInterface ...$blocks)
21
    {
22 3
        $this->blocks = $blocks;
23 3
    }
24
25 3
    public function jsonSerialize(): array
26
    {
27 3
        $jsonData = [];
28
29 3
        foreach ($this->blocks as $block) {
30 3
            $jsonData[] = $block->jsonSerialize();
31
        }
32
33 3
        return ['blocks' => $jsonData];
34
    }
35
}
36