Completed
Push — di ( 9c3a29...3d214f )
by Tim
03:30
created

EnterpriseBean::getLookup()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 6
loc 6
ccs 0
cts 6
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 0
crap 6
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
class EnterpriseBean extends AbstractBeanAnnotation
45
{
46
47
    /**
48
     * The annotation for method, a bean has to be injected.
49
     *
50
     * @var string
51
     */
52
    const ANNOTATION = 'EnterpriseBean';
53
54
    /**
55
     * This method returns the class name as
56
     * a string.
57
     *
58
     * @return string
59
     */
60
    public static function __getClass()
61
    {
62
        return __CLASS__;
63
    }
64
65
    /**
66
     * Returns the value of the bean interface attribute.
67
     *
68
     * @return string|null The annotations bean interface attribute
69
     */
70
    public function getBeanInterface()
71
    {
72
        if (isset($this->values[AnnotationKeys::BEAN_INTERFACE])) {
73
            return $this->values[AnnotationKeys::BEAN_INTERFACE];
74
        }
75
    }
76
77
    /**
78
     * Returns the value of the bean name attribute.
79
     *
80
     * @return string|null The annotations bean Name attribute
81
     */
82
    public function getBeanName()
83
    {
84
        if (isset($this->values[AnnotationKeys::BEAN_NAME])) {
85
            return $this->values[AnnotationKeys::BEAN_NAME];
86
        }
87
    }
88
}
89