PersistenceUnit   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 38
c 0
b 0
f 0
ccs 0
cts 11
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
A getUnitName() 0 4 1
1
<?php
2
3
/**
4
 * AppserverIo\Psr\EnterpriseBeans\Annotations\PersistenceUnit
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 @PersistenceUnit 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
class PersistenceUnit extends AbstractBeanAnnotation
36
{
37
38
    /**
39
     * The value of the unitName attribute.
40
     *
41
     * @var string
42
     */
43
    protected $unitName;
44
45
    /**
46
     * The constructor the initializes the instance with the
47
     * data passed with the token.
48
     *
49
     * @param array $values The annotation values
50
     */
51
    public function __construct(array $values = array())
52
    {
53
54
        // set the unit name attribute, if available
55
        if (isset($values[AnnotationKeys::UNIT_NAME])) {
56
            $this->unitName = $values[AnnotationKeys::UNIT_NAME];
57
        }
58
59
        // pass the values through to the parent constructor
60
        parent::__construct($values);
61
    }
62
63
    /**
64
     * Returns the value of the unitName attribute.
65
     *
66
     * @return string|null The annotations unitName attribute
67
     */
68
    public function getUnitName()
69
    {
70
        return $this->unitName;
71
    }
72
}
73