Summery::process()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 3
eloc 7
nc 2
nop 2
dl 0
loc 14
ccs 8
cts 8
cp 1
crap 3
rs 10
c 1
b 1
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jasny\PhpdocParser\Tag;
6
7
use Jasny\PhpdocParser\Tag\AbstractTag;
8
9
/**
10
 * General doc-block summery and description
11
 */
12
class Summery extends AbstractTag
13
{
14
    /**
15
     * Class constructor.
16
     */
17 8
    public function __construct()
18
    {
19 8
        parent::__construct('summery');
20
    }
21
22
    /**
23
     * Process a notation.
24
     *
25
     * @param array $notations
26
     * @param string $value
27
     * @return array
28
     */
29 7
    public function process(array $notations, string $value): array
30
    {
31 7
        preg_match_all('/^\s*(?:(?:\/\*)?\*\s*)?([^@\s\/*].*?)\r?$/m', $value, $matches, PREG_PATTERN_ORDER);
32
33 7
        if (!isset($matches[1]) || $matches[1] === []) {
34 2
            return $notations;
35
        }
36
37 5
        $matches = $matches[1];
38
39 5
        $notations['summery'] = reset($matches);
40 5
        $notations['description'] = implode("\n", $matches);
41
42 5
        return $notations;
43
    }
44
}
45