BaseParser   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 52
ccs 10
cts 10
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A getQueryInfos() 0 3 1
A getTriples() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of the sweetrdf/InMemoryStoreSqlite package and licensed under
5
 * the terms of the GPL-2 license.
6
 *
7
 * (c) Konrad Abicht <[email protected]>
8
 * (c) Benjamin Nowack
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace sweetrdf\InMemoryStoreSqlite\Parser;
15
16
use sweetrdf\InMemoryStoreSqlite\Log\Logger;
17
use sweetrdf\InMemoryStoreSqlite\NamespaceHelper;
18
use sweetrdf\InMemoryStoreSqlite\StringReader;
19
20
abstract class BaseParser
21
{
22
    /**
23
     * @var array
24
     */
25
    protected $added_triples;
26
27
    protected string $base;
28
29
    protected string $bnode_prefix;
30
31
    protected string $bnode_id;
32
33
    protected array $blocks;
34
35
    protected Logger $logger;
36
37
    protected NamespaceHelper $namespaceHelper;
38
39
    /**
40
     * Query infos container.
41
     */
42
    protected array $r = [];
43
44
    protected StringReader $reader;
45
46
    protected array $triples = [];
47
48
    protected int $t_count = 0;
49
50 100
    public function __construct(Logger $logger, NamespaceHelper $namespaceHelper, StringReader $stringReader)
51
    {
52 100
        $this->reader = $stringReader;
53
54 100
        $this->logger = $logger;
55
56 100
        $this->namespaceHelper = $namespaceHelper;
57
58
        // generates random prefix for blank nodes
59 100
        $this->bnode_prefix = bin2hex(random_bytes(4)).'b';
60
61 100
        $this->bnode_id = 0;
62
    }
63
64 98
    public function getQueryInfos()
65
    {
66 98
        return $this->r;
67
    }
68
69 2
    public function getTriples()
70
    {
71 2
        return $this->triples;
72
    }
73
}
74