Passed
Push — master ( 8ed01e...08cfff )
by Romain
02:40
created

Share   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A jsonSerialize() 0 11 1
1
<?php
2
3
namespace Kerox\Messenger\Model\Common\Button;
4
5
use Kerox\Messenger\Helper\UtilityTrait;
6
use Kerox\Messenger\Model\Message\Attachment\Template\Generic;
7
8
class Share extends AbstractButton
9
{
10
11
    use UtilityTrait;
12
13
    /**
14
     * @var null|\Kerox\Messenger\Model\Message\Attachment\Template\Generic
15
     */
16
    protected $content;
17
18
    /**
19
     * Share constructor.
20
     * @param \Kerox\Messenger\Model\Message\Attachment\Template\Generic $content
21
     */
22 1
    public function __construct(Generic $content = null)
23
    {
24 1
        parent::__construct(self::TYPE_SHARE);
25
26 1
        $this->content = $content;
27 1
    }
28
29
    /**
30
     * @return array
31
     */
32 1
    public function jsonSerialize(): array
33
    {
34 1
        $json = parent::jsonSerialize();
35
        $json += [
36
            'share_contents' => [
37 1
                'attachment' => $this->content,
38
            ],
39
        ];
40
41 1
        return $this->arrayFilter($json);
42
    }
43
}
44