|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of tenside/core-bundle. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Christian Schiffler <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
* |
|
11
|
|
|
* This project is provided in good faith and hope to be usable by anyone. |
|
12
|
|
|
* |
|
13
|
|
|
* @package tenside/core-bundle |
|
14
|
|
|
* @author Christian Schiffler <[email protected]> |
|
15
|
|
|
* @copyright 2015 Christian Schiffler <[email protected]> |
|
16
|
|
|
* @license https://github.com/tenside/core-bundle/blob/master/LICENSE MIT |
|
17
|
|
|
* @link https://github.com/tenside/core-bundle |
|
18
|
|
|
* @filesource |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace Tenside\CoreBundle\Annotation; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Annotation for API results. |
|
25
|
|
|
* |
|
26
|
|
|
* @Annotation |
|
27
|
|
|
*/ |
|
28
|
|
|
class ApiDescription |
|
29
|
|
|
{ |
|
30
|
|
|
/** |
|
31
|
|
|
* The request payload description. |
|
32
|
|
|
* |
|
33
|
|
|
* @var array |
|
34
|
|
|
*/ |
|
35
|
|
|
private $request = []; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* The response description. |
|
39
|
|
|
* |
|
40
|
|
|
* @var array |
|
41
|
|
|
*/ |
|
42
|
|
|
private $response = []; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Link to another route and inherit the doc from it. |
|
46
|
|
|
* |
|
47
|
|
|
* @var string |
|
48
|
|
|
*/ |
|
49
|
|
|
private $link; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Create a new instance. |
|
53
|
|
|
* |
|
54
|
|
|
* @param array $options The values from the annotation. |
|
55
|
|
|
*/ |
|
56
|
|
|
public function __construct($options) |
|
57
|
|
|
{ |
|
58
|
|
|
if (isset($options['request'])) { |
|
59
|
|
|
$this->request = (array) $options['request']; |
|
60
|
|
|
unset($options['request']); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
if (isset($options['response'])) { |
|
64
|
|
|
$this->response = (array) $options['response']; |
|
65
|
|
|
unset($options['response']); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
if (isset($options['link'])) { |
|
69
|
|
|
$this->link = $options['link']; |
|
70
|
|
|
unset($options['link']); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Retrieve the request. |
|
76
|
|
|
* |
|
77
|
|
|
* @return array |
|
78
|
|
|
*/ |
|
79
|
|
|
public function getRequest() |
|
80
|
|
|
{ |
|
81
|
|
|
return $this->request; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Retrieve the response. |
|
86
|
|
|
* |
|
87
|
|
|
* @return array |
|
88
|
|
|
*/ |
|
89
|
|
|
public function getResponse() |
|
90
|
|
|
{ |
|
91
|
|
|
return $this->response; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Retrieve the link. |
|
96
|
|
|
* |
|
97
|
|
|
* @return string |
|
98
|
|
|
*/ |
|
99
|
|
|
public function getLink() |
|
100
|
|
|
{ |
|
101
|
|
|
return $this->link; |
|
102
|
|
|
} |
|
103
|
|
|
} |
|
104
|
|
|
|