ArrayTag   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 14
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A splitValue() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jasny\PhpdocParser\Tag;
6
7
/**
8
 * Tag value represents an array
9
 */
10
class ArrayTag extends AbstractArrayTag
11
{
12
    /**
13
     * Split value into items.
14
     *
15
     * @param string $value
16
     * @return array
17
     */
18 11
    protected function splitValue(string $value): array
19
    {
20 11
        $regexp = '/(?<=^|,)\s*(?:\'(?:[^\']++|\\\\.)*\'|(?:"(?:[^"]++|\\\\.)*"|[^,\'"]+|[\'"])+)/';
21 11
        preg_match_all($regexp, $value, $matches, PREG_PATTERN_ORDER); // regex can't fail
22
23 11
        return $matches[0];
24
    }
25
}
26