Passed
Push — master ( 46bec3...dbfdbf )
by Alex
04:19
created

TPropertyRefType::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;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TSimpleIdentifierTrait;
7
8
/**
9
 * Class representing TPropertyRefType
10
 *
11
 *
12
 * XSD Type: TPropertyRef
13
 */
14 View Code Duplication
class TPropertyRefType extends IsOK
0 ignored issues
show
Duplication introduced by
This class 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...
15
{
16
    use TSimpleIdentifierTrait, GEmptyElementExtensibilityTrait;
17
    /**
18
     * @property string $name
19
     */
20
    private $name = null;
21
22
    /**
23
     * Gets as name
24
     *
25
     * @return string
26
     */
27
    public function getName()
28
    {
29
        return $this->name;
30
    }
31
32
    /**
33
     * Sets a new name
34
     *
35
     * @param string $name
36
     * @return self
37
     */
38
    public function setName($name)
39
    {
40
        $this->name = $name;
41
        return $this;
42
    }
43
44
    public function isOK(&$msg = null)
45
    {
46
        if (!$this->isStringNotNullOrEmpty($this->name)) {
47
            $msg = "Name cannot be null or empty";
48
            return false;
49
        }
50
        if (!$this->isTSimpleIdentifierValid($this->name)) {
51
            $msg = "Name must be valid TSimpleIdentifier";
52
            return false;
53
        }
54
        if (!$this->isExtensibilityElementOK($msg)) {
55
            return false;
56
        }
57
        return true;
58
    }
59
}
60