@@ 119-133 (lines=15) @@ | ||
116 | 'chain' => $reqs |
|
117 | ] |
|
118 | ]; |
|
119 | } elseif ( $needsAuth !== false ) { |
|
120 | // These are work requests and authentication has previously failed. |
|
121 | // It is most efficient to just give failed pseudo responses back for |
|
122 | // the original work requests. |
|
123 | foreach ( $reqs as $key => $req ) { |
|
124 | $req['response'] = [ |
|
125 | 'code' => $this->authCachedStatus, |
|
126 | 'reason' => $this->authCachedReason, |
|
127 | 'headers' => [], |
|
128 | 'body' => '', |
|
129 | 'error' => '' |
|
130 | ]; |
|
131 | $result[$key] = $req; |
|
132 | } |
|
133 | } else { |
|
134 | // These are work requests and we have a token already. |
|
135 | // Go through and mangle each request to include a token. |
|
136 | foreach ( $reqs as $key => $req ) { |
|
@@ 160-173 (lines=14) @@ | ||
157 | // If it succeeded, we can subsitute the work requests back. |
|
158 | // Call this recursively in order to munge and add headers. |
|
159 | $result = $this->onRequests( $firstReq['chain'], $idGeneratorFunc ); |
|
160 | } else { |
|
161 | // If it failed, it is most efficient to just give failing |
|
162 | // pseudo-responses back for the actual work requests. |
|
163 | foreach ( $firstReq['chain'] as $key => $req ) { |
|
164 | $req['response'] = [ |
|
165 | 'code' => $this->authCachedStatus, |
|
166 | 'reason' => $this->authCachedReason, |
|
167 | 'headers' => [], |
|
168 | 'body' => '', |
|
169 | 'error' => '' |
|
170 | ]; |
|
171 | $result[$key] = $req; |
|
172 | } |
|
173 | } |
|
174 | } else { |
|
175 | $result = $reqs; // no change |
|
176 | } |