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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
phpMv/ubiquity | src/Ubiquity/controllers/auth/AuthControllerOverrideTrait.php | AuthControllerOverrideTrait.rememberMe | protected function rememberMe($connected){
$id= $this->toCookie($connected);
if(isset($id)){
UCookie::set($this->_getUserSessionKey(),$id);
}
} | php | protected function rememberMe($connected){
$id= $this->toCookie($connected);
if(isset($id)){
UCookie::set($this->_getUserSessionKey(),$id);
}
} | [
"protected",
"function",
"rememberMe",
"(",
"$",
"connected",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"toCookie",
"(",
"$",
"connected",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"id",
")",
")",
"{",
"UCookie",
"::",
"set",
"(",
"$",
"this",
"... | Saves the connected user identifier in a cookie
@param object $connected | [
"Saves",
"the",
"connected",
"user",
"identifier",
"in",
"a",
"cookie"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/auth/AuthControllerOverrideTrait.php#L84-L89 | train |
phpMv/ubiquity | src/Ubiquity/utils/base/UFileSystem.php | UFileSystem.safeMkdir | public static function safeMkdir($dir, $mode = 0777, $recursive = true) {
if (! \is_dir ( $dir ))
return \mkdir ( $dir, $mode, $recursive );
return true;
} | php | public static function safeMkdir($dir, $mode = 0777, $recursive = true) {
if (! \is_dir ( $dir ))
return \mkdir ( $dir, $mode, $recursive );
return true;
} | [
"public",
"static",
"function",
"safeMkdir",
"(",
"$",
"dir",
",",
"$",
"mode",
"=",
"0777",
",",
"$",
"recursive",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"\\",
"is_dir",
"(",
"$",
"dir",
")",
")",
"return",
"\\",
"mkdir",
"(",
"$",
"dir",
",",
... | Tests the existance and eventually creates a directory
@param string $dir
@param int $mode
@param boolean $recursive
@return boolean | [
"Tests",
"the",
"existance",
"and",
"eventually",
"creates",
"a",
"directory"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/base/UFileSystem.php#L68-L72 | train |
phpMv/ubiquity | src/Ubiquity/utils/base/UFileSystem.php | UFileSystem.cleanPathname | public static function cleanPathname($path) {
if (UString::isNotNull ( $path )) {
if (\DS === "/")
$path = \str_replace ( "\\", \DS, $path );
else
$path = \str_replace ( "/", \DS, $path );
$path = \str_replace ( \DS . \DS, \DS, $path );
if (! UString::endswith ( $path, \DS )) {
$path = $path .... | php | public static function cleanPathname($path) {
if (UString::isNotNull ( $path )) {
if (\DS === "/")
$path = \str_replace ( "\\", \DS, $path );
else
$path = \str_replace ( "/", \DS, $path );
$path = \str_replace ( \DS . \DS, \DS, $path );
if (! UString::endswith ( $path, \DS )) {
$path = $path .... | [
"public",
"static",
"function",
"cleanPathname",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"UString",
"::",
"isNotNull",
"(",
"$",
"path",
")",
")",
"{",
"if",
"(",
"\\",
"DS",
"===",
"\"/\"",
")",
"$",
"path",
"=",
"\\",
"str_replace",
"(",
"\"\\\\\"",... | Cleans a directory path by removing double backslashes or slashes and using DIRECTORY_SEPARATOR
@param string $path
@return string | [
"Cleans",
"a",
"directory",
"path",
"by",
"removing",
"double",
"backslashes",
"or",
"slashes",
"and",
"using",
"DIRECTORY_SEPARATOR"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/base/UFileSystem.php#L80-L92 | train |
phpMv/ubiquity | src/Ubiquity/utils/base/UFileSystem.php | UFileSystem.cleanFilePathname | public static function cleanFilePathname($path) {
if (UString::isNotNull ( $path )) {
if (\DS === "/")
$path = \str_replace ( "\\", \DS, $path );
else
$path = \str_replace ( "/", \DS, $path );
$path = \str_replace ( \DS . \DS, \DS, $path );
}
return $path;
} | php | public static function cleanFilePathname($path) {
if (UString::isNotNull ( $path )) {
if (\DS === "/")
$path = \str_replace ( "\\", \DS, $path );
else
$path = \str_replace ( "/", \DS, $path );
$path = \str_replace ( \DS . \DS, \DS, $path );
}
return $path;
} | [
"public",
"static",
"function",
"cleanFilePathname",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"UString",
"::",
"isNotNull",
"(",
"$",
"path",
")",
")",
"{",
"if",
"(",
"\\",
"DS",
"===",
"\"/\"",
")",
"$",
"path",
"=",
"\\",
"str_replace",
"(",
"\"\\\\... | Cleans a file path by removing double backslashes or slashes and using DIRECTORY_SEPARATOR
@param string $path
@return string | [
"Cleans",
"a",
"file",
"path",
"by",
"removing",
"double",
"backslashes",
"or",
"slashes",
"and",
"using",
"DIRECTORY_SEPARATOR"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/base/UFileSystem.php#L100-L109 | train |
phpMv/ubiquity | src/Ubiquity/utils/base/UFileSystem.php | UFileSystem.getLines | public static function getLines($filename, $reverse = false, $maxLines = null, $lineCallback = null) {
if (file_exists ( $filename )) {
if ($reverse && isset ( $maxLines )) {
$result = [ ];
$fl = fopen ( $filename, "r" );
for($x_pos = 0, $ln = 0, $lines = [ ]; fseek ( $fl, $x_pos, SEEK_END ) !== - 1; $... | php | public static function getLines($filename, $reverse = false, $maxLines = null, $lineCallback = null) {
if (file_exists ( $filename )) {
if ($reverse && isset ( $maxLines )) {
$result = [ ];
$fl = fopen ( $filename, "r" );
for($x_pos = 0, $ln = 0, $lines = [ ]; fseek ( $fl, $x_pos, SEEK_END ) !== - 1; $... | [
"public",
"static",
"function",
"getLines",
"(",
"$",
"filename",
",",
"$",
"reverse",
"=",
"false",
",",
"$",
"maxLines",
"=",
"null",
",",
"$",
"lineCallback",
"=",
"null",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"filename",
")",
")",
"{",
"i... | Returns the lines of a file in an array
@param string $filename
@param boolean $reverse
@param null|int $maxLines
@param callback $lineCallback
@return array | [
"Returns",
"the",
"lines",
"of",
"a",
"file",
"in",
"an",
"array"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/base/UFileSystem.php#L181-L210 | train |
phpMv/ubiquity | src/Ubiquity/controllers/di/DiManager.php | DiManager.init | public static function init(&$config) {
$controllers = CacheManager::getControllers ();
foreach ( $controllers as $controller ) {
CacheManager::$cache->remove( self::getControllerCacheKey ( $controller ));
$parser = new DiControllerParser ();
$parser->parse ( $controller, $config );
$injections = $parse... | php | public static function init(&$config) {
$controllers = CacheManager::getControllers ();
foreach ( $controllers as $controller ) {
CacheManager::$cache->remove( self::getControllerCacheKey ( $controller ));
$parser = new DiControllerParser ();
$parser->parse ( $controller, $config );
$injections = $parse... | [
"public",
"static",
"function",
"init",
"(",
"&",
"$",
"config",
")",
"{",
"$",
"controllers",
"=",
"CacheManager",
"::",
"getControllers",
"(",
")",
";",
"foreach",
"(",
"$",
"controllers",
"as",
"$",
"controller",
")",
"{",
"CacheManager",
"::",
"$",
"... | Initialize dependency injection cache
To use in dev only!
@param array $config | [
"Initialize",
"dependency",
"injection",
"cache",
"To",
"use",
"in",
"dev",
"only!"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/di/DiManager.php#L26-L37 | train |
phpMv/ubiquity | src/Ubiquity/utils/base/UArray.php | UArray.save | public static function save($array, $filename) {
$content = "<?php\nreturn " . self::asPhpArray ( $array, "array", 1, true ) . ";";
return UFileSystem::save ( $filename, $content );
} | php | public static function save($array, $filename) {
$content = "<?php\nreturn " . self::asPhpArray ( $array, "array", 1, true ) . ";";
return UFileSystem::save ( $filename, $content );
} | [
"public",
"static",
"function",
"save",
"(",
"$",
"array",
",",
"$",
"filename",
")",
"{",
"$",
"content",
"=",
"\"<?php\\nreturn \"",
".",
"self",
"::",
"asPhpArray",
"(",
"$",
"array",
",",
"\"array\"",
",",
"1",
",",
"true",
")",
".",
"\";\"",
";",
... | Save a php array to the disk.
@param array $array The array to save
@param string $filename The path of the file to save in
@return int | [
"Save",
"a",
"php",
"array",
"to",
"the",
"disk",
"."
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/base/UArray.php#L90-L93 | train |
phpMv/ubiquity | src/Ubiquity/controllers/Router.php | Router.getRoute | public static function getRoute($path, $cachedResponse = true) {
$path = self::slashPath ( $path );
if (isset ( self::$routes [$path] )) {
return self::getRoute_ ( self::$routes [$path], $path, [ $path ], $cachedResponse );
}
foreach ( self::$routes as $routePath => $routeDetails ) {
if (preg_match ( "@^"... | php | public static function getRoute($path, $cachedResponse = true) {
$path = self::slashPath ( $path );
if (isset ( self::$routes [$path] )) {
return self::getRoute_ ( self::$routes [$path], $path, [ $path ], $cachedResponse );
}
foreach ( self::$routes as $routePath => $routeDetails ) {
if (preg_match ( "@^"... | [
"public",
"static",
"function",
"getRoute",
"(",
"$",
"path",
",",
"$",
"cachedResponse",
"=",
"true",
")",
"{",
"$",
"path",
"=",
"self",
"::",
"slashPath",
"(",
"$",
"path",
")",
";",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"routes",
"[",
"$"... | Returns the route corresponding to a path
@param string $path The route path
@param boolean $cachedResponse
@return boolean|mixed[]|string | [
"Returns",
"the",
"route",
"corresponding",
"to",
"a",
"path"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/Router.php#L114-L128 | train |
phpMv/ubiquity | src/Ubiquity/controllers/Router.php | Router.url | public static function url($name, $parameters = []) {
return URequest::getUrl ( self::getRouteByName ( $name, $parameters, false ) );
} | php | public static function url($name, $parameters = []) {
return URequest::getUrl ( self::getRouteByName ( $name, $parameters, false ) );
} | [
"public",
"static",
"function",
"url",
"(",
"$",
"name",
",",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"return",
"URequest",
"::",
"getUrl",
"(",
"self",
"::",
"getRouteByName",
"(",
"$",
"name",
",",
"$",
"parameters",
",",
"false",
")",
")",
";"... | Returns the generated url from a route
@param string $name the route name
@param array $parameters default: []
@return string the generated url (http://myApp/path/to/route) | [
"Returns",
"the",
"generated",
"url",
"from",
"a",
"route"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/Router.php#L170-L172 | train |
phpMv/ubiquity | src/Ubiquity/controllers/Router.php | Router.slashPath | public static function slashPath($path) {
if (UString::startswith ( $path, "/" ) === false)
$path = "/" . $path;
if (! UString::endswith ( $path, "/" ))
$path = $path . "/";
return $path;
} | php | public static function slashPath($path) {
if (UString::startswith ( $path, "/" ) === false)
$path = "/" . $path;
if (! UString::endswith ( $path, "/" ))
$path = $path . "/";
return $path;
} | [
"public",
"static",
"function",
"slashPath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"UString",
"::",
"startswith",
"(",
"$",
"path",
",",
"\"/\"",
")",
"===",
"false",
")",
"$",
"path",
"=",
"\"/\"",
".",
"$",
"path",
";",
"if",
"(",
"!",
"UString"... | Adds a slash before and after a path
@param string $path The path to modify
@return string The path with slashes | [
"Adds",
"a",
"slash",
"before",
"and",
"after",
"a",
"path"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/Router.php#L201-L207 | train |
phpMv/ubiquity | src/Ubiquity/contents/validation/ValidatorsManager.php | ValidatorsManager.validate | public static function validate($instance, $group = "") {
$class = get_class ( $instance );
$cache = self::getClassCacheValidators ( $class, $group );
if ($cache !== false) {
return self::validateFromCache_ ( $instance, $cache );
}
$members = self::fetch ( $class );
if ($group !== "") {
$members = sel... | php | public static function validate($instance, $group = "") {
$class = get_class ( $instance );
$cache = self::getClassCacheValidators ( $class, $group );
if ($cache !== false) {
return self::validateFromCache_ ( $instance, $cache );
}
$members = self::fetch ( $class );
if ($group !== "") {
$members = sel... | [
"public",
"static",
"function",
"validate",
"(",
"$",
"instance",
",",
"$",
"group",
"=",
"\"\"",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"instance",
")",
";",
"$",
"cache",
"=",
"self",
"::",
"getClassCacheValidators",
"(",
"$",
"class",
"... | Validates an instance
@param object $instance
@param string $group
@return \Ubiquity\contents\validation\validators\ConstraintViolation[] | [
"Validates",
"an",
"instance"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/contents/validation/ValidatorsManager.php#L134-L145 | train |
phpMv/ubiquity | src/Ubiquity/contents/validation/ValidatorsManager.php | ValidatorsManager.validateInstances | public static function validateInstances($instances, $group = "") {
if (sizeof ( $instances ) > 0) {
$instance = current ( $instances );
$class = get_class ( $instance );
$cache = self::getClassCacheValidators ( $class, $group );
if ($cache === false) {
$members = self::fetch ( $class );
self::ini... | php | public static function validateInstances($instances, $group = "") {
if (sizeof ( $instances ) > 0) {
$instance = current ( $instances );
$class = get_class ( $instance );
$cache = self::getClassCacheValidators ( $class, $group );
if ($cache === false) {
$members = self::fetch ( $class );
self::ini... | [
"public",
"static",
"function",
"validateInstances",
"(",
"$",
"instances",
",",
"$",
"group",
"=",
"\"\"",
")",
"{",
"if",
"(",
"sizeof",
"(",
"$",
"instances",
")",
">",
"0",
")",
"{",
"$",
"instance",
"=",
"current",
"(",
"$",
"instances",
")",
";... | Validates an array of objects
@param array $instances
@param string $group
@return \Ubiquity\contents\validation\validators\ConstraintViolation[] | [
"Validates",
"an",
"array",
"of",
"objects"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/contents/validation/ValidatorsManager.php#L154-L167 | train |
phpMv/ubiquity | src/Ubiquity/cache/traits/ModelsCacheTrait.php | ModelsCacheTrait.getModels | public static function getModels(&$config, $silent = false) {
$result = [ ];
$files = self::getModelsFiles ( $config, $silent );
foreach ( $files as $file ) {
$result [] = ClassUtils::getClassFullNameFromFile ( $file );
}
return $result;
} | php | public static function getModels(&$config, $silent = false) {
$result = [ ];
$files = self::getModelsFiles ( $config, $silent );
foreach ( $files as $file ) {
$result [] = ClassUtils::getClassFullNameFromFile ( $file );
}
return $result;
} | [
"public",
"static",
"function",
"getModels",
"(",
"&",
"$",
"config",
",",
"$",
"silent",
"=",
"false",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"files",
"=",
"self",
"::",
"getModelsFiles",
"(",
"$",
"config",
",",
"$",
"silent",
")",
";"... | Returns an array of the models class names
@param array $config
@param boolean $silent
@return string[] | [
"Returns",
"an",
"array",
"of",
"the",
"models",
"class",
"names"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/cache/traits/ModelsCacheTrait.php#L86-L93 | train |
phpMv/ubiquity | src/Ubiquity/controllers/crud/CRUDController.php | CRUDController.refresh_ | public function refresh_() {
$model = $this->model;
if (isset ( $_POST ["s"] )) {
$instances = $this->search ( $model, $_POST ["s"] );
} else {
$page = URequest::post ( "p", 1 );
$instances = $this->getInstances ( $totalCount, $page );
}
if (! isset ( $totalCount )) {
$totalCount = DAO::count ( $m... | php | public function refresh_() {
$model = $this->model;
if (isset ( $_POST ["s"] )) {
$instances = $this->search ( $model, $_POST ["s"] );
} else {
$page = URequest::post ( "p", 1 );
$instances = $this->getInstances ( $totalCount, $page );
}
if (! isset ( $totalCount )) {
$totalCount = DAO::count ( $m... | [
"public",
"function",
"refresh_",
"(",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"model",
";",
"if",
"(",
"isset",
"(",
"$",
"_POST",
"[",
"\"s\"",
"]",
")",
")",
"{",
"$",
"instances",
"=",
"$",
"this",
"->",
"search",
"(",
"$",
"model",
... | Refreshes the area corresponding to the DataTable | [
"Refreshes",
"the",
"area",
"corresponding",
"to",
"the",
"DataTable"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/crud/CRUDController.php#L73-L98 | train |
phpMv/ubiquity | src/Ubiquity/controllers/crud/CRUDController.php | CRUDController.edit | public function edit($modal = "no", $ids = "") {
if (URequest::isAjax ()) {
$instance = $this->getModelInstance ( $ids, false );
$instance->_new = false;
$this->_edit ( $instance, $modal );
} else {
$this->jquery->execAtLast ( "$('._edit[data-ajax={$ids}]').trigger('click');" );
$this->index ();
}
... | php | public function edit($modal = "no", $ids = "") {
if (URequest::isAjax ()) {
$instance = $this->getModelInstance ( $ids, false );
$instance->_new = false;
$this->_edit ( $instance, $modal );
} else {
$this->jquery->execAtLast ( "$('._edit[data-ajax={$ids}]').trigger('click');" );
$this->index ();
}
... | [
"public",
"function",
"edit",
"(",
"$",
"modal",
"=",
"\"no\"",
",",
"$",
"ids",
"=",
"\"\"",
")",
"{",
"if",
"(",
"URequest",
"::",
"isAjax",
"(",
")",
")",
"{",
"$",
"instance",
"=",
"$",
"this",
"->",
"getModelInstance",
"(",
"$",
"ids",
",",
... | Edits an instance
@param string $modal Accept "no" or "modal" for a modal dialog
@param string $ids the primary value(s) | [
"Edits",
"an",
"instance"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/crud/CRUDController.php#L106-L115 | train |
phpMv/ubiquity | src/Ubiquity/controllers/crud/CRUDController.php | CRUDController.newModel | public function newModel($modal = "no") {
if (URequest::isAjax ()) {
$model = $this->model;
$instance = new $model ();
$instance->_new = true;
$this->_edit ( $instance, $modal );
} else {
$this->jquery->execAtLast ( "$('.ui.button._new').trigger('click');" );
$this->index ();
}
} | php | public function newModel($modal = "no") {
if (URequest::isAjax ()) {
$model = $this->model;
$instance = new $model ();
$instance->_new = true;
$this->_edit ( $instance, $modal );
} else {
$this->jquery->execAtLast ( "$('.ui.button._new').trigger('click');" );
$this->index ();
}
} | [
"public",
"function",
"newModel",
"(",
"$",
"modal",
"=",
"\"no\"",
")",
"{",
"if",
"(",
"URequest",
"::",
"isAjax",
"(",
")",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"model",
";",
"$",
"instance",
"=",
"new",
"$",
"model",
"(",
")",
";",... | Adds a new instance and edits it
@param string $modal Accept "no" or "modal" for a modal dialog | [
"Adds",
"a",
"new",
"instance",
"and",
"edits",
"it"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/crud/CRUDController.php#L122-L132 | train |
phpMv/ubiquity | src/Ubiquity/controllers/crud/CRUDController.php | CRUDController.display | public function display($modal = "no", $ids = "") {
if (URequest::isAjax ()) {
$instance = $this->getModelInstance ( $ids );
$key = OrmUtils::getFirstKeyValue ( $instance );
$this->jquery->execOn ( "click", "._close", '$("#table-details").html("");$("#dataTable").show();' );
$this->jquery->getOnClick ( ".... | php | public function display($modal = "no", $ids = "") {
if (URequest::isAjax ()) {
$instance = $this->getModelInstance ( $ids );
$key = OrmUtils::getFirstKeyValue ( $instance );
$this->jquery->execOn ( "click", "._close", '$("#table-details").html("");$("#dataTable").show();' );
$this->jquery->getOnClick ( ".... | [
"public",
"function",
"display",
"(",
"$",
"modal",
"=",
"\"no\"",
",",
"$",
"ids",
"=",
"\"\"",
")",
"{",
"if",
"(",
"URequest",
"::",
"isAjax",
"(",
")",
")",
"{",
"$",
"instance",
"=",
"$",
"this",
"->",
"getModelInstance",
"(",
"$",
"ids",
")",... | Displays an instance
@param string $modal
@param string $ids | [
"Displays",
"an",
"instance"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/crud/CRUDController.php#L152-L166 | train |
phpMv/ubiquity | src/Ubiquity/controllers/crud/CRUDController.php | CRUDController.delete | public function delete($ids) {
if (URequest::isAjax ()) {
$instance = $this->getModelInstance ( $ids );
$instanceString = $this->getInstanceToString ( $instance );
if (sizeof ( $_POST ) > 0) {
try {
if (DAO::remove ( $instance )) {
$message = new CRUDMessage ( "Deletion of `<b>" . $instanceStr... | php | public function delete($ids) {
if (URequest::isAjax ()) {
$instance = $this->getModelInstance ( $ids );
$instanceString = $this->getInstanceToString ( $instance );
if (sizeof ( $_POST ) > 0) {
try {
if (DAO::remove ( $instance )) {
$message = new CRUDMessage ( "Deletion of `<b>" . $instanceStr... | [
"public",
"function",
"delete",
"(",
"$",
"ids",
")",
"{",
"if",
"(",
"URequest",
"::",
"isAjax",
"(",
")",
")",
"{",
"$",
"instance",
"=",
"$",
"this",
"->",
"getModelInstance",
"(",
"$",
"ids",
")",
";",
"$",
"instanceString",
"=",
"$",
"this",
"... | Deletes an instance
@param mixed $ids | [
"Deletes",
"an",
"instance"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/crud/CRUDController.php#L173-L203 | train |
phpMv/ubiquity | src/Ubiquity/controllers/crud/CRUDController.php | CRUDController.update | public function update() {
$message = new CRUDMessage ( "Modifications were successfully saved", "Updating" );
$instance = $_SESSION ["instance"] ?? null;
if (isset ( $instance )) {
$isNew = $instance->_new;
try {
$updated = CRUDHelper::update ( $instance, $_POST );
if ($updated) {
$message->se... | php | public function update() {
$message = new CRUDMessage ( "Modifications were successfully saved", "Updating" );
$instance = $_SESSION ["instance"] ?? null;
if (isset ( $instance )) {
$isNew = $instance->_new;
try {
$updated = CRUDHelper::update ( $instance, $_POST );
if ($updated) {
$message->se... | [
"public",
"function",
"update",
"(",
")",
"{",
"$",
"message",
"=",
"new",
"CRUDMessage",
"(",
"\"Modifications were successfully saved\"",
",",
"\"Updating\"",
")",
";",
"$",
"instance",
"=",
"$",
"_SESSION",
"[",
"\"instance\"",
"]",
"??",
"null",
";",
"if",... | Updates an instance from the data posted in a form
@return object The updated instance | [
"Updates",
"an",
"instance",
"from",
"the",
"data",
"posted",
"in",
"a",
"form"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/crud/CRUDController.php#L217-L243 | train |
phpMv/ubiquity | src/Ubiquity/controllers/crud/CRUDController.php | CRUDController.showDetail | public function showDetail($ids) {
if (URequest::isAjax ()) {
$instance = $this->getModelInstance ( $ids );
$viewer = $this->_getModelViewer ();
$hasElements = false;
$model = $this->model;
$fkInstances = CRUDHelper::getFKIntances ( $instance, $model );
$semantic = $this->jquery->semantic ();
$gr... | php | public function showDetail($ids) {
if (URequest::isAjax ()) {
$instance = $this->getModelInstance ( $ids );
$viewer = $this->_getModelViewer ();
$hasElements = false;
$model = $this->model;
$fkInstances = CRUDHelper::getFKIntances ( $instance, $model );
$semantic = $this->jquery->semantic ();
$gr... | [
"public",
"function",
"showDetail",
"(",
"$",
"ids",
")",
"{",
"if",
"(",
"URequest",
"::",
"isAjax",
"(",
")",
")",
"{",
"$",
"instance",
"=",
"$",
"this",
"->",
"getModelInstance",
"(",
"$",
"ids",
")",
";",
"$",
"viewer",
"=",
"$",
"this",
"->",... | Shows associated members with foreign keys
@param mixed $ids | [
"Shows",
"associated",
"members",
"with",
"foreign",
"keys"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/crud/CRUDController.php#L250-L283 | train |
phpMv/ubiquity | src/Ubiquity/controllers/rest/ResponseFormatter.php | ResponseFormatter.getDatas | public function getDatas($objects, &$classname = null) {
$objects = \array_map ( function ($o) use (&$classname) {
return $this->cleanRestObject ( $o, $classname );
}, $objects );
return \array_values ( $objects );
} | php | public function getDatas($objects, &$classname = null) {
$objects = \array_map ( function ($o) use (&$classname) {
return $this->cleanRestObject ( $o, $classname );
}, $objects );
return \array_values ( $objects );
} | [
"public",
"function",
"getDatas",
"(",
"$",
"objects",
",",
"&",
"$",
"classname",
"=",
"null",
")",
"{",
"$",
"objects",
"=",
"\\",
"array_map",
"(",
"function",
"(",
"$",
"o",
")",
"use",
"(",
"&",
"$",
"classname",
")",
"{",
"return",
"$",
"this... | Returns an array of datas from an array of objects
@param array $objects
@param string $classname
@return array | [
"Returns",
"an",
"array",
"of",
"datas",
"from",
"an",
"array",
"of",
"objects"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/rest/ResponseFormatter.php#L37-L42 | train |
phpMv/ubiquity | src/Ubiquity/orm/DAO.php | DAO.connect | public static function connect($dbType, $dbName, $serverName = '127.0.0.1', $port = '3306', $user = 'root', $password = '', $options = [], $cache = false) {
self::$db = new Database ( $dbType, $dbName, $serverName, $port, $user, $password, $options, $cache );
try {
self::$db->connect ();
} catch ( \Exception $... | php | public static function connect($dbType, $dbName, $serverName = '127.0.0.1', $port = '3306', $user = 'root', $password = '', $options = [], $cache = false) {
self::$db = new Database ( $dbType, $dbName, $serverName, $port, $user, $password, $options, $cache );
try {
self::$db->connect ();
} catch ( \Exception $... | [
"public",
"static",
"function",
"connect",
"(",
"$",
"dbType",
",",
"$",
"dbName",
",",
"$",
"serverName",
"=",
"'127.0.0.1'",
",",
"$",
"port",
"=",
"'3306'",
",",
"$",
"user",
"=",
"'root'",
",",
"$",
"password",
"=",
"''",
",",
"$",
"options",
"="... | Establishes the connection to the database using the past parameters
@param string $dbType
@param string $dbName
@param string $serverName
@param string $port
@param string $user
@param string $password
@param array $options
@param boolean $cache | [
"Establishes",
"the",
"connection",
"to",
"the",
"database",
"using",
"the",
"past",
"parameters"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/orm/DAO.php#L228-L236 | train |
phpMv/ubiquity | src/Ubiquity/orm/DAO.php | DAO.isConnected | public static function isConnected() {
return self::$db !== null && (self::$db instanceof Database) && self::$db->isConnected ();
} | php | public static function isConnected() {
return self::$db !== null && (self::$db instanceof Database) && self::$db->isConnected ();
} | [
"public",
"static",
"function",
"isConnected",
"(",
")",
"{",
"return",
"self",
"::",
"$",
"db",
"!==",
"null",
"&&",
"(",
"self",
"::",
"$",
"db",
"instanceof",
"Database",
")",
"&&",
"self",
"::",
"$",
"db",
"->",
"isConnected",
"(",
")",
";",
"}"
... | Returns true if the connection to the database is established
@return boolean | [
"Returns",
"true",
"if",
"the",
"connection",
"to",
"the",
"database",
"is",
"established"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/orm/DAO.php#L255-L257 | train |
phpMv/ubiquity | src/Ubiquity/cache/ClassUtils.php | ClassUtils.getNamespaceFromParts | public static function getNamespaceFromParts($parts) {
$resultArray = [ ];
if (! \is_array ( $parts )) {
$parts = [ $parts ];
}
foreach ( $parts as $part ) {
$resultArray = \array_merge ( $resultArray, \explode ( "\\", $part ) );
}
$resultArray = \array_diff ( $resultArray, [ "" ] );
return \implode... | php | public static function getNamespaceFromParts($parts) {
$resultArray = [ ];
if (! \is_array ( $parts )) {
$parts = [ $parts ];
}
foreach ( $parts as $part ) {
$resultArray = \array_merge ( $resultArray, \explode ( "\\", $part ) );
}
$resultArray = \array_diff ( $resultArray, [ "" ] );
return \implode... | [
"public",
"static",
"function",
"getNamespaceFromParts",
"(",
"$",
"parts",
")",
"{",
"$",
"resultArray",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"\\",
"is_array",
"(",
"$",
"parts",
")",
")",
"{",
"$",
"parts",
"=",
"[",
"$",
"parts",
"]",
";",
"}",
... | Returns a cleanly namespace
@param array|string $parts
@return string | [
"Returns",
"a",
"cleanly",
"namespace"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/cache/ClassUtils.php#L89-L99 | train |
phpMv/ubiquity | src/Ubiquity/cache/ClassUtils.php | ClassUtils.getClassNameWithNS | public static function getClassNameWithNS($defaultNS, $name) {
if (\strpos ( $name, "\\" ) === false) {
$name = $defaultNS . "\\" . $name;
}
return $name;
} | php | public static function getClassNameWithNS($defaultNS, $name) {
if (\strpos ( $name, "\\" ) === false) {
$name = $defaultNS . "\\" . $name;
}
return $name;
} | [
"public",
"static",
"function",
"getClassNameWithNS",
"(",
"$",
"defaultNS",
",",
"$",
"name",
")",
"{",
"if",
"(",
"\\",
"strpos",
"(",
"$",
"name",
",",
"\"\\\\\"",
")",
"===",
"false",
")",
"{",
"$",
"name",
"=",
"$",
"defaultNS",
".",
"\"\\\\\"",
... | Returns the complete name of a class
@param string $defaultNS
@param string $name
@return string | [
"Returns",
"the",
"complete",
"name",
"of",
"a",
"class"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/cache/ClassUtils.php#L145-L150 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/UResponse.php | UResponse.setContentType | public static function setContentType($contentType, $encoding = null) {
$value = $contentType;
if (isset ( $encoding ))
$value .= ' ;charset=' . $encoding;
self::header ( 'Content-Type', $value );
} | php | public static function setContentType($contentType, $encoding = null) {
$value = $contentType;
if (isset ( $encoding ))
$value .= ' ;charset=' . $encoding;
self::header ( 'Content-Type', $value );
} | [
"public",
"static",
"function",
"setContentType",
"(",
"$",
"contentType",
",",
"$",
"encoding",
"=",
"null",
")",
"{",
"$",
"value",
"=",
"$",
"contentType",
";",
"if",
"(",
"isset",
"(",
"$",
"encoding",
")",
")",
"$",
"value",
".=",
"' ;charset='",
... | Sets header content-type
@param string $contentType
@param string $encoding | [
"Sets",
"header",
"content",
"-",
"type"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/UResponse.php#L52-L57 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/USession.php | USession.addOrRemoveValueFromArray | public static function addOrRemoveValueFromArray($arrayKey, $value, $add = null) {
$array = self::getArray ( $arrayKey );
$_SESSION [$arrayKey] = $array;
$search = array_search ( $value, $array );
if ($search === FALSE && $add) {
$_SESSION [$arrayKey] [] = $value;
return true;
} else if ($add !== true) ... | php | public static function addOrRemoveValueFromArray($arrayKey, $value, $add = null) {
$array = self::getArray ( $arrayKey );
$_SESSION [$arrayKey] = $array;
$search = array_search ( $value, $array );
if ($search === FALSE && $add) {
$_SESSION [$arrayKey] [] = $value;
return true;
} else if ($add !== true) ... | [
"public",
"static",
"function",
"addOrRemoveValueFromArray",
"(",
"$",
"arrayKey",
",",
"$",
"value",
",",
"$",
"add",
"=",
"null",
")",
"{",
"$",
"array",
"=",
"self",
"::",
"getArray",
"(",
"$",
"arrayKey",
")",
";",
"$",
"_SESSION",
"[",
"$",
"array... | Adds or removes a value from an array in session
@param string $arrayKey
the key of the array to add or remove in
@param mixed $value
the value to add
@param boolean|null $add
If true, adds otherwise removes
@return boolean | [
"Adds",
"or",
"removes",
"a",
"value",
"from",
"an",
"array",
"in",
"session"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/USession.php#L47-L59 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/USession.php | USession.setBoolean | public static function setBoolean($key, $value) {
$_SESSION [$key] = UString::isBooleanTrue ( $value );
return $_SESSION [$key];
} | php | public static function setBoolean($key, $value) {
$_SESSION [$key] = UString::isBooleanTrue ( $value );
return $_SESSION [$key];
} | [
"public",
"static",
"function",
"setBoolean",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"_SESSION",
"[",
"$",
"key",
"]",
"=",
"UString",
"::",
"isBooleanTrue",
"(",
"$",
"value",
")",
";",
"return",
"$",
"_SESSION",
"[",
"$",
"key",
"]",
... | Sets a boolean value at key position in session
@param string $key
the key to add or set in
@param mixed $value
the value to set
@return boolean | [
"Sets",
"a",
"boolean",
"value",
"at",
"key",
"position",
"in",
"session"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/USession.php#L96-L99 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/USession.php | USession.getBoolean | public static function getBoolean($key) {
self::start ();
$ret = false;
if (isset ( $_SESSION [$key] )) {
$ret = UString::isBooleanTrue ( $_SESSION [$key] );
}
return $ret;
} | php | public static function getBoolean($key) {
self::start ();
$ret = false;
if (isset ( $_SESSION [$key] )) {
$ret = UString::isBooleanTrue ( $_SESSION [$key] );
}
return $ret;
} | [
"public",
"static",
"function",
"getBoolean",
"(",
"$",
"key",
")",
"{",
"self",
"::",
"start",
"(",
")",
";",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"_SESSION",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"ret",
"=",
"UStri... | Returns a boolean stored at the key position in session
@param string $key
the key to add or set
@return boolean | [
"Returns",
"a",
"boolean",
"stored",
"at",
"the",
"key",
"position",
"in",
"session"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/USession.php#L108-L115 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/USession.php | USession.inc | public static function inc($key, $inc = 1) {
return self::set ( $key, self::get ( $key, 0 ) + $inc );
} | php | public static function inc($key, $inc = 1) {
return self::set ( $key, self::get ( $key, 0 ) + $inc );
} | [
"public",
"static",
"function",
"inc",
"(",
"$",
"key",
",",
"$",
"inc",
"=",
"1",
")",
"{",
"return",
"self",
"::",
"set",
"(",
"$",
"key",
",",
"self",
"::",
"get",
"(",
"$",
"key",
",",
"0",
")",
"+",
"$",
"inc",
")",
";",
"}"
] | Increment the value at the key index in session
@param string $key
@param number $inc
@return number | [
"Increment",
"the",
"value",
"at",
"the",
"key",
"index",
"in",
"session"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/USession.php#L216-L218 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/USession.php | USession.dec | public static function dec($key, $dec = 1) {
return self::set ( $key, self::get ( $key, 0 ) - $dec );
} | php | public static function dec($key, $dec = 1) {
return self::set ( $key, self::get ( $key, 0 ) - $dec );
} | [
"public",
"static",
"function",
"dec",
"(",
"$",
"key",
",",
"$",
"dec",
"=",
"1",
")",
"{",
"return",
"self",
"::",
"set",
"(",
"$",
"key",
",",
"self",
"::",
"get",
"(",
"$",
"key",
",",
"0",
")",
"-",
"$",
"dec",
")",
";",
"}"
] | Decrement the value at the key index in session
@param string $key
@param number $dec
@return number | [
"Decrement",
"the",
"value",
"at",
"the",
"key",
"index",
"in",
"session"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/USession.php#L227-L229 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/USession.php | USession.concat | public static function concat($key, $str, $default = NULL) {
return self::set ( $key, self::get ( $key, $default ) . $str );
} | php | public static function concat($key, $str, $default = NULL) {
return self::set ( $key, self::get ( $key, $default ) . $str );
} | [
"public",
"static",
"function",
"concat",
"(",
"$",
"key",
",",
"$",
"str",
",",
"$",
"default",
"=",
"NULL",
")",
"{",
"return",
"self",
"::",
"set",
"(",
"$",
"key",
",",
"self",
"::",
"get",
"(",
"$",
"key",
",",
"$",
"default",
")",
".",
"$... | Adds a string at the end of the value at the key index in session
@param string $key
@param string $str
@return string | [
"Adds",
"a",
"string",
"at",
"the",
"end",
"of",
"the",
"value",
"at",
"the",
"key",
"index",
"in",
"session"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/USession.php#L238-L240 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/USession.php | USession.apply | public static function apply($key, $callback, $default = NULL) {
$value = self::get ( $key, $default );
if (is_string ( $callback ) && function_exists ( $callback )) {
$value = call_user_func ( $callback, $value );
} elseif (is_callable ( $callback )) {
$value = $callback ( $value );
} else {
return $v... | php | public static function apply($key, $callback, $default = NULL) {
$value = self::get ( $key, $default );
if (is_string ( $callback ) && function_exists ( $callback )) {
$value = call_user_func ( $callback, $value );
} elseif (is_callable ( $callback )) {
$value = $callback ( $value );
} else {
return $v... | [
"public",
"static",
"function",
"apply",
"(",
"$",
"key",
",",
"$",
"callback",
",",
"$",
"default",
"=",
"NULL",
")",
"{",
"$",
"value",
"=",
"self",
"::",
"get",
"(",
"$",
"key",
",",
"$",
"default",
")",
";",
"if",
"(",
"is_string",
"(",
"$",
... | Applies a callback function to the value at the key index in session
@param string $key
@param string|callable $callback
@return mixed | [
"Applies",
"a",
"callback",
"function",
"to",
"the",
"value",
"at",
"the",
"key",
"index",
"in",
"session"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/USession.php#L249-L259 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/USession.php | USession.Walk | public static function Walk($callback, $userData = null) {
self::start ();
array_walk ( $_SESSION, $callback, $userData );
return $_SESSION;
} | php | public static function Walk($callback, $userData = null) {
self::start ();
array_walk ( $_SESSION, $callback, $userData );
return $_SESSION;
} | [
"public",
"static",
"function",
"Walk",
"(",
"$",
"callback",
",",
"$",
"userData",
"=",
"null",
")",
"{",
"self",
"::",
"start",
"(",
")",
";",
"array_walk",
"(",
"$",
"_SESSION",
",",
"$",
"callback",
",",
"$",
"userData",
")",
";",
"return",
"$",
... | Apply a user supplied function to every member of Session array
@param callable $callback
@param mixed $userData
@return array | [
"Apply",
"a",
"user",
"supplied",
"function",
"to",
"every",
"member",
"of",
"Session",
"array"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/USession.php#L268-L272 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/USession.php | USession.start | public static function start($name = null) {
if (! self::isStarted ()) {
if (isset ( $name ) && $name !== "") {
self::$name = $name;
}
if (isset ( self::$name )) {
\session_name ( self::$name );
}
\session_start ();
}
} | php | public static function start($name = null) {
if (! self::isStarted ()) {
if (isset ( $name ) && $name !== "") {
self::$name = $name;
}
if (isset ( self::$name )) {
\session_name ( self::$name );
}
\session_start ();
}
} | [
"public",
"static",
"function",
"start",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isStarted",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"name",
")",
"&&",
"$",
"name",
"!==",
"\"\"",
")",
"{",
"self",
"::"... | Start new or resume existing session
@param string|null $name
the name of the session | [
"Start",
"new",
"or",
"resume",
"existing",
"session"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/USession.php#L302-L312 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/USession.php | USession.init | public static function init($key, $value) {
if (! isset ( $_SESSION [$key] )) {
$_SESSION [$key] = $value;
}
return $_SESSION [$key];
} | php | public static function init($key, $value) {
if (! isset ( $_SESSION [$key] )) {
$_SESSION [$key] = $value;
}
return $_SESSION [$key];
} | [
"public",
"static",
"function",
"init",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"_SESSION",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"_SESSION",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"ret... | Initialize the key in Session if key does not exists
@param string $key
@param mixed $value
@return mixed | [
"Initialize",
"the",
"key",
"in",
"Session",
"if",
"key",
"does",
"not",
"exists"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/USession.php#L342-L347 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/USession.php | USession.terminate | public static function terminate() {
if (! self::isStarted ())
return;
self::start ();
$_SESSION = array ();
if (\ini_get ( "session.use_cookies" )) {
$params = \session_get_cookie_params ();
\setcookie ( \session_name (), '', \time () - 42000, $params ["path"], $params ["domain"], $params ["secure"],... | php | public static function terminate() {
if (! self::isStarted ())
return;
self::start ();
$_SESSION = array ();
if (\ini_get ( "session.use_cookies" )) {
$params = \session_get_cookie_params ();
\setcookie ( \session_name (), '', \time () - 42000, $params ["path"], $params ["domain"], $params ["secure"],... | [
"public",
"static",
"function",
"terminate",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isStarted",
"(",
")",
")",
"return",
";",
"self",
"::",
"start",
"(",
")",
";",
"$",
"_SESSION",
"=",
"array",
"(",
")",
";",
"if",
"(",
"\\",
"ini_get",
"... | Terminates the active session | [
"Terminates",
"the",
"active",
"session"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/USession.php#L352-L363 | train |
phpMv/ubiquity | src/Ubiquity/controllers/rest/api/jsonapi/JsonApiResponseFormatter.php | JsonApiResponseFormatter.addPageLinks | protected function addPageLinks(&$r, $classname, $pages) {
$pageSize = $pages ['pageSize'];
unset ( $pages ['pageSize'] );
foreach ( $pages as $page => $number ) {
$r ['links'] [$page] = $this->getLink ( $this->pageLink, [ "baseRoute" => $this->baseRoute,'classname' => $classname,'pageNumber' => $number,'pageS... | php | protected function addPageLinks(&$r, $classname, $pages) {
$pageSize = $pages ['pageSize'];
unset ( $pages ['pageSize'] );
foreach ( $pages as $page => $number ) {
$r ['links'] [$page] = $this->getLink ( $this->pageLink, [ "baseRoute" => $this->baseRoute,'classname' => $classname,'pageNumber' => $number,'pageS... | [
"protected",
"function",
"addPageLinks",
"(",
"&",
"$",
"r",
",",
"$",
"classname",
",",
"$",
"pages",
")",
"{",
"$",
"pageSize",
"=",
"$",
"pages",
"[",
"'pageSize'",
"]",
";",
"unset",
"(",
"$",
"pages",
"[",
"'pageSize'",
"]",
")",
";",
"foreach",... | Adds page links
@param array $r
@param string $classname
@param array $pages | [
"Adds",
"page",
"links"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/rest/api/jsonapi/JsonApiResponseFormatter.php#L82-L88 | train |
phpMv/ubiquity | src/Ubiquity/controllers/crud/CRUDControllerUtilitiesTrait.php | CRUDControllerUtilitiesTrait._deleteMultiple | protected function _deleteMultiple($data, $action, $target, $condition) {
if (URequest::isPost ()) {
if (is_callable ( $condition )) {
$condition = $condition ( $data );
}
$rep = DAO::deleteAll ( $this->model, $condition );
if ($rep) {
$message = new CRUDMessage ( "Deleting {count} objects", "Dele... | php | protected function _deleteMultiple($data, $action, $target, $condition) {
if (URequest::isPost ()) {
if (is_callable ( $condition )) {
$condition = $condition ( $data );
}
$rep = DAO::deleteAll ( $this->model, $condition );
if ($rep) {
$message = new CRUDMessage ( "Deleting {count} objects", "Dele... | [
"protected",
"function",
"_deleteMultiple",
"(",
"$",
"data",
",",
"$",
"action",
",",
"$",
"target",
",",
"$",
"condition",
")",
"{",
"if",
"(",
"URequest",
"::",
"isPost",
"(",
")",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"condition",
")",
")... | Helper to delete multiple objects
@param mixed $data
@param string $action
@param string $target the css selector for refreshing
@param callable|string $condition the callback for generating the SQL where (for deletion) with the parameter data, or a simple string | [
"Helper",
"to",
"delete",
"multiple",
"objects"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/crud/CRUDControllerUtilitiesTrait.php#L135-L157 | train |
phpMv/ubiquity | src/Ubiquity/contents/validation/ValidatorsManagerInitTrait.php | ValidatorsManagerInitTrait.initModelsValidators | public static function initModelsValidators(&$config) {
$models = CacheManager::getModels ( $config, true );
foreach ( $models as $model ) {
self::initClassValidators ( $model );
}
} | php | public static function initModelsValidators(&$config) {
$models = CacheManager::getModels ( $config, true );
foreach ( $models as $model ) {
self::initClassValidators ( $model );
}
} | [
"public",
"static",
"function",
"initModelsValidators",
"(",
"&",
"$",
"config",
")",
"{",
"$",
"models",
"=",
"CacheManager",
"::",
"getModels",
"(",
"$",
"config",
",",
"true",
")",
";",
"foreach",
"(",
"$",
"models",
"as",
"$",
"model",
")",
"{",
"s... | Parses models and save validators in cache
to use in dev only
@param array $config | [
"Parses",
"models",
"and",
"save",
"validators",
"in",
"cache",
"to",
"use",
"in",
"dev",
"only"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/contents/validation/ValidatorsManagerInitTrait.php#L21-L26 | train |
phpMv/ubiquity | src/Ubiquity/controllers/admin/viewers/ModelViewer.php | ModelViewer.getForm | public function getForm($identifier, $instance) {
$form = $this->jquery->semantic ()->dataForm ( $identifier, $instance );
$form->setLibraryId ( "frmEdit" );
$className = \get_class ( $instance );
$fields = $this->controller->_getAdminData ()->getFormFieldNames ( $className, $instance );
$relFields = OrmUtils... | php | public function getForm($identifier, $instance) {
$form = $this->jquery->semantic ()->dataForm ( $identifier, $instance );
$form->setLibraryId ( "frmEdit" );
$className = \get_class ( $instance );
$fields = $this->controller->_getAdminData ()->getFormFieldNames ( $className, $instance );
$relFields = OrmUtils... | [
"public",
"function",
"getForm",
"(",
"$",
"identifier",
",",
"$",
"instance",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"jquery",
"->",
"semantic",
"(",
")",
"->",
"dataForm",
"(",
"$",
"identifier",
",",
"$",
"instance",
")",
";",
"$",
"form",... | Returns the form for adding or modifying an object
@param string $identifier
@param object $instance the object to add or modify
@return \Ajax\semantic\widgets\dataform\DataForm | [
"Returns",
"the",
"form",
"for",
"adding",
"or",
"modifying",
"an",
"object"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/admin/viewers/ModelViewer.php#L60-L83 | train |
phpMv/ubiquity | src/Ubiquity/controllers/admin/viewers/ModelViewer.php | ModelViewer.getFormTitle | protected function getFormTitle($form, $instance) {
$type = ($instance->_new) ? "new" : "edit";
$messageInfos = [ "new" => [ "icon" => HtmlIconGroups::corner ( "table", "plus", "big" ),"subMessage" => "New object creation" ],"edit" => [ "icon" => HtmlIconGroups::corner ( "table", "edit", "big" ),"subMessage" => "Ed... | php | protected function getFormTitle($form, $instance) {
$type = ($instance->_new) ? "new" : "edit";
$messageInfos = [ "new" => [ "icon" => HtmlIconGroups::corner ( "table", "plus", "big" ),"subMessage" => "New object creation" ],"edit" => [ "icon" => HtmlIconGroups::corner ( "table", "edit", "big" ),"subMessage" => "Ed... | [
"protected",
"function",
"getFormTitle",
"(",
"$",
"form",
",",
"$",
"instance",
")",
"{",
"$",
"type",
"=",
"(",
"$",
"instance",
"->",
"_new",
")",
"?",
"\"new\"",
":",
"\"edit\"",
";",
"$",
"messageInfos",
"=",
"[",
"\"new\"",
"=>",
"[",
"\"icon\"",... | Returns an associative array defining form message title with keys "icon","message","subMessage"
@param DataForm $form
@param object $instance
@return array the message title | [
"Returns",
"an",
"associative",
"array",
"defining",
"form",
"message",
"title",
"with",
"keys",
"icon",
"message",
"subMessage"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/admin/viewers/ModelViewer.php#L164-L170 | train |
phpMv/ubiquity | src/Ubiquity/controllers/admin/viewers/ModelViewer.php | ModelViewer.getModelDataElement | public function getModelDataElement($instance, $model, $modal) {
$semantic = $this->jquery->semantic ();
$fields = $this->controller->_getAdminData ()->getElementFieldNames ( $model );
$dataElement = $semantic->dataElement ( "de", $instance );
$pk = OrmUtils::getFirstKeyValue ( $instance );
$dataElement->get... | php | public function getModelDataElement($instance, $model, $modal) {
$semantic = $this->jquery->semantic ();
$fields = $this->controller->_getAdminData ()->getElementFieldNames ( $model );
$dataElement = $semantic->dataElement ( "de", $instance );
$pk = OrmUtils::getFirstKeyValue ( $instance );
$dataElement->get... | [
"public",
"function",
"getModelDataElement",
"(",
"$",
"instance",
",",
"$",
"model",
",",
"$",
"modal",
")",
"{",
"$",
"semantic",
"=",
"$",
"this",
"->",
"jquery",
"->",
"semantic",
"(",
")",
";",
"$",
"fields",
"=",
"$",
"this",
"->",
"controller",
... | Returns a DataElement object for displaying the instance
Used in the display method of the CrudController
in display route
@param object $instance
@param string $model The model class name (long name)
@param boolean $modal
@return \Ajax\semantic\widgets\dataelement\DataElement | [
"Returns",
"a",
"DataElement",
"object",
"for",
"displaying",
"the",
"instance",
"Used",
"in",
"the",
"display",
"method",
"of",
"the",
"CrudController",
"in",
"display",
"route"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/admin/viewers/ModelViewer.php#L233-L255 | train |
phpMv/ubiquity | src/Ubiquity/controllers/admin/viewers/ModelViewer.php | ModelViewer.getModelDataTable | public function getModelDataTable($instances, $model, $totalCount, $page = 1) {
$adminRoute = $this->controller->_getBaseRoute ();
$files = $this->controller->_getFiles ();
$dataTable = $this->getDataTableInstance ( $instances, $model, $totalCount, $page );
$attributes = $this->controller->_getAdminData ()->get... | php | public function getModelDataTable($instances, $model, $totalCount, $page = 1) {
$adminRoute = $this->controller->_getBaseRoute ();
$files = $this->controller->_getFiles ();
$dataTable = $this->getDataTableInstance ( $instances, $model, $totalCount, $page );
$attributes = $this->controller->_getAdminData ()->get... | [
"public",
"function",
"getModelDataTable",
"(",
"$",
"instances",
",",
"$",
"model",
",",
"$",
"totalCount",
",",
"$",
"page",
"=",
"1",
")",
"{",
"$",
"adminRoute",
"=",
"$",
"this",
"->",
"controller",
"->",
"_getBaseRoute",
"(",
")",
";",
"$",
"file... | Returns the dataTable responsible for displaying instances of the model
@param array $instances objects to display
@param string $model model class name (long name)
@return DataTable | [
"Returns",
"the",
"dataTable",
"responsible",
"for",
"displaying",
"instances",
"of",
"the",
"model"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/admin/viewers/ModelViewer.php#L275-L295 | train |
phpMv/ubiquity | src/Ubiquity/controllers/admin/viewers/ModelViewer.php | ModelViewer.getDataTableInstance | protected function getDataTableInstance($instances, $model, $totalCount, $page = 1): DataTable {
$semantic = $this->jquery->semantic ();
$recordsPerPage = $this->recordsPerPage ( $model, $totalCount );
if (is_numeric ( $recordsPerPage )) {
$grpByFields = $this->getGroupByFields ();
if (is_array ( $grpByFiel... | php | protected function getDataTableInstance($instances, $model, $totalCount, $page = 1): DataTable {
$semantic = $this->jquery->semantic ();
$recordsPerPage = $this->recordsPerPage ( $model, $totalCount );
if (is_numeric ( $recordsPerPage )) {
$grpByFields = $this->getGroupByFields ();
if (is_array ( $grpByFiel... | [
"protected",
"function",
"getDataTableInstance",
"(",
"$",
"instances",
",",
"$",
"model",
",",
"$",
"totalCount",
",",
"$",
"page",
"=",
"1",
")",
":",
"DataTable",
"{",
"$",
"semantic",
"=",
"$",
"this",
"->",
"jquery",
"->",
"semantic",
"(",
")",
";... | Returns the dataTable instance for dispaying a list of object
@param array $instances
@param string $model
@param number $totalCount
@param number $page
@return DataTable | [
"Returns",
"the",
"dataTable",
"instance",
"for",
"dispaying",
"a",
"list",
"of",
"object"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/controllers/admin/viewers/ModelViewer.php#L376-L394 | train |
phpMv/ubiquity | src/Ubiquity/themes/ThemesManager.php | ThemesManager.setActiveTheme | public static function setActiveTheme($activeTheme) {
self::$activeTheme = $activeTheme ?? '';
$engineInstance = Startup::$templateEngine;
if ($engineInstance instanceof Twig) {
$engineInstance->setTheme ( $activeTheme, self::THEMES_FOLDER );
} else {
throw new ThemesException ( 'Template engine must be a... | php | public static function setActiveTheme($activeTheme) {
self::$activeTheme = $activeTheme ?? '';
$engineInstance = Startup::$templateEngine;
if ($engineInstance instanceof Twig) {
$engineInstance->setTheme ( $activeTheme, self::THEMES_FOLDER );
} else {
throw new ThemesException ( 'Template engine must be a... | [
"public",
"static",
"function",
"setActiveTheme",
"(",
"$",
"activeTheme",
")",
"{",
"self",
"::",
"$",
"activeTheme",
"=",
"$",
"activeTheme",
"??",
"''",
";",
"$",
"engineInstance",
"=",
"Startup",
"::",
"$",
"templateEngine",
";",
"if",
"(",
"$",
"engin... | Sets the activeTheme
@param string $activeTheme
@throws ThemesException | [
"Sets",
"the",
"activeTheme"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/themes/ThemesManager.php#L37-L45 | train |
phpMv/ubiquity | src/Ubiquity/themes/ThemesManager.php | ThemesManager.getAvailableThemes | public static function getAvailableThemes() {
$path = \ROOT . \DS . 'views' . \DS . self::THEMES_FOLDER . \DS . '*';
$dirs = \glob ( $path, GLOB_ONLYDIR | GLOB_NOSORT );
$result = [ ];
foreach ( $dirs as $dir ) {
$result [] = basename ( $dir );
}
return $result;
} | php | public static function getAvailableThemes() {
$path = \ROOT . \DS . 'views' . \DS . self::THEMES_FOLDER . \DS . '*';
$dirs = \glob ( $path, GLOB_ONLYDIR | GLOB_NOSORT );
$result = [ ];
foreach ( $dirs as $dir ) {
$result [] = basename ( $dir );
}
return $result;
} | [
"public",
"static",
"function",
"getAvailableThemes",
"(",
")",
"{",
"$",
"path",
"=",
"\\",
"ROOT",
".",
"\\",
"DS",
".",
"'views'",
".",
"\\",
"DS",
".",
"self",
"::",
"THEMES_FOLDER",
".",
"\\",
"DS",
".",
"'*'",
";",
"$",
"dirs",
"=",
"\\",
"gl... | Returns the names of available themes.
@return string[] | [
"Returns",
"the",
"names",
"of",
"available",
"themes",
"."
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/themes/ThemesManager.php#L69-L77 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/URequest.php | URequest.getDatas | public static function getDatas() {
$method = \strtolower ( $_SERVER ['REQUEST_METHOD'] );
switch ($method) {
case 'post' :
if (self::getContentType () == 'application/x-www-form-urlencoded') {
return $_POST;
}
break;
case 'get' :
return $_GET;
default :
return self::getInput ();
... | php | public static function getDatas() {
$method = \strtolower ( $_SERVER ['REQUEST_METHOD'] );
switch ($method) {
case 'post' :
if (self::getContentType () == 'application/x-www-form-urlencoded') {
return $_POST;
}
break;
case 'get' :
return $_GET;
default :
return self::getInput ();
... | [
"public",
"static",
"function",
"getDatas",
"(",
")",
"{",
"$",
"method",
"=",
"\\",
"strtolower",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_METHOD'",
"]",
")",
";",
"switch",
"(",
"$",
"method",
")",
"{",
"case",
"'post'",
":",
"if",
"(",
"self",
"::",
"g... | Returns the query data, regardless of the method
@return array | [
"Returns",
"the",
"query",
"data",
"regardless",
"of",
"the",
"method"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/URequest.php#L82-L96 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/URequest.php | URequest.getBoolean | public static function getBoolean($key) {
$ret = false;
if (isset ( $_REQUEST [$key] )) {
$ret = UString::isBooleanTrue ( $_REQUEST [$key] );
}
return $ret;
} | php | public static function getBoolean($key) {
$ret = false;
if (isset ( $_REQUEST [$key] )) {
$ret = UString::isBooleanTrue ( $_REQUEST [$key] );
}
return $ret;
} | [
"public",
"static",
"function",
"getBoolean",
"(",
"$",
"key",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"_REQUEST",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"ret",
"=",
"UString",
"::",
"isBooleanTrue",
"(",
"$",
"_... | Returns a boolean at the key position in request
@param string $key the key to add or set
@return boolean | [
"Returns",
"a",
"boolean",
"at",
"the",
"key",
"position",
"in",
"request"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/URequest.php#L210-L216 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/URequest.php | URequest.getOrigin | public static function getOrigin() {
$headers = getallheaders ();
if (isset ( $headers ['Origin'] )) {
return $headers ['Origin'];
}
if (isset ( $_SERVER ['HTTP_ORIGIN'] )) {
return $_SERVER ['HTTP_ORIGIN'];
} else if (isset ( $_SERVER ['HTTP_REFERER'] )) {
return $_SERVER ['HTTP_REFERER'];
} else ... | php | public static function getOrigin() {
$headers = getallheaders ();
if (isset ( $headers ['Origin'] )) {
return $headers ['Origin'];
}
if (isset ( $_SERVER ['HTTP_ORIGIN'] )) {
return $_SERVER ['HTTP_ORIGIN'];
} else if (isset ( $_SERVER ['HTTP_REFERER'] )) {
return $_SERVER ['HTTP_REFERER'];
} else ... | [
"public",
"static",
"function",
"getOrigin",
"(",
")",
"{",
"$",
"headers",
"=",
"getallheaders",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"headers",
"[",
"'Origin'",
"]",
")",
")",
"{",
"return",
"$",
"headers",
"[",
"'Origin'",
"]",
";",
"}",
... | Returns the request origin
@return string | [
"Returns",
"the",
"request",
"origin"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/URequest.php#L256-L268 | train |
phpMv/ubiquity | src/Ubiquity/cache/system/PhpFastCacheDriver.php | PhpFastCacheDriver.fetch | public function fetch($key) {
$result = $this->cacheInstance->getItem ( $this->getRealKey ( $key ) )->get ();
return eval ( $result );
} | php | public function fetch($key) {
$result = $this->cacheInstance->getItem ( $this->getRealKey ( $key ) )->get ();
return eval ( $result );
} | [
"public",
"function",
"fetch",
"(",
"$",
"key",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"cacheInstance",
"->",
"getItem",
"(",
"$",
"this",
"->",
"getRealKey",
"(",
"$",
"key",
")",
")",
"->",
"get",
"(",
")",
";",
"return",
"eval",
"(",
... | Fetches data stored for the given key.
@param string $key cache key
@return mixed the cached data | [
"Fetches",
"data",
"stored",
"for",
"the",
"given",
"key",
"."
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/cache/system/PhpFastCacheDriver.php#L76-L79 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/UCookie.php | UCookie.set | public static function set($name, $value, $duration = 60*60*24, $path = "/", $secure = false, $httpOnly = false) {
\setcookie ( $name, $value, \time () + $duration, $path, $secure, $httpOnly );
} | php | public static function set($name, $value, $duration = 60*60*24, $path = "/", $secure = false, $httpOnly = false) {
\setcookie ( $name, $value, \time () + $duration, $path, $secure, $httpOnly );
} | [
"public",
"static",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"duration",
"=",
"60",
"*",
"60",
"*",
"24",
",",
"$",
"path",
"=",
"\"/\"",
",",
"$",
"secure",
"=",
"false",
",",
"$",
"httpOnly",
"=",
"false",
")",
"{",
"... | Sends a cookie
@param string $name
the name of the cookie
@param string $value
The value of the cookie.
@param int $duration
default : 1 day
@param string $path
default : / the cookie will be available within the entire domain
@param boolean $secure
Indicates that the cookie should only be transmitted over asecure HTT... | [
"Sends",
"a",
"cookie"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/UCookie.php#L33-L35 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/UCookie.php | UCookie.deleteAll | public static function deleteAll($path = "/") {
foreach ( $_COOKIE as $name => $value ) {
self::delete ( $name, $path );
}
} | php | public static function deleteAll($path = "/") {
foreach ( $_COOKIE as $name => $value ) {
self::delete ( $name, $path );
}
} | [
"public",
"static",
"function",
"deleteAll",
"(",
"$",
"path",
"=",
"\"/\"",
")",
"{",
"foreach",
"(",
"$",
"_COOKIE",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"self",
"::",
"delete",
"(",
"$",
"name",
",",
"$",
"path",
")",
";",
"}",
"}"... | Deletes all cookies | [
"Deletes",
"all",
"cookies"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/UCookie.php#L64-L68 | train |
phpMv/ubiquity | src/Ubiquity/utils/http/UCookie.php | UCookie.setRaw | public static function setRaw($name, $value, $duration = 60*60*24, $path = "/", $secure = false, $httpOnly = false) {
return \setrawcookie ( $name, $value, \time () + $duration, $path, $secure, $httpOnly );
} | php | public static function setRaw($name, $value, $duration = 60*60*24, $path = "/", $secure = false, $httpOnly = false) {
return \setrawcookie ( $name, $value, \time () + $duration, $path, $secure, $httpOnly );
} | [
"public",
"static",
"function",
"setRaw",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"duration",
"=",
"60",
"*",
"60",
"*",
"24",
",",
"$",
"path",
"=",
"\"/\"",
",",
"$",
"secure",
"=",
"false",
",",
"$",
"httpOnly",
"=",
"false",
")",
"{",
... | Sends a raw cookie without urlencoding the cookie value
@param string $name
the name of the cookie
@param string $value
The value of the cookie.
@param int $duration
default : 1 day
@param string $path
default : / the cookie will be available within the entire domain
@param boolean $secure
Indicates that the cookie sh... | [
"Sends",
"a",
"raw",
"cookie",
"without",
"urlencoding",
"the",
"cookie",
"value"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/http/UCookie.php#L99-L101 | train |
phpMv/ubiquity | src/Ubiquity/utils/base/UString.php | UString.pluralize | public static function pluralize($count, $zero, $one, $other) {
$result = $other;
if ($count === 0) {
$result = $zero;
} elseif ($count === 1) {
$result = $one;
}
return \str_replace ( '{count}', $count, $result );
} | php | public static function pluralize($count, $zero, $one, $other) {
$result = $other;
if ($count === 0) {
$result = $zero;
} elseif ($count === 1) {
$result = $one;
}
return \str_replace ( '{count}', $count, $result );
} | [
"public",
"static",
"function",
"pluralize",
"(",
"$",
"count",
",",
"$",
"zero",
",",
"$",
"one",
",",
"$",
"other",
")",
"{",
"$",
"result",
"=",
"$",
"other",
";",
"if",
"(",
"$",
"count",
"===",
"0",
")",
"{",
"$",
"result",
"=",
"$",
"zero... | Pluralize an expression
@param int $count
the count of elements
@param string $zero
value to return if count==0, can contains {count} mask
@param string $one
value to return if count==1, can contains {count} mask
@param string $other
value to return if count>1, can contains {count} mask
@return string the pluralized e... | [
"Pluralize",
"an",
"expression"
] | 284fccf0b4af5da817e31a958b5b67844c459b10 | https://github.com/phpMv/ubiquity/blob/284fccf0b4af5da817e31a958b5b67844c459b10/src/Ubiquity/utils/base/UString.php#L70-L78 | train |
Nexmo/nexmo-php | src/Client.php | Client.get | public function get($url, array $params = [])
{
$queryString = '?' . http_build_query($params);
$url = $url . $queryString;
$request = new Request(
$url,
'GET'
);
return $this->send($request);
} | php | public function get($url, array $params = [])
{
$queryString = '?' . http_build_query($params);
$url = $url . $queryString;
$request = new Request(
$url,
'GET'
);
return $this->send($request);
} | [
"public",
"function",
"get",
"(",
"$",
"url",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"queryString",
"=",
"'?'",
".",
"http_build_query",
"(",
"$",
"params",
")",
";",
"$",
"url",
"=",
"$",
"url",
".",
"$",
"queryString",
";",
... | Takes a URL and a key=>value array to generate a GET PSR-7 request object
@param string $url The URL to make a request to
@param array $params Key=>Value array of data to use as the query string
@return \Psr\Http\Message\ResponseInterface | [
"Takes",
"a",
"URL",
"and",
"a",
"key",
"=",
">",
"value",
"array",
"to",
"generate",
"a",
"GET",
"PSR",
"-",
"7",
"request",
"object"
] | 81e5839d544481b1e942c6d41d9b3b3cfadfd76a | https://github.com/Nexmo/nexmo-php/blob/81e5839d544481b1e942c6d41d9b3b3cfadfd76a/src/Client.php#L273-L285 | train |
Nexmo/nexmo-php | src/Verify/Verification.php | Verification.check | public function check($code, $ip = null)
{
try {
$this->useClient()->check($this, $code, $ip);
return true;
} catch(RequestException $e) {
if($e->getCode() == 16 || $e->getCode() == 17){
return false;
}
throw $e;
}
... | php | public function check($code, $ip = null)
{
try {
$this->useClient()->check($this, $code, $ip);
return true;
} catch(RequestException $e) {
if($e->getCode() == 16 || $e->getCode() == 17){
return false;
}
throw $e;
}
... | [
"public",
"function",
"check",
"(",
"$",
"code",
",",
"$",
"ip",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"useClient",
"(",
")",
"->",
"check",
"(",
"$",
"this",
",",
"$",
"code",
",",
"$",
"ip",
")",
";",
"return",
"true",
";",
... | Check if the code is correct. Unlike the method it proxies, an invalid code does not throw an exception.
@uses \Nexmo\Verify\Client::check()
@param string $code Numeric code provided by the user.
@param null|string $ip IP address to be used for the verification.
@return bool Code is valid.
@throws RequestException | [
"Check",
"if",
"the",
"code",
"is",
"correct",
".",
"Unlike",
"the",
"method",
"it",
"proxies",
"an",
"invalid",
"code",
"does",
"not",
"throw",
"an",
"exception",
"."
] | 81e5839d544481b1e942c6d41d9b3b3cfadfd76a | https://github.com/Nexmo/nexmo-php/blob/81e5839d544481b1e942c6d41d9b3b3cfadfd76a/src/Verify/Verification.php#L90-L102 | train |
Nexmo/nexmo-php | src/Verify/Verification.php | Verification.getChecks | public function getChecks()
{
$checks = $this->proxyArrayAccess('checks');
if(!$checks){
return [];
}
foreach($checks as $i => $check) {
$checks[$i] = new Check($check);
}
return $checks;
} | php | public function getChecks()
{
$checks = $this->proxyArrayAccess('checks');
if(!$checks){
return [];
}
foreach($checks as $i => $check) {
$checks[$i] = new Check($check);
}
return $checks;
} | [
"public",
"function",
"getChecks",
"(",
")",
"{",
"$",
"checks",
"=",
"$",
"this",
"->",
"proxyArrayAccess",
"(",
"'checks'",
")",
";",
"if",
"(",
"!",
"$",
"checks",
")",
"{",
"return",
"[",
"]",
";",
"}",
"foreach",
"(",
"$",
"checks",
"as",
"$",... | Get an array of verification checks, if available. Will return an empty array if no check have been made, or if
the data is not available.
Only available after a searching for a verification.
@see \Nexmo\Verify\Client::search();
However still @uses \Nexmo\Verify\Verification::proxyArrayAccess()
@return \Nexmo\Verify... | [
"Get",
"an",
"array",
"of",
"verification",
"checks",
"if",
"available",
".",
"Will",
"return",
"an",
"empty",
"array",
"if",
"no",
"check",
"have",
"been",
"made",
"or",
"if",
"the",
"data",
"is",
"not",
"available",
"."
] | 81e5839d544481b1e942c6d41d9b3b3cfadfd76a | https://github.com/Nexmo/nexmo-php/blob/81e5839d544481b1e942c6d41d9b3b3cfadfd76a/src/Verify/Verification.php#L380-L392 | train |
Nexmo/nexmo-php | src/Call/Call.php | Call.lazyLoad | protected function lazyLoad()
{
if(!empty($this->data)){
return true;
}
if(isset($this->id)){
$this->get($this);
return true;
}
return false;
} | php | protected function lazyLoad()
{
if(!empty($this->data)){
return true;
}
if(isset($this->id)){
$this->get($this);
return true;
}
return false;
} | [
"protected",
"function",
"lazyLoad",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"data",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"id",
")",
")",
"{",
"$",
"this",
"->",
"get",
... | Returns true if the resource data is loaded.
Will attempt to load the data if it's not already.
@return bool | [
"Returns",
"true",
"if",
"the",
"resource",
"data",
"is",
"loaded",
"."
] | 81e5839d544481b1e942c6d41d9b3b3cfadfd76a | https://github.com/Nexmo/nexmo-php/blob/81e5839d544481b1e942c6d41d9b3b3cfadfd76a/src/Call/Call.php#L231-L243 | train |
ruflin/Elastica | lib/Elastica/Cluster/Health/Index.php | Index.getShards | public function getShards(): array
{
$shards = [];
foreach ($this->_data['shards'] as $shardNumber => $shard) {
$shards[] = new Shard($shardNumber, $shard);
}
return $shards;
} | php | public function getShards(): array
{
$shards = [];
foreach ($this->_data['shards'] as $shardNumber => $shard) {
$shards[] = new Shard($shardNumber, $shard);
}
return $shards;
} | [
"public",
"function",
"getShards",
"(",
")",
":",
"array",
"{",
"$",
"shards",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"[",
"'shards'",
"]",
"as",
"$",
"shardNumber",
"=>",
"$",
"shard",
")",
"{",
"$",
"shards",
"[",
"]",
... | Gets the health of the shards in this index.
@return Shard[] | [
"Gets",
"the",
"health",
"of",
"the",
"shards",
"in",
"this",
"index",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Cluster/Health/Index.php#L129-L137 | train |
ruflin/Elastica | lib/Elastica/Query/FunctionScore.php | FunctionScore.addFunction | public function addFunction(
string $functionType,
$functionParams,
AbstractQuery $filter = null,
float $weight = null
): self {
$function = [
$functionType => $functionParams,
];
if (null !== $filter) {
$function['filter'] = $filter;
... | php | public function addFunction(
string $functionType,
$functionParams,
AbstractQuery $filter = null,
float $weight = null
): self {
$function = [
$functionType => $functionParams,
];
if (null !== $filter) {
$function['filter'] = $filter;
... | [
"public",
"function",
"addFunction",
"(",
"string",
"$",
"functionType",
",",
"$",
"functionParams",
",",
"AbstractQuery",
"$",
"filter",
"=",
"null",
",",
"float",
"$",
"weight",
"=",
"null",
")",
":",
"self",
"{",
"$",
"function",
"=",
"[",
"$",
"funct... | Add a function to the function_score query.
@param string $functionType valid values are DECAY_* constants and script_score
@param array|float|AbstractScript $functionParams the body of the function. See documentation for proper syntax.
@param AbstractQuery $filter filter to ... | [
"Add",
"a",
"function",
"to",
"the",
"function_score",
"query",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Query/FunctionScore.php#L75-L96 | train |
ruflin/Elastica | lib/Elastica/Query/FunctionScore.php | FunctionScore.addScriptScoreFunction | public function addScriptScoreFunction(AbstractScript $script, AbstractQuery $filter = null, float $weight = null)
{
return $this->addFunction('script_score', $script, $filter, $weight);
} | php | public function addScriptScoreFunction(AbstractScript $script, AbstractQuery $filter = null, float $weight = null)
{
return $this->addFunction('script_score', $script, $filter, $weight);
} | [
"public",
"function",
"addScriptScoreFunction",
"(",
"AbstractScript",
"$",
"script",
",",
"AbstractQuery",
"$",
"filter",
"=",
"null",
",",
"float",
"$",
"weight",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"addFunction",
"(",
"'script_score'",
",",
... | Add a script_score function to the query.
@param AbstractScript $script a Script object
@param AbstractQuery $filter an optional filter to apply to the function
@param float $weight the weight of the function
@return $this | [
"Add",
"a",
"script_score",
"function",
"to",
"the",
"query",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Query/FunctionScore.php#L107-L110 | train |
ruflin/Elastica | lib/Elastica/Query/FunctionScore.php | FunctionScore.addDecayFunction | public function addDecayFunction(
string $function,
string $field,
string $origin,
string $scale,
string $offset = null,
float $decay = null,
float $weight = null,
AbstractQuery $filter = null,
string $multiValueMode = null
) {
$functio... | php | public function addDecayFunction(
string $function,
string $field,
string $origin,
string $scale,
string $offset = null,
float $decay = null,
float $weight = null,
AbstractQuery $filter = null,
string $multiValueMode = null
) {
$functio... | [
"public",
"function",
"addDecayFunction",
"(",
"string",
"$",
"function",
",",
"string",
"$",
"field",
",",
"string",
"$",
"origin",
",",
"string",
"$",
"scale",
",",
"string",
"$",
"offset",
"=",
"null",
",",
"float",
"$",
"decay",
"=",
"null",
",",
"... | Add a decay function to the query.
@param string $function see DECAY_* constants for valid options
@param string $field the document field on which to perform the decay function
@param string $origin the origin value for this decay function
@param string $scale ... | [
"Add",
"a",
"decay",
"function",
"to",
"the",
"query",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Query/FunctionScore.php#L127-L156 | train |
ruflin/Elastica | lib/Elastica/Query/FunctionScore.php | FunctionScore.addRandomScoreFunction | public function addRandomScoreFunction(
int $seed,
AbstractQuery $filter = null,
float $weight = null,
string $field = null
): self {
$functionParams = [
'seed' => $seed,
];
if (null !== $field) {
$functionParams['field'] = $field;
... | php | public function addRandomScoreFunction(
int $seed,
AbstractQuery $filter = null,
float $weight = null,
string $field = null
): self {
$functionParams = [
'seed' => $seed,
];
if (null !== $field) {
$functionParams['field'] = $field;
... | [
"public",
"function",
"addRandomScoreFunction",
"(",
"int",
"$",
"seed",
",",
"AbstractQuery",
"$",
"filter",
"=",
"null",
",",
"float",
"$",
"weight",
"=",
"null",
",",
"string",
"$",
"field",
"=",
"null",
")",
":",
"self",
"{",
"$",
"functionParams",
"... | Add a random_score function to the query.
@param int $seed the seed value
@param AbstractQuery $filter a filter associated with this function
@param float $weight an optional boost value associated with this function
@param string $field the field to be used for random number generation
@r... | [
"Add",
"a",
"random_score",
"function",
"to",
"the",
"query",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Query/FunctionScore.php#L216-L231 | train |
ruflin/Elastica | lib/Elastica/Query/FunctionScore.php | FunctionScore.setRandomScore | public function setRandomScore(int $seed = null): self
{
$seedParam = new \stdClass();
if (null !== $seed) {
$seedParam->seed = $seed;
}
return $this->setParam('random_score', $seedParam);
} | php | public function setRandomScore(int $seed = null): self
{
$seedParam = new \stdClass();
if (null !== $seed) {
$seedParam->seed = $seed;
}
return $this->setParam('random_score', $seedParam);
} | [
"public",
"function",
"setRandomScore",
"(",
"int",
"$",
"seed",
"=",
"null",
")",
":",
"self",
"{",
"$",
"seedParam",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"seed",
")",
"{",
"$",
"seedParam",
"->",
"seed",
"="... | If set, this query will return results in random order.
@param int $seed set a seed value to return results in the same random order for consistent pagination
@return $this | [
"If",
"set",
"this",
"query",
"will",
"return",
"results",
"in",
"random",
"order",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Query/FunctionScore.php#L276-L284 | train |
ruflin/Elastica | lib/Elastica/Suggest/Phrase.php | Phrase.setHighlight | public function setHighlight(string $preTag, string $postTag): Phrase
{
return $this->setParam('highlight', [
'pre_tag' => $preTag,
'post_tag' => $postTag,
]);
} | php | public function setHighlight(string $preTag, string $postTag): Phrase
{
return $this->setParam('highlight', [
'pre_tag' => $preTag,
'post_tag' => $postTag,
]);
} | [
"public",
"function",
"setHighlight",
"(",
"string",
"$",
"preTag",
",",
"string",
"$",
"postTag",
")",
":",
"Phrase",
"{",
"return",
"$",
"this",
"->",
"setParam",
"(",
"'highlight'",
",",
"[",
"'pre_tag'",
"=>",
"$",
"preTag",
",",
"'post_tag'",
"=>",
... | Set suggestion highlighting.
@param string $preTag
@param string $postTag
@return $this | [
"Set",
"suggestion",
"highlighting",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Suggest/Phrase.php#L97-L103 | train |
ruflin/Elastica | lib/Elastica/Scroll.php | Scroll.next | public function next()
{
if ($this->currentPage < $this->totalPages) {
$this->_saveOptions();
$this->_search->setOption(Search::OPTION_SCROLL, $this->expiryTime);
$this->_search->setOption(Search::OPTION_SCROLL_ID, $this->_nextScrollId);
$this->_setScrollId(... | php | public function next()
{
if ($this->currentPage < $this->totalPages) {
$this->_saveOptions();
$this->_search->setOption(Search::OPTION_SCROLL, $this->expiryTime);
$this->_search->setOption(Search::OPTION_SCROLL_ID, $this->_nextScrollId);
$this->_setScrollId(... | [
"public",
"function",
"next",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"currentPage",
"<",
"$",
"this",
"->",
"totalPages",
")",
"{",
"$",
"this",
"->",
"_saveOptions",
"(",
")",
";",
"$",
"this",
"->",
"_search",
"->",
"setOption",
"(",
"Search"... | Next scroll search.
@see http://php.net/manual/en/iterator.next.php | [
"Next",
"scroll",
"search",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Scroll.php#L74-L89 | train |
ruflin/Elastica | lib/Elastica/Scroll.php | Scroll.rewind | public function rewind()
{
// reset state
$this->_options = [null, null];
$this->currentPage = 0;
// initial search
$this->_saveOptions();
$this->_search->setOption(Search::OPTION_SCROLL, $this->expiryTime);
$this->_search->setOption(Search::OPTION_SCROLL_ID... | php | public function rewind()
{
// reset state
$this->_options = [null, null];
$this->currentPage = 0;
// initial search
$this->_saveOptions();
$this->_search->setOption(Search::OPTION_SCROLL, $this->expiryTime);
$this->_search->setOption(Search::OPTION_SCROLL_ID... | [
"public",
"function",
"rewind",
"(",
")",
"{",
"// reset state",
"$",
"this",
"->",
"_options",
"=",
"[",
"null",
",",
"null",
"]",
";",
"$",
"this",
"->",
"currentPage",
"=",
"0",
";",
"// initial search",
"$",
"this",
"->",
"_saveOptions",
"(",
")",
... | Initial scroll search.
@see http://php.net/manual/en/iterator.rewind.php | [
"Initial",
"scroll",
"search",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Scroll.php#L120-L134 | train |
ruflin/Elastica | lib/Elastica/Scroll.php | Scroll.clear | public function clear()
{
if (null !== $this->_nextScrollId) {
$this->_search->getClient()->request(
'_search/scroll',
Request::DELETE,
[Search::OPTION_SCROLL_ID => [$this->_nextScrollId]]
);
// Reset scroll ID so valid() r... | php | public function clear()
{
if (null !== $this->_nextScrollId) {
$this->_search->getClient()->request(
'_search/scroll',
Request::DELETE,
[Search::OPTION_SCROLL_ID => [$this->_nextScrollId]]
);
// Reset scroll ID so valid() r... | [
"public",
"function",
"clear",
"(",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"_nextScrollId",
")",
"{",
"$",
"this",
"->",
"_search",
"->",
"getClient",
"(",
")",
"->",
"request",
"(",
"'_search/scroll'",
",",
"Request",
"::",
"DELETE",
"... | Cleares the search context on ES and marks this Scroll instance as finished. | [
"Cleares",
"the",
"search",
"context",
"on",
"ES",
"and",
"marks",
"this",
"Scroll",
"instance",
"as",
"finished",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Scroll.php#L139-L152 | train |
ruflin/Elastica | lib/Elastica/Scroll.php | Scroll._setScrollId | protected function _setScrollId(ResultSet $resultSet)
{
if (0 === $this->currentPage) {
$this->totalPages = $resultSet->count() > 0 ? \ceil($resultSet->getTotalHits() / $resultSet->count()) : 0;
}
$this->_currentResultSet = $resultSet;
++$this->currentPage;
$this... | php | protected function _setScrollId(ResultSet $resultSet)
{
if (0 === $this->currentPage) {
$this->totalPages = $resultSet->count() > 0 ? \ceil($resultSet->getTotalHits() / $resultSet->count()) : 0;
}
$this->_currentResultSet = $resultSet;
++$this->currentPage;
$this... | [
"protected",
"function",
"_setScrollId",
"(",
"ResultSet",
"$",
"resultSet",
")",
"{",
"if",
"(",
"0",
"===",
"$",
"this",
"->",
"currentPage",
")",
"{",
"$",
"this",
"->",
"totalPages",
"=",
"$",
"resultSet",
"->",
"count",
"(",
")",
">",
"0",
"?",
... | Prepares Scroll for next request.
@param ResultSet $resultSet | [
"Prepares",
"Scroll",
"for",
"next",
"request",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Scroll.php#L159-L168 | train |
ruflin/Elastica | lib/Elastica/Scroll.php | Scroll._saveOptions | protected function _saveOptions()
{
if ($this->_search->hasOption(Search::OPTION_SCROLL)) {
$this->_options[0] = $this->_search->getOption(Search::OPTION_SCROLL);
}
if ($this->_search->hasOption(Search::OPTION_SCROLL_ID)) {
$this->_options[1] = $this->_search->getOpt... | php | protected function _saveOptions()
{
if ($this->_search->hasOption(Search::OPTION_SCROLL)) {
$this->_options[0] = $this->_search->getOption(Search::OPTION_SCROLL);
}
if ($this->_search->hasOption(Search::OPTION_SCROLL_ID)) {
$this->_options[1] = $this->_search->getOpt... | [
"protected",
"function",
"_saveOptions",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_search",
"->",
"hasOption",
"(",
"Search",
"::",
"OPTION_SCROLL",
")",
")",
"{",
"$",
"this",
"->",
"_options",
"[",
"0",
"]",
"=",
"$",
"this",
"->",
"_search",
... | Save all search options manipulated by Scroll. | [
"Save",
"all",
"search",
"options",
"manipulated",
"by",
"Scroll",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Scroll.php#L173-L182 | train |
ruflin/Elastica | lib/Elastica/Scroll.php | Scroll._revertOptions | protected function _revertOptions()
{
$this->_search->setOption(Search::OPTION_SCROLL, $this->_options[0]);
$this->_search->setOption(Search::OPTION_SCROLL_ID, $this->_options[1]);
} | php | protected function _revertOptions()
{
$this->_search->setOption(Search::OPTION_SCROLL, $this->_options[0]);
$this->_search->setOption(Search::OPTION_SCROLL_ID, $this->_options[1]);
} | [
"protected",
"function",
"_revertOptions",
"(",
")",
"{",
"$",
"this",
"->",
"_search",
"->",
"setOption",
"(",
"Search",
"::",
"OPTION_SCROLL",
",",
"$",
"this",
"->",
"_options",
"[",
"0",
"]",
")",
";",
"$",
"this",
"->",
"_search",
"->",
"setOption",... | Revert search options to previously saved state. | [
"Revert",
"search",
"options",
"to",
"previously",
"saved",
"state",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Scroll.php#L187-L191 | train |
ruflin/Elastica | lib/Elastica/Search.php | Search.addIndex | public function addIndex($index)
{
if ($index instanceof Index) {
$index = $index->getName();
}
if (!\is_scalar($index)) {
throw new InvalidException('Invalid param type');
}
$this->_indices[] = (string) $index;
return $this;
} | php | public function addIndex($index)
{
if ($index instanceof Index) {
$index = $index->getName();
}
if (!\is_scalar($index)) {
throw new InvalidException('Invalid param type');
}
$this->_indices[] = (string) $index;
return $this;
} | [
"public",
"function",
"addIndex",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"$",
"index",
"instanceof",
"Index",
")",
"{",
"$",
"index",
"=",
"$",
"index",
"->",
"getName",
"(",
")",
";",
"}",
"if",
"(",
"!",
"\\",
"is_scalar",
"(",
"$",
"index",
"... | Adds a index to the list.
@param \Elastica\Index|string $index Index object or string
@throws \Elastica\Exception\InvalidException
@return $this | [
"Adds",
"a",
"index",
"to",
"the",
"list",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Search.php#L99-L112 | train |
ruflin/Elastica | lib/Elastica/Search.php | Search.addType | public function addType($type)
{
if ($type instanceof Type) {
$type = $type->getName();
}
if (!\is_string($type)) {
throw new InvalidException('Invalid type type');
}
$this->_types[] = $type;
return $this;
} | php | public function addType($type)
{
if ($type instanceof Type) {
$type = $type->getName();
}
if (!\is_string($type)) {
throw new InvalidException('Invalid type type');
}
$this->_types[] = $type;
return $this;
} | [
"public",
"function",
"addType",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"instanceof",
"Type",
")",
"{",
"$",
"type",
"=",
"$",
"type",
"->",
"getName",
"(",
")",
";",
"}",
"if",
"(",
"!",
"\\",
"is_string",
"(",
"$",
"type",
")",
"... | Adds a type to the current search.
@param \Elastica\Type|string $type Type name or object
@throws \Elastica\Exception\InvalidException
@return $this | [
"Adds",
"a",
"type",
"to",
"the",
"current",
"search",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Search.php#L139-L152 | train |
ruflin/Elastica | lib/Elastica/Search.php | Search.getPath | public function getPath()
{
if (isset($this->_options[self::OPTION_SCROLL_ID])) {
return '_search/scroll';
}
$indices = $this->getIndices();
$path = '';
$types = $this->getTypes();
if (empty($indices)) {
if (!empty($types)) {
... | php | public function getPath()
{
if (isset($this->_options[self::OPTION_SCROLL_ID])) {
return '_search/scroll';
}
$indices = $this->getIndices();
$path = '';
$types = $this->getTypes();
if (empty($indices)) {
if (!empty($types)) {
... | [
"public",
"function",
"getPath",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_options",
"[",
"self",
"::",
"OPTION_SCROLL_ID",
"]",
")",
")",
"{",
"return",
"'_search/scroll'",
";",
"}",
"$",
"indices",
"=",
"$",
"this",
"->",
"getIndic... | Combines indices and types to the search request path.
@return string Search path | [
"Combines",
"indices",
"and",
"types",
"to",
"the",
"search",
"request",
"path",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Search.php#L407-L432 | train |
ruflin/Elastica | lib/Elastica/Search.php | Search.search | public function search($query = '', $options = null)
{
$this->setOptionsAndQuery($options, $query);
$query = $this->getQuery();
$path = $this->getPath();
$params = $this->getOptions();
// Send scroll_id via raw HTTP body to handle cases of very large (> 4kb) ids.
i... | php | public function search($query = '', $options = null)
{
$this->setOptionsAndQuery($options, $query);
$query = $this->getQuery();
$path = $this->getPath();
$params = $this->getOptions();
// Send scroll_id via raw HTTP body to handle cases of very large (> 4kb) ids.
i... | [
"public",
"function",
"search",
"(",
"$",
"query",
"=",
"''",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setOptionsAndQuery",
"(",
"$",
"options",
",",
"$",
"query",
")",
";",
"$",
"query",
"=",
"$",
"this",
"->",
"getQuery",
"... | Search in the set indices, types.
@param mixed $query
@param int|array $options OPTIONAL Limit or associative array of options (option=>value)
@throws \Elastica\Exception\InvalidException
@return \Elastica\ResultSet | [
"Search",
"in",
"the",
"set",
"indices",
"types",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Search.php#L444-L469 | train |
ruflin/Elastica | lib/Elastica/Query/Ids.php | Ids.setIds | public function setIds($ids): self
{
if (\is_array($ids)) {
$this->_params['values'] = $ids;
} else {
$this->_params['values'] = [$ids];
}
return $this;
} | php | public function setIds($ids): self
{
if (\is_array($ids)) {
$this->_params['values'] = $ids;
} else {
$this->_params['values'] = [$ids];
}
return $this;
} | [
"public",
"function",
"setIds",
"(",
"$",
"ids",
")",
":",
"self",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"ids",
")",
")",
"{",
"$",
"this",
"->",
"_params",
"[",
"'values'",
"]",
"=",
"$",
"ids",
";",
"}",
"else",
"{",
"$",
"this",
"->",
... | Sets the ids to filter.
@param array|string $ids List of ids
@return $this | [
"Sets",
"the",
"ids",
"to",
"filter",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Query/Ids.php#L47-L56 | train |
ruflin/Elastica | lib/Elastica/Status.php | Status.getIndicesWithAlias | public function getIndicesWithAlias($alias)
{
$endpoint = new Get();
$endpoint->setName($alias);
$response = null;
try {
$response = $this->_client->requestEndpoint($endpoint);
} catch (ResponseException $e) {
// 404 means the index alias doesn't exi... | php | public function getIndicesWithAlias($alias)
{
$endpoint = new Get();
$endpoint->setName($alias);
$response = null;
try {
$response = $this->_client->requestEndpoint($endpoint);
} catch (ResponseException $e) {
// 404 means the index alias doesn't exi... | [
"public",
"function",
"getIndicesWithAlias",
"(",
"$",
"alias",
")",
"{",
"$",
"endpoint",
"=",
"new",
"Get",
"(",
")",
";",
"$",
"endpoint",
"->",
"setName",
"(",
"$",
"alias",
")",
";",
"$",
"response",
"=",
"null",
";",
"try",
"{",
"$",
"response"... | Returns an array with all indices that the given alias name points to.
@param string $alias Alias name
@return array|\Elastica\Index[] List of Elastica\Index | [
"Returns",
"an",
"array",
"with",
"all",
"indices",
"that",
"the",
"given",
"alias",
"name",
"points",
"to",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Status.php#L106-L129 | train |
ruflin/Elastica | lib/Elastica/Exception/ResponseException.php | ResponseException.getElasticsearchException | public function getElasticsearchException(): ElasticsearchException
{
$response = $this->getResponse();
return new ElasticsearchException($response->getStatus(), $response->getErrorMessage());
} | php | public function getElasticsearchException(): ElasticsearchException
{
$response = $this->getResponse();
return new ElasticsearchException($response->getStatus(), $response->getErrorMessage());
} | [
"public",
"function",
"getElasticsearchException",
"(",
")",
":",
"ElasticsearchException",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getResponse",
"(",
")",
";",
"return",
"new",
"ElasticsearchException",
"(",
"$",
"response",
"->",
"getStatus",
"(",
")",
... | Returns elasticsearch exception.
@return ElasticsearchException | [
"Returns",
"elasticsearch",
"exception",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Exception/ResponseException.php#L63-L68 | train |
ruflin/Elastica | lib/Elastica/Type/AbstractType.php | AbstractType.create | public function create(bool $recreate = false)
{
$this->getIndex()->create($this->_indexParams, $recreate);
$mapping = new Mapping($this->getType());
$mapping->setProperties($this->_mapping);
$mapping->setSource(['enabled' => $this->_source]);
$mapping->send();
} | php | public function create(bool $recreate = false)
{
$this->getIndex()->create($this->_indexParams, $recreate);
$mapping = new Mapping($this->getType());
$mapping->setProperties($this->_mapping);
$mapping->setSource(['enabled' => $this->_source]);
$mapping->send();
} | [
"public",
"function",
"create",
"(",
"bool",
"$",
"recreate",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"getIndex",
"(",
")",
"->",
"create",
"(",
"$",
"this",
"->",
"_indexParams",
",",
"$",
"recreate",
")",
";",
"$",
"mapping",
"=",
"new",
"Mappin... | Creates the index and sets the mapping for this type.
@param bool $recreate OPTIONAL Recreates the index if true (default = false) | [
"Creates",
"the",
"index",
"and",
"sets",
"the",
"mapping",
"for",
"this",
"type",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Type/AbstractType.php#L128-L136 | train |
ruflin/Elastica | lib/Elastica/Type/AbstractType.php | AbstractType.search | public function search($query = '', $options = null): ResultSet
{
return $this->getType()->search($query, $options = null);
} | php | public function search($query = '', $options = null): ResultSet
{
return $this->getType()->search($query, $options = null);
} | [
"public",
"function",
"search",
"(",
"$",
"query",
"=",
"''",
",",
"$",
"options",
"=",
"null",
")",
":",
"ResultSet",
"{",
"return",
"$",
"this",
"->",
"getType",
"(",
")",
"->",
"search",
"(",
"$",
"query",
",",
"$",
"options",
"=",
"null",
")",
... | Search on the type.
@param string|array|Query $query Array with all query data inside or a Elastica\Query object
@param int|array $options
@return ResultSet with all results inside
@see \Elastica\SearchableInterface::search | [
"Search",
"on",
"the",
"type",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Type/AbstractType.php#L159-L162 | train |
ruflin/Elastica | lib/Elastica/Aggregation/Percentiles.php | Percentiles.setHdr | public function setHdr(string $key, float $value): self
{
$compression = [$key => $value];
return $this->setParam('hdr', $compression);
} | php | public function setHdr(string $key, float $value): self
{
$compression = [$key => $value];
return $this->setParam('hdr', $compression);
} | [
"public",
"function",
"setHdr",
"(",
"string",
"$",
"key",
",",
"float",
"$",
"value",
")",
":",
"self",
"{",
"$",
"compression",
"=",
"[",
"$",
"key",
"=>",
"$",
"value",
"]",
";",
"return",
"$",
"this",
"->",
"setParam",
"(",
"'hdr'",
",",
"$",
... | Set hdr parameter.
@param string $key
@param float $value
@return $this | [
"Set",
"hdr",
"parameter",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Aggregation/Percentiles.php#L47-L52 | train |
ruflin/Elastica | lib/Elastica/Query/SpanTerm.php | SpanTerm.setTerm | public function setTerm(string $key, $value, float $boost = 1.0): self
{
return $this->setRawTerm([$key => ['value' => $value, 'boost' => $boost]]);
} | php | public function setTerm(string $key, $value, float $boost = 1.0): self
{
return $this->setRawTerm([$key => ['value' => $value, 'boost' => $boost]]);
} | [
"public",
"function",
"setTerm",
"(",
"string",
"$",
"key",
",",
"$",
"value",
",",
"float",
"$",
"boost",
"=",
"1.0",
")",
":",
"self",
"{",
"return",
"$",
"this",
"->",
"setRawTerm",
"(",
"[",
"$",
"key",
"=>",
"[",
"'value'",
"=>",
"$",
"value",... | Adds a term to the term query.
@param string $key Key to query
@param string|array $value Values(s) for the query. Boost can be set with array
@param float $boost OPTIONAL Boost value (default = 1.0)
@return $this | [
"Adds",
"a",
"term",
"to",
"the",
"term",
"query",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Query/SpanTerm.php#L47-L50 | train |
ruflin/Elastica | lib/Elastica/ResultSet.php | ResultSet.getAggregation | public function getAggregation($name)
{
$data = $this->_response->getData();
if (isset($data['aggregations']) && isset($data['aggregations'][$name])) {
return $data['aggregations'][$name];
}
throw new InvalidException("This result set does not contain an aggregation name... | php | public function getAggregation($name)
{
$data = $this->_response->getData();
if (isset($data['aggregations']) && isset($data['aggregations'][$name])) {
return $data['aggregations'][$name];
}
throw new InvalidException("This result set does not contain an aggregation name... | [
"public",
"function",
"getAggregation",
"(",
"$",
"name",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"_response",
"->",
"getData",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'aggregations'",
"]",
")",
"&&",
"isset",
"(",
"$",
"d... | Retrieve a specific aggregation from this result set.
@param string $name the name of the desired aggregation
@throws Exception\InvalidException if an aggregation by the given name cannot be found
@return array | [
"Retrieve",
"a",
"specific",
"aggregation",
"from",
"this",
"result",
"set",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/ResultSet.php#L141-L149 | train |
ruflin/Elastica | lib/Elastica/Query/Prefix.php | Prefix.setPrefix | public function setPrefix(string $key, $value, float $boost = 1.0): self
{
return $this->setRawPrefix([$key => ['value' => $value, 'boost' => $boost]]);
} | php | public function setPrefix(string $key, $value, float $boost = 1.0): self
{
return $this->setRawPrefix([$key => ['value' => $value, 'boost' => $boost]]);
} | [
"public",
"function",
"setPrefix",
"(",
"string",
"$",
"key",
",",
"$",
"value",
",",
"float",
"$",
"boost",
"=",
"1.0",
")",
":",
"self",
"{",
"return",
"$",
"this",
"->",
"setRawPrefix",
"(",
"[",
"$",
"key",
"=>",
"[",
"'value'",
"=>",
"$",
"val... | Adds a prefix to the prefix query.
@param string $key Key to query
@param string|array $value Values(s) for the query. Boost can be set with array
@param float $boost OPTIONAL Boost value (default = 1.0)
@return $this | [
"Adds",
"a",
"prefix",
"to",
"the",
"prefix",
"query",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Query/Prefix.php#L44-L47 | train |
ruflin/Elastica | lib/Elastica/QueryBuilder/DSL/Aggregation.php | Aggregation.sum_bucket | public function sum_bucket(string $name, string $bucketsPath = null): SumBucket
{
return new SumBucket($name, $bucketsPath);
} | php | public function sum_bucket(string $name, string $bucketsPath = null): SumBucket
{
return new SumBucket($name, $bucketsPath);
} | [
"public",
"function",
"sum_bucket",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"bucketsPath",
"=",
"null",
")",
":",
"SumBucket",
"{",
"return",
"new",
"SumBucket",
"(",
"$",
"name",
",",
"$",
"bucketsPath",
")",
";",
"}"
] | sum bucket aggregation.
@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-sum-bucket-aggregation.html
@param string $name
@param string|null $bucketsPath
@return SumBucket | [
"sum",
"bucket",
"aggregation",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/QueryBuilder/DSL/Aggregation.php#L110-L113 | train |
ruflin/Elastica | lib/Elastica/QueryBuilder/DSL/Aggregation.php | Aggregation.avg_bucket | public function avg_bucket(string $name, string $bucketsPath = null): AvgBucket
{
return new AvgBucket($name, $bucketsPath);
} | php | public function avg_bucket(string $name, string $bucketsPath = null): AvgBucket
{
return new AvgBucket($name, $bucketsPath);
} | [
"public",
"function",
"avg_bucket",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"bucketsPath",
"=",
"null",
")",
":",
"AvgBucket",
"{",
"return",
"new",
"AvgBucket",
"(",
"$",
"name",
",",
"$",
"bucketsPath",
")",
";",
"}"
] | avg bucket aggregation.
@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-avg-bucket-aggregation.html
@param string $name
@param string|null $bucketsPath
@return AvgBucket | [
"avg",
"bucket",
"aggregation",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/QueryBuilder/DSL/Aggregation.php#L139-L142 | train |
ruflin/Elastica | lib/Elastica/QueryBuilder/DSL/Aggregation.php | Aggregation.percentiles | public function percentiles(string $name, string $field = null): Percentiles
{
return new Percentiles($name, $field);
} | php | public function percentiles(string $name, string $field = null): Percentiles
{
return new Percentiles($name, $field);
} | [
"public",
"function",
"percentiles",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"field",
"=",
"null",
")",
":",
"Percentiles",
"{",
"return",
"new",
"Percentiles",
"(",
"$",
"name",
",",
"$",
"field",
")",
";",
"}"
] | percentiles aggregation.
@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-percentile-aggregation.html
@param string $name the name of this aggregation
@param string $field the field on which to perform this aggregation
@return Percentiles | [
"percentiles",
"aggregation",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/QueryBuilder/DSL/Aggregation.php#L197-L200 | train |
ruflin/Elastica | lib/Elastica/QueryBuilder/DSL/Aggregation.php | Aggregation.scripted_metric | public function scripted_metric(
string $name,
string $initScript = null,
string $mapScript = null,
string $combineScript = null,
string $reduceScript = null
): ScriptedMetric {
return new ScriptedMetric($name, $initScript, $mapScript, $combineScript, $reduceScript);
... | php | public function scripted_metric(
string $name,
string $initScript = null,
string $mapScript = null,
string $combineScript = null,
string $reduceScript = null
): ScriptedMetric {
return new ScriptedMetric($name, $initScript, $mapScript, $combineScript, $reduceScript);
... | [
"public",
"function",
"scripted_metric",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"initScript",
"=",
"null",
",",
"string",
"$",
"mapScript",
"=",
"null",
",",
"string",
"$",
"combineScript",
"=",
"null",
",",
"string",
"$",
"reduceScript",
"=",
"nu... | scripted metric aggregation.
@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-scripted-metric-aggregation.html
@param string $name
@param string|null $initScript
@param string|null $mapScript
@param string|null $combineScript
@param string|null $reduceScript
@retu... | [
"scripted",
"metric",
"aggregation",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/QueryBuilder/DSL/Aggregation.php#L267-L275 | train |
ruflin/Elastica | lib/Elastica/QueryBuilder/DSL/Aggregation.php | Aggregation.filter | public function filter(string $name, AbstractQuery $filter = null): Filter
{
return new Filter($name, $filter);
} | php | public function filter(string $name, AbstractQuery $filter = null): Filter
{
return new Filter($name, $filter);
} | [
"public",
"function",
"filter",
"(",
"string",
"$",
"name",
",",
"AbstractQuery",
"$",
"filter",
"=",
"null",
")",
":",
"Filter",
"{",
"return",
"new",
"Filter",
"(",
"$",
"name",
",",
"$",
"filter",
")",
";",
"}"
] | filter aggregation.
@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filter-aggregation.html
@param string $name
@param AbstractQuery $filter
@return Filter | [
"filter",
"aggregation",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/QueryBuilder/DSL/Aggregation.php#L301-L304 | train |
ruflin/Elastica | lib/Elastica/QueryBuilder/DSL/Aggregation.php | Aggregation.reverse_nested | public function reverse_nested(string $name, string $path = null): ReverseNested
{
return new ReverseNested($name, $path);
} | php | public function reverse_nested(string $name, string $path = null): ReverseNested
{
return new ReverseNested($name, $path);
} | [
"public",
"function",
"reverse_nested",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"path",
"=",
"null",
")",
":",
"ReverseNested",
"{",
"return",
"new",
"ReverseNested",
"(",
"$",
"name",
",",
"$",
"path",
")",
";",
"}"
] | reverse nested aggregation.
@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-reverse-nested-aggregation.html
@param string $name The name of this aggregation
@param string $path Optional path to the nested object for this aggregation. Defaults to the root of the main doc... | [
"reverse",
"nested",
"aggregation",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/QueryBuilder/DSL/Aggregation.php#L360-L363 | train |
ruflin/Elastica | lib/Elastica/QueryBuilder/DSL/Aggregation.php | Aggregation.histogram | public function histogram(string $name, string $field, $interval): Histogram
{
return new Histogram($name, $field, $interval);
} | php | public function histogram(string $name, string $field, $interval): Histogram
{
return new Histogram($name, $field, $interval);
} | [
"public",
"function",
"histogram",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"field",
",",
"$",
"interval",
")",
":",
"Histogram",
"{",
"return",
"new",
"Histogram",
"(",
"$",
"name",
",",
"$",
"field",
",",
"$",
"interval",
")",
";",
"}"
] | histogram aggregation.
@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html
@param string $name the name of this aggregation
@param string $field the name of the field on which to perform the aggregation
@param int $interval the interval ... | [
"histogram",
"aggregation",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/QueryBuilder/DSL/Aggregation.php#L459-L462 | train |
ruflin/Elastica | lib/Elastica/QueryBuilder/DSL/Aggregation.php | Aggregation.date_histogram | public function date_histogram(string $name, string $field, $interval): DateHistogram
{
return new DateHistogram($name, $field, $interval);
} | php | public function date_histogram(string $name, string $field, $interval): DateHistogram
{
return new DateHistogram($name, $field, $interval);
} | [
"public",
"function",
"date_histogram",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"field",
",",
"$",
"interval",
")",
":",
"DateHistogram",
"{",
"return",
"new",
"DateHistogram",
"(",
"$",
"name",
",",
"$",
"field",
",",
"$",
"interval",
")",
";",
... | date histogram aggregation.
@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html
@param string $name the name of this aggregation
@param string $field the name of the field on which to perform the aggregation
@param int|string $i... | [
"date",
"histogram",
"aggregation",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/QueryBuilder/DSL/Aggregation.php#L475-L478 | train |
ruflin/Elastica | lib/Elastica/QueryBuilder/DSL/Aggregation.php | Aggregation.geo_distance | public function geo_distance(string $name, string $field, $origin): GeoDistance
{
return new GeoDistance($name, $field, $origin);
} | php | public function geo_distance(string $name, string $field, $origin): GeoDistance
{
return new GeoDistance($name, $field, $origin);
} | [
"public",
"function",
"geo_distance",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"field",
",",
"$",
"origin",
")",
":",
"GeoDistance",
"{",
"return",
"new",
"GeoDistance",
"(",
"$",
"name",
",",
"$",
"field",
",",
"$",
"origin",
")",
";",
"}"
] | geo distance aggregation.
@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geodistance-aggregation.html
@param string $name the name if this aggregation
@param string $field the field on which to perform this aggregation
@param string|array $origin the poi... | [
"geo",
"distance",
"aggregation",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/QueryBuilder/DSL/Aggregation.php#L491-L494 | train |
ruflin/Elastica | lib/Elastica/QueryBuilder/DSL/Aggregation.php | Aggregation.bucket_script | public function bucket_script(string $name, array $bucketsPath = null, string $script = null): BucketScript
{
return new BucketScript($name, $bucketsPath, $script);
} | php | public function bucket_script(string $name, array $bucketsPath = null, string $script = null): BucketScript
{
return new BucketScript($name, $bucketsPath, $script);
} | [
"public",
"function",
"bucket_script",
"(",
"string",
"$",
"name",
",",
"array",
"$",
"bucketsPath",
"=",
"null",
",",
"string",
"$",
"script",
"=",
"null",
")",
":",
"BucketScript",
"{",
"return",
"new",
"BucketScript",
"(",
"$",
"name",
",",
"$",
"buck... | bucket script aggregation.
@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-script-aggregation.html
@param string $name
@param array|null $bucketsPath
@param string|null $script
@return BucketScript | [
"bucket",
"script",
"aggregation",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/QueryBuilder/DSL/Aggregation.php#L522-L525 | train |
ruflin/Elastica | lib/Elastica/QueryBuilder/DSL/Aggregation.php | Aggregation.serial_diff | public function serial_diff(string $name, string $bucketsPath = null): SerialDiff
{
return new SerialDiff($name, $bucketsPath);
} | php | public function serial_diff(string $name, string $bucketsPath = null): SerialDiff
{
return new SerialDiff($name, $bucketsPath);
} | [
"public",
"function",
"serial_diff",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"bucketsPath",
"=",
"null",
")",
":",
"SerialDiff",
"{",
"return",
"new",
"SerialDiff",
"(",
"$",
"name",
",",
"$",
"bucketsPath",
")",
";",
"}"
] | serial diff aggregation.
@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-serialdiff-aggregation.html
@param string $name
@param string|null $bucketsPath
@return SerialDiff | [
"serial",
"diff",
"aggregation",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/QueryBuilder/DSL/Aggregation.php#L537-L540 | train |
ruflin/Elastica | lib/Elastica/Query/MoreLikeThis.php | MoreLikeThis.setAnalyzer | public function setAnalyzer(string $analyzer): self
{
$analyzer = \trim($analyzer);
return $this->setParam('analyzer', $analyzer);
} | php | public function setAnalyzer(string $analyzer): self
{
$analyzer = \trim($analyzer);
return $this->setParam('analyzer', $analyzer);
} | [
"public",
"function",
"setAnalyzer",
"(",
"string",
"$",
"analyzer",
")",
":",
"self",
"{",
"$",
"analyzer",
"=",
"\\",
"trim",
"(",
"$",
"analyzer",
")",
";",
"return",
"$",
"this",
"->",
"setParam",
"(",
"'analyzer'",
",",
"$",
"analyzer",
")",
";",
... | Set analyzer.
@param string $analyzer
@return $this | [
"Set",
"analyzer",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Query/MoreLikeThis.php#L141-L146 | train |
ruflin/Elastica | lib/Elastica/Transport/Http.php | Http._setupCurl | protected function _setupCurl($curlConnection)
{
if ($this->getConnection()->hasConfig('curl')) {
foreach ($this->getConnection()->getConfig('curl') as $key => $param) {
\curl_setopt($curlConnection, $key, $param);
}
}
} | php | protected function _setupCurl($curlConnection)
{
if ($this->getConnection()->hasConfig('curl')) {
foreach ($this->getConnection()->getConfig('curl') as $key => $param) {
\curl_setopt($curlConnection, $key, $param);
}
}
} | [
"protected",
"function",
"_setupCurl",
"(",
"$",
"curlConnection",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getConnection",
"(",
")",
"->",
"hasConfig",
"(",
"'curl'",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getConnection",
"(",
")",
"->",
"... | Called to add additional curl params.
@param resource $curlConnection Curl connection | [
"Called",
"to",
"add",
"additional",
"curl",
"params",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Transport/Http.php#L202-L209 | train |
ruflin/Elastica | lib/Elastica/Transport/Http.php | Http._getConnection | protected function _getConnection(bool $persistent = true)
{
if (!$persistent || !self::$_curlConnection) {
self::$_curlConnection = \curl_init();
}
return self::$_curlConnection;
} | php | protected function _getConnection(bool $persistent = true)
{
if (!$persistent || !self::$_curlConnection) {
self::$_curlConnection = \curl_init();
}
return self::$_curlConnection;
} | [
"protected",
"function",
"_getConnection",
"(",
"bool",
"$",
"persistent",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"persistent",
"||",
"!",
"self",
"::",
"$",
"_curlConnection",
")",
"{",
"self",
"::",
"$",
"_curlConnection",
"=",
"\\",
"curl_init",
... | Return Curl resource.
@param bool $persistent False if not persistent connection
@return resource Connection resource | [
"Return",
"Curl",
"resource",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Transport/Http.php#L218-L225 | train |
ruflin/Elastica | lib/Elastica/Task.php | Task.refresh | public function refresh(array $options = [])
{
$endpoint = new \Elasticsearch\Endpoints\Tasks\Get();
$endpoint->setTaskId($this->_id);
$endpoint->setParams($options);
$this->_response = $this->_client->requestEndpoint($endpoint);
$this->_data = $this->getResponse()->getData(... | php | public function refresh(array $options = [])
{
$endpoint = new \Elasticsearch\Endpoints\Tasks\Get();
$endpoint->setTaskId($this->_id);
$endpoint->setParams($options);
$this->_response = $this->_client->requestEndpoint($endpoint);
$this->_data = $this->getResponse()->getData(... | [
"public",
"function",
"refresh",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"endpoint",
"=",
"new",
"\\",
"Elasticsearch",
"\\",
"Endpoints",
"\\",
"Tasks",
"\\",
"Get",
"(",
")",
";",
"$",
"endpoint",
"->",
"setTaskId",
"(",
"$",
"t... | Refresh task status.
@param array $options Options for endpoint | [
"Refresh",
"task",
"status",
"."
] | 9bda1596f79a28534dfd7b3513443478ad152e4e | https://github.com/ruflin/Elastica/blob/9bda1596f79a28534dfd7b3513443478ad152e4e/lib/Elastica/Task.php#L93-L101 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.