Completed
Push — master ( 00392a...f7852e )
by Richard
06:17
created

ParserException::setPosition()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
ccs 9
cts 9
cp 1
rs 9.6666
cc 1
eloc 8
nc 1
nop 2
crap 1
1
<?php
2
/******************************************************************************
3
 * An implementation of dicto (scg.unibe.ch/dicto) in and for PHP.
4
 *
5
 * Copyright (c) 2016 Richard Klees <[email protected]>
6
 *
7
 * This software is licensed under The MIT License. You should have received
8
 * a copy of the license along with the code.
9
 */
10
11
namespace Lechimp\Dicto\Definition;
12
13
/**
14
 * Exceptions created during parsing.
15
 */
16
class ParserException extends \Exception {
17
    /**
18
     * @var int|null
19
     */
20
    protected $s_line = null;
21
22
    /**
23
     * @var int|null
24
     */
25
    protected $s_column = null;
26
27
    /**
28
     * @return  int|null
29
     */
30 1
    public function line() {
31 1
        return $this->s_line;
32
    }
33
34
    /**
35
     * @return  int|null
36
     */
37 1
    public function column() {
38 1
        return $this->s_column;
39
    }
40
41
    /**
42
     * @param   int     $line
43
     * @param   int     $column
44
     * @return  null
45
     */
46 1
    public function setPosition($line, $column) {
47 1
        assert('is_null($this->s_line)');
48 1
        assert('is_null($this->s_column)');
49 1
        assert('is_int($line)');
50 1
        assert('is_int($column)');
51 1
        $this->s_line = $line;
52 1
        $this->s_column = $column;
53 1
        $this->message = "At line $line, column $column: $this->message";
54 1
    }
55
}
56
57