Stateless   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 60
loc 60
c 0
b 0
f 0
ccs 0
cts 18
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 16 16 3
A getBeanInterface() 4 4 1
A getBeanName() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
/**
4
 * AppserverIo\Psr\EnterpriseBeans\Annotations\Stateless
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 @Stateless annotation on a bean.
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"})
34
 */
35 View Code Duplication
class Stateless 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 constructor the initializes the instance with the
54
     * data passed with the token.
55
     *
56
     * @param array $values The annotation values
57
     */
58
    public function __construct(array $values = array())
59
    {
60
61
        // set the bean interface attribute, if available
62
        if (isset($values[AnnotationKeys::BEAN_INTERFACE])) {
63
            $this->beanInterface = $values[AnnotationKeys::BEAN_INTERFACE];
64
        }
65
66
        // set the bean interface attribute, if available
67
        if (isset($values[AnnotationKeys::BEAN_NAME])) {
68
            $this->beanName = $values[AnnotationKeys::BEAN_NAME];
69
        }
70
71
        // pass the values through to the parent constructor
72
        parent::__construct($values);
73
    }
74
75
    /**
76
     * Returns the value of the bean interface attribute.
77
     *
78
     * @return string|null The annotations bean interface attribute
79
     */
80
    public function getBeanInterface()
81
    {
82
        return $this->beanInterface;
83
    }
84
85
    /**
86
     * Returns the value of the bean name attribute.
87
     *
88
     * @return string|null The annotations bean Name attribute
89
     */
90
    public function getBeanName()
91
    {
92
        return $this->beanName;
93
    }
94
}
95