Summery   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 9
dl 0
loc 31
ccs 10
cts 10
cp 1
rs 10
c 1
b 1
f 0
wmc 4

2 Methods

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