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.

Generic   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 48
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A getElements() 0 4 1
A getType() 0 4 1
A jsonSerialize() 0 7 1
1
<?php
2
3
namespace Tgallice\FBMessenger\Model\Attachment\Template;
4
5
use Tgallice\FBMessenger\Model\Attachment\Template;
6
use Tgallice\FBMessenger\Model\Attachment\Template\Generic\Element;
7
8
class Generic extends Template
9
{
10
    /**
11
     * @var Element[]
12
     */
13
    private $elements;
14
15
    /**
16
     * @param Element[] $elements
17
     *
18
     * @throws \InvalidArgumentException
19
     */
20 6
    public function __construct(array $elements)
21
    {
22 6
        if (count($elements) > 10) {
23 1
            throw new \InvalidArgumentException('A generic template can not have more than 10 bubbles');
24
        }
25
26 5
        $this->elements = $elements;
27 5
    }
28
29
    /**
30
     * @return Element[]
31
     */
32 1
    public function getElements()
33
    {
34 1
        return $this->elements;
35
    }
36
37
    /**
38
     * @return string
39
     */
40 2
    public function getType()
41
    {
42 2
        return Template::TYPE_GENERIC;
43
    }
44
45
    /**
46
     * @inheritdoc
47
     */
48 1
    public function jsonSerialize()
49
    {
50
        return [
51 1
            'template_type' => $this->getType(),
52 1
            'elements' => $this->elements,
53 1
        ];
54
    }
55
}
56