Skip to content

Commit 9441849

Browse files
committed
Fix PHP5 support, update code style
1 parent 5b2a391 commit 9441849

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/Client.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ public function sendRequest(RequestInterface $request)
7575
{
7676
$this->requests[] = $request;
7777

78-
foreach ($this->conditionalResults as ['matcher' => $matcher, 'callable' => $callable]) {
78+
foreach ($this->conditionalResults as $result) {
79+
$matcher = $result['matcher'];
80+
$callable = $result['callable'];
7981

8082
/**
8183
* @var RequestMatcher $matcher
@@ -107,28 +109,33 @@ public function sendRequest(RequestInterface $request)
107109
}
108110

109111
/**
110-
* @param RequestMatcher $requestMatcher
112+
* @param RequestMatcher $requestMatcher
111113
* @param ResponseInterface|\Exception|callable $result
112114
*/
113115
public function on(RequestMatcher $requestMatcher, $result)
114116
{
115117
$callable = null;
118+
116119
switch (true) {
117120
case is_callable($result):
118121
$callable = $result;
119122
break;
120123
case $result instanceof ResponseInterface:
121-
$callable = function () use ($result) { return $result; };
124+
$callable = function () use ($result) {
125+
return $result;
126+
};
122127
break;
123128
case $result instanceof \Exception:
124-
$callable = function () use ($result) { throw $result; };
129+
$callable = function () use ($result) {
130+
throw $result;
131+
};
125132
break;
126133
default:
127-
throw new \InvalidArgumentException("Result must be either a response, an exception, or a callable");
134+
throw new \InvalidArgumentException('Result must be either a response, an exception, or a callable');
128135
}
129136
$this->conditionalResults[] = [
130-
'matcher' => $requestMatcher,
131-
'callable' => $callable
137+
'matcher' => $requestMatcher,
138+
'callable' => $callable
132139
];
133140
}
134141

0 commit comments

Comments
 (0)