private function executeTestMethod(\ReflectionMethod $method) { $this->tryExecute('beforeMethod'); $test = new FunctionTest([$this->class, $method->getName()]); $results = $test->execute(); $this->tryExecute('afterMethod'); return Arrays::first($results); }
public function onNext($event) { $data = $this->parser->pushIncoming($event->data); $this->notifyNext(new Event("/redis/response", Arrays::first($data)->getValueNative())); $this->notifyCompleted(); }
/** * @param $data */ public function parseHead($data) { if (empty($data)) { $this->notifyError(new EmptyResponseException()); $this->dispose(); return; } if (false !== strpos($data, "\r\n\r\n")) { list($headers, $bodyBuffer) = explode("\r\n\r\n", $data, 2); // extract headers $response = \GuzzleHttp\Psr7\parse_response($headers); $this->response = $response; $encoding = Arrays::first($response->getHeader('Transfer-Encoding')); switch ($encoding) { case 'chunked': $this->parserCallable = [$this, 'parseChunk']; break; // TODO multipart // TODO multipart default: $this->parserCallable = [$this, 'parseContentLength']; if ($length = $response->getHeader("Content-Length")) { $this->contentLength = (int) Arrays::first($length); } } // Parse rest of body call_user_func($this->parserCallable, $bodyBuffer); } }
public function testCanGetFirstValue() { $under1 = Arrays::first($this->array); $under2 = Arrays::first($this->arrayNumbers, 2); $this->assertEquals('bar', $under1); $this->assertEquals(array(1, 2), $under2); }