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

TEntitySetAttributesTrait::setEntityType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\edm\Groups;
4
5
use AlgoWeb\ODataMetadata\CodeGeneration\AccessTypeTraits;
6
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TQualifiedNameTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits\TSimpleIdentifierTrait;
8
9
trait TEntitySetAttributesTrait
10
{
11
    use TSimpleIdentifierTrait, TQualifiedNameTrait, AccessTypeTraits;
12
    /**
13
     * @property string $name
14
     */
15
    private $name = null;
16
17
    /**
18
     * @property string $entityType
19
     */
20
    private $entityType = null;
21
22
    /**
23
     * @property string $getterAccess
24
     */
25
    private $getterAccess = null;
26
27
    /**
28
     * Gets as name
29
     *
30
     * @return string
31
     */
32
    public function getName()
33
    {
34
        return $this->name;
35
    }
36
37
    /**
38
     * Sets a new name
39
     *
40
     * @param string $name
41
     * @return self
42
     */
43
    public function setName($name)
44
    {
45
        $this->name = $name;
46
        return $this;
47
    }
48
49
    /**
50
     * Gets as entityType
51
     *
52
     * @return string
53
     */
54
    public function getEntityType()
55
    {
56
        return $this->entityType;
57
    }
58
59
    /**
60
     * Sets a new entityType
61
     *
62
     * @param string $entityType
63
     * @return self
64
     */
65
    public function setEntityType($entityType)
66
    {
67
        $this->entityType = $entityType;
68
        return $this;
69
    }
70
71
    /**
72
     * Gets as getterAccess
73
     *
74
     * @return string
75
     */
76
    public function getGetterAccess()
77
    {
78
        return $this->getterAccess;
79
    }
80
81
    /**
82
     * Sets a new getterAccess
83
     *
84
     * @param string $getterAccess
85
     * @return self
86
     */
87
    public function setGetterAccess($getterAccess)
88
    {
89
        $this->getterAccess = $getterAccess;
90
        return $this;
91
    }
92
    
93
    
94
    public function isTEntitySetAttributesOK(&$msg = null)
95
    {
96 View Code Duplication
        if (null != $this->name && !$this->isTSimpleIdentifierValid($this->name)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
97
            $msg = "Name must be a valid TSimpleIdentifier";
98
            return false;
99
        }
100
        if (null != $this->entityType && !$this->isTQualifiedNameValid($this->entityType)) {
101
            $msg = "Entity type must be a valid TQualifiedName";
102
            return false;
103
        }
104 View Code Duplication
        if (null != $this->getterAccess && !$this->isTAccessOk($this->getterAccess)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
105
            $msg = "Getter access must be a valid TAccess";
106
            return false;
107
        }
108
109
        return true;
110
    }
111
}
112