id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
211,500
cakephp/cakephp
src/Cache/Engine/XcacheEngine.php
XcacheEngine.decrement
public function decrement($key, $offset = 1) { $key = $this->_key($key); return xcache_dec($key, $offset); }
php
public function decrement($key, $offset = 1) { $key = $this->_key($key); return xcache_dec($key, $offset); }
[ "public", "function", "decrement", "(", "$", "key", ",", "$", "offset", "=", "1", ")", "{", "$", "key", "=", "$", "this", "->", "_key", "(", "$", "key", ")", ";", "return", "xcache_dec", "(", "$", "key", ",", "$", "offset", ")", ";", "}" ]
Decrements the value of an integer cached key. If the cache key is not an integer it will be treated as 0 @param string $key Identifier for the data @param int $offset How much to subtract @return bool|int New decremented value, false otherwise
[ "Decrements", "the", "value", "of", "an", "integer", "cached", "key", ".", "If", "the", "cache", "key", "is", "not", "an", "integer", "it", "will", "be", "treated", "as", "0" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Cache/Engine/XcacheEngine.php#L145-L150
211,501
cakephp/cakephp
src/View/Form/ArrayContext.php
ArrayContext.primaryKey
public function primaryKey() { if (empty($this->_context['schema']['_constraints']) || !is_array($this->_context['schema']['_constraints']) ) { return []; } foreach ($this->_context['schema']['_constraints'] as $data) { if (isset($data['type']) && ...
php
public function primaryKey() { if (empty($this->_context['schema']['_constraints']) || !is_array($this->_context['schema']['_constraints']) ) { return []; } foreach ($this->_context['schema']['_constraints'] as $data) { if (isset($data['type']) && ...
[ "public", "function", "primaryKey", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "_context", "[", "'schema'", "]", "[", "'_constraints'", "]", ")", "||", "!", "is_array", "(", "$", "this", "->", "_context", "[", "'schema'", "]", "[", "'...
Get the fields used in the context as a primary key. @return array
[ "Get", "the", "fields", "used", "in", "the", "context", "as", "a", "primary", "key", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Form/ArrayContext.php#L107-L121
211,502
cakephp/cakephp
src/View/Form/ArrayContext.php
ArrayContext.isCreate
public function isCreate() { $primary = $this->primaryKey(); foreach ($primary as $column) { if (!empty($this->_context['defaults'][$column])) { return false; } } return true; }
php
public function isCreate() { $primary = $this->primaryKey(); foreach ($primary as $column) { if (!empty($this->_context['defaults'][$column])) { return false; } } return true; }
[ "public", "function", "isCreate", "(", ")", "{", "$", "primary", "=", "$", "this", "->", "primaryKey", "(", ")", ";", "foreach", "(", "$", "primary", "as", "$", "column", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "_context", "[", ...
Returns whether or not this form is for a create operation. For this method to return true, both the primary key constraint must be defined in the 'schema' data, and the 'defaults' data must contain a value for all fields in the key. @return bool
[ "Returns", "whether", "or", "not", "this", "form", "is", "for", "a", "create", "operation", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Form/ArrayContext.php#L142-L152
211,503
cakephp/cakephp
src/View/Form/ArrayContext.php
ArrayContext.val
public function val($field, $options = []) { $options += [ 'default' => null, 'schemaDefault' => true ]; $val = $this->_request->getData($field); if ($val !== null) { return $val; } if ($options['default'] !== null || !$options['sc...
php
public function val($field, $options = []) { $options += [ 'default' => null, 'schemaDefault' => true ]; $val = $this->_request->getData($field); if ($val !== null) { return $val; } if ($options['default'] !== null || !$options['sc...
[ "public", "function", "val", "(", "$", "field", ",", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "[", "'default'", "=>", "null", ",", "'schemaDefault'", "=>", "true", "]", ";", "$", "val", "=", "$", "this", "->", "_request", "->"...
Get the current value for a given field. This method will coalesce the current request data and the 'defaults' array. @param string $field A dot separated path to the field a value is needed for. @param array $options Options: - `default`: Default value to return if no value found in request data or context record. -...
[ "Get", "the", "current", "value", "for", "a", "given", "field", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Form/ArrayContext.php#L169-L193
211,504
cakephp/cakephp
src/View/Form/ArrayContext.php
ArrayContext.hasError
public function hasError($field) { if (empty($this->_context['errors'])) { return false; } return (bool)Hash::check($this->_context['errors'], $field); }
php
public function hasError($field) { if (empty($this->_context['errors'])) { return false; } return (bool)Hash::check($this->_context['errors'], $field); }
[ "public", "function", "hasError", "(", "$", "field", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "_context", "[", "'errors'", "]", ")", ")", "{", "return", "false", ";", "}", "return", "(", "bool", ")", "Hash", "::", "check", "(", "$", ...
Check whether or not a field has an error attached to it @param string $field A dot separated path to check errors on. @return bool Returns true if the errors for the field are not empty.
[ "Check", "whether", "or", "not", "a", "field", "has", "an", "error", "attached", "to", "it" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Form/ArrayContext.php#L307-L314
211,505
cakephp/cakephp
src/Core/App.php
App.shortName
public static function shortName($class, $type, $suffix = '') { $class = str_replace('\\', '/', $class); $type = '/' . $type . '/'; $pos = strrpos($class, $type); $pluginName = substr($class, 0, $pos); $name = substr($class, $pos + strlen($type)); if ($suffix) { ...
php
public static function shortName($class, $type, $suffix = '') { $class = str_replace('\\', '/', $class); $type = '/' . $type . '/'; $pos = strrpos($class, $type); $pluginName = substr($class, 0, $pos); $name = substr($class, $pos + strlen($type)); if ($suffix) { ...
[ "public", "static", "function", "shortName", "(", "$", "class", ",", "$", "type", ",", "$", "suffix", "=", "''", ")", "{", "$", "class", "=", "str_replace", "(", "'\\\\'", ",", "'/'", ",", "$", "class", ")", ";", "$", "type", "=", "'/'", ".", "$"...
Returns the plugin split name of a class Examples: ``` App::shortName( 'SomeVendor\SomePlugin\Controller\Component\TestComponent', 'Controller/Component', 'Component' ) ``` Returns: SomeVendor/SomePlugin.Test ``` App::shortName( 'SomeVendor\SomePlugin\Controller\Component\Subfolder\TestComponent', 'Controller/Compo...
[ "Returns", "the", "plugin", "split", "name", "of", "a", "class" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/App.php#L117-L139
211,506
cakephp/cakephp
src/Core/App.php
App.path
public static function path($type, $plugin = null) { if ($type === 'Plugin') { return (array)Configure::read('App.paths.plugins'); } if (empty($plugin) && $type === 'Locale') { return (array)Configure::read('App.paths.locales'); } if (empty($plugin) &&...
php
public static function path($type, $plugin = null) { if ($type === 'Plugin') { return (array)Configure::read('App.paths.plugins'); } if (empty($plugin) && $type === 'Locale') { return (array)Configure::read('App.paths.locales'); } if (empty($plugin) &&...
[ "public", "static", "function", "path", "(", "$", "type", ",", "$", "plugin", "=", "null", ")", "{", "if", "(", "$", "type", "===", "'Plugin'", ")", "{", "return", "(", "array", ")", "Configure", "::", "read", "(", "'App.paths.plugins'", ")", ";", "}...
Used to read information stored path Usage: ``` App::path('Plugin'); ``` Will return the configured paths for plugins. This is a simpler way to access the `App.paths.plugins` configure variable. ``` App::path('Model/Datasource', 'MyPlugin'); ``` Will return the path for datasources under the 'MyPlugin' plugin. @p...
[ "Used", "to", "read", "information", "stored", "path" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/App.php#L178-L194
211,507
cakephp/cakephp
src/Datasource/QueryCacher.php
QueryCacher.fetch
public function fetch($query) { $key = $this->_resolveKey($query); $storage = $this->_resolveCacher(); $result = $storage->read($key); if (empty($result)) { return null; } return $result; }
php
public function fetch($query) { $key = $this->_resolveKey($query); $storage = $this->_resolveCacher(); $result = $storage->read($key); if (empty($result)) { return null; } return $result; }
[ "public", "function", "fetch", "(", "$", "query", ")", "{", "$", "key", "=", "$", "this", "->", "_resolveKey", "(", "$", "query", ")", ";", "$", "storage", "=", "$", "this", "->", "_resolveCacher", "(", ")", ";", "$", "result", "=", "$", "storage",...
Load the cached results from the cache or run the query. @param object $query The query the cache read is for. @return \Cake\Datasource\ResultSetInterface|null Either the cached results or null.
[ "Load", "the", "cached", "results", "from", "the", "cache", "or", "run", "the", "query", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Datasource/QueryCacher.php#L72-L82
211,508
cakephp/cakephp
src/Datasource/QueryCacher.php
QueryCacher.store
public function store($query, Traversable $results) { $key = $this->_resolveKey($query); $storage = $this->_resolveCacher(); return $storage->write($key, $results); }
php
public function store($query, Traversable $results) { $key = $this->_resolveKey($query); $storage = $this->_resolveCacher(); return $storage->write($key, $results); }
[ "public", "function", "store", "(", "$", "query", ",", "Traversable", "$", "results", ")", "{", "$", "key", "=", "$", "this", "->", "_resolveKey", "(", "$", "query", ")", ";", "$", "storage", "=", "$", "this", "->", "_resolveCacher", "(", ")", ";", ...
Store the result set into the cache. @param object $query The query the cache read is for. @param \Traversable $results The result set to store. @return bool True if the data was successfully cached, false on failure
[ "Store", "the", "result", "set", "into", "the", "cache", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Datasource/QueryCacher.php#L91-L97
211,509
cakephp/cakephp
src/Datasource/QueryCacher.php
QueryCacher._resolveCacher
protected function _resolveCacher() { if (is_string($this->_config)) { return Cache::engine($this->_config); } return $this->_config; }
php
protected function _resolveCacher() { if (is_string($this->_config)) { return Cache::engine($this->_config); } return $this->_config; }
[ "protected", "function", "_resolveCacher", "(", ")", "{", "if", "(", "is_string", "(", "$", "this", "->", "_config", ")", ")", "{", "return", "Cache", "::", "engine", "(", "$", "this", "->", "_config", ")", ";", "}", "return", "$", "this", "->", "_co...
Get the cache engine. @return \Cake\Cache\CacheEngine
[ "Get", "the", "cache", "engine", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Datasource/QueryCacher.php#L126-L133
211,510
cakephp/cakephp
src/ORM/Table.php
Table.getTable
public function getTable() { if ($this->_table === null) { $table = namespaceSplit(get_class($this)); $table = substr(end($table), 0, -5); if (!$table) { $table = $this->getAlias(); } $this->_table = Inflector::underscore($table); ...
php
public function getTable() { if ($this->_table === null) { $table = namespaceSplit(get_class($this)); $table = substr(end($table), 0, -5); if (!$table) { $table = $this->getAlias(); } $this->_table = Inflector::underscore($table); ...
[ "public", "function", "getTable", "(", ")", "{", "if", "(", "$", "this", "->", "_table", "===", "null", ")", "{", "$", "table", "=", "namespaceSplit", "(", "get_class", "(", "$", "this", ")", ")", ";", "$", "table", "=", "substr", "(", "end", "(", ...
Returns the database table name. @return string
[ "Returns", "the", "database", "table", "name", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L357-L369
211,511
cakephp/cakephp
src/ORM/Table.php
Table.table
public function table($table = null) { deprecationWarning( get_called_class() . '::table() is deprecated. ' . 'Use setTable()/getTable() instead.' ); if ($table !== null) { $this->setTable($table); } return $this->getTable(); }
php
public function table($table = null) { deprecationWarning( get_called_class() . '::table() is deprecated. ' . 'Use setTable()/getTable() instead.' ); if ($table !== null) { $this->setTable($table); } return $this->getTable(); }
[ "public", "function", "table", "(", "$", "table", "=", "null", ")", "{", "deprecationWarning", "(", "get_called_class", "(", ")", ".", "'::table() is deprecated. '", ".", "'Use setTable()/getTable() instead.'", ")", ";", "if", "(", "$", "table", "!==", "null", "...
Returns the database table name or sets a new one. @deprecated 3.4.0 Use setTable()/getTable() instead. @param string|null $table the new table name @return string
[ "Returns", "the", "database", "table", "name", "or", "sets", "a", "new", "one", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L378-L389
211,512
cakephp/cakephp
src/ORM/Table.php
Table.getAlias
public function getAlias() { if ($this->_alias === null) { $alias = namespaceSplit(get_class($this)); $alias = substr(end($alias), 0, -5) ?: $this->_table; $this->_alias = $alias; } return $this->_alias; }
php
public function getAlias() { if ($this->_alias === null) { $alias = namespaceSplit(get_class($this)); $alias = substr(end($alias), 0, -5) ?: $this->_table; $this->_alias = $alias; } return $this->_alias; }
[ "public", "function", "getAlias", "(", ")", "{", "if", "(", "$", "this", "->", "_alias", "===", "null", ")", "{", "$", "alias", "=", "namespaceSplit", "(", "get_class", "(", "$", "this", ")", ")", ";", "$", "alias", "=", "substr", "(", "end", "(", ...
Returns the table alias. @return string
[ "Returns", "the", "table", "alias", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L409-L418
211,513
cakephp/cakephp
src/ORM/Table.php
Table.getRegistryAlias
public function getRegistryAlias() { if ($this->_registryAlias === null) { $this->_registryAlias = $this->getAlias(); } return $this->_registryAlias; }
php
public function getRegistryAlias() { if ($this->_registryAlias === null) { $this->_registryAlias = $this->getAlias(); } return $this->_registryAlias; }
[ "public", "function", "getRegistryAlias", "(", ")", "{", "if", "(", "$", "this", "->", "_registryAlias", "===", "null", ")", "{", "$", "this", "->", "_registryAlias", "=", "$", "this", "->", "getAlias", "(", ")", ";", "}", "return", "$", "this", "->", ...
Returns the table registry key used to create this table instance. @return string
[ "Returns", "the", "table", "registry", "key", "used", "to", "create", "this", "table", "instance", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L472-L479
211,514
cakephp/cakephp
src/ORM/Table.php
Table.registryAlias
public function registryAlias($registryAlias = null) { deprecationWarning( get_called_class() . '::registryAlias() is deprecated. ' . 'Use setRegistryAlias()/getRegistryAlias() instead.' ); if ($registryAlias !== null) { $this->setRegistryAlias($registryAl...
php
public function registryAlias($registryAlias = null) { deprecationWarning( get_called_class() . '::registryAlias() is deprecated. ' . 'Use setRegistryAlias()/getRegistryAlias() instead.' ); if ($registryAlias !== null) { $this->setRegistryAlias($registryAl...
[ "public", "function", "registryAlias", "(", "$", "registryAlias", "=", "null", ")", "{", "deprecationWarning", "(", "get_called_class", "(", ")", ".", "'::registryAlias() is deprecated. '", ".", "'Use setRegistryAlias()/getRegistryAlias() instead.'", ")", ";", "if", "(", ...
Returns the table registry key used to create this table instance or sets one. @deprecated 3.4.0 Use setRegistryAlias()/getRegistryAlias() instead. @param string|null $registryAlias the key used to access this object @return string
[ "Returns", "the", "table", "registry", "key", "used", "to", "create", "this", "table", "instance", "or", "sets", "one", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L488-L499
211,515
cakephp/cakephp
src/ORM/Table.php
Table.connection
public function connection(ConnectionInterface $connection = null) { deprecationWarning( get_called_class() . '::connection() is deprecated. ' . 'Use setConnection()/getConnection() instead.' ); if ($connection !== null) { $this->setConnection($connection)...
php
public function connection(ConnectionInterface $connection = null) { deprecationWarning( get_called_class() . '::connection() is deprecated. ' . 'Use setConnection()/getConnection() instead.' ); if ($connection !== null) { $this->setConnection($connection)...
[ "public", "function", "connection", "(", "ConnectionInterface", "$", "connection", "=", "null", ")", "{", "deprecationWarning", "(", "get_called_class", "(", ")", ".", "'::connection() is deprecated. '", ".", "'Use setConnection()/getConnection() instead.'", ")", ";", "if...
Returns the connection instance or sets a new one @deprecated 3.4.0 Use setConnection()/getConnection() instead. @param \Cake\Datasource\ConnectionInterface|null $connection The new connection instance @return \Cake\Datasource\ConnectionInterface
[ "Returns", "the", "connection", "instance", "or", "sets", "a", "new", "one" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L531-L542
211,516
cakephp/cakephp
src/ORM/Table.php
Table.setSchema
public function setSchema($schema) { if (is_array($schema)) { $constraints = []; if (isset($schema['_constraints'])) { $constraints = $schema['_constraints']; unset($schema['_constraints']); } $schema = new TableSchema($this->...
php
public function setSchema($schema) { if (is_array($schema)) { $constraints = []; if (isset($schema['_constraints'])) { $constraints = $schema['_constraints']; unset($schema['_constraints']); } $schema = new TableSchema($this->...
[ "public", "function", "setSchema", "(", "$", "schema", ")", "{", "if", "(", "is_array", "(", "$", "schema", ")", ")", "{", "$", "constraints", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "schema", "[", "'_constraints'", "]", ")", ")", "{", ...
Sets the schema table object describing this table's properties. If an array is passed, a new TableSchema will be constructed out of it and used as the schema for this table. @param array|\Cake\Database\Schema\TableSchema $schema Schema to be used for this table @return $this
[ "Sets", "the", "schema", "table", "object", "describing", "this", "table", "s", "properties", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L571-L591
211,517
cakephp/cakephp
src/ORM/Table.php
Table.getPrimaryKey
public function getPrimaryKey() { if ($this->_primaryKey === null) { $key = (array)$this->getSchema()->primaryKey(); if (count($key) === 1) { $key = $key[0]; } $this->_primaryKey = $key; } return $this->_primaryKey; }
php
public function getPrimaryKey() { if ($this->_primaryKey === null) { $key = (array)$this->getSchema()->primaryKey(); if (count($key) === 1) { $key = $key[0]; } $this->_primaryKey = $key; } return $this->_primaryKey; }
[ "public", "function", "getPrimaryKey", "(", ")", "{", "if", "(", "$", "this", "->", "_primaryKey", "===", "null", ")", "{", "$", "key", "=", "(", "array", ")", "$", "this", "->", "getSchema", "(", ")", "->", "primaryKey", "(", ")", ";", "if", "(", ...
Returns the primary key field name. @return string|array
[ "Returns", "the", "primary", "key", "field", "name", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L677-L688
211,518
cakephp/cakephp
src/ORM/Table.php
Table.getDisplayField
public function getDisplayField() { if ($this->_displayField === null) { $schema = $this->getSchema(); $primary = (array)$this->getPrimaryKey(); $this->_displayField = array_shift($primary); if ($schema->getColumn('title')) { $this->_displayFie...
php
public function getDisplayField() { if ($this->_displayField === null) { $schema = $this->getSchema(); $primary = (array)$this->getPrimaryKey(); $this->_displayField = array_shift($primary); if ($schema->getColumn('title')) { $this->_displayFie...
[ "public", "function", "getDisplayField", "(", ")", "{", "if", "(", "$", "this", "->", "_displayField", "===", "null", ")", "{", "$", "schema", "=", "$", "this", "->", "getSchema", "(", ")", ";", "$", "primary", "=", "(", "array", ")", "$", "this", ...
Returns the display field. @return string
[ "Returns", "the", "display", "field", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L728-L743
211,519
cakephp/cakephp
src/ORM/Table.php
Table.getEntityClass
public function getEntityClass() { if (!$this->_entityClass) { $default = Entity::class; $self = get_called_class(); $parts = explode('\\', $self); if ($self === __CLASS__ || count($parts) < 3) { return $this->_entityClass = $default; ...
php
public function getEntityClass() { if (!$this->_entityClass) { $default = Entity::class; $self = get_called_class(); $parts = explode('\\', $self); if ($self === __CLASS__ || count($parts) < 3) { return $this->_entityClass = $default; ...
[ "public", "function", "getEntityClass", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_entityClass", ")", "{", "$", "default", "=", "Entity", "::", "class", ";", "$", "self", "=", "get_called_class", "(", ")", ";", "$", "parts", "=", "explode", ...
Returns the class used to hydrate rows for this table. @return string
[ "Returns", "the", "class", "used", "to", "hydrate", "rows", "for", "this", "table", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L772-L798
211,520
cakephp/cakephp
src/ORM/Table.php
Table.setEntityClass
public function setEntityClass($name) { $class = App::className($name, 'Model/Entity'); if (!$class) { throw new MissingEntityException([$name]); } $this->_entityClass = $class; return $this; }
php
public function setEntityClass($name) { $class = App::className($name, 'Model/Entity'); if (!$class) { throw new MissingEntityException([$name]); } $this->_entityClass = $class; return $this; }
[ "public", "function", "setEntityClass", "(", "$", "name", ")", "{", "$", "class", "=", "App", "::", "className", "(", "$", "name", ",", "'Model/Entity'", ")", ";", "if", "(", "!", "$", "class", ")", "{", "throw", "new", "MissingEntityException", "(", "...
Sets the class used to hydrate rows for this table. @param string $name The name of the class to use @throws \Cake\ORM\Exception\MissingEntityException when the entity class cannot be found @return $this
[ "Sets", "the", "class", "used", "to", "hydrate", "rows", "for", "this", "table", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L807-L817
211,521
cakephp/cakephp
src/ORM/Table.php
Table.entityClass
public function entityClass($name = null) { deprecationWarning( get_called_class() . '::entityClass() is deprecated. ' . 'Use setEntityClass()/getEntityClass() instead.' ); if ($name !== null) { $this->setEntityClass($name); } return $this...
php
public function entityClass($name = null) { deprecationWarning( get_called_class() . '::entityClass() is deprecated. ' . 'Use setEntityClass()/getEntityClass() instead.' ); if ($name !== null) { $this->setEntityClass($name); } return $this...
[ "public", "function", "entityClass", "(", "$", "name", "=", "null", ")", "{", "deprecationWarning", "(", "get_called_class", "(", ")", ".", "'::entityClass() is deprecated. '", ".", "'Use setEntityClass()/getEntityClass() instead.'", ")", ";", "if", "(", "$", "name", ...
Returns the class used to hydrate rows for this table or sets a new one @deprecated 3.4.0 Use setEntityClass()/getEntityClass() instead. @param string|null $name The name of the class to use @throws \Cake\ORM\Exception\MissingEntityException when the entity class cannot be found @return string
[ "Returns", "the", "class", "used", "to", "hydrate", "rows", "for", "this", "table", "or", "sets", "a", "new", "one" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L828-L839
211,522
cakephp/cakephp
src/ORM/Table.php
Table.addBehaviors
public function addBehaviors(array $behaviors) { foreach ($behaviors as $name => $options) { if (is_int($name)) { $name = $options; $options = []; } $this->addBehavior($name, $options); } return $this; }
php
public function addBehaviors(array $behaviors) { foreach ($behaviors as $name => $options) { if (is_int($name)) { $name = $options; $options = []; } $this->addBehavior($name, $options); } return $this; }
[ "public", "function", "addBehaviors", "(", "array", "$", "behaviors", ")", "{", "foreach", "(", "$", "behaviors", "as", "$", "name", "=>", "$", "options", ")", "{", "if", "(", "is_int", "(", "$", "name", ")", ")", "{", "$", "name", "=", "$", "optio...
Adds an array of behaviors to the table's behavior collection. Example: ``` $this->addBehaviors([ 'Timestamp', 'Tree' => ['level' => 'level'], ]); ``` @param array $behaviors All of the behaviors to load. @return $this @throws \RuntimeException If a behavior is being reloaded.
[ "Adds", "an", "array", "of", "behaviors", "to", "the", "table", "s", "behavior", "collection", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L888-L900
211,523
cakephp/cakephp
src/ORM/Table.php
Table.getBehavior
public function getBehavior($name) { /** @var \Cake\ORM\Behavior $behavior */ $behavior = $this->_behaviors->get($name); if ($behavior === null) { throw new InvalidArgumentException(sprintf( 'The %s behavior is not defined on %s.', $name, ...
php
public function getBehavior($name) { /** @var \Cake\ORM\Behavior $behavior */ $behavior = $this->_behaviors->get($name); if ($behavior === null) { throw new InvalidArgumentException(sprintf( 'The %s behavior is not defined on %s.', $name, ...
[ "public", "function", "getBehavior", "(", "$", "name", ")", "{", "/** @var \\Cake\\ORM\\Behavior $behavior */", "$", "behavior", "=", "$", "this", "->", "_behaviors", "->", "get", "(", "$", "name", ")", ";", "if", "(", "$", "behavior", "===", "null", ")", ...
Get a behavior from the registry. @param string $name The behavior alias to get from the registry. @return \Cake\ORM\Behavior @throws \InvalidArgumentException If the behavior does not exist.
[ "Get", "a", "behavior", "from", "the", "registry", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L941-L954
211,524
cakephp/cakephp
src/ORM/Table.php
Table.findAssociation
protected function findAssociation($name) { if (strpos($name, '.') === false) { return $this->_associations->get($name); } list($name, $next) = array_pad(explode('.', $name, 2), 2, null); $result = $this->_associations->get($name); if ($result !== null && $next ...
php
protected function findAssociation($name) { if (strpos($name, '.') === false) { return $this->_associations->get($name); } list($name, $next) = array_pad(explode('.', $name, 2), 2, null); $result = $this->_associations->get($name); if ($result !== null && $next ...
[ "protected", "function", "findAssociation", "(", "$", "name", ")", "{", "if", "(", "strpos", "(", "$", "name", ",", "'.'", ")", "===", "false", ")", "{", "return", "$", "this", "->", "_associations", "->", "get", "(", "$", "name", ")", ";", "}", "l...
Returns an association object configured for the specified alias if any. The name argument also supports dot syntax to access deeper associations. ``` $users = $this->getAssociation('Articles.Comments.Users'); ``` @param string $name The alias used for the association. @return \Cake\ORM\Association|null Either the a...
[ "Returns", "an", "association", "object", "configured", "for", "the", "specified", "alias", "if", "any", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L1037-L1051
211,525
cakephp/cakephp
src/ORM/Table.php
Table.addAssociations
public function addAssociations(array $params) { foreach ($params as $assocType => $tables) { foreach ($tables as $associated => $options) { if (is_numeric($associated)) { $associated = $options; $options = []; } ...
php
public function addAssociations(array $params) { foreach ($params as $assocType => $tables) { foreach ($tables as $associated => $options) { if (is_numeric($associated)) { $associated = $options; $options = []; } ...
[ "public", "function", "addAssociations", "(", "array", "$", "params", ")", "{", "foreach", "(", "$", "params", "as", "$", "assocType", "=>", "$", "tables", ")", "{", "foreach", "(", "$", "tables", "as", "$", "associated", "=>", "$", "options", ")", "{"...
Setup multiple associations. It takes an array containing set of table names indexed by association type as argument: ``` $this->Posts->addAssociations([ 'belongsTo' => [ 'Users' => ['className' => 'App\Model\Table\UsersTable'] ], 'hasMany' => ['Comments'], 'belongsToMany' => ['Tags'] ]); ``` Each association type a...
[ "Setup", "multiple", "associations", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L1090-L1103
211,526
cakephp/cakephp
src/ORM/Table.php
Table.belongsTo
public function belongsTo($associated, array $options = []) { $options += ['sourceTable' => $this]; /** @var \Cake\ORM\Association\BelongsTo $association */ $association = $this->_associations->load(BelongsTo::class, $associated, $options); return $association; }
php
public function belongsTo($associated, array $options = []) { $options += ['sourceTable' => $this]; /** @var \Cake\ORM\Association\BelongsTo $association */ $association = $this->_associations->load(BelongsTo::class, $associated, $options); return $association; }
[ "public", "function", "belongsTo", "(", "$", "associated", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "[", "'sourceTable'", "=>", "$", "this", "]", ";", "/** @var \\Cake\\ORM\\Association\\BelongsTo $association */", "$", "assoc...
Creates a new BelongsTo association between this table and a target table. A "belongs to" association is a N-1 relationship where this table is the N side, and where there is a single associated record in the target table for each one in this table. Target table can be inferred by its name, which is provided in the fi...
[ "Creates", "a", "new", "BelongsTo", "association", "between", "this", "table", "and", "a", "target", "table", ".", "A", "belongs", "to", "association", "is", "a", "N", "-", "1", "relationship", "where", "this", "table", "is", "the", "N", "side", "and", "...
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L1135-L1143
211,527
cakephp/cakephp
src/ORM/Table.php
Table.hasOne
public function hasOne($associated, array $options = []) { $options += ['sourceTable' => $this]; /** @var \Cake\ORM\Association\HasOne $association */ $association = $this->_associations->load(HasOne::class, $associated, $options); return $association; }
php
public function hasOne($associated, array $options = []) { $options += ['sourceTable' => $this]; /** @var \Cake\ORM\Association\HasOne $association */ $association = $this->_associations->load(HasOne::class, $associated, $options); return $association; }
[ "public", "function", "hasOne", "(", "$", "associated", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "[", "'sourceTable'", "=>", "$", "this", "]", ";", "/** @var \\Cake\\ORM\\Association\\HasOne $association */", "$", "association...
Creates a new HasOne association between this table and a target table. A "has one" association is a 1-1 relationship. Target table can be inferred by its name, which is provided in the first argument, or you can either pass the class name to be instantiated or an instance of it directly. The options array accept the...
[ "Creates", "a", "new", "HasOne", "association", "between", "this", "table", "and", "a", "target", "table", ".", "A", "has", "one", "association", "is", "a", "1", "-", "1", "relationship", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L1181-L1189
211,528
cakephp/cakephp
src/ORM/Table.php
Table.hasMany
public function hasMany($associated, array $options = []) { $options += ['sourceTable' => $this]; /** @var \Cake\ORM\Association\HasMany $association */ $association = $this->_associations->load(HasMany::class, $associated, $options); return $association; }
php
public function hasMany($associated, array $options = []) { $options += ['sourceTable' => $this]; /** @var \Cake\ORM\Association\HasMany $association */ $association = $this->_associations->load(HasMany::class, $associated, $options); return $association; }
[ "public", "function", "hasMany", "(", "$", "associated", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "[", "'sourceTable'", "=>", "$", "this", "]", ";", "/** @var \\Cake\\ORM\\Association\\HasMany $association */", "$", "associati...
Creates a new HasMany association between this table and a target table. A "has many" association is a 1-N relationship. Target table can be inferred by its name, which is provided in the first argument, or you can either pass the class name to be instantiated or an instance of it directly. The options array accept t...
[ "Creates", "a", "new", "HasMany", "association", "between", "this", "table", "and", "a", "target", "table", ".", "A", "has", "many", "association", "is", "a", "1", "-", "N", "relationship", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L1233-L1241
211,529
cakephp/cakephp
src/ORM/Table.php
Table.belongsToMany
public function belongsToMany($associated, array $options = []) { $options += ['sourceTable' => $this]; /** @var \Cake\ORM\Association\BelongsToMany $association */ $association = $this->_associations->load(BelongsToMany::class, $associated, $options); return $association; }
php
public function belongsToMany($associated, array $options = []) { $options += ['sourceTable' => $this]; /** @var \Cake\ORM\Association\BelongsToMany $association */ $association = $this->_associations->load(BelongsToMany::class, $associated, $options); return $association; }
[ "public", "function", "belongsToMany", "(", "$", "associated", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "[", "'sourceTable'", "=>", "$", "this", "]", ";", "/** @var \\Cake\\ORM\\Association\\BelongsToMany $association */", "$", ...
Creates a new BelongsToMany association between this table and a target table. A "belongs to many" association is a M-N relationship. Target table can be inferred by its name, which is provided in the first argument, or you can either pass the class name to be instantiated or an instance of it directly. The options a...
[ "Creates", "a", "new", "BelongsToMany", "association", "between", "this", "table", "and", "a", "target", "table", ".", "A", "belongs", "to", "many", "association", "is", "a", "M", "-", "N", "relationship", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L1287-L1295
211,530
cakephp/cakephp
src/ORM/Table.php
Table.findThreaded
public function findThreaded(Query $query, array $options) { $options += [ 'keyField' => $this->getPrimaryKey(), 'parentField' => 'parent_id', 'nestingKey' => 'children' ]; if (isset($options['idField'])) { $options['keyField'] = $options['idF...
php
public function findThreaded(Query $query, array $options) { $options += [ 'keyField' => $this->getPrimaryKey(), 'parentField' => 'parent_id', 'nestingKey' => 'children' ]; if (isset($options['idField'])) { $options['keyField'] = $options['idF...
[ "public", "function", "findThreaded", "(", "Query", "$", "query", ",", "array", "$", "options", ")", "{", "$", "options", "+=", "[", "'keyField'", "=>", "$", "this", "->", "getPrimaryKey", "(", ")", ",", "'parentField'", "=>", "'parent_id'", ",", "'nesting...
Results for this finder will be a nested array, and is appropriate if you want to use the parent_id field of your model data to build nested results. Values belonging to a parent row based on their parent_id value will be recursively nested inside the parent row values using the `children` property You can customize ...
[ "Results", "for", "this", "finder", "will", "be", "a", "nested", "array", "and", "is", "appropriate", "if", "you", "want", "to", "use", "the", "parent_id", "field", "of", "your", "model", "data", "to", "build", "nested", "results", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L1504-L1524
211,531
cakephp/cakephp
src/ORM/Table.php
Table._executeTransaction
protected function _executeTransaction(callable $worker, $atomic = true) { if ($atomic) { return $this->getConnection()->transactional(function () use ($worker) { return $worker(); }); } return $worker(); }
php
protected function _executeTransaction(callable $worker, $atomic = true) { if ($atomic) { return $this->getConnection()->transactional(function () use ($worker) { return $worker(); }); } return $worker(); }
[ "protected", "function", "_executeTransaction", "(", "callable", "$", "worker", ",", "$", "atomic", "=", "true", ")", "{", "if", "(", "$", "atomic", ")", "{", "return", "$", "this", "->", "getConnection", "(", ")", "->", "transactional", "(", "function", ...
Handles the logic executing of a worker inside a transaction. @param callable $worker The worker that will run inside the transaction. @param bool $atomic Whether to execute the worker inside a database transaction. @return mixed
[ "Handles", "the", "logic", "executing", "of", "a", "worker", "inside", "a", "transaction", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L1630-L1639
211,532
cakephp/cakephp
src/ORM/Table.php
Table.saveOrFail
public function saveOrFail(EntityInterface $entity, $options = []) { $saved = $this->save($entity, $options); if ($saved === false) { throw new PersistenceFailedException($entity, ['save']); } return $saved; }
php
public function saveOrFail(EntityInterface $entity, $options = []) { $saved = $this->save($entity, $options); if ($saved === false) { throw new PersistenceFailedException($entity, ['save']); } return $saved; }
[ "public", "function", "saveOrFail", "(", "EntityInterface", "$", "entity", ",", "$", "options", "=", "[", "]", ")", "{", "$", "saved", "=", "$", "this", "->", "save", "(", "$", "entity", ",", "$", "options", ")", ";", "if", "(", "$", "saved", "==="...
Try to save an entity or throw a PersistenceFailedException if the application rules checks failed, the entity contains errors or the save was aborted by a callback. @param \Cake\Datasource\EntityInterface $entity the entity to be saved @param array|\ArrayAccess $options The options to use when saving. @return \Cake\D...
[ "Try", "to", "save", "an", "entity", "or", "throw", "a", "PersistenceFailedException", "if", "the", "application", "rules", "checks", "failed", "the", "entity", "contains", "errors", "or", "the", "save", "was", "aborted", "by", "a", "callback", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L1947-L1955
211,533
cakephp/cakephp
src/ORM/Table.php
Table._processSave
protected function _processSave($entity, $options) { $primaryColumns = (array)$this->getPrimaryKey(); if ($options['checkExisting'] && $primaryColumns && $entity->isNew() && $entity->has($primaryColumns)) { $alias = $this->getAlias(); $conditions = []; foreach ($...
php
protected function _processSave($entity, $options) { $primaryColumns = (array)$this->getPrimaryKey(); if ($options['checkExisting'] && $primaryColumns && $entity->isNew() && $entity->has($primaryColumns)) { $alias = $this->getAlias(); $conditions = []; foreach ($...
[ "protected", "function", "_processSave", "(", "$", "entity", ",", "$", "options", ")", "{", "$", "primaryColumns", "=", "(", "array", ")", "$", "this", "->", "getPrimaryKey", "(", ")", ";", "if", "(", "$", "options", "[", "'checkExisting'", "]", "&&", ...
Performs the actual saving of an entity based on the passed options. @param \Cake\Datasource\EntityInterface $entity the entity to be saved @param \ArrayObject $options the options to use for the save operation @return \Cake\Datasource\EntityInterface|bool @throws \RuntimeException When an entity is missing some of th...
[ "Performs", "the", "actual", "saving", "of", "an", "entity", "based", "on", "the", "passed", "options", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L1967-L2022
211,534
cakephp/cakephp
src/ORM/Table.php
Table._onSaveSuccess
protected function _onSaveSuccess($entity, $options) { $success = $this->_associations->saveChildren( $this, $entity, $options['associated'], ['_primary' => false] + $options->getArrayCopy() ); if (!$success && $options['atomic']) { ...
php
protected function _onSaveSuccess($entity, $options) { $success = $this->_associations->saveChildren( $this, $entity, $options['associated'], ['_primary' => false] + $options->getArrayCopy() ); if (!$success && $options['atomic']) { ...
[ "protected", "function", "_onSaveSuccess", "(", "$", "entity", ",", "$", "options", ")", "{", "$", "success", "=", "$", "this", "->", "_associations", "->", "saveChildren", "(", "$", "this", ",", "$", "entity", ",", "$", "options", "[", "'associated'", "...
Handles the saving of children associations and executing the afterSave logic once the entity for this table has been saved successfully. @param \Cake\Datasource\EntityInterface $entity the entity to be saved @param \ArrayObject $options the options to use for the save operation @return bool True on success @throws \C...
[ "Handles", "the", "saving", "of", "children", "associations", "and", "executing", "the", "afterSave", "logic", "once", "the", "entity", "for", "this", "table", "has", "been", "saved", "successfully", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L2034-L2060
211,535
cakephp/cakephp
src/ORM/Table.php
Table._insert
protected function _insert($entity, $data) { $primary = (array)$this->getPrimaryKey(); if (empty($primary)) { $msg = sprintf( 'Cannot insert row in "%s" table, it has no primary key.', $this->getTable() ); throw new RuntimeException...
php
protected function _insert($entity, $data) { $primary = (array)$this->getPrimaryKey(); if (empty($primary)) { $msg = sprintf( 'Cannot insert row in "%s" table, it has no primary key.', $this->getTable() ); throw new RuntimeException...
[ "protected", "function", "_insert", "(", "$", "entity", ",", "$", "data", ")", "{", "$", "primary", "=", "(", "array", ")", "$", "this", "->", "getPrimaryKey", "(", ")", ";", "if", "(", "empty", "(", "$", "primary", ")", ")", "{", "$", "msg", "="...
Auxiliary function to handle the insert of an entity's data in the table @param \Cake\Datasource\EntityInterface $entity the subject entity from were $data was extracted @param array $data The actual data that needs to be saved @return \Cake\Datasource\EntityInterface|bool @throws \RuntimeException if not all the prim...
[ "Auxiliary", "function", "to", "handle", "the", "insert", "of", "an", "entity", "s", "data", "in", "the", "table" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L2071-L2134
211,536
cakephp/cakephp
src/ORM/Table.php
Table._newId
protected function _newId($primary) { if (!$primary || count((array)$primary) > 1) { return null; } $typeName = $this->getSchema()->getColumnType($primary[0]); $type = Type::build($typeName); return $type->newId(); }
php
protected function _newId($primary) { if (!$primary || count((array)$primary) > 1) { return null; } $typeName = $this->getSchema()->getColumnType($primary[0]); $type = Type::build($typeName); return $type->newId(); }
[ "protected", "function", "_newId", "(", "$", "primary", ")", "{", "if", "(", "!", "$", "primary", "||", "count", "(", "(", "array", ")", "$", "primary", ")", ">", "1", ")", "{", "return", "null", ";", "}", "$", "typeName", "=", "$", "this", "->",...
Generate a primary key value for a new record. By default, this uses the type system to generate a new primary key value if possible. You can override this method if you have specific requirements for id generation. Note: The ORM will not generate primary key values for composite primary keys. You can overwrite _newI...
[ "Generate", "a", "primary", "key", "value", "for", "a", "new", "record", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L2149-L2158
211,537
cakephp/cakephp
src/ORM/Table.php
Table._update
protected function _update($entity, $data) { $primaryColumns = (array)$this->getPrimaryKey(); $primaryKey = $entity->extract($primaryColumns); $data = array_diff_key($data, $primaryKey); if (empty($data)) { return $entity; } if (count($primaryColumns) ==...
php
protected function _update($entity, $data) { $primaryColumns = (array)$this->getPrimaryKey(); $primaryKey = $entity->extract($primaryColumns); $data = array_diff_key($data, $primaryKey); if (empty($data)) { return $entity; } if (count($primaryColumns) ==...
[ "protected", "function", "_update", "(", "$", "entity", ",", "$", "data", ")", "{", "$", "primaryColumns", "=", "(", "array", ")", "$", "this", "->", "getPrimaryKey", "(", ")", ";", "$", "primaryKey", "=", "$", "entity", "->", "extract", "(", "$", "p...
Auxiliary function to handle the update of an entity's data in the table @param \Cake\Datasource\EntityInterface $entity the subject entity from were $data was extracted @param array $data The actual data that needs to be saved @return \Cake\Datasource\EntityInterface|bool @throws \InvalidArgumentException When primar...
[ "Auxiliary", "function", "to", "handle", "the", "update", "of", "an", "entity", "s", "data", "in", "the", "table" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L2168-L2204
211,538
cakephp/cakephp
src/ORM/Table.php
Table.saveMany
public function saveMany($entities, $options = []) { $isNew = []; $cleanup = function ($entities) use (&$isNew) { foreach ($entities as $key => $entity) { if (isset($isNew[$key]) && $isNew[$key]) { $entity->unsetProperty($this->getPrimaryKey()); ...
php
public function saveMany($entities, $options = []) { $isNew = []; $cleanup = function ($entities) use (&$isNew) { foreach ($entities as $key => $entity) { if (isset($isNew[$key]) && $isNew[$key]) { $entity->unsetProperty($this->getPrimaryKey()); ...
[ "public", "function", "saveMany", "(", "$", "entities", ",", "$", "options", "=", "[", "]", ")", "{", "$", "isNew", "=", "[", "]", ";", "$", "cleanup", "=", "function", "(", "$", "entities", ")", "use", "(", "&", "$", "isNew", ")", "{", "foreach"...
Persists multiple entities of a table. The records will be saved in a transaction which will be rolled back if any one of the records fails to save due to failed validation or database error. @param \Cake\Datasource\EntityInterface[]|\Cake\Datasource\ResultSetInterface $entities Entities to save. @param array|\ArrayA...
[ "Persists", "multiple", "entities", "of", "a", "table", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L2218-L2253
211,539
cakephp/cakephp
src/ORM/Table.php
Table.deleteOrFail
public function deleteOrFail(EntityInterface $entity, $options = []) { $deleted = $this->delete($entity, $options); if ($deleted === false) { throw new PersistenceFailedException($entity, ['delete']); } return $deleted; }
php
public function deleteOrFail(EntityInterface $entity, $options = []) { $deleted = $this->delete($entity, $options); if ($deleted === false) { throw new PersistenceFailedException($entity, ['delete']); } return $deleted; }
[ "public", "function", "deleteOrFail", "(", "EntityInterface", "$", "entity", ",", "$", "options", "=", "[", "]", ")", "{", "$", "deleted", "=", "$", "this", "->", "delete", "(", "$", "entity", ",", "$", "options", ")", ";", "if", "(", "$", "deleted",...
Try to delete an entity or throw a PersistenceFailedException if the entity is new, has no primary key value, application rules checks failed or the delete was aborted by a callback. @param \Cake\Datasource\EntityInterface $entity The entity to remove. @param array|\ArrayAccess $options The options for the delete. @re...
[ "Try", "to", "delete", "an", "entity", "or", "throw", "a", "PersistenceFailedException", "if", "the", "entity", "is", "new", "has", "no", "primary", "key", "value", "application", "rules", "checks", "failed", "or", "the", "delete", "was", "aborted", "by", "a...
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L2314-L2322
211,540
cakephp/cakephp
src/ORM/Table.php
Table._processDelete
protected function _processDelete($entity, $options) { if ($entity->isNew()) { return false; } $primaryKey = (array)$this->getPrimaryKey(); if (!$entity->has($primaryKey)) { $msg = 'Deleting requires all primary key values.'; throw new InvalidArgu...
php
protected function _processDelete($entity, $options) { if ($entity->isNew()) { return false; } $primaryKey = (array)$this->getPrimaryKey(); if (!$entity->has($primaryKey)) { $msg = 'Deleting requires all primary key values.'; throw new InvalidArgu...
[ "protected", "function", "_processDelete", "(", "$", "entity", ",", "$", "options", ")", "{", "if", "(", "$", "entity", "->", "isNew", "(", ")", ")", "{", "return", "false", ";", "}", "$", "primaryKey", "=", "(", "array", ")", "$", "this", "->", "g...
Perform the delete operation. Will delete the entity provided. Will remove rows from any dependent associations, and clear out join tables for BelongsToMany associations. @param \Cake\Datasource\EntityInterface $entity The entity to delete. @param \ArrayObject $options The options for the delete. @throws \InvalidArgu...
[ "Perform", "the", "delete", "operation", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L2336-L2383
211,541
cakephp/cakephp
src/ORM/Table.php
Table.hasFinder
public function hasFinder($type) { $finder = 'find' . $type; return method_exists($this, $finder) || ($this->_behaviors && $this->_behaviors->hasFinder($type)); }
php
public function hasFinder($type) { $finder = 'find' . $type; return method_exists($this, $finder) || ($this->_behaviors && $this->_behaviors->hasFinder($type)); }
[ "public", "function", "hasFinder", "(", "$", "type", ")", "{", "$", "finder", "=", "'find'", ".", "$", "type", ";", "return", "method_exists", "(", "$", "this", ",", "$", "finder", ")", "||", "(", "$", "this", "->", "_behaviors", "&&", "$", "this", ...
Returns true if the finder exists for the table @param string $type name of finder to check @return bool
[ "Returns", "true", "if", "the", "finder", "exists", "for", "the", "table" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L2392-L2397
211,542
cakephp/cakephp
src/ORM/Table.php
Table._dynamicFinder
protected function _dynamicFinder($method, $args) { $method = Inflector::underscore($method); preg_match('/^find_([\w]+)_by_/', $method, $matches); if (empty($matches)) { // find_by_ is 8 characters. $fields = substr($method, 8); $findType = 'all'; ...
php
protected function _dynamicFinder($method, $args) { $method = Inflector::underscore($method); preg_match('/^find_([\w]+)_by_/', $method, $matches); if (empty($matches)) { // find_by_ is 8 characters. $fields = substr($method, 8); $findType = 'all'; ...
[ "protected", "function", "_dynamicFinder", "(", "$", "method", ",", "$", "args", ")", "{", "$", "method", "=", "Inflector", "::", "underscore", "(", "$", "method", ")", ";", "preg_match", "(", "'/^find_([\\w]+)_by_/'", ",", "$", "method", ",", "$", "matche...
Provides the dynamic findBy and findByAll methods. @param string $method The method name that was fired. @param array $args List of arguments passed to the function. @return mixed @throws \BadMethodCallException when there are missing arguments, or when and & or are combined.
[ "Provides", "the", "dynamic", "findBy", "and", "findByAll", "methods", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L2436-L2489
211,543
cakephp/cakephp
src/ORM/Table.php
Table.implementedEvents
public function implementedEvents() { $eventMap = [ 'Model.beforeMarshal' => 'beforeMarshal', 'Model.buildValidator' => 'buildValidator', 'Model.beforeFind' => 'beforeFind', 'Model.beforeSave' => 'beforeSave', 'Model.afterSave' => 'afterSave', ...
php
public function implementedEvents() { $eventMap = [ 'Model.beforeMarshal' => 'beforeMarshal', 'Model.buildValidator' => 'buildValidator', 'Model.beforeFind' => 'beforeFind', 'Model.beforeSave' => 'beforeSave', 'Model.afterSave' => 'afterSave', ...
[ "public", "function", "implementedEvents", "(", ")", "{", "$", "eventMap", "=", "[", "'Model.beforeMarshal'", "=>", "'beforeMarshal'", ",", "'Model.buildValidator'", "=>", "'buildValidator'", ",", "'Model.beforeFind'", "=>", "'beforeFind'", ",", "'Model.beforeSave'", "=...
Get the Model callbacks this table is interested in. By implementing the conventional methods a table class is assumed to be interested in the related event. Override this method if you need to add non-conventional event listeners. Or if you want you table to listen to non-standard events. The conventional method ma...
[ "Get", "the", "Model", "callbacks", "this", "table", "is", "interested", "in", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Table.php#L2840-L2865
211,544
cakephp/cakephp
src/View/Helper/SecureFieldTokenTrait.php
SecureFieldTokenTrait._buildFieldToken
protected function _buildFieldToken($url, $fields, $unlockedFields = []) { $locked = []; foreach ($fields as $key => $value) { if (is_numeric($value)) { $value = (string)$value; } if (!is_int($key)) { $locked[$key] = $value; ...
php
protected function _buildFieldToken($url, $fields, $unlockedFields = []) { $locked = []; foreach ($fields as $key => $value) { if (is_numeric($value)) { $value = (string)$value; } if (!is_int($key)) { $locked[$key] = $value; ...
[ "protected", "function", "_buildFieldToken", "(", "$", "url", ",", "$", "fields", ",", "$", "unlockedFields", "=", "[", "]", ")", "{", "$", "locked", "=", "[", "]", ";", "foreach", "(", "$", "fields", "as", "$", "key", "=>", "$", "value", ")", "{",...
Generate the token data for the provided inputs. @param string $url The URL the form is being submitted to. @param array $fields If set specifies the list of fields to use when generating the hash. @param array $unlockedFields The list of fields that are excluded from field validation. @return array The token data.
[ "Generate", "the", "token", "data", "for", "the", "provided", "inputs", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/SecureFieldTokenTrait.php#L35-L67
211,545
cakephp/cakephp
src/Datasource/FactoryLocator.php
FactoryLocator.get
public static function get($type) { if (!isset(static::$_modelFactories['Table'])) { static::$_modelFactories['Table'] = [TableRegistry::getTableLocator(), 'get']; } if (!isset(static::$_modelFactories[$type])) { throw new InvalidArgumentException(sprintf( ...
php
public static function get($type) { if (!isset(static::$_modelFactories['Table'])) { static::$_modelFactories['Table'] = [TableRegistry::getTableLocator(), 'get']; } if (!isset(static::$_modelFactories[$type])) { throw new InvalidArgumentException(sprintf( ...
[ "public", "static", "function", "get", "(", "$", "type", ")", "{", "if", "(", "!", "isset", "(", "static", "::", "$", "_modelFactories", "[", "'Table'", "]", ")", ")", "{", "static", "::", "$", "_modelFactories", "[", "'Table'", "]", "=", "[", "Table...
Get the factory for the specified repository type. @param string $type The repository type to get the factory for. @throws \InvalidArgumentException If the specified repository type has no factory. @return callable The factory for the repository type.
[ "Get", "the", "factory", "for", "the", "specified", "repository", "type", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Datasource/FactoryLocator.php#L62-L76
211,546
cakephp/cakephp
src/Utility/Security.php
Security.hash
public static function hash($string, $algorithm = null, $salt = false) { if (empty($algorithm)) { $algorithm = static::$hashType; } $algorithm = strtolower($algorithm); $availableAlgorithms = hash_algos(); if (!in_array($algorithm, $availableAlgorithms)) { ...
php
public static function hash($string, $algorithm = null, $salt = false) { if (empty($algorithm)) { $algorithm = static::$hashType; } $algorithm = strtolower($algorithm); $availableAlgorithms = hash_algos(); if (!in_array($algorithm, $availableAlgorithms)) { ...
[ "public", "static", "function", "hash", "(", "$", "string", ",", "$", "algorithm", "=", "null", ",", "$", "salt", "=", "false", ")", "{", "if", "(", "empty", "(", "$", "algorithm", ")", ")", "{", "$", "algorithm", "=", "static", "::", "$", "hashTyp...
Create a hash from string using given method. @param string $string String to hash @param string|null $algorithm Hashing algo to use (i.e. sha1, sha256 etc.). Can be any valid algo included in list returned by hash_algos(). If no value is passed the type specified by `Security::$hashType` is used. @param mixed $salt I...
[ "Create", "a", "hash", "from", "string", "using", "given", "method", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Security.php#L62-L86
211,547
cakephp/cakephp
src/Utility/Security.php
Security.randomBytes
public static function randomBytes($length) { if (function_exists('random_bytes')) { return random_bytes($length); } if (!function_exists('openssl_random_pseudo_bytes')) { throw new RuntimeException( 'You do not have a safe source of random data availa...
php
public static function randomBytes($length) { if (function_exists('random_bytes')) { return random_bytes($length); } if (!function_exists('openssl_random_pseudo_bytes')) { throw new RuntimeException( 'You do not have a safe source of random data availa...
[ "public", "static", "function", "randomBytes", "(", "$", "length", ")", "{", "if", "(", "function_exists", "(", "'random_bytes'", ")", ")", "{", "return", "random_bytes", "(", "$", "length", ")", ";", "}", "if", "(", "!", "function_exists", "(", "'openssl_...
Get random bytes from a secure source. This method will fall back to an insecure source an trigger a warning if it cannot find a secure source of random data. @param int $length The number of bytes you want. @return string Random bytes in binary.
[ "Get", "random", "bytes", "from", "a", "secure", "source", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Security.php#L110-L134
211,548
cakephp/cakephp
src/Utility/Security.php
Security.engine
public static function engine($instance = null) { if ($instance === null && static::$_instance === null) { if (extension_loaded('openssl')) { $instance = new OpenSsl(); } elseif (extension_loaded('mcrypt')) { $instance = new Mcrypt(); } ...
php
public static function engine($instance = null) { if ($instance === null && static::$_instance === null) { if (extension_loaded('openssl')) { $instance = new OpenSsl(); } elseif (extension_loaded('mcrypt')) { $instance = new Mcrypt(); } ...
[ "public", "static", "function", "engine", "(", "$", "instance", "=", "null", ")", "{", "if", "(", "$", "instance", "===", "null", "&&", "static", "::", "$", "_instance", "===", "null", ")", "{", "if", "(", "extension_loaded", "(", "'openssl'", ")", ")"...
Get the crypto implementation based on the loaded extensions. You can use this method to forcibly decide between mcrypt/openssl/custom implementations. @param \Cake\Utility\Crypto\OpenSsl|\Cake\Utility\Crypto\Mcrypt|null $instance The crypto instance to use. @return \Cake\Utility\Crypto\OpenSsl|\Cake\Utility\Crypto\M...
[ "Get", "the", "crypto", "implementation", "based", "on", "the", "loaded", "extensions", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Security.php#L183-L202
211,549
cakephp/cakephp
src/Utility/Security.php
Security.constantEquals
public static function constantEquals($original, $compare) { if (!is_string($original) || !is_string($compare)) { return false; } if (function_exists('hash_equals')) { return hash_equals($original, $compare); } $originalLength = mb_strlen($original, '8...
php
public static function constantEquals($original, $compare) { if (!is_string($original) || !is_string($compare)) { return false; } if (function_exists('hash_equals')) { return hash_equals($original, $compare); } $originalLength = mb_strlen($original, '8...
[ "public", "static", "function", "constantEquals", "(", "$", "original", ",", "$", "compare", ")", "{", "if", "(", "!", "is_string", "(", "$", "original", ")", "||", "!", "is_string", "(", "$", "compare", ")", ")", "{", "return", "false", ";", "}", "i...
A timing attack resistant comparison that prefers native PHP implementations. @param string $original The original value. @param string $compare The comparison value. @return bool @see https://github.com/resonantcore/php-future/ @since 3.6.2
[ "A", "timing", "attack", "resistant", "comparison", "that", "prefers", "native", "PHP", "implementations", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Security.php#L327-L346
211,550
cakephp/cakephp
src/ORM/Association/HasMany.php
HasMany._foreignKeyAcceptsNull
protected function _foreignKeyAcceptsNull(Table $table, array $properties) { return !in_array( false, array_map( function ($prop) use ($table) { return $table->getSchema()->isNullable($prop); }, $properties ...
php
protected function _foreignKeyAcceptsNull(Table $table, array $properties) { return !in_array( false, array_map( function ($prop) use ($table) { return $table->getSchema()->isNullable($prop); }, $properties ...
[ "protected", "function", "_foreignKeyAcceptsNull", "(", "Table", "$", "table", ",", "array", "$", "properties", ")", "{", "return", "!", "in_array", "(", "false", ",", "array_map", "(", "function", "(", "$", "prop", ")", "use", "(", "$", "table", ")", "{...
Checks the nullable flag of the foreign key @param \Cake\ORM\Table $table the table containing the foreign key @param array $properties the list of fields that compose the foreign key @return bool
[ "Checks", "the", "nullable", "flag", "of", "the", "foreign", "key" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Association/HasMany.php#L554-L565
211,551
cakephp/cakephp
src/ORM/Locator/LocatorAwareTrait.php
LocatorAwareTrait.tableLocator
public function tableLocator(LocatorInterface $tableLocator = null) { deprecationWarning( get_called_class() . '::tableLocator() is deprecated. ' . 'Use getTableLocator()/setTableLocator() instead.' ); if ($tableLocator !== null) { $this->setTableLocator($...
php
public function tableLocator(LocatorInterface $tableLocator = null) { deprecationWarning( get_called_class() . '::tableLocator() is deprecated. ' . 'Use getTableLocator()/setTableLocator() instead.' ); if ($tableLocator !== null) { $this->setTableLocator($...
[ "public", "function", "tableLocator", "(", "LocatorInterface", "$", "tableLocator", "=", "null", ")", "{", "deprecationWarning", "(", "get_called_class", "(", ")", ".", "'::tableLocator() is deprecated. '", ".", "'Use getTableLocator()/setTableLocator() instead.'", ")", ";"...
Sets the table locator. If no parameters are passed, it will return the currently used locator. @param \Cake\ORM\Locator\LocatorInterface|null $tableLocator LocatorInterface instance. @return \Cake\ORM\Locator\LocatorInterface @deprecated 3.5.0 Use getTableLocator()/setTableLocator() instead.
[ "Sets", "the", "table", "locator", ".", "If", "no", "parameters", "are", "passed", "it", "will", "return", "the", "currently", "used", "locator", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Locator/LocatorAwareTrait.php#L40-L51
211,552
cakephp/cakephp
src/I18n/Translator.php
Translator.translate
public function translate($key, array $tokensValues = []) { if (isset($tokensValues['_count'])) { $message = $this->getMessage(static::PLURAL_PREFIX . $key); if (!$message) { $message = $this->getMessage($key); } } else { $message = $th...
php
public function translate($key, array $tokensValues = []) { if (isset($tokensValues['_count'])) { $message = $this->getMessage(static::PLURAL_PREFIX . $key); if (!$message) { $message = $this->getMessage($key); } } else { $message = $th...
[ "public", "function", "translate", "(", "$", "key", ",", "array", "$", "tokensValues", "=", "[", "]", ")", "{", "if", "(", "isset", "(", "$", "tokensValues", "[", "'_count'", "]", ")", ")", "{", "$", "message", "=", "$", "this", "->", "getMessage", ...
Translates the message formatting any placeholders @param string $key The message key. @param array $tokensValues Token values to interpolate into the message. @return string The translated message with tokens replaced.
[ "Translates", "the", "message", "formatting", "any", "placeholders" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/I18n/Translator.php#L36-L87
211,553
cakephp/cakephp
src/I18n/Translator.php
Translator.resolveContext
protected function resolveContext($key, $message, array $vars) { $context = isset($vars['_context']) ? $vars['_context'] : null; // No or missing context, fallback to the key/first message if ($context === null) { if (isset($message['_context'][''])) { return $me...
php
protected function resolveContext($key, $message, array $vars) { $context = isset($vars['_context']) ? $vars['_context'] : null; // No or missing context, fallback to the key/first message if ($context === null) { if (isset($message['_context'][''])) { return $me...
[ "protected", "function", "resolveContext", "(", "$", "key", ",", "$", "message", ",", "array", "$", "vars", ")", "{", "$", "context", "=", "isset", "(", "$", "vars", "[", "'_context'", "]", ")", "?", "$", "vars", "[", "'_context'", "]", ":", "null", ...
Resolve a message's context structure. @param string $key The message key being handled. @param string|array $message The message content. @param array $vars The variables containing the `_context` key. @return string
[ "Resolve", "a", "message", "s", "context", "structure", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/I18n/Translator.php#L97-L117
211,554
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.routeClass
public function routeClass($routeClass = null) { deprecationWarning( 'RouteBuilder::routeClass() is deprecated. ' . 'Use RouteBuilder::setRouteClass()/getRouteClass() instead.' ); if ($routeClass === null) { return $this->getRouteClass(); } ...
php
public function routeClass($routeClass = null) { deprecationWarning( 'RouteBuilder::routeClass() is deprecated. ' . 'Use RouteBuilder::setRouteClass()/getRouteClass() instead.' ); if ($routeClass === null) { return $this->getRouteClass(); } ...
[ "public", "function", "routeClass", "(", "$", "routeClass", "=", "null", ")", "{", "deprecationWarning", "(", "'RouteBuilder::routeClass() is deprecated. '", ".", "'Use RouteBuilder::setRouteClass()/getRouteClass() instead.'", ")", ";", "if", "(", "$", "routeClass", "===", ...
Get or set default route class. @deprecated 3.5.0 Use getRouteClass/setRouteClass instead. @param string|null $routeClass Class name. @return string|null
[ "Get", "or", "set", "default", "route", "class", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L153-L163
211,555
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.extensions
public function extensions($extensions = null) { deprecationWarning( 'RouteBuilder::extensions() is deprecated. ' . 'Use RouteBuilder::setExtensions()/getExtensions() instead.' ); if ($extensions === null) { return $this->getExtensions(); } ...
php
public function extensions($extensions = null) { deprecationWarning( 'RouteBuilder::extensions() is deprecated. ' . 'Use RouteBuilder::setExtensions()/getExtensions() instead.' ); if ($extensions === null) { return $this->getExtensions(); } ...
[ "public", "function", "extensions", "(", "$", "extensions", "=", "null", ")", "{", "deprecationWarning", "(", "'RouteBuilder::extensions() is deprecated. '", ".", "'Use RouteBuilder::setExtensions()/getExtensions() instead.'", ")", ";", "if", "(", "$", "extensions", "===", ...
Get or set the extensions in this route builder's scope. Future routes connected in through this builder will have the connected extensions applied. However, setting extensions does not modify existing routes. @deprecated 3.5.0 Use getExtensions/setExtensions instead. @param null|string|array $extensions Either the e...
[ "Get", "or", "set", "the", "extensions", "in", "this", "route", "builder", "s", "scope", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L198-L208
211,556
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.addExtensions
public function addExtensions($extensions) { $extensions = array_merge($this->_extensions, (array)$extensions); $this->_extensions = array_unique($extensions); }
php
public function addExtensions($extensions) { $extensions = array_merge($this->_extensions, (array)$extensions); $this->_extensions = array_unique($extensions); }
[ "public", "function", "addExtensions", "(", "$", "extensions", ")", "{", "$", "extensions", "=", "array_merge", "(", "$", "this", "->", "_extensions", ",", "(", "array", ")", "$", "extensions", ")", ";", "$", "this", "->", "_extensions", "=", "array_unique...
Add additional extensions to what is already in current scope @param string|array $extensions One or more extensions to add @return void
[ "Add", "additional", "extensions", "to", "what", "is", "already", "in", "current", "scope" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L242-L246
211,557
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.path
public function path() { $routeKey = strpos($this->_path, ':'); if ($routeKey !== false) { return substr($this->_path, 0, $routeKey); } return $this->_path; }
php
public function path() { $routeKey = strpos($this->_path, ':'); if ($routeKey !== false) { return substr($this->_path, 0, $routeKey); } return $this->_path; }
[ "public", "function", "path", "(", ")", "{", "$", "routeKey", "=", "strpos", "(", "$", "this", "->", "_path", ",", "':'", ")", ";", "if", "(", "$", "routeKey", "!==", "false", ")", "{", "return", "substr", "(", "$", "this", "->", "_path", ",", "0...
Get the path this scope is for. @return string
[ "Get", "the", "path", "this", "scope", "is", "for", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L253-L261
211,558
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.get
public function get($template, $target, $name = null) { return $this->_methodRoute('GET', $template, $target, $name); }
php
public function get($template, $target, $name = null) { return $this->_methodRoute('GET', $template, $target, $name); }
[ "public", "function", "get", "(", "$", "template", ",", "$", "target", ",", "$", "name", "=", "null", ")", "{", "return", "$", "this", "->", "_methodRoute", "(", "'GET'", ",", "$", "template", ",", "$", "target", ",", "$", "name", ")", ";", "}" ]
Create a route that only responds to GET requests. @param string $template The URL template to use. @param array $target An array describing the target route parameters. These parameters should indicate the plugin, prefix, controller, and action that this route points to. @param string $name The name of the route. @re...
[ "Create", "a", "route", "that", "only", "responds", "to", "GET", "requests", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L478-L481
211,559
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.post
public function post($template, $target, $name = null) { return $this->_methodRoute('POST', $template, $target, $name); }
php
public function post($template, $target, $name = null) { return $this->_methodRoute('POST', $template, $target, $name); }
[ "public", "function", "post", "(", "$", "template", ",", "$", "target", ",", "$", "name", "=", "null", ")", "{", "return", "$", "this", "->", "_methodRoute", "(", "'POST'", ",", "$", "template", ",", "$", "target", ",", "$", "name", ")", ";", "}" ]
Create a route that only responds to POST requests. @param string $template The URL template to use. @param array $target An array describing the target route parameters. These parameters should indicate the plugin, prefix, controller, and action that this route points to. @param string $name The name of the route. @r...
[ "Create", "a", "route", "that", "only", "responds", "to", "POST", "requests", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L492-L495
211,560
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.put
public function put($template, $target, $name = null) { return $this->_methodRoute('PUT', $template, $target, $name); }
php
public function put($template, $target, $name = null) { return $this->_methodRoute('PUT', $template, $target, $name); }
[ "public", "function", "put", "(", "$", "template", ",", "$", "target", ",", "$", "name", "=", "null", ")", "{", "return", "$", "this", "->", "_methodRoute", "(", "'PUT'", ",", "$", "template", ",", "$", "target", ",", "$", "name", ")", ";", "}" ]
Create a route that only responds to PUT requests. @param string $template The URL template to use. @param array $target An array describing the target route parameters. These parameters should indicate the plugin, prefix, controller, and action that this route points to. @param string $name The name of the route. @re...
[ "Create", "a", "route", "that", "only", "responds", "to", "PUT", "requests", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L506-L509
211,561
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.patch
public function patch($template, $target, $name = null) { return $this->_methodRoute('PATCH', $template, $target, $name); }
php
public function patch($template, $target, $name = null) { return $this->_methodRoute('PATCH', $template, $target, $name); }
[ "public", "function", "patch", "(", "$", "template", ",", "$", "target", ",", "$", "name", "=", "null", ")", "{", "return", "$", "this", "->", "_methodRoute", "(", "'PATCH'", ",", "$", "template", ",", "$", "target", ",", "$", "name", ")", ";", "}"...
Create a route that only responds to PATCH requests. @param string $template The URL template to use. @param array $target An array describing the target route parameters. These parameters should indicate the plugin, prefix, controller, and action that this route points to. @param string $name The name of the route. @...
[ "Create", "a", "route", "that", "only", "responds", "to", "PATCH", "requests", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L520-L523
211,562
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.delete
public function delete($template, $target, $name = null) { return $this->_methodRoute('DELETE', $template, $target, $name); }
php
public function delete($template, $target, $name = null) { return $this->_methodRoute('DELETE', $template, $target, $name); }
[ "public", "function", "delete", "(", "$", "template", ",", "$", "target", ",", "$", "name", "=", "null", ")", "{", "return", "$", "this", "->", "_methodRoute", "(", "'DELETE'", ",", "$", "template", ",", "$", "target", ",", "$", "name", ")", ";", "...
Create a route that only responds to DELETE requests. @param string $template The URL template to use. @param array $target An array describing the target route parameters. These parameters should indicate the plugin, prefix, controller, and action that this route points to. @param string $name The name of the route. ...
[ "Create", "a", "route", "that", "only", "responds", "to", "DELETE", "requests", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L534-L537
211,563
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.head
public function head($template, $target, $name = null) { return $this->_methodRoute('HEAD', $template, $target, $name); }
php
public function head($template, $target, $name = null) { return $this->_methodRoute('HEAD', $template, $target, $name); }
[ "public", "function", "head", "(", "$", "template", ",", "$", "target", ",", "$", "name", "=", "null", ")", "{", "return", "$", "this", "->", "_methodRoute", "(", "'HEAD'", ",", "$", "template", ",", "$", "target", ",", "$", "name", ")", ";", "}" ]
Create a route that only responds to HEAD requests. @param string $template The URL template to use. @param array $target An array describing the target route parameters. These parameters should indicate the plugin, prefix, controller, and action that this route points to. @param string $name The name of the route. @r...
[ "Create", "a", "route", "that", "only", "responds", "to", "HEAD", "requests", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L548-L551
211,564
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.options
public function options($template, $target, $name = null) { return $this->_methodRoute('OPTIONS', $template, $target, $name); }
php
public function options($template, $target, $name = null) { return $this->_methodRoute('OPTIONS', $template, $target, $name); }
[ "public", "function", "options", "(", "$", "template", ",", "$", "target", ",", "$", "name", "=", "null", ")", "{", "return", "$", "this", "->", "_methodRoute", "(", "'OPTIONS'", ",", "$", "template", ",", "$", "target", ",", "$", "name", ")", ";", ...
Create a route that only responds to OPTIONS requests. @param string $template The URL template to use. @param array $target An array describing the target route parameters. These parameters should indicate the plugin, prefix, controller, and action that this route points to. @param string $name The name of the route....
[ "Create", "a", "route", "that", "only", "responds", "to", "OPTIONS", "requests", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L562-L565
211,565
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder._methodRoute
protected function _methodRoute($method, $template, $target, $name) { if ($name !== null) { $name = $this->_namePrefix . $name; } $options = [ '_name' => $name, '_ext' => $this->_extensions, '_middleware' => $this->middleware, 'rout...
php
protected function _methodRoute($method, $template, $target, $name) { if ($name !== null) { $name = $this->_namePrefix . $name; } $options = [ '_name' => $name, '_ext' => $this->_extensions, '_middleware' => $this->middleware, 'rout...
[ "protected", "function", "_methodRoute", "(", "$", "method", ",", "$", "template", ",", "$", "target", ",", "$", "name", ")", "{", "if", "(", "$", "name", "!==", "null", ")", "{", "$", "name", "=", "$", "this", "->", "_namePrefix", ".", "$", "name"...
Helper to create routes that only respond to a single HTTP method. @param string $method The HTTP method name to match. @param string $template The URL template to use. @param array $target An array describing the target route parameters. These parameters should indicate the plugin, prefix, controller, and action that...
[ "Helper", "to", "create", "routes", "that", "only", "respond", "to", "a", "single", "HTTP", "method", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L577-L596
211,566
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.loadPlugin
public function loadPlugin($name, $file = 'routes.php') { $plugins = Plugin::getCollection(); if (!$plugins->has($name)) { throw new MissingPluginException(['plugin' => $name]); } $plugin = $plugins->get($name); // @deprecated This block should be removed in 4.0 ...
php
public function loadPlugin($name, $file = 'routes.php') { $plugins = Plugin::getCollection(); if (!$plugins->has($name)) { throw new MissingPluginException(['plugin' => $name]); } $plugin = $plugins->get($name); // @deprecated This block should be removed in 4.0 ...
[ "public", "function", "loadPlugin", "(", "$", "name", ",", "$", "file", "=", "'routes.php'", ")", "{", "$", "plugins", "=", "Plugin", "::", "getCollection", "(", ")", ";", "if", "(", "!", "$", "plugins", "->", "has", "(", "$", "name", ")", ")", "{"...
Load routes from a plugin. The routes file will have a local variable named `$routes` made available which contains the current RouteBuilder instance. @param string $name The plugin name @param string $file The routes file to load. Defaults to `routes.php`. This parameter is deprecated and will be removed in 4.0 @ret...
[ "Load", "routes", "from", "a", "plugin", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L611-L644
211,567
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.connect
public function connect($route, $defaults = [], array $options = []) { $defaults = $this->parseDefaults($defaults); if (empty($options['_ext'])) { $options['_ext'] = $this->_extensions; } if (empty($options['routeClass'])) { $options['routeClass'] = $this->_ro...
php
public function connect($route, $defaults = [], array $options = []) { $defaults = $this->parseDefaults($defaults); if (empty($options['_ext'])) { $options['_ext'] = $this->_extensions; } if (empty($options['routeClass'])) { $options['routeClass'] = $this->_ro...
[ "public", "function", "connect", "(", "$", "route", ",", "$", "defaults", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "defaults", "=", "$", "this", "->", "parseDefaults", "(", "$", "defaults", ")", ";", "if", "(", "...
Connects a new Route. Routes are a way of connecting request URLs to objects in your application. At their core routes are a set or regular expressions that are used to match requests to destinations. Examples: ``` $routes->connect('/:controller/:action/*'); ``` The first parameter will be used as a controller name...
[ "Connects", "a", "new", "Route", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L724-L744
211,568
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.parseDefaults
protected static function parseDefaults($defaults) { if (!is_string($defaults)) { return $defaults; } $regex = '/(?:(?<plugin>[a-zA-Z0-9\/]*)\.)?(?<prefix>[a-zA-Z0-9\/]*?)' . '(?:\/)?(?<controller>[a-zA-Z0-9]*):{2}(?<action>[a-zA-Z0-9_]*)/i'; if (preg_match(...
php
protected static function parseDefaults($defaults) { if (!is_string($defaults)) { return $defaults; } $regex = '/(?:(?<plugin>[a-zA-Z0-9\/]*)\.)?(?<prefix>[a-zA-Z0-9\/]*?)' . '(?:\/)?(?<controller>[a-zA-Z0-9]*):{2}(?<action>[a-zA-Z0-9_]*)/i'; if (preg_match(...
[ "protected", "static", "function", "parseDefaults", "(", "$", "defaults", ")", "{", "if", "(", "!", "is_string", "(", "$", "defaults", ")", ")", "{", "return", "$", "defaults", ";", "}", "$", "regex", "=", "'/(?:(?<plugin>[a-zA-Z0-9\\/]*)\\.)?(?<prefix>[a-zA-Z0-...
Parse the defaults if they're a string @param string|array $defaults Defaults array from the connect() method. @return string|array
[ "Parse", "the", "defaults", "if", "they", "re", "a", "string" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L752-L779
211,569
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder._makeRoute
protected function _makeRoute($route, $defaults, $options) { if (is_string($route)) { $routeClass = App::className($options['routeClass'], 'Routing/Route'); if ($routeClass === false) { throw new InvalidArgumentException(sprintf( 'Cannot find route...
php
protected function _makeRoute($route, $defaults, $options) { if (is_string($route)) { $routeClass = App::className($options['routeClass'], 'Routing/Route'); if ($routeClass === false) { throw new InvalidArgumentException(sprintf( 'Cannot find route...
[ "protected", "function", "_makeRoute", "(", "$", "route", ",", "$", "defaults", ",", "$", "options", ")", "{", "if", "(", "is_string", "(", "$", "route", ")", ")", "{", "$", "routeClass", "=", "App", "::", "className", "(", "$", "options", "[", "'rou...
Create a route object, or return the provided object. @param string|\Cake\Routing\Route\Route $route The route template or route object. @param array $defaults Default parameters. @param array $options Additional options parameters. @return \Cake\Routing\Route\Route @throws \InvalidArgumentException when route class o...
[ "Create", "a", "route", "object", "or", "return", "the", "provided", "object", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L791-L834
211,570
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.prefix
public function prefix($name, $params = [], callable $callback = null) { if ($callback === null) { if (!is_callable($params)) { throw new InvalidArgumentException('A valid callback is expected'); } $callback = $params; $params = []; } ...
php
public function prefix($name, $params = [], callable $callback = null) { if ($callback === null) { if (!is_callable($params)) { throw new InvalidArgumentException('A valid callback is expected'); } $callback = $params; $params = []; } ...
[ "public", "function", "prefix", "(", "$", "name", ",", "$", "params", "=", "[", "]", ",", "callable", "$", "callback", "=", "null", ")", "{", "if", "(", "$", "callback", "===", "null", ")", "{", "if", "(", "!", "is_callable", "(", "$", "params", ...
Add prefixed routes. This method creates a scoped route collection that includes relevant prefix information. The $name parameter is used to generate the routing parameter name. For example a path of `admin` would result in `'prefix' => 'admin'` being applied to all connected routes. You can re-open a prefix as many...
[ "Add", "prefixed", "routes", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L915-L935
211,571
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.scope
public function scope($path, $params, $callback = null) { if (is_callable($params)) { $callback = $params; $params = []; } if (!is_callable($callback)) { $msg = 'Need a callable function/object to connect routes.'; throw new InvalidArgumentExce...
php
public function scope($path, $params, $callback = null) { if (is_callable($params)) { $callback = $params; $params = []; } if (!is_callable($callback)) { $msg = 'Need a callable function/object to connect routes.'; throw new InvalidArgumentExce...
[ "public", "function", "scope", "(", "$", "path", ",", "$", "params", ",", "$", "callback", "=", "null", ")", "{", "if", "(", "is_callable", "(", "$", "params", ")", ")", "{", "$", "callback", "=", "$", "params", ";", "$", "params", "=", "[", "]",...
Create a new routing scope. Scopes created with this method will inherit the properties of the scope they are added to. This means that both the current path and parameters will be appended to the supplied parameters. @param string $path The path to create a scope for. @param array|callable $params Either the paramet...
[ "Create", "a", "new", "routing", "scope", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L982-L1010
211,572
cakephp/cakephp
src/Routing/RouteBuilder.php
RouteBuilder.applyMiddleware
public function applyMiddleware(...$names) { foreach ($names as $name) { if (!$this->_collection->middlewareExists($name)) { $message = "Cannot apply '$name' middleware or middleware group. " . 'Use registerMiddleware() to register middleware.'; ...
php
public function applyMiddleware(...$names) { foreach ($names as $name) { if (!$this->_collection->middlewareExists($name)) { $message = "Cannot apply '$name' middleware or middleware group. " . 'Use registerMiddleware() to register middleware.'; ...
[ "public", "function", "applyMiddleware", "(", "...", "$", "names", ")", "{", "foreach", "(", "$", "names", "as", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "_collection", "->", "middlewareExists", "(", "$", "name", ")", ")", "{", "$", ...
Apply a middleware to the current route scope. Requires middleware to be registered via `registerMiddleware()` @param string ...$names The names of the middleware to apply to the current scope. @return $this @see \Cake\Routing\RouteCollection::addMiddlewareToScope()
[ "Apply", "a", "middleware", "to", "the", "current", "route", "scope", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteBuilder.php#L1055-L1067
211,573
cakephp/cakephp
src/I18n/TranslatorRegistry.php
TranslatorRegistry.defaultFormatter
public function defaultFormatter($name = null) { if ($name === null) { return $this->_defaultFormatter; } return $this->_defaultFormatter = $name; }
php
public function defaultFormatter($name = null) { if ($name === null) { return $this->_defaultFormatter; } return $this->_defaultFormatter = $name; }
[ "public", "function", "defaultFormatter", "(", "$", "name", "=", "null", ")", "{", "if", "(", "$", "name", "===", "null", ")", "{", "return", "$", "this", "->", "_defaultFormatter", ";", "}", "return", "$", "this", "->", "_defaultFormatter", "=", "$", ...
Sets the name of the default messages formatter to use for future translator instances. If called with no arguments, it will return the currently configured value. @param string|null $name The name of the formatter to use. @return string The name of the formatter.
[ "Sets", "the", "name", "of", "the", "default", "messages", "formatter", "to", "use", "for", "future", "translator", "instances", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/I18n/TranslatorRegistry.php#L204-L211
211,574
cakephp/cakephp
src/I18n/TranslatorRegistry.php
TranslatorRegistry._getFromLoader
protected function _getFromLoader($name, $locale) { $loader = $this->_loaders[$name]($name, $locale); $package = $loader; if (!is_callable($loader)) { $loader = function () use ($package) { return $package; }; } $loader = $this->setLo...
php
protected function _getFromLoader($name, $locale) { $loader = $this->_loaders[$name]($name, $locale); $package = $loader; if (!is_callable($loader)) { $loader = function () use ($package) { return $package; }; } $loader = $this->setLo...
[ "protected", "function", "_getFromLoader", "(", "$", "name", ",", "$", "locale", ")", "{", "$", "loader", "=", "$", "this", "->", "_loaders", "[", "$", "name", "]", "(", "$", "name", ",", "$", "locale", ")", ";", "$", "package", "=", "$", "loader",...
Registers a new package by passing the register loaded function for the package name. @param string $name The name of the translator package @param string $locale The locale that should be built the package for @return \Aura\Intl\TranslatorInterface A translator object.
[ "Registers", "a", "new", "package", "by", "passing", "the", "register", "loaded", "function", "for", "the", "package", "name", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/I18n/TranslatorRegistry.php#L257-L273
211,575
cakephp/cakephp
src/I18n/TranslatorRegistry.php
TranslatorRegistry.setLoaderFallback
public function setLoaderFallback($name, callable $loader) { $fallbackDomain = 'default'; if (!$this->_useFallback || $name === $fallbackDomain) { return $loader; } $loader = function () use ($loader, $fallbackDomain) { /* @var \Aura\Intl\Package $package */ ...
php
public function setLoaderFallback($name, callable $loader) { $fallbackDomain = 'default'; if (!$this->_useFallback || $name === $fallbackDomain) { return $loader; } $loader = function () use ($loader, $fallbackDomain) { /* @var \Aura\Intl\Package $package */ ...
[ "public", "function", "setLoaderFallback", "(", "$", "name", ",", "callable", "$", "loader", ")", "{", "$", "fallbackDomain", "=", "'default'", ";", "if", "(", "!", "$", "this", "->", "_useFallback", "||", "$", "name", "===", "$", "fallbackDomain", ")", ...
Set domain fallback for loader. @param string $name The name of the loader domain @param callable $loader invokable loader @return callable loader
[ "Set", "domain", "fallback", "for", "loader", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/I18n/TranslatorRegistry.php#L282-L299
211,576
cakephp/cakephp
src/Utility/Text.php
Text.uuid
public static function uuid() { $random = function_exists('random_int') ? 'random_int' : 'mt_rand'; return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', // 32 bits for "time_low" $random(0, 65535), $random(0, 65535), // 16 bits for "tim...
php
public static function uuid() { $random = function_exists('random_int') ? 'random_int' : 'mt_rand'; return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', // 32 bits for "time_low" $random(0, 65535), $random(0, 65535), // 16 bits for "tim...
[ "public", "static", "function", "uuid", "(", ")", "{", "$", "random", "=", "function_exists", "(", "'random_int'", ")", "?", "'random_int'", ":", "'mt_rand'", ";", "return", "sprintf", "(", "'%04x%04x-%04x-%04x-%04x-%04x%04x%04x'", ",", "// 32 bits for \"time_low\"", ...
Generate a random UUID version 4 Warning: This method should not be used as a random seed for any cryptographic operations. Instead you should use the openssl or mcrypt extensions. It should also not be used to create identifiers that have security implications, such as 'unguessable' URL identifiers. Instead you shou...
[ "Generate", "a", "random", "UUID", "version", "4" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Text.php#L62-L84
211,577
cakephp/cakephp
src/Utility/Text.php
Text.wrapBlock
public static function wrapBlock($text, $options = []) { if (is_numeric($options)) { $options = ['width' => $options]; } $options += ['width' => 72, 'wordWrap' => true, 'indent' => null, 'indentAt' => 0]; if (!empty($options['indentAt']) && $options['indentAt'] === 0) { ...
php
public static function wrapBlock($text, $options = []) { if (is_numeric($options)) { $options = ['width' => $options]; } $options += ['width' => 72, 'wordWrap' => true, 'indent' => null, 'indentAt' => 0]; if (!empty($options['indentAt']) && $options['indentAt'] === 0) { ...
[ "public", "static", "function", "wrapBlock", "(", "$", "text", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "is_numeric", "(", "$", "options", ")", ")", "{", "$", "options", "=", "[", "'width'", "=>", "$", "options", "]", ";", "}", "$...
Wraps a complete block of text to a specific width, can optionally wrap at word breaks. ### Options - `width` The width to wrap to. Defaults to 72. - `wordWrap` Only wrap on words breaks (spaces) Defaults to true. - `indent` String to indent with. Defaults to null. - `indentAt` 0 based index to start indenting at. De...
[ "Wraps", "a", "complete", "block", "of", "text", "to", "a", "specific", "width", "can", "optionally", "wrap", "at", "word", "breaks", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Text.php#L362-L400
211,578
cakephp/cakephp
src/Utility/Text.php
Text.wordWrap
public static function wordWrap($text, $width = 72, $break = "\n", $cut = false) { $paragraphs = explode($break, $text); foreach ($paragraphs as &$paragraph) { $paragraph = static::_wordWrap($paragraph, $width, $break, $cut); } return implode($break, $paragraphs); }
php
public static function wordWrap($text, $width = 72, $break = "\n", $cut = false) { $paragraphs = explode($break, $text); foreach ($paragraphs as &$paragraph) { $paragraph = static::_wordWrap($paragraph, $width, $break, $cut); } return implode($break, $paragraphs); }
[ "public", "static", "function", "wordWrap", "(", "$", "text", ",", "$", "width", "=", "72", ",", "$", "break", "=", "\"\\n\"", ",", "$", "cut", "=", "false", ")", "{", "$", "paragraphs", "=", "explode", "(", "$", "break", ",", "$", "text", ")", "...
Unicode and newline aware version of wordwrap. @param string $text The text to format. @param int $width The width to wrap to. Defaults to 72. @param string $break The line is broken using the optional break parameter. Defaults to '\n'. @param bool $cut If the cut is set to true, the string is always wrapped at the sp...
[ "Unicode", "and", "newline", "aware", "version", "of", "wordwrap", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Text.php#L411-L419
211,579
cakephp/cakephp
src/Utility/Text.php
Text._strlen
protected static function _strlen($text, array $options) { if (empty($options['trimWidth'])) { $strlen = 'mb_strlen'; } else { $strlen = 'mb_strwidth'; } if (empty($options['html'])) { return $strlen($text); } $pattern = '/&[0-9a-...
php
protected static function _strlen($text, array $options) { if (empty($options['trimWidth'])) { $strlen = 'mb_strlen'; } else { $strlen = 'mb_strwidth'; } if (empty($options['html'])) { return $strlen($text); } $pattern = '/&[0-9a-...
[ "protected", "static", "function", "_strlen", "(", "$", "text", ",", "array", "$", "options", ")", "{", "if", "(", "empty", "(", "$", "options", "[", "'trimWidth'", "]", ")", ")", "{", "$", "strlen", "=", "'mb_strlen'", ";", "}", "else", "{", "$", ...
Get string length. ### Options: - `html` If true, HTML entities will be handled as decoded characters. - `trimWidth` If true, the width will return. @param string $text The string being checked for length @param array $options An array of options. @return int
[ "Get", "string", "length", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Text.php#L732-L756
211,580
cakephp/cakephp
src/Utility/Text.php
Text._substr
protected static function _substr($text, $start, $length, array $options) { if (empty($options['trimWidth'])) { $substr = 'mb_substr'; } else { $substr = 'mb_strimwidth'; } $maxPosition = self::_strlen($text, ['trimWidth' => false] + $options); if ($s...
php
protected static function _substr($text, $start, $length, array $options) { if (empty($options['trimWidth'])) { $substr = 'mb_substr'; } else { $substr = 'mb_strimwidth'; } $maxPosition = self::_strlen($text, ['trimWidth' => false] + $options); if ($s...
[ "protected", "static", "function", "_substr", "(", "$", "text", ",", "$", "start", ",", "$", "length", ",", "array", "$", "options", ")", "{", "if", "(", "empty", "(", "$", "options", "[", "'trimWidth'", "]", ")", ")", "{", "$", "substr", "=", "'mb...
Return part of a string. ### Options: - `html` If true, HTML entities will be handled as decoded characters. - `trimWidth` If true, will be truncated with specified width. @param string $text The input string. @param int $start The position to begin extracting. @param int $length The desired length. @param array $op...
[ "Return", "part", "of", "a", "string", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Text.php#L772-L850
211,581
cakephp/cakephp
src/Utility/Text.php
Text._removeLastWord
protected static function _removeLastWord($text) { $spacepos = mb_strrpos($text, ' '); if ($spacepos !== false) { $lastWord = mb_strrpos($text, $spacepos); // Some languages are written without word separation. // We recognize a string as a word if it doesn't co...
php
protected static function _removeLastWord($text) { $spacepos = mb_strrpos($text, ' '); if ($spacepos !== false) { $lastWord = mb_strrpos($text, $spacepos); // Some languages are written without word separation. // We recognize a string as a word if it doesn't co...
[ "protected", "static", "function", "_removeLastWord", "(", "$", "text", ")", "{", "$", "spacepos", "=", "mb_strrpos", "(", "$", "text", ",", "' '", ")", ";", "if", "(", "$", "spacepos", "!==", "false", ")", "{", "$", "lastWord", "=", "mb_strrpos", "(",...
Removes the last word from the input text. @param string $text The input text @return string
[ "Removes", "the", "last", "word", "from", "the", "input", "text", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Text.php#L858-L875
211,582
cakephp/cakephp
src/Utility/Text.php
Text.toList
public static function toList(array $list, $and = null, $separator = ', ') { if ($and === null) { $and = __d('cake', 'and'); } if (count($list) > 1) { return implode($separator, array_slice($list, null, -1)) . ' ' . $and . ' ' . array_pop($list); } re...
php
public static function toList(array $list, $and = null, $separator = ', ') { if ($and === null) { $and = __d('cake', 'and'); } if (count($list) > 1) { return implode($separator, array_slice($list, null, -1)) . ' ' . $and . ' ' . array_pop($list); } re...
[ "public", "static", "function", "toList", "(", "array", "$", "list", ",", "$", "and", "=", "null", ",", "$", "separator", "=", "', '", ")", "{", "if", "(", "$", "and", "===", "null", ")", "{", "$", "and", "=", "__d", "(", "'cake'", ",", "'and'", ...
Creates a comma separated list where the last two items are joined with 'and', forming natural language. @param array $list The list to be joined. @param string|null $and The word used to join the last and second last items together with. Defaults to 'and'. @param string $separator The separator used to join all the o...
[ "Creates", "a", "comma", "separated", "list", "where", "the", "last", "two", "items", "are", "joined", "with", "and", "forming", "natural", "language", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Text.php#L931-L941
211,583
cakephp/cakephp
src/Utility/Text.php
Text.isMultibyte
public static function isMultibyte($string) { $length = strlen($string); for ($i = 0; $i < $length; $i++) { $value = ord($string[$i]); if ($value > 128) { return true; } } return false; }
php
public static function isMultibyte($string) { $length = strlen($string); for ($i = 0; $i < $length; $i++) { $value = ord($string[$i]); if ($value > 128) { return true; } } return false; }
[ "public", "static", "function", "isMultibyte", "(", "$", "string", ")", "{", "$", "length", "=", "strlen", "(", "$", "string", ")", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "length", ";", "$", "i", "++", ")", "{", "$", "v...
Check if the string contain multibyte characters @param string $string value to test @return bool
[ "Check", "if", "the", "string", "contain", "multibyte", "characters" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Text.php#L949-L961
211,584
cakephp/cakephp
src/Utility/Text.php
Text.transliterate
public static function transliterate($string, $transliterator = null) { if (!$transliterator) { $transliterator = static::$_defaultTransliterator ?: static::$_defaultTransliteratorId; } return transliterator_transliterate($transliterator, $string); }
php
public static function transliterate($string, $transliterator = null) { if (!$transliterator) { $transliterator = static::$_defaultTransliterator ?: static::$_defaultTransliteratorId; } return transliterator_transliterate($transliterator, $string); }
[ "public", "static", "function", "transliterate", "(", "$", "string", ",", "$", "transliterator", "=", "null", ")", "{", "if", "(", "!", "$", "transliterator", ")", "{", "$", "transliterator", "=", "static", "::", "$", "_defaultTransliterator", "?", ":", "s...
Transliterate string. @param string $string String to transliterate. @param \Transliterator|string|null $transliterator Either a Transliterator instance, or a transliterator identifier string. If `null`, the default transliterator (identifier) set via `setTransliteratorId()` or `setTransliterator()` will be used. @ret...
[ "Transliterate", "string", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Text.php#L1128-L1135
211,585
cakephp/cakephp
src/Shell/RoutesShell.php
RoutesShell.check
public function check($url) { try { $request = new ServerRequest(['url' => $url]); $route = Router::parseRequest($request); $name = null; foreach (Router::routes() as $r) { if ($r->match($route)) { $name = isset($r->options[...
php
public function check($url) { try { $request = new ServerRequest(['url' => $url]); $route = Router::parseRequest($request); $name = null; foreach (Router::routes() as $r) { if ($r->match($route)) { $name = isset($r->options[...
[ "public", "function", "check", "(", "$", "url", ")", "{", "try", "{", "$", "request", "=", "new", "ServerRequest", "(", "[", "'url'", "=>", "$", "url", "]", ")", ";", "$", "route", "=", "Router", "::", "parseRequest", "(", "$", "request", ")", ";",...
Checks a url for the route that will be applied. @param string $url The URL to parse @return bool Success
[ "Checks", "a", "url", "for", "the", "route", "that", "will", "be", "applied", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/RoutesShell.php#L54-L84
211,586
cakephp/cakephp
src/Shell/RoutesShell.php
RoutesShell.generate
public function generate() { try { $args = $this->_splitArgs($this->args); $url = Router::url($args); $this->out("> $url"); $this->out(); } catch (MissingRouteException $e) { $this->err('<warning>The provided parameters do not match any rou...
php
public function generate() { try { $args = $this->_splitArgs($this->args); $url = Router::url($args); $this->out("> $url"); $this->out(); } catch (MissingRouteException $e) { $this->err('<warning>The provided parameters do not match any rou...
[ "public", "function", "generate", "(", ")", "{", "try", "{", "$", "args", "=", "$", "this", "->", "_splitArgs", "(", "$", "this", "->", "args", ")", ";", "$", "url", "=", "Router", "::", "url", "(", "$", "args", ")", ";", "$", "this", "->", "ou...
Generate a URL based on a set of parameters Takes variadic arguments of key/value pairs. @return bool Success
[ "Generate", "a", "URL", "based", "on", "a", "set", "of", "parameters" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/RoutesShell.php#L92-L107
211,587
cakephp/cakephp
src/Shell/RoutesShell.php
RoutesShell._splitArgs
protected function _splitArgs($args) { $out = []; foreach ($args as $arg) { if (strpos($arg, ':') !== false) { list($key, $value) = explode(':', $arg); if (in_array($value, ['true', 'false'])) { $value = $value === 'true'; ...
php
protected function _splitArgs($args) { $out = []; foreach ($args as $arg) { if (strpos($arg, ':') !== false) { list($key, $value) = explode(':', $arg); if (in_array($value, ['true', 'false'])) { $value = $value === 'true'; ...
[ "protected", "function", "_splitArgs", "(", "$", "args", ")", "{", "$", "out", "=", "[", "]", ";", "foreach", "(", "$", "args", "as", "$", "arg", ")", "{", "if", "(", "strpos", "(", "$", "arg", ",", "':'", ")", "!==", "false", ")", "{", "list",...
Split the CLI arguments into a hash. @param array $args The arguments to split. @return array
[ "Split", "the", "CLI", "arguments", "into", "a", "hash", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/RoutesShell.php#L139-L155
211,588
cakephp/cakephp
src/Database/Type.php
Type.build
public static function build($name) { if (isset(static::$_builtTypes[$name])) { return static::$_builtTypes[$name]; } if (!isset(static::$_types[$name])) { throw new InvalidArgumentException(sprintf('Unknown type "%s"', $name)); } if (is_string(static:...
php
public static function build($name) { if (isset(static::$_builtTypes[$name])) { return static::$_builtTypes[$name]; } if (!isset(static::$_types[$name])) { throw new InvalidArgumentException(sprintf('Unknown type "%s"', $name)); } if (is_string(static:...
[ "public", "static", "function", "build", "(", "$", "name", ")", "{", "if", "(", "isset", "(", "static", "::", "$", "_builtTypes", "[", "$", "name", "]", ")", ")", "{", "return", "static", "::", "$", "_builtTypes", "[", "$", "name", "]", ";", "}", ...
Returns a Type object capable of converting a type identified by name. @param string $name type identifier @throws \InvalidArgumentException If type identifier is unknown @return \Cake\Database\Type
[ "Returns", "a", "Type", "object", "capable", "of", "converting", "a", "type", "identified", "by", "name", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Type.php#L101-L114
211,589
cakephp/cakephp
src/Database/Type.php
Type.buildAll
public static function buildAll() { $result = []; foreach (static::$_types as $name => $type) { $result[$name] = isset(static::$_builtTypes[$name]) ? static::$_builtTypes[$name] : static::build($name); } return $result; }
php
public static function buildAll() { $result = []; foreach (static::$_types as $name => $type) { $result[$name] = isset(static::$_builtTypes[$name]) ? static::$_builtTypes[$name] : static::build($name); } return $result; }
[ "public", "static", "function", "buildAll", "(", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "static", "::", "$", "_types", "as", "$", "name", "=>", "$", "type", ")", "{", "$", "result", "[", "$", "name", "]", "=", "isset", "(", ...
Returns an arrays with all the mapped type objects, indexed by name. @return array
[ "Returns", "an", "arrays", "with", "all", "the", "mapped", "type", "objects", "indexed", "by", "name", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Type.php#L121-L129
211,590
cakephp/cakephp
src/Database/Type.php
Type._basicTypeCast
protected function _basicTypeCast($value) { deprecationWarning( 'Using Type::_basicTypeCast() is deprecated. ' . "The '{$this->_name}' type needs to be updated to implement `TypeInterface`." ); if ($value === null) { return null; } if (!emp...
php
protected function _basicTypeCast($value) { deprecationWarning( 'Using Type::_basicTypeCast() is deprecated. ' . "The '{$this->_name}' type needs to be updated to implement `TypeInterface`." ); if ($value === null) { return null; } if (!emp...
[ "protected", "function", "_basicTypeCast", "(", "$", "value", ")", "{", "deprecationWarning", "(", "'Using Type::_basicTypeCast() is deprecated. '", ".", "\"The '{$this->_name}' type needs to be updated to implement `TypeInterface`.\"", ")", ";", "if", "(", "$", "value", "===",...
Checks whether this type is a basic one and can be converted using a callback If it is, returns converted value @param mixed $value Value to be converted to PHP equivalent @return mixed @deprecated 3.1 All types should now be a specific class
[ "Checks", "whether", "this", "type", "is", "a", "basic", "one", "and", "can", "be", "converted", "using", "a", "callback", "If", "it", "is", "returns", "converted", "value" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Type.php#L284-L301
211,591
cakephp/cakephp
src/Database/Type.php
Type.boolval
public static function boolval($value) { deprecationWarning('Type::boolval() is deprecated.'); if (is_string($value) && !is_numeric($value)) { return strtolower($value) === 'true'; } return !empty($value); }
php
public static function boolval($value) { deprecationWarning('Type::boolval() is deprecated.'); if (is_string($value) && !is_numeric($value)) { return strtolower($value) === 'true'; } return !empty($value); }
[ "public", "static", "function", "boolval", "(", "$", "value", ")", "{", "deprecationWarning", "(", "'Type::boolval() is deprecated.'", ")", ";", "if", "(", "is_string", "(", "$", "value", ")", "&&", "!", "is_numeric", "(", "$", "value", ")", ")", "{", "ret...
Type converter for boolean values. Will convert string true/false into booleans. @param mixed $value The value to convert to a boolean. @return bool @deprecated 3.1.8 This method is now unused.
[ "Type", "converter", "for", "boolean", "values", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Type.php#L324-L332
211,592
cakephp/cakephp
src/Database/Type/DateTimeType.php
DateTimeType.toDatabase
public function toDatabase($value, Driver $driver) { if ($value === null || is_string($value)) { return $value; } if (is_int($value)) { $class = $this->_className; $value = new $class('@' . $value); } $format = (array)$this->_format; ...
php
public function toDatabase($value, Driver $driver) { if ($value === null || is_string($value)) { return $value; } if (is_int($value)) { $class = $this->_className; $value = new $class('@' . $value); } $format = (array)$this->_format; ...
[ "public", "function", "toDatabase", "(", "$", "value", ",", "Driver", "$", "driver", ")", "{", "if", "(", "$", "value", "===", "null", "||", "is_string", "(", "$", "value", ")", ")", "{", "return", "$", "value", ";", "}", "if", "(", "is_int", "(", ...
Convert DateTime instance into strings. @param string|int|\DateTime|\DateTimeImmutable $value The value to convert. @param \Cake\Database\Driver $driver The driver instance to convert with. @return string|null
[ "Convert", "DateTime", "instance", "into", "strings", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Type/DateTimeType.php#L130-L152
211,593
cakephp/cakephp
src/Database/Type/DateTimeType.php
DateTimeType.setTimezone
public function setTimezone($timezone) { if (is_string($timezone)) { $timezone = new DateTimeZone($timezone); } $this->dbTimezone = $timezone; return $this; }
php
public function setTimezone($timezone) { if (is_string($timezone)) { $timezone = new DateTimeZone($timezone); } $this->dbTimezone = $timezone; return $this; }
[ "public", "function", "setTimezone", "(", "$", "timezone", ")", "{", "if", "(", "is_string", "(", "$", "timezone", ")", ")", "{", "$", "timezone", "=", "new", "DateTimeZone", "(", "$", "timezone", ")", ";", "}", "$", "this", "->", "dbTimezone", "=", ...
Set database timezone. Specified timezone will be set for DateTime objects before generating datetime string for saving to database. If `null` no timezone conversion will be done. @param string|\DateTimeZone|null $timezone Database timezone. @return $this
[ "Set", "database", "timezone", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Type/DateTimeType.php#L164-L172
211,594
cakephp/cakephp
src/Database/Type/DateTimeType.php
DateTimeType.toPHP
public function toPHP($value, Driver $driver) { if ($value === null || strpos($value, '0000-00-00') === 0) { return null; } $instance = clone $this->_datetimeInstance; $instance = $instance->modify($value); if ($this->setToDateStart) { $instance = $i...
php
public function toPHP($value, Driver $driver) { if ($value === null || strpos($value, '0000-00-00') === 0) { return null; } $instance = clone $this->_datetimeInstance; $instance = $instance->modify($value); if ($this->setToDateStart) { $instance = $i...
[ "public", "function", "toPHP", "(", "$", "value", ",", "Driver", "$", "driver", ")", "{", "if", "(", "$", "value", "===", "null", "||", "strpos", "(", "$", "value", ",", "'0000-00-00'", ")", "===", "0", ")", "{", "return", "null", ";", "}", "$", ...
Convert strings into DateTime instances. @param string $value The value to convert. @param \Cake\Database\Driver $driver The driver instance to convert with. @return \Cake\I18n\Time|\DateTime|null
[ "Convert", "strings", "into", "DateTime", "instances", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Type/DateTimeType.php#L181-L195
211,595
cakephp/cakephp
src/Database/Type/DateTimeType.php
DateTimeType._setClassName
protected function _setClassName($class, $fallback) { if (!class_exists($class)) { $class = $fallback; } $this->_className = $class; $this->_datetimeInstance = new $this->_className; }
php
protected function _setClassName($class, $fallback) { if (!class_exists($class)) { $class = $fallback; } $this->_className = $class; $this->_datetimeInstance = new $this->_className; }
[ "protected", "function", "_setClassName", "(", "$", "class", ",", "$", "fallback", ")", "{", "if", "(", "!", "class_exists", "(", "$", "class", ")", ")", "{", "$", "class", "=", "$", "fallback", ";", "}", "$", "this", "->", "_className", "=", "$", ...
Set the classname to use when building objects. @param string $class The classname to use. @param string $fallback The classname to use when the preferred class does not exist. @return void
[ "Set", "the", "classname", "to", "use", "when", "building", "objects", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Type/DateTimeType.php#L369-L376
211,596
cakephp/cakephp
src/Http/CorsBuilder.php
CorsBuilder.build
public function build() { $response = $this->_response; if (empty($this->_origin)) { return $response; } if (isset($this->_headers['Access-Control-Allow-Origin'])) { foreach ($this->_headers as $key => $value) { $response = $response->withHead...
php
public function build() { $response = $this->_response; if (empty($this->_origin)) { return $response; } if (isset($this->_headers['Access-Control-Allow-Origin'])) { foreach ($this->_headers as $key => $value) { $response = $response->withHead...
[ "public", "function", "build", "(", ")", "{", "$", "response", "=", "$", "this", "->", "_response", ";", "if", "(", "empty", "(", "$", "this", "->", "_origin", ")", ")", "{", "return", "$", "response", ";", "}", "if", "(", "isset", "(", "$", "thi...
Apply the queued headers to the response. If the builder has no Origin, or if there are no allowed domains, or if the allowed domains do not match the Origin header no headers will be applied. @return \Psr\Http\Message\MessageInterface A new instance of the response with new headers.
[ "Apply", "the", "queued", "headers", "to", "the", "response", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/CorsBuilder.php#L84-L98
211,597
cakephp/cakephp
src/Http/CorsBuilder.php
CorsBuilder.allowOrigin
public function allowOrigin($domain) { $allowed = $this->_normalizeDomains((array)$domain); foreach ($allowed as $domain) { if (!preg_match($domain['preg'], $this->_origin)) { continue; } $value = $domain['original'] === '*' ? '*' : $this->_origin;...
php
public function allowOrigin($domain) { $allowed = $this->_normalizeDomains((array)$domain); foreach ($allowed as $domain) { if (!preg_match($domain['preg'], $this->_origin)) { continue; } $value = $domain['original'] === '*' ? '*' : $this->_origin;...
[ "public", "function", "allowOrigin", "(", "$", "domain", ")", "{", "$", "allowed", "=", "$", "this", "->", "_normalizeDomains", "(", "(", "array", ")", "$", "domain", ")", ";", "foreach", "(", "$", "allowed", "as", "$", "domain", ")", "{", "if", "(",...
Set the list of allowed domains. Accepts a string or an array of domains that have CORS enabled. You can use `*.example.com` wildcards to accept subdomains, or `*` to allow all domains @param string|array $domain The allowed domains @return $this
[ "Set", "the", "list", "of", "allowed", "domains", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/CorsBuilder.php#L109-L122
211,598
cakephp/cakephp
src/Http/CorsBuilder.php
CorsBuilder._normalizeDomains
protected function _normalizeDomains($domains) { $result = []; foreach ($domains as $domain) { if ($domain === '*') { $result[] = ['preg' => '@.@', 'original' => '*']; continue; } $original = $preg = $domain; if (strpos...
php
protected function _normalizeDomains($domains) { $result = []; foreach ($domains as $domain) { if ($domain === '*') { $result[] = ['preg' => '@.@', 'original' => '*']; continue; } $original = $preg = $domain; if (strpos...
[ "protected", "function", "_normalizeDomains", "(", "$", "domains", ")", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "domains", "as", "$", "domain", ")", "{", "if", "(", "$", "domain", "===", "'*'", ")", "{", "$", "result", "[", "]"...
Normalize the origin to regular expressions and put in an array format @param array $domains Domain names to normalize. @return array
[ "Normalize", "the", "origin", "to", "regular", "expressions", "and", "put", "in", "an", "array", "format" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/CorsBuilder.php#L130-L148
211,599
cakephp/cakephp
src/Controller/Controller.php
Controller.components
public function components($components = null) { if ($components === null && $this->_components === null) { $this->_components = new ComponentRegistry($this); } if ($components !== null) { $components->setController($this); $this->_components = $components...
php
public function components($components = null) { if ($components === null && $this->_components === null) { $this->_components = new ComponentRegistry($this); } if ($components !== null) { $components->setController($this); $this->_components = $components...
[ "public", "function", "components", "(", "$", "components", "=", "null", ")", "{", "if", "(", "$", "components", "===", "null", "&&", "$", "this", "->", "_components", "===", "null", ")", "{", "$", "this", "->", "_components", "=", "new", "ComponentRegis...
Get the component registry for this controller. If called with the first parameter, it will be set as the controller $this->_components property @param \Cake\Controller\ComponentRegistry|null $components Component registry. @return \Cake\Controller\ComponentRegistry
[ "Get", "the", "component", "registry", "for", "this", "controller", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Controller/Controller.php#L301-L312