1 | <?php |
||
11 | class RestApiRequestFactory |
||
12 | { |
||
13 | /** |
||
14 | * @var UrlGeneratorInterface |
||
15 | */ |
||
16 | protected $urlGenerator; |
||
17 | |||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $routeMapping; |
||
22 | |||
23 | /** |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $defaultOptions; |
||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $defaultBodyData; |
||
32 | |||
33 | /** |
||
34 | * Construct |
||
35 | * |
||
36 | * @param UrlGeneratorInterface $urlGenerator |
||
37 | * @param array $defaultOptions |
||
38 | * @param array $defaultBodyData |
||
39 | * @param array $routeMapping |
||
40 | */ |
||
41 | public function __construct( |
||
53 | |||
54 | /** |
||
55 | * Register a new route mapping |
||
56 | * |
||
57 | * @param array $routeMapping |
||
58 | */ |
||
59 | public function registerRouteMapping(array $routeMapping) |
||
63 | |||
64 | /** |
||
65 | * Create a http request uri from presets under $name parameter |
||
66 | * |
||
67 | * @param string $name |
||
68 | * @param array $query |
||
69 | * |
||
70 | * @return string |
||
71 | * |
||
72 | * @throws InvalidArgumentException If request doesnt exist for given name |
||
73 | */ |
||
74 | public function createRequestUri($name, array $query = array()) |
||
90 | |||
91 | /** |
||
92 | * Create request body data |
||
93 | * |
||
94 | * @param array $body |
||
95 | * |
||
96 | * @return array |
||
97 | */ |
||
98 | public function createRequestBodyData(array $body = array()) |
||
105 | |||
106 | /** |
||
107 | * Create request options, flatten default one and given one |
||
108 | * |
||
109 | * @param array $options |
||
110 | * |
||
111 | * @return array |
||
112 | */ |
||
113 | public function createRequestOptions(array $options = array()) |
||
120 | } |
||
121 |