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

isTWrappedFunctionTypeValid()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 3
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits;
4
5
use AlgoWeb\ODataMetadata\xsdRestrictions;
6
7
trait TUnwrappedFunctionTypeTrait
8
{
9
    use TQualifiedNameTrait, xsdRestrictions;
10
11
    public function isTWrappedFunctionTypeValid($string)
12
    {
13
        $regex = '[^ \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