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

ParserException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A line() 0 3 1
A column() 0 3 1
A setPosition() 0 9 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