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

EDMSimpleTypeTrait::isEDMSimpleTypeValid()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 3
nop 1
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