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.
Completed
Pull Request — master (#9)
by Gallice
03:41 queued 55s
created

Generic::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 2
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 Element[]
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