Completed
Push — master ( 1751fd...4bd364 )
by Colin
01:13
created

SyntaxError   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 42
ccs 10
cts 10
cp 1
rs 10
c 1
b 0
f 0
wmc 3
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getLineNumber() 0 4 1
A getColumn() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the colinodell/json5 package.
5
 *
6
 * (c) Colin O'Dell <[email protected]>
7
 *
8
 * Based on the official JSON5 implementation for JavaScript (https://github.com/json5/json5)
9
 *  - (c) 2012-2016 Aseem Kishore and others (https://github.com/json5/json5/contributors)
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
namespace ColinODell\Json5;
16
17
final class SyntaxError extends \RuntimeException
18
{
19
    /** @var int */
20
    private $lineNumber;
21
22
    /** @var int */
23
    private $column;
24
25
    /**
26
     * SyntaxError constructor.
27
     *
28
     * @param string          $message
29
     * @param int             $linenumber
30
     * @param int             $columnNumber
31
     * @param \Throwable|null $previous
32
     */
33 96
    public function __construct($message, $linenumber, $columnNumber, $previous = null)
34
    {
35 96
        $message = sprintf('%s at line %d column %d of the JSON5 data', $message, $linenumber, $columnNumber);
36
37 96
        parent::__construct($message, 0, $previous);
38
39 96
        $this->lineNumber = $linenumber;
40 96
        $this->column = $columnNumber;
41 96
    }
42
43
    /**
44
     * @return int
45
     */
46 21
    public function getLineNumber()
47
    {
48 21
        return $this->lineNumber;
49
    }
50
51
    /**
52
     * @return int
53
     */
54 21
    public function getColumn()
55
    {
56 21
        return $this->column;
57
    }
58
}
59