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
Push — master ( 050f47...66d8e7 )
by Miles
02:10
created

ParseException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 10
ccs 7
cts 7
cp 1
rs 9.4286
cc 2
eloc 5
nc 2
nop 5
crap 2
1
<?php
2
3
/**
4
 * This file is part of the m1\env library
5
 *
6
 * (c) m1 <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @package     m1/env
12
 * @version     1.0.0
13
 * @author      Miles Croxford <[email protected]>
14
 * @copyright   Copyright (c) Miles Croxford <[email protected]>
15
 * @license     http://github.com/m1/env/blob/master/LICENSE.md
16
 * @link        http://github.com/m1/env/blob/master/README.md Documentation
17
 */
18
19
namespace M1\Env\Exception;
20
21
/**
22
 * Env ParseException
23
 *
24
 * @since 0.1.0
25
 */
26
class ParseException extends \ErrorException
27
{
28
    /**
29
     * Constructs a ParseException
30
     *
31
     * @param string $message          The value to parse
32
     * @param bool   $origin_exception To throw the exception in the .env
33
     * @param string $file             The .env file
34
     * @param string $line             The line of the value
35
     * @param int    $line_num         The line num of the value
36
     *
37
     * @return \M1\Env\Exception\ParseException The exception
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
38
     */
39 15
    public function __construct($message, $origin_exception = false, $file = null, $line = null, $line_num = null)
40
    {
41 15
        $message = $this->createMessage($message, $file, $line, $line_num);
42
43 15
        if ($origin_exception) {
44 3
            parent::__construct($message, 0, 1, $file, $line_num);
45 3
        }
46
47 15
        parent::__construct($message);
48 15
    }
49
50
    /**
51
     * Constructs a ParseException message
52
     *
53
     * @param string $message          The value to parse
54
     * @param string $file             The .env file
55
     * @param string $line             The line of the value
56
     * @param int    $line_num         The line num of the value
57
     *
58
     * @return string The exception message
59
     */
60 15
    private function createMessage($message, $file, $line, $line_num)
61
    {
62 15
        if (!is_null($file)) {
63 15
            $message .= sprintf(" in %s", $file);
64 15
        }
65
66 15
        if (!is_null($line)) {
67 15
            $message .= sprintf(" near %s", $line);
68 15
        }
69
70 15
        if (!is_null($line_num)) {
71 15
            $message .= sprintf(" at line %d", $line_num);
72 15
        }
73
74 15
        return $message;
75
    }
76
}
77