GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — master (#36)
by Gallice
04:29
created

AbstractElement   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 11
lcom 0
cbo 0
dl 0
loc 84
c 0
b 0
f 0
ccs 15
cts 15
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 4
A getImageUrl() 0 4 1
A getSubtitle() 0 4 1
A getTitle() 0 4 1
A setImageUrl() 0 4 1
A setSubtitle() 0 8 3
1
<?php
2
3
namespace Tgallice\FBMessenger\Model\Attachment\Template;
4
5
abstract class AbstractElement implements \JsonSerializable
6
{
7
    /**
8
     * @var string
9
     */
10
    private $title;
11
    
12
    /**
13
     * @var null|string
14
     */
15
    private $subtitle;
16
17
    /**
18
     * @var null|string
19
     */
20
    private $imageUrl;
21
22
    /**
23
     * @param string $title
24
     * @param null|string $subtitle
25
     * @param null|string $imageUrl
26
     */
27 25
    public function __construct($title, $subtitle = null, $imageUrl = null)
28
    {
29 25
        if (mb_strlen($title) > 80) {
30 2
            throw new \InvalidArgumentException('In a element, the "title" field should not exceed 80 characters.');
31
        }
32
33 23
        if (!empty($subtitle) && mb_strlen($subtitle) > 80) {
34 2
            throw new \InvalidArgumentException('In a element, the "subtitle" field should not exceed 80 characters.');
35
        }
36
        
37 21
        $this->title = $title;
38 21
        $this->subtitle = $subtitle;
39 21
        $this->imageUrl = $imageUrl;
40 21
    }
41
    
42
    /**
43
     * @return null|string
44
     */
45 6
    public function getImageUrl()
46
    {
47 6
        return $this->imageUrl;
48
    }
49
50
    /**
51
     * @return null|string
52
     */
53 4
    public function getSubtitle()
54
    {
55 4
        return $this->subtitle;
56
    }
57
58
    /**
59
     * @return string
60
     */
61 6
    public function getTitle()
62
    {
63 6
        return $this->title;
64
    }
65
66
    /**
67
     * @deprecated use the constructor argument instead
68
     * @param null|string $imageUrl
69
     */
70
    public function setImageUrl($imageUrl)
71
    {
72
        $this->imageUrl = $imageUrl;
73
    }
74
75
76
    /**
77
     * @deprecated use the constructor argument instead
78
     * @param null|string $subtitle
79
     */
80
    public function setSubtitle($subtitle)
81
    {
82
        if (!empty($subtitle) && mb_strlen($subtitle) > 80) {
83
            throw new \InvalidArgumentException('In a element, the "subtitle" field should not exceed 80 characters.');
84
        }
85
86
        $this->subtitle = $subtitle;
87
    }
88
}
89