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 — 2.x (#7)
by
unknown
03:25
created

Result::text()   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
 * Created by PhpStorm.
4
 * User: robbie
5
 * Date: 01/12/14
6
 * Time: 01:36
7
 */
8
9
namespace RobbieP\ZbarQrdecoder\Result;
10
11
use RobbieP\ZbarQrdecoder\Result\Parser\ParserInterface;
12
13
class Result extends AbstractResult
14
{
15
    const FORMAT_QR_CODE         = 'QR_CODE';
16
    const FORMAT_EAN_13          = 'EAN_13';
17
    const FORMAT_CODE_39         = 'CODE_39';
18
    const FORMAT_CODE_128        = 'CODE_128';
19
    const FORMAT_INTERLEAVED_2_5 = 'INTERLEAVED_2_5';
20
21
    private static $prefix = [
22
        self::FORMAT_QR_CODE         => 'QR-Code',
23
        self::FORMAT_EAN_13          => 'EAN-13',
24
        self::FORMAT_CODE_39         => 'CODE-39',
25
        self::FORMAT_CODE_128        => 'CODE-128',
26
        self::FORMAT_INTERLEAVED_2_5 => 'I2/5',
27
    ];
28
29
    /**
30
     * Pass in the raw result from the process
31
     *
32
     * @param string $text
33
     * @param string $format
34
     */
35
    public function __construct($text, $format)
36
    {
37
        // TODO: Tidy/Refactor this bit of code
38
        $this->text($text);
39
        $this->format($format);
40
    }
41
42
    /**
43
     * Format of the bar code
44
     *
45
     * @param $format
46
     */
47
    protected function format($format)
48
    {
49
        parent::format(array_search($format, self::$prefix, true));
50
        if ($this->format) {
51
            $this->code = 200;
52
        }
53
    }
54
55
    /**
56
     * Just returns the text output
57
     *
58
     * @return string
59
     */
60
    public function __toString()
61
    {
62
        if (!empty($this->text)) {
63
            return $this->text;
64
        }
65
66
        return 'No result';
67
    }
68
}
69