Passed
Push — master ( 143625...0aa694 )
by Alex
03:46
created

TValueTermReferenceExpressionType::isOK()   B

Complexity

Conditions 5
Paths 4

Size

Total Lines 16
Code Lines 10

Duplication

Lines 16
Ratio 100 %

Importance

Changes 0
Metric Value
dl 16
loc 16
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 10
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\GExpressionTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TQualifiedNameTrait;
8
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TSimpleIdentifierTrait;
9
10
/**
11
 * Class representing TValueTermReferenceExpressionType
12
 *
13
 *
14
 * XSD Type: TValueTermReferenceExpression
15
 */
16
class TValueTermReferenceExpressionType extends IsOK
17
{
18
    use GExpressionTrait, TQualifiedNameTrait, TSimpleIdentifierTrait;
19
    /**
20
     * @property string $term
21
     */
22
    private $term = null;
23
24
    /**
25
     * @property string $qualifier
26
     */
27
    private $qualifier = null;
28
29
    /**
30
     * Gets as term
31
     *
32
     * @return string
33
     */
34
    public function getTerm()
35
    {
36
        return $this->term;
37
    }
38
39
    public function __construct()
40
    {
41
        $this->gExpressionMaximum = 1;
42
        $this->gExpressionMinimum = 1;
43
    }
44
45
    /**
46
     * Sets a new term
47
     *
48
     * @param string $term
49
     * @return self
50
     */
51
    public function setTerm($term)
52
    {
53
        $this->term = $term;
54
        return $this;
55
    }
56
57
    /**
58
     * Gets as qualifier
59
     *
60
     * @return string
61
     */
62
    public function getQualifier()
63
    {
64
        return $this->qualifier;
65
    }
66
67
    /**
68
     * Sets a new qualifier
69
     *
70
     * @param string $qualifier
71
     * @return self
72
     */
73
    public function setQualifier($qualifier)
74
    {
75
        $this->qualifier = $qualifier;
76
        return $this;
77
    }
78
79 View Code Duplication
    public function isOK(&$msg = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
80
    {
81
        if (!$this->isTQualifiedNameValid($this->term)) {
82
            $msg = "Term must be a valid TQualifiedName";
83
            return false;
84
        }
85
        if (null != $this->qualifier && !$this->isTSimpleIdentifierValid($this->qualifier)) {
86
            $msg = "Qualifier must be a valid TSimpleIdentifier";
87
            return false;
88
        }
89
        if (!$this->isGExpressionValid($msg)) {
90
            return false;
91
        }
92
93
        return true;
94
    }
95
}
96