Completed
Branch phpdbg (d0bf38)
by Josh
02:52
created

ParserBase::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
crap 1
1
<?php
2
3
/**
4
* @package   s9e\TextFormatter
5
* @copyright Copyright (c) 2010-2018 The s9e Authors
6
* @license   http://www.opensource.org/licenses/mit-license.php The MIT License
7
*/
8
namespace s9e\TextFormatter\Plugins;
9
10
use s9e\TextFormatter\Parser;
11
12
abstract class ParserBase
13
{
14
	/**
15
	* @var array
16
	*/
17
	protected $config;
18
19
	/**
20
	* @var Parser
21
	*/
22
	protected $parser;
23
24
	/**
25
	* Constructor
26
	*
27
	* @param Parser $parser
28
	* @param array  $config
29
	*/
30 3
	final public function __construct(Parser $parser, array $config)
31
	{
32 3
		$this->parser = $parser;
33 3
		$this->config = $config;
34
35 3
		$this->setUp();
36
	}
37
38
	/**
39
	* Plugin's setup
40
	*
41
	* @return void
42
	*/
43
	protected function setUp()
44
	{
45
	}
46
47
	/**
48
	* @param  string $text
49
	* @param  array  $matches If the config array has a "regexp" key, the corresponding matches are
50
	*                         passed as second parameter. Otherwise, an empty array is passed
51
	* @return void
52
	*/
53
	abstract public function parse($text, array $matches);
54
}