Completed
Push — master ( 7d20ae...438ac0 )
by Michal
16:52 queued 13:26
created

Core   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 39
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A error() 0 7 2
1
<?php
2
3
/**
4
 * Defines the core helper infrastructure of the library.
5
 */
6
7
namespace PhpMyAdmin\SqlParser;
8
9
class Core
10
{
11
    /**
12
     * Whether errors should throw exceptions or just be stored.
13
     *
14
     * @var bool
15
     *
16
     * @see static::$errors
17
     */
18
    public $strict = false;
19
20
    /**
21
     * List of errors that occurred during lexing.
22
     *
23
     * Usually, the lexing does not stop once an error occurred because that
24
     * error might be false positive or a partial result (even a bad one)
25
     * might be needed.
26
     *
27
     * @var Exception[]
28
     *
29
     * @see Core::error()
30
     */
31
    public $errors = array();
32
33
    /**
34
     * Creates a new error log.
35
     *
36
     * @param Exception $error the error exception
37
     *
38
     * @throws Exception throws the exception, if strict mode is enabled
39
     */
40 85
    public function error($error)
41
    {
42 85
        if ($this->strict) {
43 2
            throw $error;
44
        }
45 83
        $this->errors[] = $error;
46 83
    }
47
}
48