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 |
|---|---|---|---|---|---|---|---|---|---|---|
krlove/eloquent-model-generator | src/Command/GenerateModelCommand.php | GenerateModelCommand.fire | public function fire()
{
$config = $this->createConfig();
$model = $this->generator->generateModel($config);
$this->output->writeln(sprintf('Model %s generated', $model->getName()->getName()));
} | php | public function fire()
{
$config = $this->createConfig();
$model = $this->generator->generateModel($config);
$this->output->writeln(sprintf('Model %s generated', $model->getName()->getName()));
} | [
"public",
"function",
"fire",
"(",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"createConfig",
"(",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"generator",
"->",
"generateModel",
"(",
"$",
"config",
")",
";",
"$",
"this",
"->",
"output",
... | Executes the command | [
"Executes",
"the",
"command"
] | train | https://github.com/krlove/eloquent-model-generator/blob/6073e7aecb5ccad286de70cc2a039bd84a037635/src/Command/GenerateModelCommand.php#L49-L56 |
yiisoft/yii2-httpclient | src/CurlTransport.php | CurlTransport.send | public function send($request)
{
$request->beforeSend();
$curlOptions = $this->prepare($request);
$curlResource = $this->initCurl($curlOptions);
$responseHeaders = [];
$this->setHeaderOutput($curlResource, $responseHeaders);
$token = $request->client->createRequest... | php | public function send($request)
{
$request->beforeSend();
$curlOptions = $this->prepare($request);
$curlResource = $this->initCurl($curlOptions);
$responseHeaders = [];
$this->setHeaderOutput($curlResource, $responseHeaders);
$token = $request->client->createRequest... | [
"public",
"function",
"send",
"(",
"$",
"request",
")",
"{",
"$",
"request",
"->",
"beforeSend",
"(",
")",
";",
"$",
"curlOptions",
"=",
"$",
"this",
"->",
"prepare",
"(",
"$",
"request",
")",
";",
"$",
"curlResource",
"=",
"$",
"this",
"->",
"initCu... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/CurlTransport.php#L27-L58 |
yiisoft/yii2-httpclient | src/CurlTransport.php | CurlTransport.batchSend | public function batchSend(array $requests)
{
$curlBatchResource = curl_multi_init();
$token = '';
$curlResources = [];
$responseHeaders = [];
foreach ($requests as $key => $request) {
/* @var $request Request */
$request->beforeSend();
$c... | php | public function batchSend(array $requests)
{
$curlBatchResource = curl_multi_init();
$token = '';
$curlResources = [];
$responseHeaders = [];
foreach ($requests as $key => $request) {
/* @var $request Request */
$request->beforeSend();
$c... | [
"public",
"function",
"batchSend",
"(",
"array",
"$",
"requests",
")",
"{",
"$",
"curlBatchResource",
"=",
"curl_multi_init",
"(",
")",
";",
"$",
"token",
"=",
"''",
";",
"$",
"curlResources",
"=",
"[",
"]",
";",
"$",
"responseHeaders",
"=",
"[",
"]",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/CurlTransport.php#L63-L121 |
yiisoft/yii2-httpclient | src/CurlTransport.php | CurlTransport.prepare | private function prepare($request)
{
$request->prepare();
$curlOptions = $this->composeCurlOptions($request->getOptions());
$method = strtoupper($request->getMethod());
switch ($method) {
case 'POST':
$curlOptions[CURLOPT_POST] = true;
br... | php | private function prepare($request)
{
$request->prepare();
$curlOptions = $this->composeCurlOptions($request->getOptions());
$method = strtoupper($request->getMethod());
switch ($method) {
case 'POST':
$curlOptions[CURLOPT_POST] = true;
br... | [
"private",
"function",
"prepare",
"(",
"$",
"request",
")",
"{",
"$",
"request",
"->",
"prepare",
"(",
")",
";",
"$",
"curlOptions",
"=",
"$",
"this",
"->",
"composeCurlOptions",
"(",
"$",
"request",
"->",
"getOptions",
"(",
")",
")",
";",
"$",
"method... | Prepare request for execution, creating cURL resource for it.
@param Request $request request instance.
@return array cURL options. | [
"Prepare",
"request",
"for",
"execution",
"creating",
"cURL",
"resource",
"for",
"it",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/CurlTransport.php#L128-L160 |
yiisoft/yii2-httpclient | src/CurlTransport.php | CurlTransport.initCurl | private function initCurl(array $curlOptions)
{
$curlResource = curl_init();
foreach ($curlOptions as $option => $value) {
curl_setopt($curlResource, $option, $value);
}
return $curlResource;
} | php | private function initCurl(array $curlOptions)
{
$curlResource = curl_init();
foreach ($curlOptions as $option => $value) {
curl_setopt($curlResource, $option, $value);
}
return $curlResource;
} | [
"private",
"function",
"initCurl",
"(",
"array",
"$",
"curlOptions",
")",
"{",
"$",
"curlResource",
"=",
"curl_init",
"(",
")",
";",
"foreach",
"(",
"$",
"curlOptions",
"as",
"$",
"option",
"=>",
"$",
"value",
")",
"{",
"curl_setopt",
"(",
"$",
"curlReso... | Initializes cURL resource.
@param array $curlOptions cURL options.
@return resource prepared cURL resource. | [
"Initializes",
"cURL",
"resource",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/CurlTransport.php#L167-L175 |
yiisoft/yii2-httpclient | src/CurlTransport.php | CurlTransport.composeCurlOptions | private function composeCurlOptions(array $options)
{
static $optionMap = [
'protocolVersion' => CURLOPT_HTTP_VERSION,
'maxRedirects' => CURLOPT_MAXREDIRS,
'sslCapath' => CURLOPT_CAPATH,
'sslCafile' => CURLOPT_CAINFO,
'sslLocalCert' => CURLOPT_SSLC... | php | private function composeCurlOptions(array $options)
{
static $optionMap = [
'protocolVersion' => CURLOPT_HTTP_VERSION,
'maxRedirects' => CURLOPT_MAXREDIRS,
'sslCapath' => CURLOPT_CAPATH,
'sslCafile' => CURLOPT_CAINFO,
'sslLocalCert' => CURLOPT_SSLC... | [
"private",
"function",
"composeCurlOptions",
"(",
"array",
"$",
"options",
")",
"{",
"static",
"$",
"optionMap",
"=",
"[",
"'protocolVersion'",
"=>",
"CURLOPT_HTTP_VERSION",
",",
"'maxRedirects'",
"=>",
"CURLOPT_MAXREDIRS",
",",
"'sslCapath'",
"=>",
"CURLOPT_CAPATH",
... | Composes cURL options from raw request options.
@param array $options raw request options.
@return array cURL options, in format: [curl_constant => value]. | [
"Composes",
"cURL",
"options",
"from",
"raw",
"request",
"options",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/CurlTransport.php#L182-L217 |
yiisoft/yii2-httpclient | src/CurlTransport.php | CurlTransport.setHeaderOutput | private function setHeaderOutput($curlResource, array &$output)
{
curl_setopt($curlResource, CURLOPT_HEADERFUNCTION, function($resource, $headerString) use (&$output) {
$header = trim($headerString, "\n\r");
if (strlen($header) > 0) {
$output[] = $header;
... | php | private function setHeaderOutput($curlResource, array &$output)
{
curl_setopt($curlResource, CURLOPT_HEADERFUNCTION, function($resource, $headerString) use (&$output) {
$header = trim($headerString, "\n\r");
if (strlen($header) > 0) {
$output[] = $header;
... | [
"private",
"function",
"setHeaderOutput",
"(",
"$",
"curlResource",
",",
"array",
"&",
"$",
"output",
")",
"{",
"curl_setopt",
"(",
"$",
"curlResource",
",",
"CURLOPT_HEADERFUNCTION",
",",
"function",
"(",
"$",
"resource",
",",
"$",
"headerString",
")",
"use",... | Setup a variable, which should collect the cURL response headers.
@param resource $curlResource cURL resource.
@param array $output variable, which should collection headers. | [
"Setup",
"a",
"variable",
"which",
"should",
"collect",
"the",
"cURL",
"response",
"headers",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/CurlTransport.php#L224-L233 |
yiisoft/yii2-httpclient | src/CurlFormatter.php | CurlFormatter.format | public function format(Request $request)
{
$data = $request->getData();
if (strcasecmp('GET', $request->getMethod()) === 0) {
if ($data !== null) {
$content = http_build_query((array)$data, '', '&', $this->encodingType);
$request->setFullUrl(null);
... | php | public function format(Request $request)
{
$data = $request->getData();
if (strcasecmp('GET', $request->getMethod()) === 0) {
if ($data !== null) {
$content = http_build_query((array)$data, '', '&', $this->encodingType);
$request->setFullUrl(null);
... | [
"public",
"function",
"format",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"data",
"=",
"$",
"request",
"->",
"getData",
"(",
")",
";",
"if",
"(",
"strcasecmp",
"(",
"'GET'",
",",
"$",
"request",
"->",
"getMethod",
"(",
")",
")",
"===",
"0",
")... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/CurlFormatter.php#L36-L59 |
yiisoft/yii2-httpclient | src/MockTransport.php | MockTransport.send | public function send($request)
{
if (empty($this->responses)) {
throw new Exception('No Response available');
}
$nextResponse = array_shift($this->responses);
if (null === $nextResponse->client) {
$nextResponse->client = $request->client;
}
$... | php | public function send($request)
{
if (empty($this->responses)) {
throw new Exception('No Response available');
}
$nextResponse = array_shift($this->responses);
if (null === $nextResponse->client) {
$nextResponse->client = $request->client;
}
$... | [
"public",
"function",
"send",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"responses",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'No Response available'",
")",
";",
"}",
"$",
"nextResponse",
"=",
"array_shift",
"(",... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/MockTransport.php#L46-L60 |
yiisoft/yii2-httpclient | src/debug/HttpClientPanel.php | HttpClientPanel.getSummary | public function getSummary()
{
$timings = $this->calculateTimings();
$queryCount = count($timings);
if ($queryCount === 0) {
return '';
}
$queryTime = number_format($this->getTotalRequestTime($timings) * 1000) . ' ms';
return Yii::$app->view->render('@yi... | php | public function getSummary()
{
$timings = $this->calculateTimings();
$queryCount = count($timings);
if ($queryCount === 0) {
return '';
}
$queryTime = number_format($this->getTotalRequestTime($timings) * 1000) . ' ms';
return Yii::$app->view->render('@yi... | [
"public",
"function",
"getSummary",
"(",
")",
"{",
"$",
"timings",
"=",
"$",
"this",
"->",
"calculateTimings",
"(",
")",
";",
"$",
"queryCount",
"=",
"count",
"(",
"$",
"timings",
")",
";",
"if",
"(",
"$",
"queryCount",
"===",
"0",
")",
"{",
"return"... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/debug/HttpClientPanel.php#L85-L101 |
yiisoft/yii2-httpclient | src/debug/HttpClientPanel.php | HttpClientPanel.getModels | protected function getModels()
{
if ($this->_models === null) {
$this->_models = [];
$timings = $this->calculateTimings();
foreach ($timings as $seq => $dbTiming) {
$this->_models[] = [
'method' => $this->getRequestMethod($dbTiming['in... | php | protected function getModels()
{
if ($this->_models === null) {
$this->_models = [];
$timings = $this->calculateTimings();
foreach ($timings as $seq => $dbTiming) {
$this->_models[] = [
'method' => $this->getRequestMethod($dbTiming['in... | [
"protected",
"function",
"getModels",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_models",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_models",
"=",
"[",
"]",
";",
"$",
"timings",
"=",
"$",
"this",
"->",
"calculateTimings",
"(",
")",
";",
"for... | Returns an array of models that represents logs of the current request.
Can be used with data providers such as \yii\data\ArrayDataProvider.
@return array models | [
"Returns",
"an",
"array",
"of",
"models",
"that",
"represents",
"logs",
"of",
"the",
"current",
"request",
".",
"Can",
"be",
"used",
"with",
"data",
"providers",
"such",
"as",
"\\",
"yii",
"\\",
"data",
"\\",
"ArrayDataProvider",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/debug/HttpClientPanel.php#L151-L171 |
yiisoft/yii2-httpclient | src/debug/HttpClientPanel.php | HttpClientPanel.getRequestMethod | protected function getRequestMethod($timing)
{
$timing = ltrim($timing);
preg_match('/^([a-zA-z]*)/', $timing, $matches);
return count($matches) ? $matches[0] : '';
} | php | protected function getRequestMethod($timing)
{
$timing = ltrim($timing);
preg_match('/^([a-zA-z]*)/', $timing, $matches);
return count($matches) ? $matches[0] : '';
} | [
"protected",
"function",
"getRequestMethod",
"(",
"$",
"timing",
")",
"{",
"$",
"timing",
"=",
"ltrim",
"(",
"$",
"timing",
")",
";",
"preg_match",
"(",
"'/^([a-zA-z]*)/'",
",",
"$",
"timing",
",",
"$",
"matches",
")",
";",
"return",
"count",
"(",
"$",
... | Returns HTTP request method.
@param string $timing timing procedure string
@return string request method such as GET, POST, PUT, etc. | [
"Returns",
"HTTP",
"request",
"method",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/debug/HttpClientPanel.php#L179-L185 |
yiisoft/yii2-httpclient | src/debug/HttpClientPanel.php | HttpClientPanel.getMethods | public function getMethods()
{
return array_reduce(
$this->_models,
function ($result, $item) {
$result[$item['method']] = $item['method'];
return $result;
},
[]
);
} | php | public function getMethods()
{
return array_reduce(
$this->_models,
function ($result, $item) {
$result[$item['method']] = $item['method'];
return $result;
},
[]
);
} | [
"public",
"function",
"getMethods",
"(",
")",
"{",
"return",
"array_reduce",
"(",
"$",
"this",
"->",
"_models",
",",
"function",
"(",
"$",
"result",
",",
"$",
"item",
")",
"{",
"$",
"result",
"[",
"$",
"item",
"[",
"'method'",
"]",
"]",
"=",
"$",
"... | Returns array request methods
@return array | [
"Returns",
"array",
"request",
"methods"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/debug/HttpClientPanel.php#L220-L230 |
yiisoft/yii2-httpclient | src/XmlParser.php | XmlParser.parse | public function parse(Response $response)
{
$contentType = $response->getHeaders()->get('content-type', '');
if (preg_match('/charset=(.*)/i', $contentType, $matches)) {
$encoding = $matches[1];
} else {
$encoding = 'UTF-8';
}
$dom = new \DOMDocument(... | php | public function parse(Response $response)
{
$contentType = $response->getHeaders()->get('content-type', '');
if (preg_match('/charset=(.*)/i', $contentType, $matches)) {
$encoding = $matches[1];
} else {
$encoding = 'UTF-8';
}
$dom = new \DOMDocument(... | [
"public",
"function",
"parse",
"(",
"Response",
"$",
"response",
")",
"{",
"$",
"contentType",
"=",
"$",
"response",
"->",
"getHeaders",
"(",
")",
"->",
"get",
"(",
"'content-type'",
",",
"''",
")",
";",
"if",
"(",
"preg_match",
"(",
"'/charset=(.*)/i'",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/XmlParser.php#L23-L35 |
yiisoft/yii2-httpclient | src/XmlParser.php | XmlParser.convertXmlToArray | protected function convertXmlToArray($xml)
{
if (is_string($xml)) {
$xml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
}
$result = (array) $xml;
foreach ($result as $key => $value) {
if (!is_scalar($value)) {
$result[$key] ... | php | protected function convertXmlToArray($xml)
{
if (is_string($xml)) {
$xml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
}
$result = (array) $xml;
foreach ($result as $key => $value) {
if (!is_scalar($value)) {
$result[$key] ... | [
"protected",
"function",
"convertXmlToArray",
"(",
"$",
"xml",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"xml",
")",
")",
"{",
"$",
"xml",
"=",
"simplexml_load_string",
"(",
"$",
"xml",
",",
"'SimpleXMLElement'",
",",
"LIBXML_NOCDATA",
")",
";",
"}",
"... | Converts XML document to array.
@param string|\SimpleXMLElement $xml xml to process.
@return array XML array representation. | [
"Converts",
"XML",
"document",
"to",
"array",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/XmlParser.php#L42-L54 |
yiisoft/yii2-httpclient | src/Response.php | Response.getData | public function getData()
{
$data = parent::getData();
if ($data === null) {
$content = $this->getContent();
if (!empty($content)) {
$data = $this->getParser()->parse($this);
$this->setData($data);
}
}
return $data;
... | php | public function getData()
{
$data = parent::getData();
if ($data === null) {
$content = $this->getContent();
if (!empty($content)) {
$data = $this->getParser()->parse($this);
$this->setData($data);
}
}
return $data;
... | [
"public",
"function",
"getData",
"(",
")",
"{",
"$",
"data",
"=",
"parent",
"::",
"getData",
"(",
")",
";",
"if",
"(",
"$",
"data",
"===",
"null",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"!",
"e... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Response.php#L27-L38 |
yiisoft/yii2-httpclient | src/Response.php | Response.getCookies | public function getCookies()
{
$cookieCollection = parent::getCookies();
if ($cookieCollection->getCount() === 0 && $this->getHeaders()->has('set-cookie')) {
$cookieStrings = $this->getHeaders()->get('set-cookie', [], false);
foreach ($cookieStrings as $cookieString) {
... | php | public function getCookies()
{
$cookieCollection = parent::getCookies();
if ($cookieCollection->getCount() === 0 && $this->getHeaders()->has('set-cookie')) {
$cookieStrings = $this->getHeaders()->get('set-cookie', [], false);
foreach ($cookieStrings as $cookieString) {
... | [
"public",
"function",
"getCookies",
"(",
")",
"{",
"$",
"cookieCollection",
"=",
"parent",
"::",
"getCookies",
"(",
")",
";",
"if",
"(",
"$",
"cookieCollection",
"->",
"getCount",
"(",
")",
"===",
"0",
"&&",
"$",
"this",
"->",
"getHeaders",
"(",
")",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Response.php#L43-L53 |
yiisoft/yii2-httpclient | src/Response.php | Response.getStatusCode | public function getStatusCode()
{
$headers = $this->getHeaders();
if ($headers->has('http-code')) {
// take into account possible 'follow location'
$statusCodeHeaders = $headers->get('http-code', null, false);
return empty($statusCodeHeaders) ? null : end($statusC... | php | public function getStatusCode()
{
$headers = $this->getHeaders();
if ($headers->has('http-code')) {
// take into account possible 'follow location'
$statusCodeHeaders = $headers->get('http-code', null, false);
return empty($statusCodeHeaders) ? null : end($statusC... | [
"public",
"function",
"getStatusCode",
"(",
")",
"{",
"$",
"headers",
"=",
"$",
"this",
"->",
"getHeaders",
"(",
")",
";",
"if",
"(",
"$",
"headers",
"->",
"has",
"(",
"'http-code'",
")",
")",
"{",
"// take into account possible 'follow location'",
"$",
"sta... | Returns status code.
@throws Exception on failure.
@return string status code. | [
"Returns",
"status",
"code",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Response.php#L60-L69 |
yiisoft/yii2-httpclient | src/Response.php | Response.defaultFormat | protected function defaultFormat()
{
$format = $this->detectFormatByHeaders($this->getHeaders());
if ($format === null) {
$format = $this->detectFormatByContent($this->getContent());
}
return $format;
} | php | protected function defaultFormat()
{
$format = $this->detectFormatByHeaders($this->getHeaders());
if ($format === null) {
$format = $this->detectFormatByContent($this->getContent());
}
return $format;
} | [
"protected",
"function",
"defaultFormat",
"(",
")",
"{",
"$",
"format",
"=",
"$",
"this",
"->",
"detectFormatByHeaders",
"(",
"$",
"this",
"->",
"getHeaders",
"(",
")",
")",
";",
"if",
"(",
"$",
"format",
"===",
"null",
")",
"{",
"$",
"format",
"=",
... | Returns default format automatically detected from headers and content.
@return string|null format name, 'null' - if detection failed. | [
"Returns",
"default",
"format",
"automatically",
"detected",
"from",
"headers",
"and",
"content",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Response.php#L85-L93 |
yiisoft/yii2-httpclient | src/Response.php | Response.detectFormatByHeaders | protected function detectFormatByHeaders(HeaderCollection $headers)
{
$contentTypeHeaders = $headers->get('content-type', null, false);
if (!empty($contentTypeHeaders)) {
$contentType = end($contentTypeHeaders);
if (stripos($contentType, 'json') !== false) {
... | php | protected function detectFormatByHeaders(HeaderCollection $headers)
{
$contentTypeHeaders = $headers->get('content-type', null, false);
if (!empty($contentTypeHeaders)) {
$contentType = end($contentTypeHeaders);
if (stripos($contentType, 'json') !== false) {
... | [
"protected",
"function",
"detectFormatByHeaders",
"(",
"HeaderCollection",
"$",
"headers",
")",
"{",
"$",
"contentTypeHeaders",
"=",
"$",
"headers",
"->",
"get",
"(",
"'content-type'",
",",
"null",
",",
"false",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
... | Detects format from headers.
@param HeaderCollection $headers source headers.
@return null|string format name, 'null' - if detection failed. | [
"Detects",
"format",
"from",
"headers",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Response.php#L100-L118 |
yiisoft/yii2-httpclient | src/Response.php | Response.detectFormatByContent | protected function detectFormatByContent($content)
{
if (preg_match('/^(\\{|\\[\\{).*(\\}|\\}\\])$/is', $content)) {
return Client::FORMAT_JSON;
}
if (preg_match('/^([^=&])+=[^=&]+(&[^=&]+=[^=&]+)*$/', $content)) {
return Client::FORMAT_URLENCODED;
}
i... | php | protected function detectFormatByContent($content)
{
if (preg_match('/^(\\{|\\[\\{).*(\\}|\\}\\])$/is', $content)) {
return Client::FORMAT_JSON;
}
if (preg_match('/^([^=&])+=[^=&]+(&[^=&]+=[^=&]+)*$/', $content)) {
return Client::FORMAT_URLENCODED;
}
i... | [
"protected",
"function",
"detectFormatByContent",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^(\\\\{|\\\\[\\\\{).*(\\\\}|\\\\}\\\\])$/is'",
",",
"$",
"content",
")",
")",
"{",
"return",
"Client",
"::",
"FORMAT_JSON",
";",
"}",
"if",
"(",
"pr... | Detects response format from raw content.
@param string $content raw response content.
@return null|string format name, 'null' - if detection failed. | [
"Detects",
"response",
"format",
"from",
"raw",
"content",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Response.php#L125-L137 |
yiisoft/yii2-httpclient | src/Response.php | Response.parseCookie | private function parseCookie($cookieString)
{
$params = [];
$pairs = explode(';', $cookieString);
foreach ($pairs as $number => $pair) {
$pair = trim($pair);
if (strpos($pair, '=') === false) {
$params[$this->normalizeCookieParamName($pair)] = true;
... | php | private function parseCookie($cookieString)
{
$params = [];
$pairs = explode(';', $cookieString);
foreach ($pairs as $number => $pair) {
$pair = trim($pair);
if (strpos($pair, '=') === false) {
$params[$this->normalizeCookieParamName($pair)] = true;
... | [
"private",
"function",
"parseCookie",
"(",
"$",
"cookieString",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"$",
"pairs",
"=",
"explode",
"(",
"';'",
",",
"$",
"cookieString",
")",
";",
"foreach",
"(",
"$",
"pairs",
"as",
"$",
"number",
"=>",
"$",
... | Parses cookie value string, creating a [[Cookie]] instance.
@param string $cookieString cookie header string.
@return Cookie cookie object. | [
"Parses",
"cookie",
"value",
"string",
"creating",
"a",
"[[",
"Cookie",
"]]",
"instance",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Response.php#L144-L171 |
yiisoft/yii2-httpclient | src/Transport.php | Transport.batchSend | public function batchSend(array $requests)
{
$responses = [];
foreach ($requests as $key => $request) {
$responses[$key] = $this->send($request);
}
return $responses;
} | php | public function batchSend(array $requests)
{
$responses = [];
foreach ($requests as $key => $request) {
$responses[$key] = $this->send($request);
}
return $responses;
} | [
"public",
"function",
"batchSend",
"(",
"array",
"$",
"requests",
")",
"{",
"$",
"responses",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"requests",
"as",
"$",
"key",
"=>",
"$",
"request",
")",
"{",
"$",
"responses",
"[",
"$",
"key",
"]",
"=",
"$",
... | Performs multiple HTTP requests.
Particular transport may benefit from this method, allowing sending requests in parallel.
This method accepts an array of the [[Request]] objects and returns an array of the [[Response]] objects.
Keys of the response array correspond the ones from request array.
@param Request[] $reque... | [
"Performs",
"multiple",
"HTTP",
"requests",
".",
"Particular",
"transport",
"may",
"benefit",
"from",
"this",
"method",
"allowing",
"sending",
"requests",
"in",
"parallel",
".",
"This",
"method",
"accepts",
"an",
"array",
"of",
"the",
"[[",
"Request",
"]]",
"o... | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Transport.php#L37-L44 |
yiisoft/yii2-httpclient | src/XmlFormatter.php | XmlFormatter.format | public function format(Request $request)
{
$contentType = $this->contentType;
$charset = $this->encoding === null ? Yii::$app->charset : $this->encoding;
if (stripos($contentType, 'charset') === false) {
$contentType .= '; charset=' . $charset;
}
$request->getHead... | php | public function format(Request $request)
{
$contentType = $this->contentType;
$charset = $this->encoding === null ? Yii::$app->charset : $this->encoding;
if (stripos($contentType, 'charset') === false) {
$contentType .= '; charset=' . $charset;
}
$request->getHead... | [
"public",
"function",
"format",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"contentType",
"=",
"$",
"this",
"->",
"contentType",
";",
"$",
"charset",
"=",
"$",
"this",
"->",
"encoding",
"===",
"null",
"?",
"Yii",
"::",
"$",
"app",
"->",
"charset",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/XmlFormatter.php#L59-L85 |
yiisoft/yii2-httpclient | src/debug/SearchModel.php | SearchModel.search | public function search($params, $models)
{
$dataProvider = new ArrayDataProvider([
'allModels' => $models,
'pagination' => false,
'sort' => [
'attributes' => ['duration', 'seq', 'type', 'method', 'request'],
'defaultOrder' => [
... | php | public function search($params, $models)
{
$dataProvider = new ArrayDataProvider([
'allModels' => $models,
'pagination' => false,
'sort' => [
'attributes' => ['duration', 'seq', 'type', 'method', 'request'],
'defaultOrder' => [
... | [
"public",
"function",
"search",
"(",
"$",
"params",
",",
"$",
"models",
")",
"{",
"$",
"dataProvider",
"=",
"new",
"ArrayDataProvider",
"(",
"[",
"'allModels'",
"=>",
"$",
"models",
",",
"'pagination'",
"=>",
"false",
",",
"'sort'",
"=>",
"[",
"'attributes... | Returns data provider with filled models. Filter applied if needed.
@param array $params an array of parameter values indexed by parameter names
@param array $models data to return provider for
@return \yii\data\ArrayDataProvider | [
"Returns",
"data",
"provider",
"with",
"filled",
"models",
".",
"Filter",
"applied",
"if",
"needed",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/debug/SearchModel.php#L65-L89 |
yiisoft/yii2-httpclient | src/Request.php | Request.getFullUrl | public function getFullUrl()
{
if ($this->_fullUrl === null) {
$this->_fullUrl = $this->createFullUrl($this->getUrl());
}
return $this->_fullUrl;
} | php | public function getFullUrl()
{
if ($this->_fullUrl === null) {
$this->_fullUrl = $this->createFullUrl($this->getUrl());
}
return $this->_fullUrl;
} | [
"public",
"function",
"getFullUrl",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_fullUrl",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_fullUrl",
"=",
"$",
"this",
"->",
"createFullUrl",
"(",
"$",
"this",
"->",
"getUrl",
"(",
")",
")",
";",
"}",... | Returns full target URL, including [[Client::baseUrl]] as a string.
@return string full target URL. | [
"Returns",
"full",
"target",
"URL",
"including",
"[[",
"Client",
"::",
"baseUrl",
"]]",
"as",
"a",
"string",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L106-L112 |
yiisoft/yii2-httpclient | src/Request.php | Request.addOptions | public function addOptions(array $options)
{
// `array_merge()` will produce invalid result for cURL options,
// while `ArrayHelper::merge()` is unable to override cURL options
foreach ($options as $key => $value) {
if (is_array($value) && isset($this->_options[$key])) {
... | php | public function addOptions(array $options)
{
// `array_merge()` will produce invalid result for cURL options,
// while `ArrayHelper::merge()` is unable to override cURL options
foreach ($options as $key => $value) {
if (is_array($value) && isset($this->_options[$key])) {
... | [
"public",
"function",
"addOptions",
"(",
"array",
"$",
"options",
")",
"{",
"// `array_merge()` will produce invalid result for cURL options,",
"// while `ArrayHelper::merge()` is unable to override cURL options",
"foreach",
"(",
"$",
"options",
"as",
"$",
"key",
"=>",
"$",
"... | Adds more options to already defined ones.
Please refer to [[setOptions()]] on how to specify options.
@param array $options additional options
@return $this self reference. | [
"Adds",
"more",
"options",
"to",
"already",
"defined",
"ones",
".",
"Please",
"refer",
"to",
"[[",
"setOptions",
"()",
"]]",
"on",
"how",
"to",
"specify",
"options",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L171-L182 |
yiisoft/yii2-httpclient | src/Request.php | Request.setData | public function setData($data)
{
if ($this->isPrepared) {
$this->setContent(null);
$this->isPrepared = false;
}
return parent::setData($data);
} | php | public function setData($data)
{
if ($this->isPrepared) {
$this->setContent(null);
$this->isPrepared = false;
}
return parent::setData($data);
} | [
"public",
"function",
"setData",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isPrepared",
")",
"{",
"$",
"this",
"->",
"setContent",
"(",
"null",
")",
";",
"$",
"this",
"->",
"isPrepared",
"=",
"false",
";",
"}",
"return",
"parent",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L187-L195 |
yiisoft/yii2-httpclient | src/Request.php | Request.addData | public function addData($data)
{
if ($this->isPrepared) {
$this->setContent(null);
$this->isPrepared = false;
}
return parent::addData($data);
} | php | public function addData($data)
{
if ($this->isPrepared) {
$this->setContent(null);
$this->isPrepared = false;
}
return parent::addData($data);
} | [
"public",
"function",
"addData",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isPrepared",
")",
"{",
"$",
"this",
"->",
"setContent",
"(",
"null",
")",
";",
"$",
"this",
"->",
"isPrepared",
"=",
"false",
";",
"}",
"return",
"parent",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L200-L208 |
yiisoft/yii2-httpclient | src/Request.php | Request.addContent | public function addContent($name, $content, $options = [])
{
$multiPartContent = $this->getContent();
if (!is_array($multiPartContent)) {
$multiPartContent = [];
}
$options['content'] = $content;
$alias = $this->generateContentAlias($name);
$this->addAlias... | php | public function addContent($name, $content, $options = [])
{
$multiPartContent = $this->getContent();
if (!is_array($multiPartContent)) {
$multiPartContent = [];
}
$options['content'] = $content;
$alias = $this->generateContentAlias($name);
$this->addAlias... | [
"public",
"function",
"addContent",
"(",
"$",
"name",
",",
"$",
"content",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"multiPartContent",
"=",
"$",
"this",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"multiPartCon... | Adds a content part for multi-part content request.
@param string $name part (form input) name.
@param string $content content.
@param array $options content part options, valid options are:
- contentType - string, part content type
- fileName - string, name of the uploading file
- mimeType - string, part content type ... | [
"Adds",
"a",
"content",
"part",
"for",
"multi",
"-",
"part",
"content",
"request",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L220-L232 |
yiisoft/yii2-httpclient | src/Request.php | Request.addFile | public function addFile($name, $fileName, $options = [])
{
$content = file_get_contents($fileName);
if (!isset($options['mimeType'])) {
$options['mimeType'] = FileHelper::getMimeType($fileName);
}
if (!isset($options['fileName'])) {
$options['fileName'] = base... | php | public function addFile($name, $fileName, $options = [])
{
$content = file_get_contents($fileName);
if (!isset($options['mimeType'])) {
$options['mimeType'] = FileHelper::getMimeType($fileName);
}
if (!isset($options['fileName'])) {
$options['fileName'] = base... | [
"public",
"function",
"addFile",
"(",
"$",
"name",
",",
"$",
"fileName",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",
"fileName",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'mi... | Adds a file for upload as multi-part content.
@see addContent()
@param string $name part (form input) name
@param string $fileName full name of the source file.
@param array $options content part options, valid options are:
- fileName - string, base name of the uploading file, if not set it base name of the source file... | [
"Adds",
"a",
"file",
"for",
"upload",
"as",
"multi",
"-",
"part",
"content",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L245-L255 |
yiisoft/yii2-httpclient | src/Request.php | Request.addFileContent | public function addFileContent($name, $content, $options = [])
{
if (!isset($options['mimeType'])) {
$options['mimeType'] = 'application/octet-stream';
}
if (!isset($options['fileName'])) {
$options['fileName'] = $name . '.dat';
}
return $this->addCont... | php | public function addFileContent($name, $content, $options = [])
{
if (!isset($options['mimeType'])) {
$options['mimeType'] = 'application/octet-stream';
}
if (!isset($options['fileName'])) {
$options['fileName'] = $name . '.dat';
}
return $this->addCont... | [
"public",
"function",
"addFileContent",
"(",
"$",
"name",
",",
"$",
"content",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'mimeType'",
"]",
")",
")",
"{",
"$",
"options",
"[",
"'mimeType'",
"]"... | Adds a string as a file upload.
@see addContent()
@param string $name part (form input) name
@param string $content file content.
@param array $options content part options, valid options are:
- fileName - string, base name of the uploading file.
- mimeType - string, file mime type, if not set it 'application/octet-str... | [
"Adds",
"a",
"string",
"as",
"a",
"file",
"upload",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L267-L276 |
yiisoft/yii2-httpclient | src/Request.php | Request.prepare | public function prepare()
{
$content = $this->getContent();
if ($content === null) {
$this->getFormatter()->format($this);
} elseif (is_array($content)) {
$this->prepareMultiPartContent($content);
}
$this->isPrepared = true;
return $this;
... | php | public function prepare()
{
$content = $this->getContent();
if ($content === null) {
$this->getFormatter()->format($this);
} elseif (is_array($content)) {
$this->prepareMultiPartContent($content);
}
$this->isPrepared = true;
return $this;
... | [
"public",
"function",
"prepare",
"(",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"$",
"content",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"getFormatter",
"(",
")",
"->",
"format",
"(",
"$",
"this",
... | Prepares this request instance for sending.
This method should be invoked by transport before sending a request.
Do not call this method unless you know what you are doing.
@return $this self reference. | [
"Prepares",
"this",
"request",
"instance",
"for",
"sending",
".",
"This",
"method",
"should",
"be",
"invoked",
"by",
"transport",
"before",
"sending",
"a",
"request",
".",
"Do",
"not",
"call",
"this",
"method",
"unless",
"you",
"know",
"what",
"you",
"are",
... | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L284-L296 |
yiisoft/yii2-httpclient | src/Request.php | Request.createFullUrl | private function createFullUrl($url)
{
if (is_array($url)) {
$params = $url;
if (isset($params[0])) {
$url = (string)$params[0];
unset($params[0]);
} else {
$url = '';
}
}
if (!empty($this->clien... | php | private function createFullUrl($url)
{
if (is_array($url)) {
$params = $url;
if (isset($params[0])) {
$url = (string)$params[0];
unset($params[0]);
} else {
$url = '';
}
}
if (!empty($this->clien... | [
"private",
"function",
"createFullUrl",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"url",
")",
")",
"{",
"$",
"params",
"=",
"$",
"url",
";",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"0",
"]",
")",
")",
"{",
"$",
"url",
"... | Normalizes given URL value, filling it with actual string URL value.
@param array|string $url raw URL,
@return string full URL | [
"Normalizes",
"given",
"URL",
"value",
"filling",
"it",
"with",
"actual",
"string",
"URL",
"value",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L303-L333 |
yiisoft/yii2-httpclient | src/Request.php | Request.prepareMultiPartContent | private function prepareMultiPartContent(array $content)
{
static $disallowedChars = ["\0", '"', "\r", "\n"];
$contentParts = [];
$data = $this->getData();
if (!empty($data)) {
foreach ($this->composeFormInputs($data) as $name => $value) {
$name = str_re... | php | private function prepareMultiPartContent(array $content)
{
static $disallowedChars = ["\0", '"', "\r", "\n"];
$contentParts = [];
$data = $this->getData();
if (!empty($data)) {
foreach ($this->composeFormInputs($data) as $name => $value) {
$name = str_re... | [
"private",
"function",
"prepareMultiPartContent",
"(",
"array",
"$",
"content",
")",
"{",
"static",
"$",
"disallowedChars",
"=",
"[",
"\"\\0\"",
",",
"'\"'",
",",
"\"\\r\"",
",",
"\"\\n\"",
"]",
";",
"$",
"contentParts",
"=",
"[",
"]",
";",
"$",
"data",
... | Prepares multi-part content.
@param array $content multi part content.
@see https://tools.ietf.org/html/rfc7578
@see https://tools.ietf.org/html/rfc2616#section-19.5.1 for the Content-Disposition header
@see https://tools.ietf.org/html/rfc6266 for more details on the Content-Disposition header | [
"Prepares",
"multi",
"-",
"part",
"content",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L342-L392 |
yiisoft/yii2-httpclient | src/Request.php | Request.composeFormInputs | private function composeFormInputs(array $data, $baseKey = '')
{
$result = [];
foreach ($data as $key => $value) {
if (!empty($baseKey)) {
$key = $baseKey . '[' . $key . ']';
}
if (is_array($value)) {
$result = array_merge($result, ... | php | private function composeFormInputs(array $data, $baseKey = '')
{
$result = [];
foreach ($data as $key => $value) {
if (!empty($baseKey)) {
$key = $baseKey . '[' . $key . ']';
}
if (is_array($value)) {
$result = array_merge($result, ... | [
"private",
"function",
"composeFormInputs",
"(",
"array",
"$",
"data",
",",
"$",
"baseKey",
"=",
"''",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"empt... | Composes given data as form inputs submitted values, taking in account nested arrays.
Converts `['form' => ['name' => 'value']]` to `['form[name]' => 'value']`.
@param array $data
@param string $baseKey
@return array | [
"Composes",
"given",
"data",
"as",
"form",
"inputs",
"submitted",
"values",
"taking",
"in",
"account",
"nested",
"arrays",
".",
"Converts",
"[",
"form",
"=",
">",
"[",
"name",
"=",
">",
"value",
"]]",
"to",
"[",
"form",
"[",
"name",
"]",
"=",
">",
"v... | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L401-L415 |
yiisoft/yii2-httpclient | src/Request.php | Request.composeHeaderLines | public function composeHeaderLines()
{
$headers = parent::composeHeaderLines();
if ($this->hasCookies()) {
$headers[] = $this->composeCookieHeader();
}
return $headers;
} | php | public function composeHeaderLines()
{
$headers = parent::composeHeaderLines();
if ($this->hasCookies()) {
$headers[] = $this->composeCookieHeader();
}
return $headers;
} | [
"public",
"function",
"composeHeaderLines",
"(",
")",
"{",
"$",
"headers",
"=",
"parent",
"::",
"composeHeaderLines",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasCookies",
"(",
")",
")",
"{",
"$",
"headers",
"[",
"]",
"=",
"$",
"this",
"->",
"co... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L420-L427 |
yiisoft/yii2-httpclient | src/Request.php | Request.beforeSend | public function beforeSend()
{
$this->client->beforeSend($this);
$event = new RequestEvent();
$event->request = $this;
$this->trigger(self::EVENT_BEFORE_SEND, $event);
} | php | public function beforeSend()
{
$this->client->beforeSend($this);
$event = new RequestEvent();
$event->request = $this;
$this->trigger(self::EVENT_BEFORE_SEND, $event);
} | [
"public",
"function",
"beforeSend",
"(",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"beforeSend",
"(",
"$",
"this",
")",
";",
"$",
"event",
"=",
"new",
"RequestEvent",
"(",
")",
";",
"$",
"event",
"->",
"request",
"=",
"$",
"this",
";",
"$",
"thi... | This method is invoked right before this request is sent.
The method will invoke [[Client::beforeSend()]] and trigger the [[EVENT_BEFORE_SEND]] event.
@since 2.0.1 | [
"This",
"method",
"is",
"invoked",
"right",
"before",
"this",
"request",
"is",
"sent",
".",
"The",
"method",
"will",
"invoke",
"[[",
"Client",
"::",
"beforeSend",
"()",
"]]",
"and",
"trigger",
"the",
"[[",
"EVENT_BEFORE_SEND",
"]]",
"event",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L444-L451 |
yiisoft/yii2-httpclient | src/Request.php | Request.afterSend | public function afterSend($response)
{
$this->client->afterSend($this, $response);
$event = new RequestEvent();
$event->request = $this;
$event->response = $response;
$this->trigger(self::EVENT_AFTER_SEND, $event);
} | php | public function afterSend($response)
{
$this->client->afterSend($this, $response);
$event = new RequestEvent();
$event->request = $this;
$event->response = $response;
$this->trigger(self::EVENT_AFTER_SEND, $event);
} | [
"public",
"function",
"afterSend",
"(",
"$",
"response",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"afterSend",
"(",
"$",
"this",
",",
"$",
"response",
")",
";",
"$",
"event",
"=",
"new",
"RequestEvent",
"(",
")",
";",
"$",
"event",
"->",
"request... | This method is invoked right after this request is sent.
The method will invoke [[Client::afterSend()]] and trigger the [[EVENT_AFTER_SEND]] event.
@param Response $response received response instance.
@since 2.0.1 | [
"This",
"method",
"is",
"invoked",
"right",
"after",
"this",
"request",
"is",
"sent",
".",
"The",
"method",
"will",
"invoke",
"[[",
"Client",
"::",
"afterSend",
"()",
"]]",
"and",
"trigger",
"the",
"[[",
"EVENT_AFTER_SEND",
"]]",
"event",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L459-L467 |
yiisoft/yii2-httpclient | src/Request.php | Request.toString | public function toString()
{
if (!$this->isPrepared) {
$this->prepare();
}
$result = strtoupper($this->getMethod()) . ' ' . $this->getFullUrl();
$parentResult = parent::toString();
if ($parentResult !== '') {
$result .= "\n" . $parentResult;
... | php | public function toString()
{
if (!$this->isPrepared) {
$this->prepare();
}
$result = strtoupper($this->getMethod()) . ' ' . $this->getFullUrl();
$parentResult = parent::toString();
if ($parentResult !== '') {
$result .= "\n" . $parentResult;
... | [
"public",
"function",
"toString",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isPrepared",
")",
"{",
"$",
"this",
"->",
"prepare",
"(",
")",
";",
"}",
"$",
"result",
"=",
"strtoupper",
"(",
"$",
"this",
"->",
"getMethod",
"(",
")",
")",
".... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L472-L486 |
yiisoft/yii2-httpclient | src/Request.php | Request.generateContentAlias | private function generateContentAlias($name)
{
$alias = $name;
while ($this->hasContent($alias)) {
$alias = uniqid($name . '_');
}
return $alias;
} | php | private function generateContentAlias($name)
{
$alias = $name;
while ($this->hasContent($alias)) {
$alias = uniqid($name . '_');
}
return $alias;
} | [
"private",
"function",
"generateContentAlias",
"(",
"$",
"name",
")",
"{",
"$",
"alias",
"=",
"$",
"name",
";",
"while",
"(",
"$",
"this",
"->",
"hasContent",
"(",
"$",
"alias",
")",
")",
"{",
"$",
"alias",
"=",
"uniqid",
"(",
"$",
"name",
".",
"'_... | Generates unique alias for the content
@param $name string
@return string | [
"Generates",
"unique",
"alias",
"for",
"the",
"content"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L538-L546 |
yiisoft/yii2-httpclient | src/Request.php | Request.getNameByAlias | private function getNameByAlias($alias)
{
return isset($this->_contentMap[$alias]) ? $this->_contentMap[$alias] : $alias;
} | php | private function getNameByAlias($alias)
{
return isset($this->_contentMap[$alias]) ? $this->_contentMap[$alias] : $alias;
} | [
"private",
"function",
"getNameByAlias",
"(",
"$",
"alias",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_contentMap",
"[",
"$",
"alias",
"]",
")",
"?",
"$",
"this",
"->",
"_contentMap",
"[",
"$",
"alias",
"]",
":",
"$",
"alias",
";",
"}"
] | Returns name by alias from the content map
@param $alias string
@return string | [
"Returns",
"name",
"by",
"alias",
"from",
"the",
"content",
"map"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Request.php#L563-L566 |
yiisoft/yii2-httpclient | src/Client.php | Client.getFormatter | public function getFormatter($format)
{
static $defaultFormatters = [
self::FORMAT_JSON => 'yii\httpclient\JsonFormatter',
self::FORMAT_URLENCODED => [
'class' => 'yii\httpclient\UrlEncodedFormatter',
'encodingType' => PHP_QUERY_RFC1738
],
... | php | public function getFormatter($format)
{
static $defaultFormatters = [
self::FORMAT_JSON => 'yii\httpclient\JsonFormatter',
self::FORMAT_URLENCODED => [
'class' => 'yii\httpclient\UrlEncodedFormatter',
'encodingType' => PHP_QUERY_RFC1738
],
... | [
"public",
"function",
"getFormatter",
"(",
"$",
"format",
")",
"{",
"static",
"$",
"defaultFormatters",
"=",
"[",
"self",
"::",
"FORMAT_JSON",
"=>",
"'yii\\httpclient\\JsonFormatter'",
",",
"self",
"::",
"FORMAT_URLENCODED",
"=>",
"[",
"'class'",
"=>",
"'yii\\http... | Returns HTTP message formatter instance for the specified format.
@param string $format format name.
@return FormatterInterface formatter instance.
@throws InvalidParamException on invalid format name.
@throws \yii\base\InvalidConfigException | [
"Returns",
"HTTP",
"message",
"formatter",
"instance",
"for",
"the",
"specified",
"format",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Client.php#L130-L158 |
yiisoft/yii2-httpclient | src/Client.php | Client.getParser | public function getParser($format)
{
static $defaultParsers = [
self::FORMAT_JSON => 'yii\httpclient\JsonParser',
self::FORMAT_URLENCODED => 'yii\httpclient\UrlEncodedParser',
self::FORMAT_RAW_URLENCODED => 'yii\httpclient\UrlEncodedParser',
self::FORMAT_XML =... | php | public function getParser($format)
{
static $defaultParsers = [
self::FORMAT_JSON => 'yii\httpclient\JsonParser',
self::FORMAT_URLENCODED => 'yii\httpclient\UrlEncodedParser',
self::FORMAT_RAW_URLENCODED => 'yii\httpclient\UrlEncodedParser',
self::FORMAT_XML =... | [
"public",
"function",
"getParser",
"(",
"$",
"format",
")",
"{",
"static",
"$",
"defaultParsers",
"=",
"[",
"self",
"::",
"FORMAT_JSON",
"=>",
"'yii\\httpclient\\JsonParser'",
",",
"self",
"::",
"FORMAT_URLENCODED",
"=>",
"'yii\\httpclient\\UrlEncodedParser'",
",",
... | Returns HTTP message parser instance for the specified format.
@param string $format format name
@return ParserInterface parser instance.
@throws InvalidParamException on invalid format name.
@throws \yii\base\InvalidConfigException | [
"Returns",
"HTTP",
"message",
"parser",
"instance",
"for",
"the",
"specified",
"format",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Client.php#L167-L188 |
yiisoft/yii2-httpclient | src/Client.php | Client.createResponse | public function createResponse($content = null, array $headers = [])
{
$config = $this->responseConfig;
if (!isset($config['class'])) {
$config['class'] = Response::className();
}
$config['client'] = $this;
$response = Yii::createObject($config);
$response... | php | public function createResponse($content = null, array $headers = [])
{
$config = $this->responseConfig;
if (!isset($config['class'])) {
$config['class'] = Response::className();
}
$config['client'] = $this;
$response = Yii::createObject($config);
$response... | [
"public",
"function",
"createResponse",
"(",
"$",
"content",
"=",
"null",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"responseConfig",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'class'"... | Creates a response instance.
@param string $content raw content
@param array $headers headers list.
@return Response request instance.
@throws \yii\base\InvalidConfigException | [
"Creates",
"a",
"response",
"instance",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Client.php#L211-L222 |
yiisoft/yii2-httpclient | src/Client.php | Client.createRequestLogToken | public function createRequestLogToken($method, $url, $headers, $content)
{
$token = strtoupper($method) . ' ' . $url;
if (!empty($headers)) {
$token .= "\n" . implode("\n", $headers);
}
if ($content !== null) {
$token .= "\n\n" . StringHelper::truncate($conten... | php | public function createRequestLogToken($method, $url, $headers, $content)
{
$token = strtoupper($method) . ' ' . $url;
if (!empty($headers)) {
$token .= "\n" . implode("\n", $headers);
}
if ($content !== null) {
$token .= "\n\n" . StringHelper::truncate($conten... | [
"public",
"function",
"createRequestLogToken",
"(",
"$",
"method",
",",
"$",
"url",
",",
"$",
"headers",
",",
"$",
"content",
")",
"{",
"$",
"token",
"=",
"strtoupper",
"(",
"$",
"method",
")",
".",
"' '",
".",
"$",
"url",
";",
"if",
"(",
"!",
"emp... | Composes the log/profiling message token for the given HTTP request parameters.
This method should be used by transports during request sending logging.
@param string $method request method name.
@param string $url request URL.
@param array $headers request headers.
@param string $content request content.
@return strin... | [
"Composes",
"the",
"log",
"/",
"profiling",
"message",
"token",
"for",
"the",
"given",
"HTTP",
"request",
"parameters",
".",
"This",
"method",
"should",
"be",
"used",
"by",
"transports",
"during",
"request",
"sending",
"logging",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Client.php#L271-L281 |
yiisoft/yii2-httpclient | src/Client.php | Client.get | public function get($url, $data = null, $headers = [], $options = [])
{
return $this->createRequestShortcut('GET', $url, $data, $headers, $options);
} | php | public function get($url, $data = null, $headers = [], $options = [])
{
return $this->createRequestShortcut('GET', $url, $data, $headers, $options);
} | [
"public",
"function",
"get",
"(",
"$",
"url",
",",
"$",
"data",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"createRequestShortcut",
"(",
"'GET'",
",",
"$",
"url",
",... | Creates 'GET' request.
@param array|string $url target URL.
@param array|string $data if array - request data, otherwise - request content.
@param array $headers request headers.
@param array $options request options.
@return Request request instance. | [
"Creates",
"GET",
"request",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Client.php#L293-L296 |
yiisoft/yii2-httpclient | src/Client.php | Client.post | public function post($url, $data = null, $headers = [], $options = [])
{
return $this->createRequestShortcut('POST', $url, $data, $headers, $options);
} | php | public function post($url, $data = null, $headers = [], $options = [])
{
return $this->createRequestShortcut('POST', $url, $data, $headers, $options);
} | [
"public",
"function",
"post",
"(",
"$",
"url",
",",
"$",
"data",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"createRequestShortcut",
"(",
"'POST'",
",",
"$",
"url",
... | Creates 'POST' request.
@param array|string $url target URL.
@param array|string $data if array - request data, otherwise - request content.
@param array $headers request headers.
@param array $options request options.
@return Request request instance. | [
"Creates",
"POST",
"request",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Client.php#L306-L309 |
yiisoft/yii2-httpclient | src/Client.php | Client.put | public function put($url, $data = null, $headers = [], $options = [])
{
return $this->createRequestShortcut('PUT', $url, $data, $headers, $options);
} | php | public function put($url, $data = null, $headers = [], $options = [])
{
return $this->createRequestShortcut('PUT', $url, $data, $headers, $options);
} | [
"public",
"function",
"put",
"(",
"$",
"url",
",",
"$",
"data",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"createRequestShortcut",
"(",
"'PUT'",
",",
"$",
"url",
",... | Creates 'PUT' request.
@param array|string $url target URL.
@param array|string $data if array - request data, otherwise - request content.
@param array $headers request headers.
@param array $options request options.
@return Request request instance. | [
"Creates",
"PUT",
"request",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Client.php#L319-L322 |
yiisoft/yii2-httpclient | src/Client.php | Client.patch | public function patch($url, $data = null, $headers = [], $options = [])
{
return $this->createRequestShortcut('PATCH', $url, $data, $headers, $options);
} | php | public function patch($url, $data = null, $headers = [], $options = [])
{
return $this->createRequestShortcut('PATCH', $url, $data, $headers, $options);
} | [
"public",
"function",
"patch",
"(",
"$",
"url",
",",
"$",
"data",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"createRequestShortcut",
"(",
"'PATCH'",
",",
"$",
"url",
... | Creates 'PATCH' request.
@param array|string $url target URL.
@param array|string $data if array - request data, otherwise - request content.
@param array $headers request headers.
@param array $options request options.
@return Request request instance. | [
"Creates",
"PATCH",
"request",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Client.php#L332-L335 |
yiisoft/yii2-httpclient | src/Client.php | Client.delete | public function delete($url, $data = null, $headers = [], $options = [])
{
return $this->createRequestShortcut('DELETE', $url, $data, $headers, $options);
} | php | public function delete($url, $data = null, $headers = [], $options = [])
{
return $this->createRequestShortcut('DELETE', $url, $data, $headers, $options);
} | [
"public",
"function",
"delete",
"(",
"$",
"url",
",",
"$",
"data",
"=",
"null",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"createRequestShortcut",
"(",
"'DELETE'",
",",
"$",
"url"... | Creates 'DELETE' request.
@param array|string $url target URL.
@param array|string $data if array - request data, otherwise - request content.
@param array $headers request headers.
@param array $options request options.
@return Request request instance. | [
"Creates",
"DELETE",
"request",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Client.php#L345-L348 |
yiisoft/yii2-httpclient | src/Client.php | Client.head | public function head($url, $headers = [], $options = [])
{
return $this->createRequestShortcut('HEAD', $url, null, $headers, $options);
} | php | public function head($url, $headers = [], $options = [])
{
return $this->createRequestShortcut('HEAD', $url, null, $headers, $options);
} | [
"public",
"function",
"head",
"(",
"$",
"url",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"createRequestShortcut",
"(",
"'HEAD'",
",",
"$",
"url",
",",
"null",
",",
"$",
"headers",... | Creates 'HEAD' request.
@param array|string $url target URL.
@param array $headers request headers.
@param array $options request options.
@return Request request instance. | [
"Creates",
"HEAD",
"request",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Client.php#L357-L360 |
yiisoft/yii2-httpclient | src/Client.php | Client.beforeSend | public function beforeSend($request)
{
$event = new RequestEvent();
$event->request = $request;
$this->trigger(self::EVENT_BEFORE_SEND, $event);
} | php | public function beforeSend($request)
{
$event = new RequestEvent();
$event->request = $request;
$this->trigger(self::EVENT_BEFORE_SEND, $event);
} | [
"public",
"function",
"beforeSend",
"(",
"$",
"request",
")",
"{",
"$",
"event",
"=",
"new",
"RequestEvent",
"(",
")",
";",
"$",
"event",
"->",
"request",
"=",
"$",
"request",
";",
"$",
"this",
"->",
"trigger",
"(",
"self",
"::",
"EVENT_BEFORE_SEND",
"... | This method is invoked right before request is sent.
The method will trigger the [[EVENT_BEFORE_SEND]] event.
@param Request $request request instance.
@since 2.0.1 | [
"This",
"method",
"is",
"invoked",
"right",
"before",
"request",
"is",
"sent",
".",
"The",
"method",
"will",
"trigger",
"the",
"[[",
"EVENT_BEFORE_SEND",
"]]",
"event",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Client.php#L379-L384 |
yiisoft/yii2-httpclient | src/Client.php | Client.afterSend | public function afterSend($request, $response)
{
$event = new RequestEvent();
$event->request = $request;
$event->response = $response;
$this->trigger(self::EVENT_AFTER_SEND, $event);
} | php | public function afterSend($request, $response)
{
$event = new RequestEvent();
$event->request = $request;
$event->response = $response;
$this->trigger(self::EVENT_AFTER_SEND, $event);
} | [
"public",
"function",
"afterSend",
"(",
"$",
"request",
",",
"$",
"response",
")",
"{",
"$",
"event",
"=",
"new",
"RequestEvent",
"(",
")",
";",
"$",
"event",
"->",
"request",
"=",
"$",
"request",
";",
"$",
"event",
"->",
"response",
"=",
"$",
"respo... | This method is invoked right after request is sent.
The method will trigger the [[EVENT_AFTER_SEND]] event.
@param Request $request request instance.
@param Response $response received response instance.
@since 2.0.1 | [
"This",
"method",
"is",
"invoked",
"right",
"after",
"request",
"is",
"sent",
".",
"The",
"method",
"will",
"trigger",
"the",
"[[",
"EVENT_AFTER_SEND",
"]]",
"event",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Client.php#L393-L399 |
yiisoft/yii2-httpclient | src/Message.php | Message.getHeaders | public function getHeaders()
{
if (!is_object($this->_headers)) {
$headerCollection = new HeaderCollection();
if (is_array($this->_headers)) {
foreach ($this->_headers as $name => $value) {
if (is_int($name)) {
// parse raw ... | php | public function getHeaders()
{
if (!is_object($this->_headers)) {
$headerCollection = new HeaderCollection();
if (is_array($this->_headers)) {
foreach ($this->_headers as $name => $value) {
if (is_int($name)) {
// parse raw ... | [
"public",
"function",
"getHeaders",
"(",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"this",
"->",
"_headers",
")",
")",
"{",
"$",
"headerCollection",
"=",
"new",
"HeaderCollection",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
... | Returns the header collection.
The header collection contains the HTTP headers associated with HTTP message.
@return HeaderCollection the header collection | [
"Returns",
"the",
"header",
"collection",
".",
"The",
"header",
"collection",
"contains",
"the",
"HTTP",
"headers",
"associated",
"with",
"HTTP",
"message",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Message.php#L76-L103 |
yiisoft/yii2-httpclient | src/Message.php | Message.addHeaders | public function addHeaders(array $headers)
{
$headerCollection = $this->getHeaders();
foreach ($headers as $name => $value) {
$headerCollection->add($name, $value);
}
return $this;
} | php | public function addHeaders(array $headers)
{
$headerCollection = $this->getHeaders();
foreach ($headers as $name => $value) {
$headerCollection->add($name, $value);
}
return $this;
} | [
"public",
"function",
"addHeaders",
"(",
"array",
"$",
"headers",
")",
"{",
"$",
"headerCollection",
"=",
"$",
"this",
"->",
"getHeaders",
"(",
")",
";",
"foreach",
"(",
"$",
"headers",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"headerColle... | Adds more headers to the already defined ones.
@param array $headers additional headers in format: [headerName => headerValue]
@return $this self reference. | [
"Adds",
"more",
"headers",
"to",
"the",
"already",
"defined",
"ones",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Message.php#L110-L117 |
yiisoft/yii2-httpclient | src/Message.php | Message.hasHeaders | public function hasHeaders()
{
if (is_object($this->_headers)) {
return $this->_headers->getCount() > 0;
}
return !empty($this->_headers);
} | php | public function hasHeaders()
{
if (is_object($this->_headers)) {
return $this->_headers->getCount() > 0;
}
return !empty($this->_headers);
} | [
"public",
"function",
"hasHeaders",
"(",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"this",
"->",
"_headers",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_headers",
"->",
"getCount",
"(",
")",
">",
"0",
";",
"}",
"return",
"!",
"empty",
"(",
"$",... | Checks of HTTP message contains any header.
Using this method you are able to check cookie presence without instantiating [[HeaderCollection]].
@return bool whether message contains any header. | [
"Checks",
"of",
"HTTP",
"message",
"contains",
"any",
"header",
".",
"Using",
"this",
"method",
"you",
"are",
"able",
"to",
"check",
"cookie",
"presence",
"without",
"instantiating",
"[[",
"HeaderCollection",
"]]",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Message.php#L124-L130 |
yiisoft/yii2-httpclient | src/Message.php | Message.getCookies | public function getCookies()
{
if (!is_object($this->_cookies)) {
$cookieCollection = new CookieCollection();
if (is_array($this->_cookies)) {
foreach ($this->_cookies as $cookie) {
if (!is_object($cookie)) {
$cookie = new C... | php | public function getCookies()
{
if (!is_object($this->_cookies)) {
$cookieCollection = new CookieCollection();
if (is_array($this->_cookies)) {
foreach ($this->_cookies as $cookie) {
if (!is_object($cookie)) {
$cookie = new C... | [
"public",
"function",
"getCookies",
"(",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"this",
"->",
"_cookies",
")",
")",
"{",
"$",
"cookieCollection",
"=",
"new",
"CookieCollection",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
... | Returns the cookie collection.
The cookie collection contains the cookies associated with HTTP message.
@return CookieCollection|Cookie[] the cookie collection. | [
"Returns",
"the",
"cookie",
"collection",
".",
"The",
"cookie",
"collection",
"contains",
"the",
"cookies",
"associated",
"with",
"HTTP",
"message",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Message.php#L148-L163 |
yiisoft/yii2-httpclient | src/Message.php | Message.addCookies | public function addCookies(array $cookies)
{
$cookieCollection = $this->getCookies();
foreach ($cookies as $cookie) {
if (!is_object($cookie)) {
$cookie = new Cookie($cookie);
}
$cookieCollection->add($cookie);
}
return $this;
} | php | public function addCookies(array $cookies)
{
$cookieCollection = $this->getCookies();
foreach ($cookies as $cookie) {
if (!is_object($cookie)) {
$cookie = new Cookie($cookie);
}
$cookieCollection->add($cookie);
}
return $this;
} | [
"public",
"function",
"addCookies",
"(",
"array",
"$",
"cookies",
")",
"{",
"$",
"cookieCollection",
"=",
"$",
"this",
"->",
"getCookies",
"(",
")",
";",
"foreach",
"(",
"$",
"cookies",
"as",
"$",
"cookie",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
... | Adds more cookies to the already defined ones.
@param Cookie[]|array $cookies additional cookies.
@return $this self reference. | [
"Adds",
"more",
"cookies",
"to",
"the",
"already",
"defined",
"ones",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Message.php#L170-L180 |
yiisoft/yii2-httpclient | src/Message.php | Message.hasCookies | public function hasCookies()
{
if (is_object($this->_cookies)) {
return $this->_cookies->getCount() > 0;
}
return !empty($this->_cookies);
} | php | public function hasCookies()
{
if (is_object($this->_cookies)) {
return $this->_cookies->getCount() > 0;
}
return !empty($this->_cookies);
} | [
"public",
"function",
"hasCookies",
"(",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"this",
"->",
"_cookies",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_cookies",
"->",
"getCount",
"(",
")",
">",
"0",
";",
"}",
"return",
"!",
"empty",
"(",
"$",... | Checks of HTTP message contains any cookie.
Using this method you are able to check cookie presence without instantiating [[CookieCollection]].
@return bool whether message contains any cookie. | [
"Checks",
"of",
"HTTP",
"message",
"contains",
"any",
"cookie",
".",
"Using",
"this",
"method",
"you",
"are",
"able",
"to",
"check",
"cookie",
"presence",
"without",
"instantiating",
"[[",
"CookieCollection",
"]]",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Message.php#L187-L193 |
yiisoft/yii2-httpclient | src/Message.php | Message.hasContent | public function hasContent($key)
{
$content = $this->getContent();
return is_array($content) && isset($content[$key]);
} | php | public function hasContent($key)
{
$content = $this->getContent();
return is_array($content) && isset($content[$key]);
} | [
"public",
"function",
"hasContent",
"(",
"$",
"key",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"getContent",
"(",
")",
";",
"return",
"is_array",
"(",
"$",
"content",
")",
"&&",
"isset",
"(",
"$",
"content",
"[",
"$",
"key",
"]",
")",
";",
... | Checks if content with provided name exists
@param $key string Name of the content parameter
@return bool
@since 2.0.10 | [
"Checks",
"if",
"content",
"with",
"provided",
"name",
"exists"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Message.php#L221-L225 |
yiisoft/yii2-httpclient | src/Message.php | Message.addData | public function addData($data)
{
if (empty($this->_data)) {
$this->_data = $data;
} else {
if (!is_array($this->_data)) {
throw new \yii\base\Exception('Unable to merge existing data with new data. Existing data is not an array.');
}
$t... | php | public function addData($data)
{
if (empty($this->_data)) {
$this->_data = $data;
} else {
if (!is_array($this->_data)) {
throw new \yii\base\Exception('Unable to merge existing data with new data. Existing data is not an array.');
}
$t... | [
"public",
"function",
"addData",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_data",
")",
")",
"{",
"$",
"this",
"->",
"_data",
"=",
"$",
"data",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
... | Adds data fields to the existing ones.
@param array $data additional content data fields.
@return $this self reference.
@since 2.0.1 | [
"Adds",
"data",
"fields",
"to",
"the",
"existing",
"ones",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Message.php#L255-L266 |
yiisoft/yii2-httpclient | src/Message.php | Message.getFormat | public function getFormat()
{
if ($this->_format === null) {
$this->_format = $this->defaultFormat();
}
return $this->_format;
} | php | public function getFormat()
{
if ($this->_format === null) {
$this->_format = $this->defaultFormat();
}
return $this->_format;
} | [
"public",
"function",
"getFormat",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_format",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_format",
"=",
"$",
"this",
"->",
"defaultFormat",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"_format",
"... | Returns body format.
@return string body format name. | [
"Returns",
"body",
"format",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Message.php#L283-L289 |
yiisoft/yii2-httpclient | src/Message.php | Message.composeHeaderLines | public function composeHeaderLines()
{
if (!$this->hasHeaders()) {
return [];
}
$headers = [];
foreach ($this->getHeaders() as $name => $values) {
$name = str_replace(' ', '-', ucwords(str_replace('-', ' ', $name)));
foreach ($values as $value) {
... | php | public function composeHeaderLines()
{
if (!$this->hasHeaders()) {
return [];
}
$headers = [];
foreach ($this->getHeaders() as $name => $values) {
$name = str_replace(' ', '-', ucwords(str_replace('-', ' ', $name)));
foreach ($values as $value) {
... | [
"public",
"function",
"composeHeaderLines",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasHeaders",
"(",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"headers",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getHeaders",
"(",
... | Composes raw header lines from [[headers]].
Each line will be a string in format: 'header-name: value'.
@return array raw header lines. | [
"Composes",
"raw",
"header",
"lines",
"from",
"[[",
"headers",
"]]",
".",
"Each",
"line",
"will",
"be",
"a",
"string",
"in",
"format",
":",
"header",
"-",
"name",
":",
"value",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Message.php#L305-L318 |
yiisoft/yii2-httpclient | src/Message.php | Message.toString | public function toString()
{
$result = '';
if ($this->hasHeaders()) {
$headers = $this->composeHeaderLines();
$result .= implode("\n", $headers);
}
$content = $this->getContent();
if ($content !== null) {
$result .= "\n\n" . $content;
... | php | public function toString()
{
$result = '';
if ($this->hasHeaders()) {
$headers = $this->composeHeaderLines();
$result .= implode("\n", $headers);
}
$content = $this->getContent();
if ($content !== null) {
$result .= "\n\n" . $content;
... | [
"public",
"function",
"toString",
"(",
")",
"{",
"$",
"result",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"hasHeaders",
"(",
")",
")",
"{",
"$",
"headers",
"=",
"$",
"this",
"->",
"composeHeaderLines",
"(",
")",
";",
"$",
"result",
".=",
"implo... | Returns string representation of this HTTP message.
@return string the string representation of this HTTP message. | [
"Returns",
"string",
"representation",
"of",
"this",
"HTTP",
"message",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/Message.php#L324-L338 |
yiisoft/yii2-httpclient | src/UrlEncodedFormatter.php | UrlEncodedFormatter.format | public function format(Request $request)
{
if (($data = $request->getData()) !== null) {
$content = http_build_query((array)$data, '', '&', $this->encodingType);
}
if (strcasecmp('GET', $request->getMethod()) === 0) {
if (!empty($content)) {
$request-... | php | public function format(Request $request)
{
if (($data = $request->getData()) !== null) {
$content = http_build_query((array)$data, '', '&', $this->encodingType);
}
if (strcasecmp('GET', $request->getMethod()) === 0) {
if (!empty($content)) {
$request-... | [
"public",
"function",
"format",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"(",
"$",
"data",
"=",
"$",
"request",
"->",
"getData",
"(",
")",
")",
"!==",
"null",
")",
"{",
"$",
"content",
"=",
"http_build_query",
"(",
"(",
"array",
")",
"$... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/UrlEncodedFormatter.php#L41-L68 |
yiisoft/yii2-httpclient | src/debug/RequestExecuteAction.php | RequestExecuteAction.createRequestFromLog | protected function createRequestFromLog($requestLog)
{
if (strpos($requestLog, "\n\n")) {
list($head, $content) = explode("\n\n", $requestLog, 2);
} else {
$head = $requestLog;
$content = null;
}
$headers = explode("\n", $head);
$main = ar... | php | protected function createRequestFromLog($requestLog)
{
if (strpos($requestLog, "\n\n")) {
list($head, $content) = explode("\n\n", $requestLog, 2);
} else {
$head = $requestLog;
$content = null;
}
$headers = explode("\n", $head);
$main = ar... | [
"protected",
"function",
"createRequestFromLog",
"(",
"$",
"requestLog",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"requestLog",
",",
"\"\\n\\n\"",
")",
")",
"{",
"list",
"(",
"$",
"head",
",",
"$",
"content",
")",
"=",
"explode",
"(",
"\"\\n\\n\"",
",",
... | Creates an HTTP request instance from log entry.
@param string $requestLog HTTP request log entry
@return \yii\httpclient\Request request instance.
@throws \yii\base\InvalidConfigException | [
"Creates",
"an",
"HTTP",
"request",
"instance",
"from",
"log",
"entry",
"."
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/debug/RequestExecuteAction.php#L76-L94 |
yiisoft/yii2-httpclient | src/JsonFormatter.php | JsonFormatter.format | public function format(Request $request)
{
$request->getHeaders()->set('Content-Type', 'application/json; charset=UTF-8');
if (($data = $request->getData()) !== null) {
$request->setContent(Json::encode($request->getData(), $this->encodeOptions));
}
return $request;
} | php | public function format(Request $request)
{
$request->getHeaders()->set('Content-Type', 'application/json; charset=UTF-8');
if (($data = $request->getData()) !== null) {
$request->setContent(Json::encode($request->getData(), $this->encodeOptions));
}
return $request;
} | [
"public",
"function",
"format",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"request",
"->",
"getHeaders",
"(",
")",
"->",
"set",
"(",
"'Content-Type'",
",",
"'application/json; charset=UTF-8'",
")",
";",
"if",
"(",
"(",
"$",
"data",
"=",
"$",
"request"... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/JsonFormatter.php#L31-L38 |
yiisoft/yii2-httpclient | src/StreamTransport.php | StreamTransport.send | public function send($request)
{
$request->beforeSend();
$request->prepare();
$url = $request->getFullUrl();
$method = strtoupper($request->getMethod());
$contextOptions = [
'http' => [
'method' => $method,
'ignore_errors' => tru... | php | public function send($request)
{
$request->beforeSend();
$request->prepare();
$url = $request->getFullUrl();
$method = strtoupper($request->getMethod());
$contextOptions = [
'http' => [
'method' => $method,
'ignore_errors' => tru... | [
"public",
"function",
"send",
"(",
"$",
"request",
")",
"{",
"$",
"request",
"->",
"beforeSend",
"(",
")",
";",
"$",
"request",
"->",
"prepare",
"(",
")",
";",
"$",
"url",
"=",
"$",
"request",
"->",
"getFullUrl",
"(",
")",
";",
"$",
"method",
"=",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yiisoft/yii2-httpclient/blob/d0c78184665c82f39874382895a33b06885563ce/src/StreamTransport.php#L27-L78 |
doctrine/instantiator | src/Doctrine/Instantiator/Instantiator.php | Instantiator.instantiate | public function instantiate($className)
{
if (isset(self::$cachedCloneables[$className])) {
return clone self::$cachedCloneables[$className];
}
if (isset(self::$cachedInstantiators[$className])) {
$factory = self::$cachedInstantiators[$className];
return... | php | public function instantiate($className)
{
if (isset(self::$cachedCloneables[$className])) {
return clone self::$cachedCloneables[$className];
}
if (isset(self::$cachedInstantiators[$className])) {
$factory = self::$cachedInstantiators[$className];
return... | [
"public",
"function",
"instantiate",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"cachedCloneables",
"[",
"$",
"className",
"]",
")",
")",
"{",
"return",
"clone",
"self",
"::",
"$",
"cachedCloneables",
"[",
"$",
"classNam... | {@inheritDoc} | [
"{"
] | train | https://github.com/doctrine/instantiator/blob/a2c590166b2133a4633738648b6b064edae0814a/src/Doctrine/Instantiator/Instantiator.php#L47-L60 |
doctrine/instantiator | src/Doctrine/Instantiator/Instantiator.php | Instantiator.buildAndCacheFromFactory | private function buildAndCacheFromFactory(string $className)
{
$factory = self::$cachedInstantiators[$className] = $this->buildFactory($className);
$instance = $factory();
if ($this->isSafeToClone(new ReflectionClass($instance))) {
self::$cachedCloneables[$className] = clone $i... | php | private function buildAndCacheFromFactory(string $className)
{
$factory = self::$cachedInstantiators[$className] = $this->buildFactory($className);
$instance = $factory();
if ($this->isSafeToClone(new ReflectionClass($instance))) {
self::$cachedCloneables[$className] = clone $i... | [
"private",
"function",
"buildAndCacheFromFactory",
"(",
"string",
"$",
"className",
")",
"{",
"$",
"factory",
"=",
"self",
"::",
"$",
"cachedInstantiators",
"[",
"$",
"className",
"]",
"=",
"$",
"this",
"->",
"buildFactory",
"(",
"$",
"className",
")",
";",
... | Builds the requested object and caches it in static properties for performance
@return object | [
"Builds",
"the",
"requested",
"object",
"and",
"caches",
"it",
"in",
"static",
"properties",
"for",
"performance"
] | train | https://github.com/doctrine/instantiator/blob/a2c590166b2133a4633738648b6b064edae0814a/src/Doctrine/Instantiator/Instantiator.php#L67-L77 |
doctrine/instantiator | src/Doctrine/Instantiator/Instantiator.php | Instantiator.buildFactory | private function buildFactory(string $className) : callable
{
$reflectionClass = $this->getReflectionClass($className);
if ($this->isInstantiableViaReflection($reflectionClass)) {
return [$reflectionClass, 'newInstanceWithoutConstructor'];
}
$serializedString = sprintf(... | php | private function buildFactory(string $className) : callable
{
$reflectionClass = $this->getReflectionClass($className);
if ($this->isInstantiableViaReflection($reflectionClass)) {
return [$reflectionClass, 'newInstanceWithoutConstructor'];
}
$serializedString = sprintf(... | [
"private",
"function",
"buildFactory",
"(",
"string",
"$",
"className",
")",
":",
"callable",
"{",
"$",
"reflectionClass",
"=",
"$",
"this",
"->",
"getReflectionClass",
"(",
"$",
"className",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isInstantiableViaReflection... | Builds a callable capable of instantiating the given $className without
invoking its constructor.
@throws InvalidArgumentException
@throws UnexpectedValueException
@throws ReflectionException | [
"Builds",
"a",
"callable",
"capable",
"of",
"instantiating",
"the",
"given",
"$className",
"without",
"invoking",
"its",
"constructor",
"."
] | train | https://github.com/doctrine/instantiator/blob/a2c590166b2133a4633738648b6b064edae0814a/src/Doctrine/Instantiator/Instantiator.php#L87-L107 |
doctrine/instantiator | src/Doctrine/Instantiator/Instantiator.php | Instantiator.getReflectionClass | private function getReflectionClass($className) : ReflectionClass
{
if (! class_exists($className)) {
throw InvalidArgumentException::fromNonExistingClass($className);
}
$reflection = new ReflectionClass($className);
if ($reflection->isAbstract()) {
throw In... | php | private function getReflectionClass($className) : ReflectionClass
{
if (! class_exists($className)) {
throw InvalidArgumentException::fromNonExistingClass($className);
}
$reflection = new ReflectionClass($className);
if ($reflection->isAbstract()) {
throw In... | [
"private",
"function",
"getReflectionClass",
"(",
"$",
"className",
")",
":",
"ReflectionClass",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"className",
")",
")",
"{",
"throw",
"InvalidArgumentException",
"::",
"fromNonExistingClass",
"(",
"$",
"className",
... | @param string $className
@throws InvalidArgumentException
@throws ReflectionException | [
"@param",
"string",
"$className"
] | train | https://github.com/doctrine/instantiator/blob/a2c590166b2133a4633738648b6b064edae0814a/src/Doctrine/Instantiator/Instantiator.php#L115-L128 |
doctrine/instantiator | src/Doctrine/Instantiator/Instantiator.php | Instantiator.hasInternalAncestors | private function hasInternalAncestors(ReflectionClass $reflectionClass) : bool
{
do {
if ($reflectionClass->isInternal()) {
return true;
}
$reflectionClass = $reflectionClass->getParentClass();
} while ($reflectionClass);
return false;
... | php | private function hasInternalAncestors(ReflectionClass $reflectionClass) : bool
{
do {
if ($reflectionClass->isInternal()) {
return true;
}
$reflectionClass = $reflectionClass->getParentClass();
} while ($reflectionClass);
return false;
... | [
"private",
"function",
"hasInternalAncestors",
"(",
"ReflectionClass",
"$",
"reflectionClass",
")",
":",
"bool",
"{",
"do",
"{",
"if",
"(",
"$",
"reflectionClass",
"->",
"isInternal",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"reflectionClass",
"=... | Verifies whether the given class is to be considered internal | [
"Verifies",
"whether",
"the",
"given",
"class",
"is",
"to",
"be",
"considered",
"internal"
] | train | https://github.com/doctrine/instantiator/blob/a2c590166b2133a4633738648b6b064edae0814a/src/Doctrine/Instantiator/Instantiator.php#L176-L187 |
doctrine/DoctrineMigrationsBundle | Command/DoctrineCommand.php | DoctrineCommand.injectContainerToMigrations | private static function injectContainerToMigrations(ContainerInterface $container, array $versions) : void
{
foreach ($versions as $version) {
$migration = $version->getMigration();
if (! ($migration instanceof ContainerAwareInterface)) {
continue;
}
... | php | private static function injectContainerToMigrations(ContainerInterface $container, array $versions) : void
{
foreach ($versions as $version) {
$migration = $version->getMigration();
if (! ($migration instanceof ContainerAwareInterface)) {
continue;
}
... | [
"private",
"static",
"function",
"injectContainerToMigrations",
"(",
"ContainerInterface",
"$",
"container",
",",
"array",
"$",
"versions",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"versions",
"as",
"$",
"version",
")",
"{",
"$",
"migration",
"=",
"$",
"v... | @param Version[] $versions
Injects the container to migrations aware of it | [
"@param",
"Version",
"[]",
"$versions"
] | train | https://github.com/doctrine/DoctrineMigrationsBundle/blob/a43bfb16fc1ee3c52d34d7d7b160d188347ed20a/Command/DoctrineCommand.php#L128-L138 |
doctrine/DoctrineMigrationsBundle | DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder() : TreeBuilder
{
$treeBuilder = new TreeBuilder('doctrine_migrations');
if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
... | php | public function getConfigTreeBuilder() : TreeBuilder
{
$treeBuilder = new TreeBuilder('doctrine_migrations');
if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
... | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
":",
"TreeBuilder",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
"'doctrine_migrations'",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"treeBuilder",
",",
"'getRootNode'",
")",
")",
"{",
"$... | Generates the configuration tree.
@return TreeBuilder The config tree builder | [
"Generates",
"the",
"configuration",
"tree",
"."
] | train | https://github.com/doctrine/DoctrineMigrationsBundle/blob/a43bfb16fc1ee3c52d34d7d7b160d188347ed20a/DependencyInjection/Configuration.php#L29-L79 |
doctrine/DoctrineMigrationsBundle | DependencyInjection/Configuration.php | Configuration.getOrganizeMigrationsModes | private function getOrganizeMigrationsModes() : array
{
$constPrefix = 'VERSIONS_ORGANIZATION_';
$prefixLen = strlen($constPrefix);
$refClass = new ReflectionClass('Doctrine\Migrations\Configuration\Configuration');
$constsArray = $refClass->getConstants();
$namesArray ... | php | private function getOrganizeMigrationsModes() : array
{
$constPrefix = 'VERSIONS_ORGANIZATION_';
$prefixLen = strlen($constPrefix);
$refClass = new ReflectionClass('Doctrine\Migrations\Configuration\Configuration');
$constsArray = $refClass->getConstants();
$namesArray ... | [
"private",
"function",
"getOrganizeMigrationsModes",
"(",
")",
":",
"array",
"{",
"$",
"constPrefix",
"=",
"'VERSIONS_ORGANIZATION_'",
";",
"$",
"prefixLen",
"=",
"strlen",
"(",
"$",
"constPrefix",
")",
";",
"$",
"refClass",
"=",
"new",
"ReflectionClass",
"(",
... | Find organize migrations modes for their names
@return string[] | [
"Find",
"organize",
"migrations",
"modes",
"for",
"their",
"names"
] | train | https://github.com/doctrine/DoctrineMigrationsBundle/blob/a43bfb16fc1ee3c52d34d7d7b160d188347ed20a/DependencyInjection/Configuration.php#L87-L104 |
laravel-notification-channels/facebook-poster | src/FacebookPosterPost.php | FacebookPosterPost.withVideo | public function withVideo($videoPath, $data = [], $endpoint = 'me/videos')
{
$this->video = new video($videoPath, $endpoint);
if (isset($data['title'])) {
$this->video->setTitle($data['title']);
}
if (isset($data['description'])) {
$this->video->setDescripti... | php | public function withVideo($videoPath, $data = [], $endpoint = 'me/videos')
{
$this->video = new video($videoPath, $endpoint);
if (isset($data['title'])) {
$this->video->setTitle($data['title']);
}
if (isset($data['description'])) {
$this->video->setDescripti... | [
"public",
"function",
"withVideo",
"(",
"$",
"videoPath",
",",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"endpoint",
"=",
"'me/videos'",
")",
"{",
"$",
"this",
"->",
"video",
"=",
"new",
"video",
"(",
"$",
"videoPath",
",",
"$",
"endpoint",
")",
";",
"... | Set facebook post image.
@param $videoPath
@param array $data
@param string $endpoint
@return $this | [
"Set",
"facebook",
"post",
"image",
"."
] | train | https://github.com/laravel-notification-channels/facebook-poster/blob/4a4f18cf1d331db9c455aeaf41c2b82890ae2863/src/FacebookPosterPost.php#L84-L97 |
laravel-notification-channels/facebook-poster | src/FacebookPosterPost.php | FacebookPosterPost.getPostBody | public function getPostBody()
{
$body = [
'message' => $this->getContent(),
];
if ($this->link != null) {
$body['link'] = $this->link->getUrl();
}
if ($this->image != null) {
$body['media'] = $this->image;
}
if ($this->vi... | php | public function getPostBody()
{
$body = [
'message' => $this->getContent(),
];
if ($this->link != null) {
$body['link'] = $this->link->getUrl();
}
if ($this->image != null) {
$body['media'] = $this->image;
}
if ($this->vi... | [
"public",
"function",
"getPostBody",
"(",
")",
"{",
"$",
"body",
"=",
"[",
"'message'",
"=>",
"$",
"this",
"->",
"getContent",
"(",
")",
",",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"link",
"!=",
"null",
")",
"{",
"$",
"body",
"[",
"'link'",
"]",... | Build Facebook post request body.
@return array | [
"Build",
"Facebook",
"post",
"request",
"body",
"."
] | train | https://github.com/laravel-notification-channels/facebook-poster/blob/4a4f18cf1d331db9c455aeaf41c2b82890ae2863/src/FacebookPosterPost.php#L129-L152 |
laravel-notification-channels/facebook-poster | src/FacebookPosterChannel.php | FacebookPosterChannel.send | public function send($notifiable, Notification $notification)
{
if ($facebookSettings = $notifiable->routeNotificationFor('facebookPoster')) {
$this->switchSettings($facebookSettings);
}
$facebookMessage = $notification->toFacebookPoster($notifiable);
$postBody = $faceb... | php | public function send($notifiable, Notification $notification)
{
if ($facebookSettings = $notifiable->routeNotificationFor('facebookPoster')) {
$this->switchSettings($facebookSettings);
}
$facebookMessage = $notification->toFacebookPoster($notifiable);
$postBody = $faceb... | [
"public",
"function",
"send",
"(",
"$",
"notifiable",
",",
"Notification",
"$",
"notification",
")",
"{",
"if",
"(",
"$",
"facebookSettings",
"=",
"$",
"notifiable",
"->",
"routeNotificationFor",
"(",
"'facebookPoster'",
")",
")",
"{",
"$",
"this",
"->",
"sw... | Send the given notification.
@param mixed $notifiable
@param \Illuminate\Notifications\Notification $notification
@throws InvalidPostContentException | [
"Send",
"the",
"given",
"notification",
"."
] | train | https://github.com/laravel-notification-channels/facebook-poster/blob/4a4f18cf1d331db9c455aeaf41c2b82890ae2863/src/FacebookPosterChannel.php#L31-L61 |
laravel-notification-channels/facebook-poster | src/FacebookPosterChannel.php | FacebookPosterChannel.guardAgainstInvalidPostContent | protected function guardAgainstInvalidPostContent($postBody)
{
if (! is_null($postBody['message'])) {
return;
}
if (isset($postBody['link'])) {
return;
}
if (isset($postBody['media'])) {
return;
}
throw InvalidPostContent... | php | protected function guardAgainstInvalidPostContent($postBody)
{
if (! is_null($postBody['message'])) {
return;
}
if (isset($postBody['link'])) {
return;
}
if (isset($postBody['media'])) {
return;
}
throw InvalidPostContent... | [
"protected",
"function",
"guardAgainstInvalidPostContent",
"(",
"$",
"postBody",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"postBody",
"[",
"'message'",
"]",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"postBody",
"[",
"'link'",... | @param array $postBody
@throws \NotificationChannels\FacebookPoster\Exceptions\InvalidPostContent | [
"@param",
"array",
"$postBody"
] | train | https://github.com/laravel-notification-channels/facebook-poster/blob/4a4f18cf1d331db9c455aeaf41c2b82890ae2863/src/FacebookPosterChannel.php#L68-L83 |
laravel-notification-channels/facebook-poster | src/FacebookPosterServiceProvider.php | FacebookPosterServiceProvider.boot | public function boot()
{
// Bootstrap code here.
$this->app->when(FacebookPosterChannel::class)
->needs(\Facebook\Facebook::class)
->give(function () {
return new \Facebook\Facebook([
'app_id' => config('services.facebook_poster.app_id'),
... | php | public function boot()
{
// Bootstrap code here.
$this->app->when(FacebookPosterChannel::class)
->needs(\Facebook\Facebook::class)
->give(function () {
return new \Facebook\Facebook([
'app_id' => config('services.facebook_poster.app_id'),
... | [
"public",
"function",
"boot",
"(",
")",
"{",
"// Bootstrap code here.",
"$",
"this",
"->",
"app",
"->",
"when",
"(",
"FacebookPosterChannel",
"::",
"class",
")",
"->",
"needs",
"(",
"\\",
"Facebook",
"\\",
"Facebook",
"::",
"class",
")",
"->",
"give",
"(",... | Bootstrap the application services. | [
"Bootstrap",
"the",
"application",
"services",
"."
] | train | https://github.com/laravel-notification-channels/facebook-poster/blob/4a4f18cf1d331db9c455aeaf41c2b82890ae2863/src/FacebookPosterServiceProvider.php#L12-L24 |
QuilhaSoft/OpenCnabPHP | src/RegistroRemAbstract.php | RegistroRemAbstract.___get | public function ___get($prop) {
// retorna o valor da propriedade
if (isset($this->meta[$prop])) {
$metaData = (isset($this->meta[$prop])) ? $this->meta[$prop] : null;
$this->data[$prop] = !isset($this->data[$prop]) || $this->data[$prop] == '' ? $metaData['default'] : $this->... | php | public function ___get($prop) {
// retorna o valor da propriedade
if (isset($this->meta[$prop])) {
$metaData = (isset($this->meta[$prop])) ? $this->meta[$prop] : null;
$this->data[$prop] = !isset($this->data[$prop]) || $this->data[$prop] == '' ? $metaData['default'] : $this->... | [
"public",
"function",
"___get",
"(",
"$",
"prop",
")",
"{",
"// retorna o valor da propriedade\r",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"meta",
"[",
"$",
"prop",
"]",
")",
")",
"{",
"$",
"metaData",
"=",
"(",
"isset",
"(",
"$",
"this",
"->",
"... | Método ___get()
metodo auxiliar para ser chamado para dentro de metodo get personalizado | [
"Método",
"___get",
"()",
"metodo",
"auxiliar",
"para",
"ser",
"chamado",
"para",
"dentro",
"de",
"metodo",
"get",
"personalizado"
] | train | https://github.com/QuilhaSoft/OpenCnabPHP/blob/9dc7a4ed884690ee2febe1b4ecf4ed09debb81f1/src/RegistroRemAbstract.php#L90-L124 |
QuilhaSoft/OpenCnabPHP | src/RegistroRetAbstract.php | RegistroRetAbstract.___get | public function ___get($prop)
{
// retorna o valor da propriedade
if (isset($this->meta[$prop])) {
$metaData = (isset($this->meta[$prop])) ? $this->meta[$prop] : null;
switch ($metaData['tipo']) {
case 'decimal':
return ($this->data[... | php | public function ___get($prop)
{
// retorna o valor da propriedade
if (isset($this->meta[$prop])) {
$metaData = (isset($this->meta[$prop])) ? $this->meta[$prop] : null;
switch ($metaData['tipo']) {
case 'decimal':
return ($this->data[... | [
"public",
"function",
"___get",
"(",
"$",
"prop",
")",
"{",
"// retorna o valor da propriedade\r",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"meta",
"[",
"$",
"prop",
"]",
")",
")",
"{",
"$",
"metaData",
"=",
"(",
"isset",
"(",
"$",
"this",
"->",
"... | Método ___get()
metodo auxiliar para ser chamado para dentro de metodo get personalizado | [
"Método",
"___get",
"()",
"metodo",
"auxiliar",
"para",
"ser",
"chamado",
"para",
"dentro",
"de",
"metodo",
"get",
"personalizado"
] | train | https://github.com/QuilhaSoft/OpenCnabPHP/blob/9dc7a4ed884690ee2febe1b4ecf4ed09debb81f1/src/RegistroRetAbstract.php#L127-L147 |
QuilhaSoft/OpenCnabPHP | src/resources/B104/retorno/L050/Registro1.php | Registro1.inserirDetalhe | public function inserirDetalhe($linhaTxt){
$class = 'CnabPHP\resources\\'.RetornoAbstract::$banco.'\retorno\\'.RetornoAbstract::$layout.'\Registro3T';
self::addChild(new $class($linhaTxt));
RetornoAbstract::$linesCounter++;
//self::$counter++;
} | php | public function inserirDetalhe($linhaTxt){
$class = 'CnabPHP\resources\\'.RetornoAbstract::$banco.'\retorno\\'.RetornoAbstract::$layout.'\Registro3T';
self::addChild(new $class($linhaTxt));
RetornoAbstract::$linesCounter++;
//self::$counter++;
} | [
"public",
"function",
"inserirDetalhe",
"(",
"$",
"linhaTxt",
")",
"{",
"$",
"class",
"=",
"'CnabPHP\\resources\\\\'",
".",
"RetornoAbstract",
"::",
"$",
"banco",
".",
"'\\retorno\\\\'",
".",
"RetornoAbstract",
"::",
"$",
"layout",
".",
"'\\Registro3T'",
";",
"s... | /*
método inserirDetalhe()
Recebe os parametros
@$data = um array contendo os dados nessesarios para o arquvio | [
"/",
"*",
"método",
"inserirDetalhe",
"()",
"Recebe",
"os",
"parametros"
] | train | https://github.com/QuilhaSoft/OpenCnabPHP/blob/9dc7a4ed884690ee2febe1b4ecf4ed09debb81f1/src/resources/B104/retorno/L050/Registro1.php#L163-L169 |
QuilhaSoft/OpenCnabPHP | src/resources/B033/remessa/cnab240/Registro3P.php | Registro3P.modulo11 | protected static function modulo11($num, $base=9, $r=0)
{
$soma = 0;
$fator = 2;
// Separacao dos numeros
for ($i = strlen($num); $i > 0; $i--) {
// pega cada numero isoladamente
$numeros[$i] = substr($num,$i-1,1);
// Efetua multiplicac... | php | protected static function modulo11($num, $base=9, $r=0)
{
$soma = 0;
$fator = 2;
// Separacao dos numeros
for ($i = strlen($num); $i > 0; $i--) {
// pega cada numero isoladamente
$numeros[$i] = substr($num,$i-1,1);
// Efetua multiplicac... | [
"protected",
"static",
"function",
"modulo11",
"(",
"$",
"num",
",",
"$",
"base",
"=",
"9",
",",
"$",
"r",
"=",
"0",
")",
"{",
"$",
"soma",
"=",
"0",
";",
"$",
"fator",
"=",
"2",
";",
"// Separacao dos numeros\r",
"for",
"(",
"$",
"i",
"=",
"strl... | Cálculo do módulo 11
@param int $index
@return int | [
"Cálculo",
"do",
"módulo",
"11"
] | train | https://github.com/QuilhaSoft/OpenCnabPHP/blob/9dc7a4ed884690ee2febe1b4ecf4ed09debb81f1/src/resources/B033/remessa/cnab240/Registro3P.php#L399-L432 |
QuilhaSoft/OpenCnabPHP | src/RemessaAbstract.php | RemessaAbstract.addLote | public function addLote(array $data)
{
if (strpos(self::$layout, '240')) {
$class = '\CnabPHP\resources\\B' . self::$banco . '\remessa\\' . self::$layout . '\Registro1';
$loteData = $data ? $data : RemessaAbstract::$entryData;
$lote = new $class($loteData);
... | php | public function addLote(array $data)
{
if (strpos(self::$layout, '240')) {
$class = '\CnabPHP\resources\\B' . self::$banco . '\remessa\\' . self::$layout . '\Registro1';
$loteData = $data ? $data : RemessaAbstract::$entryData;
$lote = new $class($loteData);
... | [
"public",
"function",
"addLote",
"(",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"strpos",
"(",
"self",
"::",
"$",
"layout",
",",
"'240'",
")",
")",
"{",
"$",
"class",
"=",
"'\\CnabPHP\\resources\\\\B'",
".",
"self",
"::",
"$",
"banco",
".",
"'\\remess... | método addLote()
Recebe os parametros abaixo e insere num array para uso fururo
@array $data = recebe um array contendo os dados do lote a sera aberto e retorna para qualqer layout 240 o lote criado ou $this se outro | [
"método",
"addLote",
"()",
"Recebe",
"os",
"parametros",
"abaixo",
"e",
"insere",
"num",
"array",
"para",
"uso",
"fururo"
] | train | https://github.com/QuilhaSoft/OpenCnabPHP/blob/9dc7a4ed884690ee2febe1b4ecf4ed09debb81f1/src/RemessaAbstract.php#L79-L91 |
QuilhaSoft/OpenCnabPHP | src/RemessaAbstract.php | RemessaAbstract.getText | public function getText()
{
foreach (self::$children as $child) {
//echo '<pre>';
//var_dump($child);
//echo '</pre>';
$child->getText();
}
$class = '\CnabPHP\resources\\B' . self::$banco . '\remessa\\' . self::$layout . '\Registro9';
... | php | public function getText()
{
foreach (self::$children as $child) {
//echo '<pre>';
//var_dump($child);
//echo '</pre>';
$child->getText();
}
$class = '\CnabPHP\resources\\B' . self::$banco . '\remessa\\' . self::$layout . '\Registro9';
... | [
"public",
"function",
"getText",
"(",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"children",
"as",
"$",
"child",
")",
"{",
"//echo '<pre>';\r",
"//var_dump($child);\r",
"//echo '</pre>';\r",
"$",
"child",
"->",
"getText",
"(",
")",
";",
"}",
"$",
"class",
... | Método getText()
Metodo que percorre todos os filhos acionando o metodo getText() deles | [
"Método",
"getText",
"()",
"Metodo",
"que",
"percorre",
"todos",
"os",
"filhos",
"acionando",
"o",
"metodo",
"getText",
"()",
"deles"
] | train | https://github.com/QuilhaSoft/OpenCnabPHP/blob/9dc7a4ed884690ee2febe1b4ecf4ed09debb81f1/src/RemessaAbstract.php#L116-L128 |
QuilhaSoft/OpenCnabPHP | src/resources/B756/remessa/cnab400/Registro1.php | Registro1.mod11 | protected static function mod11($num)
{
$codigo_beneficiario = RemessaAbstract::$entryData['codigo_beneficiario'].RemessaAbstract::$entryData['codigo_beneficiario_dv']; // Número do contrato: à o mesmo número da conta
$agencia = RemessaAbstract::$entryData['agencia']; // Número do contrato: à o... | php | protected static function mod11($num)
{
$codigo_beneficiario = RemessaAbstract::$entryData['codigo_beneficiario'].RemessaAbstract::$entryData['codigo_beneficiario_dv']; // Número do contrato: à o mesmo número da conta
$agencia = RemessaAbstract::$entryData['agencia']; // Número do contrato: à o... | [
"protected",
"static",
"function",
"mod11",
"(",
"$",
"num",
")",
"{",
"$",
"codigo_beneficiario",
"=",
"RemessaAbstract",
"::",
"$",
"entryData",
"[",
"'codigo_beneficiario'",
"]",
".",
"RemessaAbstract",
"::",
"$",
"entryData",
"[",
"'codigo_beneficiario_dv'",
"... | Calcula e retorna o dígito verificador usando o algoritmo Modulo 11
@param string $num
@param int $base
@return array Retorna um array com as chaves 'digito' e 'resto' | [
"Calcula",
"e",
"retorna",
"o",
"dígito",
"verificador",
"usando",
"o",
"algoritmo",
"Modulo",
"11"
] | train | https://github.com/QuilhaSoft/OpenCnabPHP/blob/9dc7a4ed884690ee2febe1b4ecf4ed09debb81f1/src/resources/B756/remessa/cnab400/Registro1.php#L323-L365 |
QuilhaSoft/OpenCnabPHP | src/resources/B756/retorno/L085/Registro1.php | Registro1.inserirDetalhe | public function inserirDetalhe(){
while($this->data['codigo_lote']==abs(substr(RetornoAbstract::$lines[RetornoAbstract::$linesCounter],3,4)))
{
RetornoAbstract::$linesCounter++;
$class = 'CnabPHP\resources\\B'.RetornoAbstract::$banco.'\retorno\\'.RetornoAbstract::$layout.'\Registro3T';
$this->children[] = ... | php | public function inserirDetalhe(){
while($this->data['codigo_lote']==abs(substr(RetornoAbstract::$lines[RetornoAbstract::$linesCounter],3,4)))
{
RetornoAbstract::$linesCounter++;
$class = 'CnabPHP\resources\\B'.RetornoAbstract::$banco.'\retorno\\'.RetornoAbstract::$layout.'\Registro3T';
$this->children[] = ... | [
"public",
"function",
"inserirDetalhe",
"(",
")",
"{",
"while",
"(",
"$",
"this",
"->",
"data",
"[",
"'codigo_lote'",
"]",
"==",
"abs",
"(",
"substr",
"(",
"RetornoAbstract",
"::",
"$",
"lines",
"[",
"RetornoAbstract",
"::",
"$",
"linesCounter",
"]",
",",
... | /*
método inserirDetalhe()
Recebe os parametros
@$data = um array contendo os dados nessesarios para o arquvio | [
"/",
"*",
"método",
"inserirDetalhe",
"()",
"Recebe",
"os",
"parametros"
] | train | https://github.com/QuilhaSoft/OpenCnabPHP/blob/9dc7a4ed884690ee2febe1b4ecf4ed09debb81f1/src/resources/B756/retorno/L085/Registro1.php#L164-L174 |
QuilhaSoft/OpenCnabPHP | src/resources/B033/retorno/L040/Registro3T.php | Registro3T.get_arrayOcorrencias | public function get_arrayOcorrencias(){
$detalhes = new DetalhaMovimentoRetorno('033','240');
$codigoMovimento = str_pad($this->data['codigo_movimento'], 2, 0, STR_PAD_LEFT);
return $detalhes->getArrayTxtOcorrencias($codigoMovimento, $this->data['codigo_ocorrencia']);
} | php | public function get_arrayOcorrencias(){
$detalhes = new DetalhaMovimentoRetorno('033','240');
$codigoMovimento = str_pad($this->data['codigo_movimento'], 2, 0, STR_PAD_LEFT);
return $detalhes->getArrayTxtOcorrencias($codigoMovimento, $this->data['codigo_ocorrencia']);
} | [
"public",
"function",
"get_arrayOcorrencias",
"(",
")",
"{",
"$",
"detalhes",
"=",
"new",
"DetalhaMovimentoRetorno",
"(",
"'033'",
",",
"'240'",
")",
";",
"$",
"codigoMovimento",
"=",
"str_pad",
"(",
"$",
"this",
"->",
"data",
"[",
"'codigo_movimento'",
"]",
... | Retorna um array com a lista das descrições de comando e detalhes do
comando para o movimento
@return array | [
"Retorna",
"um",
"array",
"com",
"a",
"lista",
"das",
"descrições",
"de",
"comando",
"e",
"detalhes",
"do",
"comando",
"para",
"o",
"movimento"
] | train | https://github.com/QuilhaSoft/OpenCnabPHP/blob/9dc7a4ed884690ee2febe1b4ecf4ed09debb81f1/src/resources/B033/retorno/L040/Registro3T.php#L402-L408 |
QuilhaSoft/OpenCnabPHP | src/RegistroAbstract.php | RegistroAbstract.prepareText | protected function prepareText($text, $remove = null)
{
$result = strtoupper($this->removeAccents(trim(html_entity_decode($text))));
if ($remove)
$result = str_replace(str_split($remove), '', $result);
return $result;
} | php | protected function prepareText($text, $remove = null)
{
$result = strtoupper($this->removeAccents(trim(html_entity_decode($text))));
if ($remove)
$result = str_replace(str_split($remove), '', $result);
return $result;
} | [
"protected",
"function",
"prepareText",
"(",
"$",
"text",
",",
"$",
"remove",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"strtoupper",
"(",
"$",
"this",
"->",
"removeAccents",
"(",
"trim",
"(",
"html_entity_decode",
"(",
"$",
"text",
")",
")",
")",
")"... | Método prepareText()
metodo retirado do projeto andersondanilo/CnabPHP e usado como esta sem altera??o
recebe um texto e prepara para inserir no arquivo de texto | [
"Método",
"prepareText",
"()",
"metodo",
"retirado",
"do",
"projeto",
"andersondanilo",
"/",
"CnabPHP",
"e",
"usado",
"como",
"esta",
"sem",
"altera??o",
"recebe",
"um",
"texto",
"e",
"prepara",
"para",
"inserir",
"no",
"arquivo",
"de",
"texto"
] | train | https://github.com/QuilhaSoft/OpenCnabPHP/blob/9dc7a4ed884690ee2febe1b4ecf4ed09debb81f1/src/RegistroAbstract.php#L60-L66 |
QuilhaSoft/OpenCnabPHP | src/RegistroAbstract.php | RegistroAbstract.getText | public function getText()
{
$retorno = '';
foreach ($this->meta as $key => $value) {
$retorno .= $this->$key;
}
RemessaAbstract::$retorno[] = $retorno;
if ($this->children) {
// percorre todos objetos filhos
foreach ($this->children as $chi... | php | public function getText()
{
$retorno = '';
foreach ($this->meta as $key => $value) {
$retorno .= $this->$key;
}
RemessaAbstract::$retorno[] = $retorno;
if ($this->children) {
// percorre todos objetos filhos
foreach ($this->children as $chi... | [
"public",
"function",
"getText",
"(",
")",
"{",
"$",
"retorno",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"meta",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"retorno",
".=",
"$",
"this",
"->",
"$",
"key",
";",
"}",
"RemessaAbst... | /*
Método getText()
metodo magico que trabalha recursivamente nos filhos e netos desse objeto
prepara as linhas para serem exportadas para txt | [
"/",
"*",
"Método",
"getText",
"()",
"metodo",
"magico",
"que",
"trabalha",
"recursivamente",
"nos",
"filhos",
"e",
"netos",
"desse",
"objeto",
"prepara",
"as",
"linhas",
"para",
"serem",
"exportadas",
"para",
"txt"
] | train | https://github.com/QuilhaSoft/OpenCnabPHP/blob/9dc7a4ed884690ee2febe1b4ecf4ed09debb81f1/src/RegistroAbstract.php#L118-L131 |
QuilhaSoft/OpenCnabPHP | src/RegistroAbstract.php | RegistroAbstract.mb_str_pad | public function mb_str_pad($input, $pad_length, $pad_string = ' ', $pad_type = STR_PAD_RIGHT)
{
$diff = strlen($input) - mb_strlen($input);
return str_pad($input, $pad_length + $diff, $pad_string, $pad_type);
} | php | public function mb_str_pad($input, $pad_length, $pad_string = ' ', $pad_type = STR_PAD_RIGHT)
{
$diff = strlen($input) - mb_strlen($input);
return str_pad($input, $pad_length + $diff, $pad_string, $pad_type);
} | [
"public",
"function",
"mb_str_pad",
"(",
"$",
"input",
",",
"$",
"pad_length",
",",
"$",
"pad_string",
"=",
"' '",
",",
"$",
"pad_type",
"=",
"STR_PAD_RIGHT",
")",
"{",
"$",
"diff",
"=",
"strlen",
"(",
"$",
"input",
")",
"-",
"mb_strlen",
"(",
"$",
"... | mb_str_pad
@param string $input
@param int $pad_length
@param string $pad_string
@param int $pad_type
@return string
@author Kari "Haprog" Sderholm | [
"mb_str_pad"
] | train | https://github.com/QuilhaSoft/OpenCnabPHP/blob/9dc7a4ed884690ee2febe1b4ecf4ed09debb81f1/src/RegistroAbstract.php#L143-L147 |
QuilhaSoft/OpenCnabPHP | src/resources/B104/retorno/L030/Registro0.php | Registro0.inserirDetalhe | public function inserirDetalhe($linhaTxt){
$class = 'CnabPHP\resources\\B'.self::$banco.'\retorno\\'.self::$layout.'\Registro1';
self::addChild(new $class($linhaTxt));
RetornoAbstract::$linesCounter++;
//self::$counter++;
} | php | public function inserirDetalhe($linhaTxt){
$class = 'CnabPHP\resources\\B'.self::$banco.'\retorno\\'.self::$layout.'\Registro1';
self::addChild(new $class($linhaTxt));
RetornoAbstract::$linesCounter++;
//self::$counter++;
} | [
"public",
"function",
"inserirDetalhe",
"(",
"$",
"linhaTxt",
")",
"{",
"$",
"class",
"=",
"'CnabPHP\\resources\\\\B'",
".",
"self",
"::",
"$",
"banco",
".",
"'\\retorno\\\\'",
".",
"self",
"::",
"$",
"layout",
".",
"'\\Registro1'",
";",
"self",
"::",
"addCh... | /*
método inserirDetalhe()
Recebe os parametros
@$data = um array contendo os dados nessesarios para o arquvio | [
"/",
"*",
"método",
"inserirDetalhe",
"()",
"Recebe",
"os",
"parametros"
] | train | https://github.com/QuilhaSoft/OpenCnabPHP/blob/9dc7a4ed884690ee2febe1b4ecf4ed09debb81f1/src/resources/B104/retorno/L030/Registro0.php#L164-L170 |
doctrine/DoctrineCacheBundle | DependencyInjection/Definition/CouchbaseDefinition.php | CouchbaseDefinition.configure | public function configure($name, array $config, Definition $service, ContainerBuilder $container)
{
$couchbaseConf = $config['couchbase'];
$connRef = $this->getConnectionReference($name, $couchbaseConf, $container);
$service->addMethodCall('setCouchbase', array($connRef));
} | php | public function configure($name, array $config, Definition $service, ContainerBuilder $container)
{
$couchbaseConf = $config['couchbase'];
$connRef = $this->getConnectionReference($name, $couchbaseConf, $container);
$service->addMethodCall('setCouchbase', array($connRef));
} | [
"public",
"function",
"configure",
"(",
"$",
"name",
",",
"array",
"$",
"config",
",",
"Definition",
"$",
"service",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"couchbaseConf",
"=",
"$",
"config",
"[",
"'couchbase'",
"]",
";",
"$",
"connRef"... | {@inheritDoc} | [
"{"
] | train | https://github.com/doctrine/DoctrineCacheBundle/blob/61ce8deded490d11c653e68e15f6ca7bd3199d13/DependencyInjection/Definition/CouchbaseDefinition.php#L28-L34 |
doctrine/DoctrineCacheBundle | DependencyInjection/Definition/CouchbaseDefinition.php | CouchbaseDefinition.getConnectionReference | private function getConnectionReference($name, array $config, ContainerBuilder $container)
{
if (isset($config['connection_id'])) {
return new Reference($config['connection_id']);
}
$host = $config['hostnames'];
$user = $config['username'];
$pass =... | php | private function getConnectionReference($name, array $config, ContainerBuilder $container)
{
if (isset($config['connection_id'])) {
return new Reference($config['connection_id']);
}
$host = $config['hostnames'];
$user = $config['username'];
$pass =... | [
"private",
"function",
"getConnectionReference",
"(",
"$",
"name",
",",
"array",
"$",
"config",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'connection_id'",
"]",
")",
")",
"{",
"return",
"new",
"Refer... | @param string $name
@param array $config
@param \Symfony\Component\DependencyInjection\ContainerBuilder $container
@return \Symfony\Component\DependencyInjection\Reference | [
"@param",
"string",
"$name",
"@param",
"array",
"$config",
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"DependencyInjection",
"\\",
"ContainerBuilder",
"$container"
] | train | https://github.com/doctrine/DoctrineCacheBundle/blob/61ce8deded490d11c653e68e15f6ca7bd3199d13/DependencyInjection/Definition/CouchbaseDefinition.php#L43-L61 |
doctrine/DoctrineCacheBundle | Command/FlushCommand.php | FlushCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$cacheName = $input->getArgument('cache-name');
$cacheProvider = $this->getCacheProvider($cacheName);
if ( ! method_exists($cacheProvider, 'flushAll')) {
throw new \RuntimeException('Cache provider ... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$cacheName = $input->getArgument('cache-name');
$cacheProvider = $this->getCacheProvider($cacheName);
if ( ! method_exists($cacheProvider, 'flushAll')) {
throw new \RuntimeException('Cache provider ... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"cacheName",
"=",
"$",
"input",
"->",
"getArgument",
"(",
"'cache-name'",
")",
";",
"$",
"cacheProvider",
"=",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/DoctrineCacheBundle/blob/61ce8deded490d11c653e68e15f6ca7bd3199d13/Command/FlushCommand.php#L30-L42 |
doctrine/DoctrineCacheBundle | Command/StatsCommand.php | StatsCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$cacheName = $input->getArgument('cache-name');
$cacheProvider = $this->getCacheProvider($cacheName);
$cacheProviderName = get_class($cacheProvider);
$stats = $cacheProvider->getStats();
if ($s... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$cacheName = $input->getArgument('cache-name');
$cacheProvider = $this->getCacheProvider($cacheName);
$cacheProviderName = get_class($cacheProvider);
$stats = $cacheProvider->getStats();
if ($s... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"cacheName",
"=",
"$",
"input",
"->",
"getArgument",
"(",
"'cache-name'",
")",
";",
"$",
"cacheProvider",
"=",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/DoctrineCacheBundle/blob/61ce8deded490d11c653e68e15f6ca7bd3199d13/Command/StatsCommand.php#L29-L52 |
doctrine/DoctrineCacheBundle | Command/ContainsCommand.php | ContainsCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$cacheName = $input->getArgument('cache-name');
$cacheProvider = $this->getCacheProvider($cacheName);
$cacheId = $input->getArgument('cache-id');
$message = $cacheProvider->contains($cacheId) ? '<... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$cacheName = $input->getArgument('cache-name');
$cacheProvider = $this->getCacheProvider($cacheName);
$cacheId = $input->getArgument('cache-id');
$message = $cacheProvider->contains($cacheId) ? '<... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"cacheName",
"=",
"$",
"input",
"->",
"getArgument",
"(",
"'cache-name'",
")",
";",
"$",
"cacheProvider",
"=",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/doctrine/DoctrineCacheBundle/blob/61ce8deded490d11c653e68e15f6ca7bd3199d13/Command/ContainsCommand.php#L31-L39 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.