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 (#165)
by Eric
06:03 queued 03:27
created

DistanceMatrixRow   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 9
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 71
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A hasElements() 0 4 1
A getElements() 0 4 1
A setElements() 0 5 1
A addElements() 0 6 2
A hasElement() 0 4 1
A addElement() 0 6 2
A removeElement() 0 5 1
1
<?php
2
3
/*
4
 * This file is part of the Ivory Google Map package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\GoogleMap\Service\DistanceMatrix\Response;
13
14
/**
15
 * @author GeLo <[email protected]>
16
 */
17
class DistanceMatrixRow
18
{
19
    /**
20
     * @var DistanceMatrixElement[]
21
     */
22
    private $elements = [];
23
24
    /**
25
     * @return bool
26
     */
27
    public function hasElements()
28
    {
29
        return !empty($this->elements);
30
    }
31
32
    /**
33
     * @return DistanceMatrixElement[]
34
     */
35
    public function getElements()
36
    {
37
        return $this->elements;
38
    }
39
40
    /**
41
     * @param DistanceMatrixElement[] $elements
42
     */
43
    public function setElements(array $elements)
44
    {
45
        $this->elements = [];
46
        $this->addElements($elements);
47
    }
48
49
    /**
50
     * @param DistanceMatrixElement[] $elements
51
     */
52
    public function addElements(array $elements)
53
    {
54
        foreach ($elements as $element) {
55
            $this->addElement($element);
56
        }
57
    }
58
59
    /**
60
     * @param DistanceMatrixElement $element
61
     *
62
     * @return bool
63
     */
64
    public function hasElement(DistanceMatrixElement $element)
65
    {
66
        return in_array($element, $this->elements, true);
67
    }
68
69
    /**
70
     * @param DistanceMatrixElement $element
71
     */
72
    public function addElement(DistanceMatrixElement $element)
73
    {
74
        if (!$this->hasElement($element)) {
75
            $this->elements[] = $element;
76
        }
77
    }
78
79
    /**
80
     * @param DistanceMatrixElement $element
81
     */
82
    public function removeElement(DistanceMatrixElement $element)
83
    {
84
        unset($this->elements[array_search($element, $this->elements, true)]);
85
        $this->elements = array_values($this->elements);
86
    }
87
}
88