CustomTag::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jasny\PhpdocParser\Tag;
6
7
/**
8
 * Custom logic for a tag.
9
 */
10
class CustomTag extends AbstractTag
11
{
12
    /**
13
     * @var callable
14
     */
15
    protected $process;
16
17
    /**
18
     * Class constructor.
19
     *
20
     * @param string   $name
21
     * @param callable $process
22
     */
23 2
    public function __construct(string $name, callable $process)
24
    {
25 2
        parent::__construct($name);
26
27 2
        $this->process = $process;
28
    }
29
30
    /**
31
     * Process a notation.
32
     *
33
     * @param array  $notations
34
     * @param string $value
35
     * @return array
36
     */
37 1
    public function process(array $notations, string $value): array
38
    {
39 1
        return call_user_func($this->process, $notations, $value);
40
    }
41
}
42