Passed
Push — master ( 1f7f34...948e88 )
by Thomas
04:12 queued 02:03
created

RegexParser::parseParenthesis()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 10
cp 0
rs 9.9
c 0
b 0
f 0
cc 3
nc 2
nop 1
crap 12
1
<?php
2
3
namespace Webfactor\Laravel\Generators\Helper;
4
5
class RegexParser
6
{
7
    public static function parseParenthesis(string $string): array
8
    {
9
        if (str_contains($string, '(') && str_contains($string, ')')) {
10
            preg_match('/(.*)(\((.*)\))/', $string, $match);
11
        }
12
13
        return [
14
            'left' => $match[1] ?? $string,
15
            'inside' => $match[3] ?? '',
16
        ];
17
    }
18
}
19