CustomTag   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 30
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A process() 0 3 1
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