Passed
Push — master ( feaee9...2b3e4e )
by Alex
04:28
created

TTypeAttributesTrait::isTTypeAttributesValid()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 8
nc 3
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\edm\Groups;
4
5
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TSimpleIdentifierTrait;
6
7
trait TTypeAttributesTrait
8
{
9
    use TSimpleIdentifierTrait;
10
    /**
11
     * @property string $name
12
     */
13
    private $name = null;
14
15
    /**
16
     * Gets as name
17
     *
18
     * @return string
19
     */
20
    public function getName()
21
    {
22
        return $this->name;
23
    }
24
25
    /**
26
     * Sets a new name
27
     *
28
     * @param string $name
29
     * @return self
30
     */
31
    public function setName($name)
32
    {
33
        $this->name = $name;
34
        return $this;
35
    }
36
37
    public function isTTypeAttributesValid(&$msg = null)
38
    {
39
        if (null == $this->name) {
40
            $msg = "Name cannot be null";
41
            return false;
42
        }
43
        if (!$this->isTSimpleIdentifierValid($this->name)) {
44
            $msg = "Name must be a valid TSimpleIdentifier";
45
            return false;
46
        }
47
        
48
        return true;
49
    }
50
}
51