PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
← All changes | includes/sdk/s3/Aws/Waiter.php +15 -1 1.2.13 → 1.4.2 View file →
@@ -62,8 +62,9 @@
62 62 }
63 63 if ($this->config['before'] && !\is_callable($this->config['before'])) {
64 64 throw new \InvalidArgumentException('The provided "before" callback is not callable.');
65 65 }
66 + MetricsBuilder::appendMetricsCaptureMiddleware($this->client->getHandlerList(), MetricsBuilder::WAITER);
66 67 }
67 68 /**
68 69 * @return Coroutine
69 70 */
@@ -148,9 +149,9 @@
148 149 * @return bool
149 150 */
150 151 private function matchesPath($result, array $acceptor)
151 152 {
152 - return !$result instanceof ResultInterface ? \false : $acceptor['expected'] == $result->search($acceptor['argument']);
153 + return $result instanceof ResultInterface && $acceptor['expected'] === $result->search($acceptor['argument']);
153 154 }
154 155 /**
155 156 * @param Result $result Result or exception.
156 157 * @param array $acceptor Acceptor configuration being checked.
@@ -162,8 +163,12 @@
162 163 if (!$result instanceof ResultInterface) {
163 164 return \false;
164 165 }
165 166 $actuals = $result->search($acceptor['argument']) ?: [];
167 + // If is empty or not evaluates to an array it must return false.
168 + if (empty($actuals) || !\is_array($actuals)) {
169 + return \false;
170 + }
166 171 foreach ($actuals as $actual) {
167 172 if ($actual != $acceptor['expected']) {
168 173 return \false;
169 174 }
@@ -181,8 +186,12 @@
181 186 if (!$result instanceof ResultInterface) {
182 187 return \false;
183 188 }
184 189 $actuals = $result->search($acceptor['argument']) ?: [];
190 + // If is empty or not evaluates to an array it must return false.
191 + if (empty($actuals) || !\is_array($actuals)) {
192 + return \false;
193 + }
185 194 return \in_array($acceptor['expected'], $actuals);
186 195 }
187 196 /**
188 197 * @param Result $result Result or exception.
@@ -207,8 +216,13 @@
207 216 * @return bool
208 217 */
209 218 private function matchesError($result, array $acceptor)
210 219 {
220 + // If expected is true then the $result should be an instance of
221 + // AwsException, otherwise it should not.
222 + if (isset($acceptor['expected']) && \is_bool($acceptor['expected'])) {
223 + return $acceptor['expected'] === $result instanceof AwsException;
224 + }
211 225 if ($result instanceof AwsException) {
212 226 return $result->isConnectionError() || $result->getAwsErrorCode() == $acceptor['expected'];
213 227 }
214 228 return \false;