MorePairsMatcher::match()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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 https://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
use Maslosoft\Addendum\Interfaces\Matcher\MatcherInterface;
18
19
class MorePairsMatcher extends SerialMatcher implements MatcherInterface
20
{
21
22 50
	protected function build()
23
	{
24 50
		$this->add((new PairMatcher)->setPlugins($this->getPlugins()));
25 50
		$this->add((new RegexMatcher('\s*,\s*'))->setPlugins($this->getPlugins()));
26 50
		$this->add((new HashMatcher)->setPlugins($this->getPlugins()));
27 50
	}
28
29 50
	protected function match($string, &$value)
30
	{
31 50
		$result = parent::match($string, $value);
32 50
		return $result;
33
	}
34
35 4
	public function process($parts)
36
	{
37 4
		return array_merge($parts[0], $parts[2]);
38
	}
39
40
}
41