|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* AppserverIo\Routlt\Annotations\Path |
|
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 request path info to an action class. |
|
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
|
|
|
* @Annotation |
|
35
|
|
|
* @Target({"CLASS"}) |
|
36
|
|
|
* @Attributes({ |
|
37
|
|
|
* @Attribute("results", type="array<AppserverIo\Routlt\Annotations\Result>"), |
|
38
|
|
|
* }) |
|
39
|
|
|
*/ |
|
40
|
|
|
class Path extends AbstractBeanAnnotation |
|
41
|
|
|
{ |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* The annotation to define a servlets routing. |
|
45
|
|
|
* |
|
46
|
|
|
* @var string |
|
47
|
|
|
*/ |
|
48
|
|
|
const ANNOTATION = 'Path'; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* The array with the action results. |
|
52
|
|
|
* |
|
53
|
|
|
* @var array<AppserverIo\Routlt\Annotations\Result> |
|
54
|
|
|
*/ |
|
55
|
|
|
protected $results = array(); |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* This method returns the class name as |
|
59
|
|
|
* a string. |
|
60
|
|
|
* |
|
61
|
|
|
* @return string |
|
62
|
|
|
*/ |
|
63
|
|
|
public static function __getClass() |
|
64
|
|
|
{ |
|
65
|
|
|
return __CLASS__; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* The constructor the initializes the instance with the |
|
70
|
|
|
* data passed with the token. |
|
71
|
|
|
* |
|
72
|
|
|
* @param array $values The annotation values |
|
73
|
|
|
*/ |
|
74
|
5 |
|
public function __construct(array $values = array()) |
|
75
|
|
|
{ |
|
76
|
|
|
|
|
77
|
|
|
// set the inner result annotations, if available |
|
78
|
5 |
|
if (isset($values[AnnotationKeys::RESULTS])) { |
|
79
|
3 |
|
$this->results = $values[AnnotationKeys::RESULTS]; |
|
80
|
3 |
|
} |
|
81
|
|
|
|
|
82
|
|
|
// pass the values through to the parent class |
|
83
|
5 |
|
parent::__construct($values); |
|
84
|
5 |
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* Returns the array with the inner result annotations. |
|
88
|
|
|
* |
|
89
|
|
|
* @return array<AppserverIo\Routlt\Annotations\Result> The inner result annotations |
|
90
|
|
|
*/ |
|
91
|
4 |
|
public function getResults() |
|
92
|
|
|
{ |
|
93
|
4 |
|
return $this->results; |
|
94
|
|
|
} |
|
95
|
|
|
} |
|
96
|
|
|
|