Passed
Pull Request — master (#33)
by Christopher
08:39 queued 04:23
created

TWrappedFunctionTypeTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A isTWrappedFunctionTypeValid() 0 12 3
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits;
4
5
use AlgoWeb\ODataMetadata\xsdRestrictions;
6
7
trait TWrappedFunctionTypeTrait
8
{
9
    use TQualifiedNameTrait, xsdRestrictions;
10
11
    public function isTWrappedFunctionTypeValid($string)
12
    {
13
        $regex = '(Collection|Ref)\([^ \t]{1,}(\.[^ \t]{1,}){0,}\)';
14
15
        if (!is_string($string)) {
16
            throw new \InvalidArgumentException("Input must be a string");
17
        }
18
        if ($this->isTQualifiedNameValid($string)) {
19
            return true;
20
        }
21
        return $this->matchesRegexPattern($regex, $string);
22
    }
23
}
24