-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathParserBase.php
54 lines (46 loc) · 952 Bytes
/
ParserBase.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @package s9e\TextFormatter
* @copyright Copyright (c) The s9e authors
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
namespace s9e\TextFormatter\Plugins;
use s9e\TextFormatter\Parser;
abstract class ParserBase
{
/**
* @var array
*/
protected $config;
/**
* @var Parser
*/
protected $parser;
/**
* Constructor
*
* @param Parser $parser
* @param array $config
*/
final public function __construct(Parser $parser, array $config)
{
$this->parser = $parser;
$this->config = $config;
$this->setUp();
}
/**
* Plugin's setup
*
* @return void
*/
protected function setUp()
{
}
/**
* @param string $text
* @param array $matches If the config array has a "regexp" key, the corresponding matches are
* passed as second parameter. Otherwise, an empty array is passed
* @return void
*/
abstract public function parse($text, array $matches);
}