id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
210,500
cakephp/cakephp
src/ORM/Marshaller.php
Marshaller._buildPropertyMap
protected function _buildPropertyMap($data, $options) { $map = []; $schema = $this->_table->getSchema(); // Is a concrete column? foreach (array_keys($data) as $prop) { $columnType = $schema->getColumnType($prop); if ($columnType) { $map[$prop...
php
protected function _buildPropertyMap($data, $options) { $map = []; $schema = $this->_table->getSchema(); // Is a concrete column? foreach (array_keys($data) as $prop) { $columnType = $schema->getColumnType($prop); if ($columnType) { $map[$prop...
[ "protected", "function", "_buildPropertyMap", "(", "$", "data", ",", "$", "options", ")", "{", "$", "map", "=", "[", "]", ";", "$", "schema", "=", "$", "this", "->", "_table", "->", "getSchema", "(", ")", ";", "// Is a concrete column?", "foreach", "(", ...
Build the map of property => marshalling callable. @param array $data The data being marshalled. @param array $options List of options containing the 'associated' key. @throws \InvalidArgumentException When associations do not exist. @return array
[ "Build", "the", "map", "of", "property", "=", ">", "marshalling", "callable", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Marshaller.php#L66-L134
210,501
cakephp/cakephp
src/ORM/Marshaller.php
Marshaller.one
public function one(array $data, array $options = []) { list($data, $options) = $this->_prepareDataAndOptions($data, $options); $primaryKey = (array)$this->_table->getPrimaryKey(); $entityClass = $this->_table->getEntityClass(); /** @var \Cake\Datasource\EntityInterface $entity */ ...
php
public function one(array $data, array $options = []) { list($data, $options) = $this->_prepareDataAndOptions($data, $options); $primaryKey = (array)$this->_table->getPrimaryKey(); $entityClass = $this->_table->getEntityClass(); /** @var \Cake\Datasource\EntityInterface $entity */ ...
[ "public", "function", "one", "(", "array", "$", "data", ",", "array", "$", "options", "=", "[", "]", ")", "{", "list", "(", "$", "data", ",", "$", "options", ")", "=", "$", "this", "->", "_prepareDataAndOptions", "(", "$", "data", ",", "$", "option...
Hydrate one entity and its associated data. ### Options: - validate: Set to false to disable validation. Can also be a string of the validator ruleset to be applied. Defaults to true/default. - associated: Associations listed here will be marshalled as well. Defaults to null. - fieldList: (deprecated) Since 3.4.0. Us...
[ "Hydrate", "one", "entity", "and", "its", "associated", "data", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Marshaller.php#L168-L228
210,502
cakephp/cakephp
src/ORM/Marshaller.php
Marshaller._marshalAssociation
protected function _marshalAssociation($assoc, $value, $options) { if (!is_array($value)) { return null; } $targetTable = $assoc->getTarget(); $marshaller = $targetTable->marshaller(); $types = [Association::ONE_TO_ONE, Association::MANY_TO_ONE]; if (in_ar...
php
protected function _marshalAssociation($assoc, $value, $options) { if (!is_array($value)) { return null; } $targetTable = $assoc->getTarget(); $marshaller = $targetTable->marshaller(); $types = [Association::ONE_TO_ONE, Association::MANY_TO_ONE]; if (in_ar...
[ "protected", "function", "_marshalAssociation", "(", "$", "assoc", ",", "$", "value", ",", "$", "options", ")", "{", "if", "(", "!", "is_array", "(", "$", "value", ")", ")", "{", "return", "null", ";", "}", "$", "targetTable", "=", "$", "assoc", "->"...
Create a new sub-marshaller and marshal the associated data. @param \Cake\ORM\Association $assoc The association to marshall @param array $value The data to hydrate @param array $options List of options. @return \Cake\Datasource\EntityInterface|\Cake\Datasource\EntityInterface[]|null
[ "Create", "a", "new", "sub", "-", "marshaller", "and", "marshal", "the", "associated", "data", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Marshaller.php#L304-L331
210,503
cakephp/cakephp
src/ORM/Marshaller.php
Marshaller.many
public function many(array $data, array $options = []) { $output = []; foreach ($data as $record) { if (!is_array($record)) { continue; } $output[] = $this->one($record, $options); } return $output; }
php
public function many(array $data, array $options = []) { $output = []; foreach ($data as $record) { if (!is_array($record)) { continue; } $output[] = $this->one($record, $options); } return $output; }
[ "public", "function", "many", "(", "array", "$", "data", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "output", "=", "[", "]", ";", "foreach", "(", "$", "data", "as", "$", "record", ")", "{", "if", "(", "!", "is_array", "(", "$",...
Hydrate many entities and their associated data. ### Options: - validate: Set to false to disable validation. Can also be a string of the validator ruleset to be applied. Defaults to true/default. - associated: Associations listed here will be marshalled as well. Defaults to null. - fieldList: (deprecated) Since 3.4....
[ "Hydrate", "many", "entities", "and", "their", "associated", "data", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Marshaller.php#L355-L366
210,504
cakephp/cakephp
src/ORM/Marshaller.php
Marshaller._loadAssociatedByIds
protected function _loadAssociatedByIds($assoc, $ids) { if (empty($ids)) { return []; } $target = $assoc->getTarget(); $primaryKey = (array)$target->getPrimaryKey(); $multi = count($primaryKey) > 1; $primaryKey = array_map([$target, 'aliasField'], $primar...
php
protected function _loadAssociatedByIds($assoc, $ids) { if (empty($ids)) { return []; } $target = $assoc->getTarget(); $primaryKey = (array)$target->getPrimaryKey(); $multi = count($primaryKey) > 1; $primaryKey = array_map([$target, 'aliasField'], $primar...
[ "protected", "function", "_loadAssociatedByIds", "(", "$", "assoc", ",", "$", "ids", ")", "{", "if", "(", "empty", "(", "$", "ids", ")", ")", "{", "return", "[", "]", ";", "}", "$", "target", "=", "$", "assoc", "->", "getTarget", "(", ")", ";", "...
Loads a list of belongs to many from ids. @param \Cake\ORM\Association $assoc The association class for the belongsToMany association. @param array $ids The list of ids to load. @return \Cake\Datasource\EntityInterface[] An array of entities.
[ "Loads", "a", "list", "of", "belongs", "to", "many", "from", "ids", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Marshaller.php#L474-L496
210,505
cakephp/cakephp
src/ORM/Marshaller.php
Marshaller._mergeAssociation
protected function _mergeAssociation($original, $assoc, $value, $options) { if (!$original) { return $this->_marshalAssociation($assoc, $value, $options); } if (!is_array($value)) { return null; } $targetTable = $assoc->getTarget(); $marshalle...
php
protected function _mergeAssociation($original, $assoc, $value, $options) { if (!$original) { return $this->_marshalAssociation($assoc, $value, $options); } if (!is_array($value)) { return null; } $targetTable = $assoc->getTarget(); $marshalle...
[ "protected", "function", "_mergeAssociation", "(", "$", "original", ",", "$", "assoc", ",", "$", "value", ",", "$", "options", ")", "{", "if", "(", "!", "$", "original", ")", "{", "return", "$", "this", "->", "_marshalAssociation", "(", "$", "assoc", "...
Creates a new sub-marshaller and merges the associated data. @param \Cake\Datasource\EntityInterface|\Cake\Datasource\EntityInterface[] $original The original entity @param \Cake\ORM\Association $assoc The association to merge @param array $value The data to hydrate @param array $options List of options. @return \Cake...
[ "Creates", "a", "new", "sub", "-", "marshaller", "and", "merges", "the", "associated", "data", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Marshaller.php#L738-L769
210,506
cakephp/cakephp
src/ORM/Marshaller.php
Marshaller._mergeBelongsToMany
protected function _mergeBelongsToMany($original, $assoc, $value, $options) { $associated = isset($options['associated']) ? $options['associated'] : []; $hasIds = array_key_exists('_ids', $value); $onlyIds = array_key_exists('onlyIds', $options) && $options['onlyIds']; if ($hasIds ...
php
protected function _mergeBelongsToMany($original, $assoc, $value, $options) { $associated = isset($options['associated']) ? $options['associated'] : []; $hasIds = array_key_exists('_ids', $value); $onlyIds = array_key_exists('onlyIds', $options) && $options['onlyIds']; if ($hasIds ...
[ "protected", "function", "_mergeBelongsToMany", "(", "$", "original", ",", "$", "assoc", ",", "$", "value", ",", "$", "options", ")", "{", "$", "associated", "=", "isset", "(", "$", "options", "[", "'associated'", "]", ")", "?", "$", "options", "[", "'...
Creates a new sub-marshaller and merges the associated data for a BelongstoMany association. @param \Cake\Datasource\EntityInterface $original The original entity @param \Cake\ORM\Association $assoc The association to marshall @param array $value The data to hydrate @param array $options List of options. @return \Cake...
[ "Creates", "a", "new", "sub", "-", "marshaller", "and", "merges", "the", "associated", "data", "for", "a", "BelongstoMany", "association", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Marshaller.php#L781-L800
210,507
cakephp/cakephp
src/ORM/Marshaller.php
Marshaller._mergeJoinData
protected function _mergeJoinData($original, $assoc, $value, $options) { $associated = isset($options['associated']) ? $options['associated'] : []; $extra = []; foreach ($original as $entity) { // Mark joinData as accessible so we can marshal it properly. $entity->set...
php
protected function _mergeJoinData($original, $assoc, $value, $options) { $associated = isset($options['associated']) ? $options['associated'] : []; $extra = []; foreach ($original as $entity) { // Mark joinData as accessible so we can marshal it properly. $entity->set...
[ "protected", "function", "_mergeJoinData", "(", "$", "original", ",", "$", "assoc", ",", "$", "value", ",", "$", "options", ")", "{", "$", "associated", "=", "isset", "(", "$", "options", "[", "'associated'", "]", ")", "?", "$", "options", "[", "'assoc...
Merge the special _joinData property into the entity set. @param \Cake\Datasource\EntityInterface $original The original entity @param \Cake\ORM\Association\BelongsToMany $assoc The association to marshall @param array $value The data to hydrate @param array $options List of options. @return \Cake\Datasource\EntityInt...
[ "Merge", "the", "special", "_joinData", "property", "into", "the", "entity", "set", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/ORM/Marshaller.php#L811-L861
210,508
cakephp/cakephp
src/Core/ConventionsTrait.php
ConventionsTrait._modelKey
protected function _modelKey($name) { list(, $name) = pluginSplit($name); return Inflector::underscore(Inflector::singularize($name)) . '_id'; }
php
protected function _modelKey($name) { list(, $name) = pluginSplit($name); return Inflector::underscore(Inflector::singularize($name)) . '_id'; }
[ "protected", "function", "_modelKey", "(", "$", "name", ")", "{", "list", "(", ",", "$", "name", ")", "=", "pluginSplit", "(", "$", "name", ")", ";", "return", "Inflector", "::", "underscore", "(", "Inflector", "::", "singularize", "(", "$", "name", ")...
Creates the proper underscored model key for associations If the input contains a dot, assume that the right side is the real table name. @param string $name Model class name @return string Singular model key
[ "Creates", "the", "proper", "underscored", "model", "key", "for", "associations" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/ConventionsTrait.php#L55-L60
210,509
cakephp/cakephp
src/Core/ConventionsTrait.php
ConventionsTrait._modelNameFromKey
protected function _modelNameFromKey($key) { $key = str_replace('_id', '', $key); return Inflector::camelize(Inflector::pluralize($key)); }
php
protected function _modelNameFromKey($key) { $key = str_replace('_id', '', $key); return Inflector::camelize(Inflector::pluralize($key)); }
[ "protected", "function", "_modelNameFromKey", "(", "$", "key", ")", "{", "$", "key", "=", "str_replace", "(", "'_id'", ",", "''", ",", "$", "key", ")", ";", "return", "Inflector", "::", "camelize", "(", "Inflector", "::", "pluralize", "(", "$", "key", ...
Creates the proper model name from a foreign key @param string $key Foreign key @return string Model name
[ "Creates", "the", "proper", "model", "name", "from", "a", "foreign", "key" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/ConventionsTrait.php#L68-L73
210,510
cakephp/cakephp
src/Routing/RouteCollection.php
RouteCollection.parse
public function parse($url, $method = '') { $decoded = urldecode($url); // Sort path segments matching longest paths first. $paths = array_keys($this->_paths); rsort($paths); foreach ($paths as $path) { if (strpos($decoded, $path) !== 0) { contin...
php
public function parse($url, $method = '') { $decoded = urldecode($url); // Sort path segments matching longest paths first. $paths = array_keys($this->_paths); rsort($paths); foreach ($paths as $path) { if (strpos($decoded, $path) !== 0) { contin...
[ "public", "function", "parse", "(", "$", "url", ",", "$", "method", "=", "''", ")", "{", "$", "decoded", "=", "urldecode", "(", "$", "url", ")", ";", "// Sort path segments matching longest paths first.", "$", "paths", "=", "array_keys", "(", "$", "this", ...
Takes the URL string and iterates the routes until one is able to parse the route. @param string $url URL to parse. @param string $method The HTTP method to use. @return array An array of request parameters parsed from the URL. @throws \Cake\Routing\Exception\MissingRouteException When a URL has no matching route.
[ "Takes", "the", "URL", "string", "and", "iterates", "the", "routes", "until", "one", "is", "able", "to", "parse", "the", "route", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteCollection.php#L140-L180
210,511
cakephp/cakephp
src/Routing/RouteCollection.php
RouteCollection.parseRequest
public function parseRequest(ServerRequestInterface $request) { $uri = $request->getUri(); $urlPath = urldecode($uri->getPath()); // Sort path segments matching longest paths first. $paths = array_keys($this->_paths); rsort($paths); foreach ($paths as $path) { ...
php
public function parseRequest(ServerRequestInterface $request) { $uri = $request->getUri(); $urlPath = urldecode($uri->getPath()); // Sort path segments matching longest paths first. $paths = array_keys($this->_paths); rsort($paths); foreach ($paths as $path) { ...
[ "public", "function", "parseRequest", "(", "ServerRequestInterface", "$", "request", ")", "{", "$", "uri", "=", "$", "request", "->", "getUri", "(", ")", ";", "$", "urlPath", "=", "urldecode", "(", "$", "uri", "->", "getPath", "(", ")", ")", ";", "// S...
Takes the ServerRequestInterface, iterates the routes until one is able to parse the route. @param \Psr\Http\Message\ServerRequestInterface $request The request to parse route data from. @return array An array of request parameters parsed from the URL. @throws \Cake\Routing\Exception\MissingRouteException When a URL h...
[ "Takes", "the", "ServerRequestInterface", "iterates", "the", "routes", "until", "one", "is", "able", "to", "parse", "the", "route", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteCollection.php#L189-L218
210,512
cakephp/cakephp
src/Routing/RouteCollection.php
RouteCollection.setExtensions
public function setExtensions(array $extensions, $merge = true) { if ($merge) { $extensions = array_unique(array_merge( $this->_extensions, $extensions )); } $this->_extensions = $extensions; return $this; }
php
public function setExtensions(array $extensions, $merge = true) { if ($merge) { $extensions = array_unique(array_merge( $this->_extensions, $extensions )); } $this->_extensions = $extensions; return $this; }
[ "public", "function", "setExtensions", "(", "array", "$", "extensions", ",", "$", "merge", "=", "true", ")", "{", "if", "(", "$", "merge", ")", "{", "$", "extensions", "=", "array_unique", "(", "array_merge", "(", "$", "this", "->", "_extensions", ",", ...
Set the extensions that the route collection can handle. @param array $extensions The list of extensions to set. @param bool $merge Whether to merge with or override existing extensions. Defaults to `true`. @return $this
[ "Set", "the", "extensions", "that", "the", "route", "collection", "can", "handle", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteCollection.php#L411-L422
210,513
cakephp/cakephp
src/Routing/RouteCollection.php
RouteCollection.middlewareGroup
public function middlewareGroup($name, array $middlewareNames) { if ($this->hasMiddleware($name)) { $message = "Cannot add middleware group '$name'. A middleware by this name has already been registered."; throw new RuntimeException($message); } foreach ($middlewareN...
php
public function middlewareGroup($name, array $middlewareNames) { if ($this->hasMiddleware($name)) { $message = "Cannot add middleware group '$name'. A middleware by this name has already been registered."; throw new RuntimeException($message); } foreach ($middlewareN...
[ "public", "function", "middlewareGroup", "(", "$", "name", ",", "array", "$", "middlewareNames", ")", "{", "if", "(", "$", "this", "->", "hasMiddleware", "(", "$", "name", ")", ")", "{", "$", "message", "=", "\"Cannot add middleware group '$name'. A middleware b...
Add middleware to a middleware group @param string $name Name of the middleware group @param array $middlewareNames Names of the middleware @return $this
[ "Add", "middleware", "to", "a", "middleware", "group" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteCollection.php#L448-L465
210,514
cakephp/cakephp
src/Routing/RouteCollection.php
RouteCollection.getMiddleware
public function getMiddleware(array $names) { $out = []; foreach ($names as $name) { if ($this->hasMiddlewareGroup($name)) { $out = array_merge($out, $this->getMiddleware($this->_middlewareGroups[$name])); continue; } if (!$this->ha...
php
public function getMiddleware(array $names) { $out = []; foreach ($names as $name) { if ($this->hasMiddlewareGroup($name)) { $out = array_merge($out, $this->getMiddleware($this->_middlewareGroups[$name])); continue; } if (!$this->ha...
[ "public", "function", "getMiddleware", "(", "array", "$", "names", ")", "{", "$", "out", "=", "[", "]", ";", "foreach", "(", "$", "names", "as", "$", "name", ")", "{", "if", "(", "$", "this", "->", "hasMiddlewareGroup", "(", "$", "name", ")", ")", ...
Get an array of middleware given a list of names @param array $names The names of the middleware or groups to fetch @return array An array of middleware. If any of the passed names are groups, the groups middleware will be flattened into the returned list. @throws \RuntimeException when a requested middleware does not...
[ "Get", "an", "array", "of", "middleware", "given", "a", "list", "of", "names" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/RouteCollection.php#L535-L551
210,515
cakephp/cakephp
src/Routing/Router.php
Router.connect
public static function connect($route, $defaults = [], $options = []) { static::$initialized = true; static::scope('/', function ($routes) use ($route, $defaults, $options) { /** @var \Cake\Routing\RouteBuilder $routes */ $routes->connect($route, $defaults, $options); ...
php
public static function connect($route, $defaults = [], $options = []) { static::$initialized = true; static::scope('/', function ($routes) use ($route, $defaults, $options) { /** @var \Cake\Routing\RouteBuilder $routes */ $routes->connect($route, $defaults, $options); ...
[ "public", "static", "function", "connect", "(", "$", "route", ",", "$", "defaults", "=", "[", "]", ",", "$", "options", "=", "[", "]", ")", "{", "static", "::", "$", "initialized", "=", "true", ";", "static", "::", "scope", "(", "'/'", ",", "functi...
Connects a new Route in the router. Compatibility proxy to \Cake\Routing\RouteBuilder::connect() in the `/` scope. @param string $route A string describing the template of the route @param array|string $defaults An array describing the default route parameters. These parameters will be used by default and can supply ...
[ "Connects", "a", "new", "Route", "in", "the", "router", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L210-L217
210,516
cakephp/cakephp
src/Routing/Router.php
Router.parse
public static function parse($url, $method = '') { deprecationWarning( 'Router::parse() is deprecated. ' . 'Use Router::parseRequest() instead. This will require adopting the Http\Server library.' ); if (!static::$initialized) { static::_loadRoutes(); ...
php
public static function parse($url, $method = '') { deprecationWarning( 'Router::parse() is deprecated. ' . 'Use Router::parseRequest() instead. This will require adopting the Http\Server library.' ); if (!static::$initialized) { static::_loadRoutes(); ...
[ "public", "static", "function", "parse", "(", "$", "url", ",", "$", "method", "=", "''", ")", "{", "deprecationWarning", "(", "'Router::parse() is deprecated. '", ".", "'Use Router::parseRequest() instead. This will require adopting the Http\\Server library.'", ")", ";", "i...
Parses given URL string. Returns 'routing' parameters for that URL. @param string $url URL to be parsed. @param string $method The HTTP method being used. @return array Parsed elements from URL. @throws \Cake\Routing\Exception\MissingRouteException When a route cannot be handled @deprecated 3.4.0 Use Router::parseRequ...
[ "Parses", "given", "URL", "string", ".", "Returns", "routing", "parameters", "for", "that", "URL", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L361-L375
210,517
cakephp/cakephp
src/Routing/Router.php
Router.setRequestInfo
public static function setRequestInfo($request) { if ($request instanceof ServerRequest) { static::pushRequest($request); } else { deprecationWarning( 'Passing an array into Router::setRequestInfo() is deprecated. ' . 'Pass an instance of Serve...
php
public static function setRequestInfo($request) { if ($request instanceof ServerRequest) { static::pushRequest($request); } else { deprecationWarning( 'Passing an array into Router::setRequestInfo() is deprecated. ' . 'Pass an instance of Serve...
[ "public", "static", "function", "setRequestInfo", "(", "$", "request", ")", "{", "if", "(", "$", "request", "instanceof", "ServerRequest", ")", "{", "static", "::", "pushRequest", "(", "$", "request", ")", ";", "}", "else", "{", "deprecationWarning", "(", ...
Takes parameter and path information back from the Dispatcher, sets these parameters as the current request parameters that are merged with URL arrays created later in the request. Nested requests will create a stack of requests. You can remove requests using Router::popRequest(). This is done automatically when using...
[ "Takes", "parameter", "and", "path", "information", "back", "from", "the", "Dispatcher", "sets", "these", "parameters", "as", "the", "current", "request", "parameters", "that", "are", "merged", "with", "URL", "arrays", "created", "later", "in", "the", "request",...
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L408-L433
210,518
cakephp/cakephp
src/Routing/Router.php
Router.setRequestContext
public static function setRequestContext(ServerRequestInterface $request) { $uri = $request->getUri(); static::$_requestContext = [ '_base' => $request->getAttribute('base'), '_port' => $uri->getPort(), '_scheme' => $uri->getScheme(), '_host' => $uri->...
php
public static function setRequestContext(ServerRequestInterface $request) { $uri = $request->getUri(); static::$_requestContext = [ '_base' => $request->getAttribute('base'), '_port' => $uri->getPort(), '_scheme' => $uri->getScheme(), '_host' => $uri->...
[ "public", "static", "function", "setRequestContext", "(", "ServerRequestInterface", "$", "request", ")", "{", "$", "uri", "=", "$", "request", "->", "getUri", "(", ")", ";", "static", "::", "$", "_requestContext", "=", "[", "'_base'", "=>", "$", "request", ...
Store the request context for a given request. @param \Psr\Http\Message\ServerRequestInterface $request The request instance. @return void @throws \InvalidArgumentException When parameter is an incorrect type.
[ "Store", "the", "request", "context", "for", "a", "given", "request", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L455-L464
210,519
cakephp/cakephp
src/Routing/Router.php
Router.popRequest
public static function popRequest() { $removed = array_pop(static::$_requests); $last = end(static::$_requests); if ($last) { static::setRequestContext($last); reset(static::$_requests); } return $removed; }
php
public static function popRequest() { $removed = array_pop(static::$_requests); $last = end(static::$_requests); if ($last) { static::setRequestContext($last); reset(static::$_requests); } return $removed; }
[ "public", "static", "function", "popRequest", "(", ")", "{", "$", "removed", "=", "array_pop", "(", "static", "::", "$", "_requests", ")", ";", "$", "last", "=", "end", "(", "static", "::", "$", "_requests", ")", ";", "if", "(", "$", "last", ")", "...
Pops a request off of the request stack. Used when doing requestAction @return \Cake\Http\ServerRequest The request removed from the stack. @see \Cake\Routing\Router::pushRequest() @see \Cake\Routing\RequestActionTrait::requestAction()
[ "Pops", "a", "request", "off", "of", "the", "request", "stack", ".", "Used", "when", "doing", "requestAction" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L473-L483
210,520
cakephp/cakephp
src/Routing/Router.php
Router.getRequest
public static function getRequest($current = false) { if ($current) { $request = end(static::$_requests); return $request ?: null; } return isset(static::$_requests[0]) ? static::$_requests[0] : null; }
php
public static function getRequest($current = false) { if ($current) { $request = end(static::$_requests); return $request ?: null; } return isset(static::$_requests[0]) ? static::$_requests[0] : null; }
[ "public", "static", "function", "getRequest", "(", "$", "current", "=", "false", ")", "{", "if", "(", "$", "current", ")", "{", "$", "request", "=", "end", "(", "static", "::", "$", "_requests", ")", ";", "return", "$", "request", "?", ":", "null", ...
Get the current request object, or the first one. @param bool $current True to get the current request, or false to get the first one. @return \Cake\Http\ServerRequest|null
[ "Get", "the", "current", "request", "object", "or", "the", "first", "one", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L491-L500
210,521
cakephp/cakephp
src/Routing/Router.php
Router.reload
public static function reload() { if (empty(static::$_initialState)) { static::$_collection = new RouteCollection(); static::$_initialState = get_class_vars(get_called_class()); return; } foreach (static::$_initialState as $key => $val) { if (...
php
public static function reload() { if (empty(static::$_initialState)) { static::$_collection = new RouteCollection(); static::$_initialState = get_class_vars(get_called_class()); return; } foreach (static::$_initialState as $key => $val) { if (...
[ "public", "static", "function", "reload", "(", ")", "{", "if", "(", "empty", "(", "static", "::", "$", "_initialState", ")", ")", "{", "static", "::", "$", "_collection", "=", "new", "RouteCollection", "(", ")", ";", "static", "::", "$", "_initialState",...
Reloads default Router settings. Resets all class variables and removes all connected routes. @return void
[ "Reloads", "default", "Router", "settings", ".", "Resets", "all", "class", "variables", "and", "removes", "all", "connected", "routes", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L508-L522
210,522
cakephp/cakephp
src/Routing/Router.php
Router._applyUrlFilters
protected static function _applyUrlFilters($url) { $request = static::getRequest(true); $e = null; foreach (static::$_urlFilters as $filter) { try { $url = $filter($url, $request); } catch (Exception $e) { // fall through } ...
php
protected static function _applyUrlFilters($url) { $request = static::getRequest(true); $e = null; foreach (static::$_urlFilters as $filter) { try { $url = $filter($url, $request); } catch (Exception $e) { // fall through } ...
[ "protected", "static", "function", "_applyUrlFilters", "(", "$", "url", ")", "{", "$", "request", "=", "static", "::", "getRequest", "(", "true", ")", ";", "$", "e", "=", "null", ";", "foreach", "(", "static", "::", "$", "_urlFilters", "as", "$", "filt...
Applies all the connected URL filters to the URL. @param array $url The URL array being modified. @return array The modified URL. @see \Cake\Routing\Router::url() @see \Cake\Routing\Router::addUrlFilter()
[ "Applies", "all", "the", "connected", "URL", "filters", "to", "the", "URL", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L590-L619
210,523
cakephp/cakephp
src/Routing/Router.php
Router.fullBaseUrl
public static function fullBaseUrl($base = null) { if ($base !== null) { static::$_fullBaseUrl = $base; Configure::write('App.fullBaseUrl', $base); } if (empty(static::$_fullBaseUrl)) { static::$_fullBaseUrl = Configure::read('App.fullBaseUrl'); } ...
php
public static function fullBaseUrl($base = null) { if ($base !== null) { static::$_fullBaseUrl = $base; Configure::write('App.fullBaseUrl', $base); } if (empty(static::$_fullBaseUrl)) { static::$_fullBaseUrl = Configure::read('App.fullBaseUrl'); } ...
[ "public", "static", "function", "fullBaseUrl", "(", "$", "base", "=", "null", ")", "{", "if", "(", "$", "base", "!==", "null", ")", "{", "static", "::", "$", "_fullBaseUrl", "=", "$", "base", ";", "Configure", "::", "write", "(", "'App.fullBaseUrl'", "...
Sets the full base URL that will be used as a prefix for generating fully qualified URLs for this application. If no parameters are passed, the currently configured value is returned. ### Note: If you change the configuration value `App.fullBaseUrl` during runtime and expect the router to produce links using the new ...
[ "Sets", "the", "full", "base", "URL", "that", "will", "be", "used", "as", "a", "prefix", "for", "generating", "fully", "qualified", "URLs", "for", "this", "application", ".", "If", "no", "parameters", "are", "passed", "the", "currently", "configured", "value...
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L807-L818
210,524
cakephp/cakephp
src/Routing/Router.php
Router.reverseToArray
public static function reverseToArray($params) { $url = []; if ($params instanceof ServerRequest) { $url = $params->getQueryParams(); $params = $params->getAttribute('params'); } elseif (isset($params['url'])) { $url = $params['url']; } $pa...
php
public static function reverseToArray($params) { $url = []; if ($params instanceof ServerRequest) { $url = $params->getQueryParams(); $params = $params->getAttribute('params'); } elseif (isset($params['url'])) { $url = $params['url']; } $pa...
[ "public", "static", "function", "reverseToArray", "(", "$", "params", ")", "{", "$", "url", "=", "[", "]", ";", "if", "(", "$", "params", "instanceof", "ServerRequest", ")", "{", "$", "url", "=", "$", "params", "->", "getQueryParams", "(", ")", ";", ...
Reverses a parsed parameter array into an array. Works similarly to Router::url(), but since parsed URL's contain additional 'pass' as well as 'url.url' keys. Those keys need to be specially handled in order to reverse a params array into a string URL. This will strip out 'autoRender', 'bare', 'requested', and 'retur...
[ "Reverses", "a", "parsed", "parameter", "array", "into", "an", "array", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L834-L865
210,525
cakephp/cakephp
src/Routing/Router.php
Router.reverse
public static function reverse($params, $full = false) { $params = static::reverseToArray($params); return static::url($params, $full); }
php
public static function reverse($params, $full = false) { $params = static::reverseToArray($params); return static::url($params, $full); }
[ "public", "static", "function", "reverse", "(", "$", "params", ",", "$", "full", "=", "false", ")", "{", "$", "params", "=", "static", "::", "reverseToArray", "(", "$", "params", ")", ";", "return", "static", "::", "url", "(", "$", "params", ",", "$"...
Reverses a parsed parameter array into a string. Works similarly to Router::url(), but since parsed URL's contain additional 'pass' as well as 'url.url' keys. Those keys need to be specially handled in order to reverse a params array into a string URL. This will strip out 'autoRender', 'bare', 'requested', and 'retur...
[ "Reverses", "a", "parsed", "parameter", "array", "into", "a", "string", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L883-L888
210,526
cakephp/cakephp
src/Routing/Router.php
Router.normalize
public static function normalize($url = '/') { if (is_array($url)) { $url = static::url($url); } if (preg_match('/^[a-z\-]+:\/\//', $url)) { return $url; } $request = static::getRequest(); if ($request) { $base = $request->getAttri...
php
public static function normalize($url = '/') { if (is_array($url)) { $url = static::url($url); } if (preg_match('/^[a-z\-]+:\/\//', $url)) { return $url; } $request = static::getRequest(); if ($request) { $base = $request->getAttri...
[ "public", "static", "function", "normalize", "(", "$", "url", "=", "'/'", ")", "{", "if", "(", "is_array", "(", "$", "url", ")", ")", "{", "$", "url", "=", "static", "::", "url", "(", "$", "url", ")", ";", "}", "if", "(", "preg_match", "(", "'/...
Normalizes a URL for purposes of comparison. Will strip the base path off and replace any double /'s. It will not unify the casing and underscoring of the input value. @param array|string $url URL to normalize Either an array or a string URL. @return string Normalized URL
[ "Normalizes", "a", "URL", "for", "purposes", "of", "comparison", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L899-L927
210,527
cakephp/cakephp
src/Routing/Router.php
Router.extensions
public static function extensions($extensions = null, $merge = true) { $collection = static::$_collection; if ($extensions === null) { if (!static::$initialized) { static::_loadRoutes(); } return array_unique(array_merge(static::$_defaultExtension...
php
public static function extensions($extensions = null, $merge = true) { $collection = static::$_collection; if ($extensions === null) { if (!static::$initialized) { static::_loadRoutes(); } return array_unique(array_merge(static::$_defaultExtension...
[ "public", "static", "function", "extensions", "(", "$", "extensions", "=", "null", ",", "$", "merge", "=", "true", ")", "{", "$", "collection", "=", "static", "::", "$", "_collection", ";", "if", "(", "$", "extensions", "===", "null", ")", "{", "if", ...
Get or set valid extensions for all routes connected later. Instructs the router to parse out file extensions from the URL. For example, http://example.com/posts.rss would yield a file extension of "rss". The file extension itself is made available in the controller as `$this->request->getParam('_ext')`, and is used b...
[ "Get", "or", "set", "valid", "extensions", "for", "all", "routes", "connected", "later", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L949-L965
210,528
cakephp/cakephp
src/Routing/Router.php
Router.parseNamedParams
public static function parseNamedParams(ServerRequest $request, array $options = []) { deprecationWarning( 'Router::parseNamedParams() is deprecated. ' . '2.x backwards compatible named parameter support will be removed in 4.0' ); $options += ['separator' => ':']; ...
php
public static function parseNamedParams(ServerRequest $request, array $options = []) { deprecationWarning( 'Router::parseNamedParams() is deprecated. ' . '2.x backwards compatible named parameter support will be removed in 4.0' ); $options += ['separator' => ':']; ...
[ "public", "static", "function", "parseNamedParams", "(", "ServerRequest", "$", "request", ",", "array", "$", "options", "=", "[", "]", ")", "{", "deprecationWarning", "(", "'Router::parseNamedParams() is deprecated. '", ".", "'2.x backwards compatible named parameter suppor...
Provides legacy support for named parameters on incoming URLs. Checks the passed parameters for elements containing `$options['separator']` Those parameters are split and parsed as if they were old style named parameters. The parsed parameters will be moved from params['pass'] to params['named']. ### Options - `sep...
[ "Provides", "legacy", "support", "for", "named", "parameters", "on", "incoming", "URLs", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L984-L1025
210,529
cakephp/cakephp
src/Routing/Router.php
Router.createRouteBuilder
public static function createRouteBuilder($path, array $options = []) { $defaults = [ 'routeClass' => static::defaultRouteClass(), 'extensions' => static::$_defaultExtensions, ]; $options += $defaults; return new RouteBuilder(static::$_collection, $path, [], ...
php
public static function createRouteBuilder($path, array $options = []) { $defaults = [ 'routeClass' => static::defaultRouteClass(), 'extensions' => static::$_defaultExtensions, ]; $options += $defaults; return new RouteBuilder(static::$_collection, $path, [], ...
[ "public", "static", "function", "createRouteBuilder", "(", "$", "path", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "defaults", "=", "[", "'routeClass'", "=>", "static", "::", "defaultRouteClass", "(", ")", ",", "'extensions'", "=>", "stati...
Create a RouteBuilder for the provided path. @param string $path The path to set the builder to. @param array $options The options for the builder @return \Cake\Routing\RouteBuilder
[ "Create", "a", "RouteBuilder", "for", "the", "provided", "path", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L1034-L1046
210,530
cakephp/cakephp
src/Routing/Router.php
Router.scope
public static function scope($path, $params = [], $callback = null) { $options = []; if (is_array($params)) { $options = $params; unset($params['routeClass'], $params['extensions']); } $builder = static::createRouteBuilder('/', $options); $builder->sco...
php
public static function scope($path, $params = [], $callback = null) { $options = []; if (is_array($params)) { $options = $params; unset($params['routeClass'], $params['extensions']); } $builder = static::createRouteBuilder('/', $options); $builder->sco...
[ "public", "static", "function", "scope", "(", "$", "path", ",", "$", "params", "=", "[", "]", ",", "$", "callback", "=", "null", ")", "{", "$", "options", "=", "[", "]", ";", "if", "(", "is_array", "(", "$", "params", ")", ")", "{", "$", "optio...
Create a routing scope. Routing scopes allow you to keep your routes DRY and avoid repeating common path prefixes, and or parameter sets. Scoped collections will be indexed by path for faster route parsing. If you re-open or re-use a scope the connected routes will be merged with the existing ones. ### Options The ...
[ "Create", "a", "routing", "scope", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L1090-L1099
210,531
cakephp/cakephp
src/Routing/Router.php
Router.prefix
public static function prefix($name, $params = [], $callback = null) { if ($callback === null) { $callback = $params; $params = []; } $name = Inflector::underscore($name); if (empty($params['path'])) { $path = '/' . $name; } else { ...
php
public static function prefix($name, $params = [], $callback = null) { if ($callback === null) { $callback = $params; $params = []; } $name = Inflector::underscore($name); if (empty($params['path'])) { $path = '/' . $name; } else { ...
[ "public", "static", "function", "prefix", "(", "$", "name", ",", "$", "params", "=", "[", "]", ",", "$", "callback", "=", "null", ")", "{", "if", "(", "$", "callback", "===", "null", ")", "{", "$", "callback", "=", "$", "params", ";", "$", "param...
Create prefixed routes. This method creates a scoped route collection that includes relevant prefix information. The path 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. The prefix name will be inflec...
[ "Create", "prefixed", "routes", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Routing/Router.php#L1124-L1141
210,532
cakephp/cakephp
src/View/Form/EntityContext.php
EntityContext._prepare
protected function _prepare() { $table = $this->_context['table']; $entity = $this->_context['entity']; if (empty($table)) { if (is_array($entity) || $entity instanceof Traversable) { foreach ($entity as $e) { $entity = $e; ...
php
protected function _prepare() { $table = $this->_context['table']; $entity = $this->_context['entity']; if (empty($table)) { if (is_array($entity) || $entity instanceof Traversable) { foreach ($entity as $e) { $entity = $e; ...
[ "protected", "function", "_prepare", "(", ")", "{", "$", "table", "=", "$", "this", "->", "_context", "[", "'table'", "]", ";", "$", "entity", "=", "$", "this", "->", "_context", "[", "'entity'", "]", ";", "if", "(", "empty", "(", "$", "table", ")"...
Prepare some additional data from the context. If the table option was provided to the constructor and it was a string, TableLocator will be used to get the correct table instance. If an object is provided as the table option, it will be used as is. If no table option is provided, the table name will be derived base...
[ "Prepare", "some", "additional", "data", "from", "the", "context", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Form/EntityContext.php#L127-L164
210,533
cakephp/cakephp
src/View/Form/EntityContext.php
EntityContext.isCreate
public function isCreate() { $entity = $this->_context['entity']; if (is_array($entity) || $entity instanceof Traversable) { foreach ($entity as $e) { $entity = $e; break; } } if ($entity instanceof EntityInterface) { ...
php
public function isCreate() { $entity = $this->_context['entity']; if (is_array($entity) || $entity instanceof Traversable) { foreach ($entity as $e) { $entity = $e; break; } } if ($entity instanceof EntityInterface) { ...
[ "public", "function", "isCreate", "(", ")", "{", "$", "entity", "=", "$", "this", "->", "_context", "[", "'entity'", "]", ";", "if", "(", "is_array", "(", "$", "entity", ")", "||", "$", "entity", "instanceof", "Traversable", ")", "{", "foreach", "(", ...
Check whether or not this form is a create or update. If the context is for a single entity, the entity's isNew() method will be used. If isNew() returns null, a create operation will be assumed. If the context is for a collection or array the first object in the collection will be used. @return bool
[ "Check", "whether", "or", "not", "this", "form", "is", "a", "create", "or", "update", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Form/EntityContext.php#L201-L215
210,534
cakephp/cakephp
src/View/Form/EntityContext.php
EntityContext._schemaDefault
protected function _schemaDefault($parts) { $table = $this->_getTable($parts); if ($table === false) { return null; } $field = end($parts); $defaults = $table->getSchema()->defaultValues(); if (!array_key_exists($field, $defaults)) { return nul...
php
protected function _schemaDefault($parts) { $table = $this->_getTable($parts); if ($table === false) { return null; } $field = end($parts); $defaults = $table->getSchema()->defaultValues(); if (!array_key_exists($field, $defaults)) { return nul...
[ "protected", "function", "_schemaDefault", "(", "$", "parts", ")", "{", "$", "table", "=", "$", "this", "->", "_getTable", "(", "$", "parts", ")", ";", "if", "(", "$", "table", "===", "false", ")", "{", "return", "null", ";", "}", "$", "field", "="...
Get default value from table schema for given entity field. @param array $parts Each one of the parts in a path for a field name @return mixed
[ "Get", "default", "value", "from", "table", "schema", "for", "given", "entity", "field", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Form/EntityContext.php#L281-L294
210,535
cakephp/cakephp
src/View/Form/EntityContext.php
EntityContext.entity
public function entity($path = null) { if ($path === null) { return $this->_context['entity']; } $oneElement = count($path) === 1; if ($oneElement && $this->_isCollection) { return false; } $entity = $this->_context['entity']; if ($one...
php
public function entity($path = null) { if ($path === null) { return $this->_context['entity']; } $oneElement = count($path) === 1; if ($oneElement && $this->_isCollection) { return false; } $entity = $this->_context['entity']; if ($one...
[ "public", "function", "entity", "(", "$", "path", "=", "null", ")", "{", "if", "(", "$", "path", "===", "null", ")", "{", "return", "$", "this", "->", "_context", "[", "'entity'", "]", ";", "}", "$", "oneElement", "=", "count", "(", "$", "path", ...
Fetch the leaf entity for the given path. This method will traverse the given path and find the leaf entity. If the path does not contain a leaf entity false will be returned. @param array|null $path Each one of the parts in a path for a field name or null to get the entity passed in constructor context. @return \Cak...
[ "Fetch", "the", "leaf", "entity", "for", "the", "given", "path", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Form/EntityContext.php#L327-L373
210,536
cakephp/cakephp
src/View/Form/EntityContext.php
EntityContext.isRequired
public function isRequired($field) { $parts = explode('.', $field); $entity = $this->entity($parts); $isNew = true; if ($entity instanceof EntityInterface) { $isNew = $entity->isNew(); } $validator = $this->_getValidator($parts); $fieldName = arr...
php
public function isRequired($field) { $parts = explode('.', $field); $entity = $this->entity($parts); $isNew = true; if ($entity instanceof EntityInterface) { $isNew = $entity->isNew(); } $validator = $this->_getValidator($parts); $fieldName = arr...
[ "public", "function", "isRequired", "(", "$", "field", ")", "{", "$", "parts", "=", "explode", "(", "'.'", ",", "$", "field", ")", ";", "$", "entity", "=", "$", "this", "->", "entity", "(", "$", "parts", ")", ";", "$", "isNew", "=", "true", ";", ...
Check if a field should be marked as required. @param string $field The dot separated path to the field you want to check. @return bool
[ "Check", "if", "a", "field", "should", "be", "marked", "as", "required", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Form/EntityContext.php#L407-L427
210,537
cakephp/cakephp
src/View/Form/EntityContext.php
EntityContext._getValidator
protected function _getValidator($parts) { $keyParts = array_filter(array_slice($parts, 0, -1), function ($part) { return !is_numeric($part); }); $key = implode('.', $keyParts); $entity = $this->entity($parts) ?: null; if (isset($this->_validator[$key])) { ...
php
protected function _getValidator($parts) { $keyParts = array_filter(array_slice($parts, 0, -1), function ($part) { return !is_numeric($part); }); $key = implode('.', $keyParts); $entity = $this->entity($parts) ?: null; if (isset($this->_validator[$key])) { ...
[ "protected", "function", "_getValidator", "(", "$", "parts", ")", "{", "$", "keyParts", "=", "array_filter", "(", "array_slice", "(", "$", "parts", ",", "0", ",", "-", "1", ")", ",", "function", "(", "$", "part", ")", "{", "return", "!", "is_numeric", ...
Get the validator associated to an entity based on naming conventions. @param array $parts Each one of the parts in a path for a field name @return \Cake\Validation\Validator
[ "Get", "the", "validator", "associated", "to", "an", "entity", "based", "on", "naming", "conventions", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Form/EntityContext.php#L501-L529
210,538
cakephp/cakephp
src/View/Form/EntityContext.php
EntityContext._getTable
protected function _getTable($parts, $fallback = true) { if (!is_array($parts) || count($parts) === 1) { return $this->_tables[$this->_rootName]; } $normalized = array_slice(array_filter($parts, function ($part) { return !is_numeric($part); }), 0, -1); ...
php
protected function _getTable($parts, $fallback = true) { if (!is_array($parts) || count($parts) === 1) { return $this->_tables[$this->_rootName]; } $normalized = array_slice(array_filter($parts, function ($part) { return !is_numeric($part); }), 0, -1); ...
[ "protected", "function", "_getTable", "(", "$", "parts", ",", "$", "fallback", "=", "true", ")", "{", "if", "(", "!", "is_array", "(", "$", "parts", ")", "||", "count", "(", "$", "parts", ")", "===", "1", ")", "{", "return", "$", "this", "->", "_...
Get the table instance from a property path @param array $parts Each one of the parts in a path for a field name @param bool $fallback Whether or not to fallback to the last found table when a non-existent field/property is being encountered. @return \Cake\ORM\Table|bool Table instance or false
[ "Get", "the", "table", "instance", "from", "a", "property", "path" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Form/EntityContext.php#L539-L582
210,539
cakephp/cakephp
src/Database/Retry/ReconnectStrategy.php
ReconnectStrategy.shouldRetry
public function shouldRetry(Exception $exception, $retryCount) { $message = $exception->getMessage(); foreach (static::$causes as $cause) { if (strstr($message, $cause) !== false) { return $this->reconnect(); } } return false; }
php
public function shouldRetry(Exception $exception, $retryCount) { $message = $exception->getMessage(); foreach (static::$causes as $cause) { if (strstr($message, $cause) !== false) { return $this->reconnect(); } } return false; }
[ "public", "function", "shouldRetry", "(", "Exception", "$", "exception", ",", "$", "retryCount", ")", "{", "$", "message", "=", "$", "exception", "->", "getMessage", "(", ")", ";", "foreach", "(", "static", "::", "$", "causes", "as", "$", "cause", ")", ...
Checks whether or not the exception was caused by a lost connection, and returns true if it was able to successfully reconnect. @param Exception $exception The exception to check for its message @param int $retryCount The number of times the action has been already called @return bool Whether or not it is OK to retry ...
[ "Checks", "whether", "or", "not", "the", "exception", "was", "caused", "by", "a", "lost", "connection", "and", "returns", "true", "if", "it", "was", "able", "to", "successfully", "reconnect", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Retry/ReconnectStrategy.php#L80-L91
210,540
cakephp/cakephp
src/Database/Retry/ReconnectStrategy.php
ReconnectStrategy.reconnect
protected function reconnect() { if ($this->connection->inTransaction()) { // It is not safe to blindly reconnect in the middle of a transaction return false; } try { // Make sure we free any resources associated with the old connection $this-...
php
protected function reconnect() { if ($this->connection->inTransaction()) { // It is not safe to blindly reconnect in the middle of a transaction return false; } try { // Make sure we free any resources associated with the old connection $this-...
[ "protected", "function", "reconnect", "(", ")", "{", "if", "(", "$", "this", "->", "connection", "->", "inTransaction", "(", ")", ")", "{", "// It is not safe to blindly reconnect in the middle of a transaction", "return", "false", ";", "}", "try", "{", "// Make sur...
Tries to re-establish the connection to the server, if it is safe to do so @return bool Whether or not the connection was re-established
[ "Tries", "to", "re", "-", "establish", "the", "connection", "to", "the", "server", "if", "it", "is", "safe", "to", "do", "so" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Retry/ReconnectStrategy.php#L98-L121
210,541
cakephp/cakephp
src/Shell/ServerShell.php
ServerShell.startup
public function startup() { if ($this->param('host')) { $this->_host = $this->param('host'); } if ($this->param('port')) { $this->_port = (int)$this->param('port'); } if ($this->param('document_root')) { $this->_documentRoot = $this->param(...
php
public function startup() { if ($this->param('host')) { $this->_host = $this->param('host'); } if ($this->param('port')) { $this->_port = (int)$this->param('port'); } if ($this->param('document_root')) { $this->_documentRoot = $this->param(...
[ "public", "function", "startup", "(", ")", "{", "if", "(", "$", "this", "->", "param", "(", "'host'", ")", ")", "{", "$", "this", "->", "_host", "=", "$", "this", "->", "param", "(", "'host'", ")", ";", "}", "if", "(", "$", "this", "->", "param...
Starts up the Shell and displays the welcome message. Allows for checking and configuring prior to command or main execution Override this method if you want to remove the welcome information, or otherwise modify the pre-command flow. @return void @link https://book.cakephp.org/3.0/en/console-and-shells.html#hook-met...
[ "Starts", "up", "the", "Shell", "and", "displays", "the", "welcome", "message", ".", "Allows", "for", "checking", "and", "configuring", "prior", "to", "command", "or", "main", "execution" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Shell/ServerShell.php#L79-L108
210,542
cakephp/cakephp
src/Error/Middleware/ErrorHandlerMiddleware.php
ErrorHandlerMiddleware.handleException
public function handleException($exception, $request, $response) { $renderer = $this->getRenderer($exception, $request); try { $res = $renderer->render(); $this->logException($request, $exception); return $res; } catch (Throwable $exception) { ...
php
public function handleException($exception, $request, $response) { $renderer = $this->getRenderer($exception, $request); try { $res = $renderer->render(); $this->logException($request, $exception); return $res; } catch (Throwable $exception) { ...
[ "public", "function", "handleException", "(", "$", "exception", ",", "$", "request", ",", "$", "response", ")", "{", "$", "renderer", "=", "$", "this", "->", "getRenderer", "(", "$", "exception", ",", "$", "request", ")", ";", "try", "{", "$", "res", ...
Handle an exception and generate an error response @param \Exception $exception The exception to handle. @param \Psr\Http\Message\ServerRequestInterface $request The request. @param \Psr\Http\Message\ResponseInterface $response The response. @return \Psr\Http\Message\ResponseInterface A response
[ "Handle", "an", "exception", "and", "generate", "an", "error", "response" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Error/Middleware/ErrorHandlerMiddleware.php#L112-L129
210,543
cakephp/cakephp
src/Error/Middleware/ErrorHandlerMiddleware.php
ErrorHandlerMiddleware.getRenderer
protected function getRenderer($exception, $request) { if (!$this->exceptionRenderer) { $this->exceptionRenderer = $this->getConfig('exceptionRenderer') ?: ExceptionRenderer::class; } // For PHP5 backwards compatibility if ($exception instanceof Error) { $exc...
php
protected function getRenderer($exception, $request) { if (!$this->exceptionRenderer) { $this->exceptionRenderer = $this->getConfig('exceptionRenderer') ?: ExceptionRenderer::class; } // For PHP5 backwards compatibility if ($exception instanceof Error) { $exc...
[ "protected", "function", "getRenderer", "(", "$", "exception", ",", "$", "request", ")", "{", "if", "(", "!", "$", "this", "->", "exceptionRenderer", ")", "{", "$", "this", "->", "exceptionRenderer", "=", "$", "this", "->", "getConfig", "(", "'exceptionRen...
Get a renderer instance @param \Exception $exception The exception being rendered. @param \Psr\Http\Message\ServerRequestInterface $request The request. @return \Cake\Error\ExceptionRendererInterface The exception renderer. @throws \Exception When the renderer class cannot be found.
[ "Get", "a", "renderer", "instance" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Error/Middleware/ErrorHandlerMiddleware.php#L153-L178
210,544
cakephp/cakephp
src/Core/InstanceConfigTrait.php
InstanceConfigTrait.getConfig
public function getConfig($key = null, $default = null) { if (!$this->_configInitialized) { $this->_config = $this->_defaultConfig; $this->_configInitialized = true; } $return = $this->_configRead($key); return $return === null ? $default : $return; }
php
public function getConfig($key = null, $default = null) { if (!$this->_configInitialized) { $this->_config = $this->_defaultConfig; $this->_configInitialized = true; } $return = $this->_configRead($key); return $return === null ? $default : $return; }
[ "public", "function", "getConfig", "(", "$", "key", "=", "null", ",", "$", "default", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "_configInitialized", ")", "{", "$", "this", "->", "_config", "=", "$", "this", "->", "_defaultConfig", ";...
Returns the config. ### Usage Reading the whole config: ``` $this->getConfig(); ``` Reading a specific value: ``` $this->getConfig('key'); ``` Reading a nested value: ``` $this->getConfig('some.nested.key'); ``` Reading with default value: ``` $this->getConfig('some-key', 'default-value'); ``` @param string|n...
[ "Returns", "the", "config", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/InstanceConfigTrait.php#L116-L126
210,545
cakephp/cakephp
src/Core/InstanceConfigTrait.php
InstanceConfigTrait._configRead
protected function _configRead($key) { if ($key === null) { return $this->_config; } if (strpos($key, '.') === false) { return isset($this->_config[$key]) ? $this->_config[$key] : null; } $return = $this->_config; foreach (explode('.', $key)...
php
protected function _configRead($key) { if ($key === null) { return $this->_config; } if (strpos($key, '.') === false) { return isset($this->_config[$key]) ? $this->_config[$key] : null; } $return = $this->_config; foreach (explode('.', $key)...
[ "protected", "function", "_configRead", "(", "$", "key", ")", "{", "if", "(", "$", "key", "===", "null", ")", "{", "return", "$", "this", "->", "_config", ";", "}", "if", "(", "strpos", "(", "$", "key", ",", "'.'", ")", "===", "false", ")", "{", ...
Reads a config key. @param string|null $key Key to read. @return mixed
[ "Reads", "a", "config", "key", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/InstanceConfigTrait.php#L234-L256
210,546
cakephp/cakephp
src/Core/InstanceConfigTrait.php
InstanceConfigTrait._configWrite
protected function _configWrite($key, $value, $merge = false) { if (is_string($key) && $value === null) { $this->_configDelete($key); return; } if ($merge) { $update = is_array($key) ? $key : [$key => $value]; if ($merge === 'shallow') { ...
php
protected function _configWrite($key, $value, $merge = false) { if (is_string($key) && $value === null) { $this->_configDelete($key); return; } if ($merge) { $update = is_array($key) ? $key : [$key => $value]; if ($merge === 'shallow') { ...
[ "protected", "function", "_configWrite", "(", "$", "key", ",", "$", "value", ",", "$", "merge", "=", "false", ")", "{", "if", "(", "is_string", "(", "$", "key", ")", "&&", "$", "value", "===", "null", ")", "{", "$", "this", "->", "_configDelete", "...
Writes a config key. @param string|array $key Key to write to. @param mixed $value Value to write. @param bool|string $merge True to merge recursively, 'shallow' for simple merge, false to overwrite, defaults to false. @return void @throws \Cake\Core\Exception\Exception if attempting to clobber existing config
[ "Writes", "a", "config", "key", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/InstanceConfigTrait.php#L268-L317
210,547
cakephp/cakephp
src/Core/InstanceConfigTrait.php
InstanceConfigTrait._configDelete
protected function _configDelete($key) { if (strpos($key, '.') === false) { unset($this->_config[$key]); return; } $update =& $this->_config; $stack = explode('.', $key); $length = count($stack); foreach ($stack as $i => $k) { if...
php
protected function _configDelete($key) { if (strpos($key, '.') === false) { unset($this->_config[$key]); return; } $update =& $this->_config; $stack = explode('.', $key); $length = count($stack); foreach ($stack as $i => $k) { if...
[ "protected", "function", "_configDelete", "(", "$", "key", ")", "{", "if", "(", "strpos", "(", "$", "key", ",", "'.'", ")", "===", "false", ")", "{", "unset", "(", "$", "this", "->", "_config", "[", "$", "key", "]", ")", ";", "return", ";", "}", ...
Deletes a single config key. @param string $key Key to delete. @return void @throws \Cake\Core\Exception\Exception if attempting to clobber existing config
[ "Deletes", "a", "single", "config", "key", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Core/InstanceConfigTrait.php#L326-L354
210,548
cakephp/cakephp
src/Error/ErrorHandler.php
ErrorHandler._displayException
protected function _displayException($exception) { $rendererClassName = App::className($this->_options['exceptionRenderer'], 'Error'); try { if (!$rendererClassName) { throw new Exception("$rendererClassName is an invalid class."); } /** @var \Cake...
php
protected function _displayException($exception) { $rendererClassName = App::className($this->_options['exceptionRenderer'], 'Error'); try { if (!$rendererClassName) { throw new Exception("$rendererClassName is an invalid class."); } /** @var \Cake...
[ "protected", "function", "_displayException", "(", "$", "exception", ")", "{", "$", "rendererClassName", "=", "App", "::", "className", "(", "$", "this", "->", "_options", "[", "'exceptionRenderer'", "]", ",", "'Error'", ")", ";", "try", "{", "if", "(", "!...
Displays an exception response body. @param \Exception $exception The exception to display. @return void @throws \Exception When the chosen exception renderer is invalid.
[ "Displays", "an", "exception", "response", "body", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Error/ErrorHandler.php#L128-L145
210,549
cakephp/cakephp
src/Error/ErrorHandler.php
ErrorHandler._logInternalError
protected function _logInternalError($exception) { // Disable trace for internal errors. $this->_options['trace'] = false; $message = sprintf( "[%s] %s\n%s", // Keeping same message format get_class($exception), $exception->getMessage(), $excep...
php
protected function _logInternalError($exception) { // Disable trace for internal errors. $this->_options['trace'] = false; $message = sprintf( "[%s] %s\n%s", // Keeping same message format get_class($exception), $exception->getMessage(), $excep...
[ "protected", "function", "_logInternalError", "(", "$", "exception", ")", "{", "// Disable trace for internal errors.", "$", "this", "->", "_options", "[", "'trace'", "]", "=", "false", ";", "$", "message", "=", "sprintf", "(", "\"[%s] %s\\n%s\"", ",", "// Keeping...
Logs both PHP5 and PHP7 errors. The PHP5 part will be removed with 4.0. @param \Throwable|\Exception $exception Exception. @return void
[ "Logs", "both", "PHP5", "and", "PHP7", "errors", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Error/ErrorHandler.php#L170-L181
210,550
cakephp/cakephp
src/Error/ErrorHandler.php
ErrorHandler._sendResponse
protected function _sendResponse($response) { if (is_string($response)) { echo $response; return; } $emitter = new ResponseEmitter(); $emitter->emit($response); }
php
protected function _sendResponse($response) { if (is_string($response)) { echo $response; return; } $emitter = new ResponseEmitter(); $emitter->emit($response); }
[ "protected", "function", "_sendResponse", "(", "$", "response", ")", "{", "if", "(", "is_string", "(", "$", "response", ")", ")", "{", "echo", "$", "response", ";", "return", ";", "}", "$", "emitter", "=", "new", "ResponseEmitter", "(", ")", ";", "$", ...
Method that can be easily stubbed in testing. @param string|\Cake\Http\Response $response Either the message or response object. @return void
[ "Method", "that", "can", "be", "easily", "stubbed", "in", "testing", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Error/ErrorHandler.php#L189-L199
210,551
cakephp/cakephp
src/Http/Client/Response.php
Response._decodeGzipBody
protected function _decodeGzipBody($body) { if (!function_exists('gzinflate')) { throw new RuntimeException('Cannot decompress gzip response body without gzinflate()'); } $offset = 0; // Look for gzip 'signature' if (substr($body, 0, 2) === "\x1f\x8b") { ...
php
protected function _decodeGzipBody($body) { if (!function_exists('gzinflate')) { throw new RuntimeException('Cannot decompress gzip response body without gzinflate()'); } $offset = 0; // Look for gzip 'signature' if (substr($body, 0, 2) === "\x1f\x8b") { ...
[ "protected", "function", "_decodeGzipBody", "(", "$", "body", ")", "{", "if", "(", "!", "function_exists", "(", "'gzinflate'", ")", ")", "{", "throw", "new", "RuntimeException", "(", "'Cannot decompress gzip response body without gzinflate()'", ")", ";", "}", "$", ...
Uncompress a gzip response. Looks for gzip signatures, and if gzinflate() exists, the body will be decompressed. @param string $body Gzip encoded body. @return string @throws \RuntimeException When attempting to decode gzip content without gzinflate.
[ "Uncompress", "a", "gzip", "response", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/Response.php#L178-L192
210,552
cakephp/cakephp
src/Http/Client/Response.php
Response._parseHeaders
protected function _parseHeaders($headers) { foreach ($headers as $key => $value) { if (substr($value, 0, 5) === 'HTTP/') { preg_match('/HTTP\/([\d.]+) ([0-9]+)(.*)/i', $value, $matches); $this->protocol = $matches[1]; $this->code = (int)$matches[2...
php
protected function _parseHeaders($headers) { foreach ($headers as $key => $value) { if (substr($value, 0, 5) === 'HTTP/') { preg_match('/HTTP\/([\d.]+) ([0-9]+)(.*)/i', $value, $matches); $this->protocol = $matches[1]; $this->code = (int)$matches[2...
[ "protected", "function", "_parseHeaders", "(", "$", "headers", ")", "{", "foreach", "(", "$", "headers", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "substr", "(", "$", "value", ",", "0", ",", "5", ")", "===", "'HTTP/'", ")", "{", ...
Parses headers if necessary. - Decodes the status code and reasonphrase. - Parses and normalizes header names + values. @param array $headers Headers to parse. @return void
[ "Parses", "headers", "if", "necessary", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/Response.php#L203-L229
210,553
cakephp/cakephp
src/Http/Client/Response.php
Response.isOk
public function isOk() { $codes = [ static::STATUS_OK, static::STATUS_CREATED, static::STATUS_ACCEPTED, static::STATUS_NON_AUTHORITATIVE_INFORMATION, static::STATUS_NO_CONTENT ]; return in_array($this->code, $codes); }
php
public function isOk() { $codes = [ static::STATUS_OK, static::STATUS_CREATED, static::STATUS_ACCEPTED, static::STATUS_NON_AUTHORITATIVE_INFORMATION, static::STATUS_NO_CONTENT ]; return in_array($this->code, $codes); }
[ "public", "function", "isOk", "(", ")", "{", "$", "codes", "=", "[", "static", "::", "STATUS_OK", ",", "static", "::", "STATUS_CREATED", ",", "static", "::", "STATUS_ACCEPTED", ",", "static", "::", "STATUS_NON_AUTHORITATIVE_INFORMATION", ",", "static", "::", "...
Check if the response was OK @return bool
[ "Check", "if", "the", "response", "was", "OK" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/Response.php#L236-L247
210,554
cakephp/cakephp
src/Http/Client/Response.php
Response.isRedirect
public function isRedirect() { $codes = [ static::STATUS_MOVED_PERMANENTLY, static::STATUS_FOUND, static::STATUS_SEE_OTHER, static::STATUS_TEMPORARY_REDIRECT, ]; return ( in_array($this->code, $codes) && $this->getHeade...
php
public function isRedirect() { $codes = [ static::STATUS_MOVED_PERMANENTLY, static::STATUS_FOUND, static::STATUS_SEE_OTHER, static::STATUS_TEMPORARY_REDIRECT, ]; return ( in_array($this->code, $codes) && $this->getHeade...
[ "public", "function", "isRedirect", "(", ")", "{", "$", "codes", "=", "[", "static", "::", "STATUS_MOVED_PERMANENTLY", ",", "static", "::", "STATUS_FOUND", ",", "static", "::", "STATUS_SEE_OTHER", ",", "static", "::", "STATUS_TEMPORARY_REDIRECT", ",", "]", ";", ...
Check if the response had a redirect status code. @return bool
[ "Check", "if", "the", "response", "had", "a", "redirect", "status", "code", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/Response.php#L254-L267
210,555
cakephp/cakephp
src/Http/Client/Response.php
Response.getEncoding
public function getEncoding() { $content = $this->getHeaderLine('content-type'); if (!$content) { return null; } preg_match('/charset\s?=\s?[\'"]?([a-z0-9-_]+)[\'"]?/i', $content, $matches); if (empty($matches[1])) { return null; } ret...
php
public function getEncoding() { $content = $this->getHeaderLine('content-type'); if (!$content) { return null; } preg_match('/charset\s?=\s?[\'"]?([a-z0-9-_]+)[\'"]?/i', $content, $matches); if (empty($matches[1])) { return null; } ret...
[ "public", "function", "getEncoding", "(", ")", "{", "$", "content", "=", "$", "this", "->", "getHeaderLine", "(", "'content-type'", ")", ";", "if", "(", "!", "$", "content", ")", "{", "return", "null", ";", "}", "preg_match", "(", "'/charset\\s?=\\s?[\\'\"...
Get the encoding if it was set. @return string|null
[ "Get", "the", "encoding", "if", "it", "was", "set", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/Response.php#L342-L354
210,556
cakephp/cakephp
src/Http/Client/Response.php
Response.getCookie
public function getCookie($name) { $this->buildCookieCollection(); if (!$this->cookies->has($name)) { return null; } return $this->cookies->get($name)->getValue(); }
php
public function getCookie($name) { $this->buildCookieCollection(); if (!$this->cookies->has($name)) { return null; } return $this->cookies->get($name)->getValue(); }
[ "public", "function", "getCookie", "(", "$", "name", ")", "{", "$", "this", "->", "buildCookieCollection", "(", ")", ";", "if", "(", "!", "$", "this", "->", "cookies", "->", "has", "(", "$", "name", ")", ")", "{", "return", "null", ";", "}", "retur...
Get the value of a single cookie. @param string $name The name of the cookie value. @return string|array|null Either the cookie's value or null when the cookie is undefined.
[ "Get", "the", "value", "of", "a", "single", "cookie", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/Response.php#L447-L455
210,557
cakephp/cakephp
src/Http/Client/Response.php
Response.getCookieData
public function getCookieData($name) { $this->buildCookieCollection(); if (!$this->cookies->has($name)) { return null; } $cookie = $this->cookies->get($name); return $this->convertCookieToArray($cookie); }
php
public function getCookieData($name) { $this->buildCookieCollection(); if (!$this->cookies->has($name)) { return null; } $cookie = $this->cookies->get($name); return $this->convertCookieToArray($cookie); }
[ "public", "function", "getCookieData", "(", "$", "name", ")", "{", "$", "this", "->", "buildCookieCollection", "(", ")", ";", "if", "(", "!", "$", "this", "->", "cookies", "->", "has", "(", "$", "name", ")", ")", "{", "return", "null", ";", "}", "$...
Get the full data for a single cookie. @param string $name The name of the cookie value. @return array|null Either the cookie's data or null when the cookie is undefined.
[ "Get", "the", "full", "data", "for", "a", "single", "cookie", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/Response.php#L463-L474
210,558
cakephp/cakephp
src/Http/Client/Response.php
Response.convertCookieToArray
protected function convertCookieToArray(CookieInterface $cookie) { return [ 'name' => $cookie->getName(), 'value' => $cookie->getValue(), 'path' => $cookie->getPath(), 'domain' => $cookie->getDomain(), 'secure' => $cookie->isSecure(), '...
php
protected function convertCookieToArray(CookieInterface $cookie) { return [ 'name' => $cookie->getName(), 'value' => $cookie->getValue(), 'path' => $cookie->getPath(), 'domain' => $cookie->getDomain(), 'secure' => $cookie->isSecure(), '...
[ "protected", "function", "convertCookieToArray", "(", "CookieInterface", "$", "cookie", ")", "{", "return", "[", "'name'", "=>", "$", "cookie", "->", "getName", "(", ")", ",", "'value'", "=>", "$", "cookie", "->", "getValue", "(", ")", ",", "'path'", "=>",...
Convert the cookie into an array of its properties. This method is compatible with older client code that expects date strings instead of timestamps. @param \Cake\Http\Cookie\CookieInterface $cookie Cookie object. @return array
[ "Convert", "the", "cookie", "into", "an", "array", "of", "its", "properties", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/Response.php#L485-L496
210,559
cakephp/cakephp
src/Http/Client/Response.php
Response.body
public function body($parser = null) { deprecationWarning( 'Response::body() is deprecated. Use getStringBody()/getJson()/getXml() instead.' ); $stream = $this->stream; $stream->rewind(); if ($parser) { return $parser($stream->getContents()); ...
php
public function body($parser = null) { deprecationWarning( 'Response::body() is deprecated. Use getStringBody()/getJson()/getXml() instead.' ); $stream = $this->stream; $stream->rewind(); if ($parser) { return $parser($stream->getContents()); ...
[ "public", "function", "body", "(", "$", "parser", "=", "null", ")", "{", "deprecationWarning", "(", "'Response::body() is deprecated. Use getStringBody()/getJson()/getXml() instead.'", ")", ";", "$", "stream", "=", "$", "this", "->", "stream", ";", "$", "stream", "-...
Get the response body. By passing in a $parser callable, you can get the decoded response content back. For example to get the json data as an object: ``` $body = $response->body('json_decode'); ``` @param callable|null $parser The callback to use to decode the response body. @return mixed The response body. @depre...
[ "Get", "the", "response", "body", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/Response.php#L561-L574
210,560
cakephp/cakephp
src/Http/Client/Response.php
Response._getJson
protected function _getJson() { if ($this->_json) { return $this->_json; } return $this->_json = json_decode($this->_getBody(), true); }
php
protected function _getJson() { if ($this->_json) { return $this->_json; } return $this->_json = json_decode($this->_getBody(), true); }
[ "protected", "function", "_getJson", "(", ")", "{", "if", "(", "$", "this", "->", "_json", ")", "{", "return", "$", "this", "->", "_json", ";", "}", "return", "$", "this", "->", "_json", "=", "json_decode", "(", "$", "this", "->", "_getBody", "(", ...
Get the response body as JSON decoded data. @return array|null
[ "Get", "the", "response", "body", "as", "JSON", "decoded", "data", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/Response.php#L601-L608
210,561
cakephp/cakephp
src/Http/Client/Response.php
Response._getXml
protected function _getXml() { if ($this->_xml) { return $this->_xml; } libxml_use_internal_errors(); $data = simplexml_load_string($this->_getBody()); if ($data) { $this->_xml = $data; return $this->_xml; } return null; ...
php
protected function _getXml() { if ($this->_xml) { return $this->_xml; } libxml_use_internal_errors(); $data = simplexml_load_string($this->_getBody()); if ($data) { $this->_xml = $data; return $this->_xml; } return null; ...
[ "protected", "function", "_getXml", "(", ")", "{", "if", "(", "$", "this", "->", "_xml", ")", "{", "return", "$", "this", "->", "_xml", ";", "}", "libxml_use_internal_errors", "(", ")", ";", "$", "data", "=", "simplexml_load_string", "(", "$", "this", ...
Get the response body as XML decoded data. @return null|\SimpleXMLElement
[ "Get", "the", "response", "body", "as", "XML", "decoded", "data", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Http/Client/Response.php#L625-L639
210,562
cakephp/cakephp
src/Database/Statement/CallbackStatement.php
CallbackStatement.fetch
public function fetch($type = parent::FETCH_TYPE_NUM) { $callback = $this->_callback; $row = $this->_statement->fetch($type); return $row === false ? $row : $callback($row); }
php
public function fetch($type = parent::FETCH_TYPE_NUM) { $callback = $this->_callback; $row = $this->_statement->fetch($type); return $row === false ? $row : $callback($row); }
[ "public", "function", "fetch", "(", "$", "type", "=", "parent", "::", "FETCH_TYPE_NUM", ")", "{", "$", "callback", "=", "$", "this", "->", "_callback", ";", "$", "row", "=", "$", "this", "->", "_statement", "->", "fetch", "(", "$", "type", ")", ";", ...
Fetch a row from the statement. The result will be processed by the callback when it is not `false`. @param string $type Either 'num' or 'assoc' to indicate the result format you would like. @return array|false
[ "Fetch", "a", "row", "from", "the", "statement", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Statement/CallbackStatement.php#L54-L60
210,563
cakephp/cakephp
src/Database/Statement/CallbackStatement.php
CallbackStatement.fetchAll
public function fetchAll($type = parent::FETCH_TYPE_NUM) { return array_map($this->_callback, $this->_statement->fetchAll($type)); }
php
public function fetchAll($type = parent::FETCH_TYPE_NUM) { return array_map($this->_callback, $this->_statement->fetchAll($type)); }
[ "public", "function", "fetchAll", "(", "$", "type", "=", "parent", "::", "FETCH_TYPE_NUM", ")", "{", "return", "array_map", "(", "$", "this", "->", "_callback", ",", "$", "this", "->", "_statement", "->", "fetchAll", "(", "$", "type", ")", ")", ";", "}...
Fetch all rows from the statement. Each row in the result will be processed by the callback when it is not `false. @param string $type Either 'num' or 'assoc' to indicate the result format you would like. @return array
[ "Fetch", "all", "rows", "from", "the", "statement", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Statement/CallbackStatement.php#L70-L73
210,564
cakephp/cakephp
src/Database/Driver/PDODriverTrait.php
PDODriverTrait.connection
public function connection($connection = null) { if ($connection !== null) { $this->_connection = $connection; } return $this->_connection; }
php
public function connection($connection = null) { if ($connection !== null) { $this->_connection = $connection; } return $this->_connection; }
[ "public", "function", "connection", "(", "$", "connection", "=", "null", ")", "{", "if", "(", "$", "connection", "!==", "null", ")", "{", "$", "this", "->", "_connection", "=", "$", "connection", ";", "}", "return", "$", "this", "->", "_connection", ";...
Returns correct connection resource or object that is internally used If first argument is passed, it will set internal connection object or result to the value passed @param null|\PDO $connection The PDO connection instance. @return \PDO connection object used internally
[ "Returns", "correct", "connection", "resource", "or", "object", "that", "is", "internally", "used", "If", "first", "argument", "is", "passed", "it", "will", "set", "internal", "connection", "object", "or", "result", "to", "the", "value", "passed" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Driver/PDODriverTrait.php#L65-L72
210,565
cakephp/cakephp
src/Database/Driver/PDODriverTrait.php
PDODriverTrait.isConnected
public function isConnected() { if ($this->_connection === null) { $connected = false; } else { try { $connected = $this->_connection->query('SELECT 1'); } catch (PDOException $e) { $connected = false; } } ...
php
public function isConnected() { if ($this->_connection === null) { $connected = false; } else { try { $connected = $this->_connection->query('SELECT 1'); } catch (PDOException $e) { $connected = false; } } ...
[ "public", "function", "isConnected", "(", ")", "{", "if", "(", "$", "this", "->", "_connection", "===", "null", ")", "{", "$", "connected", "=", "false", ";", "}", "else", "{", "try", "{", "$", "connected", "=", "$", "this", "->", "_connection", "->"...
Checks whether or not the driver is connected. @return bool
[ "Checks", "whether", "or", "not", "the", "driver", "is", "connected", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Driver/PDODriverTrait.php#L89-L102
210,566
cakephp/cakephp
src/Database/Driver/PDODriverTrait.php
PDODriverTrait.beginTransaction
public function beginTransaction() { $this->connect(); if ($this->_connection->inTransaction()) { return true; } return $this->_connection->beginTransaction(); }
php
public function beginTransaction() { $this->connect(); if ($this->_connection->inTransaction()) { return true; } return $this->_connection->beginTransaction(); }
[ "public", "function", "beginTransaction", "(", ")", "{", "$", "this", "->", "connect", "(", ")", ";", "if", "(", "$", "this", "->", "_connection", "->", "inTransaction", "(", ")", ")", "{", "return", "true", ";", "}", "return", "$", "this", "->", "_c...
Starts a transaction @return bool true on success, false otherwise
[ "Starts", "a", "transaction" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Driver/PDODriverTrait.php#L124-L132
210,567
cakephp/cakephp
src/Database/Driver/PDODriverTrait.php
PDODriverTrait.quote
public function quote($value, $type) { $this->connect(); return $this->_connection->quote($value, $type); }
php
public function quote($value, $type) { $this->connect(); return $this->_connection->quote($value, $type); }
[ "public", "function", "quote", "(", "$", "value", ",", "$", "type", ")", "{", "$", "this", "->", "connect", "(", ")", ";", "return", "$", "this", "->", "_connection", "->", "quote", "(", "$", "value", ",", "$", "type", ")", ";", "}" ]
Returns a value in a safe representation to be used in a query string @param mixed $value The value to quote. @param string $type Type to be used for determining kind of quoting to perform @return string
[ "Returns", "a", "value", "in", "a", "safe", "representation", "to", "be", "used", "in", "a", "query", "string" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Driver/PDODriverTrait.php#L171-L176
210,568
cakephp/cakephp
src/Database/Driver/PDODriverTrait.php
PDODriverTrait.lastInsertId
public function lastInsertId($table = null, $column = null) { $this->connect(); return $this->_connection->lastInsertId($table); }
php
public function lastInsertId($table = null, $column = null) { $this->connect(); return $this->_connection->lastInsertId($table); }
[ "public", "function", "lastInsertId", "(", "$", "table", "=", "null", ",", "$", "column", "=", "null", ")", "{", "$", "this", "->", "connect", "(", ")", ";", "return", "$", "this", "->", "_connection", "->", "lastInsertId", "(", "$", "table", ")", ";...
Returns last id generated for a table or sequence in database @param string|null $table table name or sequence to get last insert value from @param string|null $column the name of the column representing the primary key @return string|int
[ "Returns", "last", "id", "generated", "for", "a", "table", "or", "sequence", "in", "database" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Driver/PDODriverTrait.php#L185-L190
210,569
cakephp/cakephp
src/Log/Log.php
Log._loadConfig
protected static function _loadConfig() { foreach (static::$_config as $name => $properties) { if (isset($properties['engine'])) { $properties['className'] = $properties['engine']; } if (!static::$_registry->has($name)) { static::$_registry...
php
protected static function _loadConfig() { foreach (static::$_config as $name => $properties) { if (isset($properties['engine'])) { $properties['className'] = $properties['engine']; } if (!static::$_registry->has($name)) { static::$_registry...
[ "protected", "static", "function", "_loadConfig", "(", ")", "{", "foreach", "(", "static", "::", "$", "_config", "as", "$", "name", "=>", "$", "properties", ")", "{", "if", "(", "isset", "(", "$", "properties", "[", "'engine'", "]", ")", ")", "{", "$...
Load the defined configuration and create all the defined logging adapters. @return void
[ "Load", "the", "defined", "configuration", "and", "create", "all", "the", "defined", "logging", "adapters", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Log/Log.php#L191-L201
210,570
cakephp/cakephp
src/Database/Log/QueryLogger.php
QueryLogger.log
public function log(LoggedQuery $query) { if (!empty($query->params)) { $query->query = $this->_interpolate($query); } $this->_log($query); }
php
public function log(LoggedQuery $query) { if (!empty($query->params)) { $query->query = $this->_interpolate($query); } $this->_log($query); }
[ "public", "function", "log", "(", "LoggedQuery", "$", "query", ")", "{", "if", "(", "!", "empty", "(", "$", "query", "->", "params", ")", ")", "{", "$", "query", "->", "query", "=", "$", "this", "->", "_interpolate", "(", "$", "query", ")", ";", ...
Writes a LoggedQuery into a log @param \Cake\Database\Log\LoggedQuery $query to be written in log @return void
[ "Writes", "a", "LoggedQuery", "into", "a", "log" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Log/QueryLogger.php#L34-L40
210,571
cakephp/cakephp
src/Database/Log/QueryLogger.php
QueryLogger._interpolate
protected function _interpolate($query) { $params = array_map(function ($p) { if ($p === null) { return 'NULL'; } if (is_bool($p)) { return $p ? '1' : '0'; } if (is_string($p)) { $replacements = [ ...
php
protected function _interpolate($query) { $params = array_map(function ($p) { if ($p === null) { return 'NULL'; } if (is_bool($p)) { return $p ? '1' : '0'; } if (is_string($p)) { $replacements = [ ...
[ "protected", "function", "_interpolate", "(", "$", "query", ")", "{", "$", "params", "=", "array_map", "(", "function", "(", "$", "p", ")", "{", "if", "(", "$", "p", "===", "null", ")", "{", "return", "'NULL'", ";", "}", "if", "(", "is_bool", "(", ...
Helper function used to replace query placeholders by the real params used to execute the query @param \Cake\Database\Log\LoggedQuery $query The query to log @return string
[ "Helper", "function", "used", "to", "replace", "query", "placeholders", "by", "the", "real", "params", "used", "to", "execute", "the", "query" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Log/QueryLogger.php#L61-L93
210,572
cakephp/cakephp
src/View/StringTemplateTrait.php
StringTemplateTrait.templater
public function templater() { if ($this->_templater === null) { $class = $this->getConfig('templateClass') ?: 'Cake\View\StringTemplate'; $this->_templater = new $class(); $templates = $this->getConfig('templates'); if ($templates) { if (is_st...
php
public function templater() { if ($this->_templater === null) { $class = $this->getConfig('templateClass') ?: 'Cake\View\StringTemplate'; $this->_templater = new $class(); $templates = $this->getConfig('templates'); if ($templates) { if (is_st...
[ "public", "function", "templater", "(", ")", "{", "if", "(", "$", "this", "->", "_templater", "===", "null", ")", "{", "$", "class", "=", "$", "this", "->", "getConfig", "(", "'templateClass'", ")", "?", ":", "'Cake\\View\\StringTemplate'", ";", "$", "th...
Returns the templater instance. @return \Cake\View\StringTemplate
[ "Returns", "the", "templater", "instance", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/StringTemplateTrait.php#L100-L118
210,573
cakephp/cakephp
src/Cache/Engine/WincacheEngine.php
WincacheEngine.clear
public function clear($check) { if ($check) { return true; } $info = wincache_ucache_info(); $cacheKeys = $info['ucache_entries']; unset($info); foreach ($cacheKeys as $key) { if (strpos($key['key_name'], $this->_config['prefix']) === 0) { ...
php
public function clear($check) { if ($check) { return true; } $info = wincache_ucache_info(); $cacheKeys = $info['ucache_entries']; unset($info); foreach ($cacheKeys as $key) { if (strpos($key['key_name'], $this->_config['prefix']) === 0) { ...
[ "public", "function", "clear", "(", "$", "check", ")", "{", "if", "(", "$", "check", ")", "{", "return", "true", ";", "}", "$", "info", "=", "wincache_ucache_info", "(", ")", ";", "$", "cacheKeys", "=", "$", "info", "[", "'ucache_entries'", "]", ";",...
Delete all keys from the cache. This will clear every item in the cache matching the cache config prefix. @param bool $check If true, nothing will be cleared, as entries will naturally expire in wincache.. @return bool True Returns true.
[ "Delete", "all", "keys", "from", "the", "cache", ".", "This", "will", "clear", "every", "item", "in", "the", "cache", "matching", "the", "cache", "config", "prefix", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Cache/Engine/WincacheEngine.php#L132-L147
210,574
cakephp/cakephp
src/Database/Expression/ValuesExpression.php
ValuesExpression.add
public function add($data) { if ((count($this->_values) && $data instanceof Query) || ($this->_query && is_array($data)) ) { throw new Exception( 'You cannot mix subqueries and array data in inserts.' ); } if ($data instanceof Query...
php
public function add($data) { if ((count($this->_values) && $data instanceof Query) || ($this->_query && is_array($data)) ) { throw new Exception( 'You cannot mix subqueries and array data in inserts.' ); } if ($data instanceof Query...
[ "public", "function", "add", "(", "$", "data", ")", "{", "if", "(", "(", "count", "(", "$", "this", "->", "_values", ")", "&&", "$", "data", "instanceof", "Query", ")", "||", "(", "$", "this", "->", "_query", "&&", "is_array", "(", "$", "data", "...
Add a row of data to be inserted. @param array|\Cake\Database\Query $data Array of data to append into the insert, or a query for doing INSERT INTO .. SELECT style commands @return void @throws \Cake\Database\Exception When mixing array + Query data types.
[ "Add", "a", "row", "of", "data", "to", "be", "inserted", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/ValuesExpression.php#L85-L101
210,575
cakephp/cakephp
src/Database/Expression/ValuesExpression.php
ValuesExpression.columns
public function columns($cols = null) { deprecationWarning( 'ValuesExpression::columns() is deprecated. ' . 'Use ValuesExpression::setColumns()/getColumns() instead.' ); if ($cols !== null) { return $this->setColumns($cols); } return $this...
php
public function columns($cols = null) { deprecationWarning( 'ValuesExpression::columns() is deprecated. ' . 'Use ValuesExpression::setColumns()/getColumns() instead.' ); if ($cols !== null) { return $this->setColumns($cols); } return $this...
[ "public", "function", "columns", "(", "$", "cols", "=", "null", ")", "{", "deprecationWarning", "(", "'ValuesExpression::columns() is deprecated. '", ".", "'Use ValuesExpression::setColumns()/getColumns() instead.'", ")", ";", "if", "(", "$", "cols", "!==", "null", ")",...
Sets the columns to be inserted. If no params are passed, then it returns the currently stored columns. @deprecated 3.4.0 Use setColumns()/getColumns() instead. @param array|null $cols Array with columns to be inserted. @return array|$this
[ "Sets", "the", "columns", "to", "be", "inserted", ".", "If", "no", "params", "are", "passed", "then", "it", "returns", "the", "currently", "stored", "columns", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/ValuesExpression.php#L135-L146
210,576
cakephp/cakephp
src/Database/Expression/ValuesExpression.php
ValuesExpression._columnNames
protected function _columnNames() { $columns = []; foreach ($this->_columns as $col) { if (is_string($col)) { $col = trim($col, '`[]"'); } $columns[] = $col; } return $columns; }
php
protected function _columnNames() { $columns = []; foreach ($this->_columns as $col) { if (is_string($col)) { $col = trim($col, '`[]"'); } $columns[] = $col; } return $columns; }
[ "protected", "function", "_columnNames", "(", ")", "{", "$", "columns", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "_columns", "as", "$", "col", ")", "{", "if", "(", "is_string", "(", "$", "col", ")", ")", "{", "$", "col", "=", "trim"...
Get the bare column names. Because column names could be identifier quoted, we need to strip the identifiers off of the columns. @return array
[ "Get", "the", "bare", "column", "names", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/ValuesExpression.php#L156-L167
210,577
cakephp/cakephp
src/Database/Expression/ValuesExpression.php
ValuesExpression.values
public function values($values = null) { deprecationWarning( 'ValuesExpression::values() is deprecated. ' . 'Use ValuesExpression::setValues()/getValues() instead.' ); if ($values !== null) { return $this->setValues($values); } return $thi...
php
public function values($values = null) { deprecationWarning( 'ValuesExpression::values() is deprecated. ' . 'Use ValuesExpression::setValues()/getValues() instead.' ); if ($values !== null) { return $this->setValues($values); } return $thi...
[ "public", "function", "values", "(", "$", "values", "=", "null", ")", "{", "deprecationWarning", "(", "'ValuesExpression::values() is deprecated. '", ".", "'Use ValuesExpression::setValues()/getValues() instead.'", ")", ";", "if", "(", "$", "values", "!==", "null", ")",...
Sets the values to be inserted. If no params are passed, then it returns the currently stored values @deprecated 3.4.0 Use setValues()/getValues() instead. @param array|null $values Array with values to be inserted. @return array|$this
[ "Sets", "the", "values", "to", "be", "inserted", ".", "If", "no", "params", "are", "passed", "then", "it", "returns", "the", "currently", "stored", "values" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/ValuesExpression.php#L205-L216
210,578
cakephp/cakephp
src/Database/Expression/ValuesExpression.php
ValuesExpression.query
public function query(Query $query = null) { deprecationWarning( 'ValuesExpression::query() is deprecated. ' . 'Use ValuesExpression::setQuery()/getQuery() instead.' ); if ($query !== null) { return $this->setQuery($query); } return $this-...
php
public function query(Query $query = null) { deprecationWarning( 'ValuesExpression::query() is deprecated. ' . 'Use ValuesExpression::setQuery()/getQuery() instead.' ); if ($query !== null) { return $this->setQuery($query); } return $this-...
[ "public", "function", "query", "(", "Query", "$", "query", "=", "null", ")", "{", "deprecationWarning", "(", "'ValuesExpression::query() is deprecated. '", ".", "'Use ValuesExpression::setQuery()/getQuery() instead.'", ")", ";", "if", "(", "$", "query", "!==", "null", ...
Sets the query object to be used as the values expression to be evaluated to insert records in the table. If no params are passed, then it returns the currently stored query @deprecated 3.4.0 Use setQuery()/getQuery() instead. @param \Cake\Database\Query|null $query The query to set @return \Cake\Database\Query|null|$...
[ "Sets", "the", "query", "object", "to", "be", "used", "as", "the", "values", "expression", "to", "be", "evaluated", "to", "insert", "records", "in", "the", "table", ".", "If", "no", "params", "are", "passed", "then", "it", "returns", "the", "currently", ...
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/ValuesExpression.php#L252-L263
210,579
cakephp/cakephp
src/Database/Expression/ValuesExpression.php
ValuesExpression.sql
public function sql(ValueBinder $generator) { if (empty($this->_values) && empty($this->_query)) { return ''; } if (!$this->_castedExpressions) { $this->_processExpressions(); } $columns = $this->_columnNames(); $defaults = array_fill_keys($c...
php
public function sql(ValueBinder $generator) { if (empty($this->_values) && empty($this->_query)) { return ''; } if (!$this->_castedExpressions) { $this->_processExpressions(); } $columns = $this->_columnNames(); $defaults = array_fill_keys($c...
[ "public", "function", "sql", "(", "ValueBinder", "$", "generator", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "_values", ")", "&&", "empty", "(", "$", "this", "->", "_query", ")", ")", "{", "return", "''", ";", "}", "if", "(", "!", "$"...
Convert the values into a SQL string with placeholders. @param \Cake\Database\ValueBinder $generator Placeholder generator object @return string
[ "Convert", "the", "values", "into", "a", "SQL", "string", "with", "placeholders", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/ValuesExpression.php#L271-L316
210,580
cakephp/cakephp
src/Database/Expression/ValuesExpression.php
ValuesExpression.traverse
public function traverse(callable $visitor) { if ($this->_query) { return; } if (!$this->_castedExpressions) { $this->_processExpressions(); } foreach ($this->_values as $v) { if ($v instanceof ExpressionInterface) { $v->t...
php
public function traverse(callable $visitor) { if ($this->_query) { return; } if (!$this->_castedExpressions) { $this->_processExpressions(); } foreach ($this->_values as $v) { if ($v instanceof ExpressionInterface) { $v->t...
[ "public", "function", "traverse", "(", "callable", "$", "visitor", ")", "{", "if", "(", "$", "this", "->", "_query", ")", "{", "return", ";", "}", "if", "(", "!", "$", "this", "->", "_castedExpressions", ")", "{", "$", "this", "->", "_processExpression...
Traverse the values expression. This method will also traverse any queries that are to be used in the INSERT values. @param callable $visitor The visitor to traverse the expression with. @return void
[ "Traverse", "the", "values", "expression", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/ValuesExpression.php#L327-L351
210,581
cakephp/cakephp
src/Database/Expression/ValuesExpression.php
ValuesExpression._processExpressions
protected function _processExpressions() { $types = []; $typeMap = $this->getTypeMap(); $columns = $this->_columnNames(); foreach ($columns as $c) { if (!is_scalar($c)) { continue; } $types[$c] = $typeMap->type($c); } ...
php
protected function _processExpressions() { $types = []; $typeMap = $this->getTypeMap(); $columns = $this->_columnNames(); foreach ($columns as $c) { if (!is_scalar($c)) { continue; } $types[$c] = $typeMap->type($c); } ...
[ "protected", "function", "_processExpressions", "(", ")", "{", "$", "types", "=", "[", "]", ";", "$", "typeMap", "=", "$", "this", "->", "getTypeMap", "(", ")", ";", "$", "columns", "=", "$", "this", "->", "_columnNames", "(", ")", ";", "foreach", "(...
Converts values that need to be casted to expressions @return void
[ "Converts", "values", "that", "need", "to", "be", "casted", "to", "expressions" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Database/Expression/ValuesExpression.php#L358-L384
210,582
cakephp/cakephp
src/I18n/RelativeTimeFormatter.php
RelativeTimeFormatter._options
protected function _options($options, $class) { $options += [ 'from' => $class::now(), 'timezone' => null, 'format' => $class::$wordFormat, 'accuracy' => $class::$wordAccuracy, 'end' => $class::$wordEnd, 'relativeString' => __d('cake', ...
php
protected function _options($options, $class) { $options += [ 'from' => $class::now(), 'timezone' => null, 'format' => $class::$wordFormat, 'accuracy' => $class::$wordAccuracy, 'end' => $class::$wordEnd, 'relativeString' => __d('cake', ...
[ "protected", "function", "_options", "(", "$", "options", ",", "$", "class", ")", "{", "$", "options", "+=", "[", "'from'", "=>", "$", "class", "::", "now", "(", ")", ",", "'timezone'", "=>", "null", ",", "'format'", "=>", "$", "class", "::", "$", ...
Build the options for relative date formatting. @param array $options The options provided by the user. @param string $class The class name to use for defaults. @return array Options with defaults applied.
[ "Build", "the", "options", "for", "relative", "date", "formatting", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/I18n/RelativeTimeFormatter.php#L362-L384
210,583
cakephp/cakephp
src/View/Helper/IdGeneratorTrait.php
IdGeneratorTrait._id
protected function _id($name, $val) { $name = $this->_domId($name); $idSuffix = mb_strtolower(str_replace(['/', '@', '<', '>', ' ', '"', '\''], '-', $val)); $count = 1; $check = $idSuffix; while (in_array($check, $this->_idSuffixes)) { $check = $idSuffix . $count...
php
protected function _id($name, $val) { $name = $this->_domId($name); $idSuffix = mb_strtolower(str_replace(['/', '@', '<', '>', ' ', '"', '\''], '-', $val)); $count = 1; $check = $idSuffix; while (in_array($check, $this->_idSuffixes)) { $check = $idSuffix . $count...
[ "protected", "function", "_id", "(", "$", "name", ",", "$", "val", ")", "{", "$", "name", "=", "$", "this", "->", "_domId", "(", "$", "name", ")", ";", "$", "idSuffix", "=", "mb_strtolower", "(", "str_replace", "(", "[", "'/'", ",", "'@'", ",", "...
Generate an ID attribute for an element. Ensures that id's for a given set of fields are unique. @param string $name The ID attribute name. @param string $val The ID attribute value. @return string Generated id.
[ "Generate", "an", "ID", "attribute", "for", "an", "element", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/IdGeneratorTrait.php#L59-L72
210,584
cakephp/cakephp
src/View/Helper/IdGeneratorTrait.php
IdGeneratorTrait._domId
protected function _domId($value) { $domId = mb_strtolower(Text::slug($value, '-')); if ($this->_idPrefix) { $domId = $this->_idPrefix . '-' . $domId; } return $domId; }
php
protected function _domId($value) { $domId = mb_strtolower(Text::slug($value, '-')); if ($this->_idPrefix) { $domId = $this->_idPrefix . '-' . $domId; } return $domId; }
[ "protected", "function", "_domId", "(", "$", "value", ")", "{", "$", "domId", "=", "mb_strtolower", "(", "Text", "::", "slug", "(", "$", "value", ",", "'-'", ")", ")", ";", "if", "(", "$", "this", "->", "_idPrefix", ")", "{", "$", "domId", "=", "...
Generate an ID suitable for use in an ID attribute. @param string $value The value to convert into an ID. @return string The generated id.
[ "Generate", "an", "ID", "suitable", "for", "use", "in", "an", "ID", "attribute", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Helper/IdGeneratorTrait.php#L80-L88
210,585
cakephp/cakephp
src/View/Widget/WidgetLocator.php
WidgetLocator.load
public function load($file) { $loader = new PhpConfig(); $widgets = $loader->read($file); $this->add($widgets); }
php
public function load($file) { $loader = new PhpConfig(); $widgets = $loader->read($file); $this->add($widgets); }
[ "public", "function", "load", "(", "$", "file", ")", "{", "$", "loader", "=", "new", "PhpConfig", "(", ")", ";", "$", "widgets", "=", "$", "loader", "->", "read", "(", "$", "file", ")", ";", "$", "this", "->", "add", "(", "$", "widgets", ")", "...
Load a config file containing widgets. Widget files should define a `$config` variable containing all the widgets to load. Loaded widgets will be merged with existing widgets. @param string $file The file to load @return void
[ "Load", "a", "config", "file", "containing", "widgets", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Widget/WidgetLocator.php#L88-L93
210,586
cakephp/cakephp
src/View/Widget/WidgetLocator.php
WidgetLocator._resolveWidget
protected function _resolveWidget($widget) { $type = gettype($widget); if ($type === 'object') { return $widget; } if ($type === 'string') { $widget = [$widget]; } $class = array_shift($widget); $className = App::className($class, 'Vi...
php
protected function _resolveWidget($widget) { $type = gettype($widget); if ($type === 'object') { return $widget; } if ($type === 'string') { $widget = [$widget]; } $class = array_shift($widget); $className = App::className($class, 'Vi...
[ "protected", "function", "_resolveWidget", "(", "$", "widget", ")", "{", "$", "type", "=", "gettype", "(", "$", "widget", ")", ";", "if", "(", "$", "type", "===", "'object'", ")", "{", "return", "$", "widget", ";", "}", "if", "(", "$", "type", "===...
Resolves a widget spec into an instance. @param mixed $widget The widget to get @return \Cake\View\Widget\WidgetInterface @throws \RuntimeException when class cannot be loaded or does not implement WidgetInterface. @throws \ReflectionException
[ "Resolves", "a", "widget", "spec", "into", "an", "instance", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/Widget/WidgetLocator.php#L173-L204
210,587
cakephp/cakephp
src/Mailer/TransportFactory.php
TransportFactory._buildTransport
protected static function _buildTransport($name) { if (!isset(static::$_config[$name])) { throw new InvalidArgumentException( sprintf('The "%s" transport configuration does not exist', $name) ); } if (is_array(static::$_config[$name]) && empty(static:...
php
protected static function _buildTransport($name) { if (!isset(static::$_config[$name])) { throw new InvalidArgumentException( sprintf('The "%s" transport configuration does not exist', $name) ); } if (is_array(static::$_config[$name]) && empty(static:...
[ "protected", "static", "function", "_buildTransport", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "static", "::", "$", "_config", "[", "$", "name", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(", "'The \...
Finds and builds the instance of the required tranport class. @param string $name Name of the config array that needs a tranport instance built @return void @throws \InvalidArgumentException When a tranport cannot be created.
[ "Finds", "and", "builds", "the", "instance", "of", "the", "required", "tranport", "class", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Mailer/TransportFactory.php#L79-L94
210,588
cakephp/cakephp
src/Mailer/TransportFactory.php
TransportFactory.get
public static function get($name) { $registry = static::getRegistry(); if (isset($registry->{$name})) { return $registry->{$name}; } static::_buildTransport($name); return $registry->{$name}; }
php
public static function get($name) { $registry = static::getRegistry(); if (isset($registry->{$name})) { return $registry->{$name}; } static::_buildTransport($name); return $registry->{$name}; }
[ "public", "static", "function", "get", "(", "$", "name", ")", "{", "$", "registry", "=", "static", "::", "getRegistry", "(", ")", ";", "if", "(", "isset", "(", "$", "registry", "->", "{", "$", "name", "}", ")", ")", "{", "return", "$", "registry", ...
Get transport instance. @param string $name Config name. @return \Cake\Mailer\AbstractTransport
[ "Get", "transport", "instance", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Mailer/TransportFactory.php#L102-L113
210,589
cakephp/cakephp
src/Auth/DigestAuthenticate.php
DigestAuthenticate.parseAuthData
public function parseAuthData($digest) { if (substr($digest, 0, 7) === 'Digest ') { $digest = substr($digest, 7); } $keys = $match = []; $req = ['nonce' => 1, 'nc' => 1, 'cnonce' => 1, 'qop' => 1, 'username' => 1, 'uri' => 1, 'response' => 1]; preg_match_all('/(\w...
php
public function parseAuthData($digest) { if (substr($digest, 0, 7) === 'Digest ') { $digest = substr($digest, 7); } $keys = $match = []; $req = ['nonce' => 1, 'nc' => 1, 'cnonce' => 1, 'qop' => 1, 'username' => 1, 'uri' => 1, 'response' => 1]; preg_match_all('/(\w...
[ "public", "function", "parseAuthData", "(", "$", "digest", ")", "{", "if", "(", "substr", "(", "$", "digest", ",", "0", ",", "7", ")", "===", "'Digest '", ")", "{", "$", "digest", "=", "substr", "(", "$", "digest", ",", "7", ")", ";", "}", "$", ...
Parse the digest authentication headers and split them up. @param string $digest The raw digest authentication headers. @return array|null An array of digest authentication headers
[ "Parse", "the", "digest", "authentication", "headers", "and", "split", "them", "up", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Auth/DigestAuthenticate.php#L161-L180
210,590
cakephp/cakephp
src/Auth/DigestAuthenticate.php
DigestAuthenticate.generateResponseHash
public function generateResponseHash($digest, $password, $method) { return md5( $password . ':' . $digest['nonce'] . ':' . $digest['nc'] . ':' . $digest['cnonce'] . ':' . $digest['qop'] . ':' . md5($method . ':' . $digest['uri']) ); }
php
public function generateResponseHash($digest, $password, $method) { return md5( $password . ':' . $digest['nonce'] . ':' . $digest['nc'] . ':' . $digest['cnonce'] . ':' . $digest['qop'] . ':' . md5($method . ':' . $digest['uri']) ); }
[ "public", "function", "generateResponseHash", "(", "$", "digest", ",", "$", "password", ",", "$", "method", ")", "{", "return", "md5", "(", "$", "password", ".", "':'", ".", "$", "digest", "[", "'nonce'", "]", ".", "':'", ".", "$", "digest", "[", "'n...
Generate the response hash for a given digest array. @param array $digest Digest information containing data from DigestAuthenticate::parseAuthData(). @param string $password The digest hash password generated with DigestAuthenticate::password() @param string $method Request method @return string Response hash
[ "Generate", "the", "response", "hash", "for", "a", "given", "digest", "array", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Auth/DigestAuthenticate.php#L190-L197
210,591
cakephp/cakephp
src/View/StringTemplate.php
StringTemplate.pop
public function pop() { if (empty($this->_configStack)) { return; } list($this->_config, $this->_compiled) = array_pop($this->_configStack); }
php
public function pop() { if (empty($this->_configStack)) { return; } list($this->_config, $this->_compiled) = array_pop($this->_configStack); }
[ "public", "function", "pop", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "_configStack", ")", ")", "{", "return", ";", "}", "list", "(", "$", "this", "->", "_config", ",", "$", "this", "->", "_compiled", ")", "=", "array_pop", "(", ...
Restore the most recently pushed set of templates. @return void
[ "Restore", "the", "most", "recently", "pushed", "set", "of", "templates", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/StringTemplate.php#L134-L140
210,592
cakephp/cakephp
src/View/StringTemplate.php
StringTemplate.add
public function add(array $templates) { $this->setConfig($templates); $this->_compileTemplates(array_keys($templates)); return $this; }
php
public function add(array $templates) { $this->setConfig($templates); $this->_compileTemplates(array_keys($templates)); return $this; }
[ "public", "function", "add", "(", "array", "$", "templates", ")", "{", "$", "this", "->", "setConfig", "(", "$", "templates", ")", ";", "$", "this", "->", "_compileTemplates", "(", "array_keys", "(", "$", "templates", ")", ")", ";", "return", "$", "thi...
Registers a list of templates by name ### Example: ``` $templater->add([ 'link' => '<a href="{{url}}">{{title}}</a>' 'button' => '<button>{{text}}</button>' ]); ``` @param array $templates An associative list of named templates. @return $this
[ "Registers", "a", "list", "of", "templates", "by", "name" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/StringTemplate.php#L157-L163
210,593
cakephp/cakephp
src/View/StringTemplate.php
StringTemplate.load
public function load($file) { $loader = new PhpConfig(); $templates = $loader->read($file); $this->add($templates); }
php
public function load($file) { $loader = new PhpConfig(); $templates = $loader->read($file); $this->add($templates); }
[ "public", "function", "load", "(", "$", "file", ")", "{", "$", "loader", "=", "new", "PhpConfig", "(", ")", ";", "$", "templates", "=", "$", "loader", "->", "read", "(", "$", "file", ")", ";", "$", "this", "->", "add", "(", "$", "templates", ")",...
Load a config file containing templates. Template files should define a `$config` variable containing all the templates to load. Loaded templates will be merged with existing templates. @param string $file The file to load @return void
[ "Load", "a", "config", "file", "containing", "templates", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/StringTemplate.php#L201-L206
210,594
cakephp/cakephp
src/View/StringTemplate.php
StringTemplate._formatAttribute
protected function _formatAttribute($key, $value, $escape = true) { if (is_array($value)) { $value = implode(' ', $value); } if (is_numeric($key)) { return "$value=\"$value\""; } $truthy = [1, '1', true, 'true', $key]; $isMinimized = isset($thi...
php
protected function _formatAttribute($key, $value, $escape = true) { if (is_array($value)) { $value = implode(' ', $value); } if (is_numeric($key)) { return "$value=\"$value\""; } $truthy = [1, '1', true, 'true', $key]; $isMinimized = isset($thi...
[ "protected", "function", "_formatAttribute", "(", "$", "key", ",", "$", "value", ",", "$", "escape", "=", "true", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "$", "value", "=", "implode", "(", "' '", ",", "$", "value", ")", ...
Formats an individual attribute, and returns the string value of the composed attribute. Works with minimized attributes that have the same value as their name such as 'disabled' and 'checked' @param string $key The name of the attribute to create @param string|array $value The value of the attribute to create. @param...
[ "Formats", "an", "individual", "attribute", "and", "returns", "the", "string", "value", "of", "the", "composed", "attribute", ".", "Works", "with", "minimized", "attributes", "that", "have", "the", "same", "value", "as", "their", "name", "such", "as", "disable...
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/View/StringTemplate.php#L308-L329
210,595
cakephp/cakephp
src/Utility/Xml.php
Xml.build
public static function build($input, array $options = []) { $defaults = [ 'return' => 'simplexml', 'loadEntities' => false, 'readFile' => true, 'parseHuge' => false, ]; $options += $defaults; if (is_array($input) || is_object($input)) ...
php
public static function build($input, array $options = []) { $defaults = [ 'return' => 'simplexml', 'loadEntities' => false, 'readFile' => true, 'parseHuge' => false, ]; $options += $defaults; if (is_array($input) || is_object($input)) ...
[ "public", "static", "function", "build", "(", "$", "input", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "defaults", "=", "[", "'return'", "=>", "'simplexml'", ",", "'loadEntities'", "=>", "false", ",", "'readFile'", "=>", "true", ",", "...
Initialize SimpleXMLElement or DOMDocument from a given XML string, file path, URL or array. ### Usage: Building XML from a string: ``` $xml = Xml::build('<example>text</example>'); ``` Building XML from string (output DOMDocument): ``` $xml = Xml::build('<example>text</example>', ['return' => 'domdocument']); ```...
[ "Initialize", "SimpleXMLElement", "or", "DOMDocument", "from", "a", "given", "XML", "string", "file", "path", "URL", "or", "array", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Xml.php#L104-L131
210,596
cakephp/cakephp
src/Utility/Xml.php
Xml._loadXml
protected static function _loadXml($input, $options) { $hasDisable = function_exists('libxml_disable_entity_loader'); $internalErrors = libxml_use_internal_errors(true); if ($hasDisable && !$options['loadEntities']) { libxml_disable_entity_loader(true); } $flags =...
php
protected static function _loadXml($input, $options) { $hasDisable = function_exists('libxml_disable_entity_loader'); $internalErrors = libxml_use_internal_errors(true); if ($hasDisable && !$options['loadEntities']) { libxml_disable_entity_loader(true); } $flags =...
[ "protected", "static", "function", "_loadXml", "(", "$", "input", ",", "$", "options", ")", "{", "$", "hasDisable", "=", "function_exists", "(", "'libxml_disable_entity_loader'", ")", ";", "$", "internalErrors", "=", "libxml_use_internal_errors", "(", "true", ")",...
Parse the input data and create either a SimpleXmlElement object or a DOMDocument. @param string $input The input to load. @param array $options The options to use. See Xml::build() @return \SimpleXMLElement|\DOMDocument @throws \Cake\Utility\Exception\XmlException
[ "Parse", "the", "input", "data", "and", "create", "either", "a", "SimpleXmlElement", "object", "or", "a", "DOMDocument", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Xml.php#L141-L170
210,597
cakephp/cakephp
src/Utility/Xml.php
Xml.loadHtml
public static function loadHtml($input, $options = []) { $defaults = [ 'return' => 'simplexml', 'loadEntities' => false, ]; $options += $defaults; $hasDisable = function_exists('libxml_disable_entity_loader'); $internalErrors = libxml_use_internal_err...
php
public static function loadHtml($input, $options = []) { $defaults = [ 'return' => 'simplexml', 'loadEntities' => false, ]; $options += $defaults; $hasDisable = function_exists('libxml_disable_entity_loader'); $internalErrors = libxml_use_internal_err...
[ "public", "static", "function", "loadHtml", "(", "$", "input", ",", "$", "options", "=", "[", "]", ")", "{", "$", "defaults", "=", "[", "'return'", "=>", "'simplexml'", ",", "'loadEntities'", "=>", "false", ",", "]", ";", "$", "options", "+=", "$", "...
Parse the input html string and create either a SimpleXmlElement object or a DOMDocument. @param string $input The input html string to load. @param array $options The options to use. See Xml::build() @return \SimpleXMLElement|\DOMDocument @throws \Cake\Utility\Exception\XmlException
[ "Parse", "the", "input", "html", "string", "and", "create", "either", "a", "SimpleXmlElement", "object", "or", "a", "DOMDocument", "." ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Xml.php#L180-L215
210,598
cakephp/cakephp
src/Utility/Xml.php
Xml.fromArray
public static function fromArray($input, $options = []) { if (is_object($input) && method_exists($input, 'toArray') && is_callable([$input, 'toArray'])) { $input = call_user_func([$input, 'toArray']); } if (!is_array($input) || count($input) !== 1) { throw new XmlExce...
php
public static function fromArray($input, $options = []) { if (is_object($input) && method_exists($input, 'toArray') && is_callable([$input, 'toArray'])) { $input = call_user_func([$input, 'toArray']); } if (!is_array($input) || count($input) !== 1) { throw new XmlExce...
[ "public", "static", "function", "fromArray", "(", "$", "input", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "is_object", "(", "$", "input", ")", "&&", "method_exists", "(", "$", "input", ",", "'toArray'", ")", "&&", "is_callable", "(", "...
Transform an array into a SimpleXMLElement ### Options - `format` If create childs ('tags') or attributes ('attributes'). - `pretty` Returns formatted Xml when set to `true`. Defaults to `false` - `version` Version of XML document. Default is 1.0. - `encoding` Encoding of XML document. If null remove from XML header....
[ "Transform", "an", "array", "into", "a", "SimpleXMLElement" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Xml.php#L255-L292
210,599
cakephp/cakephp
src/Utility/Xml.php
Xml._fromArray
protected static function _fromArray($dom, $node, &$data, $format) { if (empty($data) || !is_array($data)) { return; } foreach ($data as $key => $value) { if (is_string($key)) { if (is_object($value) && method_exists($value, 'toArray') && is_callable([...
php
protected static function _fromArray($dom, $node, &$data, $format) { if (empty($data) || !is_array($data)) { return; } foreach ($data as $key => $value) { if (is_string($key)) { if (is_object($value) && method_exists($value, 'toArray') && is_callable([...
[ "protected", "static", "function", "_fromArray", "(", "$", "dom", ",", "$", "node", ",", "&", "$", "data", ",", "$", "format", ")", "{", "if", "(", "empty", "(", "$", "data", ")", "||", "!", "is_array", "(", "$", "data", ")", ")", "{", "return", ...
Recursive method to create childs from array @param \DOMDocument $dom Handler to DOMDocument @param \DOMElement $node Handler to DOMElement (child) @param array $data Array of data to append to the $node. @param string $format Either 'attributes' or 'tags'. This determines where nested keys go. @return void @throws \C...
[ "Recursive", "method", "to", "create", "childs", "from", "array" ]
5f6c9d65dcbbfc093410d1dbbb207a17f4cde540
https://github.com/cakephp/cakephp/blob/5f6c9d65dcbbfc093410d1dbbb207a17f4cde540/src/Utility/Xml.php#L304-L365