id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
211,200 | cakephp/cakephp | src/Validation/Validation.php | Validation.fileSize | public static function fileSize($check, $operator = null, $size = null)
{
$file = static::getFilename($check);
if ($file === false) {
return false;
}
if (is_string($size)) {
$size = Text::parseFileSize($size);
}
$filesize = filesize($file);
... | php | public static function fileSize($check, $operator = null, $size = null)
{
$file = static::getFilename($check);
if ($file === false) {
return false;
}
if (is_string($size)) {
$size = Text::parseFileSize($size);
}
$filesize = filesize($file);
... | [
"public",
"static",
"function",
"fileSize",
"(",
"$",
"check",
",",
"$",
"operator",
"=",
"null",
",",
"$",
"size",
"=",
"null",
")",
"{",
"$",
"file",
"=",
"static",
"::",
"getFilename",
"(",
"$",
"check",
")",
";",
"if",
"(",
"$",
"file",
"===",
... | Checks the filesize
Will check the filesize of files/UploadedFileInterface instances
by checking the filesize() on disk and not relying on the length
reported by the client.
@param string|array|\Psr\Http\Message\UploadedFileInterface $check Value to check.
@param string|null $operator See `Validation::comparison()`.
... | [
"Checks",
"the",
"filesize"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Validation/Validation.php#L1232-L1245 |
211,201 | cakephp/cakephp | src/Validation/Validation.php | Validation.uploadError | public static function uploadError($check, $allowNoFile = false)
{
if ($check instanceof UploadedFileInterface) {
$code = $check->getError();
} elseif (is_array($check) && isset($check['error'])) {
$code = $check['error'];
} else {
$code = $check;
... | php | public static function uploadError($check, $allowNoFile = false)
{
if ($check instanceof UploadedFileInterface) {
$code = $check->getError();
} elseif (is_array($check) && isset($check['error'])) {
$code = $check['error'];
} else {
$code = $check;
... | [
"public",
"static",
"function",
"uploadError",
"(",
"$",
"check",
",",
"$",
"allowNoFile",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"check",
"instanceof",
"UploadedFileInterface",
")",
"{",
"$",
"code",
"=",
"$",
"check",
"->",
"getError",
"(",
")",
";",
... | Checking for upload errors
@param string|array|\Psr\Http\Message\UploadedFileInterface $check Value to check.
@param bool $allowNoFile Set to true to allow UPLOAD_ERR_NO_FILE as a pass.
@return bool
@see https://secure.php.net/manual/en/features.file-upload.errors.php | [
"Checking",
"for",
"upload",
"errors"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Validation/Validation.php#L1255-L1269 |
211,202 | cakephp/cakephp | src/Validation/Validation.php | Validation.uploadedFile | public static function uploadedFile($file, array $options = [])
{
$options += [
'minSize' => null,
'maxSize' => null,
'types' => null,
'optional' => false,
];
if (!is_array($file) && !($file instanceof UploadedFileInterface)) {
retu... | php | public static function uploadedFile($file, array $options = [])
{
$options += [
'minSize' => null,
'maxSize' => null,
'types' => null,
'optional' => false,
];
if (!is_array($file) && !($file instanceof UploadedFileInterface)) {
retu... | [
"public",
"static",
"function",
"uploadedFile",
"(",
"$",
"file",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'minSize'",
"=>",
"null",
",",
"'maxSize'",
"=>",
"null",
",",
"'types'",
"=>",
"null",
",",
"'optional... | Validate an uploaded file.
Helps join `uploadError`, `fileSize` and `mimeType` into
one higher level validation method.
### Options
- `types` - An array of valid mime types. If empty all types
will be accepted. The `type` will not be looked at, instead
the file type will be checked with ext/finfo.
- `minSize` - The ... | [
"Validate",
"an",
"uploaded",
"file",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Validation/Validation.php#L1291-L1334 |
211,203 | cakephp/cakephp | src/Validation/Validation.php | Validation.imageSize | public static function imageSize($file, $options)
{
if (!isset($options['height']) && !isset($options['width'])) {
throw new InvalidArgumentException('Invalid image size validation parameters! Missing `width` and / or `height`.');
}
$filename = static::getFilename($file);
... | php | public static function imageSize($file, $options)
{
if (!isset($options['height']) && !isset($options['width'])) {
throw new InvalidArgumentException('Invalid image size validation parameters! Missing `width` and / or `height`.');
}
$filename = static::getFilename($file);
... | [
"public",
"static",
"function",
"imageSize",
"(",
"$",
"file",
",",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'height'",
"]",
")",
"&&",
"!",
"isset",
"(",
"$",
"options",
"[",
"'width'",
"]",
")",
")",
"{",
"t... | Validates the size of an uploaded image.
@param array|\Psr\Http\Message\UploadedFileInterface $file The uploaded file data from PHP.
@param array $options Options to validate width and height.
@return bool
@throws \InvalidArgumentException | [
"Validates",
"the",
"size",
"of",
"an",
"uploaded",
"image",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Validation/Validation.php#L1344-L1373 |
211,204 | cakephp/cakephp | src/Validation/Validation.php | Validation.geoCoordinate | public static function geoCoordinate($value, array $options = [])
{
$options += [
'format' => 'both',
'type' => 'latLong'
];
if ($options['type'] !== 'latLong') {
throw new RuntimeException(sprintf(
'Unsupported coordinate type "%s". Use "l... | php | public static function geoCoordinate($value, array $options = [])
{
$options += [
'format' => 'both',
'type' => 'latLong'
];
if ($options['type'] !== 'latLong') {
throw new RuntimeException(sprintf(
'Unsupported coordinate type "%s". Use "l... | [
"public",
"static",
"function",
"geoCoordinate",
"(",
"$",
"value",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'format'",
"=>",
"'both'",
",",
"'type'",
"=>",
"'latLong'",
"]",
";",
"if",
"(",
"$",
"options",
"... | Validates a geographic coordinate.
Supported formats:
- `<latitude>, <longitude>` Example: `-25.274398, 133.775136`
### Options
- `type` - A string of the coordinate format, right now only `latLong`.
- `format` - By default `both`, can be `long` and `lat` as well to validate
only a part of the coordinate.
@param s... | [
"Validates",
"a",
"geographic",
"coordinate",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Validation/Validation.php#L1428-L1449 |
211,205 | cakephp/cakephp | src/Validation/Validation.php | Validation.utf8 | public static function utf8($value, array $options = [])
{
if (!is_string($value)) {
return false;
}
$options += ['extended' => false];
if ($options['extended']) {
return true;
}
return preg_match('/[\x{10000}-\x{10FFFF}]/u', $value) === 0;
... | php | public static function utf8($value, array $options = [])
{
if (!is_string($value)) {
return false;
}
$options += ['extended' => false];
if ($options['extended']) {
return true;
}
return preg_match('/[\x{10000}-\x{10FFFF}]/u', $value) === 0;
... | [
"public",
"static",
"function",
"utf8",
"(",
"$",
"value",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"options",
"+=",
"[",
"'extended'",
... | Check that the input value is a utf8 string.
This method will reject all non-string values.
# Options
- `extended` - Disallow bytes higher within the basic multilingual plane.
MySQL's older utf8 encoding type does not allow characters above
the basic multilingual plane. Defaults to false.
@param string $value The v... | [
"Check",
"that",
"the",
"input",
"value",
"is",
"a",
"utf8",
"string",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Validation/Validation.php#L1515-L1526 |
211,206 | cakephp/cakephp | src/Validation/Validation.php | Validation.isInteger | public static function isInteger($value)
{
if (!is_scalar($value) || is_float($value)) {
return false;
}
if (is_int($value)) {
return true;
}
return (bool)preg_match('/^-?[0-9]+$/', $value);
} | php | public static function isInteger($value)
{
if (!is_scalar($value) || is_float($value)) {
return false;
}
if (is_int($value)) {
return true;
}
return (bool)preg_match('/^-?[0-9]+$/', $value);
} | [
"public",
"static",
"function",
"isInteger",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"value",
")",
"||",
"is_float",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"value",
... | Check that the input value is an integer
This method will accept strings that contain only integer data
as well.
@param string $value The value to check
@return bool | [
"Check",
"that",
"the",
"input",
"value",
"is",
"an",
"integer"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Validation/Validation.php#L1537-L1547 |
211,207 | cakephp/cakephp | src/Validation/Validation.php | Validation.iban | public static function iban($check)
{
if (!preg_match('/^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,30}$/', $check)) {
return false;
}
$country = substr($check, 0, 2);
$checkInt = intval(substr($check, 2, 2));
$account = substr($check, 4);
$search = range('A', 'Z');
... | php | public static function iban($check)
{
if (!preg_match('/^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,30}$/', $check)) {
return false;
}
$country = substr($check, 0, 2);
$checkInt = intval(substr($check, 2, 2));
$account = substr($check, 4);
$search = range('A', 'Z');
... | [
"public",
"static",
"function",
"iban",
"(",
"$",
"check",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'/^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,30}$/'",
",",
"$",
"check",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"country",
"=",
"substr",
"(",
"$",
"check... | Check that the input value has a valid International Bank Account Number IBAN syntax
Requirements are uppercase, no whitespaces, max length 34, country code and checksum exist at right spots,
body matches against checksum via Mod97-10 algorithm
@param string $check The value to check
@return bool Success | [
"Check",
"that",
"the",
"input",
"value",
"has",
"a",
"valid",
"International",
"Bank",
"Account",
"Number",
"IBAN",
"syntax",
"Requirements",
"are",
"uppercase",
"no",
"whitespaces",
"max",
"length",
"34",
"country",
"code",
"and",
"checksum",
"exist",
"at",
... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Validation/Validation.php#L1594-L1618 |
211,208 | cakephp/cakephp | src/Validation/Validation.php | Validation._getDateString | protected static function _getDateString($value)
{
$formatted = '';
if (isset($value['year'], $value['month'], $value['day']) &&
(is_numeric($value['year']) && is_numeric($value['month']) && is_numeric($value['day']))
) {
$formatted .= sprintf('%d-%02d-%02d ', $value[... | php | protected static function _getDateString($value)
{
$formatted = '';
if (isset($value['year'], $value['month'], $value['day']) &&
(is_numeric($value['year']) && is_numeric($value['month']) && is_numeric($value['day']))
) {
$formatted .= sprintf('%d-%02d-%02d ', $value[... | [
"protected",
"static",
"function",
"_getDateString",
"(",
"$",
"value",
")",
"{",
"$",
"formatted",
"=",
"''",
";",
"if",
"(",
"isset",
"(",
"$",
"value",
"[",
"'year'",
"]",
",",
"$",
"value",
"[",
"'month'",
"]",
",",
"$",
"value",
"[",
"'day'",
... | Converts an array representing a date or datetime into a ISO string.
The arrays are typically sent for validation from a form generated by
the CakePHP FormHelper.
@param array $value The array representing a date or datetime.
@return string | [
"Converts",
"an",
"array",
"representing",
"a",
"date",
"or",
"datetime",
"into",
"a",
"ISO",
"string",
".",
"The",
"arrays",
"are",
"typically",
"sent",
"for",
"validation",
"from",
"a",
"form",
"generated",
"by",
"the",
"CakePHP",
"FormHelper",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Validation/Validation.php#L1628-L1651 |
211,209 | cakephp/cakephp | src/Validation/Validation.php | Validation._populateIp | protected static function _populateIp()
{
if (!isset(static::$_pattern['IPv6'])) {
$pattern = '((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}';
$pattern .= '(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})';
$pattern .= '... | php | protected static function _populateIp()
{
if (!isset(static::$_pattern['IPv6'])) {
$pattern = '((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}';
$pattern .= '(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})';
$pattern .= '... | [
"protected",
"static",
"function",
"_populateIp",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"_pattern",
"[",
"'IPv6'",
"]",
")",
")",
"{",
"$",
"pattern",
"=",
"'((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}'",
";"... | Lazily populate the IP address patterns used for validations
@return void | [
"Lazily",
"populate",
"the",
"IP",
"address",
"patterns",
"used",
"for",
"validations"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Validation/Validation.php#L1658-L1682 |
211,210 | cakephp/cakephp | src/Http/Client.php | Client.addCookie | public function addCookie(CookieInterface $cookie)
{
if (!$cookie->getDomain() || !$cookie->getPath()) {
throw new InvalidArgumentException('Cookie must have a domain and a path set.');
}
$this->_cookies = $this->_cookies->add($cookie);
return $this;
} | php | public function addCookie(CookieInterface $cookie)
{
if (!$cookie->getDomain() || !$cookie->getPath()) {
throw new InvalidArgumentException('Cookie must have a domain and a path set.');
}
$this->_cookies = $this->_cookies->add($cookie);
return $this;
} | [
"public",
"function",
"addCookie",
"(",
"CookieInterface",
"$",
"cookie",
")",
"{",
"if",
"(",
"!",
"$",
"cookie",
"->",
"getDomain",
"(",
")",
"||",
"!",
"$",
"cookie",
"->",
"getPath",
"(",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"("... | Adds a cookie to the Client collection.
@param \Cake\Http\Cookie\CookieInterface $cookie Cookie object.
@return $this | [
"Adds",
"a",
"cookie",
"to",
"the",
"Client",
"collection",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L210-L218 |
211,211 | cakephp/cakephp | src/Http/Client.php | Client.get | public function get($url, $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$body = null;
if (isset($data['_content'])) {
$body = $data['_content'];
unset($data['_content']);
}
$url = $this->buildUrl($url, $data, $options);
... | php | public function get($url, $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$body = null;
if (isset($data['_content'])) {
$body = $data['_content'];
unset($data['_content']);
}
$url = $this->buildUrl($url, $data, $options);
... | [
"public",
"function",
"get",
"(",
"$",
"url",
",",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_mergeOptions",
"(",
"$",
"options",
")",
";",
"$",
"body",
"=",
"nul... | Do a GET request.
The $data argument supports a special `_content` key
for providing a request body in a GET request. This is
generally not used, but services like ElasticSearch use
this feature.
@param string $url The url or path you want to request.
@param array $data The query data you want to send.
@param array $... | [
"Do",
"a",
"GET",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L233-L249 |
211,212 | cakephp/cakephp | src/Http/Client.php | Client.post | public function post($url, $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$url = $this->buildUrl($url, [], $options);
return $this->_doRequest(Request::METHOD_POST, $url, $data, $options);
} | php | public function post($url, $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$url = $this->buildUrl($url, [], $options);
return $this->_doRequest(Request::METHOD_POST, $url, $data, $options);
} | [
"public",
"function",
"post",
"(",
"$",
"url",
",",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_mergeOptions",
"(",
"$",
"options",
")",
";",
"$",
"url",
"=",
"$",... | Do a POST request.
@param string $url The url or path you want to request.
@param mixed $data The post data you want to send.
@param array $options Additional options for the request.
@return \Cake\Http\Client\Response | [
"Do",
"a",
"POST",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L259-L265 |
211,213 | cakephp/cakephp | src/Http/Client.php | Client.put | public function put($url, $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$url = $this->buildUrl($url, [], $options);
return $this->_doRequest(Request::METHOD_PUT, $url, $data, $options);
} | php | public function put($url, $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$url = $this->buildUrl($url, [], $options);
return $this->_doRequest(Request::METHOD_PUT, $url, $data, $options);
} | [
"public",
"function",
"put",
"(",
"$",
"url",
",",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_mergeOptions",
"(",
"$",
"options",
")",
";",
"$",
"url",
"=",
"$",
... | Do a PUT request.
@param string $url The url or path you want to request.
@param mixed $data The request data you want to send.
@param array $options Additional options for the request.
@return \Cake\Http\Client\Response | [
"Do",
"a",
"PUT",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L275-L281 |
211,214 | cakephp/cakephp | src/Http/Client.php | Client.patch | public function patch($url, $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$url = $this->buildUrl($url, [], $options);
return $this->_doRequest(Request::METHOD_PATCH, $url, $data, $options);
} | php | public function patch($url, $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$url = $this->buildUrl($url, [], $options);
return $this->_doRequest(Request::METHOD_PATCH, $url, $data, $options);
} | [
"public",
"function",
"patch",
"(",
"$",
"url",
",",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_mergeOptions",
"(",
"$",
"options",
")",
";",
"$",
"url",
"=",
"$"... | Do a PATCH request.
@param string $url The url or path you want to request.
@param mixed $data The request data you want to send.
@param array $options Additional options for the request.
@return \Cake\Http\Client\Response | [
"Do",
"a",
"PATCH",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L291-L297 |
211,215 | cakephp/cakephp | src/Http/Client.php | Client.options | public function options($url, $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$url = $this->buildUrl($url, [], $options);
return $this->_doRequest(Request::METHOD_OPTIONS, $url, $data, $options);
} | php | public function options($url, $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$url = $this->buildUrl($url, [], $options);
return $this->_doRequest(Request::METHOD_OPTIONS, $url, $data, $options);
} | [
"public",
"function",
"options",
"(",
"$",
"url",
",",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_mergeOptions",
"(",
"$",
"options",
")",
";",
"$",
"url",
"=",
"... | Do an OPTIONS request.
@param string $url The url or path you want to request.
@param mixed $data The request data you want to send.
@param array $options Additional options for the request.
@return \Cake\Http\Client\Response | [
"Do",
"an",
"OPTIONS",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L307-L313 |
211,216 | cakephp/cakephp | src/Http/Client.php | Client.trace | public function trace($url, $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$url = $this->buildUrl($url, [], $options);
return $this->_doRequest(Request::METHOD_TRACE, $url, $data, $options);
} | php | public function trace($url, $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$url = $this->buildUrl($url, [], $options);
return $this->_doRequest(Request::METHOD_TRACE, $url, $data, $options);
} | [
"public",
"function",
"trace",
"(",
"$",
"url",
",",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_mergeOptions",
"(",
"$",
"options",
")",
";",
"$",
"url",
"=",
"$"... | Do a TRACE request.
@param string $url The url or path you want to request.
@param mixed $data The request data you want to send.
@param array $options Additional options for the request.
@return \Cake\Http\Client\Response | [
"Do",
"a",
"TRACE",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L323-L329 |
211,217 | cakephp/cakephp | src/Http/Client.php | Client.delete | public function delete($url, $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$url = $this->buildUrl($url, [], $options);
return $this->_doRequest(Request::METHOD_DELETE, $url, $data, $options);
} | php | public function delete($url, $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$url = $this->buildUrl($url, [], $options);
return $this->_doRequest(Request::METHOD_DELETE, $url, $data, $options);
} | [
"public",
"function",
"delete",
"(",
"$",
"url",
",",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_mergeOptions",
"(",
"$",
"options",
")",
";",
"$",
"url",
"=",
"$... | Do a DELETE request.
@param string $url The url or path you want to request.
@param mixed $data The request data you want to send.
@param array $options Additional options for the request.
@return \Cake\Http\Client\Response | [
"Do",
"a",
"DELETE",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L339-L345 |
211,218 | cakephp/cakephp | src/Http/Client.php | Client.head | public function head($url, array $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$url = $this->buildUrl($url, $data, $options);
return $this->_doRequest(Request::METHOD_HEAD, $url, '', $options);
} | php | public function head($url, array $data = [], array $options = [])
{
$options = $this->_mergeOptions($options);
$url = $this->buildUrl($url, $data, $options);
return $this->_doRequest(Request::METHOD_HEAD, $url, '', $options);
} | [
"public",
"function",
"head",
"(",
"$",
"url",
",",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_mergeOptions",
"(",
"$",
"options",
")",
";",
"$",
"url",
... | Do a HEAD request.
@param string $url The url or path you want to request.
@param array $data The query string data you want to send.
@param array $options Additional options for the request.
@return \Cake\Http\Client\Response | [
"Do",
"a",
"HEAD",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L355-L361 |
211,219 | cakephp/cakephp | src/Http/Client.php | Client._doRequest | protected function _doRequest($method, $url, $data, $options)
{
$request = $this->_createRequest(
$method,
$url,
$data,
$options
);
return $this->send($request, $options);
} | php | protected function _doRequest($method, $url, $data, $options)
{
$request = $this->_createRequest(
$method,
$url,
$data,
$options
);
return $this->send($request, $options);
} | [
"protected",
"function",
"_doRequest",
"(",
"$",
"method",
",",
"$",
"url",
",",
"$",
"data",
",",
"$",
"options",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"_createRequest",
"(",
"$",
"method",
",",
"$",
"url",
",",
"$",
"data",
",",
"$",
... | Helper method for doing non-GET requests.
@param string $method HTTP method.
@param string $url URL to request.
@param mixed $data The request body.
@param array $options The options to use. Contains auth, proxy, etc.
@return \Cake\Http\Client\Response | [
"Helper",
"method",
"for",
"doing",
"non",
"-",
"GET",
"requests",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L372-L382 |
211,220 | cakephp/cakephp | src/Http/Client.php | Client._sendRequest | protected function _sendRequest(Request $request, $options)
{
$responses = $this->_adapter->send($request, $options);
$url = $request->getUri();
foreach ($responses as $response) {
$this->_cookies = $this->_cookies->addFromResponse($response, $request);
}
return ... | php | protected function _sendRequest(Request $request, $options)
{
$responses = $this->_adapter->send($request, $options);
$url = $request->getUri();
foreach ($responses as $response) {
$this->_cookies = $this->_cookies->addFromResponse($response, $request);
}
return ... | [
"protected",
"function",
"_sendRequest",
"(",
"Request",
"$",
"request",
",",
"$",
"options",
")",
"{",
"$",
"responses",
"=",
"$",
"this",
"->",
"_adapter",
"->",
"send",
"(",
"$",
"request",
",",
"$",
"options",
")",
";",
"$",
"url",
"=",
"$",
"req... | Send a request without redirection.
@param \Cake\Http\Client\Request $request The request to send.
@param array $options Additional options to use.
@return \Cake\Http\Client\Response | [
"Send",
"a",
"request",
"without",
"redirection",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L443-L452 |
211,221 | cakephp/cakephp | src/Http/Client.php | Client.buildUrl | public function buildUrl($url, $query = [], $options = [])
{
if (empty($options) && empty($query)) {
return $url;
}
if ($query) {
$q = (strpos($url, '?') === false) ? '?' : '&';
$url .= $q;
$url .= is_string($query) ? $query : http_build_query(... | php | public function buildUrl($url, $query = [], $options = [])
{
if (empty($options) && empty($query)) {
return $url;
}
if ($query) {
$q = (strpos($url, '?') === false) ? '?' : '&';
$url .= $q;
$url .= is_string($query) ? $query : http_build_query(... | [
"public",
"function",
"buildUrl",
"(",
"$",
"url",
",",
"$",
"query",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"options",
")",
"&&",
"empty",
"(",
"$",
"query",
")",
")",
"{",
"return",
"$",
"... | Generate a URL based on the scoped client options.
@param string $url Either a full URL or just the path.
@param string|array $query The query data for the URL.
@param array $options The config options stored with Client::config()
@return string A complete url with scheme, port, host, and path. | [
"Generate",
"a",
"URL",
"based",
"on",
"the",
"scoped",
"client",
"options",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L462-L498 |
211,222 | cakephp/cakephp | src/Http/Client.php | Client._createRequest | protected function _createRequest($method, $url, $data, $options)
{
$headers = isset($options['headers']) ? (array)$options['headers'] : [];
if (isset($options['type'])) {
$headers = array_merge($headers, $this->_typeHeaders($options['type']));
}
if (is_string($data) && !... | php | protected function _createRequest($method, $url, $data, $options)
{
$headers = isset($options['headers']) ? (array)$options['headers'] : [];
if (isset($options['type'])) {
$headers = array_merge($headers, $this->_typeHeaders($options['type']));
}
if (is_string($data) && !... | [
"protected",
"function",
"_createRequest",
"(",
"$",
"method",
",",
"$",
"url",
",",
"$",
"data",
",",
"$",
"options",
")",
"{",
"$",
"headers",
"=",
"isset",
"(",
"$",
"options",
"[",
"'headers'",
"]",
")",
"?",
"(",
"array",
")",
"$",
"options",
... | Creates a new request object based on the parameters.
@param string $method HTTP method name.
@param string $url The url including query string.
@param mixed $data The request body.
@param array $options The options to use. Contains auth, proxy, etc.
@return \Cake\Http\Client\Request | [
"Creates",
"a",
"new",
"request",
"object",
"based",
"on",
"the",
"parameters",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L509-L531 |
211,223 | cakephp/cakephp | src/Http/Client.php | Client._addAuthentication | protected function _addAuthentication(Request $request, $options)
{
$auth = $options['auth'];
$adapter = $this->_createAuth($auth, $options);
$result = $adapter->authentication($request, $options['auth']);
return $result ?: $request;
} | php | protected function _addAuthentication(Request $request, $options)
{
$auth = $options['auth'];
$adapter = $this->_createAuth($auth, $options);
$result = $adapter->authentication($request, $options['auth']);
return $result ?: $request;
} | [
"protected",
"function",
"_addAuthentication",
"(",
"Request",
"$",
"request",
",",
"$",
"options",
")",
"{",
"$",
"auth",
"=",
"$",
"options",
"[",
"'auth'",
"]",
";",
"$",
"adapter",
"=",
"$",
"this",
"->",
"_createAuth",
"(",
"$",
"auth",
",",
"$",
... | Add authentication headers to the request.
Uses the authentication type to choose the correct strategy
and use its methods to add headers.
@param \Cake\Http\Client\Request $request The request to modify.
@param array $options Array of options containing the 'auth' key.
@return \Cake\Http\Client\Request The updated re... | [
"Add",
"authentication",
"headers",
"to",
"the",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L573-L580 |
211,224 | cakephp/cakephp | src/Http/Client.php | Client._addProxy | protected function _addProxy(Request $request, $options)
{
$auth = $options['proxy'];
$adapter = $this->_createAuth($auth, $options);
$result = $adapter->proxyAuthentication($request, $options['proxy']);
return $result ?: $request;
} | php | protected function _addProxy(Request $request, $options)
{
$auth = $options['proxy'];
$adapter = $this->_createAuth($auth, $options);
$result = $adapter->proxyAuthentication($request, $options['proxy']);
return $result ?: $request;
} | [
"protected",
"function",
"_addProxy",
"(",
"Request",
"$",
"request",
",",
"$",
"options",
")",
"{",
"$",
"auth",
"=",
"$",
"options",
"[",
"'proxy'",
"]",
";",
"$",
"adapter",
"=",
"$",
"this",
"->",
"_createAuth",
"(",
"$",
"auth",
",",
"$",
"optio... | Add proxy authentication headers.
Uses the authentication type to choose the correct strategy
and use its methods to add headers.
@param \Cake\Http\Client\Request $request The request to modify.
@param array $options Array of options containing the 'proxy' key.
@return \Cake\Http\Client\Request The updated request ob... | [
"Add",
"proxy",
"authentication",
"headers",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L592-L599 |
211,225 | cakephp/cakephp | src/Http/Client.php | Client._createAuth | protected function _createAuth($auth, $options)
{
if (empty($auth['type'])) {
$auth['type'] = 'basic';
}
$name = ucfirst($auth['type']);
$class = App::className($name, 'Http/Client/Auth');
if (!$class) {
throw new Exception(
sprintf('In... | php | protected function _createAuth($auth, $options)
{
if (empty($auth['type'])) {
$auth['type'] = 'basic';
}
$name = ucfirst($auth['type']);
$class = App::className($name, 'Http/Client/Auth');
if (!$class) {
throw new Exception(
sprintf('In... | [
"protected",
"function",
"_createAuth",
"(",
"$",
"auth",
",",
"$",
"options",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"auth",
"[",
"'type'",
"]",
")",
")",
"{",
"$",
"auth",
"[",
"'type'",
"]",
"=",
"'basic'",
";",
"}",
"$",
"name",
"=",
"ucfirs... | Create the authentication strategy.
Use the configuration options to create the correct
authentication strategy handler.
@param array $auth The authentication options to use.
@param array $options The overall request options to use.
@return mixed Authentication strategy instance.
@throws \Cake\Core\Exception\Exceptio... | [
"Create",
"the",
"authentication",
"strategy",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client.php#L612-L626 |
211,226 | cakephp/cakephp | src/Controller/Component/PaginatorComponent.php | PaginatorComponent._setPagingParams | protected function _setPagingParams()
{
$controller = $this->getController();
$request = $controller->getRequest();
$paging = $this->_paginator->getPagingParams() + (array)$request->getParam('paging', []);
$controller->setRequest($request->withParam('paging', $paging));
} | php | protected function _setPagingParams()
{
$controller = $this->getController();
$request = $controller->getRequest();
$paging = $this->_paginator->getPagingParams() + (array)$request->getParam('paging', []);
$controller->setRequest($request->withParam('paging', $paging));
} | [
"protected",
"function",
"_setPagingParams",
"(",
")",
"{",
"$",
"controller",
"=",
"$",
"this",
"->",
"getController",
"(",
")",
";",
"$",
"request",
"=",
"$",
"controller",
"->",
"getRequest",
"(",
")",
";",
"$",
"paging",
"=",
"$",
"this",
"->",
"_p... | Set paging params to request instance.
@return void | [
"Set",
"paging",
"params",
"to",
"request",
"instance",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/PaginatorComponent.php#L268-L275 |
211,227 | cakephp/cakephp | src/ORM/BehaviorRegistry.php | BehaviorRegistry.setTable | public function setTable(Table $table)
{
$this->_table = $table;
$eventManager = $table->getEventManager();
if ($eventManager !== null) {
$this->setEventManager($eventManager);
}
} | php | public function setTable(Table $table)
{
$this->_table = $table;
$eventManager = $table->getEventManager();
if ($eventManager !== null) {
$this->setEventManager($eventManager);
}
} | [
"public",
"function",
"setTable",
"(",
"Table",
"$",
"table",
")",
"{",
"$",
"this",
"->",
"_table",
"=",
"$",
"table",
";",
"$",
"eventManager",
"=",
"$",
"table",
"->",
"getEventManager",
"(",
")",
";",
"if",
"(",
"$",
"eventManager",
"!==",
"null",
... | Attaches a table instance to this registry.
@param \Cake\ORM\Table $table The table this registry is attached to.
@return void | [
"Attaches",
"a",
"table",
"instance",
"to",
"this",
"registry",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/BehaviorRegistry.php#L75-L82 |
211,228 | cakephp/cakephp | src/ORM/BehaviorRegistry.php | BehaviorRegistry.className | public static function className($class)
{
$result = App::className($class, 'Model/Behavior', 'Behavior');
if (!$result) {
$result = App::className($class, 'ORM/Behavior', 'Behavior');
}
return $result ?: null;
} | php | public static function className($class)
{
$result = App::className($class, 'Model/Behavior', 'Behavior');
if (!$result) {
$result = App::className($class, 'ORM/Behavior', 'Behavior');
}
return $result ?: null;
} | [
"public",
"static",
"function",
"className",
"(",
"$",
"class",
")",
"{",
"$",
"result",
"=",
"App",
"::",
"className",
"(",
"$",
"class",
",",
"'Model/Behavior'",
",",
"'Behavior'",
")",
";",
"if",
"(",
"!",
"$",
"result",
")",
"{",
"$",
"result",
"... | Resolve a behavior classname.
@param string $class Partial classname to resolve.
@return string|null Either the correct classname or null.
@since 3.5.7 | [
"Resolve",
"a",
"behavior",
"classname",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/BehaviorRegistry.php#L91-L99 |
211,229 | cakephp/cakephp | src/ORM/BehaviorRegistry.php | BehaviorRegistry._create | protected function _create($class, $alias, $config)
{
$instance = new $class($this->_table, $config);
$enable = isset($config['enabled']) ? $config['enabled'] : true;
if ($enable) {
$this->getEventManager()->on($instance);
}
$methods = $this->_getMethods($instance... | php | protected function _create($class, $alias, $config)
{
$instance = new $class($this->_table, $config);
$enable = isset($config['enabled']) ? $config['enabled'] : true;
if ($enable) {
$this->getEventManager()->on($instance);
}
$methods = $this->_getMethods($instance... | [
"protected",
"function",
"_create",
"(",
"$",
"class",
",",
"$",
"alias",
",",
"$",
"config",
")",
"{",
"$",
"instance",
"=",
"new",
"$",
"class",
"(",
"$",
"this",
"->",
"_table",
",",
"$",
"config",
")",
";",
"$",
"enable",
"=",
"isset",
"(",
"... | Create the behavior instance.
Part of the template method for Cake\Core\ObjectRegistry::load()
Enabled behaviors will be registered with the event manager.
@param string $class The classname that is missing.
@param string $alias The alias of the object.
@param array $config An array of config to use for the behavior.... | [
"Create",
"the",
"behavior",
"instance",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/BehaviorRegistry.php#L144-L156 |
211,230 | cakephp/cakephp | src/ORM/BehaviorRegistry.php | BehaviorRegistry._getMethods | protected function _getMethods(Behavior $instance, $class, $alias)
{
$finders = array_change_key_case($instance->implementedFinders());
$methods = array_change_key_case($instance->implementedMethods());
foreach ($finders as $finder => $methodName) {
if (isset($this->_finderMap[$... | php | protected function _getMethods(Behavior $instance, $class, $alias)
{
$finders = array_change_key_case($instance->implementedFinders());
$methods = array_change_key_case($instance->implementedMethods());
foreach ($finders as $finder => $methodName) {
if (isset($this->_finderMap[$... | [
"protected",
"function",
"_getMethods",
"(",
"Behavior",
"$",
"instance",
",",
"$",
"class",
",",
"$",
"alias",
")",
"{",
"$",
"finders",
"=",
"array_change_key_case",
"(",
"$",
"instance",
"->",
"implementedFinders",
"(",
")",
")",
";",
"$",
"methods",
"=... | Get the behavior methods and ensure there are no duplicates.
Use the implementedEvents() method to exclude callback methods.
Methods starting with `_` will be ignored, as will methods
declared on Cake\ORM\Behavior
@param \Cake\ORM\Behavior $instance The behavior to get methods from.
@param string $class The classname... | [
"Get",
"the",
"behavior",
"methods",
"and",
"ensure",
"there",
"are",
"no",
"duplicates",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/BehaviorRegistry.php#L171-L205 |
211,231 | cakephp/cakephp | src/ORM/BehaviorRegistry.php | BehaviorRegistry.call | public function call($method, array $args = [])
{
$method = strtolower($method);
if ($this->hasMethod($method) && $this->has($this->_methodMap[$method][0])) {
list($behavior, $callMethod) = $this->_methodMap[$method];
return call_user_func_array([$this->_loaded[$behavior], $... | php | public function call($method, array $args = [])
{
$method = strtolower($method);
if ($this->hasMethod($method) && $this->has($this->_methodMap[$method][0])) {
list($behavior, $callMethod) = $this->_methodMap[$method];
return call_user_func_array([$this->_loaded[$behavior], $... | [
"public",
"function",
"call",
"(",
"$",
"method",
",",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"method",
"=",
"strtolower",
"(",
"$",
"method",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasMethod",
"(",
"$",
"method",
")",
"&&",
"$",
... | Invoke a method on a behavior.
@param string $method The method to invoke.
@param array $args The arguments you want to invoke the method with.
@return mixed The return value depends on the underlying behavior method.
@throws \BadMethodCallException When the method is unknown. | [
"Invoke",
"a",
"method",
"on",
"a",
"behavior",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/BehaviorRegistry.php#L247-L259 |
211,232 | cakephp/cakephp | src/ORM/BehaviorRegistry.php | BehaviorRegistry.callFinder | public function callFinder($type, array $args = [])
{
$type = strtolower($type);
if ($this->hasFinder($type) && $this->has($this->_finderMap[$type][0])) {
list($behavior, $callMethod) = $this->_finderMap[$type];
return call_user_func_array([$this->_loaded[$behavior], $callM... | php | public function callFinder($type, array $args = [])
{
$type = strtolower($type);
if ($this->hasFinder($type) && $this->has($this->_finderMap[$type][0])) {
list($behavior, $callMethod) = $this->_finderMap[$type];
return call_user_func_array([$this->_loaded[$behavior], $callM... | [
"public",
"function",
"callFinder",
"(",
"$",
"type",
",",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"type",
"=",
"strtolower",
"(",
"$",
"type",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasFinder",
"(",
"$",
"type",
")",
"&&",
"$",
"... | Invoke a finder on a behavior.
@param string $type The finder type to invoke.
@param array $args The arguments you want to invoke the method with.
@return mixed The return value depends on the underlying behavior method.
@throws \BadMethodCallException When the method is unknown. | [
"Invoke",
"a",
"finder",
"on",
"a",
"behavior",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/BehaviorRegistry.php#L269-L282 |
211,233 | cakephp/cakephp | src/Collection/Iterator/MapReduce.php | MapReduce.emit | public function emit($val, $key = null)
{
$this->_result[$key === null ? $this->_counter : $key] = $val;
$this->_counter++;
} | php | public function emit($val, $key = null)
{
$this->_result[$key === null ? $this->_counter : $key] = $val;
$this->_counter++;
} | [
"public",
"function",
"emit",
"(",
"$",
"val",
",",
"$",
"key",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_result",
"[",
"$",
"key",
"===",
"null",
"?",
"$",
"this",
"->",
"_counter",
":",
"$",
"key",
"]",
"=",
"$",
"val",
";",
"$",
"this",
... | Appends a new record to the final list of results and optionally assign a key
for this record.
@param mixed $val The value to be appended to the final list of results
@param string|null $key and optional key to assign to the value
@return void | [
"Appends",
"a",
"new",
"record",
"to",
"the",
"final",
"list",
"of",
"results",
"and",
"optionally",
"assign",
"a",
"key",
"for",
"this",
"record",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Collection/Iterator/MapReduce.php#L159-L163 |
211,234 | cakephp/cakephp | src/Collection/Iterator/MapReduce.php | MapReduce._execute | protected function _execute()
{
$mapper = $this->_mapper;
foreach ($this->_data as $key => $val) {
$mapper($val, $key, $this);
}
$this->_data = null;
if (!empty($this->_intermediate) && empty($this->_reducer)) {
throw new LogicException('No reducer fu... | php | protected function _execute()
{
$mapper = $this->_mapper;
foreach ($this->_data as $key => $val) {
$mapper($val, $key, $this);
}
$this->_data = null;
if (!empty($this->_intermediate) && empty($this->_reducer)) {
throw new LogicException('No reducer fu... | [
"protected",
"function",
"_execute",
"(",
")",
"{",
"$",
"mapper",
"=",
"$",
"this",
"->",
"_mapper",
";",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"$",
"mapper",
"(",
"$",
"val",
",",
"$",
"key",
... | Runs the actual Map-Reduce algorithm. This is iterate the original data
and call the mapper function for each , then for each intermediate
bucket created during the Map phase call the reduce function.
@return void
@throws \LogicException if emitIntermediate was called but no reducer function
was provided | [
"Runs",
"the",
"actual",
"Map",
"-",
"Reduce",
"algorithm",
".",
"This",
"is",
"iterate",
"the",
"original",
"data",
"and",
"call",
"the",
"mapper",
"function",
"for",
"each",
"then",
"for",
"each",
"intermediate",
"bucket",
"created",
"during",
"the",
"Map"... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Collection/Iterator/MapReduce.php#L174-L192 |
211,235 | cakephp/cakephp | src/Auth/BasicAuthenticate.php | BasicAuthenticate.unauthenticated | public function unauthenticated(ServerRequest $request, Response $response)
{
$Exception = new UnauthorizedException();
$Exception->responseHeader($this->loginHeaders($request));
throw $Exception;
} | php | public function unauthenticated(ServerRequest $request, Response $response)
{
$Exception = new UnauthorizedException();
$Exception->responseHeader($this->loginHeaders($request));
throw $Exception;
} | [
"public",
"function",
"unauthenticated",
"(",
"ServerRequest",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"$",
"Exception",
"=",
"new",
"UnauthorizedException",
"(",
")",
";",
"$",
"Exception",
"->",
"responseHeader",
"(",
"$",
"this",
"->",
... | Handles an unauthenticated access attempt by sending appropriate login headers
@param \Cake\Http\ServerRequest $request A request object.
@param \Cake\Http\Response $response A response object.
@return void
@throws \Cake\Http\Exception\UnauthorizedException | [
"Handles",
"an",
"unauthenticated",
"access",
"attempt",
"by",
"sending",
"appropriate",
"login",
"headers"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Auth/BasicAuthenticate.php#L94-L99 |
211,236 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany.targetForeignKey | public function targetForeignKey($key = null)
{
deprecationWarning(
'BelongToMany::targetForeignKey() is deprecated. ' .
'Use setTargetForeignKey()/getTargetForeignKey() instead.'
);
if ($key !== null) {
$this->setTargetForeignKey($key);
}
... | php | public function targetForeignKey($key = null)
{
deprecationWarning(
'BelongToMany::targetForeignKey() is deprecated. ' .
'Use setTargetForeignKey()/getTargetForeignKey() instead.'
);
if ($key !== null) {
$this->setTargetForeignKey($key);
}
... | [
"public",
"function",
"targetForeignKey",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"deprecationWarning",
"(",
"'BelongToMany::targetForeignKey() is deprecated. '",
".",
"'Use setTargetForeignKey()/getTargetForeignKey() instead.'",
")",
";",
"if",
"(",
"$",
"key",
"!==",
"n... | Sets the name of the field representing the foreign key to the target table.
If no parameters are passed current field is returned
@deprecated 3.4.0 Use setTargetForeignKey()/getTargetForeignKey() instead.
@param string|null $key the key to be used to link both tables together
@return string | [
"Sets",
"the",
"name",
"of",
"the",
"field",
"representing",
"the",
"foreign",
"key",
"to",
"the",
"target",
"table",
".",
"If",
"no",
"parameters",
"are",
"passed",
"current",
"field",
"is",
"returned"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L195-L206 |
211,237 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany.getForeignKey | public function getForeignKey()
{
if ($this->_foreignKey === null) {
$this->_foreignKey = $this->_modelKey($this->getSource()->getTable());
}
return $this->_foreignKey;
} | php | public function getForeignKey()
{
if ($this->_foreignKey === null) {
$this->_foreignKey = $this->_modelKey($this->getSource()->getTable());
}
return $this->_foreignKey;
} | [
"public",
"function",
"getForeignKey",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_foreignKey",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_foreignKey",
"=",
"$",
"this",
"->",
"_modelKey",
"(",
"$",
"this",
"->",
"getSource",
"(",
")",
"->",
"g... | Gets the name of the field representing the foreign key to the source table.
@return string | [
"Gets",
"the",
"name",
"of",
"the",
"field",
"representing",
"the",
"foreign",
"key",
"to",
"the",
"source",
"table",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L225-L232 |
211,238 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany.sort | public function sort($sort = null)
{
deprecationWarning(
'BelongToMany::sort() is deprecated. ' .
'Use setSort()/getSort() instead.'
);
if ($sort !== null) {
$this->setSort($sort);
}
return $this->getSort();
} | php | public function sort($sort = null)
{
deprecationWarning(
'BelongToMany::sort() is deprecated. ' .
'Use setSort()/getSort() instead.'
);
if ($sort !== null) {
$this->setSort($sort);
}
return $this->getSort();
} | [
"public",
"function",
"sort",
"(",
"$",
"sort",
"=",
"null",
")",
"{",
"deprecationWarning",
"(",
"'BelongToMany::sort() is deprecated. '",
".",
"'Use setSort()/getSort() instead.'",
")",
";",
"if",
"(",
"$",
"sort",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
... | Sets the sort order in which target records should be returned.
If no arguments are passed the currently configured value is returned
@deprecated 3.5.0 Use setSort()/getSort() instead.
@param mixed $sort A find() compatible order clause
@return mixed | [
"Sets",
"the",
"sort",
"order",
"in",
"which",
"target",
"records",
"should",
"be",
"returned",
".",
"If",
"no",
"arguments",
"are",
"passed",
"the",
"currently",
"configured",
"value",
"is",
"returned"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L265-L276 |
211,239 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany.junction | public function junction($table = null)
{
if ($table === null && $this->_junctionTable) {
return $this->_junctionTable;
}
$tableLocator = $this->getTableLocator();
if ($table === null && $this->_through) {
$table = $this->_through;
} elseif ($table ==... | php | public function junction($table = null)
{
if ($table === null && $this->_junctionTable) {
return $this->_junctionTable;
}
$tableLocator = $this->getTableLocator();
if ($table === null && $this->_through) {
$table = $this->_through;
} elseif ($table ==... | [
"public",
"function",
"junction",
"(",
"$",
"table",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"table",
"===",
"null",
"&&",
"$",
"this",
"->",
"_junctionTable",
")",
"{",
"return",
"$",
"this",
"->",
"_junctionTable",
";",
"}",
"$",
"tableLocator",
"=",
... | Sets the table instance for the junction relation. If no arguments
are passed, the current configured table instance is returned
@param string|\Cake\ORM\Table|null $table Name or instance for the join table
@return \Cake\ORM\Table | [
"Sets",
"the",
"table",
"instance",
"for",
"the",
"junction",
"relation",
".",
"If",
"no",
"arguments",
"are",
"passed",
"the",
"current",
"configured",
"table",
"instance",
"is",
"returned"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L298-L334 |
211,240 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany._generateTargetAssociations | protected function _generateTargetAssociations($junction, $source, $target)
{
$junctionAlias = $junction->getAlias();
$sAlias = $source->getAlias();
if (!$target->hasAssociation($junctionAlias)) {
$target->hasMany($junctionAlias, [
'targetTable' => $junction,
... | php | protected function _generateTargetAssociations($junction, $source, $target)
{
$junctionAlias = $junction->getAlias();
$sAlias = $source->getAlias();
if (!$target->hasAssociation($junctionAlias)) {
$target->hasMany($junctionAlias, [
'targetTable' => $junction,
... | [
"protected",
"function",
"_generateTargetAssociations",
"(",
"$",
"junction",
",",
"$",
"source",
",",
"$",
"target",
")",
"{",
"$",
"junctionAlias",
"=",
"$",
"junction",
"->",
"getAlias",
"(",
")",
";",
"$",
"sAlias",
"=",
"$",
"source",
"->",
"getAlias"... | Generate reciprocal associations as necessary.
Generates the following associations:
- target hasMany junction e.g. Articles hasMany ArticlesTags
- target belongsToMany source e.g Articles belongsToMany Tags.
You can override these generated associations by defining associations
with the correct aliases.
@param \Ca... | [
"Generate",
"reciprocal",
"associations",
"as",
"necessary",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L352-L375 |
211,241 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany._generateSourceAssociations | protected function _generateSourceAssociations($junction, $source)
{
$junctionAlias = $junction->getAlias();
if (!$source->hasAssociation($junctionAlias)) {
$source->hasMany($junctionAlias, [
'targetTable' => $junction,
'foreignKey' => $this->getForeignKey... | php | protected function _generateSourceAssociations($junction, $source)
{
$junctionAlias = $junction->getAlias();
if (!$source->hasAssociation($junctionAlias)) {
$source->hasMany($junctionAlias, [
'targetTable' => $junction,
'foreignKey' => $this->getForeignKey... | [
"protected",
"function",
"_generateSourceAssociations",
"(",
"$",
"junction",
",",
"$",
"source",
")",
"{",
"$",
"junctionAlias",
"=",
"$",
"junction",
"->",
"getAlias",
"(",
")",
";",
"if",
"(",
"!",
"$",
"source",
"->",
"hasAssociation",
"(",
"$",
"junct... | Generate additional source table associations as necessary.
Generates the following associations:
- source hasMany junction e.g. Tags hasMany ArticlesTags
You can override these generated associations by defining associations
with the correct aliases.
@param \Cake\ORM\Table $junction The junction table.
@param \Cak... | [
"Generate",
"additional",
"source",
"table",
"associations",
"as",
"necessary",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L391-L401 |
211,242 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany._generateJunctionAssociations | protected function _generateJunctionAssociations($junction, $source, $target)
{
$tAlias = $target->getAlias();
$sAlias = $source->getAlias();
if (!$junction->hasAssociation($tAlias)) {
$junction->belongsTo($tAlias, [
'foreignKey' => $this->getTargetForeignKey(),
... | php | protected function _generateJunctionAssociations($junction, $source, $target)
{
$tAlias = $target->getAlias();
$sAlias = $source->getAlias();
if (!$junction->hasAssociation($tAlias)) {
$junction->belongsTo($tAlias, [
'foreignKey' => $this->getTargetForeignKey(),
... | [
"protected",
"function",
"_generateJunctionAssociations",
"(",
"$",
"junction",
",",
"$",
"source",
",",
"$",
"target",
")",
"{",
"$",
"tAlias",
"=",
"$",
"target",
"->",
"getAlias",
"(",
")",
";",
"$",
"sAlias",
"=",
"$",
"source",
"->",
"getAlias",
"("... | Generate associations on the junction table as necessary
Generates the following associations:
- junction belongsTo source e.g. ArticlesTags belongsTo Tags
- junction belongsTo target e.g. ArticlesTags belongsTo Articles
You can override these generated associations by defining associations
with the correct aliases.... | [
"Generate",
"associations",
"on",
"the",
"junction",
"table",
"as",
"necessary"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L419-L436 |
211,243 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany.cascadeDelete | public function cascadeDelete(EntityInterface $entity, array $options = [])
{
if (!$this->getDependent()) {
return true;
}
$foreignKey = (array)$this->getForeignKey();
$bindingKey = (array)$this->getBindingKey();
$conditions = [];
if (!empty($bindingKey))... | php | public function cascadeDelete(EntityInterface $entity, array $options = [])
{
if (!$this->getDependent()) {
return true;
}
$foreignKey = (array)$this->getForeignKey();
$bindingKey = (array)$this->getBindingKey();
$conditions = [];
if (!empty($bindingKey))... | [
"public",
"function",
"cascadeDelete",
"(",
"EntityInterface",
"$",
"entity",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getDependent",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"foreignKey",
... | Clear out the data in the junction table for a given entity.
@param \Cake\Datasource\EntityInterface $entity The entity that started the cascading delete.
@param array $options The options for the original delete.
@return bool Success. | [
"Clear",
"out",
"the",
"data",
"in",
"the",
"junction",
"table",
"for",
"a",
"given",
"entity",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L595-L623 |
211,244 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany.setSaveStrategy | public function setSaveStrategy($strategy)
{
if (!in_array($strategy, [self::SAVE_APPEND, self::SAVE_REPLACE])) {
$msg = sprintf('Invalid save strategy "%s"', $strategy);
throw new InvalidArgumentException($msg);
}
$this->_saveStrategy = $strategy;
return $t... | php | public function setSaveStrategy($strategy)
{
if (!in_array($strategy, [self::SAVE_APPEND, self::SAVE_REPLACE])) {
$msg = sprintf('Invalid save strategy "%s"', $strategy);
throw new InvalidArgumentException($msg);
}
$this->_saveStrategy = $strategy;
return $t... | [
"public",
"function",
"setSaveStrategy",
"(",
"$",
"strategy",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"strategy",
",",
"[",
"self",
"::",
"SAVE_APPEND",
",",
"self",
"::",
"SAVE_REPLACE",
"]",
")",
")",
"{",
"$",
"msg",
"=",
"sprintf",
"(",
... | Sets the strategy that should be used for saving.
@param string $strategy the strategy name to be used
@throws \InvalidArgumentException if an invalid strategy name is passed
@return $this | [
"Sets",
"the",
"strategy",
"that",
"should",
"be",
"used",
"for",
"saving",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L644-L654 |
211,245 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany.saveStrategy | public function saveStrategy($strategy = null)
{
deprecationWarning(
'BelongsToMany::saveStrategy() is deprecated. ' .
'Use setSaveStrategy()/getSaveStrategy() instead.'
);
if ($strategy !== null) {
$this->setSaveStrategy($strategy);
}
ret... | php | public function saveStrategy($strategy = null)
{
deprecationWarning(
'BelongsToMany::saveStrategy() is deprecated. ' .
'Use setSaveStrategy()/getSaveStrategy() instead.'
);
if ($strategy !== null) {
$this->setSaveStrategy($strategy);
}
ret... | [
"public",
"function",
"saveStrategy",
"(",
"$",
"strategy",
"=",
"null",
")",
"{",
"deprecationWarning",
"(",
"'BelongsToMany::saveStrategy() is deprecated. '",
".",
"'Use setSaveStrategy()/getSaveStrategy() instead.'",
")",
";",
"if",
"(",
"$",
"strategy",
"!==",
"null",... | Sets the strategy that should be used for saving. If called with no
arguments, it will return the currently configured strategy
@deprecated 3.4.0 Use setSaveStrategy()/getSaveStrategy() instead.
@param string|null $strategy the strategy name to be used
@throws \InvalidArgumentException if an invalid strategy name is p... | [
"Sets",
"the",
"strategy",
"that",
"should",
"be",
"used",
"for",
"saving",
".",
"If",
"called",
"with",
"no",
"arguments",
"it",
"will",
"return",
"the",
"currently",
"configured",
"strategy"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L675-L686 |
211,246 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany._saveLinks | protected function _saveLinks(EntityInterface $sourceEntity, $targetEntities, $options)
{
$target = $this->getTarget();
$junction = $this->junction();
$entityClass = $junction->getEntityClass();
$belongsTo = $junction->getAssociation($target->getAlias());
$foreignKey = (array... | php | protected function _saveLinks(EntityInterface $sourceEntity, $targetEntities, $options)
{
$target = $this->getTarget();
$junction = $this->junction();
$entityClass = $junction->getEntityClass();
$belongsTo = $junction->getAssociation($target->getAlias());
$foreignKey = (array... | [
"protected",
"function",
"_saveLinks",
"(",
"EntityInterface",
"$",
"sourceEntity",
",",
"$",
"targetEntities",
",",
"$",
"options",
")",
"{",
"$",
"target",
"=",
"$",
"this",
"->",
"getTarget",
"(",
")",
";",
"$",
"junction",
"=",
"$",
"this",
"->",
"ju... | Creates links between the source entity and each of the passed target entities
@param \Cake\Datasource\EntityInterface $sourceEntity the entity from source table in this
association
@param array $targetEntities list of entities to link to link to the source entity using the
junction table
@param array $options list of... | [
"Creates",
"links",
"between",
"the",
"source",
"entity",
"and",
"each",
"of",
"the",
"passed",
"target",
"entities"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L817-L862 |
211,247 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany.link | public function link(EntityInterface $sourceEntity, array $targetEntities, array $options = [])
{
$this->_checkPersistenceStatus($sourceEntity, $targetEntities);
$property = $this->getProperty();
$links = $sourceEntity->get($property) ?: [];
$links = array_merge($links, $targetEntiti... | php | public function link(EntityInterface $sourceEntity, array $targetEntities, array $options = [])
{
$this->_checkPersistenceStatus($sourceEntity, $targetEntities);
$property = $this->getProperty();
$links = $sourceEntity->get($property) ?: [];
$links = array_merge($links, $targetEntiti... | [
"public",
"function",
"link",
"(",
"EntityInterface",
"$",
"sourceEntity",
",",
"array",
"$",
"targetEntities",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"_checkPersistenceStatus",
"(",
"$",
"sourceEntity",
",",
"$",
"targetEn... | Associates the source entity to each of the target entities provided by
creating links in the junction table. Both the source entity and each of
the target entities are assumed to be already persisted, if they are marked
as new or their status is unknown then an exception will be thrown.
When using this method, all en... | [
"Associates",
"the",
"source",
"entity",
"to",
"each",
"of",
"the",
"target",
"entities",
"provided",
"by",
"creating",
"links",
"in",
"the",
"junction",
"table",
".",
"Both",
"the",
"source",
"entity",
"and",
"each",
"of",
"the",
"target",
"entities",
"are"... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L893-L906 |
211,248 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany.targetConditions | protected function targetConditions()
{
if ($this->_targetConditions !== null) {
return $this->_targetConditions;
}
$conditions = $this->getConditions();
if (!is_array($conditions)) {
return $conditions;
}
$matching = [];
$alias = $this... | php | protected function targetConditions()
{
if ($this->_targetConditions !== null) {
return $this->_targetConditions;
}
$conditions = $this->getConditions();
if (!is_array($conditions)) {
return $conditions;
}
$matching = [];
$alias = $this... | [
"protected",
"function",
"targetConditions",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_targetConditions",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_targetConditions",
";",
"}",
"$",
"conditions",
"=",
"$",
"this",
"->",
"getConditions",
... | Returns filtered conditions that reference the target table.
Any string expressions, or expression objects will
also be returned in this list.
@return mixed Generally an array. If the conditions
are not an array, the association conditions will be
returned unmodified. | [
"Returns",
"filtered",
"conditions",
"that",
"reference",
"the",
"target",
"table",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L1032-L1052 |
211,249 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany.junctionConditions | protected function junctionConditions()
{
if ($this->_junctionConditions !== null) {
return $this->_junctionConditions;
}
$matching = [];
$conditions = $this->getConditions();
if (!is_array($conditions)) {
return $matching;
}
$alias = $... | php | protected function junctionConditions()
{
if ($this->_junctionConditions !== null) {
return $this->_junctionConditions;
}
$matching = [];
$conditions = $this->getConditions();
if (!is_array($conditions)) {
return $matching;
}
$alias = $... | [
"protected",
"function",
"junctionConditions",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_junctionConditions",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_junctionConditions",
";",
"}",
"$",
"matching",
"=",
"[",
"]",
";",
"$",
"conditions"... | Returns filtered conditions that specifically reference
the junction table.
@return array | [
"Returns",
"filtered",
"conditions",
"that",
"specifically",
"reference",
"the",
"junction",
"table",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L1060-L1084 |
211,250 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany.find | public function find($type = null, array $options = [])
{
$type = $type ?: $this->getFinder();
list($type, $opts) = $this->_extractFinder($type);
$query = $this->getTarget()
->find($type, $options + $opts)
->where($this->targetConditions())
->addDefaultTyp... | php | public function find($type = null, array $options = [])
{
$type = $type ?: $this->getFinder();
list($type, $opts) = $this->_extractFinder($type);
$query = $this->getTarget()
->find($type, $options + $opts)
->where($this->targetConditions())
->addDefaultTyp... | [
"public",
"function",
"find",
"(",
"$",
"type",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"type",
"=",
"$",
"type",
"?",
":",
"$",
"this",
"->",
"getFinder",
"(",
")",
";",
"list",
"(",
"$",
"type",
",",
"$",
"o... | Proxies the finding operation to the target table's find method
and modifies the query accordingly based of this association
configuration.
If your association includes conditions, the junction table will be
included in the query's contained associations.
@param string|array|null $type the type of query to perform, i... | [
"Proxies",
"the",
"finding",
"operation",
"to",
"the",
"target",
"table",
"s",
"find",
"method",
"and",
"modifies",
"the",
"query",
"accordingly",
"based",
"of",
"this",
"association",
"configuration",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L1100-L1120 |
211,251 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany._appendJunctionJoin | protected function _appendJunctionJoin($query, $conditions)
{
$name = $this->_junctionAssociationName();
/** @var array $joins */
$joins = $query->clause('join');
$matching = [
$name => [
'table' => $this->junction()->getTable(),
'condition... | php | protected function _appendJunctionJoin($query, $conditions)
{
$name = $this->_junctionAssociationName();
/** @var array $joins */
$joins = $query->clause('join');
$matching = [
$name => [
'table' => $this->junction()->getTable(),
'condition... | [
"protected",
"function",
"_appendJunctionJoin",
"(",
"$",
"query",
",",
"$",
"conditions",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"_junctionAssociationName",
"(",
")",
";",
"/** @var array $joins */",
"$",
"joins",
"=",
"$",
"query",
"->",
"clause",
... | Append a join to the junction table.
@param \Cake\ORM\Query $query The query to append.
@param string|array $conditions The query conditions to use.
@return \Cake\ORM\Query The modified query. | [
"Append",
"a",
"join",
"to",
"the",
"junction",
"table",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L1129-L1148 |
211,252 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany._checkPersistenceStatus | protected function _checkPersistenceStatus($sourceEntity, array $targetEntities)
{
if ($sourceEntity->isNew()) {
$error = 'Source entity needs to be persisted before links can be created or removed.';
throw new InvalidArgumentException($error);
}
foreach ($targetEnti... | php | protected function _checkPersistenceStatus($sourceEntity, array $targetEntities)
{
if ($sourceEntity->isNew()) {
$error = 'Source entity needs to be persisted before links can be created or removed.';
throw new InvalidArgumentException($error);
}
foreach ($targetEnti... | [
"protected",
"function",
"_checkPersistenceStatus",
"(",
"$",
"sourceEntity",
",",
"array",
"$",
"targetEntities",
")",
"{",
"if",
"(",
"$",
"sourceEntity",
"->",
"isNew",
"(",
")",
")",
"{",
"$",
"error",
"=",
"'Source entity needs to be persisted before links can ... | Throws an exception should any of the passed entities is not persisted.
@param \Cake\Datasource\EntityInterface $sourceEntity the row belonging to the `source` side
of this association
@param array $targetEntities list of entities belonging to the `target` side
of this association
@return bool
@throws \InvalidArgument... | [
"Throws",
"an",
"exception",
"should",
"any",
"of",
"the",
"passed",
"entities",
"is",
"not",
"persisted",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L1326-L1341 |
211,253 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany._collectJointEntities | protected function _collectJointEntities($sourceEntity, $targetEntities)
{
$target = $this->getTarget();
$source = $this->getSource();
$junction = $this->junction();
$jointProperty = $this->_junctionProperty;
$primary = (array)$target->getPrimaryKey();
$result = [];
... | php | protected function _collectJointEntities($sourceEntity, $targetEntities)
{
$target = $this->getTarget();
$source = $this->getSource();
$junction = $this->junction();
$jointProperty = $this->_junctionProperty;
$primary = (array)$target->getPrimaryKey();
$result = [];
... | [
"protected",
"function",
"_collectJointEntities",
"(",
"$",
"sourceEntity",
",",
"$",
"targetEntities",
")",
"{",
"$",
"target",
"=",
"$",
"this",
"->",
"getTarget",
"(",
")",
";",
"$",
"source",
"=",
"$",
"this",
"->",
"getSource",
"(",
")",
";",
"$",
... | Returns the list of joint entities that exist between the source entity
and each of the passed target entities
@param \Cake\Datasource\EntityInterface $sourceEntity The row belonging to the source side
of this association.
@param array $targetEntities The rows belonging to the target side of this
association.
@throws ... | [
"Returns",
"the",
"list",
"of",
"joint",
"entities",
"that",
"exist",
"between",
"the",
"source",
"entity",
"and",
"each",
"of",
"the",
"passed",
"target",
"entities"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L1355-L1403 |
211,254 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany._junctionAssociationName | protected function _junctionAssociationName()
{
if (!$this->_junctionAssociationName) {
$this->_junctionAssociationName = $this->getTarget()
->getAssociation($this->junction()->getAlias())
->getName();
}
return $this->_junctionAssociationName;
... | php | protected function _junctionAssociationName()
{
if (!$this->_junctionAssociationName) {
$this->_junctionAssociationName = $this->getTarget()
->getAssociation($this->junction()->getAlias())
->getName();
}
return $this->_junctionAssociationName;
... | [
"protected",
"function",
"_junctionAssociationName",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_junctionAssociationName",
")",
"{",
"$",
"this",
"->",
"_junctionAssociationName",
"=",
"$",
"this",
"->",
"getTarget",
"(",
")",
"->",
"getAssociation",
"... | Returns the name of the association from the target table to the junction table,
this name is used to generate alias in the query and to later on retrieve the
results.
@return string | [
"Returns",
"the",
"name",
"of",
"the",
"association",
"from",
"the",
"target",
"table",
"to",
"the",
"junction",
"table",
"this",
"name",
"is",
"used",
"to",
"generate",
"alias",
"in",
"the",
"query",
"and",
"to",
"later",
"on",
"retrieve",
"the",
"results... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L1412-L1421 |
211,255 | cakephp/cakephp | src/ORM/Association/BelongsToMany.php | BelongsToMany._junctionTableName | protected function _junctionTableName($name = null)
{
if ($name === null) {
if (empty($this->_junctionTableName)) {
$tablesNames = array_map('Cake\Utility\Inflector::underscore', [
$this->getSource()->getTable(),
$this->getTarget()->getTabl... | php | protected function _junctionTableName($name = null)
{
if ($name === null) {
if (empty($this->_junctionTableName)) {
$tablesNames = array_map('Cake\Utility\Inflector::underscore', [
$this->getSource()->getTable(),
$this->getTarget()->getTabl... | [
"protected",
"function",
"_junctionTableName",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_junctionTableName",
")",
")",
"{",
"$",
"tablesNames",
"=",
"array_ma... | Sets the name of the junction table.
If no arguments are passed the current configured name is returned. A default
name based of the associated tables will be generated if none found.
@param string|null $name The name of the junction table.
@return string | [
"Sets",
"the",
"name",
"of",
"the",
"junction",
"table",
".",
"If",
"no",
"arguments",
"are",
"passed",
"the",
"current",
"configured",
"name",
"is",
"returned",
".",
"A",
"default",
"name",
"based",
"of",
"the",
"associated",
"tables",
"will",
"be",
"gene... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/BelongsToMany.php#L1431-L1447 |
211,256 | cakephp/cakephp | src/Database/Dialect/SqlserverDialectTrait.php | SqlserverDialectTrait._pagingSubquery | protected function _pagingSubquery($original, $limit, $offset)
{
$field = '_cake_paging_._cake_page_rownum_';
if ($original->clause('order')) {
// SQL server does not support column aliases in OVER clauses. But
// the only practical way to specify the use of calculated colu... | php | protected function _pagingSubquery($original, $limit, $offset)
{
$field = '_cake_paging_._cake_page_rownum_';
if ($original->clause('order')) {
// SQL server does not support column aliases in OVER clauses. But
// the only practical way to specify the use of calculated colu... | [
"protected",
"function",
"_pagingSubquery",
"(",
"$",
"original",
",",
"$",
"limit",
",",
"$",
"offset",
")",
"{",
"$",
"field",
"=",
"'_cake_paging_._cake_page_rownum_'",
";",
"if",
"(",
"$",
"original",
"->",
"clause",
"(",
"'order'",
")",
")",
"{",
"// ... | Generate a paging subquery for older versions of SQLserver.
Prior to SQLServer 2012 there was no equivalent to LIMIT OFFSET, so a subquery must
be used.
@param \Cake\Database\Query $original The query to wrap in a subquery.
@param int $limit The number of rows to fetch.
@param int $offset The number of rows to offset... | [
"Generate",
"a",
"paging",
"subquery",
"for",
"older",
"versions",
"of",
"SQLserver",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Dialect/SqlserverDialectTrait.php#L104-L163 |
211,257 | cakephp/cakephp | src/Routing/Route/InflectedRoute.php | InflectedRoute.parse | public function parse($url, $method = '')
{
$params = parent::parse($url, $method);
if (!$params) {
return false;
}
if (!empty($params['controller'])) {
$params['controller'] = Inflector::camelize($params['controller']);
}
if (!empty($params['p... | php | public function parse($url, $method = '')
{
$params = parent::parse($url, $method);
if (!$params) {
return false;
}
if (!empty($params['controller'])) {
$params['controller'] = Inflector::camelize($params['controller']);
}
if (!empty($params['p... | [
"public",
"function",
"parse",
"(",
"$",
"url",
",",
"$",
"method",
"=",
"''",
")",
"{",
"$",
"params",
"=",
"parent",
"::",
"parse",
"(",
"$",
"url",
",",
"$",
"method",
")",
";",
"if",
"(",
"!",
"$",
"params",
")",
"{",
"return",
"false",
";"... | Parses a string URL into an array. If it matches, it will convert the prefix, controller and
plugin keys to their camelized form.
@param string $url The URL to parse
@param string $method The HTTP method being matched.
@return array|false An array of request parameters, or false on failure. | [
"Parses",
"a",
"string",
"URL",
"into",
"an",
"array",
".",
"If",
"it",
"matches",
"it",
"will",
"convert",
"the",
"prefix",
"controller",
"and",
"plugin",
"keys",
"to",
"their",
"camelized",
"form",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/InflectedRoute.php#L44-L63 |
211,258 | cakephp/cakephp | src/Routing/Route/InflectedRoute.php | InflectedRoute._underscore | protected function _underscore($url)
{
if (!empty($url['controller'])) {
$url['controller'] = Inflector::underscore($url['controller']);
}
if (!empty($url['plugin'])) {
$url['plugin'] = Inflector::underscore($url['plugin']);
}
return $url;
} | php | protected function _underscore($url)
{
if (!empty($url['controller'])) {
$url['controller'] = Inflector::underscore($url['controller']);
}
if (!empty($url['plugin'])) {
$url['plugin'] = Inflector::underscore($url['plugin']);
}
return $url;
} | [
"protected",
"function",
"_underscore",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"url",
"[",
"'controller'",
"]",
")",
")",
"{",
"$",
"url",
"[",
"'controller'",
"]",
"=",
"Inflector",
"::",
"underscore",
"(",
"$",
"url",
"[",
... | Helper method for underscoring keys in a URL array.
@param array $url An array of URL keys.
@return array | [
"Helper",
"method",
"for",
"underscoring",
"keys",
"in",
"a",
"URL",
"array",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/InflectedRoute.php#L92-L102 |
211,259 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression.tieWith | public function tieWith($conjunction = null)
{
deprecationWarning(
'QueryExpression::tieWith() is deprecated. ' .
'Use QueryExpression::setConjunction()/getConjunction() instead.'
);
if ($conjunction !== null) {
return $this->setConjunction($conjunction);
... | php | public function tieWith($conjunction = null)
{
deprecationWarning(
'QueryExpression::tieWith() is deprecated. ' .
'Use QueryExpression::setConjunction()/getConjunction() instead.'
);
if ($conjunction !== null) {
return $this->setConjunction($conjunction);
... | [
"public",
"function",
"tieWith",
"(",
"$",
"conjunction",
"=",
"null",
")",
"{",
"deprecationWarning",
"(",
"'QueryExpression::tieWith() is deprecated. '",
".",
"'Use QueryExpression::setConjunction()/getConjunction() instead.'",
")",
";",
"if",
"(",
"$",
"conjunction",
"!=... | Changes the conjunction for the conditions at this level of the expression tree.
If called with no arguments it will return the currently configured value.
@deprecated 3.4.0 Use setConjunction()/getConjunction() instead.
@param string|null $conjunction value to be used for joining conditions. If null it
will not set a... | [
"Changes",
"the",
"conjunction",
"for",
"the",
"conditions",
"at",
"this",
"level",
"of",
"the",
"expression",
"tree",
".",
"If",
"called",
"with",
"no",
"arguments",
"it",
"will",
"return",
"the",
"currently",
"configured",
"value",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L109-L120 |
211,260 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression.add | public function add($conditions, $types = [])
{
if (is_string($conditions)) {
$this->_conditions[] = $conditions;
return $this;
}
if ($conditions instanceof ExpressionInterface) {
$this->_conditions[] = $conditions;
return $this;
}
... | php | public function add($conditions, $types = [])
{
if (is_string($conditions)) {
$this->_conditions[] = $conditions;
return $this;
}
if ($conditions instanceof ExpressionInterface) {
$this->_conditions[] = $conditions;
return $this;
}
... | [
"public",
"function",
"add",
"(",
"$",
"conditions",
",",
"$",
"types",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"conditions",
")",
")",
"{",
"$",
"this",
"->",
"_conditions",
"[",
"]",
"=",
"$",
"conditions",
";",
"return",
"$",
... | Adds one or more conditions to this expression object. Conditions can be
expressed in a one dimensional array, that will cause all conditions to
be added directly at this level of the tree or they can be nested arbitrarily
making it create more expression objects that will be nested inside and
configured to use the spe... | [
"Adds",
"one",
"or",
"more",
"conditions",
"to",
"this",
"expression",
"object",
".",
"Conditions",
"can",
"be",
"expressed",
"in",
"a",
"one",
"dimensional",
"array",
"that",
"will",
"cause",
"all",
"conditions",
"to",
"be",
"added",
"directly",
"at",
"this... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L160-L177 |
211,261 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression.gt | public function gt($field, $value, $type = null)
{
if ($type === null) {
$type = $this->_calculateType($field);
}
return $this->add(new Comparison($field, $value, $type, '>'));
} | php | public function gt($field, $value, $type = null)
{
if ($type === null) {
$type = $this->_calculateType($field);
}
return $this->add(new Comparison($field, $value, $type, '>'));
} | [
"public",
"function",
"gt",
"(",
"$",
"field",
",",
"$",
"value",
",",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"null",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"_calculateType",
"(",
"$",
"field",
")",
";",
"}",... | Adds a new condition to the expression object in the form "field > value".
@param string|\Cake\Database\ExpressionInterface $field Database field to be compared against value
@param mixed $value The value to be bound to $field for comparison
@param string|null $type the type name for $value as configured using the Typ... | [
"Adds",
"a",
"new",
"condition",
"to",
"the",
"expression",
"object",
"in",
"the",
"form",
"field",
">",
"value",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L225-L232 |
211,262 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression.isNull | public function isNull($field)
{
if (!($field instanceof ExpressionInterface)) {
$field = new IdentifierExpression($field);
}
return $this->add(new UnaryExpression('IS NULL', $field, UnaryExpression::POSTFIX));
} | php | public function isNull($field)
{
if (!($field instanceof ExpressionInterface)) {
$field = new IdentifierExpression($field);
}
return $this->add(new UnaryExpression('IS NULL', $field, UnaryExpression::POSTFIX));
} | [
"public",
"function",
"isNull",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"field",
"instanceof",
"ExpressionInterface",
")",
")",
"{",
"$",
"field",
"=",
"new",
"IdentifierExpression",
"(",
"$",
"field",
")",
";",
"}",
"return",
"$",
"this... | Adds a new condition to the expression object in the form "field IS NULL".
@param string|\Cake\Database\ExpressionInterface $field database field to be
tested for null
@return $this | [
"Adds",
"a",
"new",
"condition",
"to",
"the",
"expression",
"object",
"in",
"the",
"form",
"field",
"IS",
"NULL",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L292-L299 |
211,263 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression.isNotNull | public function isNotNull($field)
{
if (!($field instanceof ExpressionInterface)) {
$field = new IdentifierExpression($field);
}
return $this->add(new UnaryExpression('IS NOT NULL', $field, UnaryExpression::POSTFIX));
} | php | public function isNotNull($field)
{
if (!($field instanceof ExpressionInterface)) {
$field = new IdentifierExpression($field);
}
return $this->add(new UnaryExpression('IS NOT NULL', $field, UnaryExpression::POSTFIX));
} | [
"public",
"function",
"isNotNull",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"field",
"instanceof",
"ExpressionInterface",
")",
")",
"{",
"$",
"field",
"=",
"new",
"IdentifierExpression",
"(",
"$",
"field",
")",
";",
"}",
"return",
"$",
"t... | Adds a new condition to the expression object in the form "field IS NOT NULL".
@param string|\Cake\Database\ExpressionInterface $field database field to be
tested for not null
@return $this | [
"Adds",
"a",
"new",
"condition",
"to",
"the",
"expression",
"object",
"in",
"the",
"form",
"field",
"IS",
"NOT",
"NULL",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L308-L315 |
211,264 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression.addCase | public function addCase($conditions, $values = [], $types = [])
{
return $this->add(new CaseExpression($conditions, $values, $types));
} | php | public function addCase($conditions, $values = [], $types = [])
{
return $this->add(new CaseExpression($conditions, $values, $types));
} | [
"public",
"function",
"addCase",
"(",
"$",
"conditions",
",",
"$",
"values",
"=",
"[",
"]",
",",
"$",
"types",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"add",
"(",
"new",
"CaseExpression",
"(",
"$",
"conditions",
",",
"$",
"values",
",... | Adds a new case expression to the expression object
@param array|\Cake\Database\ExpressionInterface $conditions The conditions to test. Must be a ExpressionInterface
instance, or an array of ExpressionInterface instances.
@param array|\Cake\Database\ExpressionInterface $values associative array of values to be associa... | [
"Adds",
"a",
"new",
"case",
"expression",
"to",
"the",
"expression",
"object"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L383-L386 |
211,265 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression.between | public function between($field, $from, $to, $type = null)
{
if ($type === null) {
$type = $this->_calculateType($field);
}
return $this->add(new BetweenExpression($field, $from, $to, $type));
} | php | public function between($field, $from, $to, $type = null)
{
if ($type === null) {
$type = $this->_calculateType($field);
}
return $this->add(new BetweenExpression($field, $from, $to, $type));
} | [
"public",
"function",
"between",
"(",
"$",
"field",
",",
"$",
"from",
",",
"$",
"to",
",",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"null",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"_calculateType",
"(",
"$",
"fi... | Adds a new condition to the expression object in the form
"field BETWEEN from AND to".
@param string|\Cake\Database\ExpressionInterface $field The field name to compare for values in between the range.
@param mixed $from The initial value of the range.
@param mixed $to The ending value in the comparison range.
@param ... | [
"Adds",
"a",
"new",
"condition",
"to",
"the",
"expression",
"object",
"in",
"the",
"form",
"field",
"BETWEEN",
"from",
"AND",
"to",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L441-L448 |
211,266 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression.and_ | public function and_($conditions, $types = [])
{
if ($this->isCallable($conditions)) {
return $conditions(new static([], $this->getTypeMap()->setTypes($types)));
}
return new static($conditions, $this->getTypeMap()->setTypes($types));
} | php | public function and_($conditions, $types = [])
{
if ($this->isCallable($conditions)) {
return $conditions(new static([], $this->getTypeMap()->setTypes($types)));
}
return new static($conditions, $this->getTypeMap()->setTypes($types));
} | [
"public",
"function",
"and_",
"(",
"$",
"conditions",
",",
"$",
"types",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isCallable",
"(",
"$",
"conditions",
")",
")",
"{",
"return",
"$",
"conditions",
"(",
"new",
"static",
"(",
"[",
"]",
... | Returns a new QueryExpression object containing all the conditions passed
and set up the conjunction to be "AND"
@param callable|string|array|\Cake\Database\ExpressionInterface $conditions to be joined with AND
@param array $types associative array of fields pointing to the type of the
values that are being passed. Us... | [
"Returns",
"a",
"new",
"QueryExpression",
"object",
"containing",
"all",
"the",
"conditions",
"passed",
"and",
"set",
"up",
"the",
"conjunction",
"to",
"be",
"AND"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L460-L467 |
211,267 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression.or_ | public function or_($conditions, $types = [])
{
if ($this->isCallable($conditions)) {
return $conditions(new static([], $this->getTypeMap()->setTypes($types), 'OR'));
}
return new static($conditions, $this->getTypeMap()->setTypes($types), 'OR');
} | php | public function or_($conditions, $types = [])
{
if ($this->isCallable($conditions)) {
return $conditions(new static([], $this->getTypeMap()->setTypes($types), 'OR'));
}
return new static($conditions, $this->getTypeMap()->setTypes($types), 'OR');
} | [
"public",
"function",
"or_",
"(",
"$",
"conditions",
",",
"$",
"types",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isCallable",
"(",
"$",
"conditions",
")",
")",
"{",
"return",
"$",
"conditions",
"(",
"new",
"static",
"(",
"[",
"]",
... | Returns a new QueryExpression object containing all the conditions passed
and set up the conjunction to be "OR"
@param callable|string|array|\Cake\Database\ExpressionInterface $conditions to be joined with OR
@param array $types associative array of fields pointing to the type of the
values that are being passed. Used... | [
"Returns",
"a",
"new",
"QueryExpression",
"object",
"containing",
"all",
"the",
"conditions",
"passed",
"and",
"set",
"up",
"the",
"conjunction",
"to",
"be",
"OR"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L478-L485 |
211,268 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression.equalFields | public function equalFields($left, $right)
{
$wrapIdentifier = function ($field) {
if ($field instanceof ExpressionInterface) {
return $field;
}
return new IdentifierExpression($field);
};
return $this->eq($wrapIdentifier($left), $wrapIde... | php | public function equalFields($left, $right)
{
$wrapIdentifier = function ($field) {
if ($field instanceof ExpressionInterface) {
return $field;
}
return new IdentifierExpression($field);
};
return $this->eq($wrapIdentifier($left), $wrapIde... | [
"public",
"function",
"equalFields",
"(",
"$",
"left",
",",
"$",
"right",
")",
"{",
"$",
"wrapIdentifier",
"=",
"function",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"instanceof",
"ExpressionInterface",
")",
"{",
"return",
"$",
"field",
";",
... | Builds equal condition or assignment with identifier wrapping.
@param string $left Left join condition field name.
@param string $right Right join condition field name.
@return $this | [
"Builds",
"equal",
"condition",
"or",
"assignment",
"with",
"identifier",
"wrapping",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L523-L534 |
211,269 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression.traverse | public function traverse(callable $callable)
{
foreach ($this->_conditions as $c) {
if ($c instanceof ExpressionInterface) {
$callable($c);
$c->traverse($callable);
}
}
} | php | public function traverse(callable $callable)
{
foreach ($this->_conditions as $c) {
if ($c instanceof ExpressionInterface) {
$callable($c);
$c->traverse($callable);
}
}
} | [
"public",
"function",
"traverse",
"(",
"callable",
"$",
"callable",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_conditions",
"as",
"$",
"c",
")",
"{",
"if",
"(",
"$",
"c",
"instanceof",
"ExpressionInterface",
")",
"{",
"$",
"callable",
"(",
"$",
"c"... | Traverses the tree structure of this query expression by executing a callback
function for each of the conditions that are included in this object.
Useful for compiling the final expression, or doing
introspection in the structure.
Callback function receives as only argument an instance of ExpressionInterface
@param ... | [
"Traverses",
"the",
"tree",
"structure",
"of",
"this",
"query",
"expression",
"by",
"executing",
"a",
"callback",
"function",
"for",
"each",
"of",
"the",
"conditions",
"that",
"are",
"included",
"in",
"this",
"object",
".",
"Useful",
"for",
"compiling",
"the",... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L579-L587 |
211,270 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression.iterateParts | public function iterateParts(callable $callable)
{
$parts = [];
foreach ($this->_conditions as $k => $c) {
$key =& $k;
$part = $callable($c, $key);
if ($part !== null) {
$parts[$key] = $part;
}
}
$this->_conditions = $pa... | php | public function iterateParts(callable $callable)
{
$parts = [];
foreach ($this->_conditions as $k => $c) {
$key =& $k;
$part = $callable($c, $key);
if ($part !== null) {
$parts[$key] = $part;
}
}
$this->_conditions = $pa... | [
"public",
"function",
"iterateParts",
"(",
"callable",
"$",
"callable",
")",
"{",
"$",
"parts",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"_conditions",
"as",
"$",
"k",
"=>",
"$",
"c",
")",
"{",
"$",
"key",
"=",
"&",
"$",
"k",
";",
... | Executes a callable function for each of the parts that form this expression.
The callable function is required to return a value with which the currently
visited part will be replaced. If the callable function returns null then
the part will be discarded completely from this expression.
The callback function will re... | [
"Executes",
"a",
"callable",
"function",
"for",
"each",
"of",
"the",
"parts",
"that",
"form",
"this",
"expression",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L604-L617 |
211,271 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression.isCallable | public function isCallable($c)
{
if (is_string($c)) {
return false;
}
if (is_object($c) && is_callable($c)) {
return true;
}
return is_array($c) && isset($c[0]) && is_object($c[0]) && is_callable($c);
} | php | public function isCallable($c)
{
if (is_string($c)) {
return false;
}
if (is_object($c) && is_callable($c)) {
return true;
}
return is_array($c) && isset($c[0]) && is_object($c[0]) && is_callable($c);
} | [
"public",
"function",
"isCallable",
"(",
"$",
"c",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"c",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_object",
"(",
"$",
"c",
")",
"&&",
"is_callable",
"(",
"$",
"c",
")",
")",
"{",
"retu... | Check whether or not a callable is acceptable.
We don't accept ['class', 'method'] style callbacks,
as they often contain user input and arrays of strings
are easy to sneak in.
@param callable $c The callable to check.
@return bool Valid callable. | [
"Check",
"whether",
"or",
"not",
"a",
"callable",
"is",
"acceptable",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L645-L655 |
211,272 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression._addConditions | protected function _addConditions(array $conditions, array $types)
{
$operators = ['and', 'or', 'xor'];
$typeMap = $this->getTypeMap()->setTypes($types);
foreach ($conditions as $k => $c) {
$numericKey = is_numeric($k);
if ($this->isCallable($c)) {
... | php | protected function _addConditions(array $conditions, array $types)
{
$operators = ['and', 'or', 'xor'];
$typeMap = $this->getTypeMap()->setTypes($types);
foreach ($conditions as $k => $c) {
$numericKey = is_numeric($k);
if ($this->isCallable($c)) {
... | [
"protected",
"function",
"_addConditions",
"(",
"array",
"$",
"conditions",
",",
"array",
"$",
"types",
")",
"{",
"$",
"operators",
"=",
"[",
"'and'",
",",
"'or'",
",",
"'xor'",
"]",
";",
"$",
"typeMap",
"=",
"$",
"this",
"->",
"getTypeMap",
"(",
")",
... | Auxiliary function used for decomposing a nested array of conditions and build
a tree structure inside this object to represent the full SQL expression.
String conditions are stored directly in the conditions, while any other
representation is wrapped around an adequate instance or of this class.
@param array $conditi... | [
"Auxiliary",
"function",
"used",
"for",
"decomposing",
"a",
"nested",
"array",
"of",
"conditions",
"and",
"build",
"a",
"tree",
"structure",
"inside",
"this",
"object",
"to",
"represent",
"the",
"full",
"SQL",
"expression",
".",
"String",
"conditions",
"are",
... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L684-L734 |
211,273 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression._parseCondition | protected function _parseCondition($field, $value)
{
$operator = '=';
$expression = $field;
$parts = explode(' ', trim($field), 2);
if (count($parts) > 1) {
list($expression, $operator) = $parts;
}
$type = $this->getTypeMap()->type($expression);
... | php | protected function _parseCondition($field, $value)
{
$operator = '=';
$expression = $field;
$parts = explode(' ', trim($field), 2);
if (count($parts) > 1) {
list($expression, $operator) = $parts;
}
$type = $this->getTypeMap()->type($expression);
... | [
"protected",
"function",
"_parseCondition",
"(",
"$",
"field",
",",
"$",
"value",
")",
"{",
"$",
"operator",
"=",
"'='",
";",
"$",
"expression",
"=",
"$",
"field",
";",
"$",
"parts",
"=",
"explode",
"(",
"' '",
",",
"trim",
"(",
"$",
"field",
")",
... | Parses a string conditions by trying to extract the operator inside it if any
and finally returning either an adequate QueryExpression object or a plain
string representation of the condition. This function is responsible for
generating the placeholders and replacing the values by them, while storing
the value elsewher... | [
"Parses",
"a",
"string",
"conditions",
"by",
"trying",
"to",
"extract",
"the",
"operator",
"inside",
"it",
"if",
"any",
"and",
"finally",
"returning",
"either",
"an",
"adequate",
"QueryExpression",
"object",
"or",
"a",
"plain",
"string",
"representation",
"of",
... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L748-L799 |
211,274 | cakephp/cakephp | src/Database/Expression/QueryExpression.php | QueryExpression._calculateType | protected function _calculateType($field)
{
$field = $field instanceof IdentifierExpression ? $field->getIdentifier() : $field;
if (is_string($field)) {
return $this->getTypeMap()->type($field);
}
return null;
} | php | protected function _calculateType($field)
{
$field = $field instanceof IdentifierExpression ? $field->getIdentifier() : $field;
if (is_string($field)) {
return $this->getTypeMap()->type($field);
}
return null;
} | [
"protected",
"function",
"_calculateType",
"(",
"$",
"field",
")",
"{",
"$",
"field",
"=",
"$",
"field",
"instanceof",
"IdentifierExpression",
"?",
"$",
"field",
"->",
"getIdentifier",
"(",
")",
":",
"$",
"field",
";",
"if",
"(",
"is_string",
"(",
"$",
"... | Returns the type name for the passed field if it was stored in the typeMap
@param string|\Cake\Database\Expression\IdentifierExpression $field The field name to get a type for.
@return string|null The computed type or null, if the type is unknown. | [
"Returns",
"the",
"type",
"name",
"for",
"the",
"passed",
"field",
"if",
"it",
"was",
"stored",
"in",
"the",
"typeMap"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/QueryExpression.php#L807-L815 |
211,275 | cakephp/cakephp | src/Http/Client/FormData.php | FormData.boundary | public function boundary()
{
if ($this->_boundary) {
return $this->_boundary;
}
$this->_boundary = md5(uniqid(time()));
return $this->_boundary;
} | php | public function boundary()
{
if ($this->_boundary) {
return $this->_boundary;
}
$this->_boundary = md5(uniqid(time()));
return $this->_boundary;
} | [
"public",
"function",
"boundary",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_boundary",
")",
"{",
"return",
"$",
"this",
"->",
"_boundary",
";",
"}",
"$",
"this",
"->",
"_boundary",
"=",
"md5",
"(",
"uniqid",
"(",
"time",
"(",
")",
")",
")",
... | Get the boundary marker
@return string | [
"Get",
"the",
"boundary",
"marker"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/FormData.php#L62-L70 |
211,276 | cakephp/cakephp | src/Http/Client/FormData.php | FormData.add | public function add($name, $value = null)
{
if (is_array($value)) {
$this->addRecursive($name, $value);
} elseif (is_resource($value)) {
$this->addFile($name, $value);
} elseif ($name instanceof FormDataPart && $value === null) {
$this->_hasComplexPart = t... | php | public function add($name, $value = null)
{
if (is_array($value)) {
$this->addRecursive($name, $value);
} elseif (is_resource($value)) {
$this->addFile($name, $value);
} elseif ($name instanceof FormDataPart && $value === null) {
$this->_hasComplexPart = t... | [
"public",
"function",
"add",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"this",
"->",
"addRecursive",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"}",
"elseif",
"... | Add a new part to the data.
The value for a part can be a string, array, int,
float, filehandle, or object implementing __toString()
If the $value is an array, multiple parts will be added.
Files will be read from their current position and saved in memory.
@param string|\Cake\Http\Client\FormData $name The name of ... | [
"Add",
"a",
"new",
"part",
"to",
"the",
"data",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/FormData.php#L98-L112 |
211,277 | cakephp/cakephp | src/Http/Client/FormData.php | FormData.addMany | public function addMany(array $data)
{
foreach ($data as $name => $value) {
$this->add($name, $value);
}
return $this;
} | php | public function addMany(array $data)
{
foreach ($data as $name => $value) {
$this->add($name, $value);
}
return $this;
} | [
"public",
"function",
"addMany",
"(",
"array",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"add",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"}",
"return",
"$",
"th... | Add multiple parts at once.
Iterates the parameter and adds all the key/values.
@param array $data Array of data to add.
@return $this | [
"Add",
"multiple",
"parts",
"at",
"once",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/FormData.php#L122-L129 |
211,278 | cakephp/cakephp | src/Http/Client/FormData.php | FormData.addRecursive | public function addRecursive($name, $value)
{
foreach ($value as $key => $value) {
$key = $name . '[' . $key . ']';
$this->add($key, $value);
}
} | php | public function addRecursive($name, $value)
{
foreach ($value as $key => $value) {
$key = $name . '[' . $key . ']';
$this->add($key, $value);
}
} | [
"public",
"function",
"addRecursive",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"value",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"key",
"=",
"$",
"name",
".",
"'['",
".",
"$",
"key",
".",
"']'",
";",
"$",
... | Recursively add data.
@param string $name The name to use.
@param mixed $value The value to add.
@return void | [
"Recursively",
"add",
"data",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/FormData.php#L177-L183 |
211,279 | cakephp/cakephp | src/Shell/Helper/TableHelper.php | TableHelper._calculateWidths | protected function _calculateWidths($rows)
{
$widths = [];
foreach ($rows as $line) {
foreach (array_values($line) as $k => $v) {
$columnLength = $this->_cellWidth($v);
if ($columnLength >= (isset($widths[$k]) ? $widths[$k] : 0)) {
$wid... | php | protected function _calculateWidths($rows)
{
$widths = [];
foreach ($rows as $line) {
foreach (array_values($line) as $k => $v) {
$columnLength = $this->_cellWidth($v);
if ($columnLength >= (isset($widths[$k]) ? $widths[$k] : 0)) {
$wid... | [
"protected",
"function",
"_calculateWidths",
"(",
"$",
"rows",
")",
"{",
"$",
"widths",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"line",
")",
"{",
"foreach",
"(",
"array_values",
"(",
"$",
"line",
")",
"as",
"$",
"k",
"=>",
"$",
... | Calculate the column widths
@param array $rows The rows on which the columns width will be calculated on.
@return array | [
"Calculate",
"the",
"column",
"widths"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/Helper/TableHelper.php#L42-L55 |
211,280 | cakephp/cakephp | src/Shell/Helper/TableHelper.php | TableHelper._cellWidth | protected function _cellWidth($text)
{
if (strpos($text, '<') === false && strpos($text, '>') === false) {
return mb_strwidth($text);
}
$styles = array_keys($this->_io->styles());
$tags = implode('|', $styles);
$text = preg_replace('#</?(?:' . $tags . ')>#', '', $... | php | protected function _cellWidth($text)
{
if (strpos($text, '<') === false && strpos($text, '>') === false) {
return mb_strwidth($text);
}
$styles = array_keys($this->_io->styles());
$tags = implode('|', $styles);
$text = preg_replace('#</?(?:' . $tags . ')>#', '', $... | [
"protected",
"function",
"_cellWidth",
"(",
"$",
"text",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"text",
",",
"'<'",
")",
"===",
"false",
"&&",
"strpos",
"(",
"$",
"text",
",",
"'>'",
")",
"===",
"false",
")",
"{",
"return",
"mb_strwidth",
"(",
"$... | Get the width of a cell exclusive of style tags.
@param string $text The text to calculate a width for.
@return int The width of the textual content in visible characters. | [
"Get",
"the",
"width",
"of",
"a",
"cell",
"exclusive",
"of",
"style",
"tags",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/Helper/TableHelper.php#L63-L73 |
211,281 | cakephp/cakephp | src/Shell/Helper/TableHelper.php | TableHelper._rowSeparator | protected function _rowSeparator($widths)
{
$out = '';
foreach ($widths as $column) {
$out .= '+' . str_repeat('-', $column + 2);
}
$out .= '+';
$this->_io->out($out);
} | php | protected function _rowSeparator($widths)
{
$out = '';
foreach ($widths as $column) {
$out .= '+' . str_repeat('-', $column + 2);
}
$out .= '+';
$this->_io->out($out);
} | [
"protected",
"function",
"_rowSeparator",
"(",
"$",
"widths",
")",
"{",
"$",
"out",
"=",
"''",
";",
"foreach",
"(",
"$",
"widths",
"as",
"$",
"column",
")",
"{",
"$",
"out",
".=",
"'+'",
".",
"str_repeat",
"(",
"'-'",
",",
"$",
"column",
"+",
"2",
... | Output a row separator.
@param array $widths The widths of each column to output.
@return void | [
"Output",
"a",
"row",
"separator",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/Helper/TableHelper.php#L81-L89 |
211,282 | cakephp/cakephp | src/Shell/Helper/TableHelper.php | TableHelper._render | protected function _render(array $row, $widths, $options = [])
{
if (count($row) === 0) {
return;
}
$out = '';
foreach (array_values($row) as $i => $column) {
$pad = $widths[$i] - $this->_cellWidth($column);
if (!empty($options['style'])) {
... | php | protected function _render(array $row, $widths, $options = [])
{
if (count($row) === 0) {
return;
}
$out = '';
foreach (array_values($row) as $i => $column) {
$pad = $widths[$i] - $this->_cellWidth($column);
if (!empty($options['style'])) {
... | [
"protected",
"function",
"_render",
"(",
"array",
"$",
"row",
",",
"$",
"widths",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"row",
")",
"===",
"0",
")",
"{",
"return",
";",
"}",
"$",
"out",
"=",
"''",
";",
"f... | Output a row.
@param array $row The row to output.
@param array $widths The widths of each column to output.
@param array $options Options to be passed.
@return void | [
"Output",
"a",
"row",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/Helper/TableHelper.php#L99-L115 |
211,283 | cakephp/cakephp | src/Shell/Helper/TableHelper.php | TableHelper.output | public function output($rows)
{
if (!is_array($rows) || count($rows) === 0) {
return;
}
$config = $this->getConfig();
$widths = $this->_calculateWidths($rows);
$this->_rowSeparator($widths);
if ($config['headers'] === true) {
$this->_render(a... | php | public function output($rows)
{
if (!is_array($rows) || count($rows) === 0) {
return;
}
$config = $this->getConfig();
$widths = $this->_calculateWidths($rows);
$this->_rowSeparator($widths);
if ($config['headers'] === true) {
$this->_render(a... | [
"public",
"function",
"output",
"(",
"$",
"rows",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"rows",
")",
"||",
"count",
"(",
"$",
"rows",
")",
"===",
"0",
")",
"{",
"return",
";",
"}",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"... | Output a table.
Data will be output based on the order of the values
in the array. The keys will not be used to align data.
@param array $rows The data to render out.
@return void | [
"Output",
"a",
"table",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/Helper/TableHelper.php#L126-L154 |
211,284 | cakephp/cakephp | src/Event/EventManager.php | EventManager.instance | public static function instance($manager = null)
{
if ($manager instanceof EventManager) {
static::$_generalManager = $manager;
}
if (empty(static::$_generalManager)) {
static::$_generalManager = new static();
}
static::$_generalManager->_isGlobal = t... | php | public static function instance($manager = null)
{
if ($manager instanceof EventManager) {
static::$_generalManager = $manager;
}
if (empty(static::$_generalManager)) {
static::$_generalManager = new static();
}
static::$_generalManager->_isGlobal = t... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"manager",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"manager",
"instanceof",
"EventManager",
")",
"{",
"static",
"::",
"$",
"_generalManager",
"=",
"$",
"manager",
";",
"}",
"if",
"(",
"empty",
"(",
"... | Returns the globally available instance of a Cake\Event\EventManager
this is used for dispatching events attached from outside the scope
other managers were created. Usually for creating hook systems or inter-class
communication
If called with the first parameter, it will be set as the globally available instance
@pa... | [
"Returns",
"the",
"globally",
"available",
"instance",
"of",
"a",
"Cake",
"\\",
"Event",
"\\",
"EventManager",
"this",
"is",
"used",
"for",
"dispatching",
"events",
"attached",
"from",
"outside",
"the",
"scope",
"other",
"managers",
"were",
"created",
".",
"Us... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Event/EventManager.php#L81-L93 |
211,285 | cakephp/cakephp | src/Event/EventManager.php | EventManager.attach | public function attach($callable, $eventKey = null, array $options = [])
{
deprecationWarning('EventManager::attach() is deprecated. Use EventManager::on() instead.');
if ($eventKey === null) {
$this->on($callable);
return;
}
if ($options) {
$this... | php | public function attach($callable, $eventKey = null, array $options = [])
{
deprecationWarning('EventManager::attach() is deprecated. Use EventManager::on() instead.');
if ($eventKey === null) {
$this->on($callable);
return;
}
if ($options) {
$this... | [
"public",
"function",
"attach",
"(",
"$",
"callable",
",",
"$",
"eventKey",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"deprecationWarning",
"(",
"'EventManager::attach() is deprecated. Use EventManager::on() instead.'",
")",
";",
"if",
"(... | Adds a new listener to an event.
@param callable|\Cake\Event\EventListenerInterface $callable PHP valid callback type or instance of Cake\Event\EventListenerInterface to be called
when the event named with $eventKey is triggered. If a Cake\Event\EventListenerInterface instance is passed, then the `implementedEvents`
m... | [
"Adds",
"a",
"new",
"listener",
"to",
"an",
"event",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Event/EventManager.php#L115-L129 |
211,286 | cakephp/cakephp | src/Event/EventManager.php | EventManager._attachSubscriber | protected function _attachSubscriber(EventListenerInterface $subscriber)
{
foreach ((array)$subscriber->implementedEvents() as $eventKey => $function) {
$options = [];
$method = $function;
if (is_array($function) && isset($function['callable'])) {
list($me... | php | protected function _attachSubscriber(EventListenerInterface $subscriber)
{
foreach ((array)$subscriber->implementedEvents() as $eventKey => $function) {
$options = [];
$method = $function;
if (is_array($function) && isset($function['callable'])) {
list($me... | [
"protected",
"function",
"_attachSubscriber",
"(",
"EventListenerInterface",
"$",
"subscriber",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"subscriber",
"->",
"implementedEvents",
"(",
")",
"as",
"$",
"eventKey",
"=>",
"$",
"function",
")",
"{",
"$",
... | Auxiliary function to attach all implemented callbacks of a Cake\Event\EventListenerInterface class instance
as individual methods on this manager
@param \Cake\Event\EventListenerInterface $subscriber Event listener.
@return void | [
"Auxiliary",
"function",
"to",
"attach",
"all",
"implemented",
"callbacks",
"of",
"a",
"Cake",
"\\",
"Event",
"\\",
"EventListenerInterface",
"class",
"instance",
"as",
"individual",
"methods",
"on",
"this",
"manager"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Event/EventManager.php#L170-L189 |
211,287 | cakephp/cakephp | src/Event/EventManager.php | EventManager._extractCallable | protected function _extractCallable($function, $object)
{
$method = $function['callable'];
$options = $function;
unset($options['callable']);
if (is_string($method)) {
$method = [$object, $method];
}
return [$method, $options];
} | php | protected function _extractCallable($function, $object)
{
$method = $function['callable'];
$options = $function;
unset($options['callable']);
if (is_string($method)) {
$method = [$object, $method];
}
return [$method, $options];
} | [
"protected",
"function",
"_extractCallable",
"(",
"$",
"function",
",",
"$",
"object",
")",
"{",
"$",
"method",
"=",
"$",
"function",
"[",
"'callable'",
"]",
";",
"$",
"options",
"=",
"$",
"function",
";",
"unset",
"(",
"$",
"options",
"[",
"'callable'",... | Auxiliary function to extract and return a PHP callback type out of the callable definition
from the return value of the `implementedEvents` method on a Cake\Event\EventListenerInterface
@param array $function the array taken from a handler definition for an event
@param \Cake\Event\EventListenerInterface $object The ... | [
"Auxiliary",
"function",
"to",
"extract",
"and",
"return",
"a",
"PHP",
"callback",
"type",
"out",
"of",
"the",
"callable",
"definition",
"from",
"the",
"return",
"value",
"of",
"the",
"implementedEvents",
"method",
"on",
"a",
"Cake",
"\\",
"Event",
"\\",
"Ev... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Event/EventManager.php#L199-L209 |
211,288 | cakephp/cakephp | src/Event/EventManager.php | EventManager.detach | public function detach($callable, $eventKey = null)
{
deprecationWarning('EventManager::detach() is deprecated. Use EventManager::off() instead.');
if ($eventKey === null) {
$this->off($callable);
return;
}
$this->off($eventKey, $callable);
} | php | public function detach($callable, $eventKey = null)
{
deprecationWarning('EventManager::detach() is deprecated. Use EventManager::off() instead.');
if ($eventKey === null) {
$this->off($callable);
return;
}
$this->off($eventKey, $callable);
} | [
"public",
"function",
"detach",
"(",
"$",
"callable",
",",
"$",
"eventKey",
"=",
"null",
")",
"{",
"deprecationWarning",
"(",
"'EventManager::detach() is deprecated. Use EventManager::off() instead.'",
")",
";",
"if",
"(",
"$",
"eventKey",
"===",
"null",
")",
"{",
... | Removes a listener from the active listeners.
@param callable|\Cake\Event\EventListenerInterface $callable any valid PHP callback type or an instance of EventListenerInterface
@param string|null $eventKey The event unique identifier name with which the callback has been associated
@return void
@deprecated 3.0.0 Use of... | [
"Removes",
"a",
"listener",
"from",
"the",
"active",
"listeners",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Event/EventManager.php#L219-L228 |
211,289 | cakephp/cakephp | src/Event/EventManager.php | EventManager._detachSubscriber | protected function _detachSubscriber(EventListenerInterface $subscriber, $eventKey = null)
{
$events = (array)$subscriber->implementedEvents();
if (!empty($eventKey) && empty($events[$eventKey])) {
return;
}
if (!empty($eventKey)) {
$events = [$eventKey => $ev... | php | protected function _detachSubscriber(EventListenerInterface $subscriber, $eventKey = null)
{
$events = (array)$subscriber->implementedEvents();
if (!empty($eventKey) && empty($events[$eventKey])) {
return;
}
if (!empty($eventKey)) {
$events = [$eventKey => $ev... | [
"protected",
"function",
"_detachSubscriber",
"(",
"EventListenerInterface",
"$",
"subscriber",
",",
"$",
"eventKey",
"=",
"null",
")",
"{",
"$",
"events",
"=",
"(",
"array",
")",
"$",
"subscriber",
"->",
"implementedEvents",
"(",
")",
";",
"if",
"(",
"!",
... | Auxiliary function to help detach all listeners provided by an object implementing EventListenerInterface
@param \Cake\Event\EventListenerInterface $subscriber the subscriber to be detached
@param string|null $eventKey optional event key name to unsubscribe the listener from
@return void | [
"Auxiliary",
"function",
"to",
"help",
"detach",
"all",
"listeners",
"provided",
"by",
"an",
"object",
"implementing",
"EventListenerInterface"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Event/EventManager.php#L279-L301 |
211,290 | cakephp/cakephp | src/Event/EventManager.php | EventManager.matchingListeners | public function matchingListeners($eventKeyPattern)
{
$matchPattern = '/' . preg_quote($eventKeyPattern, '/') . '/';
$matches = array_intersect_key(
$this->_listeners,
array_flip(
preg_grep($matchPattern, array_keys($this->_listeners), 0)
)
... | php | public function matchingListeners($eventKeyPattern)
{
$matchPattern = '/' . preg_quote($eventKeyPattern, '/') . '/';
$matches = array_intersect_key(
$this->_listeners,
array_flip(
preg_grep($matchPattern, array_keys($this->_listeners), 0)
)
... | [
"public",
"function",
"matchingListeners",
"(",
"$",
"eventKeyPattern",
")",
"{",
"$",
"matchPattern",
"=",
"'/'",
".",
"preg_quote",
"(",
"$",
"eventKeyPattern",
",",
"'/'",
")",
".",
"'/'",
";",
"$",
"matches",
"=",
"array_intersect_key",
"(",
"$",
"this",... | Returns the listeners matching a specified pattern
@param string $eventKeyPattern Pattern to match.
@return array | [
"Returns",
"the",
"listeners",
"matching",
"a",
"specified",
"pattern"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Event/EventManager.php#L407-L418 |
211,291 | cakephp/cakephp | src/Event/EventManager.php | EventManager.addEventToList | public function addEventToList(Event $event)
{
if ($this->_eventList) {
$this->_eventList->add($event);
}
return $this;
} | php | public function addEventToList(Event $event)
{
if ($this->_eventList) {
$this->_eventList->add($event);
}
return $this;
} | [
"public",
"function",
"addEventToList",
"(",
"Event",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_eventList",
")",
"{",
"$",
"this",
"->",
"_eventList",
"->",
"add",
"(",
"$",
"event",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Adds an event to the list if the event list object is present.
@param \Cake\Event\Event $event An event to add to the list.
@return $this | [
"Adds",
"an",
"event",
"to",
"the",
"list",
"if",
"the",
"event",
"list",
"object",
"is",
"present",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Event/EventManager.php#L436-L443 |
211,292 | cakephp/cakephp | src/Event/EventManager.php | EventManager.setEventList | public function setEventList(EventList $eventList)
{
$this->_eventList = $eventList;
$this->_trackEvents = true;
return $this;
} | php | public function setEventList(EventList $eventList)
{
$this->_eventList = $eventList;
$this->_trackEvents = true;
return $this;
} | [
"public",
"function",
"setEventList",
"(",
"EventList",
"$",
"eventList",
")",
"{",
"$",
"this",
"->",
"_eventList",
"=",
"$",
"eventList",
";",
"$",
"this",
"->",
"_trackEvents",
"=",
"true",
";",
"return",
"$",
"this",
";",
"}"
] | Enables the listing of dispatched events.
@param \Cake\Event\EventList $eventList The event list object to use.
@return $this | [
"Enables",
"the",
"listing",
"of",
"dispatched",
"events",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Event/EventManager.php#L474-L480 |
211,293 | cakephp/cakephp | src/I18n/Number.php | Number.precision | public static function precision($value, $precision = 3, array $options = [])
{
$formatter = static::formatter(['precision' => $precision, 'places' => $precision] + $options);
return $formatter->format($value);
} | php | public static function precision($value, $precision = 3, array $options = [])
{
$formatter = static::formatter(['precision' => $precision, 'places' => $precision] + $options);
return $formatter->format($value);
} | [
"public",
"static",
"function",
"precision",
"(",
"$",
"value",
",",
"$",
"precision",
"=",
"3",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"formatter",
"=",
"static",
"::",
"formatter",
"(",
"[",
"'precision'",
"=>",
"$",
"precision",... | Formats a number with a level of precision.
Options:
- `locale`: The locale name to use for formatting the number, e.g. fr_FR
@param float $value A floating point number.
@param int $precision The precision of the returned number.
@param array $options Additional options
@return string Formatted float.
@link https:/... | [
"Formats",
"a",
"number",
"with",
"a",
"level",
"of",
"precision",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/I18n/Number.php#L70-L75 |
211,294 | cakephp/cakephp | src/I18n/Number.php | Number.parseFloat | public static function parseFloat($value, array $options = [])
{
$formatter = static::formatter($options);
return (float)$formatter->parse($value, NumberFormatter::TYPE_DOUBLE);
} | php | public static function parseFloat($value, array $options = [])
{
$formatter = static::formatter($options);
return (float)$formatter->parse($value, NumberFormatter::TYPE_DOUBLE);
} | [
"public",
"static",
"function",
"parseFloat",
"(",
"$",
"value",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"formatter",
"=",
"static",
"::",
"formatter",
"(",
"$",
"options",
")",
";",
"return",
"(",
"float",
")",
"$",
"formatter",
... | Parse a localized numeric string and transform it in a float point
Options:
- `locale` - The locale name to use for parsing the number, e.g. fr_FR
- `type` - The formatter type to construct, set it to `currency` if you need to parse
numbers representing money.
@param string $value A numeric string.
@param array $opt... | [
"Parse",
"a",
"localized",
"numeric",
"string",
"and",
"transform",
"it",
"in",
"a",
"float",
"point"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/I18n/Number.php#L161-L166 |
211,295 | cakephp/cakephp | src/I18n/Number.php | Number.formatter | public static function formatter($options = [])
{
$locale = isset($options['locale']) ? $options['locale'] : ini_get('intl.default_locale');
if (!$locale) {
$locale = static::DEFAULT_LOCALE;
}
$type = NumberFormatter::DECIMAL;
if (!empty($options['type'])) {
... | php | public static function formatter($options = [])
{
$locale = isset($options['locale']) ? $options['locale'] : ini_get('intl.default_locale');
if (!$locale) {
$locale = static::DEFAULT_LOCALE;
}
$type = NumberFormatter::DECIMAL;
if (!empty($options['type'])) {
... | [
"public",
"static",
"function",
"formatter",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"locale",
"=",
"isset",
"(",
"$",
"options",
"[",
"'locale'",
"]",
")",
"?",
"$",
"options",
"[",
"'locale'",
"]",
":",
"ini_get",
"(",
"'intl.default_local... | Returns a formatter object that can be reused for similar formatting task
under the same locale and options. This is often a speedier alternative to
using other methods in this class as only one formatter object needs to be
constructed.
### Options
- `locale` - The locale name to use for formatting the number, e.g. f... | [
"Returns",
"a",
"formatter",
"object",
"that",
"can",
"be",
"reused",
"for",
"similar",
"formatting",
"task",
"under",
"the",
"same",
"locale",
"and",
"options",
".",
"This",
"is",
"often",
"a",
"speedier",
"alternative",
"to",
"using",
"other",
"methods",
"... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/I18n/Number.php#L287-L322 |
211,296 | cakephp/cakephp | src/I18n/Number.php | Number.config | public static function config($locale, $type = NumberFormatter::DECIMAL, array $options = [])
{
static::$_formatters[$locale][$type] = static::_setAttributes(
new NumberFormatter($locale, $type),
$options
);
} | php | public static function config($locale, $type = NumberFormatter::DECIMAL, array $options = [])
{
static::$_formatters[$locale][$type] = static::_setAttributes(
new NumberFormatter($locale, $type),
$options
);
} | [
"public",
"static",
"function",
"config",
"(",
"$",
"locale",
",",
"$",
"type",
"=",
"NumberFormatter",
"::",
"DECIMAL",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"static",
"::",
"$",
"_formatters",
"[",
"$",
"locale",
"]",
"[",
"$",
"ty... | Configure formatters.
@param string $locale The locale name to use for formatting the number, e.g. fr_FR
@param int $type The formatter type to construct. Defaults to NumberFormatter::DECIMAL.
@param array $options See Number::formatter() for possible options.
@return void | [
"Configure",
"formatters",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/I18n/Number.php#L332-L338 |
211,297 | cakephp/cakephp | src/Controller/Component/SecurityComponent.php | SecurityComponent.startup | public function startup(Event $event)
{
/** @var \Cake\Controller\Controller $controller */
$controller = $event->getSubject();
$request = $controller->request;
$this->session = $request->getSession();
$this->_action = $request->getParam('action');
$hasData = ($reques... | php | public function startup(Event $event)
{
/** @var \Cake\Controller\Controller $controller */
$controller = $event->getSubject();
$request = $controller->request;
$this->session = $request->getSession();
$this->_action = $request->getParam('action');
$hasData = ($reques... | [
"public",
"function",
"startup",
"(",
"Event",
"$",
"event",
")",
"{",
"/** @var \\Cake\\Controller\\Controller $controller */",
"$",
"controller",
"=",
"$",
"event",
"->",
"getSubject",
"(",
")",
";",
"$",
"request",
"=",
"$",
"controller",
"->",
"request",
";"... | Component startup. All security checking happens here.
@param \Cake\Event\Event $event An Event instance
@return mixed | [
"Component",
"startup",
".",
"All",
"security",
"checking",
"happens",
"here",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/SecurityComponent.php#L101-L135 |
211,298 | cakephp/cakephp | src/Controller/Component/SecurityComponent.php | SecurityComponent._throwException | protected function _throwException($exception = null)
{
if ($exception !== null) {
if (!Configure::read('debug') && $exception instanceof SecurityException) {
$exception->setReason($exception->getMessage());
$exception->setMessage(self::DEFAULT_EXCEPTION_MESSAGE);... | php | protected function _throwException($exception = null)
{
if ($exception !== null) {
if (!Configure::read('debug') && $exception instanceof SecurityException) {
$exception->setReason($exception->getMessage());
$exception->setMessage(self::DEFAULT_EXCEPTION_MESSAGE);... | [
"protected",
"function",
"_throwException",
"(",
"$",
"exception",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"exception",
"!==",
"null",
")",
"{",
"if",
"(",
"!",
"Configure",
"::",
"read",
"(",
"'debug'",
")",
"&&",
"$",
"exception",
"instanceof",
"Securit... | Check debug status and throw an Exception based on the existing one
@param \Cake\Controller\Exception\SecurityException|null $exception Additional debug info describing the cause
@throws \Cake\Http\Exception\BadRequestException
@return void | [
"Check",
"debug",
"status",
"and",
"throw",
"an",
"Exception",
"based",
"on",
"the",
"existing",
"one"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/SecurityComponent.php#L205-L215 |
211,299 | cakephp/cakephp | src/Controller/Component/SecurityComponent.php | SecurityComponent._secureRequired | protected function _secureRequired(Controller $controller)
{
if (is_array($this->_config['requireSecure']) &&
!empty($this->_config['requireSecure'])
) {
$requireSecure = $this->_config['requireSecure'];
if (in_array($this->_action, $requireSecure) || $requireSec... | php | protected function _secureRequired(Controller $controller)
{
if (is_array($this->_config['requireSecure']) &&
!empty($this->_config['requireSecure'])
) {
$requireSecure = $this->_config['requireSecure'];
if (in_array($this->_action, $requireSecure) || $requireSec... | [
"protected",
"function",
"_secureRequired",
"(",
"Controller",
"$",
"controller",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"_config",
"[",
"'requireSecure'",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"_config",
"[",
"'requireSec... | Check if access requires secure connection
@param \Cake\Controller\Controller $controller Instantiating controller
@return bool true if secure connection required | [
"Check",
"if",
"access",
"requires",
"secure",
"connection"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/SecurityComponent.php#L238-L255 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.