Completed
Pull Request — master (#69)
by Alex
04:33
created

EndAnonymousType::setDocumentation()   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\ssdl\EntityContainer\AssociationSetAnonymousType;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\Groups\GEmptyElementExtensibilityTrait;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TSimpleIdentifierTrait;
8
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType;
9
10
/**
11
 * Class representing EndAnonymousType
12
 */
13
class EndAnonymousType extends IsOK
14
{
15
    /**
16
     * 1. The number of Ends has to match with ones defined in AssociationType
17
     * 2. Value for attribute Name should match the defined ones and EntitySet should be of the
18
     * defined Entity Type in AssociationType
19
     */
20
21
    use GEmptyElementExtensibilityTrait, TSimpleIdentifierTrait;
22
23
    /**
24
     * @property string $role
25
     */
26
    private $role = null;
27
28
    /**
29
     * @property string $entitySet
30
     */
31
    private $entitySet = null;
32
33
    /**
34
     * Gets as role
35
     *
36
     * @return string
37
     */
38
    public function getRole()
39
    {
40
        return $this->role;
41
    }
42
43
    /**
44
     * Sets a new role
45
     *
46
     * @param string $role
47
     * @return self
48
     */
49
    public function setRole($role)
50
    {
51
        $this->role = $role;
52
        return $this;
53
    }
54
55
    /**
56
     * Gets as entitySet
57
     *
58
     * @return string
59
     */
60
    public function getEntitySet()
61
    {
62
        return $this->entitySet;
63
    }
64
65
    /**
66
     * Sets a new entitySet
67
     *
68
     * @param string $entitySet
69
     * @return self
70
     */
71
    public function setEntitySet($entitySet)
72
    {
73
        $this->entitySet = $entitySet;
74
        return $this;
75
    }
76
77 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...
78
    {
79
        if (null != $this->role && !$this->isTSimpleIdentifierValid($this->role)) {
80
            $msg = "Role must be a valid TSimpleIdentifier";
81
            return false;
82
        }
83
        if (!$this->isTSimpleIdentifierValid($this->entitySet)) {
84
            $msg = "Entity set must be a valid TSimpleIdentifier";
85
            return false;
86
        }
87
        if (!$this->isExtensibilityElementOK($msg)) {
88
            return false;
89
        }
90
91
        return true;
92
    }
93
}
94