Share   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A create() 0 4 1
A toArray() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kerox\Messenger\Model\Common\Button;
6
7
use Kerox\Messenger\Helper\UtilityTrait;
8
use Kerox\Messenger\Model\Message\Attachment\Template\GenericTemplate;
9
10
/**
11
 * @deprecated Since version 3.2.0 and will be removed in version 4.0.0.
12
 */
13
class Share extends AbstractButton
14
{
15
    use UtilityTrait;
16
17
    /**
18
     * @var \Kerox\Messenger\Model\Message\Attachment\Template\GenericTemplate|null
19
     */
20
    protected $content;
21
22
    /**
23
     * Share constructor.
24
     */
25 1
    public function __construct(?GenericTemplate $content = null)
26
    {
27 1
        parent::__construct(self::TYPE_SHARE);
0 ignored issues
show
Deprecated Code introduced by
The constant Kerox\Messenger\Model\Co...tractButton::TYPE_SHARE has been deprecated with message: Since version 3.3.1 and will be removed in version 4.0.0.

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
28
29 1
        $this->content = $content;
30 1
    }
31
32
    /**
33
     * @return \Kerox\Messenger\Model\Common\Button\Share
34
     */
35 1
    public static function create(?GenericTemplate $content = null): self
36
    {
37 1
        return new self($content);
0 ignored issues
show
Deprecated Code introduced by
The class Kerox\Messenger\Model\Common\Button\Share has been deprecated with message: Since version 3.2.0 and will be removed in version 4.0.0.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
38
    }
39
40 1
    public function toArray(): array
41
    {
42 1
        $array = parent::toArray();
43
        $array += [
44
            'share_contents' => [
45 1
                'attachment' => $this->content,
46
            ],
47
        ];
48
49 1
        return $this->arrayFilter($array);
50
    }
51
}
52