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

SyntaxError::getAt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
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