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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
210,900 | cakephp/cakephp | src/Controller/ComponentRegistry.php | ComponentRegistry._create | protected function _create($class, $alias, $config)
{
$instance = new $class($this, $config);
$enable = isset($config['enabled']) ? $config['enabled'] : true;
if ($enable) {
$this->getEventManager()->on($instance);
}
return $instance;
} | php | protected function _create($class, $alias, $config)
{
$instance = new $class($this, $config);
$enable = isset($config['enabled']) ? $config['enabled'] : true;
if ($enable) {
$this->getEventManager()->on($instance);
}
return $instance;
} | [
"protected",
"function",
"_create",
"(",
"$",
"class",
",",
"$",
"alias",
",",
"$",
"config",
")",
"{",
"$",
"instance",
"=",
"new",
"$",
"class",
"(",
"$",
"this",
",",
"$",
"config",
")",
";",
"$",
"enable",
"=",
"isset",
"(",
"$",
"config",
"[... | Create the component instance.
Part of the template method for Cake\Core\ObjectRegistry::load()
Enabled components will be registered with the event manager.
@param string $class The classname to create.
@param string $alias The alias of the component.
@param array $config An array of config to use for the component.... | [
"Create",
"the",
"component",
"instance",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/ComponentRegistry.php#L117-L126 |
210,901 | cakephp/cakephp | src/I18n/MessagesFileLoader.php | MessagesFileLoader.translationsFolders | public function translationsFolders()
{
$locale = Locale::parseLocale($this->_locale) + ['region' => null];
$folders = [
implode('_', [$locale['language'], $locale['region']]),
$locale['language']
];
$searchPaths = [];
$localePaths = App::path('Loca... | php | public function translationsFolders()
{
$locale = Locale::parseLocale($this->_locale) + ['region' => null];
$folders = [
implode('_', [$locale['language'], $locale['region']]),
$locale['language']
];
$searchPaths = [];
$localePaths = App::path('Loca... | [
"public",
"function",
"translationsFolders",
"(",
")",
"{",
"$",
"locale",
"=",
"Locale",
"::",
"parseLocale",
"(",
"$",
"this",
"->",
"_locale",
")",
"+",
"[",
"'region'",
"=>",
"null",
"]",
";",
"$",
"folders",
"=",
"[",
"implode",
"(",
"'_'",
",",
... | Returns the folders where the file should be looked for according to the locale
and package name.
@return array The list of folders where the translation file should be looked for | [
"Returns",
"the",
"folders",
"where",
"the",
"file",
"should",
"be",
"looked",
"for",
"according",
"to",
"the",
"locale",
"and",
"package",
"name",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/I18n/MessagesFileLoader.php#L151-L182 |
210,902 | cakephp/cakephp | src/Console/CommandScanner.php | CommandScanner.scanCore | public function scanCore()
{
$coreShells = $this->scanDir(
dirname(__DIR__) . DIRECTORY_SEPARATOR . 'Shell' . DIRECTORY_SEPARATOR,
'Cake\Shell\\',
'',
['command_list']
);
$coreCommands = $this->scanDir(
dirname(__DIR__) . DIRECTORY_... | php | public function scanCore()
{
$coreShells = $this->scanDir(
dirname(__DIR__) . DIRECTORY_SEPARATOR . 'Shell' . DIRECTORY_SEPARATOR,
'Cake\Shell\\',
'',
['command_list']
);
$coreCommands = $this->scanDir(
dirname(__DIR__) . DIRECTORY_... | [
"public",
"function",
"scanCore",
"(",
")",
"{",
"$",
"coreShells",
"=",
"$",
"this",
"->",
"scanDir",
"(",
"dirname",
"(",
"__DIR__",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"'Shell'",
".",
"DIRECTORY_SEPARATOR",
",",
"'Cake\\Shell\\\\'",
",",
"''",
",",
"[",... | Scan CakePHP internals for shells & commands.
@return array A list of command metadata. | [
"Scan",
"CakePHP",
"internals",
"for",
"shells",
"&",
"commands",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/CommandScanner.php#L36-L52 |
210,903 | cakephp/cakephp | src/Console/CommandScanner.php | CommandScanner.scanApp | public function scanApp()
{
$appNamespace = Configure::read('App.namespace');
$appShells = $this->scanDir(
App::path('Shell')[0],
$appNamespace . '\Shell\\',
'',
[]
);
$appCommands = $this->scanDir(
App::path('Command')[0],
... | php | public function scanApp()
{
$appNamespace = Configure::read('App.namespace');
$appShells = $this->scanDir(
App::path('Shell')[0],
$appNamespace . '\Shell\\',
'',
[]
);
$appCommands = $this->scanDir(
App::path('Command')[0],
... | [
"public",
"function",
"scanApp",
"(",
")",
"{",
"$",
"appNamespace",
"=",
"Configure",
"::",
"read",
"(",
"'App.namespace'",
")",
";",
"$",
"appShells",
"=",
"$",
"this",
"->",
"scanDir",
"(",
"App",
"::",
"path",
"(",
"'Shell'",
")",
"[",
"0",
"]",
... | Scan the application for shells & commands.
@return array A list of command metadata. | [
"Scan",
"the",
"application",
"for",
"shells",
"&",
"commands",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/CommandScanner.php#L59-L76 |
210,904 | cakephp/cakephp | src/Console/CommandScanner.php | CommandScanner.scanPlugin | public function scanPlugin($plugin)
{
if (!Plugin::isLoaded($plugin)) {
return [];
}
$path = Plugin::classPath($plugin);
$namespace = str_replace('/', '\\', $plugin);
$prefix = Inflector::underscore($plugin) . '.';
$commands = $this->scanDir($path . 'Comm... | php | public function scanPlugin($plugin)
{
if (!Plugin::isLoaded($plugin)) {
return [];
}
$path = Plugin::classPath($plugin);
$namespace = str_replace('/', '\\', $plugin);
$prefix = Inflector::underscore($plugin) . '.';
$commands = $this->scanDir($path . 'Comm... | [
"public",
"function",
"scanPlugin",
"(",
"$",
"plugin",
")",
"{",
"if",
"(",
"!",
"Plugin",
"::",
"isLoaded",
"(",
"$",
"plugin",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"path",
"=",
"Plugin",
"::",
"classPath",
"(",
"$",
"plugin",
")",
... | Scan the named plugin for shells and commands
@param string $plugin The named plugin.
@return array A list of command metadata. | [
"Scan",
"the",
"named",
"plugin",
"for",
"shells",
"and",
"commands"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/CommandScanner.php#L84-L97 |
210,905 | cakephp/cakephp | src/Routing/Route/DashedRoute.php | DashedRoute.parse | public function parse($url, $method = '')
{
$params = parent::parse($url, $method);
if (!$params) {
return false;
}
if (!empty($params['controller'])) {
$params['controller'] = Inflector::camelize($params['controller'], '-');
}
if (!empty($para... | php | public function parse($url, $method = '')
{
$params = parent::parse($url, $method);
if (!$params) {
return false;
}
if (!empty($params['controller'])) {
$params['controller'] = Inflector::camelize($params['controller'], '-');
}
if (!empty($para... | [
"public",
"function",
"parse",
"(",
"$",
"url",
",",
"$",
"method",
"=",
"''",
")",
"{",
"$",
"params",
"=",
"parent",
"::",
"parse",
"(",
"$",
"url",
",",
"$",
"method",
")",
";",
"if",
"(",
"!",
"$",
"params",
")",
"{",
"return",
"false",
";"... | Parses a string URL into an array. If it matches, it will convert the
controller and plugin keys to their CamelCased form and action key to
camelBacked form.
@param string $url The URL to parse
@param string $method The HTTP method.
@return array|false An array of request parameters, or false on failure. | [
"Parses",
"a",
"string",
"URL",
"into",
"an",
"array",
".",
"If",
"it",
"matches",
"it",
"will",
"convert",
"the",
"controller",
"and",
"plugin",
"keys",
"to",
"their",
"CamelCased",
"form",
"and",
"action",
"key",
"to",
"camelBacked",
"form",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/DashedRoute.php#L63-L84 |
210,906 | cakephp/cakephp | src/Routing/Route/DashedRoute.php | DashedRoute.match | public function match(array $url, array $context = [])
{
$url = $this->_dasherize($url);
if (!$this->_inflectedDefaults) {
$this->_inflectedDefaults = true;
$this->defaults = $this->_dasherize($this->defaults);
}
return parent::match($url, $context);
} | php | public function match(array $url, array $context = [])
{
$url = $this->_dasherize($url);
if (!$this->_inflectedDefaults) {
$this->_inflectedDefaults = true;
$this->defaults = $this->_dasherize($this->defaults);
}
return parent::match($url, $context);
} | [
"public",
"function",
"match",
"(",
"array",
"$",
"url",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"_dasherize",
"(",
"$",
"url",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_inflectedDefaults",
... | Dasherizes the controller, action and plugin params before passing them on
to the parent class.
@param array $url Array of parameters to convert to a string.
@param array $context An array of the current request context.
Contains information such as the current host, scheme, port, and base
directory.
@return bool|stri... | [
"Dasherizes",
"the",
"controller",
"action",
"and",
"plugin",
"params",
"before",
"passing",
"them",
"on",
"to",
"the",
"parent",
"class",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/DashedRoute.php#L96-L105 |
210,907 | cakephp/cakephp | src/Routing/Route/DashedRoute.php | DashedRoute._dasherize | protected function _dasherize($url)
{
foreach (['controller', 'plugin', 'action'] as $element) {
if (!empty($url[$element])) {
$url[$element] = Inflector::dasherize($url[$element]);
}
}
return $url;
} | php | protected function _dasherize($url)
{
foreach (['controller', 'plugin', 'action'] as $element) {
if (!empty($url[$element])) {
$url[$element] = Inflector::dasherize($url[$element]);
}
}
return $url;
} | [
"protected",
"function",
"_dasherize",
"(",
"$",
"url",
")",
"{",
"foreach",
"(",
"[",
"'controller'",
",",
"'plugin'",
",",
"'action'",
"]",
"as",
"$",
"element",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"url",
"[",
"$",
"element",
"]",
")",
"... | Helper method for dasherizing keys in a URL array.
@param array $url An array of URL keys.
@return array | [
"Helper",
"method",
"for",
"dasherizing",
"keys",
"in",
"a",
"URL",
"array",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Route/DashedRoute.php#L113-L122 |
210,908 | cakephp/cakephp | src/Console/ConsoleInput.php | ConsoleInput.read | public function read()
{
if ($this->_canReadline) {
$line = readline('');
if (strlen($line) > 0) {
readline_add_history($line);
}
return $line;
}
return fgets($this->_input);
} | php | public function read()
{
if ($this->_canReadline) {
$line = readline('');
if (strlen($line) > 0) {
readline_add_history($line);
}
return $line;
}
return fgets($this->_input);
} | [
"public",
"function",
"read",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_canReadline",
")",
"{",
"$",
"line",
"=",
"readline",
"(",
"''",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"line",
")",
">",
"0",
")",
"{",
"readline_add_history",
"(",
"... | Read a value from the stream
@return mixed The value of the stream | [
"Read",
"a",
"value",
"from",
"the",
"stream"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleInput.php#L57-L69 |
210,909 | cakephp/cakephp | src/Console/ConsoleInput.php | ConsoleInput.dataAvailable | public function dataAvailable($timeout = 0)
{
$readFds = [$this->_input];
$writeFds = null;
$errorFds = null;
$readyFds = stream_select($readFds, $writeFds, $errorFds, $timeout);
return ($readyFds > 0);
} | php | public function dataAvailable($timeout = 0)
{
$readFds = [$this->_input];
$writeFds = null;
$errorFds = null;
$readyFds = stream_select($readFds, $writeFds, $errorFds, $timeout);
return ($readyFds > 0);
} | [
"public",
"function",
"dataAvailable",
"(",
"$",
"timeout",
"=",
"0",
")",
"{",
"$",
"readFds",
"=",
"[",
"$",
"this",
"->",
"_input",
"]",
";",
"$",
"writeFds",
"=",
"null",
";",
"$",
"errorFds",
"=",
"null",
";",
"$",
"readyFds",
"=",
"stream_selec... | Check if data is available on stdin
@param int $timeout An optional time to wait for data
@return bool True for data available, false otherwise | [
"Check",
"if",
"data",
"is",
"available",
"on",
"stdin"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleInput.php#L77-L85 |
210,910 | cakephp/cakephp | src/Controller/Component/CookieComponent.php | CookieComponent.initialize | public function initialize(array $config)
{
if (!$this->_config['key']) {
$this->setConfig('key', Security::getSalt());
}
$controller = $this->_registry->getController();
if ($controller === null) {
$this->request = ServerRequestFactory::fromGlobals();
... | php | public function initialize(array $config)
{
if (!$this->_config['key']) {
$this->setConfig('key', Security::getSalt());
}
$controller = $this->_registry->getController();
if ($controller === null) {
$this->request = ServerRequestFactory::fromGlobals();
... | [
"public",
"function",
"initialize",
"(",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_config",
"[",
"'key'",
"]",
")",
"{",
"$",
"this",
"->",
"setConfig",
"(",
"'key'",
",",
"Security",
"::",
"getSalt",
"(",
")",
")",
";"... | Initialize config data and properties.
@param array $config The config data.
@return void | [
"Initialize",
"config",
"data",
"and",
"properties",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/CookieComponent.php#L119-L134 |
210,911 | cakephp/cakephp | src/Controller/Component/CookieComponent.php | CookieComponent.configKey | public function configKey($keyname, $option = null, $value = null)
{
if ($option === null) {
$default = $this->_config;
$local = isset($this->_keyConfig[$keyname]) ? $this->_keyConfig[$keyname] : [];
return $local + $default;
}
if (!is_array($option)) {
... | php | public function configKey($keyname, $option = null, $value = null)
{
if ($option === null) {
$default = $this->_config;
$local = isset($this->_keyConfig[$keyname]) ? $this->_keyConfig[$keyname] : [];
return $local + $default;
}
if (!is_array($option)) {
... | [
"public",
"function",
"configKey",
"(",
"$",
"keyname",
",",
"$",
"option",
"=",
"null",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"option",
"===",
"null",
")",
"{",
"$",
"default",
"=",
"$",
"this",
"->",
"_config",
";",
"$",
"lo... | Set the configuration for a specific top level key.
### Examples:
Set a single config option for a key:
```
$this->Cookie->configKey('User', 'expires', '+3 months');
```
Set multiple options:
```
$this->Cookie->configKey('User', [
'expires', '+3 months',
'httpOnly' => true,
]);
```
@param string $keyname The top ... | [
"Set",
"the",
"configuration",
"for",
"a",
"specific",
"top",
"level",
"key",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/CookieComponent.php#L162-L176 |
210,912 | cakephp/cakephp | src/Controller/Component/CookieComponent.php | CookieComponent.write | public function write($key, $value = null)
{
if (!is_array($key)) {
$key = [$key => $value];
}
$keys = [];
foreach ($key as $name => $value) {
$this->_load($name);
$this->_values = Hash::insert($this->_values, $name, $value);
$parts =... | php | public function write($key, $value = null)
{
if (!is_array($key)) {
$key = [$key => $value];
}
$keys = [];
foreach ($key as $name => $value) {
$this->_load($name);
$this->_values = Hash::insert($this->_values, $name, $value);
$parts =... | [
"public",
"function",
"write",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"$",
"key",
"=",
"[",
"$",
"key",
"=>",
"$",
"value",
"]",
";",
"}",
"$",
"keys",
"=",
"["... | Write a value to the response cookies.
You must use this method before any output is sent to the browser.
Failure to do so will result in header already sent errors.
@param string|array $key Key for the value
@param mixed $value Value
@return void | [
"Write",
"a",
"value",
"to",
"the",
"response",
"cookies",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/CookieComponent.php#L198-L216 |
210,913 | cakephp/cakephp | src/Controller/Component/CookieComponent.php | CookieComponent.read | public function read($key = null)
{
$this->_load($key);
return Hash::get($this->_values, $key);
} | php | public function read($key = null)
{
$this->_load($key);
return Hash::get($this->_values, $key);
} | [
"public",
"function",
"read",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_load",
"(",
"$",
"key",
")",
";",
"return",
"Hash",
"::",
"get",
"(",
"$",
"this",
"->",
"_values",
",",
"$",
"key",
")",
";",
"}"
] | Read the value of key path from request cookies.
This method will also allow you to read cookies that have been written in this
request, but not yet sent to the client.
@param string|null $key Key of the value to be obtained.
@return string or null, value for specified key | [
"Read",
"the",
"value",
"of",
"key",
"path",
"from",
"request",
"cookies",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/CookieComponent.php#L227-L232 |
210,914 | cakephp/cakephp | src/Controller/Component/CookieComponent.php | CookieComponent._load | protected function _load($key)
{
$parts = explode('.', $key);
$first = array_shift($parts);
if (isset($this->_loaded[$first])) {
return;
}
$cookie = $this->getController()->getRequest()->getCookie($first);
if ($cookie === null) {
return;
... | php | protected function _load($key)
{
$parts = explode('.', $key);
$first = array_shift($parts);
if (isset($this->_loaded[$first])) {
return;
}
$cookie = $this->getController()->getRequest()->getCookie($first);
if ($cookie === null) {
return;
... | [
"protected",
"function",
"_load",
"(",
"$",
"key",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"$",
"first",
"=",
"array_shift",
"(",
"$",
"parts",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_loaded"... | Load the cookie data from the request and response objects.
Based on the configuration data, cookies will be decrypted. When cookies
contain array data, that data will be expanded.
@param string|array $key The key to load.
@return void | [
"Load",
"the",
"cookie",
"data",
"from",
"the",
"request",
"and",
"response",
"objects",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/CookieComponent.php#L243-L257 |
210,915 | cakephp/cakephp | src/Controller/Component/CookieComponent.php | CookieComponent.check | public function check($key = null)
{
if (empty($key)) {
return false;
}
return $this->read($key) !== null;
} | php | public function check($key = null)
{
if (empty($key)) {
return false;
}
return $this->read($key) !== null;
} | [
"public",
"function",
"check",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"key",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"read",
"(",
"$",
"key",
")",
"!==",
"null",
";",
"}"
] | Returns true if given key is set in the cookie.
@param string|null $key Key to check for
@return bool True if the key exists | [
"Returns",
"true",
"if",
"given",
"key",
"is",
"set",
"in",
"the",
"cookie",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/CookieComponent.php#L265-L272 |
210,916 | cakephp/cakephp | src/Controller/Component/CookieComponent.php | CookieComponent.delete | public function delete($key)
{
$this->_load($key);
$this->_values = Hash::remove($this->_values, $key);
$parts = explode('.', $key);
$top = $parts[0];
if (isset($this->_values[$top])) {
$this->_write($top, $this->_values[$top]);
} else {
$thi... | php | public function delete($key)
{
$this->_load($key);
$this->_values = Hash::remove($this->_values, $key);
$parts = explode('.', $key);
$top = $parts[0];
if (isset($this->_values[$top])) {
$this->_write($top, $this->_values[$top]);
} else {
$thi... | [
"public",
"function",
"delete",
"(",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"_load",
"(",
"$",
"key",
")",
";",
"$",
"this",
"->",
"_values",
"=",
"Hash",
"::",
"remove",
"(",
"$",
"this",
"->",
"_values",
",",
"$",
"key",
")",
";",
"$",
"par... | Delete a cookie value
You must use this method before any output is sent to the browser.
Failure to do so will result in header already sent errors.
Deleting a top level key will delete all keys nested within that key.
For example deleting the `User` key, will also delete `User.email`.
@param string $key Key of the ... | [
"Delete",
"a",
"cookie",
"value"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/CookieComponent.php#L286-L299 |
210,917 | cakephp/cakephp | src/Controller/Component/CookieComponent.php | CookieComponent._delete | protected function _delete($name)
{
$config = $this->configKey($name);
$expires = new Time('now');
$controller = $this->getController();
$cookie = new Cookie(
$name,
'',
$expires,
$config['path'],
$config['domain'],
... | php | protected function _delete($name)
{
$config = $this->configKey($name);
$expires = new Time('now');
$controller = $this->getController();
$cookie = new Cookie(
$name,
'',
$expires,
$config['path'],
$config['domain'],
... | [
"protected",
"function",
"_delete",
"(",
"$",
"name",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"configKey",
"(",
"$",
"name",
")",
";",
"$",
"expires",
"=",
"new",
"Time",
"(",
"'now'",
")",
";",
"$",
"controller",
"=",
"$",
"this",
"->",
... | Sets a cookie expire time to remove cookie value.
This is only done once all values in a cookie key have been
removed with delete.
@param string $name Name of cookie
@return void | [
"Sets",
"a",
"cookie",
"expire",
"time",
"to",
"remove",
"cookie",
"value",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Component/CookieComponent.php#L337-L354 |
210,918 | cakephp/cakephp | src/Collection/Iterator/InsertIterator.php | InsertIterator.next | public function next()
{
parent::next();
if ($this->_validValues) {
$this->_values->next();
}
$this->_validValues = $this->_values->valid();
} | php | public function next()
{
parent::next();
if ($this->_validValues) {
$this->_values->next();
}
$this->_validValues = $this->_values->valid();
} | [
"public",
"function",
"next",
"(",
")",
"{",
"parent",
"::",
"next",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_validValues",
")",
"{",
"$",
"this",
"->",
"_values",
"->",
"next",
"(",
")",
";",
"}",
"$",
"this",
"->",
"_validValues",
"=",
"$... | Advances the cursor to the next record
@return void | [
"Advances",
"the",
"cursor",
"to",
"the",
"next",
"record"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Collection/Iterator/InsertIterator.php#L88-L95 |
210,919 | cakephp/cakephp | src/Collection/Iterator/InsertIterator.php | InsertIterator.current | public function current()
{
$row = parent::current();
if (!$this->_validValues) {
return $row;
}
$pointer =& $row;
foreach ($this->_path as $step) {
if (!isset($pointer[$step])) {
return $row;
}
$pointer =& $po... | php | public function current()
{
$row = parent::current();
if (!$this->_validValues) {
return $row;
}
$pointer =& $row;
foreach ($this->_path as $step) {
if (!isset($pointer[$step])) {
return $row;
}
$pointer =& $po... | [
"public",
"function",
"current",
"(",
")",
"{",
"$",
"row",
"=",
"parent",
"::",
"current",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_validValues",
")",
"{",
"return",
"$",
"row",
";",
"}",
"$",
"pointer",
"=",
"&",
"$",
"row",
";",
"... | Returns the current element in the target collection after inserting
the value from the source collection into the specified path.
@return mixed | [
"Returns",
"the",
"current",
"element",
"in",
"the",
"target",
"collection",
"after",
"inserting",
"the",
"value",
"from",
"the",
"source",
"collection",
"into",
"the",
"specified",
"path",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Collection/Iterator/InsertIterator.php#L103-L122 |
210,920 | cakephp/cakephp | src/Collection/Iterator/InsertIterator.php | InsertIterator.rewind | public function rewind()
{
parent::rewind();
$this->_values->rewind();
$this->_validValues = $this->_values->valid();
} | php | public function rewind()
{
parent::rewind();
$this->_values->rewind();
$this->_validValues = $this->_values->valid();
} | [
"public",
"function",
"rewind",
"(",
")",
"{",
"parent",
"::",
"rewind",
"(",
")",
";",
"$",
"this",
"->",
"_values",
"->",
"rewind",
"(",
")",
";",
"$",
"this",
"->",
"_validValues",
"=",
"$",
"this",
"->",
"_values",
"->",
"valid",
"(",
")",
";",... | Resets the collection pointer.
@return void | [
"Resets",
"the",
"collection",
"pointer",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Collection/Iterator/InsertIterator.php#L129-L134 |
210,921 | cakephp/cakephp | src/Database/Statement/StatementDecorator.php | StatementDecorator.execute | public function execute($params = null)
{
$this->_hasExecuted = true;
return $this->_statement->execute($params);
} | php | public function execute($params = null)
{
$this->_hasExecuted = true;
return $this->_statement->execute($params);
} | [
"public",
"function",
"execute",
"(",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_hasExecuted",
"=",
"true",
";",
"return",
"$",
"this",
"->",
"_statement",
"->",
"execute",
"(",
"$",
"params",
")",
";",
"}"
] | Executes the statement by sending the SQL query to the database. It can optionally
take an array or arguments to be bound to the query variables. Please note
that binding parameters from this method will not perform any custom type conversion
as it would normally happen when calling `bindValue`.
@param array|null $par... | [
"Executes",
"the",
"statement",
"by",
"sending",
"the",
"SQL",
"query",
"to",
"the",
"database",
".",
"It",
"can",
"optionally",
"take",
"an",
"array",
"or",
"arguments",
"to",
"be",
"bound",
"to",
"the",
"query",
"variables",
".",
"Please",
"note",
"that"... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Statement/StatementDecorator.php#L169-L174 |
210,922 | cakephp/cakephp | src/Database/Statement/StatementDecorator.php | StatementDecorator.bind | public function bind($params, $types)
{
if (empty($params)) {
return;
}
$anonymousParams = is_int(key($params)) ? true : false;
$offset = 1;
foreach ($params as $index => $value) {
$type = null;
if (isset($types[$index])) {
... | php | public function bind($params, $types)
{
if (empty($params)) {
return;
}
$anonymousParams = is_int(key($params)) ? true : false;
$offset = 1;
foreach ($params as $index => $value) {
$type = null;
if (isset($types[$index])) {
... | [
"public",
"function",
"bind",
"(",
"$",
"params",
",",
"$",
"types",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"params",
")",
")",
"{",
"return",
";",
"}",
"$",
"anonymousParams",
"=",
"is_int",
"(",
"key",
"(",
"$",
"params",
")",
")",
"?",
"true"... | Binds a set of values to statement object with corresponding type.
@param array $params list of values to be bound
@param array $types list of types to be used, keys should match those in $params
@return void | [
"Binds",
"a",
"set",
"of",
"values",
"to",
"statement",
"object",
"with",
"corresponding",
"type",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Statement/StatementDecorator.php#L306-L324 |
210,923 | cakephp/cakephp | src/Database/Statement/StatementDecorator.php | StatementDecorator.lastInsertId | public function lastInsertId($table = null, $column = null)
{
$row = null;
if ($column && $this->columnCount()) {
$row = $this->fetch(static::FETCH_TYPE_ASSOC);
}
if (isset($row[$column])) {
return $row[$column];
}
return $this->_driver->lastI... | php | public function lastInsertId($table = null, $column = null)
{
$row = null;
if ($column && $this->columnCount()) {
$row = $this->fetch(static::FETCH_TYPE_ASSOC);
}
if (isset($row[$column])) {
return $row[$column];
}
return $this->_driver->lastI... | [
"public",
"function",
"lastInsertId",
"(",
"$",
"table",
"=",
"null",
",",
"$",
"column",
"=",
"null",
")",
"{",
"$",
"row",
"=",
"null",
";",
"if",
"(",
"$",
"column",
"&&",
"$",
"this",
"->",
"columnCount",
"(",
")",
")",
"{",
"$",
"row",
"=",
... | Returns the latest primary inserted using this statement.
@param string|null $table table name or sequence to get last insert value from
@param string|null $column the name of the column representing the primary key
@return string|int | [
"Returns",
"the",
"latest",
"primary",
"inserted",
"using",
"this",
"statement",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Statement/StatementDecorator.php#L333-L344 |
210,924 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.buildFromArray | public static function buildFromArray($spec, $defaultOptions = true)
{
$parser = new static($spec['command'], $defaultOptions);
if (!empty($spec['arguments'])) {
$parser->addArguments($spec['arguments']);
}
if (!empty($spec['options'])) {
$parser->addOptions($... | php | public static function buildFromArray($spec, $defaultOptions = true)
{
$parser = new static($spec['command'], $defaultOptions);
if (!empty($spec['arguments'])) {
$parser->addArguments($spec['arguments']);
}
if (!empty($spec['options'])) {
$parser->addOptions($... | [
"public",
"static",
"function",
"buildFromArray",
"(",
"$",
"spec",
",",
"$",
"defaultOptions",
"=",
"true",
")",
"{",
"$",
"parser",
"=",
"new",
"static",
"(",
"$",
"spec",
"[",
"'command'",
"]",
",",
"$",
"defaultOptions",
")",
";",
"if",
"(",
"!",
... | Build a parser from an array. Uses an array like
```
$spec = [
'description' => 'text',
'epilog' => 'text',
'arguments' => [
// list of arguments compatible with addArguments.
],
'options' => [
// list of options compatible with addOptions
],
'subcommands' => [
// list of subcommands to add.
]
];
```
@param array $sp... | [
"Build",
"a",
"parser",
"from",
"an",
"array",
".",
"Uses",
"an",
"array",
"like"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L217-L237 |
210,925 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.toArray | public function toArray()
{
$result = [
'command' => $this->_command,
'arguments' => $this->_args,
'options' => $this->_options,
'subcommands' => $this->_subcommands,
'description' => $this->_description,
'epilog' => $this->_epilog
... | php | public function toArray()
{
$result = [
'command' => $this->_command,
'arguments' => $this->_args,
'options' => $this->_options,
'subcommands' => $this->_subcommands,
'description' => $this->_description,
'epilog' => $this->_epilog
... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"'command'",
"=>",
"$",
"this",
"->",
"_command",
",",
"'arguments'",
"=>",
"$",
"this",
"->",
"_args",
",",
"'options'",
"=>",
"$",
"this",
"->",
"_options",
",",
"'subcommands'",
... | Returns an array representation of this parser.
@return array | [
"Returns",
"an",
"array",
"representation",
"of",
"this",
"parser",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L244-L256 |
210,926 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.setEpilog | public function setEpilog($text)
{
if (is_array($text)) {
$text = implode("\n", $text);
}
$this->_epilog = $text;
return $this;
} | php | public function setEpilog($text)
{
if (is_array($text)) {
$text = implode("\n", $text);
}
$this->_epilog = $text;
return $this;
} | [
"public",
"function",
"setEpilog",
"(",
"$",
"text",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"text",
")",
")",
"{",
"$",
"text",
"=",
"implode",
"(",
"\"\\n\"",
",",
"$",
"text",
")",
";",
"}",
"$",
"this",
"->",
"_epilog",
"=",
"$",
"text",
... | Sets an epilog to the parser. The epilog is added to the end of
the options and arguments listing when help is generated.
@param string|array $text The text to set. If an array the text will
be imploded with "\n".
@return $this | [
"Sets",
"an",
"epilog",
"to",
"the",
"parser",
".",
"The",
"epilog",
"is",
"added",
"to",
"the",
"end",
"of",
"the",
"options",
"and",
"arguments",
"listing",
"when",
"help",
"is",
"generated",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L387-L395 |
210,927 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.epilog | public function epilog($text = null)
{
deprecationWarning(
'ConsoleOptionParser::epliog() is deprecated. ' .
'Use ConsoleOptionParser::setEpilog()/getEpilog() instead.'
);
if ($text !== null) {
return $this->setEpilog($text);
}
return $thi... | php | public function epilog($text = null)
{
deprecationWarning(
'ConsoleOptionParser::epliog() is deprecated. ' .
'Use ConsoleOptionParser::setEpilog()/getEpilog() instead.'
);
if ($text !== null) {
return $this->setEpilog($text);
}
return $thi... | [
"public",
"function",
"epilog",
"(",
"$",
"text",
"=",
"null",
")",
"{",
"deprecationWarning",
"(",
"'ConsoleOptionParser::epliog() is deprecated. '",
".",
"'Use ConsoleOptionParser::setEpilog()/getEpilog() instead.'",
")",
";",
"if",
"(",
"$",
"text",
"!==",
"null",
")... | Gets or sets an epilog to the parser. The epilog is added to the end of
the options and arguments listing when help is generated.
@deprecated 3.4.0 Use setEpilog()/getEpilog() instead.
@param string|array|null $text Text when setting or null when reading. If an array the text will
be imploded with "\n".
@return string... | [
"Gets",
"or",
"sets",
"an",
"epilog",
"to",
"the",
"parser",
".",
"The",
"epilog",
"is",
"added",
"to",
"the",
"end",
"of",
"the",
"options",
"and",
"arguments",
"listing",
"when",
"help",
"is",
"generated",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L416-L427 |
210,928 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.addOption | public function addOption($name, array $options = [])
{
if ($name instanceof ConsoleInputOption) {
$option = $name;
$name = $option->name();
} else {
$defaults = [
'name' => $name,
'short' => null,
'help' => '',
... | php | public function addOption($name, array $options = [])
{
if ($name instanceof ConsoleInputOption) {
$option = $name;
$name = $option->name();
} else {
$defaults = [
'name' => $name,
'short' => null,
'help' => '',
... | [
"public",
"function",
"addOption",
"(",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"name",
"instanceof",
"ConsoleInputOption",
")",
"{",
"$",
"option",
"=",
"$",
"name",
";",
"$",
"name",
"=",
"$",
"option",
... | Add an option to the option parser. Options allow you to define optional or required
parameters for your console application. Options are defined by the parameters they use.
### Options
- `short` - The single letter variant for this option, leave undefined for none.
- `help` - Help text for this option. Used when gen... | [
"Add",
"an",
"option",
"to",
"the",
"option",
"parser",
".",
"Options",
"allow",
"you",
"to",
"define",
"optional",
"or",
"required",
"parameters",
"for",
"your",
"console",
"application",
".",
"Options",
"are",
"defined",
"by",
"the",
"parameters",
"they",
... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L476-L501 |
210,929 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.addArgument | public function addArgument($name, array $params = [])
{
if ($name instanceof ConsoleInputArgument) {
$arg = $name;
$index = count($this->_args);
} else {
$defaults = [
'name' => $name,
'help' => '',
'index' => count... | php | public function addArgument($name, array $params = [])
{
if ($name instanceof ConsoleInputArgument) {
$arg = $name;
$index = count($this->_args);
} else {
$defaults = [
'name' => $name,
'help' => '',
'index' => count... | [
"public",
"function",
"addArgument",
"(",
"$",
"name",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"name",
"instanceof",
"ConsoleInputArgument",
")",
"{",
"$",
"arg",
"=",
"$",
"name",
";",
"$",
"index",
"=",
"count",
"(",
... | Add a positional argument to the option parser.
### Params
- `help` The help text to display for this argument.
- `required` Whether this parameter is required.
- `index` The index for the arg, if left undefined the argument will be put
onto the end of the arguments. If you define the same index twice the first
optio... | [
"Add",
"a",
"positional",
"argument",
"to",
"the",
"option",
"parser",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L534-L564 |
210,930 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.addArguments | public function addArguments(array $args)
{
foreach ($args as $name => $params) {
if ($params instanceof ConsoleInputArgument) {
$name = $params;
$params = [];
}
$this->addArgument($name, $params);
}
return $this;
} | php | public function addArguments(array $args)
{
foreach ($args as $name => $params) {
if ($params instanceof ConsoleInputArgument) {
$name = $params;
$params = [];
}
$this->addArgument($name, $params);
}
return $this;
} | [
"public",
"function",
"addArguments",
"(",
"array",
"$",
"args",
")",
"{",
"foreach",
"(",
"$",
"args",
"as",
"$",
"name",
"=>",
"$",
"params",
")",
"{",
"if",
"(",
"$",
"params",
"instanceof",
"ConsoleInputArgument",
")",
"{",
"$",
"name",
"=",
"$",
... | Add multiple arguments at once. Take an array of argument definitions.
The keys are used as the argument names, and the values as params for the argument.
@param array $args Array of arguments to add.
@see \Cake\Console\ConsoleOptionParser::addArgument()
@return $this | [
"Add",
"multiple",
"arguments",
"at",
"once",
".",
"Take",
"an",
"array",
"of",
"argument",
"definitions",
".",
"The",
"keys",
"are",
"used",
"as",
"the",
"argument",
"names",
"and",
"the",
"values",
"as",
"params",
"for",
"the",
"argument",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L574-L585 |
210,931 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.addOptions | public function addOptions(array $options)
{
foreach ($options as $name => $params) {
if ($params instanceof ConsoleInputOption) {
$name = $params;
$params = [];
}
$this->addOption($name, $params);
}
return $this;
} | php | public function addOptions(array $options)
{
foreach ($options as $name => $params) {
if ($params instanceof ConsoleInputOption) {
$name = $params;
$params = [];
}
$this->addOption($name, $params);
}
return $this;
} | [
"public",
"function",
"addOptions",
"(",
"array",
"$",
"options",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"name",
"=>",
"$",
"params",
")",
"{",
"if",
"(",
"$",
"params",
"instanceof",
"ConsoleInputOption",
")",
"{",
"$",
"name",
"=",
"$",... | Add multiple options at once. Takes an array of option definitions.
The keys are used as option names, and the values as params for the option.
@param array $options Array of options to add.
@see \Cake\Console\ConsoleOptionParser::addOption()
@return $this | [
"Add",
"multiple",
"options",
"at",
"once",
".",
"Takes",
"an",
"array",
"of",
"option",
"definitions",
".",
"The",
"keys",
"are",
"used",
"as",
"option",
"names",
"and",
"the",
"values",
"as",
"params",
"for",
"the",
"option",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L595-L606 |
210,932 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.addSubcommand | public function addSubcommand($name, array $options = [])
{
if ($name instanceof ConsoleInputSubcommand) {
$command = $name;
$name = $command->name();
} else {
$name = Inflector::underscore($name);
$defaults = [
'name' => $name,
... | php | public function addSubcommand($name, array $options = [])
{
if ($name instanceof ConsoleInputSubcommand) {
$command = $name;
$name = $command->name();
} else {
$name = Inflector::underscore($name);
$defaults = [
'name' => $name,
... | [
"public",
"function",
"addSubcommand",
"(",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"name",
"instanceof",
"ConsoleInputSubcommand",
")",
"{",
"$",
"command",
"=",
"$",
"name",
";",
"$",
"name",
"=",
"$",
"c... | Append a subcommand to the subcommand list.
Subcommands are usually methods on your Shell, but can also be used to document Tasks.
### Options
- `help` - Help text for the subcommand.
- `parser` - A ConsoleOptionParser for the subcommand. This allows you to create method
specific option parsers. When help is generate... | [
"Append",
"a",
"subcommand",
"to",
"the",
"subcommand",
"list",
".",
"Subcommands",
"are",
"usually",
"methods",
"on",
"your",
"Shell",
"but",
"can",
"also",
"be",
"used",
"to",
"document",
"Tasks",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L623-L645 |
210,933 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.addSubcommands | public function addSubcommands(array $commands)
{
foreach ($commands as $name => $params) {
if ($params instanceof ConsoleInputSubcommand) {
$name = $params;
$params = [];
}
$this->addSubcommand($name, $params);
}
return $t... | php | public function addSubcommands(array $commands)
{
foreach ($commands as $name => $params) {
if ($params instanceof ConsoleInputSubcommand) {
$name = $params;
$params = [];
}
$this->addSubcommand($name, $params);
}
return $t... | [
"public",
"function",
"addSubcommands",
"(",
"array",
"$",
"commands",
")",
"{",
"foreach",
"(",
"$",
"commands",
"as",
"$",
"name",
"=>",
"$",
"params",
")",
"{",
"if",
"(",
"$",
"params",
"instanceof",
"ConsoleInputSubcommand",
")",
"{",
"$",
"name",
"... | Add multiple subcommands at once.
@param array $commands Array of subcommands.
@return $this | [
"Add",
"multiple",
"subcommands",
"at",
"once",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L666-L677 |
210,934 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.argumentNames | public function argumentNames()
{
$out = [];
foreach ($this->_args as $arg) {
$out[] = $arg->name();
}
return $out;
} | php | public function argumentNames()
{
$out = [];
foreach ($this->_args as $arg) {
$out[] = $arg->name();
}
return $out;
} | [
"public",
"function",
"argumentNames",
"(",
")",
"{",
"$",
"out",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"_args",
"as",
"$",
"arg",
")",
"{",
"$",
"out",
"[",
"]",
"=",
"$",
"arg",
"->",
"name",
"(",
")",
";",
"}",
"return",
"... | Get the list of argument names.
@return string[] | [
"Get",
"the",
"list",
"of",
"argument",
"names",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L694-L702 |
210,935 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.help | public function help($subcommand = null, $format = 'text', $width = 72)
{
if ($subcommand === null) {
$formatter = new HelpFormatter($this);
$formatter->setAlias($this->rootName);
if ($format === 'text') {
return $formatter->text($width);
}
... | php | public function help($subcommand = null, $format = 'text', $width = 72)
{
if ($subcommand === null) {
$formatter = new HelpFormatter($this);
$formatter->setAlias($this->rootName);
if ($format === 'text') {
return $formatter->text($width);
}
... | [
"public",
"function",
"help",
"(",
"$",
"subcommand",
"=",
"null",
",",
"$",
"format",
"=",
"'text'",
",",
"$",
"width",
"=",
"72",
")",
"{",
"if",
"(",
"$",
"subcommand",
"===",
"null",
")",
"{",
"$",
"formatter",
"=",
"new",
"HelpFormatter",
"(",
... | Gets formatted help for this parser object.
Generates help text based on the description, options, arguments, subcommands and epilog
in the parser.
@param string|null $subcommand If present and a valid subcommand that has a linked parser.
That subcommands help will be shown instead.
@param string $format Define the o... | [
"Gets",
"formatted",
"help",
"for",
"this",
"parser",
"object",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L791-L828 |
210,936 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.getCommandError | protected function getCommandError($command)
{
$rootCommand = $this->getCommand();
$subcommands = array_keys((array)$this->subcommands());
$bestGuess = $this->findClosestItem($command, $subcommands);
$out = [
sprintf(
'Unable to find the `%s %s` subcomman... | php | protected function getCommandError($command)
{
$rootCommand = $this->getCommand();
$subcommands = array_keys((array)$this->subcommands());
$bestGuess = $this->findClosestItem($command, $subcommands);
$out = [
sprintf(
'Unable to find the `%s %s` subcomman... | [
"protected",
"function",
"getCommandError",
"(",
"$",
"command",
")",
"{",
"$",
"rootCommand",
"=",
"$",
"this",
"->",
"getCommand",
"(",
")",
";",
"$",
"subcommands",
"=",
"array_keys",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"subcommands",
"(",
")",... | Get the message output in the console stating that the command can not be found and tries to guess what the user
wanted to say. Output a list of available subcommands as well.
@param string $command Unknown command name trying to be dispatched.
@return string The message to be displayed in the console. | [
"Get",
"the",
"message",
"output",
"in",
"the",
"console",
"stating",
"that",
"the",
"command",
"can",
"not",
"be",
"found",
"and",
"tries",
"to",
"guess",
"what",
"the",
"user",
"wanted",
"to",
"say",
".",
"Output",
"a",
"list",
"of",
"available",
"subc... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L866-L894 |
210,937 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.getOptionError | protected function getOptionError($option)
{
$availableOptions = array_keys($this->_options);
$bestGuess = $this->findClosestItem($option, $availableOptions);
$out = [
sprintf('Unknown option `%s`.', $option),
''
];
if ($bestGuess !== null) {
... | php | protected function getOptionError($option)
{
$availableOptions = array_keys($this->_options);
$bestGuess = $this->findClosestItem($option, $availableOptions);
$out = [
sprintf('Unknown option `%s`.', $option),
''
];
if ($bestGuess !== null) {
... | [
"protected",
"function",
"getOptionError",
"(",
"$",
"option",
")",
"{",
"$",
"availableOptions",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"_options",
")",
";",
"$",
"bestGuess",
"=",
"$",
"this",
"->",
"findClosestItem",
"(",
"$",
"option",
",",
"$",
... | Get the message output in the console stating that the option can not be found and tries to guess what the user
wanted to say. Output a list of available options as well.
@param string $option Unknown option name trying to be used.
@return string The message to be displayed in the console. | [
"Get",
"the",
"message",
"output",
"in",
"the",
"console",
"stating",
"that",
"the",
"option",
"can",
"not",
"be",
"found",
"and",
"tries",
"to",
"guess",
"what",
"the",
"user",
"wanted",
"to",
"say",
".",
"Output",
"a",
"list",
"of",
"available",
"optio... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L903-L924 |
210,938 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.getShortOptionError | protected function getShortOptionError($option)
{
$out = [sprintf('Unknown short option `%s`', $option)];
$out[] = '';
$out[] = 'Available short options are :';
$out[] = '';
foreach ($this->_shortOptions as $short => $long) {
$out[] = sprintf(' - `%s` (short for ... | php | protected function getShortOptionError($option)
{
$out = [sprintf('Unknown short option `%s`', $option)];
$out[] = '';
$out[] = 'Available short options are :';
$out[] = '';
foreach ($this->_shortOptions as $short => $long) {
$out[] = sprintf(' - `%s` (short for ... | [
"protected",
"function",
"getShortOptionError",
"(",
"$",
"option",
")",
"{",
"$",
"out",
"=",
"[",
"sprintf",
"(",
"'Unknown short option `%s`'",
",",
"$",
"option",
")",
"]",
";",
"$",
"out",
"[",
"]",
"=",
"''",
";",
"$",
"out",
"[",
"]",
"=",
"'A... | Get the message output in the console stating that the short option can not be found. Output a list of available
short options and what option they refer to as well.
@param string $option Unknown short option name trying to be used.
@return string The message to be displayed in the console. | [
"Get",
"the",
"message",
"output",
"in",
"the",
"console",
"stating",
"that",
"the",
"short",
"option",
"can",
"not",
"be",
"found",
".",
"Output",
"a",
"list",
"of",
"available",
"short",
"options",
"and",
"what",
"option",
"they",
"refer",
"to",
"as",
... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L933-L945 |
210,939 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser.findClosestItem | protected function findClosestItem($needle, $haystack)
{
$bestGuess = null;
foreach ($haystack as $item) {
if (preg_match('/^' . $needle . '/', $item)) {
return $item;
}
}
foreach ($haystack as $item) {
if (preg_match('/' . $needle... | php | protected function findClosestItem($needle, $haystack)
{
$bestGuess = null;
foreach ($haystack as $item) {
if (preg_match('/^' . $needle . '/', $item)) {
return $item;
}
}
foreach ($haystack as $item) {
if (preg_match('/' . $needle... | [
"protected",
"function",
"findClosestItem",
"(",
"$",
"needle",
",",
"$",
"haystack",
")",
"{",
"$",
"bestGuess",
"=",
"null",
";",
"foreach",
"(",
"$",
"haystack",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^'",
".",
"$",
"needle",
... | Tries to guess the item name the user originally wanted using the some regex pattern and the levenshtein
algorithm.
@param string $needle Unknown item (either a subcommand name or an option for instance) trying to be used.
@param string[] $haystack List of items available for the type $needle belongs to.
@return strin... | [
"Tries",
"to",
"guess",
"the",
"item",
"name",
"the",
"user",
"originally",
"wanted",
"using",
"the",
"some",
"regex",
"pattern",
"and",
"the",
"levenshtein",
"algorithm",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L955-L978 |
210,940 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser._parseOption | protected function _parseOption($name, $params)
{
if (!isset($this->_options[$name])) {
throw new ConsoleException($this->getOptionError($name));
}
$option = $this->_options[$name];
$isBoolean = $option->isBoolean();
$nextValue = $this->_nextToken();
$empt... | php | protected function _parseOption($name, $params)
{
if (!isset($this->_options[$name])) {
throw new ConsoleException($this->getOptionError($name));
}
$option = $this->_options[$name];
$isBoolean = $option->isBoolean();
$nextValue = $this->_nextToken();
$empt... | [
"protected",
"function",
"_parseOption",
"(",
"$",
"name",
",",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_options",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"ConsoleException",
"(",
"$",
"this",
"->",
... | Parse an option by its name index.
@param string $name The name to parse.
@param array $params The params to append the parsed value into
@return array Params with $option added in.
@throws \Cake\Console\Exception\ConsoleException | [
"Parse",
"an",
"option",
"by",
"its",
"name",
"index",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L1035-L1063 |
210,941 | cakephp/cakephp | src/Console/ConsoleOptionParser.php | ConsoleOptionParser._parseArg | protected function _parseArg($argument, $args)
{
if (empty($this->_args)) {
$args[] = $argument;
return $args;
}
$next = count($args);
if (!isset($this->_args[$next])) {
throw new ConsoleException('Too many arguments.');
}
if ($th... | php | protected function _parseArg($argument, $args)
{
if (empty($this->_args)) {
$args[] = $argument;
return $args;
}
$next = count($args);
if (!isset($this->_args[$next])) {
throw new ConsoleException('Too many arguments.');
}
if ($th... | [
"protected",
"function",
"_parseArg",
"(",
"$",
"argument",
",",
"$",
"args",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_args",
")",
")",
"{",
"$",
"args",
"[",
"]",
"=",
"$",
"argument",
";",
"return",
"$",
"args",
";",
"}",
"$",
... | Parse an argument, and ensure that the argument doesn't exceed the number of arguments
and that the argument is a valid choice.
@param string $argument The argument to append
@param array $args The array of parsed args to append to.
@return string[] Args
@throws \Cake\Console\Exception\ConsoleException | [
"Parse",
"an",
"argument",
"and",
"ensure",
"that",
"the",
"argument",
"doesn",
"t",
"exceed",
"the",
"number",
"of",
"arguments",
"and",
"that",
"the",
"argument",
"is",
"a",
"valid",
"choice",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Console/ConsoleOptionParser.php#L1092-L1109 |
210,942 | cakephp/cakephp | src/Database/Schema/CachedCollection.php | CachedCollection.cacheMetadata | public function cacheMetadata($enable = null)
{
deprecationWarning(
'CachedCollection::cacheMetadata() is deprecated. ' .
'Use CachedCollection::setCacheMetadata()/getCacheMetadata() instead.'
);
if ($enable !== null) {
$this->setCacheMetadata($enable);
... | php | public function cacheMetadata($enable = null)
{
deprecationWarning(
'CachedCollection::cacheMetadata() is deprecated. ' .
'Use CachedCollection::setCacheMetadata()/getCacheMetadata() instead.'
);
if ($enable !== null) {
$this->setCacheMetadata($enable);
... | [
"public",
"function",
"cacheMetadata",
"(",
"$",
"enable",
"=",
"null",
")",
"{",
"deprecationWarning",
"(",
"'CachedCollection::cacheMetadata() is deprecated. '",
".",
"'Use CachedCollection::setCacheMetadata()/getCacheMetadata() instead.'",
")",
";",
"if",
"(",
"$",
"enable... | Sets the cache config name to use for caching table metadata, or
disables it if false is passed.
If called with no arguments it returns the current configuration name.
@deprecated 3.4.0 Use setCacheMetadata()/getCacheMetadata()
@param bool|null $enable Whether or not to enable caching
@return string|bool | [
"Sets",
"the",
"cache",
"config",
"name",
"to",
"use",
"for",
"caching",
"table",
"metadata",
"or",
"disables",
"it",
"if",
"false",
"is",
"passed",
".",
"If",
"called",
"with",
"no",
"arguments",
"it",
"returns",
"the",
"current",
"configuration",
"name",
... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Schema/CachedCollection.php#L120-L131 |
210,943 | cakephp/cakephp | src/Error/ExceptionRenderer.php | ExceptionRenderer._getController | protected function _getController()
{
$request = $this->request;
$routerRequest = Router::getRequest(true);
// Fallback to the request in the router or make a new one from
// $_SERVER
if ($request === null) {
$request = $routerRequest ?: ServerRequestFactory::from... | php | protected function _getController()
{
$request = $this->request;
$routerRequest = Router::getRequest(true);
// Fallback to the request in the router or make a new one from
// $_SERVER
if ($request === null) {
$request = $routerRequest ?: ServerRequestFactory::from... | [
"protected",
"function",
"_getController",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"request",
";",
"$",
"routerRequest",
"=",
"Router",
"::",
"getRequest",
"(",
"true",
")",
";",
"// Fallback to the request in the router or make a new one from",
"// $... | Get the controller instance to handle the exception.
Override this method in subclasses to customize the controller used.
This method returns the built in `ErrorController` normally, or if an error is repeated
a bare controller will be used.
@return \Cake\Controller\Controller
@triggers Controller.startup $controller | [
"Get",
"the",
"controller",
"instance",
"to",
"handle",
"the",
"exception",
".",
"Override",
"this",
"method",
"in",
"subclasses",
"to",
"customize",
"the",
"controller",
"used",
".",
"This",
"method",
"returns",
"the",
"built",
"in",
"ErrorController",
"normall... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Error/ExceptionRenderer.php#L126-L188 |
210,944 | cakephp/cakephp | src/Error/ExceptionRenderer.php | ExceptionRenderer.render | public function render()
{
$exception = $this->error;
$code = $this->_code($exception);
$method = $this->_method($exception);
$template = $this->_template($exception, $method, $code);
$unwrapped = $this->_unwrap($exception);
if (method_exists($this, $method)) {
... | php | public function render()
{
$exception = $this->error;
$code = $this->_code($exception);
$method = $this->_method($exception);
$template = $this->_template($exception, $method, $code);
$unwrapped = $this->_unwrap($exception);
if (method_exists($this, $method)) {
... | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"exception",
"=",
"$",
"this",
"->",
"error",
";",
"$",
"code",
"=",
"$",
"this",
"->",
"_code",
"(",
"$",
"exception",
")",
";",
"$",
"method",
"=",
"$",
"this",
"->",
"_method",
"(",
"$",
"exc... | Renders the response for the exception.
@return \Cake\Http\Response The response to be sent. | [
"Renders",
"the",
"response",
"for",
"the",
"exception",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Error/ExceptionRenderer.php#L195-L245 |
210,945 | cakephp/cakephp | src/Error/ExceptionRenderer.php | ExceptionRenderer._method | protected function _method(Exception $exception)
{
$exception = $this->_unwrap($exception);
list(, $baseClass) = namespaceSplit(get_class($exception));
if (substr($baseClass, -9) === 'Exception') {
$baseClass = substr($baseClass, 0, -9);
}
$method = Inflector::v... | php | protected function _method(Exception $exception)
{
$exception = $this->_unwrap($exception);
list(, $baseClass) = namespaceSplit(get_class($exception));
if (substr($baseClass, -9) === 'Exception') {
$baseClass = substr($baseClass, 0, -9);
}
$method = Inflector::v... | [
"protected",
"function",
"_method",
"(",
"Exception",
"$",
"exception",
")",
"{",
"$",
"exception",
"=",
"$",
"this",
"->",
"_unwrap",
"(",
"$",
"exception",
")",
";",
"list",
"(",
",",
"$",
"baseClass",
")",
"=",
"namespaceSplit",
"(",
"get_class",
"(",... | Get method name
@param \Exception $exception Exception instance.
@return string | [
"Get",
"method",
"name"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Error/ExceptionRenderer.php#L271-L283 |
210,946 | cakephp/cakephp | src/Error/ExceptionRenderer.php | ExceptionRenderer._template | protected function _template(Exception $exception, $method, $code)
{
$exception = $this->_unwrap($exception);
$isHttpException = $exception instanceof HttpException;
if (!Configure::read('debug') && !$isHttpException || $isHttpException) {
$template = 'error500';
if ... | php | protected function _template(Exception $exception, $method, $code)
{
$exception = $this->_unwrap($exception);
$isHttpException = $exception instanceof HttpException;
if (!Configure::read('debug') && !$isHttpException || $isHttpException) {
$template = 'error500';
if ... | [
"protected",
"function",
"_template",
"(",
"Exception",
"$",
"exception",
",",
"$",
"method",
",",
"$",
"code",
")",
"{",
"$",
"exception",
"=",
"$",
"this",
"->",
"_unwrap",
"(",
"$",
"exception",
")",
";",
"$",
"isHttpException",
"=",
"$",
"exception",... | Get template for rendering exception info.
@param \Exception $exception Exception instance.
@param string $method Method name.
@param int $code Error code.
@return string Template name | [
"Get",
"template",
"for",
"rendering",
"exception",
"info",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Error/ExceptionRenderer.php#L318-L339 |
210,947 | cakephp/cakephp | src/Error/ExceptionRenderer.php | ExceptionRenderer._code | protected function _code(Exception $exception)
{
$code = 500;
$exception = $this->_unwrap($exception);
$errorCode = $exception->getCode();
if ($errorCode >= 400 && $errorCode < 600) {
$code = $errorCode;
}
return $code;
} | php | protected function _code(Exception $exception)
{
$code = 500;
$exception = $this->_unwrap($exception);
$errorCode = $exception->getCode();
if ($errorCode >= 400 && $errorCode < 600) {
$code = $errorCode;
}
return $code;
} | [
"protected",
"function",
"_code",
"(",
"Exception",
"$",
"exception",
")",
"{",
"$",
"code",
"=",
"500",
";",
"$",
"exception",
"=",
"$",
"this",
"->",
"_unwrap",
"(",
"$",
"exception",
")",
";",
"$",
"errorCode",
"=",
"$",
"exception",
"->",
"getCode"... | Get HTTP status code.
@param \Exception $exception Exception.
@return int A valid HTTP error status code. | [
"Get",
"HTTP",
"status",
"code",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Error/ExceptionRenderer.php#L347-L358 |
210,948 | cakephp/cakephp | src/Error/ExceptionRenderer.php | ExceptionRenderer._outputMessageSafe | protected function _outputMessageSafe($template)
{
$helpers = ['Form', 'Html'];
$this->controller->helpers = $helpers;
$builder = $this->controller->viewBuilder();
$builder->setHelpers($helpers, false)
->setLayoutPath('')
->setTemplatePath('Error');
$v... | php | protected function _outputMessageSafe($template)
{
$helpers = ['Form', 'Html'];
$this->controller->helpers = $helpers;
$builder = $this->controller->viewBuilder();
$builder->setHelpers($helpers, false)
->setLayoutPath('')
->setTemplatePath('Error');
$v... | [
"protected",
"function",
"_outputMessageSafe",
"(",
"$",
"template",
")",
"{",
"$",
"helpers",
"=",
"[",
"'Form'",
",",
"'Html'",
"]",
";",
"$",
"this",
"->",
"controller",
"->",
"helpers",
"=",
"$",
"helpers",
";",
"$",
"builder",
"=",
"$",
"this",
"-... | A safer way to render error messages, replaces all helpers, with basics
and doesn't call component methods.
@param string $template The template to render.
@return \Cake\Http\Response A response object that can be sent. | [
"A",
"safer",
"way",
"to",
"render",
"error",
"messages",
"replaces",
"all",
"helpers",
"with",
"basics",
"and",
"doesn",
"t",
"call",
"component",
"methods",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Error/ExceptionRenderer.php#L398-L413 |
210,949 | cakephp/cakephp | src/Error/ExceptionRenderer.php | ExceptionRenderer._shutdown | protected function _shutdown()
{
$this->controller->dispatchEvent('Controller.shutdown');
$dispatcher = DispatcherFactory::create();
$eventManager = $dispatcher->getEventManager();
foreach ($dispatcher->filters() as $filter) {
$eventManager->on($filter);
}
... | php | protected function _shutdown()
{
$this->controller->dispatchEvent('Controller.shutdown');
$dispatcher = DispatcherFactory::create();
$eventManager = $dispatcher->getEventManager();
foreach ($dispatcher->filters() as $filter) {
$eventManager->on($filter);
}
... | [
"protected",
"function",
"_shutdown",
"(",
")",
"{",
"$",
"this",
"->",
"controller",
"->",
"dispatchEvent",
"(",
"'Controller.shutdown'",
")",
";",
"$",
"dispatcher",
"=",
"DispatcherFactory",
"::",
"create",
"(",
")",
";",
"$",
"eventManager",
"=",
"$",
"d... | Run the shutdown events.
Triggers the afterFilter and afterDispatch events.
@return \Cake\Http\Response The response to serve. | [
"Run",
"the",
"shutdown",
"events",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Error/ExceptionRenderer.php#L422-L437 |
210,950 | cakephp/cakephp | src/Mailer/TransportRegistry.php | TransportRegistry._resolveClassName | protected function _resolveClassName($class)
{
if (is_object($class)) {
return $class;
}
$className = App::className($class, 'Mailer/Transport', 'Transport');
if (!$className) {
$className = App::className($class, 'Network/Email', 'Transport');
i... | php | protected function _resolveClassName($class)
{
if (is_object($class)) {
return $class;
}
$className = App::className($class, 'Mailer/Transport', 'Transport');
if (!$className) {
$className = App::className($class, 'Network/Email', 'Transport');
i... | [
"protected",
"function",
"_resolveClassName",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"class",
")",
")",
"{",
"return",
"$",
"class",
";",
"}",
"$",
"className",
"=",
"App",
"::",
"className",
"(",
"$",
"class",
",",
"'Mailer/Tra... | Resolve a mailer tranport classname.
Part of the template method for Cake\Core\ObjectRegistry::load()
@param string|\Cake\Mailer\AbstractTransport $class Partial classname to resolve or transport instance.
@return string|false Either the correct classname or false. | [
"Resolve",
"a",
"mailer",
"tranport",
"classname",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Mailer/TransportRegistry.php#L35-L53 |
210,951 | cakephp/cakephp | src/Mailer/TransportRegistry.php | TransportRegistry._create | protected function _create($class, $alias, $config)
{
$instance = null;
if (is_object($class)) {
$instance = $class;
}
if (!$instance) {
$instance = new $class($config);
}
if ($instance instanceof AbstractTransport) {
return $ins... | php | protected function _create($class, $alias, $config)
{
$instance = null;
if (is_object($class)) {
$instance = $class;
}
if (!$instance) {
$instance = new $class($config);
}
if ($instance instanceof AbstractTransport) {
return $ins... | [
"protected",
"function",
"_create",
"(",
"$",
"class",
",",
"$",
"alias",
",",
"$",
"config",
")",
"{",
"$",
"instance",
"=",
"null",
";",
"if",
"(",
"is_object",
"(",
"$",
"class",
")",
")",
"{",
"$",
"instance",
"=",
"$",
"class",
";",
"}",
"if... | Create the mailer transport instance.
Part of the template method for Cake\Core\ObjectRegistry::load()
@param string|\Cake\Mailer\AbstractTransport $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... | [
"Create",
"the",
"mailer",
"transport",
"instance",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Mailer/TransportRegistry.php#L81-L100 |
210,952 | cakephp/cakephp | src/ORM/Rule/ExistsIn.php | ExistsIn._fieldsAreNull | protected function _fieldsAreNull($entity, $source)
{
$nulls = 0;
$schema = $source->getSchema();
foreach ($this->_fields as $field) {
if ($schema->getColumn($field) && $schema->isNullable($field) && $entity->get($field) === null) {
$nulls++;
}
... | php | protected function _fieldsAreNull($entity, $source)
{
$nulls = 0;
$schema = $source->getSchema();
foreach ($this->_fields as $field) {
if ($schema->getColumn($field) && $schema->isNullable($field) && $entity->get($field) === null) {
$nulls++;
}
... | [
"protected",
"function",
"_fieldsAreNull",
"(",
"$",
"entity",
",",
"$",
"source",
")",
"{",
"$",
"nulls",
"=",
"0",
";",
"$",
"schema",
"=",
"$",
"source",
"->",
"getSchema",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_fields",
"as",
"$",
... | Checks whether or not the given entity fields are nullable and null.
@param \Cake\Datasource\EntityInterface $entity The entity to check.
@param \Cake\ORM\Table $source The table to use schema from.
@return bool | [
"Checks",
"whether",
"or",
"not",
"the",
"given",
"entity",
"fields",
"are",
"nullable",
"and",
"null",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Rule/ExistsIn.php#L148-L159 |
210,953 | cakephp/cakephp | src/View/Helper.php | Helper._confirm | protected function _confirm($message, $okCode, $cancelCode = '', $options = [])
{
$message = $this->_cleanConfirmMessage($message);
$confirm = "if (confirm({$message})) { {$okCode} } {$cancelCode}";
// We cannot change the key here in 3.x, but the behavior is inverted in this case
$e... | php | protected function _confirm($message, $okCode, $cancelCode = '', $options = [])
{
$message = $this->_cleanConfirmMessage($message);
$confirm = "if (confirm({$message})) { {$okCode} } {$cancelCode}";
// We cannot change the key here in 3.x, but the behavior is inverted in this case
$e... | [
"protected",
"function",
"_confirm",
"(",
"$",
"message",
",",
"$",
"okCode",
",",
"$",
"cancelCode",
"=",
"''",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"_cleanConfirmMessage",
"(",
"$",
"message",
")",
"... | Returns a string to be used as onclick handler for confirm dialogs.
@param string $message Message to be displayed
@param string $okCode Code to be executed after user chose 'OK'
@param string $cancelCode Code to be executed after user chose 'Cancel'
@param array $options Array of options
@return string onclick JS cod... | [
"Returns",
"a",
"string",
"to",
"be",
"used",
"as",
"onclick",
"handler",
"for",
"confirm",
"dialogs",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper.php#L230-L242 |
210,954 | cakephp/cakephp | src/Database/SchemaCache.php | SchemaCache.build | public function build($name = null)
{
$tables = [$name];
if (empty($name)) {
$tables = $this->_schema->listTables();
}
foreach ($tables as $table) {
$this->_schema->describe($table, ['forceRefresh' => true]);
}
return $tables;
} | php | public function build($name = null)
{
$tables = [$name];
if (empty($name)) {
$tables = $this->_schema->listTables();
}
foreach ($tables as $table) {
$this->_schema->describe($table, ['forceRefresh' => true]);
}
return $tables;
} | [
"public",
"function",
"build",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"tables",
"=",
"[",
"$",
"name",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"$",
"tables",
"=",
"$",
"this",
"->",
"_schema",
"->",
"listTables",
"... | Build metadata.
@param string|null $name The name of the table to build cache data for.
@return array Returns a list build table caches | [
"Build",
"metadata",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/SchemaCache.php#L55-L67 |
210,955 | cakephp/cakephp | src/Database/SchemaCache.php | SchemaCache.getSchema | public function getSchema(Connection $connection)
{
if (!method_exists($connection, 'schemaCollection')) {
throw new RuntimeException('The given connection object is not compatible with schema caching, as it does not implement a "schemaCollection()" method.');
}
$config = $conne... | php | public function getSchema(Connection $connection)
{
if (!method_exists($connection, 'schemaCollection')) {
throw new RuntimeException('The given connection object is not compatible with schema caching, as it does not implement a "schemaCollection()" method.');
}
$config = $conne... | [
"public",
"function",
"getSchema",
"(",
"Connection",
"$",
"connection",
")",
"{",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"connection",
",",
"'schemaCollection'",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'The given connection object is not compat... | Helper method to get the schema collection.
@param \Cake\Database\Connection $connection Connection object
@return \Cake\Database\Schema\Collection|\Cake\Database\Schema\CachedCollection
@throws \RuntimeException If given connection object is not compatible with schema caching | [
"Helper",
"method",
"to",
"get",
"the",
"schema",
"collection",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/SchemaCache.php#L98-L110 |
210,956 | cakephp/cakephp | src/View/Widget/SelectBoxWidget.php | SelectBoxWidget.render | public function render(array $data, ContextInterface $context)
{
$data += [
'name' => '',
'empty' => false,
'escape' => true,
'options' => [],
'disabled' => null,
'val' => null,
'templateVars' => []
];
$opti... | php | public function render(array $data, ContextInterface $context)
{
$data += [
'name' => '',
'empty' => false,
'escape' => true,
'options' => [],
'disabled' => null,
'val' => null,
'templateVars' => []
];
$opti... | [
"public",
"function",
"render",
"(",
"array",
"$",
"data",
",",
"ContextInterface",
"$",
"context",
")",
"{",
"$",
"data",
"+=",
"[",
"'name'",
"=>",
"''",
",",
"'empty'",
"=>",
"false",
",",
"'escape'",
"=>",
"true",
",",
"'options'",
"=>",
"[",
"]",
... | Render a select box form input.
Render a select box input given a set of data. Supported keys
are:
- `name` - Set the input name.
- `options` - An array of options.
- `disabled` - Either true or an array of options to disable.
When true, the select element will be disabled.
- `val` - Either a string or an array of op... | [
"Render",
"a",
"select",
"box",
"form",
"input",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Widget/SelectBoxWidget.php#L104-L136 |
210,957 | cakephp/cakephp | src/View/Widget/SelectBoxWidget.php | SelectBoxWidget._renderContent | protected function _renderContent($data)
{
$options = $data['options'];
if ($options instanceof Traversable) {
$options = iterator_to_array($options);
}
if (!empty($data['empty'])) {
$options = $this->_emptyValue($data['empty']) + (array)$options;
}
... | php | protected function _renderContent($data)
{
$options = $data['options'];
if ($options instanceof Traversable) {
$options = iterator_to_array($options);
}
if (!empty($data['empty'])) {
$options = $this->_emptyValue($data['empty']) + (array)$options;
}
... | [
"protected",
"function",
"_renderContent",
"(",
"$",
"data",
")",
"{",
"$",
"options",
"=",
"$",
"data",
"[",
"'options'",
"]",
";",
"if",
"(",
"$",
"options",
"instanceof",
"Traversable",
")",
"{",
"$",
"options",
"=",
"iterator_to_array",
"(",
"$",
"op... | Render the contents of the select element.
@param array $data The context for rendering a select.
@return array | [
"Render",
"the",
"contents",
"of",
"the",
"select",
"element",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Widget/SelectBoxWidget.php#L144-L167 |
210,958 | cakephp/cakephp | src/View/Widget/SelectBoxWidget.php | SelectBoxWidget._emptyValue | protected function _emptyValue($value)
{
if ($value === true) {
return ['' => ''];
}
if (is_scalar($value)) {
return ['' => $value];
}
if (is_array($value)) {
return $value;
}
return [];
} | php | protected function _emptyValue($value)
{
if ($value === true) {
return ['' => ''];
}
if (is_scalar($value)) {
return ['' => $value];
}
if (is_array($value)) {
return $value;
}
return [];
} | [
"protected",
"function",
"_emptyValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"true",
")",
"{",
"return",
"[",
"''",
"=>",
"''",
"]",
";",
"}",
"if",
"(",
"is_scalar",
"(",
"$",
"value",
")",
")",
"{",
"return",
"[",
"''",
... | Generate the empty value based on the input.
@param string|bool|array $value The provided empty value.
@return array The generated option key/value. | [
"Generate",
"the",
"empty",
"value",
"based",
"on",
"the",
"input",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Widget/SelectBoxWidget.php#L175-L188 |
210,959 | cakephp/cakephp | src/View/Widget/SelectBoxWidget.php | SelectBoxWidget._renderOptgroup | protected function _renderOptgroup($label, $optgroup, $disabled, $selected, $templateVars, $escape)
{
$opts = $optgroup;
$attrs = [];
if (isset($optgroup['options'], $optgroup['text'])) {
$opts = $optgroup['options'];
$label = $optgroup['text'];
$attrs = $... | php | protected function _renderOptgroup($label, $optgroup, $disabled, $selected, $templateVars, $escape)
{
$opts = $optgroup;
$attrs = [];
if (isset($optgroup['options'], $optgroup['text'])) {
$opts = $optgroup['options'];
$label = $optgroup['text'];
$attrs = $... | [
"protected",
"function",
"_renderOptgroup",
"(",
"$",
"label",
",",
"$",
"optgroup",
",",
"$",
"disabled",
",",
"$",
"selected",
",",
"$",
"templateVars",
",",
"$",
"escape",
")",
"{",
"$",
"opts",
"=",
"$",
"optgroup",
";",
"$",
"attrs",
"=",
"[",
"... | Render the contents of an optgroup element.
@param string $label The optgroup label text
@param array $optgroup The opt group data.
@param array|null $disabled The options to disable.
@param array|string|null $selected The options to select.
@param array $templateVars Additional template variables.
@param bool $escape... | [
"Render",
"the",
"contents",
"of",
"an",
"optgroup",
"element",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Widget/SelectBoxWidget.php#L201-L218 |
210,960 | cakephp/cakephp | src/View/Widget/SelectBoxWidget.php | SelectBoxWidget._renderOptions | protected function _renderOptions($options, $disabled, $selected, $templateVars, $escape)
{
$out = [];
foreach ($options as $key => $val) {
// Option groups
$arrayVal = (is_array($val) || $val instanceof Traversable);
if ((!is_int($key) && $arrayVal) ||
... | php | protected function _renderOptions($options, $disabled, $selected, $templateVars, $escape)
{
$out = [];
foreach ($options as $key => $val) {
// Option groups
$arrayVal = (is_array($val) || $val instanceof Traversable);
if ((!is_int($key) && $arrayVal) ||
... | [
"protected",
"function",
"_renderOptions",
"(",
"$",
"options",
",",
"$",
"disabled",
",",
"$",
"selected",
",",
"$",
"templateVars",
",",
"$",
"escape",
")",
"{",
"$",
"out",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"options",
"as",
"$",
"key",
"=>"... | Render a set of options.
Will recursively call itself when option groups are in use.
@param array $options The options to render.
@param array|null $disabled The options to disable.
@param array|string|null $selected The options to select.
@param array $templateVars Additional template variables.
@param bool $escape ... | [
"Render",
"a",
"set",
"of",
"options",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Widget/SelectBoxWidget.php#L232-L278 |
210,961 | cakephp/cakephp | src/View/Widget/SelectBoxWidget.php | SelectBoxWidget._isSelected | protected function _isSelected($key, $selected)
{
if ($selected === null) {
return false;
}
$isArray = is_array($selected);
if (!$isArray) {
$selected = $selected === false ? '0' : $selected;
return (string)$key === (string)$selected;
}
... | php | protected function _isSelected($key, $selected)
{
if ($selected === null) {
return false;
}
$isArray = is_array($selected);
if (!$isArray) {
$selected = $selected === false ? '0' : $selected;
return (string)$key === (string)$selected;
}
... | [
"protected",
"function",
"_isSelected",
"(",
"$",
"key",
",",
"$",
"selected",
")",
"{",
"if",
"(",
"$",
"selected",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"$",
"isArray",
"=",
"is_array",
"(",
"$",
"selected",
")",
";",
"if",
"(",
"... | Helper method for deciding what options are selected.
@param string $key The key to test.
@param array|string|null $selected The selected values.
@return bool | [
"Helper",
"method",
"for",
"deciding",
"what",
"options",
"are",
"selected",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Widget/SelectBoxWidget.php#L287-L301 |
210,962 | cakephp/cakephp | src/Database/Type/BinaryUuidType.php | BinaryUuidType.toDatabase | public function toDatabase($value, Driver $driver)
{
if (is_string($value)) {
return $this->convertStringToBinaryUuid($value);
}
return $value;
} | php | public function toDatabase($value, Driver $driver)
{
if (is_string($value)) {
return $this->convertStringToBinaryUuid($value);
}
return $value;
} | [
"public",
"function",
"toDatabase",
"(",
"$",
"value",
",",
"Driver",
"$",
"driver",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"this",
"->",
"convertStringToBinaryUuid",
"(",
"$",
"value",
")",
";",
"}",
"return... | Convert binary uuid data into the database format.
Binary data is not altered before being inserted into the database.
As PDO will handle reading file handles.
@param string|resource $value The value to convert.
@param \Cake\Database\Driver $driver The driver instance to convert with.
@return string|resource | [
"Convert",
"binary",
"uuid",
"data",
"into",
"the",
"database",
"format",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Type/BinaryUuidType.php#L64-L71 |
210,963 | cakephp/cakephp | src/Database/Type/BinaryUuidType.php | BinaryUuidType.toPHP | public function toPHP($value, Driver $driver)
{
if ($value === null) {
return null;
}
if (is_string($value)) {
return $this->convertBinaryUuidToString($value);
}
if (is_resource($value)) {
return $value;
}
throw new Excepti... | php | public function toPHP($value, Driver $driver)
{
if ($value === null) {
return null;
}
if (is_string($value)) {
return $this->convertBinaryUuidToString($value);
}
if (is_resource($value)) {
return $value;
}
throw new Excepti... | [
"public",
"function",
"toPHP",
"(",
"$",
"value",
",",
"Driver",
"$",
"driver",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"this... | Convert binary uuid into resource handles
@param null|string|resource $value The value to convert.
@param \Cake\Database\Driver $driver The driver instance to convert with.
@return resource|string|null
@throws \Cake\Core\Exception\Exception | [
"Convert",
"binary",
"uuid",
"into",
"resource",
"handles"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Type/BinaryUuidType.php#L91-L104 |
210,964 | cakephp/cakephp | src/Database/Schema/BaseSchema.php | BaseSchema._foreignOnClause | protected function _foreignOnClause($on)
{
if ($on === TableSchema::ACTION_SET_NULL) {
return 'SET NULL';
}
if ($on === TableSchema::ACTION_SET_DEFAULT) {
return 'SET DEFAULT';
}
if ($on === TableSchema::ACTION_CASCADE) {
return 'CASCADE';
... | php | protected function _foreignOnClause($on)
{
if ($on === TableSchema::ACTION_SET_NULL) {
return 'SET NULL';
}
if ($on === TableSchema::ACTION_SET_DEFAULT) {
return 'SET DEFAULT';
}
if ($on === TableSchema::ACTION_CASCADE) {
return 'CASCADE';
... | [
"protected",
"function",
"_foreignOnClause",
"(",
"$",
"on",
")",
"{",
"if",
"(",
"$",
"on",
"===",
"TableSchema",
"::",
"ACTION_SET_NULL",
")",
"{",
"return",
"'SET NULL'",
";",
"}",
"if",
"(",
"$",
"on",
"===",
"TableSchema",
"::",
"ACTION_SET_DEFAULT",
... | Generate an ON clause for a foreign key.
@param string|null $on The on clause
@return string | [
"Generate",
"an",
"ON",
"clause",
"for",
"a",
"foreign",
"key",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Schema/BaseSchema.php#L55-L72 |
210,965 | cakephp/cakephp | src/Database/Schema/BaseSchema.php | BaseSchema._convertOnClause | protected function _convertOnClause($clause)
{
if ($clause === 'CASCADE' || $clause === 'RESTRICT') {
return strtolower($clause);
}
if ($clause === 'NO ACTION') {
return TableSchema::ACTION_NO_ACTION;
}
return TableSchema::ACTION_SET_NULL;
} | php | protected function _convertOnClause($clause)
{
if ($clause === 'CASCADE' || $clause === 'RESTRICT') {
return strtolower($clause);
}
if ($clause === 'NO ACTION') {
return TableSchema::ACTION_NO_ACTION;
}
return TableSchema::ACTION_SET_NULL;
} | [
"protected",
"function",
"_convertOnClause",
"(",
"$",
"clause",
")",
"{",
"if",
"(",
"$",
"clause",
"===",
"'CASCADE'",
"||",
"$",
"clause",
"===",
"'RESTRICT'",
")",
"{",
"return",
"strtolower",
"(",
"$",
"clause",
")",
";",
"}",
"if",
"(",
"$",
"cla... | Convert string on clauses to the abstract ones.
@param string $clause The on clause to convert.
@return string|null | [
"Convert",
"string",
"on",
"clauses",
"to",
"the",
"abstract",
"ones",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Schema/BaseSchema.php#L80-L90 |
210,966 | cakephp/cakephp | src/Database/Schema/BaseSchema.php | BaseSchema._convertConstraintColumns | protected function _convertConstraintColumns($references)
{
if (is_string($references)) {
return $this->_driver->quoteIdentifier($references);
}
return implode(', ', array_map(
[$this->_driver, 'quoteIdentifier'],
$references
));
} | php | protected function _convertConstraintColumns($references)
{
if (is_string($references)) {
return $this->_driver->quoteIdentifier($references);
}
return implode(', ', array_map(
[$this->_driver, 'quoteIdentifier'],
$references
));
} | [
"protected",
"function",
"_convertConstraintColumns",
"(",
"$",
"references",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"references",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_driver",
"->",
"quoteIdentifier",
"(",
"$",
"references",
")",
";",
"}",
"... | Convert foreign key constraints references to a valid
stringified list
@param string|array $references The referenced columns of a foreign key constraint statement
@return string | [
"Convert",
"foreign",
"key",
"constraints",
"references",
"to",
"a",
"valid",
"stringified",
"list"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Schema/BaseSchema.php#L99-L109 |
210,967 | cakephp/cakephp | src/Database/Schema/BaseSchema.php | BaseSchema.dropTableSql | public function dropTableSql(TableSchema $schema)
{
$sql = sprintf(
'DROP TABLE %s',
$this->_driver->quoteIdentifier($schema->name())
);
return [$sql];
} | php | public function dropTableSql(TableSchema $schema)
{
$sql = sprintf(
'DROP TABLE %s',
$this->_driver->quoteIdentifier($schema->name())
);
return [$sql];
} | [
"public",
"function",
"dropTableSql",
"(",
"TableSchema",
"$",
"schema",
")",
"{",
"$",
"sql",
"=",
"sprintf",
"(",
"'DROP TABLE %s'",
",",
"$",
"this",
"->",
"_driver",
"->",
"quoteIdentifier",
"(",
"$",
"schema",
"->",
"name",
"(",
")",
")",
")",
";",
... | Generate the SQL to drop a table.
@param \Cake\Database\Schema\TableSchema $schema Schema instance
@return array SQL statements to drop a table. | [
"Generate",
"the",
"SQL",
"to",
"drop",
"a",
"table",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Schema/BaseSchema.php#L117-L125 |
210,968 | cakephp/cakephp | src/Datasource/RulesChecker.php | RulesChecker.add | public function add(callable $rule, $name = null, array $options = [])
{
$this->_rules[] = $this->_addError($rule, $name, $options);
return $this;
} | php | public function add(callable $rule, $name = null, array $options = [])
{
$this->_rules[] = $this->_addError($rule, $name, $options);
return $this;
} | [
"public",
"function",
"add",
"(",
"callable",
"$",
"rule",
",",
"$",
"name",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"_rules",
"[",
"]",
"=",
"$",
"this",
"->",
"_addError",
"(",
"$",
"rule",
",",
... | Adds a rule that will be applied to the entity both on create and update
operations.
### Options
The options array accept the following special keys:
- `errorField`: The name of the entity field that will be marked as invalid
if the rule does not pass.
- `message`: The error message to set to `errorField` if the rul... | [
"Adds",
"a",
"rule",
"that",
"will",
"be",
"applied",
"to",
"the",
"entity",
"both",
"on",
"create",
"and",
"update",
"operations",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Datasource/RulesChecker.php#L135-L140 |
210,969 | cakephp/cakephp | src/Datasource/RulesChecker.php | RulesChecker.addCreate | public function addCreate(callable $rule, $name = null, array $options = [])
{
$this->_createRules[] = $this->_addError($rule, $name, $options);
return $this;
} | php | public function addCreate(callable $rule, $name = null, array $options = [])
{
$this->_createRules[] = $this->_addError($rule, $name, $options);
return $this;
} | [
"public",
"function",
"addCreate",
"(",
"callable",
"$",
"rule",
",",
"$",
"name",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"_createRules",
"[",
"]",
"=",
"$",
"this",
"->",
"_addError",
"(",
"$",
"rule... | Adds a rule that will be applied to the entity on create operations.
### Options
The options array accept the following special keys:
- `errorField`: The name of the entity field that will be marked as invalid
if the rule does not pass.
- `message`: The error message to set to `errorField` if the rule does not pass.... | [
"Adds",
"a",
"rule",
"that",
"will",
"be",
"applied",
"to",
"the",
"entity",
"on",
"create",
"operations",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Datasource/RulesChecker.php#L160-L165 |
210,970 | cakephp/cakephp | src/Datasource/RulesChecker.php | RulesChecker.addUpdate | public function addUpdate(callable $rule, $name = null, array $options = [])
{
$this->_updateRules[] = $this->_addError($rule, $name, $options);
return $this;
} | php | public function addUpdate(callable $rule, $name = null, array $options = [])
{
$this->_updateRules[] = $this->_addError($rule, $name, $options);
return $this;
} | [
"public",
"function",
"addUpdate",
"(",
"callable",
"$",
"rule",
",",
"$",
"name",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"_updateRules",
"[",
"]",
"=",
"$",
"this",
"->",
"_addError",
"(",
"$",
"rule... | Adds a rule that will be applied to the entity on update operations.
### Options
The options array accept the following special keys:
- `errorField`: The name of the entity field that will be marked as invalid
if the rule does not pass.
- `message`: The error message to set to `errorField` if the rule does not pass.... | [
"Adds",
"a",
"rule",
"that",
"will",
"be",
"applied",
"to",
"the",
"entity",
"on",
"update",
"operations",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Datasource/RulesChecker.php#L185-L190 |
210,971 | cakephp/cakephp | src/Datasource/RulesChecker.php | RulesChecker.addDelete | public function addDelete(callable $rule, $name = null, array $options = [])
{
$this->_deleteRules[] = $this->_addError($rule, $name, $options);
return $this;
} | php | public function addDelete(callable $rule, $name = null, array $options = [])
{
$this->_deleteRules[] = $this->_addError($rule, $name, $options);
return $this;
} | [
"public",
"function",
"addDelete",
"(",
"callable",
"$",
"rule",
",",
"$",
"name",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"_deleteRules",
"[",
"]",
"=",
"$",
"this",
"->",
"_addError",
"(",
"$",
"rule... | Adds a rule that will be applied to the entity on delete operations.
### Options
The options array accept the following special keys:
- `errorField`: The name of the entity field that will be marked as invalid
if the rule does not pass.
- `message`: The error message to set to `errorField` if the rule does not pass.... | [
"Adds",
"a",
"rule",
"that",
"will",
"be",
"applied",
"to",
"the",
"entity",
"on",
"delete",
"operations",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Datasource/RulesChecker.php#L210-L215 |
210,972 | cakephp/cakephp | src/Datasource/RulesChecker.php | RulesChecker.checkCreate | public function checkCreate(EntityInterface $entity, array $options = [])
{
return $this->_checkRules($entity, $options, array_merge($this->_rules, $this->_createRules));
} | php | public function checkCreate(EntityInterface $entity, array $options = [])
{
return $this->_checkRules($entity, $options, array_merge($this->_rules, $this->_createRules));
} | [
"public",
"function",
"checkCreate",
"(",
"EntityInterface",
"$",
"entity",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"_checkRules",
"(",
"$",
"entity",
",",
"$",
"options",
",",
"array_merge",
"(",
"$",
"this",
... | Runs each of the rules by passing the provided entity and returns true if all
of them pass. The rules selected will be only those specified to be run on 'create'
@param \Cake\Datasource\EntityInterface $entity The entity to check for validity.
@param array $options Extra options to pass to checker functions.
@return b... | [
"Runs",
"each",
"of",
"the",
"rules",
"by",
"passing",
"the",
"provided",
"entity",
"and",
"returns",
"true",
"if",
"all",
"of",
"them",
"pass",
".",
"The",
"rules",
"selected",
"will",
"be",
"only",
"those",
"specified",
"to",
"be",
"run",
"on",
"create... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Datasource/RulesChecker.php#L253-L256 |
210,973 | cakephp/cakephp | src/Datasource/RulesChecker.php | RulesChecker.checkUpdate | public function checkUpdate(EntityInterface $entity, array $options = [])
{
return $this->_checkRules($entity, $options, array_merge($this->_rules, $this->_updateRules));
} | php | public function checkUpdate(EntityInterface $entity, array $options = [])
{
return $this->_checkRules($entity, $options, array_merge($this->_rules, $this->_updateRules));
} | [
"public",
"function",
"checkUpdate",
"(",
"EntityInterface",
"$",
"entity",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"_checkRules",
"(",
"$",
"entity",
",",
"$",
"options",
",",
"array_merge",
"(",
"$",
"this",
... | Runs each of the rules by passing the provided entity and returns true if all
of them pass. The rules selected will be only those specified to be run on 'update'
@param \Cake\Datasource\EntityInterface $entity The entity to check for validity.
@param array $options Extra options to pass to checker functions.
@return b... | [
"Runs",
"each",
"of",
"the",
"rules",
"by",
"passing",
"the",
"provided",
"entity",
"and",
"returns",
"true",
"if",
"all",
"of",
"them",
"pass",
".",
"The",
"rules",
"selected",
"will",
"be",
"only",
"those",
"specified",
"to",
"be",
"run",
"on",
"update... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Datasource/RulesChecker.php#L266-L269 |
210,974 | cakephp/cakephp | src/Datasource/RulesChecker.php | RulesChecker.checkDelete | public function checkDelete(EntityInterface $entity, array $options = [])
{
return $this->_checkRules($entity, $options, $this->_deleteRules);
} | php | public function checkDelete(EntityInterface $entity, array $options = [])
{
return $this->_checkRules($entity, $options, $this->_deleteRules);
} | [
"public",
"function",
"checkDelete",
"(",
"EntityInterface",
"$",
"entity",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"_checkRules",
"(",
"$",
"entity",
",",
"$",
"options",
",",
"$",
"this",
"->",
"_deleteRules"... | Runs each of the rules by passing the provided entity and returns true if all
of them pass. The rules selected will be only those specified to be run on 'delete'
@param \Cake\Datasource\EntityInterface $entity The entity to check for validity.
@param array $options Extra options to pass to checker functions.
@return b... | [
"Runs",
"each",
"of",
"the",
"rules",
"by",
"passing",
"the",
"provided",
"entity",
"and",
"returns",
"true",
"if",
"all",
"of",
"them",
"pass",
".",
"The",
"rules",
"selected",
"will",
"be",
"only",
"those",
"specified",
"to",
"be",
"run",
"on",
"delete... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Datasource/RulesChecker.php#L279-L282 |
210,975 | cakephp/cakephp | src/Datasource/RulesChecker.php | RulesChecker._checkRules | protected function _checkRules(EntityInterface $entity, array $options = [], array $rules = [])
{
$success = true;
$options += $this->_options;
foreach ($rules as $rule) {
$success = $rule($entity, $options) && $success;
}
return $success;
} | php | protected function _checkRules(EntityInterface $entity, array $options = [], array $rules = [])
{
$success = true;
$options += $this->_options;
foreach ($rules as $rule) {
$success = $rule($entity, $options) && $success;
}
return $success;
} | [
"protected",
"function",
"_checkRules",
"(",
"EntityInterface",
"$",
"entity",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"array",
"$",
"rules",
"=",
"[",
"]",
")",
"{",
"$",
"success",
"=",
"true",
";",
"$",
"options",
"+=",
"$",
"this",
"->"... | Used by top level functions checkDelete, checkCreate and checkUpdate, this function
iterates an array containing the rules to be checked and checks them all.
@param \Cake\Datasource\EntityInterface $entity The entity to check for validity.
@param array $options Extra options to pass to checker functions.
@param array ... | [
"Used",
"by",
"top",
"level",
"functions",
"checkDelete",
"checkCreate",
"and",
"checkUpdate",
"this",
"function",
"iterates",
"an",
"array",
"containing",
"the",
"rules",
"to",
"be",
"checked",
"and",
"checks",
"them",
"all",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Datasource/RulesChecker.php#L293-L302 |
210,976 | cakephp/cakephp | src/Datasource/RulesChecker.php | RulesChecker._addError | protected function _addError($rule, $name, $options)
{
if (is_array($name)) {
$options = $name;
$name = null;
}
if (!($rule instanceof RuleInvoker)) {
$rule = new RuleInvoker($rule, $name, $options);
} else {
$rule->setOptions($options... | php | protected function _addError($rule, $name, $options)
{
if (is_array($name)) {
$options = $name;
$name = null;
}
if (!($rule instanceof RuleInvoker)) {
$rule = new RuleInvoker($rule, $name, $options);
} else {
$rule->setOptions($options... | [
"protected",
"function",
"_addError",
"(",
"$",
"rule",
",",
"$",
"name",
",",
"$",
"options",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"$",
"options",
"=",
"$",
"name",
";",
"$",
"name",
"=",
"null",
";",
"}",
"if",
"(... | Utility method for decorating any callable so that if it returns false, the correct
property in the entity is marked as invalid.
@param callable $rule The rule to decorate
@param string $name The alias for a rule.
@param array $options The options containing the error message and field.
@return callable | [
"Utility",
"method",
"for",
"decorating",
"any",
"callable",
"so",
"that",
"if",
"it",
"returns",
"false",
"the",
"correct",
"property",
"in",
"the",
"entity",
"is",
"marked",
"as",
"invalid",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Datasource/RulesChecker.php#L313-L327 |
210,977 | cakephp/cakephp | src/Validation/ValidationRule.php | ValidationRule.process | public function process($value, array $providers, array $context = [])
{
$context += ['data' => [], 'newRecord' => true, 'providers' => $providers];
if ($this->_skip($context)) {
return true;
}
if (!is_string($this->_rule) && is_callable($this->_rule)) {
$ca... | php | public function process($value, array $providers, array $context = [])
{
$context += ['data' => [], 'newRecord' => true, 'providers' => $providers];
if ($this->_skip($context)) {
return true;
}
if (!is_string($this->_rule) && is_callable($this->_rule)) {
$ca... | [
"public",
"function",
"process",
"(",
"$",
"value",
",",
"array",
"$",
"providers",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"context",
"+=",
"[",
"'data'",
"=>",
"[",
"]",
",",
"'newRecord'",
"=>",
"true",
",",
"'providers'",
"=>"... | Dispatches the validation rule to the given validator method and returns
a boolean indicating whether the rule passed or not. If a string is returned
it is assumed that the rule failed and the error message was given as a result.
@param mixed $value The data to validate
@param array $providers associative array with o... | [
"Dispatches",
"the",
"validation",
"rule",
"to",
"the",
"given",
"validator",
"method",
"and",
"returns",
"a",
"boolean",
"indicating",
"whether",
"the",
"rule",
"passed",
"or",
"not",
".",
"If",
"a",
"string",
"is",
"returned",
"it",
"is",
"assumed",
"that"... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Validation/ValidationRule.php#L112-L148 |
210,978 | cakephp/cakephp | src/Validation/ValidationRule.php | ValidationRule._skip | protected function _skip($context)
{
if (!is_string($this->_on) && is_callable($this->_on)) {
$function = $this->_on;
return !$function($context);
}
$newRecord = $context['newRecord'];
if (!empty($this->_on)) {
if (($this->_on === 'create' && !$n... | php | protected function _skip($context)
{
if (!is_string($this->_on) && is_callable($this->_on)) {
$function = $this->_on;
return !$function($context);
}
$newRecord = $context['newRecord'];
if (!empty($this->_on)) {
if (($this->_on === 'create' && !$n... | [
"protected",
"function",
"_skip",
"(",
"$",
"context",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"this",
"->",
"_on",
")",
"&&",
"is_callable",
"(",
"$",
"this",
"->",
"_on",
")",
")",
"{",
"$",
"function",
"=",
"$",
"this",
"->",
"_on",
"... | Checks if the validation rule should be skipped
@param array $context A key value list of data that could be used as context
during validation. Recognized keys are:
- newRecord: (boolean) whether or not the data to be validated belongs to a
new record
- data: The full data that was passed to the validation process
- p... | [
"Checks",
"if",
"the",
"validation",
"rule",
"should",
"be",
"skipped"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Validation/ValidationRule.php#L162-L178 |
210,979 | cakephp/cakephp | src/Validation/ValidationRule.php | ValidationRule._addValidatorProps | protected function _addValidatorProps($validator = [])
{
foreach ($validator as $key => $value) {
if (!isset($value) || empty($value)) {
continue;
}
if ($key === 'rule' && is_array($value) && !is_callable($value)) {
$this->_pass = array_sli... | php | protected function _addValidatorProps($validator = [])
{
foreach ($validator as $key => $value) {
if (!isset($value) || empty($value)) {
continue;
}
if ($key === 'rule' && is_array($value) && !is_callable($value)) {
$this->_pass = array_sli... | [
"protected",
"function",
"_addValidatorProps",
"(",
"$",
"validator",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"validator",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"value",
")",
"||",
"empty",
"(",
"$... | Sets the rule properties from the rule entry in validate
@param array $validator [optional]
@return void | [
"Sets",
"the",
"rule",
"properties",
"from",
"the",
"rule",
"entry",
"in",
"validate"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Validation/ValidationRule.php#L186-L200 |
210,980 | cakephp/cakephp | src/Collection/Iterator/ZipIterator.php | ZipIterator.current | public function current()
{
if ($this->_callback === null) {
return parent::current();
}
return call_user_func_array($this->_callback, parent::current());
} | php | public function current()
{
if ($this->_callback === null) {
return parent::current();
}
return call_user_func_array($this->_callback, parent::current());
} | [
"public",
"function",
"current",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_callback",
"===",
"null",
")",
"{",
"return",
"parent",
"::",
"current",
"(",
")",
";",
"}",
"return",
"call_user_func_array",
"(",
"$",
"this",
"->",
"_callback",
",",
"pa... | Returns the value resulting out of zipping all the elements for all the
iterators with the same positional index.
@return mixed | [
"Returns",
"the",
"value",
"resulting",
"out",
"of",
"zipping",
"all",
"the",
"elements",
"for",
"all",
"the",
"iterators",
"with",
"the",
"same",
"positional",
"index",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Collection/Iterator/ZipIterator.php#L92-L99 |
210,981 | cakephp/cakephp | src/Collection/Iterator/ZipIterator.php | ZipIterator.unserialize | public function unserialize($iterators)
{
parent::__construct(MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC);
$this->_iterators = unserialize($iterators);
foreach ($this->_iterators as $it) {
$this->attachIterator($it);
}
} | php | public function unserialize($iterators)
{
parent::__construct(MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC);
$this->_iterators = unserialize($iterators);
foreach ($this->_iterators as $it) {
$this->attachIterator($it);
}
} | [
"public",
"function",
"unserialize",
"(",
"$",
"iterators",
")",
"{",
"parent",
"::",
"__construct",
"(",
"MultipleIterator",
"::",
"MIT_NEED_ALL",
"|",
"MultipleIterator",
"::",
"MIT_KEYS_NUMERIC",
")",
";",
"$",
"this",
"->",
"_iterators",
"=",
"unserialize",
... | Unserializes the passed string and rebuilds the ZipIterator instance
@param string $iterators The serialized iterators
@return void | [
"Unserializes",
"the",
"passed",
"string",
"and",
"rebuilds",
"the",
"ZipIterator",
"instance"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Collection/Iterator/ZipIterator.php#L118-L125 |
210,982 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior.beforeSave | public function beforeSave(Event $event, EntityInterface $entity)
{
$isNew = $entity->isNew();
$config = $this->getConfig();
$parent = $entity->get($config['parent']);
$primaryKey = $this->_getPrimaryKey();
$dirty = $entity->isDirty($config['parent']);
$level = $confi... | php | public function beforeSave(Event $event, EntityInterface $entity)
{
$isNew = $entity->isNew();
$config = $this->getConfig();
$parent = $entity->get($config['parent']);
$primaryKey = $this->_getPrimaryKey();
$dirty = $entity->isDirty($config['parent']);
$level = $confi... | [
"public",
"function",
"beforeSave",
"(",
"Event",
"$",
"event",
",",
"EntityInterface",
"$",
"entity",
")",
"{",
"$",
"isNew",
"=",
"$",
"entity",
"->",
"isNew",
"(",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"$",
... | Before save listener.
Transparently manages setting the lft and rght fields if the parent field is
included in the parameters to be saved.
@param \Cake\Event\Event $event The beforeSave event that was fired
@param \Cake\Datasource\EntityInterface $entity the entity that is going to be saved
@return void
@throws \Runti... | [
"Before",
"save",
"listener",
".",
"Transparently",
"manages",
"setting",
"the",
"lft",
"and",
"rght",
"fields",
"if",
"the",
"parent",
"field",
"is",
"included",
"in",
"the",
"parameters",
"to",
"be",
"saved",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L97-L154 |
210,983 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior.afterSave | public function afterSave(Event $event, EntityInterface $entity)
{
if (!$this->_config['level'] || $entity->isNew()) {
return;
}
$this->_setChildrenLevel($entity);
} | php | public function afterSave(Event $event, EntityInterface $entity)
{
if (!$this->_config['level'] || $entity->isNew()) {
return;
}
$this->_setChildrenLevel($entity);
} | [
"public",
"function",
"afterSave",
"(",
"Event",
"$",
"event",
",",
"EntityInterface",
"$",
"entity",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_config",
"[",
"'level'",
"]",
"||",
"$",
"entity",
"->",
"isNew",
"(",
")",
")",
"{",
"return",
";",
... | After save listener.
Manages updating level of descendants of currently saved entity.
@param \Cake\Event\Event $event The afterSave event that was fired
@param \Cake\Datasource\EntityInterface $entity the entity that is going to be saved
@return void | [
"After",
"save",
"listener",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L165-L172 |
210,984 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior._setChildrenLevel | protected function _setChildrenLevel($entity)
{
$config = $this->getConfig();
if ($entity->get($config['left']) + 1 === $entity->get($config['right'])) {
return;
}
$primaryKey = $this->_getPrimaryKey();
$primaryKeyValue = $entity->get($primaryKey);
$dept... | php | protected function _setChildrenLevel($entity)
{
$config = $this->getConfig();
if ($entity->get($config['left']) + 1 === $entity->get($config['right'])) {
return;
}
$primaryKey = $this->_getPrimaryKey();
$primaryKeyValue = $entity->get($primaryKey);
$dept... | [
"protected",
"function",
"_setChildrenLevel",
"(",
"$",
"entity",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"if",
"(",
"$",
"entity",
"->",
"get",
"(",
"$",
"config",
"[",
"'left'",
"]",
")",
"+",
"1",
"===",
"$",... | Set level for descendants.
@param \Cake\Datasource\EntityInterface $entity The entity whose descendants need to be updated.
@return void | [
"Set",
"level",
"for",
"descendants",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L180-L209 |
210,985 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior.beforeDelete | public function beforeDelete(Event $event, EntityInterface $entity)
{
$config = $this->getConfig();
$this->_ensureFields($entity);
$left = $entity->get($config['left']);
$right = $entity->get($config['right']);
$diff = $right - $left + 1;
if ($diff > 2) {
... | php | public function beforeDelete(Event $event, EntityInterface $entity)
{
$config = $this->getConfig();
$this->_ensureFields($entity);
$left = $entity->get($config['left']);
$right = $entity->get($config['right']);
$diff = $right - $left + 1;
if ($diff > 2) {
... | [
"public",
"function",
"beforeDelete",
"(",
"Event",
"$",
"event",
",",
"EntityInterface",
"$",
"entity",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"$",
"this",
"->",
"_ensureFields",
"(",
"$",
"entity",
")",
";",
"$",... | Also deletes the nodes in the subtree of the entity to be delete
@param \Cake\Event\Event $event The beforeDelete event that was fired
@param \Cake\Datasource\EntityInterface $entity The entity that is going to be saved
@return void | [
"Also",
"deletes",
"the",
"nodes",
"in",
"the",
"subtree",
"of",
"the",
"entity",
"to",
"be",
"delete"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L218-L240 |
210,986 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior._setParent | protected function _setParent($entity, $parent)
{
$config = $this->getConfig();
$parentNode = $this->_getNode($parent);
$this->_ensureFields($entity);
$parentLeft = $parentNode->get($config['left']);
$parentRight = $parentNode->get($config['right']);
$right = $entity-... | php | protected function _setParent($entity, $parent)
{
$config = $this->getConfig();
$parentNode = $this->_getNode($parent);
$this->_ensureFields($entity);
$parentLeft = $parentNode->get($config['left']);
$parentRight = $parentNode->get($config['right']);
$right = $entity-... | [
"protected",
"function",
"_setParent",
"(",
"$",
"entity",
",",
"$",
"parent",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"$",
"parentNode",
"=",
"$",
"this",
"->",
"_getNode",
"(",
"$",
"parent",
")",
";",
"$",
"t... | Sets the correct left and right values for the passed entity so it can be
updated to a new parent. It also makes the hole in the tree so the node
move can be done without corrupting the structure.
@param \Cake\Datasource\EntityInterface $entity The entity to re-parent
@param mixed $parent the id of the parent to set
@... | [
"Sets",
"the",
"correct",
"left",
"and",
"right",
"values",
"for",
"the",
"passed",
"entity",
"so",
"it",
"can",
"be",
"updated",
"to",
"a",
"new",
"parent",
".",
"It",
"also",
"makes",
"the",
"hole",
"in",
"the",
"tree",
"so",
"the",
"node",
"move",
... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L252-L302 |
210,987 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior._setAsRoot | protected function _setAsRoot($entity)
{
$config = $this->getConfig();
$edge = $this->_getMax();
$this->_ensureFields($entity);
$right = $entity->get($config['right']);
$left = $entity->get($config['left']);
$diff = $right - $left;
if ($right - $left > 1) {
... | php | protected function _setAsRoot($entity)
{
$config = $this->getConfig();
$edge = $this->_getMax();
$this->_ensureFields($entity);
$right = $entity->get($config['right']);
$left = $entity->get($config['left']);
$diff = $right - $left;
if ($right - $left > 1) {
... | [
"protected",
"function",
"_setAsRoot",
"(",
"$",
"entity",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"$",
"edge",
"=",
"$",
"this",
"->",
"_getMax",
"(",
")",
";",
"$",
"this",
"->",
"_ensureFields",
"(",
"$",
"en... | Updates the left and right column for the passed entity so it can be set as
a new root in the tree. It also modifies the ordering in the rest of the tree
so the structure remains valid
@param \Cake\Datasource\EntityInterface $entity The entity to set as a new root
@return void | [
"Updates",
"the",
"left",
"and",
"right",
"column",
"for",
"the",
"passed",
"entity",
"so",
"it",
"can",
"be",
"set",
"as",
"a",
"new",
"root",
"in",
"the",
"tree",
".",
"It",
"also",
"modifies",
"the",
"ordering",
"in",
"the",
"rest",
"of",
"the",
"... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L312-L336 |
210,988 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior._unmarkInternalTree | protected function _unmarkInternalTree()
{
$config = $this->getConfig();
$this->_table->updateAll(
function ($exp) use ($config) {
/* @var \Cake\Database\Expression\QueryExpression $exp */
$leftInverse = clone $exp;
$leftInverse->setConjunc... | php | protected function _unmarkInternalTree()
{
$config = $this->getConfig();
$this->_table->updateAll(
function ($exp) use ($config) {
/* @var \Cake\Database\Expression\QueryExpression $exp */
$leftInverse = clone $exp;
$leftInverse->setConjunc... | [
"protected",
"function",
"_unmarkInternalTree",
"(",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"$",
"this",
"->",
"_table",
"->",
"updateAll",
"(",
"function",
"(",
"$",
"exp",
")",
"use",
"(",
"$",
"config",
")",
"... | Helper method used to invert the sign of the left and right columns that are
less than 0. They were set to negative values before so their absolute value
wouldn't change while performing other tree transformations.
@return void | [
"Helper",
"method",
"used",
"to",
"invert",
"the",
"sign",
"of",
"the",
"left",
"and",
"right",
"columns",
"that",
"are",
"less",
"than",
"0",
".",
"They",
"were",
"set",
"to",
"negative",
"values",
"before",
"so",
"their",
"absolute",
"value",
"wouldn",
... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L345-L364 |
210,989 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior.findPath | public function findPath(Query $query, array $options)
{
if (empty($options['for'])) {
throw new InvalidArgumentException("The 'for' key is required for find('path')");
}
$config = $this->getConfig();
list($left, $right) = array_map(
function ($field) {
... | php | public function findPath(Query $query, array $options)
{
if (empty($options['for'])) {
throw new InvalidArgumentException("The 'for' key is required for find('path')");
}
$config = $this->getConfig();
list($left, $right) = array_map(
function ($field) {
... | [
"public",
"function",
"findPath",
"(",
"Query",
"$",
"query",
",",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"options",
"[",
"'for'",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"The 'for' key is required for... | Custom finder method which can be used to return the list of nodes from the root
to a specific node in the tree. This custom finder requires that the key 'for'
is passed in the options containing the id of the node to get its path for.
@param \Cake\ORM\Query $query The constructed query to modify
@param array $options... | [
"Custom",
"finder",
"method",
"which",
"can",
"be",
"used",
"to",
"return",
"the",
"list",
"of",
"nodes",
"from",
"the",
"root",
"to",
"a",
"specific",
"node",
"in",
"the",
"tree",
".",
"This",
"custom",
"finder",
"requires",
"that",
"the",
"key",
"for",... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L376-L398 |
210,990 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior.childCount | public function childCount(EntityInterface $node, $direct = false)
{
$config = $this->getConfig();
$parent = $this->_table->aliasField($config['parent']);
if ($direct) {
return $this->_scope($this->_table->find())
->where([$parent => $node->get($this->_getPrimary... | php | public function childCount(EntityInterface $node, $direct = false)
{
$config = $this->getConfig();
$parent = $this->_table->aliasField($config['parent']);
if ($direct) {
return $this->_scope($this->_table->find())
->where([$parent => $node->get($this->_getPrimary... | [
"public",
"function",
"childCount",
"(",
"EntityInterface",
"$",
"node",
",",
"$",
"direct",
"=",
"false",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"$",
"parent",
"=",
"$",
"this",
"->",
"_table",
"->",
"aliasField",... | Get the number of children nodes.
@param \Cake\Datasource\EntityInterface $node The entity to count children for
@param bool $direct whether to count all nodes in the subtree or just
direct children
@return int Number of children nodes. | [
"Get",
"the",
"number",
"of",
"children",
"nodes",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L408-L422 |
210,991 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior.findChildren | public function findChildren(Query $query, array $options)
{
$config = $this->getConfig();
$options += ['for' => null, 'direct' => false];
list($parent, $left, $right) = array_map(
function ($field) {
return $this->_table->aliasField($field);
},
... | php | public function findChildren(Query $query, array $options)
{
$config = $this->getConfig();
$options += ['for' => null, 'direct' => false];
list($parent, $left, $right) = array_map(
function ($field) {
return $this->_table->aliasField($field);
},
... | [
"public",
"function",
"findChildren",
"(",
"Query",
"$",
"query",
",",
"array",
"$",
"options",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"$",
"options",
"+=",
"[",
"'for'",
"=>",
"null",
",",
"'direct'",
"=>",
"fal... | Get the children nodes of the current model
Available options are:
- for: The id of the record to read.
- direct: Boolean, whether to return only the direct (true), or all (false) children,
defaults to false (all children).
If the direct option is set to true, only the direct children are returned (based upon the pa... | [
"Get",
"the",
"children",
"nodes",
"of",
"the",
"current",
"model"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L440-L472 |
210,992 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior.findTreeList | public function findTreeList(Query $query, array $options)
{
$left = $this->_table->aliasField($this->getConfig('left'));
$results = $this->_scope($query)
->find('threaded', [
'parentField' => $this->getConfig('parent'),
'order' => [$left => 'ASC'],
... | php | public function findTreeList(Query $query, array $options)
{
$left = $this->_table->aliasField($this->getConfig('left'));
$results = $this->_scope($query)
->find('threaded', [
'parentField' => $this->getConfig('parent'),
'order' => [$left => 'ASC'],
... | [
"public",
"function",
"findTreeList",
"(",
"Query",
"$",
"query",
",",
"array",
"$",
"options",
")",
"{",
"$",
"left",
"=",
"$",
"this",
"->",
"_table",
"->",
"aliasField",
"(",
"$",
"this",
"->",
"getConfig",
"(",
"'left'",
")",
")",
";",
"$",
"resu... | Gets a representation of the elements in the tree as a flat list where the keys are
the primary key for the table and the values are the display field for the table.
Values are prefixed to visually indicate relative depth in the tree.
### Options
- keyPath: A dot separated path to fetch the field to use for the array... | [
"Gets",
"a",
"representation",
"of",
"the",
"elements",
"in",
"the",
"tree",
"as",
"a",
"flat",
"list",
"where",
"the",
"keys",
"are",
"the",
"primary",
"key",
"for",
"the",
"table",
"and",
"the",
"values",
"are",
"the",
"display",
"field",
"for",
"the",... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L491-L502 |
210,993 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior.formatTreeList | public function formatTreeList(Query $query, array $options = [])
{
return $query->formatResults(function ($results) use ($options) {
/* @var \Cake\Collection\CollectionTrait $results */
$options += [
'keyPath' => $this->_getPrimaryKey(),
'valuePath' =... | php | public function formatTreeList(Query $query, array $options = [])
{
return $query->formatResults(function ($results) use ($options) {
/* @var \Cake\Collection\CollectionTrait $results */
$options += [
'keyPath' => $this->_getPrimaryKey(),
'valuePath' =... | [
"public",
"function",
"formatTreeList",
"(",
"Query",
"$",
"query",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"query",
"->",
"formatResults",
"(",
"function",
"(",
"$",
"results",
")",
"use",
"(",
"$",
"options",
")",
"{",
... | Formats query as a flat list where the keys are the primary key for the table
and the values are the display field for the table. Values are prefixed to visually
indicate relative depth in the tree.
### Options
- keyPath: A dot separated path to the field that will be the result array key, or a closure to
return the ... | [
"Formats",
"query",
"as",
"a",
"flat",
"list",
"where",
"the",
"keys",
"are",
"the",
"primary",
"key",
"for",
"the",
"table",
"and",
"the",
"values",
"are",
"the",
"display",
"field",
"for",
"the",
"table",
".",
"Values",
"are",
"prefixed",
"to",
"visual... | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L521-L535 |
210,994 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior.removeFromTree | public function removeFromTree(EntityInterface $node)
{
return $this->_table->getConnection()->transactional(function () use ($node) {
$this->_ensureFields($node);
return $this->_removeFromTree($node);
});
} | php | public function removeFromTree(EntityInterface $node)
{
return $this->_table->getConnection()->transactional(function () use ($node) {
$this->_ensureFields($node);
return $this->_removeFromTree($node);
});
} | [
"public",
"function",
"removeFromTree",
"(",
"EntityInterface",
"$",
"node",
")",
"{",
"return",
"$",
"this",
"->",
"_table",
"->",
"getConnection",
"(",
")",
"->",
"transactional",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"node",
")",
"{",
"$",
"this... | Removes the current node from the tree, by positioning it as a new root
and re-parents all children up one level.
Note that the node will not be deleted just moved away from its current position
without moving its children with it.
@param \Cake\Datasource\EntityInterface $node The node to remove from the tree
@return... | [
"Removes",
"the",
"current",
"node",
"from",
"the",
"tree",
"by",
"positioning",
"it",
"as",
"a",
"new",
"root",
"and",
"re",
"-",
"parents",
"all",
"children",
"up",
"one",
"level",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L548-L555 |
210,995 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior._removeFromTree | protected function _removeFromTree($node)
{
$config = $this->getConfig();
$left = $node->get($config['left']);
$right = $node->get($config['right']);
$parent = $node->get($config['parent']);
$node->set($config['parent'], null);
if ($right - $left == 1) {
... | php | protected function _removeFromTree($node)
{
$config = $this->getConfig();
$left = $node->get($config['left']);
$right = $node->get($config['right']);
$parent = $node->get($config['parent']);
$node->set($config['parent'], null);
if ($right - $left == 1) {
... | [
"protected",
"function",
"_removeFromTree",
"(",
"$",
"node",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"$",
"left",
"=",
"$",
"node",
"->",
"get",
"(",
"$",
"config",
"[",
"'left'",
"]",
")",
";",
"$",
"right",
... | Helper function containing the actual code for removeFromTree
@param \Cake\Datasource\EntityInterface $node The node to remove from the tree
@return \Cake\Datasource\EntityInterface|false the node after being removed from the tree or
false on error | [
"Helper",
"function",
"containing",
"the",
"actual",
"code",
"for",
"removeFromTree"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L564-L596 |
210,996 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior.moveUp | public function moveUp(EntityInterface $node, $number = 1)
{
if ($number < 1) {
return false;
}
return $this->_table->getConnection()->transactional(function () use ($node, $number) {
$this->_ensureFields($node);
return $this->_moveUp($node, $number);
... | php | public function moveUp(EntityInterface $node, $number = 1)
{
if ($number < 1) {
return false;
}
return $this->_table->getConnection()->transactional(function () use ($node, $number) {
$this->_ensureFields($node);
return $this->_moveUp($node, $number);
... | [
"public",
"function",
"moveUp",
"(",
"EntityInterface",
"$",
"node",
",",
"$",
"number",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"number",
"<",
"1",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"_table",
"->",
"getConnection",
"(",... | Reorders the node without changing its parent.
If the node is the first child, or is a top level node with no previous node
this method will return false
@param \Cake\Datasource\EntityInterface $node The node to move
@param int|bool $number How many places to move the node, or true to move to first position
@throws \... | [
"Reorders",
"the",
"node",
"without",
"changing",
"its",
"parent",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L609-L620 |
210,997 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior._moveUp | protected function _moveUp($node, $number)
{
$config = $this->getConfig();
list($parent, $left, $right) = [$config['parent'], $config['left'], $config['right']];
list($nodeParent, $nodeLeft, $nodeRight) = array_values($node->extract([$parent, $left, $right]));
$targetNode = null;
... | php | protected function _moveUp($node, $number)
{
$config = $this->getConfig();
list($parent, $left, $right) = [$config['parent'], $config['left'], $config['right']];
list($nodeParent, $nodeLeft, $nodeRight) = array_values($node->extract([$parent, $left, $right]));
$targetNode = null;
... | [
"protected",
"function",
"_moveUp",
"(",
"$",
"node",
",",
"$",
"number",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"list",
"(",
"$",
"parent",
",",
"$",
"left",
",",
"$",
"right",
")",
"=",
"[",
"$",
"config",
... | Helper function used with the actual code for moveUp
@param \Cake\Datasource\EntityInterface $node The node to move
@param int|bool $number How many places to move the node, or true to move to first position
@throws \Cake\Datasource\Exception\RecordNotFoundException When node was not found
@return \Cake\Datasource\Ent... | [
"Helper",
"function",
"used",
"with",
"the",
"actual",
"code",
"for",
"moveUp"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L630-L686 |
210,998 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior.moveDown | public function moveDown(EntityInterface $node, $number = 1)
{
if ($number < 1) {
return false;
}
return $this->_table->getConnection()->transactional(function () use ($node, $number) {
$this->_ensureFields($node);
return $this->_moveDown($node, $number)... | php | public function moveDown(EntityInterface $node, $number = 1)
{
if ($number < 1) {
return false;
}
return $this->_table->getConnection()->transactional(function () use ($node, $number) {
$this->_ensureFields($node);
return $this->_moveDown($node, $number)... | [
"public",
"function",
"moveDown",
"(",
"EntityInterface",
"$",
"node",
",",
"$",
"number",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"number",
"<",
"1",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"_table",
"->",
"getConnection",
"(... | Reorders the node without changing the parent.
If the node is the last child, or is a top level node with no subsequent node
this method will return false
@param \Cake\Datasource\EntityInterface $node The node to move
@param int|bool $number How many places to move the node or true to move to last position
@throws \C... | [
"Reorders",
"the",
"node",
"without",
"changing",
"the",
"parent",
"."
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L699-L710 |
210,999 | cakephp/cakephp | src/ORM/Behavior/TreeBehavior.php | TreeBehavior._getNode | protected function _getNode($id)
{
$config = $this->getConfig();
list($parent, $left, $right) = [$config['parent'], $config['left'], $config['right']];
$primaryKey = $this->_getPrimaryKey();
$fields = [$parent, $left, $right];
if ($config['level']) {
$fields[] = $... | php | protected function _getNode($id)
{
$config = $this->getConfig();
list($parent, $left, $right) = [$config['parent'], $config['left'], $config['right']];
$primaryKey = $this->_getPrimaryKey();
$fields = [$parent, $left, $right];
if ($config['level']) {
$fields[] = $... | [
"protected",
"function",
"_getNode",
"(",
"$",
"id",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"list",
"(",
"$",
"parent",
",",
"$",
"left",
",",
"$",
"right",
")",
"=",
"[",
"$",
"config",
"[",
"'parent'",
"]",... | Returns a single node from the tree from its primary key
@param mixed $id Record id.
@return \Cake\Datasource\EntityInterface
@throws \Cake\Datasource\Exception\RecordNotFoundException When node was not found | [
"Returns",
"a",
"single",
"node",
"from",
"the",
"tree",
"from",
"its",
"primary",
"key"
] | 5f6c9d65dcbbfc093410d1dbbb207a17f4cde540 | https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Behavior/TreeBehavior.php#L785-L805 |
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.