Completed
Push — master ( 305309...6586da )
by Tim
11s
created

AbstractBeanAnnotation   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 1
dl 0
loc 68
ccs 0
cts 29
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A getName() 0 6 2
A getDescription() 0 6 2
A getLookup() 0 6 2
A getShared() 0 6 2
1
<?php
2
3
/**
4
 * AppserverIo\Psr\EnterpriseBeans\Annotations\AbstractBeanAnnotation
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
use AppserverIo\Lang\Reflection\ReflectionAnnotation;
24
25
/**
26
 * Abstract bean annotation implementation.
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      https://github.com/appserver-io-psr/epb
32
 * @link      http://www.appserver.io
33
 */
34
abstract class AbstractBeanAnnotation extends ReflectionAnnotation
35
{
36
37
    /**
38
     * The constructor the initializes the instance with the
39
     * data passed with the token.
40
     *
41
     * @param string $annotationName The annotation name
42
     * @param array  $values         The annotation values
43
     */
44
    public function __construct($annotationName, array $values = array())
45
    {
46
47
        // pre-initialize the shared flag if NOT found in the passed values
48
        isset($values[AnnotationKeys::SHARED]) ? null : $values[AnnotationKeys::SHARED] = true;
49
50
        // pass the paremeters to the parent instance
51
        parent::__construct($annotationName, $values);
52
    }
53
54
    /**
55
     * Returns the value of the name attribute.
56
     *
57
     * @return string|null The annotations name attribute
58
     */
59
    public function getName()
60
    {
61
        if (isset($this->values[AnnotationKeys::NAME])) {
62
            return $this->values[AnnotationKeys::NAME];
63
        }
64
    }
65
66
    /**
67
     * Returns the value of the description attribute.
68
     *
69
     * @return string|null The annotations description attribute
70
     */
71
    public function getDescription()
72
    {
73
        if (isset($this->values[AnnotationKeys::DESCRIPTION])) {
74
            return $this->values[AnnotationKeys::DESCRIPTION];
75
        }
76
    }
77
78
    /**
79
     * Returns the value of the lookup attribute.
80
     *
81
     * @return string|null The annotations lookup attribute
82
     */
83
    public function getLookup()
84
    {
85
        if (isset($this->values[AnnotationKeys::LOOKUP])) {
86
            return $this->values[AnnotationKeys::LOOKUP];
87
        }
88
    }
89
90
    /**
91
     * Returns the value of the shared attribute.
92
     *
93
     * @return boolean The annotations shared attribute
94
     */
95
    public function getShared()
96
    {
97
        if (isset($this->values[AnnotationKeys::SHARED])) {
98
            return $this->values[AnnotationKeys::SHARED];
99
        }
100
    }
101
}
102