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 — develop (#30)
by Tom Van
02:07
created

ArrayCollection::exists()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * Basic array implementation of a Collection
4
 *
5
 * @link        http://github.com/PHPExif/php-exif-common for the canonical source repository
6
 * @copyright   Copyright (c) 2016 Tom Van Herreweghe <[email protected]>
7
 * @license     http://github.com/PHPExif/php-exif-common/blob/master/LICENSE MIT License
8
 * @category    PHPExif
9
 * @package     Common
10
 * @codeCoverageIgnore
11
 */
12
13
namespace PHPExif\Common\Collection;
14
15
use PHPExif\Common\Exception\Collection\ElementAlreadyExistsException;
16
use PHPExif\Common\Exception\Collection\ElementNotExistsException;
17
18
/**
19
 * ArrayCollection class
20
 *
21
 * @category    PHPExif
22
 * @package     Common
23
 */
24
class ArrayCollection implements Collection
25
{
26
    /**
27
     * Holds the entries of the collection
28
     *
29
     * @var array
30
     */
31
    protected $elements;
32
33
    /**
34
     * Collection constructor
35
     *
36
     * @param array $elements
37
     */
38
    public function __construct(array $elements = array())
39
    {
40
        $this->elements = array();
41
42
        foreach ($elements as $name => $value) {
43
            $this->set($name, $value);
44
        }
45
    }
46
47
    /**
48
     * @inheritDoc
49
     */
50
    public function add($value)
51
    {
52
        $this->elements[] = $value;
53
54
        return $this;
55
    }
56
57
    /**
58
     * @inheritDoc
59
     */
60
    public function set($key, $value)
61
    {
62
        if ($this->exists($key)) {
63
            throw ElementAlreadyExistsException::withKey($key);
64
        }
65
66
        $this->elements[$key] = $value;
67
68
        return $this;
69
    }
70
71
    /**
72
     * @inheritDoc
73
     */
74
    public function exists($key)
75
    {
76
        return array_key_exists($key, $this->elements);
77
    }
78
79
    /**
80
     * @inheritDoc
81
     */
82
    public function get($key)
83
    {
84
        if (!$this->exists($key)) {
85
            throw ElementNotExistsException::withKey($key);
86
        }
87
88
        return $this->elements[$key];
89
    }
90
91
    /**
92
     * @inheritDoc
93
     */
94
    public function count()
95
    {
96
        return count($this->elements);
97
    }
98
}
99