Completed
Pull Request — master (#58)
by Tim
06:23
created

Result::__construct()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 21

Duplication

Lines 21
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 4.0466

Importance

Changes 0
Metric Value
dl 21
loc 21
ccs 6
cts 7
cp 0.8571
rs 9.584
c 0
b 0
f 0
cc 4
nc 8
nop 1
crap 4.0466
1
<?php
2
3
/**
4
 * AppserverIo\Routlt\Annotations\Result
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
use AppserverIo\Psr\EnterpriseBeans\Annotations\AbstractBeanAnnotation;
24
25
/**
26
 * Annotation to map a string to a action result.
27
 *
28
 * @author     Tim Wagner <[email protected]>
29
 * @copyright  2015 TechDivision GmbH <[email protected]>
30
 * @license    http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
31
 * @link       http://github.com/appserver-io/routlt
32
 * @link       http://www.appserver.io
33
 *
34
 * @Annotation
35
 * @Target({"CLASS", "ANNOTATION"})
36
 */
37
class Result extends AbstractBeanAnnotation
38
{
39
40
    /**
41
     * The value of the type attribute.
42
     *
43
     * @var string
44
     */
45
    protected $type;
46
47
    /**
48
     * The value of the code attribute.
49
     *
50 7
     * @var string
51
     */
52 7
    protected $code;
53
54
    /**
55
     * The value of the result attribute.
56
     *
57
     * @var string
58
     */
59
    protected $result;
60 5
61
    /**
62 5
     * The constructor the initializes the instance with the
63 4
     * data passed with the token.
64
     *
65 1
     * @param array $values The annotation values
66
     */
67 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...
68
    {
69
70
        // set the type attribute, if available
71
        if (isset($values[AnnotationKeys::TYPE])) {
72 5
            $this->type = $values[AnnotationKeys::TYPE];
73
        }
74 5
75 4
        // set the code attribute, if available
76
        if (isset($values[AnnotationKeys::CODE])) {
77 1
            $this->code = $values[AnnotationKeys::CODE];
78
        }
79
80
        // set the result attribute, if available
81
        if (isset($values[AnnotationKeys::RESULT])) {
82
            $this->result = $values[AnnotationKeys::RESULT];
83
        }
84 3
85
        // pass the arguements through to the parent instance
86 3
        parent::__construct($values);
87
    }
88
89 3
    /**
90
     * Returns the value of the type attribute.
91
     *
92
     * @return string|null The annotations type attribute
93
     */
94
    public function getType()
95
    {
96
        return $this->type;
97
    }
98
99
    /**
100
     * Returns the value of the result attribute.
101
     *
102
     * @return string|null The annotations result attribute
103
     */
104
    public function getResult()
105
    {
106
        return $this->result;
107
    }
108
109
    /**
110
     * Returns the value of the code attribute.
111
     *
112
     * @return string|null The annotations code attribute
113
     */
114
    public function getCode()
115
    {
116
        return $this->code;
117
    }
118
}
119