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

TOnActionType::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\TActionTrait;
7
8
/**
9
 * Class representing TOnActionType
10
 *
11
 *
12
 * XSD Type: TOnAction
13
 */
14 View Code Duplication
class TOnActionType 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 TActionTrait, GEmptyElementExtensibilityTrait;
17
    /**
18
     * @property string $action
19
     */
20
    private $action = null;
21
22
    /**
23
     * Gets as action
24
     *
25
     * @return string
26
     */
27
    public function getAction()
28
    {
29
        return $this->action;
30
    }
31
32
    /**
33
     * Sets a new action
34
     *
35
     * @param string $action
36
     * @return self
37
     */
38
    public function setAction($action)
39
    {
40
        $this->action = $action;
41
        return $this;
42
    }
43
44
    /**
45
     * @param null $msg
46
     * @return bool
47
     */
48
    public function isOK(&$msg = null)
49
    {
50
        if (!$this->isStringNotNullOrEmpty($this->action)) {
51
            $msg = "Action cannot be null or empty";
52
            return false;
53
        }
54
        if (!$this->isTActionValid($this->action)) {
55
            $msg = "Action must be valid TAction";
56
            return false;
57
        }
58
        if (!$this->isExtensibilityElementOK($msg)) {
59
            return false;
60
        }
61
        return true;
62
    }
63
}
64