Resource::getType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 4
loc 4
c 0
b 0
f 0
ccs 0
cts 4
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * AppserverIo\Psr\EnterpriseBeans\Annotations\Resource
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      https://github.com/appserver-io-psr/epb
18
 * @link      http://www.appserver.io
19
 */
20
21
namespace AppserverIo\Psr\EnterpriseBeans\Annotations;
22
23
/**
24
 * Annotation implementation representing a @Resource annotation on a property.
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      https://github.com/appserver-io-psr/epb
30
 * @link      http://www.appserver.io
31
 *
32
 * @Annotation
33
 * @Target({"CLASS", "METHOD","PROPERTY"})
34
 */
35 View Code Duplication
class Resource extends AbstractBeanAnnotation
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...
36
{
37
38
    /**
39
     * The value of the bean interface attribute.
40
     *
41
     * @var string
42
     */
43
    protected $beanInterface;
44
45
    /**
46
     *  The value of the bean name attribute.
47
     *
48
     * @var string
49
     */
50
    protected $beanName;
51
52
    /**
53
     * The value of the type attribute.
54
     *
55
     * @var string
56
     */
57
    protected $type;
58
59
    /**
60
     * The value of the lookup attribute.
61
     *
62
     * @var string
63
     */
64
    protected $lookup;
65
66
    /**
67
     * The constructor the initializes the instance with the
68
     * data passed with the token.
69
     *
70
     * @param array $values The annotation values
71
     */
72
    public function __construct(array $values = array())
73
    {
74
75
        // set the bean interface attribute, if available
76
        if (isset($values[AnnotationKeys::BEAN_INTERFACE])) {
77
            $this->beanInterface = $values[AnnotationKeys::BEAN_INTERFACE];
78
        }
79
80
        // set the bean interface attribute, if available
81
        if (isset($values[AnnotationKeys::BEAN_NAME])) {
82
            $this->beanName = $values[AnnotationKeys::BEAN_NAME];
83
        }
84
85
        // set the type attribute, if available
86
        if (isset($values[AnnotationKeys::TYPE])) {
87
            $this->type = $values[AnnotationKeys::TYPE];
88
        }
89
90
        // set the lookup attribute, if available
91
        if (isset($values[AnnotationKeys::LOOKUP])) {
92
            $this->lookup = $values[AnnotationKeys::LOOKUP];
93
        }
94
95
        // pass the values through to the parent constructor
96
        parent::__construct($values);
97
    }
98
99
    /**
100
     * Returns the value of the bean interface attribute.
101
     *
102
     * @return string|null The annotations bean interface attribute
103
     */
104
    public function getBeanInterface()
105
    {
106
        return $this->beanInterface;
107
    }
108
109
    /**
110
     * Returns the value of the bean name attribute.
111
     *
112
     * @return string|null The annotations bean Name attribute
113
     */
114
    public function getBeanName()
115
    {
116
        return $this->beanName;
117
    }
118
119
    /**
120
     * Returns the value of the type attribute.
121
     *
122
     * @return string The annotations type attribute
123
     */
124
    public function getType()
125
    {
126
        return $this->type;
127
    }
128
129
    /**
130
     * Returns the value of the lookup name attribute.
131
     *
132
     * @return string|null The annotations lookup name attribute
133
     */
134
    public function getLookup()
135
    {
136
        return $this->lookup;
137
    }
138
}
139