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 (#10)
by
unknown
05:09
created

ResultCollection::isEmpty()   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 0
1
<?php
2
3
namespace RobbieP\ZbarQrdecoder\Result;
4
5
class ResultCollection extends AbstractResult implements \IteratorAggregate, \Countable
6
{
7
    public function hasResult()
8
    {
9
        return !$this->isEmpty();
10
    }
11
12
    public function getText()
13
    {
14
        if ($this->isEmpty()) {
15
            throw new \LogicException('Empty result set.');
16
        }
17
18
        return $this->results[0]->getText();
19
    }
20
21
    public function getFormat()
22
    {
23
        if ($this->isEmpty()) {
24
            throw new \LogicException('Empty result set.');
25
        }
26
27
        return $this->results[0]->getFormat();
28
    }
29
30
    public function __toString()
31
    {
32
        if ($this->isEmpty()) {
33
            return 'No result';
34
        }
35
36
        return (string)$this->results[0];
37
    }
38
39
40
    /**
41
     * @var AbstractResult[]
42
     */
43
    public $results = [];
44
45
    /**
46
     * @return AbstractResult[]
47
     */
48
    public function getResults()
49
    {
50
        return $this->results;
51
    }
52
53
    public function addResult(AbstractResult $result)
54
    {
55
        $this->results[] = $result;
56
    }
57
58
    /**
59
     * @return bool
60
     */
61
    public function isEmpty()
62
    {
63
        return count($this->results) === 0;
64
    }
65
66
    public function getIterator()
67
    {
68
        return new \ArrayIterator($this->results);
69
    }
70
71
    public function count()
72
    {
73
        return count($this->results);
74
    }
75
}
76