1 | <?php |
||
32 | abstract class WebserviceRequest extends Request |
||
33 | { |
||
34 | /** |
||
35 | * @var string The Input Data. |
||
36 | */ |
||
37 | protected $input = ''; |
||
38 | |||
39 | /** |
||
40 | * @var string The method called by the web service request. |
||
41 | */ |
||
42 | protected $invokedMethod = ''; |
||
43 | |||
44 | /** |
||
45 | * Constructor. |
||
46 | * |
||
47 | * @author David Zülke <[email protected]> |
||
48 | * @since 0.11.0 |
||
49 | */ |
||
50 | public function __construct() |
||
57 | |||
58 | /** |
||
59 | * Initialize this Request. |
||
60 | * |
||
61 | * @param Context $context A Context instance. |
||
62 | * @param array $parameters An associative array of initialization parameters. |
||
63 | * |
||
64 | * @throws <b>AgaviInitializationException</b> If an error occurs while |
||
65 | * initializing this Request. |
||
66 | * |
||
67 | * @author David Zülke <[email protected]> |
||
68 | * @since 0.11.0 |
||
69 | */ |
||
70 | public function initialize(Context $context, array $parameters = array()) |
||
80 | |||
81 | /** |
||
82 | * Get the input data, usually the request from the POST body. |
||
83 | * |
||
84 | * @return string The input data. |
||
85 | * |
||
86 | * @author David Zülke <[email protected]> |
||
87 | * @since 0.11.0 |
||
88 | */ |
||
89 | public function getInput() |
||
93 | |||
94 | /** |
||
95 | * Set the input data. Useful for debugging purposes. |
||
96 | * |
||
97 | * @param string $input The input data. |
||
98 | * |
||
99 | * @author David Zülke <[email protected]> |
||
100 | * @since 0.11.0 |
||
101 | */ |
||
102 | public function setInput($input) |
||
106 | |||
107 | /** |
||
108 | * Set the name of the method called by the web service request. |
||
109 | * |
||
110 | * @return string $method A method name. |
||
111 | * |
||
112 | * @author David Zülke <[email protected]> |
||
113 | * @since 0.11.0 |
||
114 | */ |
||
115 | public function setInvokedMethod($method) |
||
122 | |||
123 | /** |
||
124 | * Get the name of the method called by the web service request. |
||
125 | * |
||
126 | * @return string A method name. |
||
127 | * |
||
128 | * @author David Zülke <[email protected]> |
||
129 | * @since 0.11.0 |
||
130 | */ |
||
131 | public function getInvokedMethod() |
||
135 | } |
||
136 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: