EnterpriseBean::getBeanInterface()   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\EnterpriseBean
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 @EnterpriseBean annotation on a property.
25
 *
26
 * The name attribute refers to what the naming context name will be for the referenced enterprise bean.
27
 *
28
 * The beanInterface attribute is the interface you are interested in and usually is used by the container
29
 * to distinguish whether you want a remote or local reference to the enterprise bean.
30
 *
31
 * The beanName is the name of the enterprise bean referenced. It is equal to either the value you specify
32
 * in the @Stateless->name() or @Stateful->name() annotation.
33
 * 
34
 * The lookup attribute, defines the naming context name that should be used to find the target enterprise
35
 * bean reference. When placed on the bean class, the @EnterpriseBean annotation will register a reference into
36
 * the naming context.
37
 *
38
 * @author    Tim Wagner <[email protected]>
39
 * @copyright 2015 TechDivision GmbH <[email protected]>
40
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
41
 * @link      https://github.com/appserver-io-psr/epb
42
 * @link      http://www.appserver.io
43
 *
44
 * @Annotation
45
 * @Target({"METHOD","PROPERTY"})
46
 */
47 View Code Duplication
class EnterpriseBean 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...
48
{
49
50
    /**
51
     * The value of the bean interface attribute.
52
     *
53
     * @var string
54
     */
55
    protected $beanInterface;
56
57
    /**
58
     *  The value of the bean name attribute.
59
     *
60
     * @var string
61
     */
62
    protected $beanName;
63
64
    /**
65
     * The constructor the initializes the instance with the
66
     * data passed with the token.
67
     *
68
     * @param array $values The annotation values
69
     */
70
    public function __construct(array $values = array())
71
    {
72
73
        // set the bean interface attribute, if available
74
        if (isset($values[AnnotationKeys::BEAN_INTERFACE])) {
75
            $this->beanInterface = $values[AnnotationKeys::BEAN_INTERFACE];
76
        }
77
78
        // set the bean interface attribute, if available
79
        if (isset($values[AnnotationKeys::BEAN_NAME])) {
80
            $this->beanName = $values[AnnotationKeys::BEAN_NAME];
81
        }
82
83
        // pass the values through to the parent constructor
84
        parent::__construct($values);
85
    }
86
87
    /**
88
     * Returns the value of the bean interface attribute.
89
     *
90
     * @return string|null The annotations bean interface attribute
91
     */
92
    public function getBeanInterface()
93
    {
94
        return $this->beanInterface;
95
    }
96
97
    /**
98
     * Returns the value of the bean name attribute.
99
     *
100
     * @return string|null The annotations bean Name attribute
101
     */
102
    public function getBeanName()
103
    {
104
        return $this->beanName;
105
    }
106
}
107