repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
egeloen/ivory-http-adapter
src/SocketHttpAdapter.php
SocketHttpAdapter.prepareRequest
private function prepareRequest(InternalRequestInterface $internalRequest) { $uri = $internalRequest->getUri(); $path = $uri->getPath().($uri->getQuery() ? '?'.$uri->getQuery() : ''); $request = $internalRequest->getMethod().' '.$path.' HTTP/'.$internalRequest->getProtocolVersion()."\r\n"; ...
php
private function prepareRequest(InternalRequestInterface $internalRequest) { $uri = $internalRequest->getUri(); $path = $uri->getPath().($uri->getQuery() ? '?'.$uri->getQuery() : ''); $request = $internalRequest->getMethod().' '.$path.' HTTP/'.$internalRequest->getProtocolVersion()."\r\n"; ...
[ "private", "function", "prepareRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "$", "uri", "=", "$", "internalRequest", "->", "getUri", "(", ")", ";", "$", "path", "=", "$", "uri", "->", "getPath", "(", ")", ".", "(", "$", "u...
@param InternalRequestInterface $internalRequest @return string
[ "@param", "InternalRequestInterface", "$internalRequest" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/SocketHttpAdapter.php#L79-L90
egeloen/ivory-http-adapter
src/SocketHttpAdapter.php
SocketHttpAdapter.parseResponse
private function parseResponse($socket) { $headers = ''; $body = ''; $processHeaders = true; while (!feof($socket) && !$this->detectTimeout($socket)) { $line = fgets($socket); if ($line === "\r\n") { $processHeaders = false; } els...
php
private function parseResponse($socket) { $headers = ''; $body = ''; $processHeaders = true; while (!feof($socket) && !$this->detectTimeout($socket)) { $line = fgets($socket); if ($line === "\r\n") { $processHeaders = false; } els...
[ "private", "function", "parseResponse", "(", "$", "socket", ")", "{", "$", "headers", "=", "''", ";", "$", "body", "=", "''", ";", "$", "processHeaders", "=", "true", ";", "while", "(", "!", "feof", "(", "$", "socket", ")", "&&", "!", "$", "this", ...
@param resource $socket @return array
[ "@param", "resource", "$socket" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/SocketHttpAdapter.php#L97-L116
egeloen/ivory-http-adapter
src/SocketHttpAdapter.php
SocketHttpAdapter.decodeBody
private function decodeBody(array $headers, $body) { $headers = array_change_key_case($headers); if (isset($headers['transfer-encoding']) && $headers['transfer-encoding'] === 'chunked') { for ($decodedBody = ''; !empty($body); $body = trim($body)) { $pos = strpos($body, ...
php
private function decodeBody(array $headers, $body) { $headers = array_change_key_case($headers); if (isset($headers['transfer-encoding']) && $headers['transfer-encoding'] === 'chunked') { for ($decodedBody = ''; !empty($body); $body = trim($body)) { $pos = strpos($body, ...
[ "private", "function", "decodeBody", "(", "array", "$", "headers", ",", "$", "body", ")", "{", "$", "headers", "=", "array_change_key_case", "(", "$", "headers", ")", ";", "if", "(", "isset", "(", "$", "headers", "[", "'transfer-encoding'", "]", ")", "&&...
@param array $headers @param string $body @return string
[ "@param", "array", "$headers", "@param", "string", "$body" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/SocketHttpAdapter.php#L124-L140
egeloen/ivory-http-adapter
src/Guzzle3HttpAdapter.php
Guzzle3HttpAdapter.sendInternalRequest
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { try { $response = $this->createRequest($internalRequest)->send(); } catch (RequestException $e) { throw HttpAdapterException::cannotFetchUri( $e->getRequest()->getUrl(), ...
php
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { try { $response = $this->createRequest($internalRequest)->send(); } catch (RequestException $e) { throw HttpAdapterException::cannotFetchUri( $e->getRequest()->getUrl(), ...
[ "protected", "function", "sendInternalRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "try", "{", "$", "response", "=", "$", "this", "->", "createRequest", "(", "$", "internalRequest", ")", "->", "send", "(", ")", ";", "}", "catch"...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Guzzle3HttpAdapter.php#L53-L79
egeloen/ivory-http-adapter
src/Guzzle3HttpAdapter.php
Guzzle3HttpAdapter.sendInternalRequests
protected function sendInternalRequests(array $internalRequests, $success, $error) { $requests = []; foreach ($internalRequests as $internalRequest) { $requests[] = $this->createRequest($internalRequest, $success, $error); } try { $this->client->send($request...
php
protected function sendInternalRequests(array $internalRequests, $success, $error) { $requests = []; foreach ($internalRequests as $internalRequest) { $requests[] = $this->createRequest($internalRequest, $success, $error); } try { $this->client->send($request...
[ "protected", "function", "sendInternalRequests", "(", "array", "$", "internalRequests", ",", "$", "success", ",", "$", "error", ")", "{", "$", "requests", "=", "[", "]", ";", "foreach", "(", "$", "internalRequests", "as", "$", "internalRequest", ")", "{", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Guzzle3HttpAdapter.php#L84-L95
egeloen/ivory-http-adapter
src/Guzzle3HttpAdapter.php
Guzzle3HttpAdapter.createRequest
private function createRequest(InternalRequestInterface $internalRequest, $success = null, $error = null) { $request = $this->client->createRequest( $internalRequest->getMethod(), (string) $internalRequest->getUri(), $this->prepareHeaders($internalRequest), $t...
php
private function createRequest(InternalRequestInterface $internalRequest, $success = null, $error = null) { $request = $this->client->createRequest( $internalRequest->getMethod(), (string) $internalRequest->getUri(), $this->prepareHeaders($internalRequest), $t...
[ "private", "function", "createRequest", "(", "InternalRequestInterface", "$", "internalRequest", ",", "$", "success", "=", "null", ",", "$", "error", "=", "null", ")", "{", "$", "request", "=", "$", "this", "->", "client", "->", "createRequest", "(", "$", ...
@param InternalRequestInterface $internalRequest @param callable|null $success @param callable|null $error @return RequestInterface
[ "@param", "InternalRequestInterface", "$internalRequest", "@param", "callable|null", "$success", "@param", "callable|null", "$error" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Guzzle3HttpAdapter.php#L112-L175
egeloen/ivory-http-adapter
src/PeclHttpAdapter.php
PeclHttpAdapter.sendInternalRequest
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $body = new Body(); $body->append($this->prepareBody($internalRequest)); $request = new Request( $internalRequest->getMethod(), $uri = (string) $internalRequest->getUri(), ...
php
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $body = new Body(); $body->append($this->prepareBody($internalRequest)); $request = new Request( $internalRequest->getMethod(), $uri = (string) $internalRequest->getUri(), ...
[ "protected", "function", "sendInternalRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "$", "body", "=", "new", "Body", "(", ")", ";", "$", "body", "->", "append", "(", "$", "this", "->", "prepareBody", "(", "$", "internalRequest", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/PeclHttpAdapter.php#L43-L78
egeloen/ivory-http-adapter
src/Event/Cookie/Jar/SessionCookieJar.php
SessionCookieJar.load
public function load() { $this->unserialize(isset($_SESSION[$this->key]) ? $_SESSION[$this->key] : null); }
php
public function load() { $this->unserialize(isset($_SESSION[$this->key]) ? $_SESSION[$this->key] : null); }
[ "public", "function", "load", "(", ")", "{", "$", "this", "->", "unserialize", "(", "isset", "(", "$", "_SESSION", "[", "$", "this", "->", "key", "]", ")", "?", "$", "_SESSION", "[", "$", "this", "->", "key", "]", ":", "null", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Jar/SessionCookieJar.php#L56-L59
egeloen/ivory-http-adapter
src/CakeHttpAdapter.php
CakeHttpAdapter.sendInternalRequest
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $request = new Request(); foreach ($this->prepareHeaders($internalRequest) as $name => $value) { $request->header($name, $value); } $request->method($internalRequest->getMethod()); ...
php
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $request = new Request(); foreach ($this->prepareHeaders($internalRequest) as $name => $value) { $request->header($name, $value); } $request->method($internalRequest->getMethod()); ...
[ "protected", "function", "sendInternalRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "$", "request", "=", "new", "Request", "(", ")", ";", "foreach", "(", "$", "this", "->", "prepareHeaders", "(", "$", "internalRequest", ")", "as", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/CakeHttpAdapter.php#L50-L78
egeloen/ivory-http-adapter
src/Normalizer/BodyNormalizer.php
BodyNormalizer.normalize
public static function normalize($body, $method) { if ($method === RequestInterface::METHOD_HEAD || empty($body)) { return; } if (is_callable($body)) { return call_user_func($body); } return $body; }
php
public static function normalize($body, $method) { if ($method === RequestInterface::METHOD_HEAD || empty($body)) { return; } if (is_callable($body)) { return call_user_func($body); } return $body; }
[ "public", "static", "function", "normalize", "(", "$", "body", ",", "$", "method", ")", "{", "if", "(", "$", "method", "===", "RequestInterface", "::", "METHOD_HEAD", "||", "empty", "(", "$", "body", ")", ")", "{", "return", ";", "}", "if", "(", "is_...
@param mixed $body @param string $method @return mixed
[ "@param", "mixed", "$body", "@param", "string", "$method" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Normalizer/BodyNormalizer.php#L28-L39
egeloen/ivory-http-adapter
src/Event/Retry/Retry.php
Retry.retry
public function retry(InternalRequestInterface $internalRequest, $wait = true) { if (!$this->strategy->verify($internalRequest)) { return false; } if ($wait && ($delay = $this->strategy->delay($internalRequest)) > 0) { usleep($delay * 1000000); } ret...
php
public function retry(InternalRequestInterface $internalRequest, $wait = true) { if (!$this->strategy->verify($internalRequest)) { return false; } if ($wait && ($delay = $this->strategy->delay($internalRequest)) > 0) { usleep($delay * 1000000); } ret...
[ "public", "function", "retry", "(", "InternalRequestInterface", "$", "internalRequest", ",", "$", "wait", "=", "true", ")", "{", "if", "(", "!", "$", "this", "->", "strategy", "->", "verify", "(", "$", "internalRequest", ")", ")", "{", "return", "false", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Retry/Retry.php#L56-L70
egeloen/ivory-http-adapter
src/Event/Cookie/Jar/FileCookieJar.php
FileCookieJar.load
public function load() { if (($data = @file_get_contents($this->file)) === false) { $error = error_get_last(); throw HttpAdapterException::cannotLoadCookieJar($error['message']); } $this->unserialize($data); }
php
public function load() { if (($data = @file_get_contents($this->file)) === false) { $error = error_get_last(); throw HttpAdapterException::cannotLoadCookieJar($error['message']); } $this->unserialize($data); }
[ "public", "function", "load", "(", ")", "{", "if", "(", "(", "$", "data", "=", "@", "file_get_contents", "(", "$", "this", "->", "file", ")", ")", "===", "false", ")", "{", "$", "error", "=", "error_get_last", "(", ")", ";", "throw", "HttpAdapterExce...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Jar/FileCookieJar.php#L57-L65
egeloen/ivory-http-adapter
src/Event/Cookie/Jar/FileCookieJar.php
FileCookieJar.save
public function save() { if (@file_put_contents($this->file, $this->serialize()) === false) { $error = error_get_last(); throw HttpAdapterException::cannotSaveCookieJar($error['message']); } }
php
public function save() { if (@file_put_contents($this->file, $this->serialize()) === false) { $error = error_get_last(); throw HttpAdapterException::cannotSaveCookieJar($error['message']); } }
[ "public", "function", "save", "(", ")", "{", "if", "(", "@", "file_put_contents", "(", "$", "this", "->", "file", ",", "$", "this", "->", "serialize", "(", ")", ")", "===", "false", ")", "{", "$", "error", "=", "error_get_last", "(", ")", ";", "thr...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Jar/FileCookieJar.php#L70-L76
egeloen/ivory-http-adapter
src/CurlHttpAdapter.php
CurlHttpAdapter.sendInternalRequest
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $curl = $this->createCurl($internalRequest); try { $response = $this->createResponse($curl, curl_exec($curl), $internalRequest); } catch (HttpAdapterException $e) { curl_close($curl);...
php
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $curl = $this->createCurl($internalRequest); try { $response = $this->createResponse($curl, curl_exec($curl), $internalRequest); } catch (HttpAdapterException $e) { curl_close($curl);...
[ "protected", "function", "sendInternalRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "$", "curl", "=", "$", "this", "->", "createCurl", "(", "$", "internalRequest", ")", ";", "try", "{", "$", "response", "=", "$", "this", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/CurlHttpAdapter.php#L46-L61
egeloen/ivory-http-adapter
src/CurlHttpAdapter.php
CurlHttpAdapter.sendInternalRequests
protected function sendInternalRequests(array $internalRequests, $success, $error) { $curlMulti = curl_multi_init(); $contexts = []; foreach ($internalRequests as $internalRequest) { $contexts[] = [ 'curl' => $curl = $this->createCurl($internalRequest), ...
php
protected function sendInternalRequests(array $internalRequests, $success, $error) { $curlMulti = curl_multi_init(); $contexts = []; foreach ($internalRequests as $internalRequest) { $contexts[] = [ 'curl' => $curl = $this->createCurl($internalRequest), ...
[ "protected", "function", "sendInternalRequests", "(", "array", "$", "internalRequests", ",", "$", "success", ",", "$", "error", ")", "{", "$", "curlMulti", "=", "curl_multi_init", "(", ")", ";", "$", "contexts", "=", "[", "]", ";", "foreach", "(", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/CurlHttpAdapter.php#L66-L104
egeloen/ivory-http-adapter
src/CurlHttpAdapter.php
CurlHttpAdapter.createCurl
private function createCurl(InternalRequestInterface $internalRequest) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, (string) $internalRequest->getUri()); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false); curl_setopt($curl, CURLOPT_HTTP_VERSION, $this->prepareProtocolVersi...
php
private function createCurl(InternalRequestInterface $internalRequest) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, (string) $internalRequest->getUri()); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false); curl_setopt($curl, CURLOPT_HTTP_VERSION, $this->prepareProtocolVersi...
[ "private", "function", "createCurl", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "$", "curl", "=", "curl_init", "(", ")", ";", "curl_setopt", "(", "$", "curl", ",", "CURLOPT_URL", ",", "(", "string", ")", "$", "internalRequest", "->", ...
@param InternalRequestInterface $internalRequest @return resource
[ "@param", "InternalRequestInterface", "$internalRequest" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/CurlHttpAdapter.php#L111-L156
egeloen/ivory-http-adapter
src/CurlHttpAdapter.php
CurlHttpAdapter.createResponse
private function createResponse($curl, $data, InternalRequestInterface $internalRequest) { if (empty($data)) { throw HttpAdapterException::cannotFetchUri( (string) $internalRequest->getUri(), $this->getName(), curl_error($curl) ); ...
php
private function createResponse($curl, $data, InternalRequestInterface $internalRequest) { if (empty($data)) { throw HttpAdapterException::cannotFetchUri( (string) $internalRequest->getUri(), $this->getName(), curl_error($curl) ); ...
[ "private", "function", "createResponse", "(", "$", "curl", ",", "$", "data", ",", "InternalRequestInterface", "$", "internalRequest", ")", "{", "if", "(", "empty", "(", "$", "data", ")", ")", "{", "throw", "HttpAdapterException", "::", "cannotFetchUri", "(", ...
@param resource $curl @param string|bool|null $data @param InternalRequestInterface $internalRequest @throws HttpAdapterException @return ResponseInterface
[ "@param", "resource", "$curl", "@param", "string|bool|null", "$data", "@param", "InternalRequestInterface", "$internalRequest" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/CurlHttpAdapter.php#L180-L198
egeloen/ivory-http-adapter
src/Event/Cookie/CookieFactory.php
CookieFactory.create
public function create($name, $value, array $attributes, $createdAt) { return new Cookie($name, $value, $attributes, $createdAt); }
php
public function create($name, $value, array $attributes, $createdAt) { return new Cookie($name, $value, $attributes, $createdAt); }
[ "public", "function", "create", "(", "$", "name", ",", "$", "value", ",", "array", "$", "attributes", ",", "$", "createdAt", ")", "{", "return", "new", "Cookie", "(", "$", "name", ",", "$", "value", ",", "$", "attributes", ",", "$", "createdAt", ")",...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/CookieFactory.php#L24-L27
egeloen/ivory-http-adapter
src/Event/Cookie/CookieFactory.php
CookieFactory.parse
public function parse($header) { list($name, $value, $attributes) = CookieParser::parse($header); return $this->create($name, $value, $attributes, time()); }
php
public function parse($header) { list($name, $value, $attributes) = CookieParser::parse($header); return $this->create($name, $value, $attributes, time()); }
[ "public", "function", "parse", "(", "$", "header", ")", "{", "list", "(", "$", "name", ",", "$", "value", ",", "$", "attributes", ")", "=", "CookieParser", "::", "parse", "(", "$", "header", ")", ";", "return", "$", "this", "->", "create", "(", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/CookieFactory.php#L32-L37
egeloen/ivory-http-adapter
src/Normalizer/HeadersNormalizer.php
HeadersNormalizer.normalize
public static function normalize($headers, $associative = true) { $normalizedHeaders = []; if (!$associative) { $headers = self::normalize($headers); } foreach (HeadersParser::parse($headers) as $name => $value) { if (strpos($value, 'HTTP/') === 0) { ...
php
public static function normalize($headers, $associative = true) { $normalizedHeaders = []; if (!$associative) { $headers = self::normalize($headers); } foreach (HeadersParser::parse($headers) as $name => $value) { if (strpos($value, 'HTTP/') === 0) { ...
[ "public", "static", "function", "normalize", "(", "$", "headers", ",", "$", "associative", "=", "true", ")", "{", "$", "normalizedHeaders", "=", "[", "]", ";", "if", "(", "!", "$", "associative", ")", "{", "$", "headers", "=", "self", "::", "normalize"...
@param string|array $headers @param bool $associative @return array
[ "@param", "string|array", "$headers", "@param", "bool", "$associative" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Normalizer/HeadersNormalizer.php#L28-L56
egeloen/ivory-http-adapter
src/Event/Subscriber/StopwatchSubscriber.php
StopwatchSubscriber.getStopwatchName
private function getStopwatchName(HttpAdapterInterface $httpAdapter, InternalRequestInterface $internalRequest) { return sprintf('ivory.http_adapter.%s (%s)', $httpAdapter->getName(), (string) $internalRequest->getUri()); }
php
private function getStopwatchName(HttpAdapterInterface $httpAdapter, InternalRequestInterface $internalRequest) { return sprintf('ivory.http_adapter.%s (%s)', $httpAdapter->getName(), (string) $internalRequest->getUri()); }
[ "private", "function", "getStopwatchName", "(", "HttpAdapterInterface", "$", "httpAdapter", ",", "InternalRequestInterface", "$", "internalRequest", ")", "{", "return", "sprintf", "(", "'ivory.http_adapter.%s (%s)'", ",", "$", "httpAdapter", "->", "getName", "(", ")", ...
@param HttpAdapterInterface $httpAdapter @param InternalRequestInterface $internalRequest @return string
[ "@param", "HttpAdapterInterface", "$httpAdapter", "@param", "InternalRequestInterface", "$internalRequest" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Subscriber/StopwatchSubscriber.php#L139-L142
egeloen/ivory-http-adapter
src/FopenHttpAdapter.php
FopenHttpAdapter.process
protected function process($uri, $context) { $http_response_header = []; $resource = @fopen($uri, 'rb', false, $context); if (is_resource($resource)) { $copy = @fopen('php://memory', 'rb+'); stream_copy_to_stream($resource, $copy); fclose($resource); ...
php
protected function process($uri, $context) { $http_response_header = []; $resource = @fopen($uri, 'rb', false, $context); if (is_resource($resource)) { $copy = @fopen('php://memory', 'rb+'); stream_copy_to_stream($resource, $copy); fclose($resource); ...
[ "protected", "function", "process", "(", "$", "uri", ",", "$", "context", ")", "{", "$", "http_response_header", "=", "[", "]", ";", "$", "resource", "=", "@", "fopen", "(", "$", "uri", ",", "'rb'", ",", "false", ",", "$", "context", ")", ";", "if"...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/FopenHttpAdapter.php#L30-L44
egeloen/ivory-http-adapter
src/Guzzle6HttpAdapter.php
Guzzle6HttpAdapter.sendInternalRequests
protected function sendInternalRequests(array $internalRequests, $success, $error) { $requests = []; foreach ($internalRequests as $key => $internalRequest) { $requests[$key] = $this->createRequest($internalRequest); } $httpAdapter = $this; $pool = new Pool($thi...
php
protected function sendInternalRequests(array $internalRequests, $success, $error) { $requests = []; foreach ($internalRequests as $key => $internalRequest) { $requests[$key] = $this->createRequest($internalRequest); } $httpAdapter = $this; $pool = new Pool($thi...
[ "protected", "function", "sendInternalRequests", "(", "array", "$", "internalRequests", ",", "$", "success", ",", "$", "error", ")", "{", "$", "requests", "=", "[", "]", ";", "foreach", "(", "$", "internalRequests", "as", "$", "key", "=>", "$", "internalRe...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Guzzle6HttpAdapter.php#L85-L124
egeloen/ivory-http-adapter
src/Guzzle6HttpAdapter.php
Guzzle6HttpAdapter.createRequest
private function createRequest(InternalRequestInterface $internalRequest) { return new Request( $internalRequest->getMethod(), $internalRequest->getUri(), $this->prepareHeaders($internalRequest), $this->prepareBody($internalRequest), $internalReque...
php
private function createRequest(InternalRequestInterface $internalRequest) { return new Request( $internalRequest->getMethod(), $internalRequest->getUri(), $this->prepareHeaders($internalRequest), $this->prepareBody($internalRequest), $internalReque...
[ "private", "function", "createRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "return", "new", "Request", "(", "$", "internalRequest", "->", "getMethod", "(", ")", ",", "$", "internalRequest", "->", "getUri", "(", ")", ",", "$", "t...
@param InternalRequestInterface $internalRequest @return Request
[ "@param", "InternalRequestInterface", "$internalRequest" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Guzzle6HttpAdapter.php#L131-L140
egeloen/ivory-http-adapter
src/Zend1HttpAdapter.php
Zend1HttpAdapter.sendInternalRequest
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $this->client ->resetParameters(true) ->setConfig([ 'httpversion' => $internalRequest->getProtocolVersion(), 'timeout' => $this->getConfiguration()->getTime...
php
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $this->client ->resetParameters(true) ->setConfig([ 'httpversion' => $internalRequest->getProtocolVersion(), 'timeout' => $this->getConfiguration()->getTime...
[ "protected", "function", "sendInternalRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "$", "this", "->", "client", "->", "resetParameters", "(", "true", ")", "->", "setConfig", "(", "[", "'httpversion'", "=>", "$", "internalRequest", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Zend1HttpAdapter.php#L47-L81
egeloen/ivory-http-adapter
src/Event/Subscriber/CookieSubscriber.php
CookieSubscriber.getSubscribedEvents
public static function getSubscribedEvents() { return [ Events::REQUEST_CREATED => ['onRequestCreated', 300], Events::REQUEST_SENT => ['onRequestSent', 300], Events::REQUEST_ERRORED => ['onRequestErrored', 300], Events::MULTI_REQUEST_CREAT...
php
public static function getSubscribedEvents() { return [ Events::REQUEST_CREATED => ['onRequestCreated', 300], Events::REQUEST_SENT => ['onRequestSent', 300], Events::REQUEST_ERRORED => ['onRequestErrored', 300], Events::MULTI_REQUEST_CREAT...
[ "public", "static", "function", "getSubscribedEvents", "(", ")", "{", "return", "[", "Events", "::", "REQUEST_CREATED", "=>", "[", "'onRequestCreated'", ",", "300", "]", ",", "Events", "::", "REQUEST_SENT", "=>", "[", "'onRequestSent'", ",", "300", "]", ",", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Subscriber/CookieSubscriber.php#L113-L123
egeloen/ivory-http-adapter
src/Event/Cookie/Jar/AbstractPersistentCookieJar.php
AbstractPersistentCookieJar.unserialize
public function unserialize($serialized) { $data = json_decode($serialized, true); if (empty($data)) { $this->clear(); } else { $cookieFactory = $this->getCookieFactory(); $this->setCookies(array_map(function (array $cookie) use ($cookieFactory) { ...
php
public function unserialize($serialized) { $data = json_decode($serialized, true); if (empty($data)) { $this->clear(); } else { $cookieFactory = $this->getCookieFactory(); $this->setCookies(array_map(function (array $cookie) use ($cookieFactory) { ...
[ "public", "function", "unserialize", "(", "$", "serialized", ")", "{", "$", "data", "=", "json_decode", "(", "$", "serialized", ",", "true", ")", ";", "if", "(", "empty", "(", "$", "data", ")", ")", "{", "$", "this", "->", "clear", "(", ")", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Jar/AbstractPersistentCookieJar.php#L56-L74
egeloen/ivory-http-adapter
src/StopwatchHttpAdapter.php
StopwatchHttpAdapter.doSendInternalRequest
protected function doSendInternalRequest(InternalRequestInterface $internalRequest) { $this->stopwatch->start($name = 'ivory.http_adapter'); try { $result = parent::doSendInternalRequest($internalRequest); } catch (\Exception $e) { $this->stopwatch->stop($name); ...
php
protected function doSendInternalRequest(InternalRequestInterface $internalRequest) { $this->stopwatch->start($name = 'ivory.http_adapter'); try { $result = parent::doSendInternalRequest($internalRequest); } catch (\Exception $e) { $this->stopwatch->stop($name); ...
[ "protected", "function", "doSendInternalRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "$", "this", "->", "stopwatch", "->", "start", "(", "$", "name", "=", "'ivory.http_adapter'", ")", ";", "try", "{", "$", "result", "=", "parent",...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/StopwatchHttpAdapter.php#L41-L56
egeloen/ivory-http-adapter
src/StopwatchHttpAdapter.php
StopwatchHttpAdapter.doSendInternalRequests
protected function doSendInternalRequests(array $internalRequests) { $this->stopwatch->start($name = 'ivory.http_adapter'); try { $result = parent::doSendInternalRequests($internalRequests); } catch (\Exception $e) { $this->stopwatch->stop($name); throw ...
php
protected function doSendInternalRequests(array $internalRequests) { $this->stopwatch->start($name = 'ivory.http_adapter'); try { $result = parent::doSendInternalRequests($internalRequests); } catch (\Exception $e) { $this->stopwatch->stop($name); throw ...
[ "protected", "function", "doSendInternalRequests", "(", "array", "$", "internalRequests", ")", "{", "$", "this", "->", "stopwatch", "->", "start", "(", "$", "name", "=", "'ivory.http_adapter'", ")", ";", "try", "{", "$", "result", "=", "parent", "::", "doSen...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/StopwatchHttpAdapter.php#L61-L76
egeloen/ivory-http-adapter
src/ReactHttpAdapter.php
ReactHttpAdapter.sendInternalRequest
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $loop = EventLoopFactory::create(); $dnsResolverFactory = new DnsResolverFactory(); $httpClientFactory = new HttpClientFactory(); $error = null; $response = null; $body = null; ...
php
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $loop = EventLoopFactory::create(); $dnsResolverFactory = new DnsResolverFactory(); $httpClientFactory = new HttpClientFactory(); $error = null; $response = null; $body = null; ...
[ "protected", "function", "sendInternalRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "$", "loop", "=", "EventLoopFactory", "::", "create", "(", ")", ";", "$", "dnsResolverFactory", "=", "new", "DnsResolverFactory", "(", ")", ";", "$",...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/ReactHttpAdapter.php#L37-L78
egeloen/ivory-http-adapter
src/Message/MessageFactory.php
MessageFactory.createRequest
public function createRequest( $uri, $method = RequestInterface::METHOD_GET, $protocolVersion = RequestInterface::PROTOCOL_VERSION_1_1, array $headers = [], $body = null, array $parameters = [] ) { return (new Request( $this->createUri($uri), ...
php
public function createRequest( $uri, $method = RequestInterface::METHOD_GET, $protocolVersion = RequestInterface::PROTOCOL_VERSION_1_1, array $headers = [], $body = null, array $parameters = [] ) { return (new Request( $this->createUri($uri), ...
[ "public", "function", "createRequest", "(", "$", "uri", ",", "$", "method", "=", "RequestInterface", "::", "METHOD_GET", ",", "$", "protocolVersion", "=", "RequestInterface", "::", "PROTOCOL_VERSION_1_1", ",", "array", "$", "headers", "=", "[", "]", ",", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Message/MessageFactory.php#L68-L83
egeloen/ivory-http-adapter
src/Message/MessageFactory.php
MessageFactory.createInternalRequest
public function createInternalRequest( $uri, $method = RequestInterface::METHOD_GET, $protocolVersion = RequestInterface::PROTOCOL_VERSION_1_1, array $headers = [], $datas = [], array $files = [], array $parameters = [] ) { $body = null; if (!...
php
public function createInternalRequest( $uri, $method = RequestInterface::METHOD_GET, $protocolVersion = RequestInterface::PROTOCOL_VERSION_1_1, array $headers = [], $datas = [], array $files = [], array $parameters = [] ) { $body = null; if (!...
[ "public", "function", "createInternalRequest", "(", "$", "uri", ",", "$", "method", "=", "RequestInterface", "::", "METHOD_GET", ",", "$", "protocolVersion", "=", "RequestInterface", "::", "PROTOCOL_VERSION_1_1", ",", "array", "$", "headers", "=", "[", "]", ",",...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Message/MessageFactory.php#L88-L113
egeloen/ivory-http-adapter
src/Message/MessageFactory.php
MessageFactory.createResponse
public function createResponse( $statusCode = 200, $protocolVersion = RequestInterface::PROTOCOL_VERSION_1_1, array $headers = [], $body = null, array $parameters = [] ) { return (new Response( $this->createStream($body), $statusCode, ...
php
public function createResponse( $statusCode = 200, $protocolVersion = RequestInterface::PROTOCOL_VERSION_1_1, array $headers = [], $body = null, array $parameters = [] ) { return (new Response( $this->createStream($body), $statusCode, ...
[ "public", "function", "createResponse", "(", "$", "statusCode", "=", "200", ",", "$", "protocolVersion", "=", "RequestInterface", "::", "PROTOCOL_VERSION_1_1", ",", "array", "$", "headers", "=", "[", "]", ",", "$", "body", "=", "null", ",", "array", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Message/MessageFactory.php#L118-L131
egeloen/ivory-http-adapter
src/Message/MessageFactory.php
MessageFactory.createUri
private function createUri($uri) { if ($this->hasBaseUri() && (stripos($uri, $baseUri = (string) $this->getBaseUri()) === false)) { return $baseUri.$uri; } return $uri; }
php
private function createUri($uri) { if ($this->hasBaseUri() && (stripos($uri, $baseUri = (string) $this->getBaseUri()) === false)) { return $baseUri.$uri; } return $uri; }
[ "private", "function", "createUri", "(", "$", "uri", ")", "{", "if", "(", "$", "this", "->", "hasBaseUri", "(", ")", "&&", "(", "stripos", "(", "$", "uri", ",", "$", "baseUri", "=", "(", "string", ")", "$", "this", "->", "getBaseUri", "(", ")", "...
@param string $uri @return string
[ "@param", "string", "$uri" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Message/MessageFactory.php#L138-L145
egeloen/ivory-http-adapter
src/PsrHttpAdapterDecorator.php
PsrHttpAdapterDecorator.sendInternalRequests
protected function sendInternalRequests(array $internalRequests, $success, $error) { $exceptions = []; try { $responses = $this->doSendInternalRequests($internalRequests); } catch (MultiHttpAdapterException $e) { $responses = $e->getResponses(); $exceptio...
php
protected function sendInternalRequests(array $internalRequests, $success, $error) { $exceptions = []; try { $responses = $this->doSendInternalRequests($internalRequests); } catch (MultiHttpAdapterException $e) { $responses = $e->getResponses(); $exceptio...
[ "protected", "function", "sendInternalRequests", "(", "array", "$", "internalRequests", ",", "$", "success", ",", "$", "error", ")", "{", "$", "exceptions", "=", "[", "]", ";", "try", "{", "$", "responses", "=", "$", "this", "->", "doSendInternalRequests", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/PsrHttpAdapterDecorator.php#L71-L89
egeloen/ivory-http-adapter
src/Parser/HeadersParser.php
HeadersParser.parse
public static function parse($headers) { if (is_string($headers)) { $headers = explode("\r\n\r\n", trim($headers)); return explode("\r\n", end($headers)); } $parsedHeaders = []; foreach ($headers as $name => $value) { $value = HeadersNormalizer:...
php
public static function parse($headers) { if (is_string($headers)) { $headers = explode("\r\n\r\n", trim($headers)); return explode("\r\n", end($headers)); } $parsedHeaders = []; foreach ($headers as $name => $value) { $value = HeadersNormalizer:...
[ "public", "static", "function", "parse", "(", "$", "headers", ")", "{", "if", "(", "is_string", "(", "$", "headers", ")", ")", "{", "$", "headers", "=", "explode", "(", "\"\\r\\n\\r\\n\"", ",", "trim", "(", "$", "headers", ")", ")", ";", "return", "e...
@param array|string $headers @return array
[ "@param", "array|string", "$headers" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Parser/HeadersParser.php#L27-L52
egeloen/ivory-http-adapter
src/RequestsHttpAdapter.php
RequestsHttpAdapter.sendInternalRequest
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $options = [ 'timeout' => $this->getConfiguration()->getTimeout(), 'connect_timeout' => $this->getConfiguration()->getTimeout(), 'protocol_version' => (float) $this->getConfigura...
php
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $options = [ 'timeout' => $this->getConfiguration()->getTimeout(), 'connect_timeout' => $this->getConfiguration()->getTimeout(), 'protocol_version' => (float) $this->getConfigura...
[ "protected", "function", "sendInternalRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "$", "options", "=", "[", "'timeout'", "=>", "$", "this", "->", "getConfiguration", "(", ")", "->", "getTimeout", "(", ")", ",", "'connect_timeout'",...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/RequestsHttpAdapter.php#L48-L80
egeloen/ivory-http-adapter
src/Parser/CookieParser.php
CookieParser.parse
public static function parse($header) { if (strpos($header, '=') === false) { $header = '='.$header; } list($name, $header) = explode('=', $header, 2); if (strpos($header, ';') === false) { $value = $header; $header = null; } else { ...
php
public static function parse($header) { if (strpos($header, '=') === false) { $header = '='.$header; } list($name, $header) = explode('=', $header, 2); if (strpos($header, ';') === false) { $value = $header; $header = null; } else { ...
[ "public", "static", "function", "parse", "(", "$", "header", ")", "{", "if", "(", "strpos", "(", "$", "header", ",", "'='", ")", "===", "false", ")", "{", "$", "header", "=", "'='", ".", "$", "header", ";", "}", "list", "(", "$", "name", ",", "...
@param string $header @return array
[ "@param", "string", "$header" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Parser/CookieParser.php#L26-L61
egeloen/ivory-http-adapter
src/Event/History/Journal.php
Journal.record
public function record(InternalRequestInterface $request, ResponseInterface $response) { $this->addEntry($this->journalEntryFactory->create($request, $response)); }
php
public function record(InternalRequestInterface $request, ResponseInterface $response) { $this->addEntry($this->journalEntryFactory->create($request, $response)); }
[ "public", "function", "record", "(", "InternalRequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "$", "this", "->", "addEntry", "(", "$", "this", "->", "journalEntryFactory", "->", "create", "(", "$", "request", ",", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/History/Journal.php#L64-L67
egeloen/ivory-http-adapter
src/Event/History/Journal.php
Journal.addEntry
public function addEntry(JournalEntryInterface $entry) { if (!$this->hasEntry($entry)) { $this->entries[] = $entry; $this->entries = array_slice($this->entries, $this->limit * -1); } }
php
public function addEntry(JournalEntryInterface $entry) { if (!$this->hasEntry($entry)) { $this->entries[] = $entry; $this->entries = array_slice($this->entries, $this->limit * -1); } }
[ "public", "function", "addEntry", "(", "JournalEntryInterface", "$", "entry", ")", "{", "if", "(", "!", "$", "this", "->", "hasEntry", "(", "$", "entry", ")", ")", "{", "$", "this", "->", "entries", "[", "]", "=", "$", "entry", ";", "$", "this", "-...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/History/Journal.php#L133-L139
egeloen/ivory-http-adapter
src/Event/History/Journal.php
Journal.removeEntry
public function removeEntry(JournalEntryInterface $entry) { if ($this->hasEntry($entry)) { unset($this->entries[array_search($entry, $this->entries, true)]); $this->entries = array_values($this->entries); } }
php
public function removeEntry(JournalEntryInterface $entry) { if ($this->hasEntry($entry)) { unset($this->entries[array_search($entry, $this->entries, true)]); $this->entries = array_values($this->entries); } }
[ "public", "function", "removeEntry", "(", "JournalEntryInterface", "$", "entry", ")", "{", "if", "(", "$", "this", "->", "hasEntry", "(", "$", "entry", ")", ")", "{", "unset", "(", "$", "this", "->", "entries", "[", "array_search", "(", "$", "entry", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/History/Journal.php#L144-L150
egeloen/ivory-http-adapter
src/Event/Cookie/Jar/CookieJar.php
CookieJar.clean
public function clean() { foreach ($this->cookies as $cookie) { if ($cookie->isExpired()) { $this->removeCookie($cookie); } } }
php
public function clean() { foreach ($this->cookies as $cookie) { if ($cookie->isExpired()) { $this->removeCookie($cookie); } } }
[ "public", "function", "clean", "(", ")", "{", "foreach", "(", "$", "this", "->", "cookies", "as", "$", "cookie", ")", "{", "if", "(", "$", "cookie", "->", "isExpired", "(", ")", ")", "{", "$", "this", "->", "removeCookie", "(", "$", "cookie", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Jar/CookieJar.php#L62-L69
egeloen/ivory-http-adapter
src/Event/Cookie/Jar/CookieJar.php
CookieJar.clear
public function clear($domain = null, $path = null, $name = null) { foreach ($this->cookies as $cookie) { if ($domain !== null && !$cookie->matchDomain($domain)) { continue; } if ($path !== null && !$cookie->matchPath($path)) { continue; ...
php
public function clear($domain = null, $path = null, $name = null) { foreach ($this->cookies as $cookie) { if ($domain !== null && !$cookie->matchDomain($domain)) { continue; } if ($path !== null && !$cookie->matchPath($path)) { continue; ...
[ "public", "function", "clear", "(", "$", "domain", "=", "null", ",", "$", "path", "=", "null", ",", "$", "name", "=", "null", ")", "{", "foreach", "(", "$", "this", "->", "cookies", "as", "$", "cookie", ")", "{", "if", "(", "$", "domain", "!==", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Jar/CookieJar.php#L74-L91
egeloen/ivory-http-adapter
src/Event/Cookie/Jar/CookieJar.php
CookieJar.addCookie
public function addCookie(CookieInterface $cookie) { if (!$cookie->hasName() || $this->hasCookie($cookie)) { return; } if (!$cookie->hasValue()) { $this->clear( $cookie->getAttribute(CookieInterface::ATTR_DOMAIN), $cookie->getAttribute...
php
public function addCookie(CookieInterface $cookie) { if (!$cookie->hasName() || $this->hasCookie($cookie)) { return; } if (!$cookie->hasValue()) { $this->clear( $cookie->getAttribute(CookieInterface::ATTR_DOMAIN), $cookie->getAttribute...
[ "public", "function", "addCookie", "(", "CookieInterface", "$", "cookie", ")", "{", "if", "(", "!", "$", "cookie", "->", "hasName", "(", ")", "||", "$", "this", "->", "hasCookie", "(", "$", "cookie", ")", ")", "{", "return", ";", "}", "if", "(", "!...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Jar/CookieJar.php#L149-L184
egeloen/ivory-http-adapter
src/Event/Cookie/Jar/CookieJar.php
CookieJar.removeCookie
public function removeCookie(CookieInterface $cookie) { unset($this->cookies[array_search($cookie, $this->cookies, true)]); $this->cookies = array_values($this->cookies); }
php
public function removeCookie(CookieInterface $cookie) { unset($this->cookies[array_search($cookie, $this->cookies, true)]); $this->cookies = array_values($this->cookies); }
[ "public", "function", "removeCookie", "(", "CookieInterface", "$", "cookie", ")", "{", "unset", "(", "$", "this", "->", "cookies", "[", "array_search", "(", "$", "cookie", ",", "$", "this", "->", "cookies", ",", "true", ")", "]", ")", ";", "$", "this",...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Jar/CookieJar.php#L189-L193
egeloen/ivory-http-adapter
src/Event/Cookie/Jar/CookieJar.php
CookieJar.populate
public function populate(InternalRequestInterface $request) { foreach ($this->cookies as $cookie) { if (!$cookie->isExpired() && $cookie->match($request)) { $request = $request->withAddedHeader('Cookie', (string) $cookie); } } return $request; }
php
public function populate(InternalRequestInterface $request) { foreach ($this->cookies as $cookie) { if (!$cookie->isExpired() && $cookie->match($request)) { $request = $request->withAddedHeader('Cookie', (string) $cookie); } } return $request; }
[ "public", "function", "populate", "(", "InternalRequestInterface", "$", "request", ")", "{", "foreach", "(", "$", "this", "->", "cookies", "as", "$", "cookie", ")", "{", "if", "(", "!", "$", "cookie", "->", "isExpired", "(", ")", "&&", "$", "cookie", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Jar/CookieJar.php#L198-L207
egeloen/ivory-http-adapter
src/Event/Cookie/Jar/CookieJar.php
CookieJar.extract
public function extract(InternalRequestInterface $request, ResponseInterface $response) { foreach ($response->getHeader('Set-Cookie') as $header) { $cookie = $this->cookieFactory->parse($header); if (!$cookie->hasAttribute(CookieInterface::ATTR_DOMAIN)) { $cookie->se...
php
public function extract(InternalRequestInterface $request, ResponseInterface $response) { foreach ($response->getHeader('Set-Cookie') as $header) { $cookie = $this->cookieFactory->parse($header); if (!$cookie->hasAttribute(CookieInterface::ATTR_DOMAIN)) { $cookie->se...
[ "public", "function", "extract", "(", "InternalRequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ")", "{", "foreach", "(", "$", "response", "->", "getHeader", "(", "'Set-Cookie'", ")", "as", "$", "header", ")", "{", "$", "cookie", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Jar/CookieJar.php#L212-L223
egeloen/ivory-http-adapter
src/AbstractStreamHttpAdapter.php
AbstractStreamHttpAdapter.sendInternalRequest
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $context = stream_context_create([ 'http' => [ 'follow_location' => false, 'max_redirects' => 1, 'ignore_errors' => true, 'timeout' ...
php
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $context = stream_context_create([ 'http' => [ 'follow_location' => false, 'max_redirects' => 1, 'ignore_errors' => true, 'timeout' ...
[ "protected", "function", "sendInternalRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "$", "context", "=", "stream_context_create", "(", "[", "'http'", "=>", "[", "'follow_location'", "=>", "false", ",", "'max_redirects'", "=>", "1", ","...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/AbstractStreamHttpAdapter.php#L28-L56
egeloen/ivory-http-adapter
src/HttpfulHttpAdapter.php
HttpfulHttpAdapter.sendInternalRequest
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $request = Request::init($internalRequest->getMethod()) ->whenError(function () { }) ->addOnCurlOption(CURLOPT_HTTP_VERSION, $this->prepareProtocolVersion($internalRequest)) ->...
php
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $request = Request::init($internalRequest->getMethod()) ->whenError(function () { }) ->addOnCurlOption(CURLOPT_HTTP_VERSION, $this->prepareProtocolVersion($internalRequest)) ->...
[ "protected", "function", "sendInternalRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "$", "request", "=", "Request", "::", "init", "(", "$", "internalRequest", "->", "getMethod", "(", ")", ")", "->", "whenError", "(", "function", "(...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/HttpfulHttpAdapter.php#L44-L79
egeloen/ivory-http-adapter
src/Event/Cookie/Cookie.php
Cookie.addAttributes
public function addAttributes(array $attributes) { foreach ($attributes as $name => $value) { $this->setAttribute($name, $value); } }
php
public function addAttributes(array $attributes) { foreach ($attributes as $name => $value) { $this->setAttribute($name, $value); } }
[ "public", "function", "addAttributes", "(", "array", "$", "attributes", ")", "{", "foreach", "(", "$", "attributes", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "this", "->", "setAttribute", "(", "$", "name", ",", "$", "value", ")", ";", "}...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Cookie.php#L139-L144
egeloen/ivory-http-adapter
src/Event/Cookie/Cookie.php
Cookie.getAttribute
public function getAttribute($name) { return $this->hasAttribute($name) ? $this->attributes[$this->fixAttribute($name)] : null; }
php
public function getAttribute($name) { return $this->hasAttribute($name) ? $this->attributes[$this->fixAttribute($name)] : null; }
[ "public", "function", "getAttribute", "(", "$", "name", ")", "{", "return", "$", "this", "->", "hasAttribute", "(", "$", "name", ")", "?", "$", "this", "->", "attributes", "[", "$", "this", "->", "fixAttribute", "(", "$", "name", ")", "]", ":", "null...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Cookie.php#L167-L170
egeloen/ivory-http-adapter
src/Event/Cookie/Cookie.php
Cookie.getExpires
public function getExpires() { if ($this->hasAttribute(self::ATTR_EXPIRES)) { return strtotime($this->getAttribute(self::ATTR_EXPIRES)); } if ($this->hasAttribute(self::ATTR_MAX_AGE)) { return $this->createdAt + $this->getAttribute(self::ATTR_MAX_AGE); } ...
php
public function getExpires() { if ($this->hasAttribute(self::ATTR_EXPIRES)) { return strtotime($this->getAttribute(self::ATTR_EXPIRES)); } if ($this->hasAttribute(self::ATTR_MAX_AGE)) { return $this->createdAt + $this->getAttribute(self::ATTR_MAX_AGE); } ...
[ "public", "function", "getExpires", "(", ")", "{", "if", "(", "$", "this", "->", "hasAttribute", "(", "self", "::", "ATTR_EXPIRES", ")", ")", "{", "return", "strtotime", "(", "$", "this", "->", "getAttribute", "(", "self", "::", "ATTR_EXPIRES", ")", ")",...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Cookie.php#L207-L218
egeloen/ivory-http-adapter
src/Event/Cookie/Cookie.php
Cookie.compare
public function compare(CookieInterface $cookie) { return $this->name === $cookie->getName() && $this->getAttribute(self::ATTR_DOMAIN) === $cookie->getAttribute(self::ATTR_DOMAIN) && $this->getAttribute(self::ATTR_PATH) === $cookie->getAttribute(self::ATTR_PATH); }
php
public function compare(CookieInterface $cookie) { return $this->name === $cookie->getName() && $this->getAttribute(self::ATTR_DOMAIN) === $cookie->getAttribute(self::ATTR_DOMAIN) && $this->getAttribute(self::ATTR_PATH) === $cookie->getAttribute(self::ATTR_PATH); }
[ "public", "function", "compare", "(", "CookieInterface", "$", "cookie", ")", "{", "return", "$", "this", "->", "name", "===", "$", "cookie", "->", "getName", "(", ")", "&&", "$", "this", "->", "getAttribute", "(", "self", "::", "ATTR_DOMAIN", ")", "===",...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Cookie.php#L231-L236
egeloen/ivory-http-adapter
src/Event/Cookie/Cookie.php
Cookie.match
public function match(InternalRequestInterface $request) { return $this->matchDomain($request->getUri()->getHost()) && $this->matchPath($request->getUri()->getPath()) && $this->matchScheme($request->getUri()->getScheme()); }
php
public function match(InternalRequestInterface $request) { return $this->matchDomain($request->getUri()->getHost()) && $this->matchPath($request->getUri()->getPath()) && $this->matchScheme($request->getUri()->getScheme()); }
[ "public", "function", "match", "(", "InternalRequestInterface", "$", "request", ")", "{", "return", "$", "this", "->", "matchDomain", "(", "$", "request", "->", "getUri", "(", ")", "->", "getHost", "(", ")", ")", "&&", "$", "this", "->", "matchPath", "("...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Cookie.php#L241-L246
egeloen/ivory-http-adapter
src/Event/Cookie/Cookie.php
Cookie.matchDomain
public function matchDomain($domain) { if (!$this->hasAttribute(self::ATTR_DOMAIN)) { return true; } $cookieDomain = $this->getAttribute(self::ATTR_DOMAIN); if (strpos($cookieDomain, '.') === 0) { return (bool) preg_match('/\b'.preg_quote(substr($cookieDomai...
php
public function matchDomain($domain) { if (!$this->hasAttribute(self::ATTR_DOMAIN)) { return true; } $cookieDomain = $this->getAttribute(self::ATTR_DOMAIN); if (strpos($cookieDomain, '.') === 0) { return (bool) preg_match('/\b'.preg_quote(substr($cookieDomai...
[ "public", "function", "matchDomain", "(", "$", "domain", ")", "{", "if", "(", "!", "$", "this", "->", "hasAttribute", "(", "self", "::", "ATTR_DOMAIN", ")", ")", "{", "return", "true", ";", "}", "$", "cookieDomain", "=", "$", "this", "->", "getAttribut...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Cookie.php#L251-L264
egeloen/ivory-http-adapter
src/Event/Cookie/Cookie.php
Cookie.matchPath
public function matchPath($path) { if (!$this->hasAttribute(self::ATTR_PATH)) { return true; } return strpos($path, $this->getAttribute(self::ATTR_PATH)) === 0; }
php
public function matchPath($path) { if (!$this->hasAttribute(self::ATTR_PATH)) { return true; } return strpos($path, $this->getAttribute(self::ATTR_PATH)) === 0; }
[ "public", "function", "matchPath", "(", "$", "path", ")", "{", "if", "(", "!", "$", "this", "->", "hasAttribute", "(", "self", "::", "ATTR_PATH", ")", ")", "{", "return", "true", ";", "}", "return", "strpos", "(", "$", "path", ",", "$", "this", "->...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Cookie.php#L269-L276
egeloen/ivory-http-adapter
src/Event/Cookie/Cookie.php
Cookie.matchScheme
public function matchScheme($scheme) { if (!$this->hasAttribute(self::ATTR_SECURE)) { return true; } $secure = $this->getAttribute(self::ATTR_SECURE); return ($secure && $scheme === 'https') || (!$secure && ($scheme === 'http' || $scheme === null)); }
php
public function matchScheme($scheme) { if (!$this->hasAttribute(self::ATTR_SECURE)) { return true; } $secure = $this->getAttribute(self::ATTR_SECURE); return ($secure && $scheme === 'https') || (!$secure && ($scheme === 'http' || $scheme === null)); }
[ "public", "function", "matchScheme", "(", "$", "scheme", ")", "{", "if", "(", "!", "$", "this", "->", "hasAttribute", "(", "self", "::", "ATTR_SECURE", ")", ")", "{", "return", "true", ";", "}", "$", "secure", "=", "$", "this", "->", "getAttribute", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cookie/Cookie.php#L281-L290
egeloen/ivory-http-adapter
src/Event/Cache/Adapter/DoctrineCacheAdapter.php
DoctrineCacheAdapter.get
public function get($id) { return $this->has($id) ? $this->cache->fetch($id) : null; }
php
public function get($id) { return $this->has($id) ? $this->cache->fetch($id) : null; }
[ "public", "function", "get", "(", "$", "id", ")", "{", "return", "$", "this", "->", "has", "(", "$", "id", ")", "?", "$", "this", "->", "cache", "->", "fetch", "(", "$", "id", ")", ":", "null", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Cache/Adapter/DoctrineCacheAdapter.php#L45-L48
egeloen/ivory-http-adapter
src/EventDispatcherHttpAdapter.php
EventDispatcherHttpAdapter.doSendInternalRequest
protected function doSendInternalRequest(InternalRequestInterface $internalRequest) { try { $this->eventDispatcher->dispatch( Events::REQUEST_CREATED, $requestCreatedEvent = new RequestCreatedEvent($this, $internalRequest) ); if ($requestC...
php
protected function doSendInternalRequest(InternalRequestInterface $internalRequest) { try { $this->eventDispatcher->dispatch( Events::REQUEST_CREATED, $requestCreatedEvent = new RequestCreatedEvent($this, $internalRequest) ); if ($requestC...
[ "protected", "function", "doSendInternalRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "try", "{", "$", "this", "->", "eventDispatcher", "->", "dispatch", "(", "Events", "::", "REQUEST_CREATED", ",", "$", "requestCreatedEvent", "=", "ne...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/EventDispatcherHttpAdapter.php#L48-L91
egeloen/ivory-http-adapter
src/EventDispatcherHttpAdapter.php
EventDispatcherHttpAdapter.doSendInternalRequests
protected function doSendInternalRequests(array $internalRequests) { $responses = []; $exceptions = []; if (!empty($internalRequests)) { $this->eventDispatcher->dispatch( Events::MULTI_REQUEST_CREATED, $multiRequestCreatedEvent = new MultiRequestC...
php
protected function doSendInternalRequests(array $internalRequests) { $responses = []; $exceptions = []; if (!empty($internalRequests)) { $this->eventDispatcher->dispatch( Events::MULTI_REQUEST_CREATED, $multiRequestCreatedEvent = new MultiRequestC...
[ "protected", "function", "doSendInternalRequests", "(", "array", "$", "internalRequests", ")", "{", "$", "responses", "=", "[", "]", ";", "$", "exceptions", "=", "[", "]", ";", "if", "(", "!", "empty", "(", "$", "internalRequests", ")", ")", "{", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/EventDispatcherHttpAdapter.php#L96-L144
egeloen/ivory-http-adapter
src/Event/Retry/Strategy/AbstractRetryStrategyChain.php
AbstractRetryStrategyChain.verify
public function verify(InternalRequestInterface $request) { $verify = $this->doVerify($request); if ($verify && $this->hasNext()) { return $this->next->verify($request); } return $verify; }
php
public function verify(InternalRequestInterface $request) { $verify = $this->doVerify($request); if ($verify && $this->hasNext()) { return $this->next->verify($request); } return $verify; }
[ "public", "function", "verify", "(", "InternalRequestInterface", "$", "request", ")", "{", "$", "verify", "=", "$", "this", "->", "doVerify", "(", "$", "request", ")", ";", "if", "(", "$", "verify", "&&", "$", "this", "->", "hasNext", "(", ")", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Retry/Strategy/AbstractRetryStrategyChain.php#L61-L70
egeloen/ivory-http-adapter
src/Event/Retry/Strategy/AbstractRetryStrategyChain.php
AbstractRetryStrategyChain.delay
public function delay(InternalRequestInterface $request) { $delay = $this->doDelay($request); if ($this->hasNext() && (($nextDelay = $this->next->delay($request)) > $delay)) { return $nextDelay; } return $delay; }
php
public function delay(InternalRequestInterface $request) { $delay = $this->doDelay($request); if ($this->hasNext() && (($nextDelay = $this->next->delay($request)) > $delay)) { return $nextDelay; } return $delay; }
[ "public", "function", "delay", "(", "InternalRequestInterface", "$", "request", ")", "{", "$", "delay", "=", "$", "this", "->", "doDelay", "(", "$", "request", ")", ";", "if", "(", "$", "this", "->", "hasNext", "(", ")", "&&", "(", "(", "$", "nextDel...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Retry/Strategy/AbstractRetryStrategyChain.php#L75-L84
egeloen/ivory-http-adapter
src/AbstractCurlHttpAdapter.php
AbstractCurlHttpAdapter.prepareContent
protected function prepareContent(InternalRequestInterface $internalRequest) { $files = $internalRequest->getFiles(); if (empty($files)) { return $this->prepareBody($internalRequest); } $content = []; foreach ($internalRequest->getDatas() as $name => $data) { ...
php
protected function prepareContent(InternalRequestInterface $internalRequest) { $files = $internalRequest->getFiles(); if (empty($files)) { return $this->prepareBody($internalRequest); } $content = []; foreach ($internalRequest->getDatas() as $name => $data) { ...
[ "protected", "function", "prepareContent", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "$", "files", "=", "$", "internalRequest", "->", "getFiles", "(", ")", ";", "if", "(", "empty", "(", "$", "files", ")", ")", "{", "return", "$", "...
@param InternalRequestInterface $internalRequest @return array|string
[ "@param", "InternalRequestInterface", "$internalRequest" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/AbstractCurlHttpAdapter.php#L53-L72
egeloen/ivory-http-adapter
src/AbstractCurlHttpAdapter.php
AbstractCurlHttpAdapter.prepareRawContent
private function prepareRawContent($name, $data, $isFile = false) { if (is_array($data)) { $preparedData = []; foreach ($data as $subName => $subData) { $preparedData = array_merge( $preparedData, $this->prepareRawContent($this...
php
private function prepareRawContent($name, $data, $isFile = false) { if (is_array($data)) { $preparedData = []; foreach ($data as $subName => $subData) { $preparedData = array_merge( $preparedData, $this->prepareRawContent($this...
[ "private", "function", "prepareRawContent", "(", "$", "name", ",", "$", "data", ",", "$", "isFile", "=", "false", ")", "{", "if", "(", "is_array", "(", "$", "data", ")", ")", "{", "$", "preparedData", "=", "[", "]", ";", "foreach", "(", "$", "data"...
@param string $name @param array|string $data @param bool $isFile @return array
[ "@param", "string", "$name", "@param", "array|string", "$data", "@param", "bool", "$isFile" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/AbstractCurlHttpAdapter.php#L99-L115
egeloen/ivory-http-adapter
src/Zend2HttpAdapter.php
Zend2HttpAdapter.sendInternalRequest
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $this->client ->resetParameters(true) ->setOptions([ 'httpversion' => $internalRequest->getProtocolVersion(), 'timeout' => $this->getConfiguration()->getTimeout()...
php
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { $this->client ->resetParameters(true) ->setOptions([ 'httpversion' => $internalRequest->getProtocolVersion(), 'timeout' => $this->getConfiguration()->getTimeout()...
[ "protected", "function", "sendInternalRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "$", "this", "->", "client", "->", "resetParameters", "(", "true", ")", "->", "setOptions", "(", "[", "'httpversion'", "=>", "$", "internalRequest", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Zend2HttpAdapter.php#L51-L82
egeloen/ivory-http-adapter
src/Guzzle4HttpAdapter.php
Guzzle4HttpAdapter.sendInternalRequest
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { try { $response = $this->client->send($this->createRequest($internalRequest)); } catch (RequestException $e) { throw HttpAdapterException::cannotFetchUri( $e->getRequest()->get...
php
protected function sendInternalRequest(InternalRequestInterface $internalRequest) { try { $response = $this->client->send($this->createRequest($internalRequest)); } catch (RequestException $e) { throw HttpAdapterException::cannotFetchUri( $e->getRequest()->get...
[ "protected", "function", "sendInternalRequest", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "try", "{", "$", "response", "=", "$", "this", "->", "client", "->", "send", "(", "$", "this", "->", "createRequest", "(", "$", "internalRequest", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Guzzle4HttpAdapter.php#L56-L79
egeloen/ivory-http-adapter
src/Guzzle4HttpAdapter.php
Guzzle4HttpAdapter.sendInternalRequests
protected function sendInternalRequests(array $internalRequests, $success, $error) { $requests = []; foreach ($internalRequests as $internalRequest) { $requests[] = $this->createRequest($internalRequest, $success, $error); } class_exists('GuzzleHttp\Pool') ? ...
php
protected function sendInternalRequests(array $internalRequests, $success, $error) { $requests = []; foreach ($internalRequests as $internalRequest) { $requests[] = $this->createRequest($internalRequest, $success, $error); } class_exists('GuzzleHttp\Pool') ? ...
[ "protected", "function", "sendInternalRequests", "(", "array", "$", "internalRequests", ",", "$", "success", ",", "$", "error", ")", "{", "$", "requests", "=", "[", "]", ";", "foreach", "(", "$", "internalRequests", "as", "$", "internalRequest", ")", "{", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Guzzle4HttpAdapter.php#L84-L94
egeloen/ivory-http-adapter
src/Guzzle4HttpAdapter.php
Guzzle4HttpAdapter.createRequest
private function createRequest(InternalRequestInterface $internalRequest, $success = null, $error = null) { $request = $this->client->createRequest( $internalRequest->getMethod(), (string) $internalRequest->getUri(), [ 'exceptions' => false, ...
php
private function createRequest(InternalRequestInterface $internalRequest, $success = null, $error = null) { $request = $this->client->createRequest( $internalRequest->getMethod(), (string) $internalRequest->getUri(), [ 'exceptions' => false, ...
[ "private", "function", "createRequest", "(", "InternalRequestInterface", "$", "internalRequest", ",", "$", "success", "=", "null", ",", "$", "error", "=", "null", ")", "{", "$", "request", "=", "$", "this", "->", "client", "->", "createRequest", "(", "$", ...
@param InternalRequestInterface $internalRequest @param callable|null $success @param callable|null $error @return RequestInterface the request
[ "@param", "InternalRequestInterface", "$internalRequest", "@param", "callable|null", "$success", "@param", "callable|null", "$error" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Guzzle4HttpAdapter.php#L111-L169
egeloen/ivory-http-adapter
src/Event/Timer/Timer.php
Timer.start
public function start(InternalRequestInterface $internalRequest) { return $internalRequest ->withParameter(self::START_TIME, $this->getTime()) ->withoutParameter(self::TIME); }
php
public function start(InternalRequestInterface $internalRequest) { return $internalRequest ->withParameter(self::START_TIME, $this->getTime()) ->withoutParameter(self::TIME); }
[ "public", "function", "start", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "return", "$", "internalRequest", "->", "withParameter", "(", "self", "::", "START_TIME", ",", "$", "this", "->", "getTime", "(", ")", ")", "->", "withoutParameter"...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Timer/Timer.php#L24-L29
egeloen/ivory-http-adapter
src/Event/Timer/Timer.php
Timer.stop
public function stop(InternalRequestInterface $internalRequest) { if ($internalRequest->hasParameter(self::START_TIME) && !$internalRequest->hasParameter(self::TIME)) { return $internalRequest->withParameter( self::TIME, $this->getTime() - $internalRequest->getPar...
php
public function stop(InternalRequestInterface $internalRequest) { if ($internalRequest->hasParameter(self::START_TIME) && !$internalRequest->hasParameter(self::TIME)) { return $internalRequest->withParameter( self::TIME, $this->getTime() - $internalRequest->getPar...
[ "public", "function", "stop", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "if", "(", "$", "internalRequest", "->", "hasParameter", "(", "self", "::", "START_TIME", ")", "&&", "!", "$", "internalRequest", "->", "hasParameter", "(", "self", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Timer/Timer.php#L34-L44
egeloen/ivory-http-adapter
src/Event/Retry/Strategy/CallbackRetryStrategy.php
CallbackRetryStrategy.doVerify
protected function doVerify(InternalRequestInterface $request) { if ($this->hasVerifyCallback()) { return call_user_func($this->verifyCallback, $request); } return parent::doVerify($request); }
php
protected function doVerify(InternalRequestInterface $request) { if ($this->hasVerifyCallback()) { return call_user_func($this->verifyCallback, $request); } return parent::doVerify($request); }
[ "protected", "function", "doVerify", "(", "InternalRequestInterface", "$", "request", ")", "{", "if", "(", "$", "this", "->", "hasVerifyCallback", "(", ")", ")", "{", "return", "call_user_func", "(", "$", "this", "->", "verifyCallback", ",", "$", "request", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Retry/Strategy/CallbackRetryStrategy.php#L95-L102
egeloen/ivory-http-adapter
src/Event/Retry/Strategy/CallbackRetryStrategy.php
CallbackRetryStrategy.doDelay
protected function doDelay(InternalRequestInterface $request) { if ($this->hasDelayCallback()) { return call_user_func($this->delayCallback, $request); } return parent::doDelay($request); }
php
protected function doDelay(InternalRequestInterface $request) { if ($this->hasDelayCallback()) { return call_user_func($this->delayCallback, $request); } return parent::doDelay($request); }
[ "protected", "function", "doDelay", "(", "InternalRequestInterface", "$", "request", ")", "{", "if", "(", "$", "this", "->", "hasDelayCallback", "(", ")", ")", "{", "return", "call_user_func", "(", "$", "this", "->", "delayCallback", ",", "$", "request", ")"...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Retry/Strategy/CallbackRetryStrategy.php#L107-L114
egeloen/ivory-http-adapter
src/Message/InternalRequest.php
InternalRequest.withAddedData
public function withAddedData($name, $value) { $new = clone $this; $new->datas[$name] = $new->hasData($name) ? array_merge((array) $new->datas[$name], (array) $value) : $value; return $new; }
php
public function withAddedData($name, $value) { $new = clone $this; $new->datas[$name] = $new->hasData($name) ? array_merge((array) $new->datas[$name], (array) $value) : $value; return $new; }
[ "public", "function", "withAddedData", "(", "$", "name", ",", "$", "value", ")", "{", "$", "new", "=", "clone", "$", "this", ";", "$", "new", "->", "datas", "[", "$", "name", "]", "=", "$", "new", "->", "hasData", "(", "$", "name", ")", "?", "a...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Message/InternalRequest.php#L94-L102
egeloen/ivory-http-adapter
src/Message/InternalRequest.php
InternalRequest.withAddedFile
public function withAddedFile($name, $file) { $new = clone $this; $new->files[$name] = $new->hasFile($name) ? array_merge((array) $new->files[$name], (array) $file) : $file; return $new; }
php
public function withAddedFile($name, $file) { $new = clone $this; $new->files[$name] = $new->hasFile($name) ? array_merge((array) $new->files[$name], (array) $file) : $file; return $new; }
[ "public", "function", "withAddedFile", "(", "$", "name", ",", "$", "file", ")", "{", "$", "new", "=", "clone", "$", "this", ";", "$", "new", "->", "files", "[", "$", "name", "]", "=", "$", "new", "->", "hasFile", "(", "$", "name", ")", "?", "ar...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Message/InternalRequest.php#L153-L161
egeloen/ivory-http-adapter
src/Event/Formatter/Formatter.php
Formatter.formatRequest
public function formatRequest(InternalRequestInterface $request) { return [ 'protocol_version' => $request->getProtocolVersion(), 'uri' => (string) $request->getUri(), 'method' => $request->getMethod(), 'headers' => $request->ge...
php
public function formatRequest(InternalRequestInterface $request) { return [ 'protocol_version' => $request->getProtocolVersion(), 'uri' => (string) $request->getUri(), 'method' => $request->getMethod(), 'headers' => $request->ge...
[ "public", "function", "formatRequest", "(", "InternalRequestInterface", "$", "request", ")", "{", "return", "[", "'protocol_version'", "=>", "$", "request", "->", "getProtocolVersion", "(", ")", ",", "'uri'", "=>", "(", "string", ")", "$", "request", "->", "ge...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Formatter/Formatter.php#L26-L38
egeloen/ivory-http-adapter
src/Event/Formatter/Formatter.php
Formatter.formatResponse
public function formatResponse(ResponseInterface $response) { return [ 'protocol_version' => $response->getProtocolVersion(), 'status_code' => $response->getStatusCode(), 'reason_phrase' => $response->getReasonPhrase(), 'headers' => $response-...
php
public function formatResponse(ResponseInterface $response) { return [ 'protocol_version' => $response->getProtocolVersion(), 'status_code' => $response->getStatusCode(), 'reason_phrase' => $response->getReasonPhrase(), 'headers' => $response-...
[ "public", "function", "formatResponse", "(", "ResponseInterface", "$", "response", ")", "{", "return", "[", "'protocol_version'", "=>", "$", "response", "->", "getProtocolVersion", "(", ")", ",", "'status_code'", "=>", "$", "response", "->", "getStatusCode", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Formatter/Formatter.php#L43-L53
egeloen/ivory-http-adapter
src/Event/Formatter/Formatter.php
Formatter.formatException
public function formatException(HttpAdapterException $exception) { return [ 'code' => $exception->getCode(), 'message' => $exception->getMessage(), 'line' => $exception->getLine(), 'file' => $exception->getFile(), ]; }
php
public function formatException(HttpAdapterException $exception) { return [ 'code' => $exception->getCode(), 'message' => $exception->getMessage(), 'line' => $exception->getLine(), 'file' => $exception->getFile(), ]; }
[ "public", "function", "formatException", "(", "HttpAdapterException", "$", "exception", ")", "{", "return", "[", "'code'", "=>", "$", "exception", "->", "getCode", "(", ")", ",", "'message'", "=>", "$", "exception", "->", "getMessage", "(", ")", ",", "'line'...
{@inheritdoc}
[ "{" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Formatter/Formatter.php#L58-L66
egeloen/ivory-http-adapter
src/HttpAdapterException.php
HttpAdapterException.maxRedirectsExceeded
public static function maxRedirectsExceeded($uri, $maxRedirects, $adapter) { return self::cannotFetchUri($uri, $adapter, sprintf('Max redirects exceeded (%d)', $maxRedirects)); }
php
public static function maxRedirectsExceeded($uri, $maxRedirects, $adapter) { return self::cannotFetchUri($uri, $adapter, sprintf('Max redirects exceeded (%d)', $maxRedirects)); }
[ "public", "static", "function", "maxRedirectsExceeded", "(", "$", "uri", ",", "$", "maxRedirects", ",", "$", "adapter", ")", "{", "return", "self", "::", "cannotFetchUri", "(", "$", "uri", ",", "$", "adapter", ",", "sprintf", "(", "'Max redirects exceeded (%d)...
@param string $uri @param int $maxRedirects @param string $adapter @return HttpAdapterException
[ "@param", "string", "$uri", "@param", "int", "$maxRedirects", "@param", "string", "$adapter" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/HttpAdapterException.php#L184-L187
egeloen/ivory-http-adapter
src/HttpAdapterException.php
HttpAdapterException.requestIsNotValid
public static function requestIsNotValid($request) { return new self(sprintf( 'The request must be a string, an array or implement "Psr\Http\Message\RequestInterface" ("%s" given).', is_object($request) ? get_class($request) : gettype($request) )); }
php
public static function requestIsNotValid($request) { return new self(sprintf( 'The request must be a string, an array or implement "Psr\Http\Message\RequestInterface" ("%s" given).', is_object($request) ? get_class($request) : gettype($request) )); }
[ "public", "static", "function", "requestIsNotValid", "(", "$", "request", ")", "{", "return", "new", "self", "(", "sprintf", "(", "'The request must be a string, an array or implement \"Psr\\Http\\Message\\RequestInterface\" (\"%s\" given).'", ",", "is_object", "(", "$", "req...
@param mixed $request @return HttpAdapterException
[ "@param", "mixed", "$request" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/HttpAdapterException.php#L194-L200
egeloen/ivory-http-adapter
src/HttpAdapterException.php
HttpAdapterException.streamIsNotValid
public static function streamIsNotValid($stream, $wrapper, $expected) { return new self(sprintf( 'The stream "%s" only accepts a "%s" (current: "%s")', $wrapper, $expected, is_object($stream) ? get_class($stream) : gettype($stream) )); }
php
public static function streamIsNotValid($stream, $wrapper, $expected) { return new self(sprintf( 'The stream "%s" only accepts a "%s" (current: "%s")', $wrapper, $expected, is_object($stream) ? get_class($stream) : gettype($stream) )); }
[ "public", "static", "function", "streamIsNotValid", "(", "$", "stream", ",", "$", "wrapper", ",", "$", "expected", ")", "{", "return", "new", "self", "(", "sprintf", "(", "'The stream \"%s\" only accepts a \"%s\" (current: \"%s\")'", ",", "$", "wrapper", ",", "$",...
@param mixed $stream @param string $wrapper @param string $expected @return HttpAdapterException
[ "@param", "mixed", "$stream", "@param", "string", "$wrapper", "@param", "string", "$expected" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/HttpAdapterException.php#L209-L217
egeloen/ivory-http-adapter
src/HttpAdapterException.php
HttpAdapterException.timeoutExceeded
public static function timeoutExceeded($uri, $timeout, $adapter) { return self::cannotFetchUri($uri, $adapter, sprintf('Timeout exceeded (%.2f)', $timeout)); }
php
public static function timeoutExceeded($uri, $timeout, $adapter) { return self::cannotFetchUri($uri, $adapter, sprintf('Timeout exceeded (%.2f)', $timeout)); }
[ "public", "static", "function", "timeoutExceeded", "(", "$", "uri", ",", "$", "timeout", ",", "$", "adapter", ")", "{", "return", "self", "::", "cannotFetchUri", "(", "$", "uri", ",", "$", "adapter", ",", "sprintf", "(", "'Timeout exceeded (%.2f)'", ",", "...
@param string $uri @param float $timeout @param string $adapter @return HttpAdapterException
[ "@param", "string", "$uri", "@param", "float", "$timeout", "@param", "string", "$adapter" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/HttpAdapterException.php#L226-L229
egeloen/ivory-http-adapter
src/Event/Subscriber/HistorySubscriber.php
HistorySubscriber.record
private function record(InternalRequestInterface $internalRequest, ResponseInterface $response) { $internalRequest = $this->getTimer()->stop($internalRequest); $this->journal->record($internalRequest, $response); return $internalRequest; }
php
private function record(InternalRequestInterface $internalRequest, ResponseInterface $response) { $internalRequest = $this->getTimer()->stop($internalRequest); $this->journal->record($internalRequest, $response); return $internalRequest; }
[ "private", "function", "record", "(", "InternalRequestInterface", "$", "internalRequest", ",", "ResponseInterface", "$", "response", ")", "{", "$", "internalRequest", "=", "$", "this", "->", "getTimer", "(", ")", "->", "stop", "(", "$", "internalRequest", ")", ...
@param InternalRequestInterface $internalRequest @param ResponseInterface $response @return InternalRequestInterface
[ "@param", "InternalRequestInterface", "$internalRequest", "@param", "ResponseInterface", "$response" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Subscriber/HistorySubscriber.php#L113-L119
egeloen/ivory-http-adapter
src/AbstractHttpAdapter.php
AbstractHttpAdapter.prepareHeaders
protected function prepareHeaders( InternalRequestInterface &$internalRequest, $associative = true, $contentType = true, $contentLength = false ) { if (!$internalRequest->hasHeader('Connection')) { $internalRequest = $internalRequest->withHeader( '...
php
protected function prepareHeaders( InternalRequestInterface &$internalRequest, $associative = true, $contentType = true, $contentLength = false ) { if (!$internalRequest->hasHeader('Connection')) { $internalRequest = $internalRequest->withHeader( '...
[ "protected", "function", "prepareHeaders", "(", "InternalRequestInterface", "&", "$", "internalRequest", ",", "$", "associative", "=", "true", ",", "$", "contentType", "=", "true", ",", "$", "contentLength", "=", "false", ")", "{", "if", "(", "!", "$", "inte...
@param InternalRequestInterface $internalRequest @param bool $associative @param bool $contentType @param bool $contentLength @return array the prepared headers
[ "@param", "InternalRequestInterface", "$internalRequest", "@param", "bool", "$associative", "@param", "bool", "$contentType", "@param", "bool", "$contentLength" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/AbstractHttpAdapter.php#L61-L107
egeloen/ivory-http-adapter
src/AbstractHttpAdapter.php
AbstractHttpAdapter.prepareBody
protected function prepareBody(InternalRequestInterface $internalRequest) { $body = (string) $internalRequest->getBody(); if (!empty($body)) { return $body; } $files = $internalRequest->getFiles(); if (empty($files)) { return http_build_query($inter...
php
protected function prepareBody(InternalRequestInterface $internalRequest) { $body = (string) $internalRequest->getBody(); if (!empty($body)) { return $body; } $files = $internalRequest->getFiles(); if (empty($files)) { return http_build_query($inter...
[ "protected", "function", "prepareBody", "(", "InternalRequestInterface", "$", "internalRequest", ")", "{", "$", "body", "=", "(", "string", ")", "$", "internalRequest", "->", "getBody", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "body", ")", ")", ...
@param InternalRequestInterface $internalRequest @return string
[ "@param", "InternalRequestInterface", "$internalRequest" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/AbstractHttpAdapter.php#L114-L141
egeloen/ivory-http-adapter
src/AbstractHttpAdapter.php
AbstractHttpAdapter.prepareRawBody
private function prepareRawBody($name, $data, $isFile = false) { if (is_array($data)) { $body = ''; foreach ($data as $subName => $subData) { $body .= $this->prepareRawBody($this->prepareName($name, $subName), $subData, $isFile); } return $bo...
php
private function prepareRawBody($name, $data, $isFile = false) { if (is_array($data)) { $body = ''; foreach ($data as $subName => $subData) { $body .= $this->prepareRawBody($this->prepareName($name, $subName), $subData, $isFile); } return $bo...
[ "private", "function", "prepareRawBody", "(", "$", "name", ",", "$", "data", ",", "$", "isFile", "=", "false", ")", "{", "if", "(", "is_array", "(", "$", "data", ")", ")", "{", "$", "body", "=", "''", ";", "foreach", "(", "$", "data", "as", "$", ...
@param string $name @param array|string $data @param bool $isFile @return string
[ "@param", "string", "$name", "@param", "array|string", "$data", "@param", "bool", "$isFile" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/AbstractHttpAdapter.php#L161-L181
egeloen/ivory-http-adapter
src/HttpAdapterTrait.php
HttpAdapterTrait.post
public function post($uri, array $headers = [], $datas = [], array $files = []) { return $this->send($uri, InternalRequestInterface::METHOD_POST, $headers, $datas, $files); }
php
public function post($uri, array $headers = [], $datas = [], array $files = []) { return $this->send($uri, InternalRequestInterface::METHOD_POST, $headers, $datas, $files); }
[ "public", "function", "post", "(", "$", "uri", ",", "array", "$", "headers", "=", "[", "]", ",", "$", "datas", "=", "[", "]", ",", "array", "$", "files", "=", "[", "]", ")", "{", "return", "$", "this", "->", "send", "(", "$", "uri", ",", "Int...
@param string|object $uri @param array $headers @param array|string $datas @param array $files @throws HttpAdapterException @return ResponseInterface
[ "@param", "string|object", "$uri", "@param", "array", "$headers", "@param", "array|string", "$datas", "@param", "array", "$files" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/HttpAdapterTrait.php#L72-L75
egeloen/ivory-http-adapter
src/HttpAdapterTrait.php
HttpAdapterTrait.put
public function put($uri, array $headers = [], $datas = [], array $files = []) { return $this->send($uri, InternalRequestInterface::METHOD_PUT, $headers, $datas, $files); }
php
public function put($uri, array $headers = [], $datas = [], array $files = []) { return $this->send($uri, InternalRequestInterface::METHOD_PUT, $headers, $datas, $files); }
[ "public", "function", "put", "(", "$", "uri", ",", "array", "$", "headers", "=", "[", "]", ",", "$", "datas", "=", "[", "]", ",", "array", "$", "files", "=", "[", "]", ")", "{", "return", "$", "this", "->", "send", "(", "$", "uri", ",", "Inte...
@param string|object $uri @param array $headers @param array|string $datas @param array $files @throws HttpAdapterException @return ResponseInterface
[ "@param", "string|object", "$uri", "@param", "array", "$headers", "@param", "array|string", "$datas", "@param", "array", "$files" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/HttpAdapterTrait.php#L87-L90
egeloen/ivory-http-adapter
src/HttpAdapterTrait.php
HttpAdapterTrait.patch
public function patch($uri, array $headers = [], $datas = [], array $files = []) { return $this->send($uri, InternalRequestInterface::METHOD_PATCH, $headers, $datas, $files); }
php
public function patch($uri, array $headers = [], $datas = [], array $files = []) { return $this->send($uri, InternalRequestInterface::METHOD_PATCH, $headers, $datas, $files); }
[ "public", "function", "patch", "(", "$", "uri", ",", "array", "$", "headers", "=", "[", "]", ",", "$", "datas", "=", "[", "]", ",", "array", "$", "files", "=", "[", "]", ")", "{", "return", "$", "this", "->", "send", "(", "$", "uri", ",", "In...
@param string|object $uri @param array $headers @param array|string $datas @param array $files @throws HttpAdapterException @return ResponseInterface
[ "@param", "string|object", "$uri", "@param", "array", "$headers", "@param", "array|string", "$datas", "@param", "array", "$files" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/HttpAdapterTrait.php#L102-L105
egeloen/ivory-http-adapter
src/HttpAdapterTrait.php
HttpAdapterTrait.delete
public function delete($uri, array $headers = [], $datas = [], array $files = []) { return $this->send($uri, InternalRequestInterface::METHOD_DELETE, $headers, $datas, $files); }
php
public function delete($uri, array $headers = [], $datas = [], array $files = []) { return $this->send($uri, InternalRequestInterface::METHOD_DELETE, $headers, $datas, $files); }
[ "public", "function", "delete", "(", "$", "uri", ",", "array", "$", "headers", "=", "[", "]", ",", "$", "datas", "=", "[", "]", ",", "array", "$", "files", "=", "[", "]", ")", "{", "return", "$", "this", "->", "send", "(", "$", "uri", ",", "I...
@param string|object $uri @param array $headers @param array|string $datas @param array $files @throws HttpAdapterException @return ResponseInterface
[ "@param", "string|object", "$uri", "@param", "array", "$headers", "@param", "array|string", "$datas", "@param", "array", "$files" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/HttpAdapterTrait.php#L117-L120
egeloen/ivory-http-adapter
src/HttpAdapterTrait.php
HttpAdapterTrait.options
public function options($uri, array $headers = [], $datas = [], array $files = []) { return $this->send($uri, InternalRequestInterface::METHOD_OPTIONS, $headers, $datas, $files); }
php
public function options($uri, array $headers = [], $datas = [], array $files = []) { return $this->send($uri, InternalRequestInterface::METHOD_OPTIONS, $headers, $datas, $files); }
[ "public", "function", "options", "(", "$", "uri", ",", "array", "$", "headers", "=", "[", "]", ",", "$", "datas", "=", "[", "]", ",", "array", "$", "files", "=", "[", "]", ")", "{", "return", "$", "this", "->", "send", "(", "$", "uri", ",", "...
@param string|object $uri @param array $headers @param array|string $datas @param array $files @throws HttpAdapterException @return ResponseInterface
[ "@param", "string|object", "$uri", "@param", "array", "$headers", "@param", "array|string", "$datas", "@param", "array", "$files" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/HttpAdapterTrait.php#L132-L135
egeloen/ivory-http-adapter
src/HttpAdapterTrait.php
HttpAdapterTrait.send
public function send($uri, $method, array $headers = [], $datas = [], array $files = []) { return $this->sendRequest($this->getConfiguration()->getMessageFactory()->createInternalRequest( $uri, $method, $this->getConfiguration()->getProtocolVersion(), $headers...
php
public function send($uri, $method, array $headers = [], $datas = [], array $files = []) { return $this->sendRequest($this->getConfiguration()->getMessageFactory()->createInternalRequest( $uri, $method, $this->getConfiguration()->getProtocolVersion(), $headers...
[ "public", "function", "send", "(", "$", "uri", ",", "$", "method", ",", "array", "$", "headers", "=", "[", "]", ",", "$", "datas", "=", "[", "]", ",", "array", "$", "files", "=", "[", "]", ")", "{", "return", "$", "this", "->", "sendRequest", "...
@param string|object $uri @param string $method @param array $headers @param array|string $datas @param array $files @throws HttpAdapterException @return ResponseInterface
[ "@param", "string|object", "$uri", "@param", "string", "$method", "@param", "array", "$headers", "@param", "array|string", "$datas", "@param", "array", "$files" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/HttpAdapterTrait.php#L148-L158
egeloen/ivory-http-adapter
src/HttpAdapterTrait.php
HttpAdapterTrait.sendRequest
public function sendRequest(RequestInterface $request) { if ($request instanceof InternalRequestInterface) { return $this->sendInternalRequest($request); } $protocolVersion = $this->getConfiguration()->getProtocolVersion(); $this->getConfiguration()->setProtocolVersion($...
php
public function sendRequest(RequestInterface $request) { if ($request instanceof InternalRequestInterface) { return $this->sendInternalRequest($request); } $protocolVersion = $this->getConfiguration()->getProtocolVersion(); $this->getConfiguration()->setProtocolVersion($...
[ "public", "function", "sendRequest", "(", "RequestInterface", "$", "request", ")", "{", "if", "(", "$", "request", "instanceof", "InternalRequestInterface", ")", "{", "return", "$", "this", "->", "sendInternalRequest", "(", "$", "request", ")", ";", "}", "$", ...
@param RequestInterface $request @throws HttpAdapterException @return ResponseInterface
[ "@param", "RequestInterface", "$request" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/HttpAdapterTrait.php#L167-L186
egeloen/ivory-http-adapter
src/HttpAdapterTrait.php
HttpAdapterTrait.sendRequests
public function sendRequests(array $requests) { $responses = $exceptions = []; foreach ($requests as $index => &$request) { if (is_string($request)) { $request = [$request]; } if (is_array($request)) { $request = call_user_func_ar...
php
public function sendRequests(array $requests) { $responses = $exceptions = []; foreach ($requests as $index => &$request) { if (is_string($request)) { $request = [$request]; } if (is_array($request)) { $request = call_user_func_ar...
[ "public", "function", "sendRequests", "(", "array", "$", "requests", ")", "{", "$", "responses", "=", "$", "exceptions", "=", "[", "]", ";", "foreach", "(", "$", "requests", "as", "$", "index", "=>", "&", "$", "request", ")", "{", "if", "(", "is_stri...
@param array $requests @throws MultiHttpAdapterException @return array
[ "@param", "array", "$requests" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/HttpAdapterTrait.php#L195-L240
egeloen/ivory-http-adapter
src/HttpAdapterTrait.php
HttpAdapterTrait.sendInternalRequests
protected function sendInternalRequests(array $internalRequests, $success, $error) { foreach ($internalRequests as $internalRequest) { try { $response = $this->sendInternalRequest($internalRequest); $response = $response->withParameter('request', $internalRequest)...
php
protected function sendInternalRequests(array $internalRequests, $success, $error) { foreach ($internalRequests as $internalRequest) { try { $response = $this->sendInternalRequest($internalRequest); $response = $response->withParameter('request', $internalRequest)...
[ "protected", "function", "sendInternalRequests", "(", "array", "$", "internalRequests", ",", "$", "success", ",", "$", "error", ")", "{", "foreach", "(", "$", "internalRequests", "as", "$", "internalRequest", ")", "{", "try", "{", "$", "response", "=", "$", ...
@param array $internalRequests @param callable $success @param callable $error @throws MultiHttpAdapterException @return array
[ "@param", "array", "$internalRequests", "@param", "callable", "$success", "@param", "callable", "$error" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/HttpAdapterTrait.php#L260-L273
egeloen/ivory-http-adapter
src/Event/Subscriber/StatusCodeSubscriber.php
StatusCodeSubscriber.createStatusCodeException
private function createStatusCodeException( ResponseInterface $response, InternalRequestInterface $internalRequest, HttpAdapterInterface $httpAdapter ) { $exception = HttpAdapterException::cannotFetchUri( (string) $internalRequest->getUri(), $httpAdapter->getN...
php
private function createStatusCodeException( ResponseInterface $response, InternalRequestInterface $internalRequest, HttpAdapterInterface $httpAdapter ) { $exception = HttpAdapterException::cannotFetchUri( (string) $internalRequest->getUri(), $httpAdapter->getN...
[ "private", "function", "createStatusCodeException", "(", "ResponseInterface", "$", "response", ",", "InternalRequestInterface", "$", "internalRequest", ",", "HttpAdapterInterface", "$", "httpAdapter", ")", "{", "$", "exception", "=", "HttpAdapterException", "::", "cannotF...
@param ResponseInterface $response @param InternalRequestInterface $internalRequest @param HttpAdapterInterface $httpAdapter @return HttpAdapterException
[ "@param", "ResponseInterface", "$response", "@param", "InternalRequestInterface", "$internalRequest", "@param", "HttpAdapterInterface", "$httpAdapter" ]
train
https://github.com/egeloen/ivory-http-adapter/blob/2387f532049d8c6c439e68097abc6f7b33f027a4/src/Event/Subscriber/StatusCodeSubscriber.php#L101-L116
multidots/cakephp-rest-api
src/View/ApiView.php
ApiView.render
public function render($view = null, $layout = null) { if ($this->hasRendered) { return null; } $this->layout = "RestApi.{$this->_responseLayout}"; $this->Blocks->set('content', $this->renderLayout('', $this->layout)); $this->hasRendered = true; return...
php
public function render($view = null, $layout = null) { if ($this->hasRendered) { return null; } $this->layout = "RestApi.{$this->_responseLayout}"; $this->Blocks->set('content', $this->renderLayout('', $this->layout)); $this->hasRendered = true; return...
[ "public", "function", "render", "(", "$", "view", "=", "null", ",", "$", "layout", "=", "null", ")", "{", "if", "(", "$", "this", "->", "hasRendered", ")", "{", "return", "null", ";", "}", "$", "this", "->", "layout", "=", "\"RestApi.{$this->_responseL...
Renders api response @param string|null $view Name of view file to use @param string|null $layout Layout to use. @return string|null Rendered content or null if content already rendered and returned earlier. @throws Exception If there is an error in the view.
[ "Renders", "api", "response" ]
train
https://github.com/multidots/cakephp-rest-api/blob/6c2a73bbe3073c58ade3f24cd015dd58e71ebd50/src/View/ApiView.php#L49-L62
multidots/cakephp-rest-api
src/Controller/Component/AccessControlComponent.php
AccessControlComponent._performTokenValidation
protected function _performTokenValidation(Event $event) { $request = $event->getSubject()->request; if (!empty($request->getParam('allowWithoutToken')) && $request->getParam('allowWithoutToken')) { return true; } $token = ''; $header = $request->getHeader('Aut...
php
protected function _performTokenValidation(Event $event) { $request = $event->getSubject()->request; if (!empty($request->getParam('allowWithoutToken')) && $request->getParam('allowWithoutToken')) { return true; } $token = ''; $header = $request->getHeader('Aut...
[ "protected", "function", "_performTokenValidation", "(", "Event", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getSubject", "(", ")", "->", "request", ";", "if", "(", "!", "empty", "(", "$", "request", "->", "getParam", "(", "'allowW...
Performs token validation. @param Event $event The startup event @return bool @throws UnauthorizedException If missing or invalid token
[ "Performs", "token", "validation", "." ]
train
https://github.com/multidots/cakephp-rest-api/blob/6c2a73bbe3073c58ade3f24cd015dd58e71ebd50/src/Controller/Component/AccessControlComponent.php#L47-L94
multidots/cakephp-rest-api
src/Event/ApiRequestHandler.php
ApiRequestHandler.beforeDispatch
public function beforeDispatch(Event $event) { $this->buildResponse($event); Configure::write('requestLogged', false); $request = $event->getData()['request']; if ('OPTIONS' === $request->getMethod()) { $event->stopPropagation(); $response = $event->getData()[...
php
public function beforeDispatch(Event $event) { $this->buildResponse($event); Configure::write('requestLogged', false); $request = $event->getData()['request']; if ('OPTIONS' === $request->getMethod()) { $event->stopPropagation(); $response = $event->getData()[...
[ "public", "function", "beforeDispatch", "(", "Event", "$", "event", ")", "{", "$", "this", "->", "buildResponse", "(", "$", "event", ")", ";", "Configure", "::", "write", "(", "'requestLogged'", ",", "false", ")", ";", "$", "request", "=", "$", "event", ...
Handles incoming request and its data. @param Event $event The beforeDispatch event
[ "Handles", "incoming", "request", "and", "its", "data", "." ]
train
https://github.com/multidots/cakephp-rest-api/blob/6c2a73bbe3073c58ade3f24cd015dd58e71ebd50/src/Event/ApiRequestHandler.php#L46-L62
multidots/cakephp-rest-api
src/Event/ApiRequestHandler.php
ApiRequestHandler.shutdown
public function shutdown(Event $event) { $request = $event->getSubject()->request; if ('OPTIONS' === $request->getMethod()) { return; } if (!Configure::read('requestLogged') && Configure::read('ApiRequest.log')) { if (Configure::read('ApiRequest.logOnlyErrors...
php
public function shutdown(Event $event) { $request = $event->getSubject()->request; if ('OPTIONS' === $request->getMethod()) { return; } if (!Configure::read('requestLogged') && Configure::read('ApiRequest.log')) { if (Configure::read('ApiRequest.logOnlyErrors...
[ "public", "function", "shutdown", "(", "Event", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getSubject", "(", ")", "->", "request", ";", "if", "(", "'OPTIONS'", "===", "$", "request", "->", "getMethod", "(", ")", ")", "{", "retu...
Logs the request and response data into database. @param Event $event The shutdown event
[ "Logs", "the", "request", "and", "response", "data", "into", "database", "." ]
train
https://github.com/multidots/cakephp-rest-api/blob/6c2a73bbe3073c58ade3f24cd015dd58e71ebd50/src/Event/ApiRequestHandler.php#L79-L99
multidots/cakephp-rest-api
src/Event/ApiRequestHandler.php
ApiRequestHandler.buildResponse
private function buildResponse(Event $event) { $request = $event->getData()['request']; $response = $event->getData()['response']; if ('xml' === Configure::read('ApiRequest.responseType')) { $response->withType('xml'); } else { $response->withType('json'); ...
php
private function buildResponse(Event $event) { $request = $event->getData()['request']; $response = $event->getData()['response']; if ('xml' === Configure::read('ApiRequest.responseType')) { $response->withType('xml'); } else { $response->withType('json'); ...
[ "private", "function", "buildResponse", "(", "Event", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getData", "(", ")", "[", "'request'", "]", ";", "$", "response", "=", "$", "event", "->", "getData", "(", ")", "[", "'response'", ...
Prepares the response object with content type and cors headers. @param Event $event The event object either beforeDispatch or afterDispatch @return bool true
[ "Prepares", "the", "response", "object", "with", "content", "type", "and", "cors", "headers", "." ]
train
https://github.com/multidots/cakephp-rest-api/blob/6c2a73bbe3073c58ade3f24cd015dd58e71ebd50/src/Event/ApiRequestHandler.php#L108-L128