Completed
Push — master ( c82f1b...c3956a )
by Tim
12s
created

Action::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * AppserverIo\Routlt\Annotations\Action
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author     Tim Wagner <[email protected]>
15
 * @copyright  2015 TechDivision GmbH <[email protected]>
16
 * @license    http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link       http://github.com/appserver-io/routlt
18
 * @link       http://www.appserver.io
19
 */
20
21
namespace AppserverIo\Routlt\Annotations;
22
23
/**
24
 * Annotation to map a request path info to an action method.
25
 *
26
 * @author     Tim Wagner <[email protected]>
27
 * @copyright  2015 TechDivision GmbH <[email protected]>
28
 * @license    http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
29
 * @link       http://github.com/appserver-io/routlt
30
 * @link       http://www.appserver.io
31
 *
32
 * @Annotation
33
 * @Target({"METHOD"})
34
 */
35
class Action
36
{
37
38
    /**
39
     * The value of the name attribute.
40
     *
41
     * @var string
42
     */
43
    protected $name;
44
45
    /**
46
     * The value of the restrictions attribute.
47
     *
48
     * @var string
49
     */
50
    protected $restrictions;
51
52
    /**
53
     * The value of the defaults attribute.
54
     *
55
     * @var string
56
     */
57
    protected $defaults;
58
59
    /**
60
     * The constructor the initializes the instance with the
61
     * data passed with the token.
62
     *
63
     * @param array $values The annotation values
64
     */
65 9 View Code Duplication
    public function __construct(array $values = array())
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...
66
    {
67
68
        // set the name attribute, if available
69 9
        if (isset($values[AnnotationKeys::NAME])) {
70 8
            $this->name = $values[AnnotationKeys::NAME];
71 8
        }
72
73
        // set the restrictions attribute, if available
74 9
        if (isset($values[AnnotationKeys::RESTRICTIONS])) {
75
            $this->restrictions = $values[AnnotationKeys::RESTRICTIONS];
76
        }
77
78
        // set the defaults attribute, if available
79 9
        if (isset($values[AnnotationKeys::DEFAULTS])) {
80
            $this->defaults = $values[AnnotationKeys::DEFAULTS];
81
        }
82 9
    }
83
84
    /**
85
     * Returns the value of the name attribute.
86
     *
87
     * @return string|null The annotations name attribute
88
     */
89 9
    public function getName()
90
    {
91 9
        return $this->name;
92
    }
93
94
    /**
95
     * Returns the value of the restrictions attribute.
96
     *
97
     * @return string|null The annotations restrictions attribute
98
     */
99 8
    public function getRestrictions()
100
    {
101 8
        return $this->restrictions;
102
    }
103
104
    /**
105
     * Returns the value of the defaults attribute.
106
     *
107
     * @return string|null The annotations defaults attribute
108
     */
109 8
    public function getDefaults()
110
    {
111 8
        return $this->defaults;
112
    }
113
}
114