Passed
Push — master ( 4f7966...46bec3 )
by Alex
04:29
created

isOK()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
c 0
b 0
f 0
rs 9.2
cc 4
eloc 10
nc 4
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\mapping\cs;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\Groups\TModificationFunctionMappingAssociationEndPropertyGroup;
7
use AlgoWeb\ODataMetadata\MetadataV3\mapping\cs\IsOKTraits\TSimpleIdentifierTrait;
8
9
/**
10
 * Class representing TModificationFunctionMappingEndPropertyType
11
 *
12
 * Type for function mapping end property
13
 *
14
 * XSD Type: TModificationFunctionMappingEndProperty
15
 */
16
class TModificationFunctionMappingEndPropertyType extends IsOK
17
{
18
    use TSimpleIdentifierTrait, TModificationFunctionMappingAssociationEndPropertyGroup;
19
    /**
20
     * @property string $name
21
     */
22
    private $name = null;
23
24
    /**
25
     * Gets as name
26
     *
27
     * @return string
28
     */
29
    public function getName()
30
    {
31
        return $this->name;
32
    }
33
34
    /**
35
     * Sets a new name
36
     *
37
     * @param string $name
38
     * @return self
39
     */
40
    public function setName($name)
41
    {
42
        $this->name = $name;
43
        return $this;
44
    }
45
46
    public function isOK(&$msg = null)
47
    {
48
        if (!$this->isStringNotNullOrEmpty($this->name)) {
49
            $msg = 'Name cannot be null or empty';
50
            return false;
51
        }
52
        if (!$this->isTSimpleIdentifierValid($this->name)) {
53
            $msg = 'Name must be a valid TSimpleIdentifier';
54
            return false;
55
        }
56
        if (!$this->isModificationFunctionMappingAssociationOK($msg)) {
57
            return false;
58
        }
59
        return true;
60
    }
61
}
62