|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* AppserverIo\Routlt\Annotations\Result |
|
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 http://github.com/appserver-io/routlt |
|
18
|
|
|
* @link http://www.appserver.io |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace AppserverIo\Routlt\Annotations; |
|
22
|
|
|
|
|
23
|
|
|
use AppserverIo\Psr\EnterpriseBeans\Annotations\AbstractBeanAnnotation; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Annotation to map a string to a action result. |
|
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 http://github.com/appserver-io/routlt |
|
32
|
|
|
* @link http://www.appserver.io |
|
33
|
|
|
*/ |
|
34
|
|
View Code Duplication |
class Result extends AbstractBeanAnnotation |
|
|
|
|
|
|
35
|
|
|
{ |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* The annotation to define a servlets routing. |
|
39
|
|
|
* |
|
40
|
|
|
* @var string |
|
41
|
|
|
*/ |
|
42
|
|
|
const ANNOTATION = 'Result'; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* This method returns the class name as |
|
46
|
|
|
* a string. |
|
47
|
|
|
* |
|
48
|
|
|
* @return string |
|
49
|
|
|
*/ |
|
50
|
7 |
|
public static function __getClass() |
|
51
|
|
|
{ |
|
52
|
7 |
|
return __CLASS__; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Returns the value of the type attribute. |
|
57
|
|
|
* |
|
58
|
|
|
* @return string|null The annotations type attribute |
|
59
|
|
|
*/ |
|
60
|
5 |
|
public function getType() |
|
61
|
|
|
{ |
|
62
|
5 |
|
if (isset($this->values['type'])) { |
|
63
|
4 |
|
return $this->values['type']; |
|
64
|
|
|
} |
|
65
|
1 |
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Returns the value of the result attribute. |
|
69
|
|
|
* |
|
70
|
|
|
* @return string|null The annotations result attribute |
|
71
|
|
|
*/ |
|
72
|
5 |
|
public function getResult() |
|
73
|
|
|
{ |
|
74
|
5 |
|
if (isset($this->values['result'])) { |
|
75
|
4 |
|
return $this->values['result']; |
|
76
|
|
|
} |
|
77
|
1 |
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Returns the value of the code attribute. |
|
81
|
|
|
* |
|
82
|
|
|
* @return string|null The annotations code attribute |
|
83
|
|
|
*/ |
|
84
|
5 |
|
public function getCode() |
|
85
|
|
|
{ |
|
86
|
5 |
|
if (isset($this->values['code'])) { |
|
87
|
4 |
|
return $this->values['code']; |
|
88
|
|
|
} |
|
89
|
1 |
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|
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.