Passed
Push — master ( 8dd668...9643d3 )
by Alex
04:27
created

EDMSimpleTypeTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A isEDMSimpleTypeValid() 0 10 3
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits;
4
5
trait EDMSimpleTypeTrait
6
{
7
    //EDM SimpleType instances for use by EDM Instance documents
8
9
    private $validType = ["Binary", "Boolean", "Byte", "DateTime", "DateTimeOffset", "Time", "Decimal", "Double",
10
        "Single", "Geography", "Point", "LineString", "Polygon", "MultiPoint", "MultiLineString", "MultiPolygon",
11
        "GeographyCollection", "Geometry", "GeometricPoint", "GeometricLineString", "GeometricPolygon",
12
        "GeometricMultiPoint", "GeometricMultiLineString", "GeometricMultiPolygon", "GeometryCollection",
13
        "Guid", "Int16", "Int32", "Int64", "String", "SByte"];
14
15
    public function isEDMSimpleTypeValid($string)
16
    {
17
        if (!is_string($string)) {
18
            throw new \InvalidArgumentException("Input must be a string");
19
        }
20
        if (!in_array($string, $this->validType)) {
21
            return false;
22
        }
23
        return true;
24
    }
25
}
26