Passed
Push — master ( 8dd18e...dc0318 )
by Romain
35s
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
namespace Kerox\Messenger\Model\Common\Buttons;
3
4
use Kerox\Messenger\Helper\UtilityTrait;
5
use Kerox\Messenger\Model\Message\Attachment\Template\Generic;
6
7
class Share extends AbstractButtons
8
{
9
10
    use UtilityTrait;
11
12
    /**
13
     * @var null|\Kerox\Messenger\Model\Message\Attachment\Template\Generic
14
     */
15
    protected $content;
16
17
    /**
18
     * Share constructor.
19
     * @param \Kerox\Messenger\Model\Message\Attachment\Template\Generic $content
20
     */
21 1
    public function __construct(Generic $content = null)
22
    {
23 1
        parent::__construct(self::TYPE_SHARE);
24
25 1
        $this->content = $content;
26 1
    }
27
28
    /**
29
     * @return array
30
     */
31 1
    public function jsonSerialize(): array
32
    {
33 1
        $json = parent::jsonSerialize();
34
        $json += [
35
            'share_contents' => [
36 1
                'attachment' => $this->content,
37
            ],
38
        ];
39
40 1
        return $this->arrayFilter($json);
41
    }
42
}
43