Test Failed
Push — master ( 268315...188fde )
by Christopher
10:31
created

TTypeRefType::isOK()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 14
rs 9.2
cc 4
eloc 9
nc 4
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\edm;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\MetadataV3\edm\Groups\GEmptyElementExtensibilityTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\Groups\TFacetAttributesTrait;
8
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TUnwrappedFunctionTypeTrait;
9
10
/**
11
 * Class representing TTypeRefType
12
 *
13
 * XSD Type: TTypeRef
14
 */
15
class TTypeRefType extends IsOK
0 ignored issues
show
Bug introduced by
Possible parse error: class missing opening or closing brace
Loading history...
16
{
17
    use GEmptyElementExtensibilityTrait, TFacetAttributesTrait, TUnwrappedFunctionTypeTrait {
18
        TFacetAttributesTrait::isStringNotNullOrEmpty insteadof GEmptyElementExtensibilityTrait;
19
        TFacetAttributesTrait::isStringNotNull insteadof GEmptyElementExtensibilityTrait;
20
        TFacetAttributesTrait::isNotNullInstanceOf insteadof GEmptyElementExtensibilityTrait;
21
        TFacetAttributesTrait::isNullInstanceOf insteadof GEmptyElementExtensibilityTrait;
22
        TFacetAttributesTrait::isURLValid insteadof GEmptyElementExtensibilityTrait;
23
        TFacetAttributesTrait::isObjectNullOrOK insteadof GEmptyElementExtensibilityTrait;
24
        TFacetAttributesTrait::isObjectNullOrType insteadof GEmptyElementExtensibilityTrait;
25
        TFacetAttributesTrait::isValidArrayOK insteadof GEmptyElementExtensibilityTrait;
26
        TFacetAttributesTrait::isValidArray insteadof GEmptyElementExtensibilityTrait;
27
        TFacetAttributesTrait::isChildArrayOK insteadof GEmptyElementExtensibilityTrait;
28
    }
29
    
30
    /**
31
     * @property string $type
32
     */
33
    private $type = null;
34
35
<<<<<<< HEAD
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_SL, expecting T_FUNCTION or T_CONST
Loading history...
36
        /**
37
         * Gets as type
38
         *
39
         * @return string
40
         */
41
=======
42
     /**
43
      * Gets as type
44
      *
45
      * @return string
46
      */
47
>>>>>>> Code Cleanup
48
    public function getType()
49
    {
50
        return $this->type;
51
    }
52
53
    /**
54
     * Sets a new type
55
     *
56
     * @param  string $type
57
     * @return self
58
     */
59
    public function setType($type)
60
    {
61
        if (!$this->isTUnwrappedFunctionTypeValid($type)) {
62
            $msg = "Type must be a valid TUnwrappedFunctionType";
63
            throw new \InvalidArgumentException($msg);
64
        }
65
        $this->type = $type;
66
        return $this;
67
    }
68
69
    public function isOK(&$msg = null)
70
    {
71
        if (!$this->isTUnwrappedFunctionTypeValid($this->type)) {
72
            $msg = "Type must be a valid TUnwrappedFunctionType";
73
            return false;
74
        }
75
        if (!$this->isExtensibilityElementOK($msg)) {
76
            return false;
77
        }
78
        if (!$this->isTFacetAttributesTraitValid($msg)) {
79
            return false;
80
        }
81
        return true;
82
    }
83
}
84