Completed
Push — master ( b7fbe3...8fe22f )
by Peter
02:11
created

ArrayBracketsMatcher::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 9
cts 9
cp 1
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * This software package is licensed under AGPL, Commercial license.
5
 *
6
 * @package maslosoft/addendum
7
 * @licence AGPL, Commercial
8
 * @copyright Copyright (c) Piotr Masełkowski <[email protected]> (Meta container, further improvements, bugfixes)
9
 * @copyright Copyright (c) Maslosoft (Meta container, further improvements, bugfixes)
10
 * @copyright Copyright (c) Jan Suchal (Original version, builder, parser)
11
 * @link http://maslosoft.com/addendum/ - maslosoft addendum
12
 * @link https://code.google.com/p/addendum/ - original addendum project
13
 */
14
15
namespace Maslosoft\Addendum\Matcher;
16
17
class ArrayBracketsMatcher extends ParallelMatcher implements \Maslosoft\Addendum\Interfaces\Matcher\MatcherInterface
18
{
19
20 40
	protected function build()
21
	{
22 40
		$this->add((new ConstantMatcher('\[\]', []))->setPlugins($this->getPlugins()));
23 40
		$valuesMatcher = new SimpleSerialMatcher(1);
24 40
		$valuesMatcher->setPlugins($this->getPlugins());
25 40
		$valuesMatcher->add((new RegexMatcher('\s*\[\s*'))->setPlugins($this->getPlugins()));
26 40
		$valuesMatcher->add((new ArrayValuesMatcher)->setPlugins($this->getPlugins()));
27 40
		$valuesMatcher->add((new RegexMatcher('\s*\]\s*'))->setPlugins($this->getPlugins()));
28 40
		$this->add($valuesMatcher);
29 40
	}
30
31
}
32