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

RegexParser   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 14
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A parseParenthesis() 0 11 3
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