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,300 | cakephp/cakephp | src/Controller/Component/SecurityComponent.php | SecurityComponent._authRequired | protected function _authRequired(Controller $controller)
{
$request = $controller->getRequest();
if (is_array($this->_config['requireAuth']) &&
!empty($this->_config['requireAuth']) &&
$request->getData()
) {
deprecationWarning('SecurityComponent::requireA... | php | protected function _authRequired(Controller $controller)
{
$request = $controller->getRequest();
if (is_array($this->_config['requireAuth']) &&
!empty($this->_config['requireAuth']) &&
$request->getData()
) {
deprecationWarning('SecurityComponent::requireA... | [
"protected",
"function",
"_authRequired",
"(",
"Controller",
"$",
"controller",
")",
"{",
"$",
"request",
"=",
"$",
"controller",
"->",
"getRequest",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"_config",
"[",
"'requireAuth'",
"]",
")",
... | Check if authentication is required
@param \Cake\Controller\Controller $controller Instantiating controller
@return bool true if authentication required
@deprecated 3.2.2 This feature is confusing and not useful. | [
"Check",
"if",
"authentication",
"is",
"required"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/SecurityComponent.php#L264-L311 |
211,301 | cakephp/cakephp | src/Controller/Component/SecurityComponent.php | SecurityComponent._validatePost | protected function _validatePost(Controller $controller)
{
$token = $this->_validToken($controller);
$hashParts = $this->_hashParts($controller);
$check = hash_hmac('sha1', implode('', $hashParts), Security::getSalt());
if (hash_equals($check, $token)) {
return true;
... | php | protected function _validatePost(Controller $controller)
{
$token = $this->_validToken($controller);
$hashParts = $this->_hashParts($controller);
$check = hash_hmac('sha1', implode('', $hashParts), Security::getSalt());
if (hash_equals($check, $token)) {
return true;
... | [
"protected",
"function",
"_validatePost",
"(",
"Controller",
"$",
"controller",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"_validToken",
"(",
"$",
"controller",
")",
";",
"$",
"hashParts",
"=",
"$",
"this",
"->",
"_hashParts",
"(",
"$",
"controller",... | Validate submitted form
@param \Cake\Controller\Controller $controller Instantiating controller
@throws \Cake\Controller\Exception\AuthSecurityException
@return bool true if submitted form is valid | [
"Validate",
"submitted",
"form"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/SecurityComponent.php#L320-L336 |
211,302 | cakephp/cakephp | src/Controller/Component/SecurityComponent.php | SecurityComponent._hashParts | protected function _hashParts(Controller $controller)
{
$request = $controller->getRequest();
// Start the session to ensure we get the correct session id.
$session = $request->getSession();
$session->start();
$data = $request->getData();
$fieldList = $this->_fields... | php | protected function _hashParts(Controller $controller)
{
$request = $controller->getRequest();
// Start the session to ensure we get the correct session id.
$session = $request->getSession();
$session->start();
$data = $request->getData();
$fieldList = $this->_fields... | [
"protected",
"function",
"_hashParts",
"(",
"Controller",
"$",
"controller",
")",
"{",
"$",
"request",
"=",
"$",
"controller",
"->",
"getRequest",
"(",
")",
";",
"// Start the session to ensure we get the correct session id.",
"$",
"session",
"=",
"$",
"request",
"-... | Return hash parts for the Token generation
@param \Cake\Controller\Controller $controller Instantiating controller
@return array | [
"Return",
"hash",
"parts",
"for",
"the",
"Token",
"generation"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/SecurityComponent.php#L380-L398 |
211,303 | cakephp/cakephp | src/Controller/Component/SecurityComponent.php | SecurityComponent._fieldsList | protected function _fieldsList(array $check)
{
$locked = '';
$token = urldecode($check['_Token']['fields']);
$unlocked = $this->_unlocked($check);
if (strpos($token, ':')) {
list($token, $locked) = explode(':', $token, 2);
}
unset($check['_Token'], $check... | php | protected function _fieldsList(array $check)
{
$locked = '';
$token = urldecode($check['_Token']['fields']);
$unlocked = $this->_unlocked($check);
if (strpos($token, ':')) {
list($token, $locked) = explode(':', $token, 2);
}
unset($check['_Token'], $check... | [
"protected",
"function",
"_fieldsList",
"(",
"array",
"$",
"check",
")",
"{",
"$",
"locked",
"=",
"''",
";",
"$",
"token",
"=",
"urldecode",
"(",
"$",
"check",
"[",
"'_Token'",
"]",
"[",
"'fields'",
"]",
")",
";",
"$",
"unlocked",
"=",
"$",
"this",
... | Return the fields list for the hash calculation
@param array $check Data array
@return array | [
"Return",
"the",
"fields",
"list",
"for",
"the",
"hash",
"calculation"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/SecurityComponent.php#L406-L467 |
211,304 | cakephp/cakephp | src/Controller/Component/SecurityComponent.php | SecurityComponent._sortedUnlocked | protected function _sortedUnlocked($data)
{
$unlocked = $this->_unlocked($data);
$unlocked = explode('|', $unlocked);
sort($unlocked, SORT_STRING);
return implode('|', $unlocked);
} | php | protected function _sortedUnlocked($data)
{
$unlocked = $this->_unlocked($data);
$unlocked = explode('|', $unlocked);
sort($unlocked, SORT_STRING);
return implode('|', $unlocked);
} | [
"protected",
"function",
"_sortedUnlocked",
"(",
"$",
"data",
")",
"{",
"$",
"unlocked",
"=",
"$",
"this",
"->",
"_unlocked",
"(",
"$",
"data",
")",
";",
"$",
"unlocked",
"=",
"explode",
"(",
"'|'",
",",
"$",
"unlocked",
")",
";",
"sort",
"(",
"$",
... | Get the sorted unlocked string
@param array $data Data array
@return string | [
"Get",
"the",
"sorted",
"unlocked",
"string"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/SecurityComponent.php#L486-L493 |
211,305 | cakephp/cakephp | src/Controller/Component/SecurityComponent.php | SecurityComponent._debugPostTokenNotMatching | protected function _debugPostTokenNotMatching(Controller $controller, $hashParts)
{
$messages = [];
$expectedParts = json_decode(urldecode($controller->getRequest()->getData('_Token.debug')), true);
if (!is_array($expectedParts) || count($expectedParts) !== 3) {
return 'Invalid s... | php | protected function _debugPostTokenNotMatching(Controller $controller, $hashParts)
{
$messages = [];
$expectedParts = json_decode(urldecode($controller->getRequest()->getData('_Token.debug')), true);
if (!is_array($expectedParts) || count($expectedParts) !== 3) {
return 'Invalid s... | [
"protected",
"function",
"_debugPostTokenNotMatching",
"(",
"Controller",
"$",
"controller",
",",
"$",
"hashParts",
")",
"{",
"$",
"messages",
"=",
"[",
"]",
";",
"$",
"expectedParts",
"=",
"json_decode",
"(",
"urldecode",
"(",
"$",
"controller",
"->",
"getReq... | Create a message for humans to understand why Security token is not matching
@param \Cake\Controller\Controller $controller Instantiating controller
@param array $hashParts Elements used to generate the Token hash
@return string Message explaining why the tokens are not matching | [
"Create",
"a",
"message",
"for",
"humans",
"to",
"understand",
"why",
"Security",
"token",
"is",
"not",
"matching"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/SecurityComponent.php#L502-L542 |
211,306 | cakephp/cakephp | src/Controller/Component/SecurityComponent.php | SecurityComponent._debugCheckFields | protected function _debugCheckFields($dataFields, $expectedFields = [], $intKeyMessage = '', $stringKeyMessage = '', $missingMessage = '')
{
$messages = $this->_matchExistingFields($dataFields, $expectedFields, $intKeyMessage, $stringKeyMessage);
$expectedFieldsMessage = $this->_debugExpectedFields(... | php | protected function _debugCheckFields($dataFields, $expectedFields = [], $intKeyMessage = '', $stringKeyMessage = '', $missingMessage = '')
{
$messages = $this->_matchExistingFields($dataFields, $expectedFields, $intKeyMessage, $stringKeyMessage);
$expectedFieldsMessage = $this->_debugExpectedFields(... | [
"protected",
"function",
"_debugCheckFields",
"(",
"$",
"dataFields",
",",
"$",
"expectedFields",
"=",
"[",
"]",
",",
"$",
"intKeyMessage",
"=",
"''",
",",
"$",
"stringKeyMessage",
"=",
"''",
",",
"$",
"missingMessage",
"=",
"''",
")",
"{",
"$",
"messages"... | Iterates data array to check against expected
@param array $dataFields Fields array, containing the POST data fields
@param array $expectedFields Fields array, containing the expected fields we should have in POST
@param string $intKeyMessage Message string if unexpected found in data fields indexed by int (not protec... | [
"Iterates",
"data",
"array",
"to",
"check",
"against",
"expected"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/SecurityComponent.php#L554-L563 |
211,307 | cakephp/cakephp | src/Controller/Component/SecurityComponent.php | SecurityComponent.generateToken | public function generateToken(ServerRequest $request)
{
if ($request->is('requested')) {
if ($this->session->check('_Token')) {
$request = $request->withParam('_Token', $this->session->read('_Token'));
}
return $request;
}
$token = [
... | php | public function generateToken(ServerRequest $request)
{
if ($request->is('requested')) {
if ($this->session->check('_Token')) {
$request = $request->withParam('_Token', $this->session->read('_Token'));
}
return $request;
}
$token = [
... | [
"public",
"function",
"generateToken",
"(",
"ServerRequest",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"is",
"(",
"'requested'",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"session",
"->",
"check",
"(",
"'_Token'",
")",
")",
"{",
"... | Manually add form tampering prevention token information into the provided
request object.
@param \Cake\Http\ServerRequest $request The request object to add into.
@return \Cake\Http\ServerRequest The modified request. | [
"Manually",
"add",
"form",
"tampering",
"prevention",
"token",
"information",
"into",
"the",
"provided",
"request",
"object",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/SecurityComponent.php#L572-L592 |
211,308 | cakephp/cakephp | src/Controller/Component/SecurityComponent.php | SecurityComponent._callback | protected function _callback(Controller $controller, $method, $params = [])
{
if (!is_callable([$controller, $method])) {
throw new BadRequestException('The request has been black-holed');
}
return call_user_func_array([&$controller, $method], empty($params) ? null : $params);
... | php | protected function _callback(Controller $controller, $method, $params = [])
{
if (!is_callable([$controller, $method])) {
throw new BadRequestException('The request has been black-holed');
}
return call_user_func_array([&$controller, $method], empty($params) ? null : $params);
... | [
"protected",
"function",
"_callback",
"(",
"Controller",
"$",
"controller",
",",
"$",
"method",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"[",
"$",
"controller",
",",
"$",
"method",
"]",
")",
")",
"{",
"throw",
... | Calls a controller callback method
@param \Cake\Controller\Controller $controller Instantiating controller
@param string $method Method to execute
@param array $params Parameters to send to method
@return mixed Controller callback method's response
@throws \Cake\Http\Exception\BadRequestException When a the blackholeC... | [
"Calls",
"a",
"controller",
"callback",
"method"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/SecurityComponent.php#L603-L610 |
211,309 | cakephp/cakephp | src/Controller/Component/SecurityComponent.php | SecurityComponent._debugExpectedFields | protected function _debugExpectedFields($expectedFields = [], $missingMessage = '')
{
if (count($expectedFields) === 0) {
return null;
}
$expectedFieldNames = [];
foreach ((array)$expectedFields as $key => $expectedField) {
if (is_int($key)) {
... | php | protected function _debugExpectedFields($expectedFields = [], $missingMessage = '')
{
if (count($expectedFields) === 0) {
return null;
}
$expectedFieldNames = [];
foreach ((array)$expectedFields as $key => $expectedField) {
if (is_int($key)) {
... | [
"protected",
"function",
"_debugExpectedFields",
"(",
"$",
"expectedFields",
"=",
"[",
"]",
",",
"$",
"missingMessage",
"=",
"''",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"expectedFields",
")",
"===",
"0",
")",
"{",
"return",
"null",
";",
"}",
"$",
"ex... | Generate debug message for the expected fields
@param array $expectedFields Expected fields
@param string $missingMessage Message template
@return string|null Error message about expected fields | [
"Generate",
"debug",
"message",
"for",
"the",
"expected",
"fields"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/SecurityComponent.php#L651-L667 |
211,310 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest._processPost | protected function _processPost($data)
{
$method = $this->getEnv('REQUEST_METHOD');
$override = false;
if (in_array($method, ['PUT', 'DELETE', 'PATCH']) &&
strpos($this->contentType(), 'application/x-www-form-urlencoded') === 0
) {
$data = $this->input();
... | php | protected function _processPost($data)
{
$method = $this->getEnv('REQUEST_METHOD');
$override = false;
if (in_array($method, ['PUT', 'DELETE', 'PATCH']) &&
strpos($this->contentType(), 'application/x-www-form-urlencoded') === 0
) {
$data = $this->input();
... | [
"protected",
"function",
"_processPost",
"(",
"$",
"data",
")",
"{",
"$",
"method",
"=",
"$",
"this",
"->",
"getEnv",
"(",
"'REQUEST_METHOD'",
")",
";",
"$",
"override",
"=",
"false",
";",
"if",
"(",
"in_array",
"(",
"$",
"method",
",",
"[",
"'PUT'",
... | Sets the REQUEST_METHOD environment variable based on the simulated _method
HTTP override value. The 'ORIGINAL_REQUEST_METHOD' is also preserved, if you
want the read the non-simulated HTTP method the client used.
@param array $data Array of post data.
@return array | [
"Sets",
"the",
"REQUEST_METHOD",
"environment",
"variable",
"based",
"on",
"the",
"simulated",
"_method",
"HTTP",
"override",
"value",
".",
"The",
"ORIGINAL_REQUEST_METHOD",
"is",
"also",
"preserved",
"if",
"you",
"want",
"the",
"read",
"the",
"non",
"-",
"simul... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L382-L409 |
211,311 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest._processGet | protected function _processGet($query, $queryString = '')
{
$unsetUrl = '/' . str_replace(['.', ' '], '_', urldecode($this->url));
unset($query[$unsetUrl], $query[$this->base . $unsetUrl]);
if (strlen($queryString)) {
parse_str($queryString, $queryArgs);
$query += $qu... | php | protected function _processGet($query, $queryString = '')
{
$unsetUrl = '/' . str_replace(['.', ' '], '_', urldecode($this->url));
unset($query[$unsetUrl], $query[$this->base . $unsetUrl]);
if (strlen($queryString)) {
parse_str($queryString, $queryArgs);
$query += $qu... | [
"protected",
"function",
"_processGet",
"(",
"$",
"query",
",",
"$",
"queryString",
"=",
"''",
")",
"{",
"$",
"unsetUrl",
"=",
"'/'",
".",
"str_replace",
"(",
"[",
"'.'",
",",
"' '",
"]",
",",
"'_'",
",",
"urldecode",
"(",
"$",
"this",
"->",
"url",
... | Process the GET parameters and move things into the object.
@param array $query The array to which the parsed keys/values are being added.
@param string $queryString A query string from the URL if provided
@return array An array containing the parsed query string as keys/values. | [
"Process",
"the",
"GET",
"parameters",
"and",
"move",
"things",
"into",
"the",
"object",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L418-L428 |
211,312 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest._processFiles | protected function _processFiles($post, $files)
{
if (!is_array($files)) {
return $post;
}
$fileData = [];
foreach ($files as $key => $value) {
if ($value instanceof UploadedFileInterface) {
$fileData[$key] = $value;
continue;
... | php | protected function _processFiles($post, $files)
{
if (!is_array($files)) {
return $post;
}
$fileData = [];
foreach ($files as $key => $value) {
if ($value instanceof UploadedFileInterface) {
$fileData[$key] = $value;
continue;
... | [
"protected",
"function",
"_processFiles",
"(",
"$",
"post",
",",
"$",
"files",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"files",
")",
")",
"{",
"return",
"$",
"post",
";",
"}",
"$",
"fileData",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"fil... | Process uploaded files and move things onto the post data.
@param array $post Post data to merge files onto.
@param array $files Uploaded files to merge in.
@return array merged post + file data. | [
"Process",
"uploaded",
"files",
"and",
"move",
"things",
"onto",
"the",
"post",
"data",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L437-L479 |
211,313 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.session | public function session(Session $session = null)
{
deprecationWarning(
'ServerRequest::session() is deprecated. ' .
'Use getSession() instead. The setter part will be removed.'
);
if ($session === null) {
return $this->session;
}
return $... | php | public function session(Session $session = null)
{
deprecationWarning(
'ServerRequest::session() is deprecated. ' .
'Use getSession() instead. The setter part will be removed.'
);
if ($session === null) {
return $this->session;
}
return $... | [
"public",
"function",
"session",
"(",
"Session",
"$",
"session",
"=",
"null",
")",
"{",
"deprecationWarning",
"(",
"'ServerRequest::session() is deprecated. '",
".",
"'Use getSession() instead. The setter part will be removed.'",
")",
";",
"if",
"(",
"$",
"session",
"==="... | Returns the instance of the Session object for this request
If a session object is passed as first argument it will be set as
the session to use for this request
@deprecated 3.5.0 Use getSession() instead. The setter part will be removed.
@param \Cake\Http\Session|null $session the session object to use
@return \Cake... | [
"Returns",
"the",
"instance",
"of",
"the",
"Session",
"object",
"for",
"this",
"request"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L566-L578 |
211,314 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.clientIp | public function clientIp()
{
if ($this->trustProxy && $this->getEnv('HTTP_X_FORWARDED_FOR')) {
$addresses = array_map('trim', explode(',', $this->getEnv('HTTP_X_FORWARDED_FOR')));
$trusted = (count($this->trustedProxies) > 0);
$n = count($addresses);
if ($tru... | php | public function clientIp()
{
if ($this->trustProxy && $this->getEnv('HTTP_X_FORWARDED_FOR')) {
$addresses = array_map('trim', explode(',', $this->getEnv('HTTP_X_FORWARDED_FOR')));
$trusted = (count($this->trustedProxies) > 0);
$n = count($addresses);
if ($tru... | [
"public",
"function",
"clientIp",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"trustProxy",
"&&",
"$",
"this",
"->",
"getEnv",
"(",
"'HTTP_X_FORWARDED_FOR'",
")",
")",
"{",
"$",
"addresses",
"=",
"array_map",
"(",
"'trim'",
",",
"explode",
"(",
"','",
... | Get the IP the client is using, or says they are using.
@return string The client IP. | [
"Get",
"the",
"IP",
"the",
"client",
"is",
"using",
"or",
"says",
"they",
"are",
"using",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L585-L613 |
211,315 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.referer | public function referer($local = false)
{
$ref = $this->getEnv('HTTP_REFERER');
$base = Configure::read('App.fullBaseUrl') . $this->webroot;
if (!empty($ref) && !empty($base)) {
if ($local && strpos($ref, $base) === 0) {
$ref = substr($ref, strlen($base));
... | php | public function referer($local = false)
{
$ref = $this->getEnv('HTTP_REFERER');
$base = Configure::read('App.fullBaseUrl') . $this->webroot;
if (!empty($ref) && !empty($base)) {
if ($local && strpos($ref, $base) === 0) {
$ref = substr($ref, strlen($base));
... | [
"public",
"function",
"referer",
"(",
"$",
"local",
"=",
"false",
")",
"{",
"$",
"ref",
"=",
"$",
"this",
"->",
"getEnv",
"(",
"'HTTP_REFERER'",
")",
";",
"$",
"base",
"=",
"Configure",
"::",
"read",
"(",
"'App.fullBaseUrl'",
")",
".",
"$",
"this",
"... | Returns the referer that referred this request.
@param bool $local Attempt to return a local address.
Local addresses do not contain hostnames.
@return string The referring address for this request. | [
"Returns",
"the",
"referer",
"that",
"referred",
"this",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L644-L667 |
211,316 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.& | public function &__get($name)
{
if (isset($this->deprecatedProperties[$name])) {
$method = $this->deprecatedProperties[$name]['get'];
deprecationWarning(
"Accessing `{$name}` as a property will be removed in 4.0.0. " .
"Use request->{$method} instead."... | php | public function &__get($name)
{
if (isset($this->deprecatedProperties[$name])) {
$method = $this->deprecatedProperties[$name]['get'];
deprecationWarning(
"Accessing `{$name}` as a property will be removed in 4.0.0. " .
"Use request->{$method} instead."... | [
"public",
"function",
"&",
"__get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"deprecatedProperties",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"method",
"=",
"$",
"this",
"->",
"deprecatedProperties",
"[",
"$",
"name",... | Magic get method allows access to parsed routing parameters directly on the object.
Allows access to `$this->params['controller']` via `$this->controller`
@param string $name The property being accessed.
@return mixed Either the value of the parameter or null.
@deprecated 3.4.0 Accessing routing parameters through __... | [
"Magic",
"get",
"method",
"allows",
"access",
"to",
"parsed",
"routing",
"parameters",
"directly",
"on",
"the",
"object",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L723-L747 |
211,317 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.is | public function is($type, ...$args)
{
if (is_array($type)) {
$result = array_map([$this, 'is'], $type);
return count(array_filter($result)) > 0;
}
$type = strtolower($type);
if (!isset(static::$_detectors[$type])) {
return false;
}
... | php | public function is($type, ...$args)
{
if (is_array($type)) {
$result = array_map([$this, 'is'], $type);
return count(array_filter($result)) > 0;
}
$type = strtolower($type);
if (!isset(static::$_detectors[$type])) {
return false;
}
... | [
"public",
"function",
"is",
"(",
"$",
"type",
",",
"...",
"$",
"args",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"type",
")",
")",
"{",
"$",
"result",
"=",
"array_map",
"(",
"[",
"$",
"this",
",",
"'is'",
"]",
",",
"$",
"type",
")",
";",
"re... | Check whether or not a Request is a certain type.
Uses the built in detection rules as well as additional rules
defined with Cake\Http\ServerRequest::addDetector(). Any detector can be called
as `is($type)` or `is$Type()`.
@param string|array $type The type of request you want to check. If an array
this method will r... | [
"Check",
"whether",
"or",
"not",
"a",
"Request",
"is",
"a",
"certain",
"type",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L790-L810 |
211,318 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest._headerDetector | protected function _headerDetector($detect)
{
foreach ($detect['header'] as $header => $value) {
$header = $this->getEnv('http_' . $header);
if ($header !== null) {
if (!is_string($value) && !is_bool($value) && is_callable($value)) {
return call_us... | php | protected function _headerDetector($detect)
{
foreach ($detect['header'] as $header => $value) {
$header = $this->getEnv('http_' . $header);
if ($header !== null) {
if (!is_string($value) && !is_bool($value) && is_callable($value)) {
return call_us... | [
"protected",
"function",
"_headerDetector",
"(",
"$",
"detect",
")",
"{",
"foreach",
"(",
"$",
"detect",
"[",
"'header'",
"]",
"as",
"$",
"header",
"=>",
"$",
"value",
")",
"{",
"$",
"header",
"=",
"$",
"this",
"->",
"getEnv",
"(",
"'http_'",
".",
"$... | Detects if a specific header is present.
@param array $detect Detector options array.
@return bool Whether or not the request is the type you are checking. | [
"Detects",
"if",
"a",
"specific",
"header",
"is",
"present",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L877-L891 |
211,319 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest._paramDetector | protected function _paramDetector($detect)
{
$key = $detect['param'];
if (isset($detect['value'])) {
$value = $detect['value'];
return isset($this->params[$key]) ? $this->params[$key] == $value : false;
}
if (isset($detect['options'])) {
return is... | php | protected function _paramDetector($detect)
{
$key = $detect['param'];
if (isset($detect['value'])) {
$value = $detect['value'];
return isset($this->params[$key]) ? $this->params[$key] == $value : false;
}
if (isset($detect['options'])) {
return is... | [
"protected",
"function",
"_paramDetector",
"(",
"$",
"detect",
")",
"{",
"$",
"key",
"=",
"$",
"detect",
"[",
"'param'",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"detect",
"[",
"'value'",
"]",
")",
")",
"{",
"$",
"value",
"=",
"$",
"detect",
"[",
... | Detects if a specific request parameter is present.
@param array $detect Detector options array.
@return bool Whether or not the request is the type you are checking. | [
"Detects",
"if",
"a",
"specific",
"request",
"parameter",
"is",
"present",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L899-L912 |
211,320 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest._environmentDetector | protected function _environmentDetector($detect)
{
if (isset($detect['env'])) {
if (isset($detect['value'])) {
return $this->getEnv($detect['env']) == $detect['value'];
}
if (isset($detect['pattern'])) {
return (bool)preg_match($detect['pat... | php | protected function _environmentDetector($detect)
{
if (isset($detect['env'])) {
if (isset($detect['value'])) {
return $this->getEnv($detect['env']) == $detect['value'];
}
if (isset($detect['pattern'])) {
return (bool)preg_match($detect['pat... | [
"protected",
"function",
"_environmentDetector",
"(",
"$",
"detect",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"detect",
"[",
"'env'",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"detect",
"[",
"'value'",
"]",
")",
")",
"{",
"return",
"$",
"thi... | Detects if a specific environment variable is present.
@param array $detect Detector options array.
@return bool Whether or not the request is the type you are checking. | [
"Detects",
"if",
"a",
"specific",
"environment",
"variable",
"is",
"present",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L920-L937 |
211,321 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.isAll | public function isAll(array $types)
{
$result = array_filter(array_map([$this, 'is'], $types));
return count($result) === count($types);
} | php | public function isAll(array $types)
{
$result = array_filter(array_map([$this, 'is'], $types));
return count($result) === count($types);
} | [
"public",
"function",
"isAll",
"(",
"array",
"$",
"types",
")",
"{",
"$",
"result",
"=",
"array_filter",
"(",
"array_map",
"(",
"[",
"$",
"this",
",",
"'is'",
"]",
",",
"$",
"types",
")",
")",
";",
"return",
"count",
"(",
"$",
"result",
")",
"===",... | Check that a request matches all the given types.
Allows you to test multiple types and union the results.
See Request::is() for how to add additional types and the
built-in types.
@param array $types The types to check.
@return bool Success.
@see \Cake\Http\ServerRequest::is() | [
"Check",
"that",
"a",
"request",
"matches",
"all",
"the",
"given",
"types",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L950-L955 |
211,322 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.addDetector | public static function addDetector($name, $callable)
{
$name = strtolower($name);
if (is_callable($callable)) {
static::$_detectors[$name] = $callable;
return;
}
if (isset(static::$_detectors[$name], $callable['options'])) {
$callable = Hash::merg... | php | public static function addDetector($name, $callable)
{
$name = strtolower($name);
if (is_callable($callable)) {
static::$_detectors[$name] = $callable;
return;
}
if (isset(static::$_detectors[$name], $callable['options'])) {
$callable = Hash::merg... | [
"public",
"static",
"function",
"addDetector",
"(",
"$",
"name",
",",
"$",
"callable",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"if",
"(",
"is_callable",
"(",
"$",
"callable",
")",
")",
"{",
"static",
"::",
"$",
"_detecto... | Add a new detector to the list of detectors that a request can use.
There are several different formats and types of detectors that can be set.
### Callback detectors
Callback detectors allow you to provide a callable to handle the check.
The callback will receive the request object as its only parameter.
```
addDet... | [
"Add",
"a",
"new",
"detector",
"to",
"the",
"list",
"of",
"detectors",
"that",
"a",
"request",
"can",
"use",
".",
"There",
"are",
"several",
"different",
"formats",
"and",
"types",
"of",
"detectors",
"that",
"can",
"be",
"set",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L1011-L1023 |
211,323 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.addPaths | public function addPaths(array $paths)
{
deprecationWarning(
'ServerRequest::addPaths() is deprecated. ' .
'Use `withAttribute($key, $value)` instead.'
);
foreach (['webroot', 'here', 'base'] as $element) {
if (isset($paths[$element])) {
$t... | php | public function addPaths(array $paths)
{
deprecationWarning(
'ServerRequest::addPaths() is deprecated. ' .
'Use `withAttribute($key, $value)` instead.'
);
foreach (['webroot', 'here', 'base'] as $element) {
if (isset($paths[$element])) {
$t... | [
"public",
"function",
"addPaths",
"(",
"array",
"$",
"paths",
")",
"{",
"deprecationWarning",
"(",
"'ServerRequest::addPaths() is deprecated. '",
".",
"'Use `withAttribute($key, $value)` instead.'",
")",
";",
"foreach",
"(",
"[",
"'webroot'",
",",
"'here'",
",",
"'base'... | Add paths to the requests' paths vars. This will overwrite any existing paths.
Provides an easy way to modify, here, webroot and base.
@param array $paths Array of paths to merge in
@return $this The current object, you can chain this method.
@deprecated 3.6.0 Mutating a request in place is deprecated. Use `withAttrib... | [
"Add",
"paths",
"to",
"the",
"requests",
"paths",
"vars",
".",
"This",
"will",
"overwrite",
"any",
"existing",
"paths",
".",
"Provides",
"an",
"easy",
"way",
"to",
"modify",
"here",
"webroot",
"and",
"base",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L1053-L1066 |
211,324 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.here | public function here($base = true)
{
deprecationWarning(
'ServerRequest::here() will be removed in 4.0.0. You should use getRequestTarget() instead.'
);
$url = $this->here;
if (!empty($this->query)) {
$url .= '?' . http_build_query($this->query, null, '&');
... | php | public function here($base = true)
{
deprecationWarning(
'ServerRequest::here() will be removed in 4.0.0. You should use getRequestTarget() instead.'
);
$url = $this->here;
if (!empty($this->query)) {
$url .= '?' . http_build_query($this->query, null, '&');
... | [
"public",
"function",
"here",
"(",
"$",
"base",
"=",
"true",
")",
"{",
"deprecationWarning",
"(",
"'ServerRequest::here() will be removed in 4.0.0. You should use getRequestTarget() instead.'",
")",
";",
"$",
"url",
"=",
"$",
"this",
"->",
"here",
";",
"if",
"(",
"!... | Get the value of the current requests URL. Will include the query string arguments.
@param bool $base Include the base path, set to false to trim the base path off.
@return string The current request URL including query string args.
@deprecated 3.4.0 This method will be removed in 4.0.0. You should use getRequestTarge... | [
"Get",
"the",
"value",
"of",
"the",
"current",
"requests",
"URL",
".",
"Will",
"include",
"the",
"query",
"string",
"arguments",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L1075-L1090 |
211,325 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.normalizeHeaderName | protected function normalizeHeaderName($name)
{
$name = str_replace('-', '_', strtoupper($name));
if (!in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'])) {
$name = 'HTTP_' . $name;
}
return $name;
} | php | protected function normalizeHeaderName($name)
{
$name = str_replace('-', '_', strtoupper($name));
if (!in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'])) {
$name = 'HTTP_' . $name;
}
return $name;
} | [
"protected",
"function",
"normalizeHeaderName",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"str_replace",
"(",
"'-'",
",",
"'_'",
",",
"strtoupper",
"(",
"$",
"name",
")",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"name",
",",
"[",
"'CONTENT... | Normalize a header name into the SERVER version.
@param string $name The header name.
@return string The normalized header name. | [
"Normalize",
"a",
"header",
"name",
"into",
"the",
"SERVER",
"version",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L1098-L1106 |
211,326 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.header | public function header($name)
{
deprecationWarning(
'ServerRequest::header() is deprecated. ' .
'The automatic fallback to env() will be removed in 4.0.0, see getHeader()'
);
$name = $this->normalizeHeaderName($name);
return $this->getEnv($name);
} | php | public function header($name)
{
deprecationWarning(
'ServerRequest::header() is deprecated. ' .
'The automatic fallback to env() will be removed in 4.0.0, see getHeader()'
);
$name = $this->normalizeHeaderName($name);
return $this->getEnv($name);
} | [
"public",
"function",
"header",
"(",
"$",
"name",
")",
"{",
"deprecationWarning",
"(",
"'ServerRequest::header() is deprecated. '",
".",
"'The automatic fallback to env() will be removed in 4.0.0, see getHeader()'",
")",
";",
"$",
"name",
"=",
"$",
"this",
"->",
"normalizeH... | Read an HTTP header from the Request information.
If the header is not defined in the request, this method
will fallback to reading data from $_SERVER and $_ENV.
This fallback behavior is deprecated, and will be removed in 4.0.0
@param string $name Name of the header you want.
@return string|null Either null on no he... | [
"Read",
"an",
"HTTP",
"header",
"from",
"the",
"Request",
"information",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L1119-L1129 |
211,327 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.getHeaders | public function getHeaders()
{
$headers = [];
foreach ($this->_environment as $key => $value) {
$name = null;
if (strpos($key, 'HTTP_') === 0) {
$name = substr($key, 5);
}
if (strpos($key, 'CONTENT_') === 0) {
$name = $k... | php | public function getHeaders()
{
$headers = [];
foreach ($this->_environment as $key => $value) {
$name = null;
if (strpos($key, 'HTTP_') === 0) {
$name = substr($key, 5);
}
if (strpos($key, 'CONTENT_') === 0) {
$name = $k... | [
"public",
"function",
"getHeaders",
"(",
")",
"{",
"$",
"headers",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"_environment",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"name",
"=",
"null",
";",
"if",
"(",
"strpos",
"(",
"$"... | Get all headers in the request.
Returns an associative array where the header names are
the keys and the values are a list of header values.
While header names are not case-sensitive, getHeaders() will normalize
the headers.
@return array An associative array of headers and their values.
@link http://www.php-fig.org... | [
"Get",
"all",
"headers",
"in",
"the",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L1143-L1162 |
211,328 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.hasHeader | public function hasHeader($name)
{
$name = $this->normalizeHeaderName($name);
return isset($this->_environment[$name]);
} | php | public function hasHeader($name)
{
$name = $this->normalizeHeaderName($name);
return isset($this->_environment[$name]);
} | [
"public",
"function",
"hasHeader",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"normalizeHeaderName",
"(",
"$",
"name",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"_environment",
"[",
"$",
"name",
"]",
")",
";",
"}"
] | Check if a header is set in the request.
@param string $name The header you want to get (case-insensitive)
@return bool Whether or not the header is defined.
@link http://www.php-fig.org/psr/psr-7/ This method is part of the PSR-7 server request interface. | [
"Check",
"if",
"a",
"header",
"is",
"set",
"in",
"the",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L1171-L1176 |
211,329 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.getHeader | public function getHeader($name)
{
$name = $this->normalizeHeaderName($name);
if (isset($this->_environment[$name])) {
return (array)$this->_environment[$name];
}
return [];
} | php | public function getHeader($name)
{
$name = $this->normalizeHeaderName($name);
if (isset($this->_environment[$name])) {
return (array)$this->_environment[$name];
}
return [];
} | [
"public",
"function",
"getHeader",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"normalizeHeaderName",
"(",
"$",
"name",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_environment",
"[",
"$",
"name",
"]",
")",
")",
"{",... | Get a single header from the request.
Return the header value as an array. If the header
is not present an empty array will be returned.
@param string $name The header you want to get (case-insensitive)
@return array An associative array of headers and their values.
If the header doesn't exist, an empty array will be... | [
"Get",
"a",
"single",
"header",
"from",
"the",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L1189-L1197 |
211,330 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.withMethod | public function withMethod($method)
{
$new = clone $this;
if (!is_string($method) ||
!preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)
) {
throw new InvalidArgumentException(sprintf(
'Unsupported HTTP method "%s" provided',
$meth... | php | public function withMethod($method)
{
$new = clone $this;
if (!is_string($method) ||
!preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)
) {
throw new InvalidArgumentException(sprintf(
'Unsupported HTTP method "%s" provided',
$meth... | [
"public",
"function",
"withMethod",
"(",
"$",
"method",
")",
"{",
"$",
"new",
"=",
"clone",
"$",
"this",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"method",
")",
"||",
"!",
"preg_match",
"(",
"'/^[!#$%&\\'*+.^_`\\|~0-9a-z-]+$/i'",
",",
"$",
"method",
"... | Update the request method and get a new instance.
@param string $method The HTTP method to use.
@return static A new instance with the updated method.
@link http://www.php-fig.org/psr/psr-7/ This method is part of the PSR-7 server request interface. | [
"Update",
"the",
"request",
"method",
"and",
"get",
"a",
"new",
"instance",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L1313-L1328 |
211,331 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.accepts | public function accepts($type = null)
{
$raw = $this->parseAccept();
$accept = [];
foreach ($raw as $types) {
$accept = array_merge($accept, $types);
}
if ($type === null) {
return $accept;
}
return in_array($type, $accept);
} | php | public function accepts($type = null)
{
$raw = $this->parseAccept();
$accept = [];
foreach ($raw as $types) {
$accept = array_merge($accept, $types);
}
if ($type === null) {
return $accept;
}
return in_array($type, $accept);
} | [
"public",
"function",
"accepts",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"raw",
"=",
"$",
"this",
"->",
"parseAccept",
"(",
")",
";",
"$",
"accept",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"raw",
"as",
"$",
"types",
")",
"{",
"$",
"accep... | Find out which content types the client accepts or check if they accept a
particular type of content.
#### Get all types:
```
$this->request->accepts();
```
#### Check for a single type:
```
$this->request->accepts('application/json');
```
This method will order the returned content types by the preference values ... | [
"Find",
"out",
"which",
"content",
"types",
"the",
"client",
"accepts",
"or",
"check",
"if",
"they",
"accept",
"a",
"particular",
"type",
"of",
"content",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L1467-L1479 |
211,332 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.acceptLanguage | public function acceptLanguage($language = null)
{
$raw = $this->_parseAcceptWithQualifier($this->getHeaderLine('Accept-Language'));
$accept = [];
foreach ($raw as $languages) {
foreach ($languages as &$lang) {
if (strpos($lang, '_')) {
$lang =... | php | public function acceptLanguage($language = null)
{
$raw = $this->_parseAcceptWithQualifier($this->getHeaderLine('Accept-Language'));
$accept = [];
foreach ($raw as $languages) {
foreach ($languages as &$lang) {
if (strpos($lang, '_')) {
$lang =... | [
"public",
"function",
"acceptLanguage",
"(",
"$",
"language",
"=",
"null",
")",
"{",
"$",
"raw",
"=",
"$",
"this",
"->",
"_parseAcceptWithQualifier",
"(",
"$",
"this",
"->",
"getHeaderLine",
"(",
"'Accept-Language'",
")",
")",
";",
"$",
"accept",
"=",
"[",... | Get the languages accepted by the client, or check if a specific language is accepted.
Get the list of accepted languages:
``` \Cake\Http\ServerRequest::acceptLanguage(); ```
Check if a specific language is accepted:
``` \Cake\Http\ServerRequest::acceptLanguage('es-es'); ```
@param string|null $language The langua... | [
"Get",
"the",
"languages",
"accepted",
"by",
"the",
"client",
"or",
"check",
"if",
"a",
"specific",
"language",
"is",
"accepted",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L1509-L1527 |
211,333 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.getQuery | public function getQuery($name = null, $default = null)
{
if ($name === null) {
return $this->query;
}
return Hash::get($this->query, $name, $default);
} | php | public function getQuery($name = null, $default = null)
{
if ($name === null) {
return $this->query;
}
return Hash::get($this->query, $name, $default);
} | [
"public",
"function",
"getQuery",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"query",
";",
"}",
"return",
"Hash",
"::",
"get",
"(",
"$",... | Read a specific query value or dotted path.
Developers are encouraged to use getQueryParams() when possible as it is PSR-7 compliant, and this method
is not.
### PSR-7 Alternative
```
$value = Hash::get($request->getQueryParams(), 'Post.id', null);
```
@param string|null $name The name or dotted path to the query p... | [
"Read",
"a",
"specific",
"query",
"value",
"or",
"dotted",
"path",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L1609-L1616 |
211,334 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.cookie | public function cookie($key)
{
deprecationWarning(
'ServerRequest::cookie() is deprecated. ' .
'Use getCookie() instead.'
);
if (isset($this->cookies[$key])) {
return $this->cookies[$key];
}
return null;
} | php | public function cookie($key)
{
deprecationWarning(
'ServerRequest::cookie() is deprecated. ' .
'Use getCookie() instead.'
);
if (isset($this->cookies[$key])) {
return $this->cookies[$key];
}
return null;
} | [
"public",
"function",
"cookie",
"(",
"$",
"key",
")",
"{",
"deprecationWarning",
"(",
"'ServerRequest::cookie() is deprecated. '",
".",
"'Use getCookie() instead.'",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"cookies",
"[",
"$",
"key",
"]",
")",
")... | Read cookie data from the request's cookie data.
@param string $key The key you want to read.
@return null|string Either the cookie value, or null if the value doesn't exist.
@deprecated 3.4.0 Use getCookie() instead. | [
"Read",
"cookie",
"data",
"from",
"the",
"request",
"s",
"cookie",
"data",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L1767-L1779 |
211,335 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.withCookieCollection | public function withCookieCollection(CookieCollection $cookies)
{
$new = clone $this;
$values = [];
foreach ($cookies as $cookie) {
$values[$cookie->getName()] = $cookie->getValue();
}
$new->cookies = $values;
return $new;
} | php | public function withCookieCollection(CookieCollection $cookies)
{
$new = clone $this;
$values = [];
foreach ($cookies as $cookie) {
$values[$cookie->getName()] = $cookie->getValue();
}
$new->cookies = $values;
return $new;
} | [
"public",
"function",
"withCookieCollection",
"(",
"CookieCollection",
"$",
"cookies",
")",
"{",
"$",
"new",
"=",
"clone",
"$",
"this",
";",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"cookies",
"as",
"$",
"cookie",
")",
"{",
"$",
"values"... | Replace the cookies in the request with those contained in
the provided CookieCollection.
@param \Cake\Http\Cookie\CookieCollection $cookies The cookie collection
@return static | [
"Replace",
"the",
"cookies",
"in",
"the",
"request",
"with",
"those",
"contained",
"in",
"the",
"provided",
"CookieCollection",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L1820-L1830 |
211,336 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.allowMethod | public function allowMethod($methods)
{
$methods = (array)$methods;
foreach ($methods as $method) {
if ($this->is($method)) {
return true;
}
}
$allowed = strtoupper(implode(', ', $methods));
$e = new MethodNotAllowedException();
... | php | public function allowMethod($methods)
{
$methods = (array)$methods;
foreach ($methods as $method) {
if ($this->is($method)) {
return true;
}
}
$allowed = strtoupper(implode(', ', $methods));
$e = new MethodNotAllowedException();
... | [
"public",
"function",
"allowMethod",
"(",
"$",
"methods",
")",
"{",
"$",
"methods",
"=",
"(",
"array",
")",
"$",
"methods",
";",
"foreach",
"(",
"$",
"methods",
"as",
"$",
"method",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"is",
"(",
"$",
"method",
... | Allow only certain HTTP request methods, if the request method does not match
a 405 error will be shown and the required "Allow" response header will be set.
Example:
$this->request->allowMethod('post');
or
$this->request->allowMethod(['post', 'delete']);
If the request would be GET, response header "Allow: POST, DE... | [
"Allow",
"only",
"certain",
"HTTP",
"request",
"methods",
"if",
"the",
"request",
"method",
"does",
"not",
"match",
"a",
"405",
"error",
"will",
"be",
"shown",
"and",
"the",
"required",
"Allow",
"response",
"header",
"will",
"be",
"set",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L2018-L2030 |
211,337 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.withData | public function withData($name, $value)
{
$copy = clone $this;
$copy->data = Hash::insert($copy->data, $name, $value);
return $copy;
} | php | public function withData($name, $value)
{
$copy = clone $this;
$copy->data = Hash::insert($copy->data, $name, $value);
return $copy;
} | [
"public",
"function",
"withData",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"copy",
"=",
"clone",
"$",
"this",
";",
"$",
"copy",
"->",
"data",
"=",
"Hash",
"::",
"insert",
"(",
"$",
"copy",
"->",
"data",
",",
"$",
"name",
",",
"$",
"v... | Update the request with a new request data element.
Returns an updated request object. This method returns
a *new* request object and does not mutate the request in-place.
Use `withParsedBody()` if you need to replace the all request data.
@param string $name The dot separated path to insert $value at.
@param mixed ... | [
"Update",
"the",
"request",
"with",
"a",
"new",
"request",
"data",
"element",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L2082-L2088 |
211,338 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.withoutData | public function withoutData($name)
{
$copy = clone $this;
$copy->data = Hash::remove($copy->data, $name);
return $copy;
} | php | public function withoutData($name)
{
$copy = clone $this;
$copy->data = Hash::remove($copy->data, $name);
return $copy;
} | [
"public",
"function",
"withoutData",
"(",
"$",
"name",
")",
"{",
"$",
"copy",
"=",
"clone",
"$",
"this",
";",
"$",
"copy",
"->",
"data",
"=",
"Hash",
"::",
"remove",
"(",
"$",
"copy",
"->",
"data",
",",
"$",
"name",
")",
";",
"return",
"$",
"copy... | Update the request removing a data element.
Returns an updated request object. This method returns
a *new* request object and does not mutate the request in-place.
@param string $name The dot separated path to remove.
@return static | [
"Update",
"the",
"request",
"removing",
"a",
"data",
"element",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L2099-L2105 |
211,339 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.withParam | public function withParam($name, $value)
{
$copy = clone $this;
$copy->params = Hash::insert($copy->params, $name, $value);
return $copy;
} | php | public function withParam($name, $value)
{
$copy = clone $this;
$copy->params = Hash::insert($copy->params, $name, $value);
return $copy;
} | [
"public",
"function",
"withParam",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"copy",
"=",
"clone",
"$",
"this",
";",
"$",
"copy",
"->",
"params",
"=",
"Hash",
"::",
"insert",
"(",
"$",
"copy",
"->",
"params",
",",
"$",
"name",
",",
"$",... | Update the request with a new routing parameter
Returns an updated request object. This method returns
a *new* request object and does not mutate the request in-place.
@param string $name The dot separated path to insert $value at.
@param mixed $value The value to insert into the the request parameters.
@return stati... | [
"Update",
"the",
"request",
"with",
"a",
"new",
"routing",
"parameter"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L2117-L2123 |
211,340 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.withAttribute | public function withAttribute($name, $value)
{
$new = clone $this;
if (in_array($name, $this->emulatedAttributes, true)) {
$new->{$name} = $value;
} else {
$new->attributes[$name] = $value;
}
return $new;
} | php | public function withAttribute($name, $value)
{
$new = clone $this;
if (in_array($name, $this->emulatedAttributes, true)) {
$new->{$name} = $value;
} else {
$new->attributes[$name] = $value;
}
return $new;
} | [
"public",
"function",
"withAttribute",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"new",
"=",
"clone",
"$",
"this",
";",
"if",
"(",
"in_array",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"emulatedAttributes",
",",
"true",
")",
")",
"{",
"$"... | Return an instance with the specified request attribute.
@param string $name The attribute name.
@param mixed $value The value of the attribute.
@return static | [
"Return",
"an",
"instance",
"with",
"the",
"specified",
"request",
"attribute",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L2144-L2154 |
211,341 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.withoutAttribute | public function withoutAttribute($name)
{
$new = clone $this;
if (in_array($name, $this->emulatedAttributes, true)) {
throw new InvalidArgumentException(
"You cannot unset '$name'. It is a required CakePHP attribute."
);
}
unset($new->attribute... | php | public function withoutAttribute($name)
{
$new = clone $this;
if (in_array($name, $this->emulatedAttributes, true)) {
throw new InvalidArgumentException(
"You cannot unset '$name'. It is a required CakePHP attribute."
);
}
unset($new->attribute... | [
"public",
"function",
"withoutAttribute",
"(",
"$",
"name",
")",
"{",
"$",
"new",
"=",
"clone",
"$",
"this",
";",
"if",
"(",
"in_array",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"emulatedAttributes",
",",
"true",
")",
")",
"{",
"throw",
"new",
"Inva... | Return an instance without the specified request attribute.
@param string $name The attribute name.
@return static
@throws \InvalidArgumentException | [
"Return",
"an",
"instance",
"without",
"the",
"specified",
"request",
"attribute",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L2163-L2174 |
211,342 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.getAttribute | public function getAttribute($name, $default = null)
{
if (in_array($name, $this->emulatedAttributes, true)) {
return $this->{$name};
}
if (array_key_exists($name, $this->attributes)) {
return $this->attributes[$name];
}
return $default;
} | php | public function getAttribute($name, $default = null)
{
if (in_array($name, $this->emulatedAttributes, true)) {
return $this->{$name};
}
if (array_key_exists($name, $this->attributes)) {
return $this->attributes[$name];
}
return $default;
} | [
"public",
"function",
"getAttribute",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"emulatedAttributes",
",",
"true",
")",
")",
"{",
"return",
"$",
"this",
"->",
"{",
... | Read an attribute from the request, or get the default
@param string $name The attribute name.
@param mixed|null $default The default value if the attribute has not been set.
@return mixed | [
"Read",
"an",
"attribute",
"from",
"the",
"request",
"or",
"get",
"the",
"default"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L2183-L2193 |
211,343 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.getAttributes | public function getAttributes()
{
$emulated = [
'params' => $this->params,
'webroot' => $this->webroot,
'base' => $this->base,
'here' => $this->here
];
return $this->attributes + $emulated;
} | php | public function getAttributes()
{
$emulated = [
'params' => $this->params,
'webroot' => $this->webroot,
'base' => $this->base,
'here' => $this->here
];
return $this->attributes + $emulated;
} | [
"public",
"function",
"getAttributes",
"(",
")",
"{",
"$",
"emulated",
"=",
"[",
"'params'",
"=>",
"$",
"this",
"->",
"params",
",",
"'webroot'",
"=>",
"$",
"this",
"->",
"webroot",
",",
"'base'",
"=>",
"$",
"this",
"->",
"base",
",",
"'here'",
"=>",
... | Get all the attributes in the request.
This will include the params, webroot, base, and here attributes that CakePHP
provides.
@return array | [
"Get",
"all",
"the",
"attributes",
"in",
"the",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L2203-L2213 |
211,344 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.getUploadedFile | public function getUploadedFile($path)
{
$file = Hash::get($this->uploadedFiles, $path);
if (!$file instanceof UploadedFile) {
return null;
}
return $file;
} | php | public function getUploadedFile($path)
{
$file = Hash::get($this->uploadedFiles, $path);
if (!$file instanceof UploadedFile) {
return null;
}
return $file;
} | [
"public",
"function",
"getUploadedFile",
"(",
"$",
"path",
")",
"{",
"$",
"file",
"=",
"Hash",
"::",
"get",
"(",
"$",
"this",
"->",
"uploadedFiles",
",",
"$",
"path",
")",
";",
"if",
"(",
"!",
"$",
"file",
"instanceof",
"UploadedFile",
")",
"{",
"ret... | Get the uploaded file from a dotted path.
@param string $path The dot separated path to the file you want.
@return null|\Psr\Http\Message\UploadedFileInterface | [
"Get",
"the",
"uploaded",
"file",
"from",
"a",
"dotted",
"path",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L2221-L2229 |
211,345 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.withUri | public function withUri(UriInterface $uri, $preserveHost = false)
{
$new = clone $this;
$new->uri = $uri;
if ($preserveHost && $this->hasHeader('Host')) {
return $new;
}
$host = $uri->getHost();
if (!$host) {
return $new;
}
if... | php | public function withUri(UriInterface $uri, $preserveHost = false)
{
$new = clone $this;
$new->uri = $uri;
if ($preserveHost && $this->hasHeader('Host')) {
return $new;
}
$host = $uri->getHost();
if (!$host) {
return $new;
}
if... | [
"public",
"function",
"withUri",
"(",
"UriInterface",
"$",
"uri",
",",
"$",
"preserveHost",
"=",
"false",
")",
"{",
"$",
"new",
"=",
"clone",
"$",
"this",
";",
"$",
"new",
"->",
"uri",
"=",
"$",
"uri",
";",
"if",
"(",
"$",
"preserveHost",
"&&",
"$"... | Return an instance with the specified uri
*Warning* Replacing the Uri will not update the `base`, `webroot`,
and `url` attributes.
@param \Psr\Http\Message\UriInterface $uri The new request uri
@param bool $preserveHost Whether or not the host should be retained.
@return static | [
"Return",
"an",
"instance",
"with",
"the",
"specified",
"uri"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L2324-L2343 |
211,346 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.getPath | public function getPath()
{
if ($this->requestTarget === null) {
return $this->uri->getPath();
}
list($path) = explode('?', $this->requestTarget);
return $path;
} | php | public function getPath()
{
if ($this->requestTarget === null) {
return $this->uri->getPath();
}
list($path) = explode('?', $this->requestTarget);
return $path;
} | [
"public",
"function",
"getPath",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"requestTarget",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"uri",
"->",
"getPath",
"(",
")",
";",
"}",
"list",
"(",
"$",
"path",
")",
"=",
"explode",
"(",
"... | Get the path of current request.
@return string
@since 3.6.1 | [
"Get",
"the",
"path",
"of",
"current",
"request",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L2399-L2408 |
211,347 | cakephp/cakephp | src/Http/ServerRequest.php | ServerRequest.offsetGet | public function offsetGet($name)
{
deprecationWarning(
'The ArrayAccess methods will be removed in 4.0.0.' .
'Use getParam(), getData() and getQuery() instead.'
);
if (isset($this->params[$name])) {
return $this->params[$name];
}
if ($name... | php | public function offsetGet($name)
{
deprecationWarning(
'The ArrayAccess methods will be removed in 4.0.0.' .
'Use getParam(), getData() and getQuery() instead.'
);
if (isset($this->params[$name])) {
return $this->params[$name];
}
if ($name... | [
"public",
"function",
"offsetGet",
"(",
"$",
"name",
")",
"{",
"deprecationWarning",
"(",
"'The ArrayAccess methods will be removed in 4.0.0.'",
".",
"'Use getParam(), getData() and getQuery() instead.'",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"params",
"... | Array access read implementation
@param string $name Name of the key being accessed.
@return mixed
@deprecated 3.4.0 The ArrayAccess methods will be removed in 4.0.0. Use getParam(), getData() and getQuery() instead. | [
"Array",
"access",
"read",
"implementation"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/ServerRequest.php#L2417-L2435 |
211,348 | cakephp/cakephp | src/Collection/ExtractTrait.php | ExtractTrait._propertyExtractor | protected function _propertyExtractor($callback)
{
if (!is_string($callback)) {
return $callback;
}
$path = explode('.', $callback);
if (strpos($callback, '{*}') !== false) {
return function ($element) use ($path) {
return $this->_extract($el... | php | protected function _propertyExtractor($callback)
{
if (!is_string($callback)) {
return $callback;
}
$path = explode('.', $callback);
if (strpos($callback, '{*}') !== false) {
return function ($element) use ($path) {
return $this->_extract($el... | [
"protected",
"function",
"_propertyExtractor",
"(",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"callback",
")",
")",
"{",
"return",
"$",
"callback",
";",
"}",
"$",
"path",
"=",
"explode",
"(",
"'.'",
",",
"$",
"callback",
")",
... | Returns a callable that can be used to extract a property or column from
an array or object based on a dot separated path.
@param string|callable $callback A dot separated path of column to follow
so that the final one can be returned or a callable that will take care
of doing that.
@return callable | [
"Returns",
"a",
"callable",
"that",
"can",
"be",
"used",
"to",
"extract",
"a",
"property",
"or",
"column",
"from",
"an",
"array",
"or",
"object",
"based",
"on",
"a",
"dot",
"separated",
"path",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Collection/ExtractTrait.php#L35-L52 |
211,349 | cakephp/cakephp | src/Collection/ExtractTrait.php | ExtractTrait._createMatcherFilter | protected function _createMatcherFilter(array $conditions)
{
$matchers = [];
foreach ($conditions as $property => $value) {
$extractor = $this->_propertyExtractor($property);
$matchers[] = function ($v) use ($extractor, $value) {
return $extractor($v) == $valu... | php | protected function _createMatcherFilter(array $conditions)
{
$matchers = [];
foreach ($conditions as $property => $value) {
$extractor = $this->_propertyExtractor($property);
$matchers[] = function ($v) use ($extractor, $value) {
return $extractor($v) == $valu... | [
"protected",
"function",
"_createMatcherFilter",
"(",
"array",
"$",
"conditions",
")",
"{",
"$",
"matchers",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"conditions",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"$",
"extractor",
"=",
"$",
"this",
... | Returns a callable that receives a value and will return whether or not
it matches certain condition.
@param array $conditions A key-value list of conditions to match where the
key is the property path to get from the current item and the value is the
value to be compared the item with.
@return callable | [
"Returns",
"a",
"callable",
"that",
"receives",
"a",
"value",
"and",
"will",
"return",
"whether",
"or",
"not",
"it",
"matches",
"certain",
"condition",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Collection/ExtractTrait.php#L127-L146 |
211,350 | cakephp/cakephp | src/View/ViewBlock.php | ViewBlock.start | public function start($name, $mode = ViewBlock::OVERRIDE)
{
if (array_key_exists($name, $this->_active)) {
throw new Exception(sprintf("A view block with the name '%s' is already/still open.", $name));
}
$this->_active[$name] = $mode;
ob_start();
} | php | public function start($name, $mode = ViewBlock::OVERRIDE)
{
if (array_key_exists($name, $this->_active)) {
throw new Exception(sprintf("A view block with the name '%s' is already/still open.", $name));
}
$this->_active[$name] = $mode;
ob_start();
} | [
"public",
"function",
"start",
"(",
"$",
"name",
",",
"$",
"mode",
"=",
"ViewBlock",
"::",
"OVERRIDE",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"_active",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"spr... | Start capturing output for a 'block'
Blocks allow you to create slots or blocks of dynamic content in the layout.
view files can implement some or all of a layout's slots.
You can end capturing blocks using View::end(). Blocks can be output
using View::get();
@param string $name The name of the block to capture for.... | [
"Start",
"capturing",
"output",
"for",
"a",
"block"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/ViewBlock.php#L87-L94 |
211,351 | cakephp/cakephp | src/View/ViewBlock.php | ViewBlock.concat | public function concat($name, $value = null, $mode = ViewBlock::APPEND)
{
if ($value === null) {
$this->start($name, $mode);
return;
}
if (!isset($this->_blocks[$name])) {
$this->_blocks[$name] = '';
}
if ($mode === ViewBlock::PREPEND) {
... | php | public function concat($name, $value = null, $mode = ViewBlock::APPEND)
{
if ($value === null) {
$this->start($name, $mode);
return;
}
if (!isset($this->_blocks[$name])) {
$this->_blocks[$name] = '';
}
if ($mode === ViewBlock::PREPEND) {
... | [
"public",
"function",
"concat",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
",",
"$",
"mode",
"=",
"ViewBlock",
"::",
"APPEND",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"start",
"(",
"$",
"name",
",",
... | Concat content to an existing or new block.
Concating to a new block will create the block.
Calling concat() without a value will create a new capturing
block that needs to be finished with View::end(). The content
of the new capturing context will be added to the existing block context.
@param string $name Name of t... | [
"Concat",
"content",
"to",
"an",
"existing",
"or",
"new",
"block",
".",
"Concating",
"to",
"a",
"new",
"block",
"will",
"create",
"the",
"block",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/ViewBlock.php#L138-L154 |
211,352 | cakephp/cakephp | src/Command/VersionCommand.php | VersionCommand.execute | public function execute(Arguments $args, ConsoleIo $io)
{
$io->out(Configure::version());
return static::CODE_SUCCESS;
} | php | public function execute(Arguments $args, ConsoleIo $io)
{
$io->out(Configure::version());
return static::CODE_SUCCESS;
} | [
"public",
"function",
"execute",
"(",
"Arguments",
"$",
"args",
",",
"ConsoleIo",
"$",
"io",
")",
"{",
"$",
"io",
"->",
"out",
"(",
"Configure",
"::",
"version",
"(",
")",
")",
";",
"return",
"static",
"::",
"CODE_SUCCESS",
";",
"}"
] | Print out the version of CakePHP in use.
@param \Cake\Console\Arguments $args The command arguments.
@param \Cake\Console\ConsoleIo $io The console io
@return int | [
"Print",
"out",
"the",
"version",
"of",
"CakePHP",
"in",
"use",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Command/VersionCommand.php#L34-L39 |
211,353 | cakephp/cakephp | src/Mailer/Transport/SmtpTransport.php | SmtpTransport._bufferResponseLines | protected function _bufferResponseLines(array $responseLines)
{
$response = [];
foreach ($responseLines as $responseLine) {
if (preg_match('/^(\d{3})(?:[ -]+(.*))?$/', $responseLine, $match)) {
$response[] = [
'code' => $match[1],
'... | php | protected function _bufferResponseLines(array $responseLines)
{
$response = [];
foreach ($responseLines as $responseLine) {
if (preg_match('/^(\d{3})(?:[ -]+(.*))?$/', $responseLine, $match)) {
$response[] = [
'code' => $match[1],
'... | [
"protected",
"function",
"_bufferResponseLines",
"(",
"array",
"$",
"responseLines",
")",
"{",
"$",
"response",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"responseLines",
"as",
"$",
"responseLine",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^(\\d{3})(?:[ -]+(.*... | Parses and stores the response lines in `'code' => 'message'` format.
@param array $responseLines Response lines to parse.
@return void | [
"Parses",
"and",
"stores",
"the",
"response",
"lines",
"in",
"code",
"=",
">",
"message",
"format",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Mailer/Transport/SmtpTransport.php#L196-L208 |
211,354 | cakephp/cakephp | src/Mailer/Transport/SmtpTransport.php | SmtpTransport._connect | protected function _connect()
{
$this->_generateSocket();
if (!$this->_socket->connect()) {
throw new SocketException('Unable to connect to SMTP server.');
}
$this->_smtpSend(null, '220');
$config = $this->_config;
if (isset($config['client'])) {
... | php | protected function _connect()
{
$this->_generateSocket();
if (!$this->_socket->connect()) {
throw new SocketException('Unable to connect to SMTP server.');
}
$this->_smtpSend(null, '220');
$config = $this->_config;
if (isset($config['client'])) {
... | [
"protected",
"function",
"_connect",
"(",
")",
"{",
"$",
"this",
"->",
"_generateSocket",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_socket",
"->",
"connect",
"(",
")",
")",
"{",
"throw",
"new",
"SocketException",
"(",
"'Unable to connect to SMTP ... | Connect to SMTP Server
@return void
@throws \Cake\Network\Exception\SocketException | [
"Connect",
"to",
"SMTP",
"Server"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Mailer/Transport/SmtpTransport.php#L216-L251 |
211,355 | cakephp/cakephp | src/Mailer/Transport/SmtpTransport.php | SmtpTransport._prepareFromAddress | protected function _prepareFromAddress($email)
{
$from = $email->getReturnPath();
if (empty($from)) {
$from = $email->getFrom();
}
return $from;
} | php | protected function _prepareFromAddress($email)
{
$from = $email->getReturnPath();
if (empty($from)) {
$from = $email->getFrom();
}
return $from;
} | [
"protected",
"function",
"_prepareFromAddress",
"(",
"$",
"email",
")",
"{",
"$",
"from",
"=",
"$",
"email",
"->",
"getReturnPath",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"from",
")",
")",
"{",
"$",
"from",
"=",
"$",
"email",
"->",
"getFrom",
... | Prepares the `from` email address.
@param \Cake\Mailer\Email $email Email instance
@return array | [
"Prepares",
"the",
"from",
"email",
"address",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Mailer/Transport/SmtpTransport.php#L310-L318 |
211,356 | cakephp/cakephp | src/Mailer/Transport/SmtpTransport.php | SmtpTransport._prepareRecipientAddresses | protected function _prepareRecipientAddresses($email)
{
$to = $email->getTo();
$cc = $email->getCc();
$bcc = $email->getBcc();
return array_merge(array_keys($to), array_keys($cc), array_keys($bcc));
} | php | protected function _prepareRecipientAddresses($email)
{
$to = $email->getTo();
$cc = $email->getCc();
$bcc = $email->getBcc();
return array_merge(array_keys($to), array_keys($cc), array_keys($bcc));
} | [
"protected",
"function",
"_prepareRecipientAddresses",
"(",
"$",
"email",
")",
"{",
"$",
"to",
"=",
"$",
"email",
"->",
"getTo",
"(",
")",
";",
"$",
"cc",
"=",
"$",
"email",
"->",
"getCc",
"(",
")",
";",
"$",
"bcc",
"=",
"$",
"email",
"->",
"getBcc... | Prepares the recipient email addresses.
@param \Cake\Mailer\Email $email Email instance
@return array | [
"Prepares",
"the",
"recipient",
"email",
"addresses",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Mailer/Transport/SmtpTransport.php#L326-L333 |
211,357 | cakephp/cakephp | src/Mailer/Transport/SmtpTransport.php | SmtpTransport._prepareMessage | protected function _prepareMessage($email)
{
$lines = $email->message();
$messages = [];
foreach ($lines as $line) {
if (!empty($line) && ($line[0] === '.')) {
$messages[] = '.' . $line;
} else {
$messages[] = $line;
}
... | php | protected function _prepareMessage($email)
{
$lines = $email->message();
$messages = [];
foreach ($lines as $line) {
if (!empty($line) && ($line[0] === '.')) {
$messages[] = '.' . $line;
} else {
$messages[] = $line;
}
... | [
"protected",
"function",
"_prepareMessage",
"(",
"$",
"email",
")",
"{",
"$",
"lines",
"=",
"$",
"email",
"->",
"message",
"(",
")",
";",
"$",
"messages",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"line",
")",
"{",
"if",
"(",
"... | Prepares the message body.
@param \Cake\Mailer\Email $email Email instance
@return string | [
"Prepares",
"the",
"message",
"body",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Mailer/Transport/SmtpTransport.php#L352-L365 |
211,358 | cakephp/cakephp | src/Mailer/Transport/SmtpTransport.php | SmtpTransport._smtpSend | protected function _smtpSend($data, $checkCode = '250')
{
$this->_lastResponse = [];
if ($data !== null) {
$this->_socket->write($data . "\r\n");
}
$timeout = $this->_config['timeout'];
while ($checkCode !== false) {
$response = '';
$sta... | php | protected function _smtpSend($data, $checkCode = '250')
{
$this->_lastResponse = [];
if ($data !== null) {
$this->_socket->write($data . "\r\n");
}
$timeout = $this->_config['timeout'];
while ($checkCode !== false) {
$response = '';
$sta... | [
"protected",
"function",
"_smtpSend",
"(",
"$",
"data",
",",
"$",
"checkCode",
"=",
"'250'",
")",
"{",
"$",
"this",
"->",
"_lastResponse",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"data",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"_socket",
"->",
"wri... | Protected method for sending data to SMTP connection
@param string|null $data Data to be sent to SMTP server
@param string|bool $checkCode Code to check for in server response, false to skip
@return string|null The matched code, or null if nothing matched
@throws \Cake\Network\Exception\SocketException | [
"Protected",
"method",
"for",
"sending",
"data",
"to",
"SMTP",
"connection"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Mailer/Transport/SmtpTransport.php#L434-L471 |
211,359 | cakephp/cakephp | src/Console/ConsoleIo.php | ConsoleIo.out | public function out($message = '', $newlines = 1, $level = self::NORMAL)
{
if ($level <= $this->_level) {
$this->_lastWritten = (int)$this->_out->write($message, $newlines);
return $this->_lastWritten;
}
return true;
} | php | public function out($message = '', $newlines = 1, $level = self::NORMAL)
{
if ($level <= $this->_level) {
$this->_lastWritten = (int)$this->_out->write($message, $newlines);
return $this->_lastWritten;
}
return true;
} | [
"public",
"function",
"out",
"(",
"$",
"message",
"=",
"''",
",",
"$",
"newlines",
"=",
"1",
",",
"$",
"level",
"=",
"self",
"::",
"NORMAL",
")",
"{",
"if",
"(",
"$",
"level",
"<=",
"$",
"this",
"->",
"_level",
")",
"{",
"$",
"this",
"->",
"_la... | Outputs a single or multiple messages to stdout. If no parameters
are passed outputs just a newline.
### Output levels
There are 3 built-in output level. ConsoleIo::QUIET, ConsoleIo::NORMAL, ConsoleIo::VERBOSE.
The verbose and quiet output levels, map to the `verbose` and `quiet` output switches
present in most shell... | [
"Outputs",
"a",
"single",
"or",
"multiple",
"messages",
"to",
"stdout",
".",
"If",
"no",
"parameters",
"are",
"passed",
"outputs",
"just",
"a",
"newline",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleIo.php#L176-L185 |
211,360 | cakephp/cakephp | src/Console/ConsoleIo.php | ConsoleIo.overwrite | public function overwrite($message, $newlines = 1, $size = null)
{
$size = $size ?: $this->_lastWritten;
// Output backspaces.
$this->out(str_repeat("\x08", $size), 0);
$newBytes = $this->out($message, 0);
// Fill any remaining bytes with spaces.
$fill = $size - $n... | php | public function overwrite($message, $newlines = 1, $size = null)
{
$size = $size ?: $this->_lastWritten;
// Output backspaces.
$this->out(str_repeat("\x08", $size), 0);
$newBytes = $this->out($message, 0);
// Fill any remaining bytes with spaces.
$fill = $size - $n... | [
"public",
"function",
"overwrite",
"(",
"$",
"message",
",",
"$",
"newlines",
"=",
"1",
",",
"$",
"size",
"=",
"null",
")",
"{",
"$",
"size",
"=",
"$",
"size",
"?",
":",
"$",
"this",
"->",
"_lastWritten",
";",
"// Output backspaces.",
"$",
"this",
"-... | Overwrite some already output text.
Useful for building progress bars, or when you want to replace
text already output to the screen with new text.
**Warning** You cannot overwrite text that contains newlines.
@param array|string $message The message to output.
@param int $newlines Number of newlines to append.
@par... | [
"Overwrite",
"some",
"already",
"output",
"text",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleIo.php#L287-L311 |
211,361 | cakephp/cakephp | src/Console/ConsoleIo.php | ConsoleIo.hr | public function hr($newlines = 0, $width = 79)
{
$this->out(null, $newlines);
$this->out(str_repeat('-', $width));
$this->out(null, $newlines);
} | php | public function hr($newlines = 0, $width = 79)
{
$this->out(null, $newlines);
$this->out(str_repeat('-', $width));
$this->out(null, $newlines);
} | [
"public",
"function",
"hr",
"(",
"$",
"newlines",
"=",
"0",
",",
"$",
"width",
"=",
"79",
")",
"{",
"$",
"this",
"->",
"out",
"(",
"null",
",",
"$",
"newlines",
")",
";",
"$",
"this",
"->",
"out",
"(",
"str_repeat",
"(",
"'-'",
",",
"$",
"width... | Outputs a series of minus characters to the standard output, acts as a visual separator.
@param int $newlines Number of newlines to pre- and append
@param int $width Width of the line, defaults to 79
@return void | [
"Outputs",
"a",
"series",
"of",
"minus",
"characters",
"to",
"the",
"standard",
"output",
"acts",
"as",
"a",
"visual",
"separator",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleIo.php#L344-L349 |
211,362 | cakephp/cakephp | src/Console/ConsoleIo.php | ConsoleIo.styles | public function styles($style = null, $definition = null)
{
return $this->_out->styles($style, $definition);
} | php | public function styles($style = null, $definition = null)
{
return $this->_out->styles($style, $definition);
} | [
"public",
"function",
"styles",
"(",
"$",
"style",
"=",
"null",
",",
"$",
"definition",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"_out",
"->",
"styles",
"(",
"$",
"style",
",",
"$",
"definition",
")",
";",
"}"
] | Add a new output style or get defined styles.
@param string|null $style The style to get or create.
@param array|bool|null $definition The array definition of the style to change or create a style
or false to remove a style.
@return mixed If you are getting styles, the style or null will be returned. If you are creati... | [
"Add",
"a",
"new",
"output",
"style",
"or",
"get",
"defined",
"styles",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleIo.php#L399-L402 |
211,363 | cakephp/cakephp | src/Console/ConsoleIo.php | ConsoleIo.askChoice | public function askChoice($prompt, $options, $default = null)
{
if ($options && is_string($options)) {
if (strpos($options, ',')) {
$options = explode(',', $options);
} elseif (strpos($options, '/')) {
$options = explode('/', $options);
} e... | php | public function askChoice($prompt, $options, $default = null)
{
if ($options && is_string($options)) {
if (strpos($options, ',')) {
$options = explode(',', $options);
} elseif (strpos($options, '/')) {
$options = explode('/', $options);
} e... | [
"public",
"function",
"askChoice",
"(",
"$",
"prompt",
",",
"$",
"options",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"options",
"&&",
"is_string",
"(",
"$",
"options",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"options",
",",... | Prompts the user for input based on a list of options, and returns it.
@param string $prompt Prompt text.
@param string|array $options Array or string of options.
@param string|null $default Default input value.
@return mixed Either the default value, or the user-provided input. | [
"Prompts",
"the",
"user",
"for",
"input",
"based",
"on",
"a",
"list",
"of",
"options",
"and",
"returns",
"it",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleIo.php#L412-L436 |
211,364 | cakephp/cakephp | src/Console/ConsoleIo.php | ConsoleIo.setLoggers | public function setLoggers($enable)
{
Log::drop('stdout');
Log::drop('stderr');
if ($enable === false) {
return;
}
$outLevels = ['notice', 'info'];
if ($enable === static::VERBOSE || $enable === true) {
$outLevels[] = 'debug';
}
... | php | public function setLoggers($enable)
{
Log::drop('stdout');
Log::drop('stderr');
if ($enable === false) {
return;
}
$outLevels = ['notice', 'info'];
if ($enable === static::VERBOSE || $enable === true) {
$outLevels[] = 'debug';
}
... | [
"public",
"function",
"setLoggers",
"(",
"$",
"enable",
")",
"{",
"Log",
"::",
"drop",
"(",
"'stdout'",
")",
";",
"Log",
"::",
"drop",
"(",
"'stderr'",
")",
";",
"if",
"(",
"$",
"enable",
"===",
"false",
")",
"{",
"return",
";",
"}",
"$",
"outLevel... | Connects or disconnects the loggers to the console output.
Used to enable or disable logging stream output to stdout and stderr
If you don't wish all log output in stdout or stderr
through Cake's Log class, call this function with `$enable=false`.
@param int|bool $enable Use a boolean to enable/toggle all logging. Us... | [
"Connects",
"or",
"disconnects",
"the",
"loggers",
"to",
"the",
"console",
"output",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleIo.php#L481-L504 |
211,365 | cakephp/cakephp | src/Console/ConsoleIo.php | ConsoleIo.helper | public function helper($name, array $settings = [])
{
$name = ucfirst($name);
return $this->_helpers->load($name, $settings);
} | php | public function helper($name, array $settings = [])
{
$name = ucfirst($name);
return $this->_helpers->load($name, $settings);
} | [
"public",
"function",
"helper",
"(",
"$",
"name",
",",
"array",
"$",
"settings",
"=",
"[",
"]",
")",
"{",
"$",
"name",
"=",
"ucfirst",
"(",
"$",
"name",
")",
";",
"return",
"$",
"this",
"->",
"_helpers",
"->",
"load",
"(",
"$",
"name",
",",
"$",
... | Render a Console Helper
Create and render the output for a helper object. If the helper
object has not already been loaded, it will be loaded and constructed.
@param string $name The name of the helper to render
@param array $settings Configuration data for the helper.
@return \Cake\Console\Helper The created helper ... | [
"Render",
"a",
"Console",
"Helper"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleIo.php#L516-L521 |
211,366 | cakephp/cakephp | src/Console/ConsoleIo.php | ConsoleIo.createFile | public function createFile($path, $contents, $forceOverwrite = false)
{
$this->out();
$forceOverwrite = $forceOverwrite || $this->forceOverwrite;
if (file_exists($path) && $forceOverwrite === false) {
$this->warning("File `{$path}` exists");
$key = $this->askChoice('... | php | public function createFile($path, $contents, $forceOverwrite = false)
{
$this->out();
$forceOverwrite = $forceOverwrite || $this->forceOverwrite;
if (file_exists($path) && $forceOverwrite === false) {
$this->warning("File `{$path}` exists");
$key = $this->askChoice('... | [
"public",
"function",
"createFile",
"(",
"$",
"path",
",",
"$",
"contents",
",",
"$",
"forceOverwrite",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"out",
"(",
")",
";",
"$",
"forceOverwrite",
"=",
"$",
"forceOverwrite",
"||",
"$",
"this",
"->",
"forceO... | Create a file at the given path.
This method will prompt the user if a file will be overwritten.
Setting `forceOverwrite` to true will suppress this behavior
and always overwrite the file.
If the user replies `a` subsequent `forceOverwrite` parameters will
be coerced to true and all files will be overwritten.
@param... | [
"Create",
"a",
"file",
"at",
"the",
"given",
"path",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleIo.php#L541-L591 |
211,367 | cakephp/cakephp | src/Cache/Engine/FileEngine.php | FileEngine.init | public function init(array $config = [])
{
parent::init($config);
if ($this->_config['path'] === null) {
$this->_config['path'] = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'cake_cache' . DIRECTORY_SEPARATOR;
}
if (DIRECTORY_SEPARATOR === '\\') {
$this->_conf... | php | public function init(array $config = [])
{
parent::init($config);
if ($this->_config['path'] === null) {
$this->_config['path'] = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'cake_cache' . DIRECTORY_SEPARATOR;
}
if (DIRECTORY_SEPARATOR === '\\') {
$this->_conf... | [
"public",
"function",
"init",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"parent",
"::",
"init",
"(",
"$",
"config",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_config",
"[",
"'path'",
"]",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"... | Initialize File Cache Engine
Called automatically by the cache frontend.
@param array $config array of setting for the engine
@return bool True if the engine has been successfully initialized, false if not | [
"Initialize",
"File",
"Cache",
"Engine"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Cache/Engine/FileEngine.php#L89-L107 |
211,368 | cakephp/cakephp | src/Cache/Engine/FileEngine.php | FileEngine.clear | public function clear($check)
{
if (!$this->_init) {
return false;
}
$this->_File = null;
$threshold = $now = false;
if ($check) {
$now = time();
$threshold = $now - $this->_config['duration'];
}
$this->_clearDirectory($th... | php | public function clear($check)
{
if (!$this->_init) {
return false;
}
$this->_File = null;
$threshold = $now = false;
if ($check) {
$now = time();
$threshold = $now - $this->_config['duration'];
}
$this->_clearDirectory($th... | [
"public",
"function",
"clear",
"(",
"$",
"check",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_init",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"_File",
"=",
"null",
";",
"$",
"threshold",
"=",
"$",
"now",
"=",
"false",
";",
"... | Delete all values from the cache
@param bool $check Optional - only delete expired cache items
@return bool True if the cache was successfully cleared, false otherwise | [
"Delete",
"all",
"values",
"from",
"the",
"cache"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Cache/Engine/FileEngine.php#L257-L294 |
211,369 | cakephp/cakephp | src/Cache/Engine/FileEngine.php | FileEngine._clearDirectory | protected function _clearDirectory($path, $now, $threshold)
{
if (!is_dir($path)) {
return;
}
$prefixLength = strlen($this->_config['prefix']);
$dir = dir($path);
while (($entry = $dir->read()) !== false) {
if (substr($entry, 0, $prefixLength) !== $th... | php | protected function _clearDirectory($path, $now, $threshold)
{
if (!is_dir($path)) {
return;
}
$prefixLength = strlen($this->_config['prefix']);
$dir = dir($path);
while (($entry = $dir->read()) !== false) {
if (substr($entry, 0, $prefixLength) !== $th... | [
"protected",
"function",
"_clearDirectory",
"(",
"$",
"path",
",",
"$",
"now",
",",
"$",
"threshold",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"path",
")",
")",
"{",
"return",
";",
"}",
"$",
"prefixLength",
"=",
"strlen",
"(",
"$",
"this",
"->... | Used to clear a directory of matching files.
@param string $path The path to search.
@param int $now The current timestamp
@param int $threshold Any file not modified after this value will be deleted.
@return void | [
"Used",
"to",
"clear",
"a",
"directory",
"of",
"matching",
"files",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Cache/Engine/FileEngine.php#L304-L345 |
211,370 | cakephp/cakephp | src/Cache/Engine/FileEngine.php | FileEngine._setKey | protected function _setKey($key, $createKey = false)
{
$groups = null;
if ($this->_groupPrefix) {
$groups = vsprintf($this->_groupPrefix, $this->groups());
}
$dir = $this->_config['path'] . $groups;
if (!is_dir($dir)) {
mkdir($dir, 0775, true);
... | php | protected function _setKey($key, $createKey = false)
{
$groups = null;
if ($this->_groupPrefix) {
$groups = vsprintf($this->_groupPrefix, $this->groups());
}
$dir = $this->_config['path'] . $groups;
if (!is_dir($dir)) {
mkdir($dir, 0775, true);
... | [
"protected",
"function",
"_setKey",
"(",
"$",
"key",
",",
"$",
"createKey",
"=",
"false",
")",
"{",
"$",
"groups",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"_groupPrefix",
")",
"{",
"$",
"groups",
"=",
"vsprintf",
"(",
"$",
"this",
"->",
"_g... | Sets the current cache key this class is managing, and creates a writable SplFileObject
for the cache file the key is referring to.
@param string $key The key
@param bool $createKey Whether the key should be created if it doesn't exists, or not
@return bool true if the cache key could be set, false otherwise | [
"Sets",
"the",
"current",
"cache",
"key",
"this",
"class",
"is",
"managing",
"and",
"creates",
"a",
"writable",
"SplFileObject",
"for",
"the",
"cache",
"file",
"the",
"key",
"is",
"referring",
"to",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Cache/Engine/FileEngine.php#L381-L422 |
211,371 | cakephp/cakephp | src/Cache/Engine/FileEngine.php | FileEngine._active | protected function _active()
{
$dir = new SplFileInfo($this->_config['path']);
$path = $dir->getPathname();
$success = true;
if (!is_dir($path)) {
//@codingStandardsIgnoreStart
$success = @mkdir($path, 0775, true);
//@codingStandardsIgnoreEnd
... | php | protected function _active()
{
$dir = new SplFileInfo($this->_config['path']);
$path = $dir->getPathname();
$success = true;
if (!is_dir($path)) {
//@codingStandardsIgnoreStart
$success = @mkdir($path, 0775, true);
//@codingStandardsIgnoreEnd
... | [
"protected",
"function",
"_active",
"(",
")",
"{",
"$",
"dir",
"=",
"new",
"SplFileInfo",
"(",
"$",
"this",
"->",
"_config",
"[",
"'path'",
"]",
")",
";",
"$",
"path",
"=",
"$",
"dir",
"->",
"getPathname",
"(",
")",
";",
"$",
"success",
"=",
"true"... | Determine if cache directory is writable
@return bool | [
"Determine",
"if",
"cache",
"directory",
"is",
"writable"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Cache/Engine/FileEngine.php#L429-L450 |
211,372 | cakephp/cakephp | src/Routing/Route/RedirectRoute.php | RedirectRoute.parse | public function parse($url, $method = '')
{
$params = parent::parse($url, $method);
if (!$params) {
return false;
}
$redirect = $this->redirect;
if (count($this->redirect) === 1 && !isset($this->redirect['controller'])) {
$redirect = $this->redirect[0]... | php | public function parse($url, $method = '')
{
$params = parent::parse($url, $method);
if (!$params) {
return false;
}
$redirect = $this->redirect;
if (count($this->redirect) === 1 && !isset($this->redirect['controller'])) {
$redirect = $this->redirect[0]... | [
"public",
"function",
"parse",
"(",
"$",
"url",
",",
"$",
"method",
"=",
"''",
")",
"{",
"$",
"params",
"=",
"parent",
"::",
"parse",
"(",
"$",
"url",
",",
"$",
"method",
")",
";",
"if",
"(",
"!",
"$",
"params",
")",
"{",
"return",
"false",
";"... | Parses a string URL into an array. Parsed URLs will result in an automatic
redirection.
@param string $url The URL to parse.
@param string $method The HTTP method being used.
@return bool|null False on failure. An exception is raised on a successful match.
@throws \Cake\Routing\Exception\RedirectException An exception... | [
"Parses",
"a",
"string",
"URL",
"into",
"an",
"array",
".",
"Parsed",
"URLs",
"will",
"result",
"in",
"an",
"automatic",
"redirection",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/RedirectRoute.php#L72-L98 |
211,373 | cakephp/cakephp | src/Cache/CacheRegistry.php | CacheRegistry._create | protected function _create($class, $alias, $config)
{
if (is_object($class)) {
$instance = $class;
}
unset($config['className']);
if (!isset($instance)) {
$instance = new $class($config);
}
if (!($instance instanceof CacheEngine)) {
... | php | protected function _create($class, $alias, $config)
{
if (is_object($class)) {
$instance = $class;
}
unset($config['className']);
if (!isset($instance)) {
$instance = new $class($config);
}
if (!($instance instanceof CacheEngine)) {
... | [
"protected",
"function",
"_create",
"(",
"$",
"class",
",",
"$",
"alias",
",",
"$",
"config",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"class",
")",
")",
"{",
"$",
"instance",
"=",
"$",
"class",
";",
"}",
"unset",
"(",
"$",
"config",
"[",
"'cl... | Create the cache engine instance.
Part of the template method for Cake\Core\ObjectRegistry::load()
@param string|\Cake\Cache\CacheEngine $class The classname or object to make.
@param string $alias The alias of the object.
@param array $config An array of settings to use for the cache engine.
@return \Cake\Cache\Cach... | [
"Create",
"the",
"cache",
"engine",
"instance",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Cache/CacheRegistry.php#L73-L102 |
211,374 | cakephp/cakephp | src/View/ViewVarsTrait.php | ViewVarsTrait.createView | public function createView($viewClass = null)
{
$builder = $this->viewBuilder();
if ($viewClass === null && $builder->getClassName() === null) {
$builder->setClassName($this->viewClass);
$this->viewClass = null;
}
if ($viewClass) {
$builder->setCla... | php | public function createView($viewClass = null)
{
$builder = $this->viewBuilder();
if ($viewClass === null && $builder->getClassName() === null) {
$builder->setClassName($this->viewClass);
$this->viewClass = null;
}
if ($viewClass) {
$builder->setCla... | [
"public",
"function",
"createView",
"(",
"$",
"viewClass",
"=",
"null",
")",
"{",
"$",
"builder",
"=",
"$",
"this",
"->",
"viewBuilder",
"(",
")",
";",
"if",
"(",
"$",
"viewClass",
"===",
"null",
"&&",
"$",
"builder",
"->",
"getClassName",
"(",
")",
... | Constructs the view class instance based on the current configuration.
@param string|null $viewClass Optional namespaced class name of the View class to instantiate.
@return \Cake\View\View
@throws \Cake\View\Exception\MissingViewException If view class was not found. | [
"Constructs",
"the",
"view",
"class",
"instance",
"based",
"on",
"the",
"current",
"configuration",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/ViewVarsTrait.php#L73-L126 |
211,375 | cakephp/cakephp | src/View/ViewVarsTrait.php | ViewVarsTrait.set | public function set($name, $value = null)
{
if (is_array($name)) {
if (is_array($value)) {
$data = array_combine($name, $value);
} else {
$data = $name;
}
} else {
$data = [$name => $value];
}
$this->view... | php | public function set($name, $value = null)
{
if (is_array($name)) {
if (is_array($value)) {
$data = array_combine($name, $value);
} else {
$data = $name;
}
} else {
$data = [$name => $value];
}
$this->view... | [
"public",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"data",
"=",
"array_combine",
"(",
"$... | Saves a variable or an associative array of variables for use inside a template.
@param string|array $name A string or an array of data.
@param mixed $value Value in case $name is a string (which then works as the key).
Unused if $name is an associative array, otherwise serves as the values to $name's keys.
@return $t... | [
"Saves",
"a",
"variable",
"or",
"an",
"associative",
"array",
"of",
"variables",
"for",
"use",
"inside",
"a",
"template",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/ViewVarsTrait.php#L136-L150 |
211,376 | cakephp/cakephp | src/Core/Retry/CommandRetry.php | CommandRetry.run | public function run(callable $action)
{
$retryCount = 0;
$lastException = null;
do {
try {
return $action();
} catch (Exception $e) {
$lastException = $e;
if (!$this->strategy->shouldRetry($e, $retryCount)) {
... | php | public function run(callable $action)
{
$retryCount = 0;
$lastException = null;
do {
try {
return $action();
} catch (Exception $e) {
$lastException = $e;
if (!$this->strategy->shouldRetry($e, $retryCount)) {
... | [
"public",
"function",
"run",
"(",
"callable",
"$",
"action",
")",
"{",
"$",
"retryCount",
"=",
"0",
";",
"$",
"lastException",
"=",
"null",
";",
"do",
"{",
"try",
"{",
"return",
"$",
"action",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e"... | The number of retries to perform in case of failure
@param callable $action The callable action to execute with a retry strategy
@return mixed The return value of the passed action callable
@throws \Exception | [
"The",
"number",
"of",
"retries",
"to",
"perform",
"in",
"case",
"of",
"failure"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/Retry/CommandRetry.php#L61-L80 |
211,377 | cakephp/cakephp | src/Routing/Route/Route.php | Route.setExtensions | public function setExtensions(array $extensions)
{
$this->_extensions = [];
foreach ($extensions as $ext) {
$this->_extensions[] = strtolower($ext);
}
return $this;
} | php | public function setExtensions(array $extensions)
{
$this->_extensions = [];
foreach ($extensions as $ext) {
$this->_extensions[] = strtolower($ext);
}
return $this;
} | [
"public",
"function",
"setExtensions",
"(",
"array",
"$",
"extensions",
")",
"{",
"$",
"this",
"->",
"_extensions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"extensions",
"as",
"$",
"ext",
")",
"{",
"$",
"this",
"->",
"_extensions",
"[",
"]",
"=",
"s... | Set the supported extensions for this route.
@param array $extensions The extensions to set.
@return $this | [
"Set",
"the",
"supported",
"extensions",
"for",
"this",
"route",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/Route.php#L167-L175 |
211,378 | cakephp/cakephp | src/Routing/Route/Route.php | Route.setMethods | public function setMethods(array $methods)
{
$methods = array_map('strtoupper', $methods);
$diff = array_diff($methods, static::VALID_METHODS);
if ($diff !== []) {
throw new InvalidArgumentException(
sprintf('Invalid HTTP method received. %s is invalid.', implode(... | php | public function setMethods(array $methods)
{
$methods = array_map('strtoupper', $methods);
$diff = array_diff($methods, static::VALID_METHODS);
if ($diff !== []) {
throw new InvalidArgumentException(
sprintf('Invalid HTTP method received. %s is invalid.', implode(... | [
"public",
"function",
"setMethods",
"(",
"array",
"$",
"methods",
")",
"{",
"$",
"methods",
"=",
"array_map",
"(",
"'strtoupper'",
",",
"$",
"methods",
")",
";",
"$",
"diff",
"=",
"array_diff",
"(",
"$",
"methods",
",",
"static",
"::",
"VALID_METHODS",
"... | Set the accepted HTTP methods for this route.
@param array $methods The HTTP methods to accept.
@return $this
@throws \InvalidArgumentException | [
"Set",
"the",
"accepted",
"HTTP",
"methods",
"for",
"this",
"route",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/Route.php#L194-L206 |
211,379 | cakephp/cakephp | src/Routing/Route/Route.php | Route.setPatterns | public function setPatterns(array $patterns)
{
$patternValues = implode("", $patterns);
if (mb_strlen($patternValues) < strlen($patternValues)) {
$this->options['multibytePattern'] = true;
}
$this->options = array_merge($this->options, $patterns);
return $this;
... | php | public function setPatterns(array $patterns)
{
$patternValues = implode("", $patterns);
if (mb_strlen($patternValues) < strlen($patternValues)) {
$this->options['multibytePattern'] = true;
}
$this->options = array_merge($this->options, $patterns);
return $this;
... | [
"public",
"function",
"setPatterns",
"(",
"array",
"$",
"patterns",
")",
"{",
"$",
"patternValues",
"=",
"implode",
"(",
"\"\"",
",",
"$",
"patterns",
")",
";",
"if",
"(",
"mb_strlen",
"(",
"$",
"patternValues",
")",
"<",
"strlen",
"(",
"$",
"patternValu... | Set regexp patterns for routing parameters
If any of your patterns contain multibyte values, the `multibytePattern`
mode will be enabled.
@param array $patterns The patterns to apply to routing elements
@return $this | [
"Set",
"regexp",
"patterns",
"for",
"routing",
"parameters"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/Route.php#L217-L226 |
211,380 | cakephp/cakephp | src/Routing/Route/Route.php | Route.hostMatches | public function hostMatches($host)
{
$pattern = '@^' . str_replace('\*', '.*', preg_quote($this->options['_host'], '@')) . '$@';
return preg_match($pattern, $host) !== 0;
} | php | public function hostMatches($host)
{
$pattern = '@^' . str_replace('\*', '.*', preg_quote($this->options['_host'], '@')) . '$@';
return preg_match($pattern, $host) !== 0;
} | [
"public",
"function",
"hostMatches",
"(",
"$",
"host",
")",
"{",
"$",
"pattern",
"=",
"'@^'",
".",
"str_replace",
"(",
"'\\*'",
",",
"'.*'",
",",
"preg_quote",
"(",
"$",
"this",
"->",
"options",
"[",
"'_host'",
"]",
",",
"'@'",
")",
")",
".",
"'$@'",... | Check to see if the host matches the route requirements
@param string $host The request's host name
@return bool Whether or not the host matches any conditions set in for this route. | [
"Check",
"to",
"see",
"if",
"the",
"host",
"matches",
"the",
"route",
"requirements"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/Route.php#L531-L536 |
211,381 | cakephp/cakephp | src/Routing/Route/Route.php | Route._parseArgs | protected function _parseArgs($args, $context)
{
$pass = [];
$args = explode('/', $args);
foreach ($args as $param) {
if (empty($param) && $param !== '0' && $param !== 0) {
continue;
}
$pass[] = rawurldecode($param);
}
ret... | php | protected function _parseArgs($args, $context)
{
$pass = [];
$args = explode('/', $args);
foreach ($args as $param) {
if (empty($param) && $param !== '0' && $param !== 0) {
continue;
}
$pass[] = rawurldecode($param);
}
ret... | [
"protected",
"function",
"_parseArgs",
"(",
"$",
"args",
",",
"$",
"context",
")",
"{",
"$",
"pass",
"=",
"[",
"]",
";",
"$",
"args",
"=",
"explode",
"(",
"'/'",
",",
"$",
"args",
")",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"param",
")",
... | Parse passed parameters into a list of passed args.
Return true if a given named $param's $val matches a given $rule depending on $context.
Currently implemented rule types are controller, action and match that can be combined with each other.
@param string $args A string with the passed params. eg. /1/foo
@param str... | [
"Parse",
"passed",
"parameters",
"into",
"a",
"list",
"of",
"passed",
"args",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/Route.php#L569-L582 |
211,382 | cakephp/cakephp | src/Routing/Route/Route.php | Route._persistParams | protected function _persistParams(array $url, array $params)
{
foreach ($this->options['persist'] as $persistKey) {
if (array_key_exists($persistKey, $params) && !isset($url[$persistKey])) {
$url[$persistKey] = $params[$persistKey];
}
}
return $url;
... | php | protected function _persistParams(array $url, array $params)
{
foreach ($this->options['persist'] as $persistKey) {
if (array_key_exists($persistKey, $params) && !isset($url[$persistKey])) {
$url[$persistKey] = $params[$persistKey];
}
}
return $url;
... | [
"protected",
"function",
"_persistParams",
"(",
"array",
"$",
"url",
",",
"array",
"$",
"params",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"[",
"'persist'",
"]",
"as",
"$",
"persistKey",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
... | Apply persistent parameters to a URL array. Persistent parameters are a
special key used during route creation to force route parameters to
persist when omitted from a URL array.
@param array $url The array to apply persistent parameters to.
@param array $params An array of persistent values to replace persistent ones... | [
"Apply",
"persistent",
"parameters",
"to",
"a",
"URL",
"array",
".",
"Persistent",
"parameters",
"are",
"a",
"special",
"key",
"used",
"during",
"route",
"creation",
"to",
"force",
"route",
"parameters",
"to",
"persist",
"when",
"omitted",
"from",
"a",
"URL",
... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/Route.php#L593-L602 |
211,383 | cakephp/cakephp | src/Routing/Route/Route.php | Route._matchMethod | protected function _matchMethod($url)
{
if (empty($this->defaults['_method'])) {
return true;
}
// @deprecated The `[method]` support should be removed in 4.0.0
if (isset($url['[method]'])) {
deprecationWarning('The `[method]` key is deprecated. Use `_method` ... | php | protected function _matchMethod($url)
{
if (empty($this->defaults['_method'])) {
return true;
}
// @deprecated The `[method]` support should be removed in 4.0.0
if (isset($url['[method]'])) {
deprecationWarning('The `[method]` key is deprecated. Use `_method` ... | [
"protected",
"function",
"_matchMethod",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"defaults",
"[",
"'_method'",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"// @deprecated The `[method]` support should be removed in 4.0.0",
"if"... | Check whether or not the URL's HTTP method matches.
@param array $url The array for the URL being generated.
@return bool | [
"Check",
"whether",
"or",
"not",
"the",
"URL",
"s",
"HTTP",
"method",
"matches",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/Route.php#L761-L782 |
211,384 | cakephp/cakephp | src/Routing/Route/Route.php | Route._writeUrl | protected function _writeUrl($params, $pass = [], $query = [])
{
$pass = implode('/', array_map('rawurlencode', $pass));
$out = $this->template;
$search = $replace = [];
foreach ($this->keys as $key) {
$string = null;
if (isset($params[$key])) {
... | php | protected function _writeUrl($params, $pass = [], $query = [])
{
$pass = implode('/', array_map('rawurlencode', $pass));
$out = $this->template;
$search = $replace = [];
foreach ($this->keys as $key) {
$string = null;
if (isset($params[$key])) {
... | [
"protected",
"function",
"_writeUrl",
"(",
"$",
"params",
",",
"$",
"pass",
"=",
"[",
"]",
",",
"$",
"query",
"=",
"[",
"]",
")",
"{",
"$",
"pass",
"=",
"implode",
"(",
"'/'",
",",
"array_map",
"(",
"'rawurlencode'",
",",
"$",
"pass",
")",
")",
"... | Converts a matching route array into a URL string.
Composes the string URL using the template
used to create the route.
@param array $params The params to convert to a string url
@param array $pass The additional passed arguments
@param array $query An array of parameters
@return string Composed route string. | [
"Converts",
"a",
"matching",
"route",
"array",
"into",
"a",
"URL",
"string",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/Route.php#L795-L856 |
211,385 | cakephp/cakephp | src/Routing/Route/Route.php | Route.staticPath | public function staticPath()
{
$routeKey = strpos($this->template, ':');
if ($routeKey !== false) {
return substr($this->template, 0, $routeKey);
}
$routeKey = strpos($this->template, '{');
if ($routeKey !== false && strpos($this->template, '}') !== false) {
... | php | public function staticPath()
{
$routeKey = strpos($this->template, ':');
if ($routeKey !== false) {
return substr($this->template, 0, $routeKey);
}
$routeKey = strpos($this->template, '{');
if ($routeKey !== false && strpos($this->template, '}') !== false) {
... | [
"public",
"function",
"staticPath",
"(",
")",
"{",
"$",
"routeKey",
"=",
"strpos",
"(",
"$",
"this",
"->",
"template",
",",
"':'",
")",
";",
"if",
"(",
"$",
"routeKey",
"!==",
"false",
")",
"{",
"return",
"substr",
"(",
"$",
"this",
"->",
"template",... | Get the static path portion for this route.
@return string | [
"Get",
"the",
"static",
"path",
"portion",
"for",
"this",
"route",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/Route.php#L863-L881 |
211,386 | cakephp/cakephp | src/Core/PluginCollection.php | PluginCollection.findPath | public function findPath($name)
{
$this->loadConfig();
$path = Configure::read('plugins.' . $name);
if ($path) {
return $path;
}
$pluginPath = str_replace('/', DIRECTORY_SEPARATOR, $name);
$paths = App::path('Plugin');
foreach ($paths as $path) {... | php | public function findPath($name)
{
$this->loadConfig();
$path = Configure::read('plugins.' . $name);
if ($path) {
return $path;
}
$pluginPath = str_replace('/', DIRECTORY_SEPARATOR, $name);
$paths = App::path('Plugin');
foreach ($paths as $path) {... | [
"public",
"function",
"findPath",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"loadConfig",
"(",
")",
";",
"$",
"path",
"=",
"Configure",
"::",
"read",
"(",
"'plugins.'",
".",
"$",
"name",
")",
";",
"if",
"(",
"$",
"path",
")",
"{",
"return",
... | Locate a plugin path by looking at configuration data.
This will use the `plugins` Configure key, and fallback to enumerating `App::path('Plugin')`
This method is not part of the official public API as plugins with
no plugin class are being phased out.
@param string $name The plugin name to locate a path for. Will r... | [
"Locate",
"a",
"plugin",
"path",
"by",
"looking",
"at",
"configuration",
"data",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/PluginCollection.php#L110-L128 |
211,387 | cakephp/cakephp | src/Core/PluginCollection.php | PluginCollection.add | public function add(PluginInterface $plugin)
{
$name = $plugin->getName();
$this->plugins[$name] = $plugin;
$this->names = array_keys($this->plugins);
return $this;
} | php | public function add(PluginInterface $plugin)
{
$name = $plugin->getName();
$this->plugins[$name] = $plugin;
$this->names = array_keys($this->plugins);
return $this;
} | [
"public",
"function",
"add",
"(",
"PluginInterface",
"$",
"plugin",
")",
"{",
"$",
"name",
"=",
"$",
"plugin",
"->",
"getName",
"(",
")",
";",
"$",
"this",
"->",
"plugins",
"[",
"$",
"name",
"]",
"=",
"$",
"plugin",
";",
"$",
"this",
"->",
"names",... | Add a plugin to the collection
Plugins will be keyed by their names.
@param \Cake\Core\PluginInterface $plugin The plugin to load.
@return $this | [
"Add",
"a",
"plugin",
"to",
"the",
"collection"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/PluginCollection.php#L138-L145 |
211,388 | cakephp/cakephp | src/Core/PluginCollection.php | PluginCollection.remove | public function remove($name)
{
unset($this->plugins[$name]);
$this->names = array_keys($this->plugins);
return $this;
} | php | public function remove($name)
{
unset($this->plugins[$name]);
$this->names = array_keys($this->plugins);
return $this;
} | [
"public",
"function",
"remove",
"(",
"$",
"name",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"plugins",
"[",
"$",
"name",
"]",
")",
";",
"$",
"this",
"->",
"names",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"plugins",
")",
";",
"return",
"$",
"t... | Remove a plugin from the collection if it exists.
@param string $name The named plugin.
@return $this | [
"Remove",
"a",
"plugin",
"from",
"the",
"collection",
"if",
"it",
"exists",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/PluginCollection.php#L153-L159 |
211,389 | cakephp/cakephp | src/Core/PluginCollection.php | PluginCollection.get | public function get($name)
{
if (!$this->has($name)) {
throw new MissingPluginException(['plugin' => $name]);
}
return $this->plugins[$name];
} | php | public function get($name)
{
if (!$this->has($name)) {
throw new MissingPluginException(['plugin' => $name]);
}
return $this->plugins[$name];
} | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"MissingPluginException",
"(",
"[",
"'plugin'",
"=>",
"$",
"name",
"]",
")",
";",
"}",
"return",
"... | Get the a plugin by name
@param string $name The plugin to get.
@return \Cake\Core\PluginInterface The plugin.
@throws \Cake\Core\Exception\MissingPluginException when unknown plugins are fetched. | [
"Get",
"the",
"a",
"plugin",
"by",
"name"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/PluginCollection.php#L191-L198 |
211,390 | cakephp/cakephp | src/Core/PluginCollection.php | PluginCollection.with | public function with($hook)
{
if (!in_array($hook, PluginInterface::VALID_HOOKS)) {
throw new InvalidArgumentException("The `{$hook}` hook is not a known plugin hook.");
}
foreach ($this as $plugin) {
if ($plugin->isEnabled($hook)) {
yield $plugin;
... | php | public function with($hook)
{
if (!in_array($hook, PluginInterface::VALID_HOOKS)) {
throw new InvalidArgumentException("The `{$hook}` hook is not a known plugin hook.");
}
foreach ($this as $plugin) {
if ($plugin->isEnabled($hook)) {
yield $plugin;
... | [
"public",
"function",
"with",
"(",
"$",
"hook",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"hook",
",",
"PluginInterface",
"::",
"VALID_HOOKS",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"The `{$hook}` hook is not a known plugin hook.\"... | Filter the plugins to those with the named hook enabled.
@param string $hook The hook to filter plugins by
@return \Generator A generator containing matching plugins.
@throws \InvalidArgumentException on invalid hooks | [
"Filter",
"the",
"plugins",
"to",
"those",
"with",
"the",
"named",
"hook",
"enabled",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/PluginCollection.php#L271-L281 |
211,391 | cakephp/cakephp | src/View/Helper/PaginatorHelper.php | PaginatorHelper.params | public function params($model = null)
{
$request = $this->_View->getRequest();
if (empty($model)) {
$model = $this->defaultModel();
}
if (!$request->getParam('paging') || !$request->getParam('paging.' . $model)) {
return [];
}
return $request... | php | public function params($model = null)
{
$request = $this->_View->getRequest();
if (empty($model)) {
$model = $this->defaultModel();
}
if (!$request->getParam('paging') || !$request->getParam('paging.' . $model)) {
return [];
}
return $request... | [
"public",
"function",
"params",
"(",
"$",
"model",
"=",
"null",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"_View",
"->",
"getRequest",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"model",
")",
")",
"{",
"$",
"model",
"=",
"$",
"this",
... | Gets the current paging parameters from the resultset for the given model
@param string|null $model Optional model name. Uses the default if none is specified.
@return array The array of paging parameters for the paginated resultset. | [
"Gets",
"the",
"current",
"paging",
"parameters",
"from",
"the",
"resultset",
"for",
"the",
"given",
"model"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/PaginatorHelper.php#L117-L129 |
211,392 | cakephp/cakephp | src/View/Helper/PaginatorHelper.php | PaginatorHelper.options | public function options(array $options = [])
{
$request = $this->_View->getRequest();
if (!empty($options['paging'])) {
$request = $request->withParam(
'paging',
$options['paging'] + $request->getParam('paging', [])
);
unset($optio... | php | public function options(array $options = [])
{
$request = $this->_View->getRequest();
if (!empty($options['paging'])) {
$request = $request->withParam(
'paging',
$options['paging'] + $request->getParam('paging', [])
);
unset($optio... | [
"public",
"function",
"options",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"_View",
"->",
"getRequest",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
"[",
"'paging'",
"]",
")",
"... | Sets default options for all pagination links
@param array $options Default options for pagination links.
See PaginatorHelper::$options for list of keys.
@return void | [
"Sets",
"default",
"options",
"for",
"all",
"pagination",
"links"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/PaginatorHelper.php#L155-L185 |
211,393 | cakephp/cakephp | src/View/Helper/PaginatorHelper.php | PaginatorHelper.current | public function current($model = null)
{
$params = $this->params($model);
if (isset($params['page'])) {
return $params['page'];
}
return 1;
} | php | public function current($model = null)
{
$params = $this->params($model);
if (isset($params['page'])) {
return $params['page'];
}
return 1;
} | [
"public",
"function",
"current",
"(",
"$",
"model",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"params",
"(",
"$",
"model",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'page'",
"]",
")",
")",
"{",
"return",
"$",
"... | Gets the current page of the recordset for the given model
@param string|null $model Optional model name. Uses the default if none is specified.
@return int The current page number of the recordset.
@link https://book.cakephp.org/3.0/en/views/helpers/paginator.html#checking-the-pagination-state | [
"Gets",
"the",
"current",
"page",
"of",
"the",
"recordset",
"for",
"the",
"given",
"model"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/PaginatorHelper.php#L194-L203 |
211,394 | cakephp/cakephp | src/View/Helper/PaginatorHelper.php | PaginatorHelper.total | public function total($model = null)
{
$params = $this->params($model);
if (isset($params['pageCount'])) {
return $params['pageCount'];
}
return 0;
} | php | public function total($model = null)
{
$params = $this->params($model);
if (isset($params['pageCount'])) {
return $params['pageCount'];
}
return 0;
} | [
"public",
"function",
"total",
"(",
"$",
"model",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"params",
"(",
"$",
"model",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'pageCount'",
"]",
")",
")",
"{",
"return",
"$",
... | Gets the total number of pages in the recordset for the given model.
@param string|null $model Optional model name. Uses the default if none is specified.
@return int The total pages for the recordset. | [
"Gets",
"the",
"total",
"number",
"of",
"pages",
"in",
"the",
"recordset",
"for",
"the",
"given",
"model",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/PaginatorHelper.php#L211-L220 |
211,395 | cakephp/cakephp | src/View/Helper/PaginatorHelper.php | PaginatorHelper.sortKey | public function sortKey($model = null, array $options = [])
{
if (empty($options)) {
$options = $this->params($model);
}
if (!empty($options['sort'])) {
return $options['sort'];
}
return null;
} | php | public function sortKey($model = null, array $options = [])
{
if (empty($options)) {
$options = $this->params($model);
}
if (!empty($options['sort'])) {
return $options['sort'];
}
return null;
} | [
"public",
"function",
"sortKey",
"(",
"$",
"model",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"options",
")",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"params",
"(",
"$",
"model",
... | Gets the current key by which the recordset is sorted
@param string|null $model Optional model name. Uses the default if none is specified.
@param array $options Options for pagination links. See #options for list of keys.
@return string|null The name of the key by which the recordset is being sorted, or
null if the r... | [
"Gets",
"the",
"current",
"key",
"by",
"which",
"the",
"recordset",
"is",
"sorted"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/PaginatorHelper.php#L231-L241 |
211,396 | cakephp/cakephp | src/View/Helper/PaginatorHelper.php | PaginatorHelper.sortDir | public function sortDir($model = null, array $options = [])
{
$dir = null;
if (empty($options)) {
$options = $this->params($model);
}
if (isset($options['direction'])) {
$dir = strtolower($options['direction']);
}
if ($dir === 'desc') {
... | php | public function sortDir($model = null, array $options = [])
{
$dir = null;
if (empty($options)) {
$options = $this->params($model);
}
if (isset($options['direction'])) {
$dir = strtolower($options['direction']);
}
if ($dir === 'desc') {
... | [
"public",
"function",
"sortDir",
"(",
"$",
"model",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"dir",
"=",
"null",
";",
"if",
"(",
"empty",
"(",
"$",
"options",
")",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->"... | Gets the current direction the recordset is sorted
@param string|null $model Optional model name. Uses the default if none is specified.
@param array $options Options for pagination links. See #options for list of keys.
@return string The direction by which the recordset is being sorted, or
null if the results are not... | [
"Gets",
"the",
"current",
"direction",
"the",
"recordset",
"is",
"sorted"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/PaginatorHelper.php#L252-L269 |
211,397 | cakephp/cakephp | src/View/Helper/PaginatorHelper.php | PaginatorHelper.prev | public function prev($title = '<< Previous', array $options = [])
{
$defaults = [
'url' => [],
'model' => $this->defaultModel(),
'disabledTitle' => $title,
'escape' => true,
];
$options += $defaults;
$options['step'] = -1;
$ena... | php | public function prev($title = '<< Previous', array $options = [])
{
$defaults = [
'url' => [],
'model' => $this->defaultModel(),
'disabledTitle' => $title,
'escape' => true,
];
$options += $defaults;
$options['step'] = -1;
$ena... | [
"public",
"function",
"prev",
"(",
"$",
"title",
"=",
"'<< Previous'",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'url'",
"=>",
"[",
"]",
",",
"'model'",
"=>",
"$",
"this",
"->",
"defaultModel",
"(",
")",
","... | Generates a "previous" link for a set of paged records
### Options:
- `disabledTitle` The text to used when the link is disabled. This
defaults to the same text at the active link. Setting to false will cause
this method to return ''.
- `escape` Whether you want the contents html entity encoded, defaults to true
- `m... | [
"Generates",
"a",
"previous",
"link",
"for",
"a",
"set",
"of",
"paged",
"records"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/PaginatorHelper.php#L352-L370 |
211,398 | cakephp/cakephp | src/View/Helper/PaginatorHelper.php | PaginatorHelper.sort | public function sort($key, $title = null, array $options = [])
{
$options += ['url' => [], 'model' => null, 'escape' => true];
$url = $options['url'];
unset($options['url']);
if (empty($title)) {
$title = $key;
if (strpos($title, '.') !== false) {
... | php | public function sort($key, $title = null, array $options = [])
{
$options += ['url' => [], 'model' => null, 'escape' => true];
$url = $options['url'];
unset($options['url']);
if (empty($title)) {
$title = $key;
if (strpos($title, '.') !== false) {
... | [
"public",
"function",
"sort",
"(",
"$",
"key",
",",
"$",
"title",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"+=",
"[",
"'url'",
"=>",
"[",
"]",
",",
"'model'",
"=>",
"null",
",",
"'escape'",
"=>",
"true",... | Generates a sorting link. Sets named parameters for the sort and direction. Handles
direction switching automatically.
### Options:
- `escape` Whether you want the contents html entity encoded, defaults to true.
- `model` The model to use, defaults to PaginatorHelper::defaultModel().
- `direction` The default directi... | [
"Generates",
"a",
"sorting",
"link",
".",
"Sets",
"named",
"parameters",
"for",
"the",
"sort",
"and",
"direction",
".",
"Handles",
"direction",
"switching",
"automatically",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/PaginatorHelper.php#L431-L492 |
211,399 | cakephp/cakephp | src/View/Helper/PaginatorHelper.php | PaginatorHelper.defaultModel | public function defaultModel($model = null)
{
if ($model !== null) {
$this->_defaultModel = $model;
}
if ($this->_defaultModel) {
return $this->_defaultModel;
}
if (!$this->_View->getRequest()->getParam('paging')) {
return null;
}
... | php | public function defaultModel($model = null)
{
if ($model !== null) {
$this->_defaultModel = $model;
}
if ($this->_defaultModel) {
return $this->_defaultModel;
}
if (!$this->_View->getRequest()->getParam('paging')) {
return null;
}
... | [
"public",
"function",
"defaultModel",
"(",
"$",
"model",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"model",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"_defaultModel",
"=",
"$",
"model",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"_defaultModel",
")",
"... | Gets or sets the default model of the paged sets
@param string|null $model Model name to set
@return string|null Model name or null if the pagination isn't initialized. | [
"Gets",
"or",
"sets",
"the",
"default",
"model",
"of",
"the",
"paged",
"sets"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/PaginatorHelper.php#L688-L702 |
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.