@@ -64,6 +64,9 @@ |
||
64 | 64 | return new Operation($definition); |
65 | 65 | } |
66 | 66 | |
67 | + /** |
|
68 | + * @return ResponseInterface |
|
69 | + */ |
|
67 | 70 | protected function sendRequest(Operation $operation, array $userValues = [], $async = false) |
68 | 71 | { |
69 | 72 | $uri = uri_template($operation->getPath(), $userValues); |
@@ -149,11 +149,11 @@ |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | $promise = new Promise( |
152 | - function () use (&$promise, $realMethod, $args) { |
|
152 | + function() use (&$promise, $realMethod, $args) { |
|
153 | 153 | $value = call_user_func_array([$this, $realMethod], $args); |
154 | 154 | $promise->resolve($value); |
155 | 155 | }, |
156 | - function ($e) use (&$promise) { |
|
156 | + function($e) use (&$promise) { |
|
157 | 157 | $promise->reject($e); |
158 | 158 | } |
159 | 159 | ); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * Internal method used when outputting headers in the error description. |
47 | 47 | * |
48 | - * @param $name |
|
48 | + * @param string $name |
|
49 | 49 | * |
50 | 50 | * @return string |
51 | 51 | */ |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * Before outputting custom links, it is validated to ensure that the user is not |
59 | 59 | * directed off to a broken link. If a 404 is detected, it is hidden. |
60 | 60 | * |
61 | - * @param $link The proposed link |
|
61 | + * @param string $link The proposed link |
|
62 | 62 | * |
63 | 63 | * @return bool |
64 | 64 | */ |
@@ -38,7 +38,7 @@ |
||
38 | 38 | /** |
39 | 39 | * Set a node in the structure |
40 | 40 | * |
41 | - * @param $path The XPath to use |
|
41 | + * @param string $path The XPath to use |
|
42 | 42 | * @param $value The new value of the node |
43 | 43 | */ |
44 | 44 | public function set($path, $value) |
@@ -105,6 +105,9 @@ discard block |
||
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | + /** |
|
109 | + * @param string $type |
|
110 | + */ |
|
108 | 111 | private function isNotNativeType($type) |
109 | 112 | { |
110 | 113 | return !in_array($type, [ |
@@ -112,6 +115,11 @@ discard block |
||
112 | 115 | ]); |
113 | 116 | } |
114 | 117 | |
118 | + /** |
|
119 | + * @param string $class |
|
120 | + * |
|
121 | + * @return string |
|
122 | + */ |
|
115 | 123 | private function normalizeModelClass($class) |
116 | 124 | { |
117 | 125 | if (strpos($class, '\\') === false) { |
@@ -158,7 +166,7 @@ discard block |
||
158 | 166 | /** |
159 | 167 | * @param array $definition |
160 | 168 | * |
161 | - * @return mixed |
|
169 | + * @return ResponseInterface |
|
162 | 170 | */ |
163 | 171 | public function executeWithState(array $definition) |
164 | 172 | { |
@@ -177,7 +177,7 @@ |
||
177 | 177 | $limit = isset($userVals['limit']) ? $userVals : false; |
178 | 178 | $count = 0; |
179 | 179 | |
180 | - $totalReached = function ($count) use ($limit) { |
|
180 | + $totalReached = function($count) use ($limit) { |
|
181 | 181 | return $limit && $count >= $limit; |
182 | 182 | }; |
183 | 183 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * encapsulate your own logic to determine whether the resource has |
45 | 45 | * successfully transitioned. When TRUE is returned by the callback, |
46 | 46 | * the loop will end. |
47 | - * @param int|bool $timeout The maximum timeout in seconds. If the total time taken by the waiter has reached |
|
47 | + * @param integer $timeout The maximum timeout in seconds. If the total time taken by the waiter has reached |
|
48 | 48 | * or exceed this timeout, the blocking operation will immediately cease. If FALSE |
49 | 49 | * is provided, the timeout will never be considered. |
50 | 50 | * @param int $sleepPeriod The amount of time to pause between each HTTP request. |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * Internal method used to identify whether a timeout has been exceeded. |
71 | 71 | * |
72 | - * @param bool|int $timeout |
|
72 | + * @param integer $timeout |
|
73 | 73 | * @param int $startTime |
74 | 74 | * |
75 | 75 | * @return bool |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * Convenience method providing a blocking operation until the resource transitions to an |
88 | 88 | * ``ACTIVE`` status. |
89 | 89 | * |
90 | - * @param int|bool $timeout The maximum timeout in seconds. If the total time taken by the waiter has reached |
|
90 | + * @param integer $timeout The maximum timeout in seconds. If the total time taken by the waiter has reached |
|
91 | 91 | * or exceed this timeout, the blocking operation will immediately cease. If FALSE |
92 | 92 | * is provided, the timeout will never be considered. |
93 | 93 | */ |
@@ -138,7 +138,7 @@ |
||
138 | 138 | * |
139 | 139 | * @param string $name The name of the object |
140 | 140 | * |
141 | - * @return Object |
|
141 | + * @return \OpenStack\Common\Resource\ResourceInterface |
|
142 | 142 | */ |
143 | 143 | public function getObject($name) |
144 | 144 | { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | $this->location = $this->location ?: self::DEFAULT_LOCATION; |
126 | - $this->required = (bool)$this->required; |
|
126 | + $this->required = (bool) $this->required; |
|
127 | 127 | |
128 | 128 | if (isset($data['items'])) { |
129 | 129 | $this->itemSchema = new Parameter($data['items']); |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | private function hasCorrectType($userValue) |
226 | 226 | { |
227 | 227 | // Helper fn to see whether an array is associative (i.e. a JSON object) |
228 | - $isAssociative = function ($value) { |
|
229 | - return is_array($value) && (bool)count(array_filter(array_keys($value), 'is_string')); |
|
228 | + $isAssociative = function($value) { |
|
229 | + return is_array($value) && (bool) count(array_filter(array_keys($value), 'is_string')); |
|
230 | 230 | }; |
231 | 231 | |
232 | 232 | // For params defined as objects, we'll let the user get away with |
@@ -86,7 +86,7 @@ |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | if (!isset($options['authHandler'])) { |
89 | - $options['authHandler'] = function () use ($options) { |
|
89 | + $options['authHandler'] = function() use ($options) { |
|
90 | 90 | return $options['identityService']->generateToken($options); |
91 | 91 | }; |
92 | 92 | } |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | { |
14 | 14 | public static function httpErrors() |
15 | 15 | { |
16 | - return function (callable $handler) { |
|
17 | - return function ($request, array $options) use ($handler) { |
|
16 | + return function(callable $handler) { |
|
17 | + return function($request, array $options) use ($handler) { |
|
18 | 18 | return $handler($request, $options)->then( |
19 | - function (ResponseInterface $response) use ($request, $handler) { |
|
19 | + function(ResponseInterface $response) use ($request, $handler) { |
|
20 | 20 | if ($response->getStatusCode() < 400) { |
21 | 21 | return $response; |
22 | 22 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | public static function authHandler(callable $tokenGenerator, Token $token = null) |
31 | 31 | { |
32 | - return function (callable $handler) use ($tokenGenerator, $token) { |
|
32 | + return function(callable $handler) use ($tokenGenerator, $token) { |
|
33 | 33 | return new AuthHandler($handler, $tokenGenerator, $token); |
34 | 34 | }; |
35 | 35 | } |