id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
sequence
docstring
stringlengths
3
47.2k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
91
247
12,400
PytoCryto/PytoTPL
src/Compiler.php
Compiler.wrap
public function wrap($content, $end = ';', $newLine = false) { return '<?php ' . $content . $end . ' ?>' . ($newLine === true ? PHP_EOL : ''); }
php
public function wrap($content, $end = ';', $newLine = false) { return '<?php ' . $content . $end . ' ?>' . ($newLine === true ? PHP_EOL : ''); }
[ "public", "function", "wrap", "(", "$", "content", ",", "$", "end", "=", "';'", ",", "$", "newLine", "=", "false", ")", "{", "return", "'<?php '", ".", "$", "content", ".", "$", "end", ".", "' ?>'", ".", "(", "$", "newLine", "===", "true", "?", "PHP_EOL", ":", "''", ")", ";", "}" ]
Wrap the given value in PHP tags @param string $content @param null|string $end @param bool $newLine @return string
[ "Wrap", "the", "given", "value", "in", "PHP", "tags" ]
a130fb26d57b888871a5b047fba970a5fafd4131
https://github.com/PytoCryto/PytoTPL/blob/a130fb26d57b888871a5b047fba970a5fafd4131/src/Compiler.php#L153-L156
12,401
nours/TableBundle
Renderer/TwigRenderer.php
TwigRenderer.setTheme
public function setTheme(View $view, $themes) { $cacheKey = $this->getCacheKey($view); $this->themes[$cacheKey] = $themes; }
php
public function setTheme(View $view, $themes) { $cacheKey = $this->getCacheKey($view); $this->themes[$cacheKey] = $themes; }
[ "public", "function", "setTheme", "(", "View", "$", "view", ",", "$", "themes", ")", "{", "$", "cacheKey", "=", "$", "this", "->", "getCacheKey", "(", "$", "view", ")", ";", "$", "this", "->", "themes", "[", "$", "cacheKey", "]", "=", "$", "themes", ";", "}" ]
Sets a theme for a table view @param View $view @param $themes
[ "Sets", "a", "theme", "for", "a", "table", "view" ]
0fb5bd7cc13008fb7890037b1a1ccb02d047c329
https://github.com/nours/TableBundle/blob/0fb5bd7cc13008fb7890037b1a1ccb02d047c329/Renderer/TwigRenderer.php#L66-L71
12,402
nours/TableBundle
Renderer/TwigRenderer.php
TwigRenderer.loadTemplates
private function loadTemplates(array $themes) { $templates = array(); foreach ($themes as $theme) { $key = is_object($theme) ? spl_object_hash($theme) : $theme; if (!isset($this->templates[$key])) { $template = $this->twig->load($theme); $this->templates[$key] = $template; } $templates[] = $this->templates[$key]; } return $templates; }
php
private function loadTemplates(array $themes) { $templates = array(); foreach ($themes as $theme) { $key = is_object($theme) ? spl_object_hash($theme) : $theme; if (!isset($this->templates[$key])) { $template = $this->twig->load($theme); $this->templates[$key] = $template; } $templates[] = $this->templates[$key]; } return $templates; }
[ "private", "function", "loadTemplates", "(", "array", "$", "themes", ")", "{", "$", "templates", "=", "array", "(", ")", ";", "foreach", "(", "$", "themes", "as", "$", "theme", ")", "{", "$", "key", "=", "is_object", "(", "$", "theme", ")", "?", "spl_object_hash", "(", "$", "theme", ")", ":", "$", "theme", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "templates", "[", "$", "key", "]", ")", ")", "{", "$", "template", "=", "$", "this", "->", "twig", "->", "load", "(", "$", "theme", ")", ";", "$", "this", "->", "templates", "[", "$", "key", "]", "=", "$", "template", ";", "}", "$", "templates", "[", "]", "=", "$", "this", "->", "templates", "[", "$", "key", "]", ";", "}", "return", "$", "templates", ";", "}" ]
Loads the templates used by current theme.
[ "Loads", "the", "templates", "used", "by", "current", "theme", "." ]
0fb5bd7cc13008fb7890037b1a1ccb02d047c329
https://github.com/nours/TableBundle/blob/0fb5bd7cc13008fb7890037b1a1ccb02d047c329/Renderer/TwigRenderer.php#L76-L92
12,403
echo511/TreeTraversal
src/Tree.php
Tree.moveNode
public function moveNode($headId, $targetId = null, $mode = self::MODE_UNDER) { $head = $this->getNode($headId); $target = $this->getNode($targetId); switch ($mode) { case self::MODE_BEFORE: $operation = new MoveBefore($head, $target, $this->config, $this); break; case self::MODE_AFTER: $operation = new MoveAfter($head, $target, $this->config, $this); break; case self::MODE_UNDER: $operation = new MoveUnderEnd($head, $target, $this->config, $this); break; } $operation->run(); }
php
public function moveNode($headId, $targetId = null, $mode = self::MODE_UNDER) { $head = $this->getNode($headId); $target = $this->getNode($targetId); switch ($mode) { case self::MODE_BEFORE: $operation = new MoveBefore($head, $target, $this->config, $this); break; case self::MODE_AFTER: $operation = new MoveAfter($head, $target, $this->config, $this); break; case self::MODE_UNDER: $operation = new MoveUnderEnd($head, $target, $this->config, $this); break; } $operation->run(); }
[ "public", "function", "moveNode", "(", "$", "headId", ",", "$", "targetId", "=", "null", ",", "$", "mode", "=", "self", "::", "MODE_UNDER", ")", "{", "$", "head", "=", "$", "this", "->", "getNode", "(", "$", "headId", ")", ";", "$", "target", "=", "$", "this", "->", "getNode", "(", "$", "targetId", ")", ";", "switch", "(", "$", "mode", ")", "{", "case", "self", "::", "MODE_BEFORE", ":", "$", "operation", "=", "new", "MoveBefore", "(", "$", "head", ",", "$", "target", ",", "$", "this", "->", "config", ",", "$", "this", ")", ";", "break", ";", "case", "self", "::", "MODE_AFTER", ":", "$", "operation", "=", "new", "MoveAfter", "(", "$", "head", ",", "$", "target", ",", "$", "this", "->", "config", ",", "$", "this", ")", ";", "break", ";", "case", "self", "::", "MODE_UNDER", ":", "$", "operation", "=", "new", "MoveUnderEnd", "(", "$", "head", ",", "$", "target", ",", "$", "this", "->", "config", ",", "$", "this", ")", ";", "break", ";", "}", "$", "operation", "->", "run", "(", ")", ";", "}" ]
Move head node to target node. @param mixed $headId @param mixed $targetId @param int $mode
[ "Move", "head", "node", "to", "target", "node", "." ]
7d748c90df4a1941e7c1ad4578f892bc1414c189
https://github.com/echo511/TreeTraversal/blob/7d748c90df4a1941e7c1ad4578f892bc1414c189/src/Tree.php#L108-L126
12,404
echo511/TreeTraversal
src/Tree.php
Tree.deleteNode
public function deleteNode($nodeId) { $node = $this->getNode($nodeId); $operation = new Operations\Delete($node, $this->config, $this); $operation->run(); }
php
public function deleteNode($nodeId) { $node = $this->getNode($nodeId); $operation = new Operations\Delete($node, $this->config, $this); $operation->run(); }
[ "public", "function", "deleteNode", "(", "$", "nodeId", ")", "{", "$", "node", "=", "$", "this", "->", "getNode", "(", "$", "nodeId", ")", ";", "$", "operation", "=", "new", "Operations", "\\", "Delete", "(", "$", "node", ",", "$", "this", "->", "config", ",", "$", "this", ")", ";", "$", "operation", "->", "run", "(", ")", ";", "}" ]
Delete node and its children. @param int $nodeId
[ "Delete", "node", "and", "its", "children", "." ]
7d748c90df4a1941e7c1ad4578f892bc1414c189
https://github.com/echo511/TreeTraversal/blob/7d748c90df4a1941e7c1ad4578f892bc1414c189/src/Tree.php#L132-L138
12,405
echo511/TreeTraversal
src/Tree.php
Tree.isChildOf
public function isChildOf($head, $target) { if (!is_array($head)) { $head = $this->getNode($head); } if (!is_array($target)) { $target = $this->getNode($target); } $config = $this->config; $headLft = $head[$config['lft']]; $headRgt = $head[$config['rgt']]; $targetLft = $target[$config['lft']]; $targetRgt = $target[$config['rgt']]; if ($headLft > $targetLft && $headRgt < $targetRgt) { return TRUE; } else { return FALSE; } }
php
public function isChildOf($head, $target) { if (!is_array($head)) { $head = $this->getNode($head); } if (!is_array($target)) { $target = $this->getNode($target); } $config = $this->config; $headLft = $head[$config['lft']]; $headRgt = $head[$config['rgt']]; $targetLft = $target[$config['lft']]; $targetRgt = $target[$config['rgt']]; if ($headLft > $targetLft && $headRgt < $targetRgt) { return TRUE; } else { return FALSE; } }
[ "public", "function", "isChildOf", "(", "$", "head", ",", "$", "target", ")", "{", "if", "(", "!", "is_array", "(", "$", "head", ")", ")", "{", "$", "head", "=", "$", "this", "->", "getNode", "(", "$", "head", ")", ";", "}", "if", "(", "!", "is_array", "(", "$", "target", ")", ")", "{", "$", "target", "=", "$", "this", "->", "getNode", "(", "$", "target", ")", ";", "}", "$", "config", "=", "$", "this", "->", "config", ";", "$", "headLft", "=", "$", "head", "[", "$", "config", "[", "'lft'", "]", "]", ";", "$", "headRgt", "=", "$", "head", "[", "$", "config", "[", "'rgt'", "]", "]", ";", "$", "targetLft", "=", "$", "target", "[", "$", "config", "[", "'lft'", "]", "]", ";", "$", "targetRgt", "=", "$", "target", "[", "$", "config", "[", "'rgt'", "]", "]", ";", "if", "(", "$", "headLft", ">", "$", "targetLft", "&&", "$", "headRgt", "<", "$", "targetRgt", ")", "{", "return", "TRUE", ";", "}", "else", "{", "return", "FALSE", ";", "}", "}" ]
Is head node child of target node? @param type $head @param type $target
[ "Is", "head", "node", "child", "of", "target", "node?" ]
7d748c90df4a1941e7c1ad4578f892bc1414c189
https://github.com/echo511/TreeTraversal/blob/7d748c90df4a1941e7c1ad4578f892bc1414c189/src/Tree.php#L145-L163
12,406
echo511/TreeTraversal
src/Tree.php
Tree.getChildren
public function getChildren($headId, $relativeDepth = null, $summarize = false) { $head = $this->getNode($headId); $config = $this->config; $query = $this->table() ->select(null) ->select("$config[id] AS id") ->where("$config[lft] > ?", $head['lft']) ->where("$config[rgt] < ?", $head['rgt']); if (!is_null($relativeDepth)) { $absoluteDepth = $relativeDepth + $head['dpt']; if ($summarize) { $query->where("$config[dpt] <= ?", $absoluteDepth); } else { $query->where("$config[dpt] = ?", $absoluteDepth); } } $children = $query->fetchAll(); return array_map(function($key) { return $key['id']; }, $children); }
php
public function getChildren($headId, $relativeDepth = null, $summarize = false) { $head = $this->getNode($headId); $config = $this->config; $query = $this->table() ->select(null) ->select("$config[id] AS id") ->where("$config[lft] > ?", $head['lft']) ->where("$config[rgt] < ?", $head['rgt']); if (!is_null($relativeDepth)) { $absoluteDepth = $relativeDepth + $head['dpt']; if ($summarize) { $query->where("$config[dpt] <= ?", $absoluteDepth); } else { $query->where("$config[dpt] = ?", $absoluteDepth); } } $children = $query->fetchAll(); return array_map(function($key) { return $key['id']; }, $children); }
[ "public", "function", "getChildren", "(", "$", "headId", ",", "$", "relativeDepth", "=", "null", ",", "$", "summarize", "=", "false", ")", "{", "$", "head", "=", "$", "this", "->", "getNode", "(", "$", "headId", ")", ";", "$", "config", "=", "$", "this", "->", "config", ";", "$", "query", "=", "$", "this", "->", "table", "(", ")", "->", "select", "(", "null", ")", "->", "select", "(", "\"$config[id] AS id\"", ")", "->", "where", "(", "\"$config[lft] > ?\"", ",", "$", "head", "[", "'lft'", "]", ")", "->", "where", "(", "\"$config[rgt] < ?\"", ",", "$", "head", "[", "'rgt'", "]", ")", ";", "if", "(", "!", "is_null", "(", "$", "relativeDepth", ")", ")", "{", "$", "absoluteDepth", "=", "$", "relativeDepth", "+", "$", "head", "[", "'dpt'", "]", ";", "if", "(", "$", "summarize", ")", "{", "$", "query", "->", "where", "(", "\"$config[dpt] <= ?\"", ",", "$", "absoluteDepth", ")", ";", "}", "else", "{", "$", "query", "->", "where", "(", "\"$config[dpt] = ?\"", ",", "$", "absoluteDepth", ")", ";", "}", "}", "$", "children", "=", "$", "query", "->", "fetchAll", "(", ")", ";", "return", "array_map", "(", "function", "(", "$", "key", ")", "{", "return", "$", "key", "[", "'id'", "]", ";", "}", ",", "$", "children", ")", ";", "}" ]
Get IDs of children nodes. @param mixed $headId @param int|null Eg. 1 - children, 2 - grandchildren. @param bool If enabled and $relativeDepth = 2 then select children and grandchildren. @return array
[ "Get", "IDs", "of", "children", "nodes", "." ]
7d748c90df4a1941e7c1ad4578f892bc1414c189
https://github.com/echo511/TreeTraversal/blob/7d748c90df4a1941e7c1ad4578f892bc1414c189/src/Tree.php#L172-L196
12,407
echo511/TreeTraversal
src/Tree.php
Tree.getParents
public function getParents($headId) { $head = $this->getNode($headId); $config = $this->config; $parents = $this->table() ->select(null) ->select("$config[id] AS id") ->where("$config[lft] < ?", $head['lft']) ->where("$config[rgt] > ?", $head['rgt']) ->where("$config[dpt] < ?", $head['dpt']) ->orderBy($config['lft']) ->fetchAll(); return array_map(function($key) { return $key['id']; }, $parents); }
php
public function getParents($headId) { $head = $this->getNode($headId); $config = $this->config; $parents = $this->table() ->select(null) ->select("$config[id] AS id") ->where("$config[lft] < ?", $head['lft']) ->where("$config[rgt] > ?", $head['rgt']) ->where("$config[dpt] < ?", $head['dpt']) ->orderBy($config['lft']) ->fetchAll(); return array_map(function($key) { return $key['id']; }, $parents); }
[ "public", "function", "getParents", "(", "$", "headId", ")", "{", "$", "head", "=", "$", "this", "->", "getNode", "(", "$", "headId", ")", ";", "$", "config", "=", "$", "this", "->", "config", ";", "$", "parents", "=", "$", "this", "->", "table", "(", ")", "->", "select", "(", "null", ")", "->", "select", "(", "\"$config[id] AS id\"", ")", "->", "where", "(", "\"$config[lft] < ?\"", ",", "$", "head", "[", "'lft'", "]", ")", "->", "where", "(", "\"$config[rgt] > ?\"", ",", "$", "head", "[", "'rgt'", "]", ")", "->", "where", "(", "\"$config[dpt] < ?\"", ",", "$", "head", "[", "'dpt'", "]", ")", "->", "orderBy", "(", "$", "config", "[", "'lft'", "]", ")", "->", "fetchAll", "(", ")", ";", "return", "array_map", "(", "function", "(", "$", "key", ")", "{", "return", "$", "key", "[", "'id'", "]", ";", "}", ",", "$", "parents", ")", ";", "}" ]
Get parents in order, the big boss first. @param type $headId @return type
[ "Get", "parents", "in", "order", "the", "big", "boss", "first", "." ]
7d748c90df4a1941e7c1ad4578f892bc1414c189
https://github.com/echo511/TreeTraversal/blob/7d748c90df4a1941e7c1ad4578f892bc1414c189/src/Tree.php#L203-L219
12,408
echo511/TreeTraversal
src/Tree.php
Tree.getNode
protected function getNode($id) { $config = $this->config; return $this->table() ->select(null) ->select("$config[id] AS id, $config[lft] AS lft, $config[rgt] AS rgt, $config[dpt] AS dpt, $config[prt] AS prt") ->where($config['id'], $id) ->fetch(); }
php
protected function getNode($id) { $config = $this->config; return $this->table() ->select(null) ->select("$config[id] AS id, $config[lft] AS lft, $config[rgt] AS rgt, $config[dpt] AS dpt, $config[prt] AS prt") ->where($config['id'], $id) ->fetch(); }
[ "protected", "function", "getNode", "(", "$", "id", ")", "{", "$", "config", "=", "$", "this", "->", "config", ";", "return", "$", "this", "->", "table", "(", ")", "->", "select", "(", "null", ")", "->", "select", "(", "\"$config[id] AS id, $config[lft] AS lft, $config[rgt] AS rgt, $config[dpt] AS dpt, $config[prt] AS prt\"", ")", "->", "where", "(", "$", "config", "[", "'id'", "]", ",", "$", "id", ")", "->", "fetch", "(", ")", ";", "}" ]
Return single node tree data. @param mixed $id @return array
[ "Return", "single", "node", "tree", "data", "." ]
7d748c90df4a1941e7c1ad4578f892bc1414c189
https://github.com/echo511/TreeTraversal/blob/7d748c90df4a1941e7c1ad4578f892bc1414c189/src/Tree.php#L244-L252
12,409
atelierspierrot/validators
src/Validator/HostnameValidator.php
HostnameValidator.setMustPass
public function setMustPass($ref) { if (null!==$this->getMask($ref)) { $this->must_pass = $ref; } else { throw new \Exception(sprintf("Unknown standard [%s] in Hostname validation!", $ref)); } }
php
public function setMustPass($ref) { if (null!==$this->getMask($ref)) { $this->must_pass = $ref; } else { throw new \Exception(sprintf("Unknown standard [%s] in Hostname validation!", $ref)); } }
[ "public", "function", "setMustPass", "(", "$", "ref", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "getMask", "(", "$", "ref", ")", ")", "{", "$", "this", "->", "must_pass", "=", "$", "ref", ";", "}", "else", "{", "throw", "new", "\\", "Exception", "(", "sprintf", "(", "\"Unknown standard [%s] in Hostname validation!\"", ",", "$", "ref", ")", ")", ";", "}", "}" ]
Defines the RFC to validate @param string $ref @throws \Exception if the `$ref` is not a known RFC
[ "Defines", "the", "RFC", "to", "validate" ]
6c97b10bfe8324b33771f24cee8c722d7bc3bb15
https://github.com/atelierspierrot/validators/blob/6c97b10bfe8324b33771f24cee8c722d7bc3bb15/src/Validator/HostnameValidator.php#L145-L152
12,410
Sowapps/orpheus-inputcontroller
src/InputController/HTTPController/HTTPRoute.php
HTTPRoute.prepare
public function prepare(InputRequest $request) { $routeOptions = $this->getOptions(); if( !isset($routeOptions['session']) || $routeOptions['session'] ) { startSession(); } }
php
public function prepare(InputRequest $request) { $routeOptions = $this->getOptions(); if( !isset($routeOptions['session']) || $routeOptions['session'] ) { startSession(); } }
[ "public", "function", "prepare", "(", "InputRequest", "$", "request", ")", "{", "$", "routeOptions", "=", "$", "this", "->", "getOptions", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "routeOptions", "[", "'session'", "]", ")", "||", "$", "routeOptions", "[", "'session'", "]", ")", "{", "startSession", "(", ")", ";", "}", "}" ]
Prepare environment for this route @param HTTPRequest $request
[ "Prepare", "environment", "for", "this", "route" ]
91f848a42ac02ae4009ffb3e9a9b4e8c0731455e
https://github.com/Sowapps/orpheus-inputcontroller/blob/91f848a42ac02ae4009ffb3e9a9b4e8c0731455e/src/InputController/HTTPController/HTTPRoute.php#L98-L103
12,411
Sowapps/orpheus-inputcontroller
src/InputController/HTTPController/HTTPRoute.php
HTTPRoute.extractVariable
protected static function extractVariable($str, &$var=null, &$regex=null) { list($p1, $p2) = explodeList(':', $str, 2); // Optionnal only if there is a default value if( $p2 ) { // {regex|type:variable} $var = $p2; $regex = $p1; if( ctype_alpha($regex) && isset(static::$typesRegex[$regex]) ) { $regex = static::$typesRegex[$regex]; } } else { // {variable}, regex=[^\/]+ $var = $p1; $regex = '[^\/]+'; } }
php
protected static function extractVariable($str, &$var=null, &$regex=null) { list($p1, $p2) = explodeList(':', $str, 2); // Optionnal only if there is a default value if( $p2 ) { // {regex|type:variable} $var = $p2; $regex = $p1; if( ctype_alpha($regex) && isset(static::$typesRegex[$regex]) ) { $regex = static::$typesRegex[$regex]; } } else { // {variable}, regex=[^\/]+ $var = $p1; $regex = '[^\/]+'; } }
[ "protected", "static", "function", "extractVariable", "(", "$", "str", ",", "&", "$", "var", "=", "null", ",", "&", "$", "regex", "=", "null", ")", "{", "list", "(", "$", "p1", ",", "$", "p2", ")", "=", "explodeList", "(", "':'", ",", "$", "str", ",", "2", ")", ";", "// Optionnal only if there is a default value", "if", "(", "$", "p2", ")", "{", "// {regex|type:variable}", "$", "var", "=", "$", "p2", ";", "$", "regex", "=", "$", "p1", ";", "if", "(", "ctype_alpha", "(", "$", "regex", ")", "&&", "isset", "(", "static", "::", "$", "typesRegex", "[", "$", "regex", "]", ")", ")", "{", "$", "regex", "=", "static", "::", "$", "typesRegex", "[", "$", "regex", "]", ";", "}", "}", "else", "{", "// {variable}, regex=[^\\/]+", "$", "var", "=", "$", "p1", ";", "$", "regex", "=", "'[^\\/]+'", ";", "}", "}" ]
Extract variable from configuration string @param string $str @param string $var @param string $regex
[ "Extract", "variable", "from", "configuration", "string" ]
91f848a42ac02ae4009ffb3e9a9b4e8c0731455e
https://github.com/Sowapps/orpheus-inputcontroller/blob/91f848a42ac02ae4009ffb3e9a9b4e8c0731455e/src/InputController/HTTPController/HTTPRoute.php#L148-L163
12,412
Sowapps/orpheus-inputcontroller
src/InputController/HTTPController/HTTPRoute.php
HTTPRoute.generatePathRegex
protected function generatePathRegex() { if( $this->pathRegex ) { return; } $variables = array(); $this->pathRegex = preg_replace_callback( '#\{([^\}]+)\}#sm', function($matches) use(&$variables) { // debug('$matches', $matches); $regex = $var = null; static::extractVariable(str_replace('\.', '.', $matches[1]), $var, $regex); $variables[] = $var; return '('.$regex.')'; }, str_replace('.', '\.', $this->path) ); $this->pathVariables = $variables; }
php
protected function generatePathRegex() { if( $this->pathRegex ) { return; } $variables = array(); $this->pathRegex = preg_replace_callback( '#\{([^\}]+)\}#sm', function($matches) use(&$variables) { // debug('$matches', $matches); $regex = $var = null; static::extractVariable(str_replace('\.', '.', $matches[1]), $var, $regex); $variables[] = $var; return '('.$regex.')'; }, str_replace('.', '\.', $this->path) ); $this->pathVariables = $variables; }
[ "protected", "function", "generatePathRegex", "(", ")", "{", "if", "(", "$", "this", "->", "pathRegex", ")", "{", "return", ";", "}", "$", "variables", "=", "array", "(", ")", ";", "$", "this", "->", "pathRegex", "=", "preg_replace_callback", "(", "'#\\{([^\\}]+)\\}#sm'", ",", "function", "(", "$", "matches", ")", "use", "(", "&", "$", "variables", ")", "{", "// \t\t\t\tdebug('$matches', $matches);", "$", "regex", "=", "$", "var", "=", "null", ";", "static", "::", "extractVariable", "(", "str_replace", "(", "'\\.'", ",", "'.'", ",", "$", "matches", "[", "1", "]", ")", ",", "$", "var", ",", "$", "regex", ")", ";", "$", "variables", "[", "]", "=", "$", "var", ";", "return", "'('", ".", "$", "regex", ".", "')'", ";", "}", ",", "str_replace", "(", "'.'", ",", "'\\.'", ",", "$", "this", "->", "path", ")", ")", ";", "$", "this", "->", "pathVariables", "=", "$", "variables", ";", "}" ]
Generate all regex of the path from extracted variables
[ "Generate", "all", "regex", "of", "the", "path", "from", "extracted", "variables" ]
91f848a42ac02ae4009ffb3e9a9b4e8c0731455e
https://github.com/Sowapps/orpheus-inputcontroller/blob/91f848a42ac02ae4009ffb3e9a9b4e8c0731455e/src/InputController/HTTPController/HTTPRoute.php#L168-L183
12,413
hirnsturm/typo3-extbase-services
TYPO3/Extbase/Domain/Model/BaseValueObject.php
BaseValueObject.getCheckedUidsAsArray
public function getCheckedUidsAsArray($property) { $array = array(); $entities = $this->{'get' . ucfirst($property)}(); foreach ($entities as $item) { $array[$item->getUid()] = $item->getUid(); } return $array; }
php
public function getCheckedUidsAsArray($property) { $array = array(); $entities = $this->{'get' . ucfirst($property)}(); foreach ($entities as $item) { $array[$item->getUid()] = $item->getUid(); } return $array; }
[ "public", "function", "getCheckedUidsAsArray", "(", "$", "property", ")", "{", "$", "array", "=", "array", "(", ")", ";", "$", "entities", "=", "$", "this", "->", "{", "'get'", ".", "ucfirst", "(", "$", "property", ")", "}", "(", ")", ";", "foreach", "(", "$", "entities", "as", "$", "item", ")", "{", "$", "array", "[", "$", "item", "->", "getUid", "(", ")", "]", "=", "$", "item", "->", "getUid", "(", ")", ";", "}", "return", "$", "array", ";", "}" ]
Returns the UIDs of releated entites as array @param string $property @return array
[ "Returns", "the", "UIDs", "of", "releated", "entites", "as", "array" ]
1cdb97eb260267ea5e5610e802d20a5453296bb1
https://github.com/hirnsturm/typo3-extbase-services/blob/1cdb97eb260267ea5e5610e802d20a5453296bb1/TYPO3/Extbase/Domain/Model/BaseValueObject.php#L22-L32
12,414
hirnsturm/typo3-extbase-services
TYPO3/Extbase/Domain/Model/BaseValueObject.php
BaseValueObject.has
public function has($property) { if (is_array($property)) { foreach ($property as $item) { if (is_a($this->{$item}, '\\TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage')) { return ($this->{$item}->count()) ? true : false; } else { return (!empty($this->{$item})) ? true : false; } } } else { if (is_a($this->{$property}, '\\TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage')) { return ($this->{$property}->count()) ? true : false; } else { return (!empty($this->{$property})) ? true : false; } } }
php
public function has($property) { if (is_array($property)) { foreach ($property as $item) { if (is_a($this->{$item}, '\\TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage')) { return ($this->{$item}->count()) ? true : false; } else { return (!empty($this->{$item})) ? true : false; } } } else { if (is_a($this->{$property}, '\\TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage')) { return ($this->{$property}->count()) ? true : false; } else { return (!empty($this->{$property})) ? true : false; } } }
[ "public", "function", "has", "(", "$", "property", ")", "{", "if", "(", "is_array", "(", "$", "property", ")", ")", "{", "foreach", "(", "$", "property", "as", "$", "item", ")", "{", "if", "(", "is_a", "(", "$", "this", "->", "{", "$", "item", "}", ",", "'\\\\TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage'", ")", ")", "{", "return", "(", "$", "this", "->", "{", "$", "item", "}", "->", "count", "(", ")", ")", "?", "true", ":", "false", ";", "}", "else", "{", "return", "(", "!", "empty", "(", "$", "this", "->", "{", "$", "item", "}", ")", ")", "?", "true", ":", "false", ";", "}", "}", "}", "else", "{", "if", "(", "is_a", "(", "$", "this", "->", "{", "$", "property", "}", ",", "'\\\\TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\ObjectStorage'", ")", ")", "{", "return", "(", "$", "this", "->", "{", "$", "property", "}", "->", "count", "(", ")", ")", "?", "true", ":", "false", ";", "}", "else", "{", "return", "(", "!", "empty", "(", "$", "this", "->", "{", "$", "property", "}", ")", ")", "?", "true", ":", "false", ";", "}", "}", "}" ]
Checks if a property has value @param mixed $property array|string @return boolean
[ "Checks", "if", "a", "property", "has", "value" ]
1cdb97eb260267ea5e5610e802d20a5453296bb1
https://github.com/hirnsturm/typo3-extbase-services/blob/1cdb97eb260267ea5e5610e802d20a5453296bb1/TYPO3/Extbase/Domain/Model/BaseValueObject.php#L40-L57
12,415
jivoo/core
src/Utilities.php
Utilities.dashesToCamelCase
public static function dashesToCamelCase($dashes) { $words = explode('-', $dashes); $camelCase = ''; foreach ($words as $word) { $camelCase .= ucfirst($word); } return $camelCase; }
php
public static function dashesToCamelCase($dashes) { $words = explode('-', $dashes); $camelCase = ''; foreach ($words as $word) { $camelCase .= ucfirst($word); } return $camelCase; }
[ "public", "static", "function", "dashesToCamelCase", "(", "$", "dashes", ")", "{", "$", "words", "=", "explode", "(", "'-'", ",", "$", "dashes", ")", ";", "$", "camelCase", "=", "''", ";", "foreach", "(", "$", "words", "as", "$", "word", ")", "{", "$", "camelCase", ".=", "ucfirst", "(", "$", "word", ")", ";", "}", "return", "$", "camelCase", ";", "}" ]
Convert a lowercase dash-separated name to a camel case class-name. E.g. from "camel-case" to "CamelCase". @param string $dashes Dash-separated string @return string A camel case string
[ "Convert", "a", "lowercase", "dash", "-", "separated", "name", "to", "a", "camel", "case", "class", "-", "name", ".", "E", ".", "g", ".", "from", "camel", "-", "case", "to", "CamelCase", "." ]
4ef3445068f0ff9c0a6512cb741831a847013b76
https://github.com/jivoo/core/blob/4ef3445068f0ff9c0a6512cb741831a847013b76/src/Utilities.php#L85-L93
12,416
jivoo/core
src/Utilities.php
Utilities.underscoresToCamelCase
public static function underscoresToCamelCase($underscores) { $words = explode('_', $underscores); $camelCase = ''; foreach ($words as $word) { $camelCase .= ucfirst($word); } return $camelCase; }
php
public static function underscoresToCamelCase($underscores) { $words = explode('_', $underscores); $camelCase = ''; foreach ($words as $word) { $camelCase .= ucfirst($word); } return $camelCase; }
[ "public", "static", "function", "underscoresToCamelCase", "(", "$", "underscores", ")", "{", "$", "words", "=", "explode", "(", "'_'", ",", "$", "underscores", ")", ";", "$", "camelCase", "=", "''", ";", "foreach", "(", "$", "words", "as", "$", "word", ")", "{", "$", "camelCase", ".=", "ucfirst", "(", "$", "word", ")", ";", "}", "return", "$", "camelCase", ";", "}" ]
Convert a lowercase underscore-separated name to a camel case class-name. E.g. from "camel_case" to "CamelCase". @param string $underscores Underscores-separated string @return string A camel case string
[ "Convert", "a", "lowercase", "underscore", "-", "separated", "name", "to", "a", "camel", "case", "class", "-", "name", ".", "E", ".", "g", ".", "from", "camel_case", "to", "CamelCase", "." ]
4ef3445068f0ff9c0a6512cb741831a847013b76
https://github.com/jivoo/core/blob/4ef3445068f0ff9c0a6512cb741831a847013b76/src/Utilities.php#L103-L111
12,417
jivoo/core
src/Utilities.php
Utilities.getNamespace
public static function getNamespace($className) { if (is_object($className)) { $className = get_class($className); } if (strpos($className, '\\') === false) { return ''; } return preg_replace('/\\\\[^\\\\]+$/', '', $className); }
php
public static function getNamespace($className) { if (is_object($className)) { $className = get_class($className); } if (strpos($className, '\\') === false) { return ''; } return preg_replace('/\\\\[^\\\\]+$/', '', $className); }
[ "public", "static", "function", "getNamespace", "(", "$", "className", ")", "{", "if", "(", "is_object", "(", "$", "className", ")", ")", "{", "$", "className", "=", "get_class", "(", "$", "className", ")", ";", "}", "if", "(", "strpos", "(", "$", "className", ",", "'\\\\'", ")", "===", "false", ")", "{", "return", "''", ";", "}", "return", "preg_replace", "(", "'/\\\\\\\\[^\\\\\\\\]+$/'", ",", "''", ",", "$", "className", ")", ";", "}" ]
Get namespace part of a class name. @param string|object $className Class or object, e.g. 'Jivoo\Utilities'. @return string Namespace, e.g. 'Jivoo'.
[ "Get", "namespace", "part", "of", "a", "class", "name", "." ]
4ef3445068f0ff9c0a6512cb741831a847013b76
https://github.com/jivoo/core/blob/4ef3445068f0ff9c0a6512cb741831a847013b76/src/Utilities.php#L133-L142
12,418
jivoo/core
src/Utilities.php
Utilities.getClassName
public static function getClassName($className) { if (is_object($className)) { $className = get_class($className); } $className = array_slice(explode('\\', $className), - 1); return $className[0]; }
php
public static function getClassName($className) { if (is_object($className)) { $className = get_class($className); } $className = array_slice(explode('\\', $className), - 1); return $className[0]; }
[ "public", "static", "function", "getClassName", "(", "$", "className", ")", "{", "if", "(", "is_object", "(", "$", "className", ")", ")", "{", "$", "className", "=", "get_class", "(", "$", "className", ")", ";", "}", "$", "className", "=", "array_slice", "(", "explode", "(", "'\\\\'", ",", "$", "className", ")", ",", "-", "1", ")", ";", "return", "$", "className", "[", "0", "]", ";", "}" ]
Get class name part of a qualified class name. @param string|object $className Class or object, e.g. 'Jivoo\Utilities'. @return string Class name, e.g. 'Utilities'.
[ "Get", "class", "name", "part", "of", "a", "qualified", "class", "name", "." ]
4ef3445068f0ff9c0a6512cb741831a847013b76
https://github.com/jivoo/core/blob/4ef3445068f0ff9c0a6512cb741831a847013b76/src/Utilities.php#L151-L158
12,419
jivoo/core
src/Utilities.php
Utilities.getCaller
public static function getCaller() { $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); if (isset($backtrace[2])) { $caller = ''; if (isset($backtrace[2]['class'])) { $caller = $backtrace[2]['class'] . $backtrace[2]['type']; } $caller .= $backtrace[2]['function']; return $caller; } return '{null}'; }
php
public static function getCaller() { $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); if (isset($backtrace[2])) { $caller = ''; if (isset($backtrace[2]['class'])) { $caller = $backtrace[2]['class'] . $backtrace[2]['type']; } $caller .= $backtrace[2]['function']; return $caller; } return '{null}'; }
[ "public", "static", "function", "getCaller", "(", ")", "{", "$", "backtrace", "=", "debug_backtrace", "(", "DEBUG_BACKTRACE_IGNORE_ARGS", ",", "3", ")", ";", "if", "(", "isset", "(", "$", "backtrace", "[", "2", "]", ")", ")", "{", "$", "caller", "=", "''", ";", "if", "(", "isset", "(", "$", "backtrace", "[", "2", "]", "[", "'class'", "]", ")", ")", "{", "$", "caller", "=", "$", "backtrace", "[", "2", "]", "[", "'class'", "]", ".", "$", "backtrace", "[", "2", "]", "[", "'type'", "]", ";", "}", "$", "caller", ".=", "$", "backtrace", "[", "2", "]", "[", "'function'", "]", ";", "return", "$", "caller", ";", "}", "return", "'{null}'", ";", "}" ]
Get caller class and method. @return string Either returns the name of the class and method as a string (either 'Class->method' or 'Class::staticMethod'), the name of the function, '{closure}', or '{null}'.
[ "Get", "caller", "class", "and", "method", "." ]
4ef3445068f0ff9c0a6512cb741831a847013b76
https://github.com/jivoo/core/blob/4ef3445068f0ff9c0a6512cb741831a847013b76/src/Utilities.php#L258-L270
12,420
snowiow/cocurl
src/Player.php
Player.create
public static function create(array $data): Player { $player = new Player(); parent::fill($data, $player); if (is_array($player->clan)) { $player->clan = Clan::create($player->clan); } if (is_array($player->league)) { $player->league = League::create($player->league); } return $player; }
php
public static function create(array $data): Player { $player = new Player(); parent::fill($data, $player); if (is_array($player->clan)) { $player->clan = Clan::create($player->clan); } if (is_array($player->league)) { $player->league = League::create($player->league); } return $player; }
[ "public", "static", "function", "create", "(", "array", "$", "data", ")", ":", "Player", "{", "$", "player", "=", "new", "Player", "(", ")", ";", "parent", "::", "fill", "(", "$", "data", ",", "$", "player", ")", ";", "if", "(", "is_array", "(", "$", "player", "->", "clan", ")", ")", "{", "$", "player", "->", "clan", "=", "Clan", "::", "create", "(", "$", "player", "->", "clan", ")", ";", "}", "if", "(", "is_array", "(", "$", "player", "->", "league", ")", ")", "{", "$", "player", "->", "league", "=", "League", "::", "create", "(", "$", "player", "->", "league", ")", ";", "}", "return", "$", "player", ";", "}" ]
Creates a player object with the given data @param array $data an associative array to fill up the members of the player class @return Player a player object with the data given as it's members
[ "Creates", "a", "player", "object", "with", "the", "given", "data" ]
583df05bd3c8f24fd99f294da9906a3e4b1a9c7b
https://github.com/snowiow/cocurl/blob/583df05bd3c8f24fd99f294da9906a3e4b1a9c7b/src/Player.php#L90-L101
12,421
asbsoft/yii2-common_2_170212
web/UniView.php
UniView.stopBlock
public function stopBlock($name = null) { if (empty($this->currentBlockName)) { throw new InvalidParamException( "Unexpected stopBlock in '{$this->processingViewFile}'" ); } if (!empty($name) && $this->currentBlockName != $name) { throw new InvalidParamException( "Expected current closed block name '{$this->currentBlockName}' instead of '{$name}'" . " in '{$this->processingViewFile}'" ); } $name = $this->currentBlockName; $fullBlockName = $this->getCurrentBlockFullName(); array_pop(static::$_blocksStack); $content = ob_get_clean(); // save every block of every view-file in inherit chain (not only for last) - it will need for render parentBlock if (!$this->viewBlocks($this->processingViewFile)->exists($fullBlockName)) { $this->viewBlocks($this->processingViewFile)->add($fullBlockName, $content); } $savedContent = $this->findProperBlock($fullBlockName, $this->processingViewFile); if ($savedContent !== false) { $content = $savedContent; // rewrite } if ($savedContent !== false && empty($this->_extendingParent[$this->processingViewFile])) { // such block already saved - replace block in parent view-template by saved content $n = $this->hasParentBlock($savedContent); while ($n--) { $savedContent = $this->replaceParentBlock($savedContent); } echo $savedContent; } else { echo $content; // always echo - to catch by outer block } }
php
public function stopBlock($name = null) { if (empty($this->currentBlockName)) { throw new InvalidParamException( "Unexpected stopBlock in '{$this->processingViewFile}'" ); } if (!empty($name) && $this->currentBlockName != $name) { throw new InvalidParamException( "Expected current closed block name '{$this->currentBlockName}' instead of '{$name}'" . " in '{$this->processingViewFile}'" ); } $name = $this->currentBlockName; $fullBlockName = $this->getCurrentBlockFullName(); array_pop(static::$_blocksStack); $content = ob_get_clean(); // save every block of every view-file in inherit chain (not only for last) - it will need for render parentBlock if (!$this->viewBlocks($this->processingViewFile)->exists($fullBlockName)) { $this->viewBlocks($this->processingViewFile)->add($fullBlockName, $content); } $savedContent = $this->findProperBlock($fullBlockName, $this->processingViewFile); if ($savedContent !== false) { $content = $savedContent; // rewrite } if ($savedContent !== false && empty($this->_extendingParent[$this->processingViewFile])) { // such block already saved - replace block in parent view-template by saved content $n = $this->hasParentBlock($savedContent); while ($n--) { $savedContent = $this->replaceParentBlock($savedContent); } echo $savedContent; } else { echo $content; // always echo - to catch by outer block } }
[ "public", "function", "stopBlock", "(", "$", "name", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "currentBlockName", ")", ")", "{", "throw", "new", "InvalidParamException", "(", "\"Unexpected stopBlock in '{$this->processingViewFile}'\"", ")", ";", "}", "if", "(", "!", "empty", "(", "$", "name", ")", "&&", "$", "this", "->", "currentBlockName", "!=", "$", "name", ")", "{", "throw", "new", "InvalidParamException", "(", "\"Expected current closed block name '{$this->currentBlockName}' instead of '{$name}'\"", ".", "\" in '{$this->processingViewFile}'\"", ")", ";", "}", "$", "name", "=", "$", "this", "->", "currentBlockName", ";", "$", "fullBlockName", "=", "$", "this", "->", "getCurrentBlockFullName", "(", ")", ";", "array_pop", "(", "static", "::", "$", "_blocksStack", ")", ";", "$", "content", "=", "ob_get_clean", "(", ")", ";", "// save every block of every view-file in inherit chain (not only for last) - it will need for render parentBlock", "if", "(", "!", "$", "this", "->", "viewBlocks", "(", "$", "this", "->", "processingViewFile", ")", "->", "exists", "(", "$", "fullBlockName", ")", ")", "{", "$", "this", "->", "viewBlocks", "(", "$", "this", "->", "processingViewFile", ")", "->", "add", "(", "$", "fullBlockName", ",", "$", "content", ")", ";", "}", "$", "savedContent", "=", "$", "this", "->", "findProperBlock", "(", "$", "fullBlockName", ",", "$", "this", "->", "processingViewFile", ")", ";", "if", "(", "$", "savedContent", "!==", "false", ")", "{", "$", "content", "=", "$", "savedContent", ";", "// rewrite", "}", "if", "(", "$", "savedContent", "!==", "false", "&&", "empty", "(", "$", "this", "->", "_extendingParent", "[", "$", "this", "->", "processingViewFile", "]", ")", ")", "{", "// such block already saved - replace block in parent view-template by saved content", "$", "n", "=", "$", "this", "->", "hasParentBlock", "(", "$", "savedContent", ")", ";", "while", "(", "$", "n", "--", ")", "{", "$", "savedContent", "=", "$", "this", "->", "replaceParentBlock", "(", "$", "savedContent", ")", ";", "}", "echo", "$", "savedContent", ";", "}", "else", "{", "echo", "$", "content", ";", "// always echo - to catch by outer block", "}", "}" ]
Stop block with save or echo.
[ "Stop", "block", "with", "save", "or", "echo", "." ]
6c58012ff89225d7d4e42b200cf39e009e9d9dac
https://github.com/asbsoft/yii2-common_2_170212/blob/6c58012ff89225d7d4e42b200cf39e009e9d9dac/web/UniView.php#L146-L186
12,422
asbsoft/yii2-common_2_170212
web/UniView.php
UniView.replaceParentBlock
protected function replaceParentBlock($savedContent) { $pattern = sprintf(self::TMPL_RENDER_PARENT, "([^']+)", "([^|]+)"); $result = preg_match("/{$pattern}/", $savedContent, $matches); if (!$result) { return $savedContent; } else { // processing parentBlock() $fullBlockName = $matches[1]; $viewFileName = $matches[2]; $replacement = $this->findParentBlock($fullBlockName, $viewFileName); $out = preg_replace("/{$pattern}/", $replacement, $savedContent); return $out; } }
php
protected function replaceParentBlock($savedContent) { $pattern = sprintf(self::TMPL_RENDER_PARENT, "([^']+)", "([^|]+)"); $result = preg_match("/{$pattern}/", $savedContent, $matches); if (!$result) { return $savedContent; } else { // processing parentBlock() $fullBlockName = $matches[1]; $viewFileName = $matches[2]; $replacement = $this->findParentBlock($fullBlockName, $viewFileName); $out = preg_replace("/{$pattern}/", $replacement, $savedContent); return $out; } }
[ "protected", "function", "replaceParentBlock", "(", "$", "savedContent", ")", "{", "$", "pattern", "=", "sprintf", "(", "self", "::", "TMPL_RENDER_PARENT", ",", "\"([^']+)\"", ",", "\"([^|]+)\"", ")", ";", "$", "result", "=", "preg_match", "(", "\"/{$pattern}/\"", ",", "$", "savedContent", ",", "$", "matches", ")", ";", "if", "(", "!", "$", "result", ")", "{", "return", "$", "savedContent", ";", "}", "else", "{", "// processing parentBlock()", "$", "fullBlockName", "=", "$", "matches", "[", "1", "]", ";", "$", "viewFileName", "=", "$", "matches", "[", "2", "]", ";", "$", "replacement", "=", "$", "this", "->", "findParentBlock", "(", "$", "fullBlockName", ",", "$", "viewFileName", ")", ";", "$", "out", "=", "preg_replace", "(", "\"/{$pattern}/\"", ",", "$", "replacement", ",", "$", "savedContent", ")", ";", "return", "$", "out", ";", "}", "}" ]
Replace in block tag with parentBlock info. @param string $savedContent @return string
[ "Replace", "in", "block", "tag", "with", "parentBlock", "info", "." ]
6c58012ff89225d7d4e42b200cf39e009e9d9dac
https://github.com/asbsoft/yii2-common_2_170212/blob/6c58012ff89225d7d4e42b200cf39e009e9d9dac/web/UniView.php#L212-L225
12,423
asbsoft/yii2-common_2_170212
web/UniView.php
UniView.findParentBlock
protected function findParentBlock($fullBlockName, $viewFileName) { $parentViewFile = $this->findParentViewFile($viewFileName); $viewFilesChain = $this->getViewFilesChain($parentViewFile); $savedContent = ''; foreach ($viewFilesChain as $viewFile) { if ($this->viewBlocks($viewFile)->exists($fullBlockName)) { $savedContent = $this->viewBlocks($viewFile)->get($fullBlockName); break; } } return $savedContent; }
php
protected function findParentBlock($fullBlockName, $viewFileName) { $parentViewFile = $this->findParentViewFile($viewFileName); $viewFilesChain = $this->getViewFilesChain($parentViewFile); $savedContent = ''; foreach ($viewFilesChain as $viewFile) { if ($this->viewBlocks($viewFile)->exists($fullBlockName)) { $savedContent = $this->viewBlocks($viewFile)->get($fullBlockName); break; } } return $savedContent; }
[ "protected", "function", "findParentBlock", "(", "$", "fullBlockName", ",", "$", "viewFileName", ")", "{", "$", "parentViewFile", "=", "$", "this", "->", "findParentViewFile", "(", "$", "viewFileName", ")", ";", "$", "viewFilesChain", "=", "$", "this", "->", "getViewFilesChain", "(", "$", "parentViewFile", ")", ";", "$", "savedContent", "=", "''", ";", "foreach", "(", "$", "viewFilesChain", "as", "$", "viewFile", ")", "{", "if", "(", "$", "this", "->", "viewBlocks", "(", "$", "viewFile", ")", "->", "exists", "(", "$", "fullBlockName", ")", ")", "{", "$", "savedContent", "=", "$", "this", "->", "viewBlocks", "(", "$", "viewFile", ")", "->", "get", "(", "$", "fullBlockName", ")", ";", "break", ";", "}", "}", "return", "$", "savedContent", ";", "}" ]
Find parent block. @param string $fullBlockName name of block - name of current block where parentBlock() occured @return string block body or empty string if not found
[ "Find", "parent", "block", "." ]
6c58012ff89225d7d4e42b200cf39e009e9d9dac
https://github.com/asbsoft/yii2-common_2_170212/blob/6c58012ff89225d7d4e42b200cf39e009e9d9dac/web/UniView.php#L232-L244
12,424
asbsoft/yii2-common_2_170212
web/UniView.php
UniView.startParent
public function startParent($addParentData = []) { if (!empty($this->_extendingParent[$this->processingViewFile])) { throw new InvalidParamException("Nested startParent() impossible in '{$this->processingViewFile}'"); } $this->_extendingParent[$this->processingViewFile] = true; $this->_addParentData[$this->processingViewFile] = $addParentData; ob_start(); // for lost all non-block info between startParent...stopParent ob_implicit_flush(false); }
php
public function startParent($addParentData = []) { if (!empty($this->_extendingParent[$this->processingViewFile])) { throw new InvalidParamException("Nested startParent() impossible in '{$this->processingViewFile}'"); } $this->_extendingParent[$this->processingViewFile] = true; $this->_addParentData[$this->processingViewFile] = $addParentData; ob_start(); // for lost all non-block info between startParent...stopParent ob_implicit_flush(false); }
[ "public", "function", "startParent", "(", "$", "addParentData", "=", "[", "]", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "_extendingParent", "[", "$", "this", "->", "processingViewFile", "]", ")", ")", "{", "throw", "new", "InvalidParamException", "(", "\"Nested startParent() impossible in '{$this->processingViewFile}'\"", ")", ";", "}", "$", "this", "->", "_extendingParent", "[", "$", "this", "->", "processingViewFile", "]", "=", "true", ";", "$", "this", "->", "_addParentData", "[", "$", "this", "->", "processingViewFile", "]", "=", "$", "addParentData", ";", "ob_start", "(", ")", ";", "// for lost all non-block info between startParent...stopParent", "ob_implicit_flush", "(", "false", ")", ";", "}" ]
Begin extend parent view file. @param array $addParentData additional data from inherited view-file
[ "Begin", "extend", "parent", "view", "file", "." ]
6c58012ff89225d7d4e42b200cf39e009e9d9dac
https://github.com/asbsoft/yii2-common_2_170212/blob/6c58012ff89225d7d4e42b200cf39e009e9d9dac/web/UniView.php#L274-L285
12,425
asbsoft/yii2-common_2_170212
web/UniView.php
UniView.stopParent
public function stopParent() { if (!empty($this->currentBlockName)) { throw new InvalidParamException("Unclosed startBlock detected in '{$this->processingViewFile}'"); } if (empty($this->_extendingParent[$this->processingViewFile])) { throw new InvalidParamException("stopParent unexpected here without startParent in '{$this->processingViewFile}'"); } $this->_extendingParent[$this->processingViewFile] = false; $lost = ob_get_clean(); // lost all non-block info between startParent...stopParent // render parent view with blocks inclusions $parentFile = $this->findParentViewFile($this->processingViewFile); if ($parentFile) { $this->_currentViewFile[$this->viewFile] = $parentFile; $parentDataFile = $this->viewFile; $params = empty($this->_viewsParams[$parentDataFile]) ? [] : $this->_viewsParams[$parentDataFile]; if (!empty($this->_addParentData[$parentDataFile])) { $addParentData = $this->_addParentData[$parentDataFile]; $params = ArrayHelper::merge($params, $addParentData); } $result = $this->renderPhpFile($parentFile, $params); $n = $this->hasParentBlock($result); while ($n--) { $result = $this->replaceParentBlock($result); } if ($this->hasParentBlock($result)) { throw new InvalidParamException("Unprocessed nested parentBlock found in '{$this->processingViewFile}'"); } echo $result; } }
php
public function stopParent() { if (!empty($this->currentBlockName)) { throw new InvalidParamException("Unclosed startBlock detected in '{$this->processingViewFile}'"); } if (empty($this->_extendingParent[$this->processingViewFile])) { throw new InvalidParamException("stopParent unexpected here without startParent in '{$this->processingViewFile}'"); } $this->_extendingParent[$this->processingViewFile] = false; $lost = ob_get_clean(); // lost all non-block info between startParent...stopParent // render parent view with blocks inclusions $parentFile = $this->findParentViewFile($this->processingViewFile); if ($parentFile) { $this->_currentViewFile[$this->viewFile] = $parentFile; $parentDataFile = $this->viewFile; $params = empty($this->_viewsParams[$parentDataFile]) ? [] : $this->_viewsParams[$parentDataFile]; if (!empty($this->_addParentData[$parentDataFile])) { $addParentData = $this->_addParentData[$parentDataFile]; $params = ArrayHelper::merge($params, $addParentData); } $result = $this->renderPhpFile($parentFile, $params); $n = $this->hasParentBlock($result); while ($n--) { $result = $this->replaceParentBlock($result); } if ($this->hasParentBlock($result)) { throw new InvalidParamException("Unprocessed nested parentBlock found in '{$this->processingViewFile}'"); } echo $result; } }
[ "public", "function", "stopParent", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "currentBlockName", ")", ")", "{", "throw", "new", "InvalidParamException", "(", "\"Unclosed startBlock detected in '{$this->processingViewFile}'\"", ")", ";", "}", "if", "(", "empty", "(", "$", "this", "->", "_extendingParent", "[", "$", "this", "->", "processingViewFile", "]", ")", ")", "{", "throw", "new", "InvalidParamException", "(", "\"stopParent unexpected here without startParent in '{$this->processingViewFile}'\"", ")", ";", "}", "$", "this", "->", "_extendingParent", "[", "$", "this", "->", "processingViewFile", "]", "=", "false", ";", "$", "lost", "=", "ob_get_clean", "(", ")", ";", "// lost all non-block info between startParent...stopParent", "// render parent view with blocks inclusions", "$", "parentFile", "=", "$", "this", "->", "findParentViewFile", "(", "$", "this", "->", "processingViewFile", ")", ";", "if", "(", "$", "parentFile", ")", "{", "$", "this", "->", "_currentViewFile", "[", "$", "this", "->", "viewFile", "]", "=", "$", "parentFile", ";", "$", "parentDataFile", "=", "$", "this", "->", "viewFile", ";", "$", "params", "=", "empty", "(", "$", "this", "->", "_viewsParams", "[", "$", "parentDataFile", "]", ")", "?", "[", "]", ":", "$", "this", "->", "_viewsParams", "[", "$", "parentDataFile", "]", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "_addParentData", "[", "$", "parentDataFile", "]", ")", ")", "{", "$", "addParentData", "=", "$", "this", "->", "_addParentData", "[", "$", "parentDataFile", "]", ";", "$", "params", "=", "ArrayHelper", "::", "merge", "(", "$", "params", ",", "$", "addParentData", ")", ";", "}", "$", "result", "=", "$", "this", "->", "renderPhpFile", "(", "$", "parentFile", ",", "$", "params", ")", ";", "$", "n", "=", "$", "this", "->", "hasParentBlock", "(", "$", "result", ")", ";", "while", "(", "$", "n", "--", ")", "{", "$", "result", "=", "$", "this", "->", "replaceParentBlock", "(", "$", "result", ")", ";", "}", "if", "(", "$", "this", "->", "hasParentBlock", "(", "$", "result", ")", ")", "{", "throw", "new", "InvalidParamException", "(", "\"Unprocessed nested parentBlock found in '{$this->processingViewFile}'\"", ")", ";", "}", "echo", "$", "result", ";", "}", "}" ]
End extend parent view file.
[ "End", "extend", "parent", "view", "file", "." ]
6c58012ff89225d7d4e42b200cf39e009e9d9dac
https://github.com/asbsoft/yii2-common_2_170212/blob/6c58012ff89225d7d4e42b200cf39e009e9d9dac/web/UniView.php#L290-L323
12,426
asbsoft/yii2-common_2_170212
web/UniView.php
UniView.getViewsSubSubdir
protected function getViewsSubSubdir($currentViewFile) { $viewsSubSubdir = false; $currentViewFile = realpath($currentViewFile); $currentViewPath = dirname($currentViewFile); $module = $this->context->module; $pathList = $module->getBasePathList(); foreach ($pathList as $modulePath) { $viewsPath = realpath($modulePath) . DIRECTORY_SEPARATOR . $module::$viewsSubdir; if (strpos($currentViewPath, $viewsPath) === 0) { $viewsSubSubdir = substr($currentViewPath, strlen($viewsPath) + 1); return $viewsSubSubdir; } } throw new InvalidParamException( "Unexpected view file '{$currentViewFile}' is out of module's '{$module->className()}' parents chain" ); }
php
protected function getViewsSubSubdir($currentViewFile) { $viewsSubSubdir = false; $currentViewFile = realpath($currentViewFile); $currentViewPath = dirname($currentViewFile); $module = $this->context->module; $pathList = $module->getBasePathList(); foreach ($pathList as $modulePath) { $viewsPath = realpath($modulePath) . DIRECTORY_SEPARATOR . $module::$viewsSubdir; if (strpos($currentViewPath, $viewsPath) === 0) { $viewsSubSubdir = substr($currentViewPath, strlen($viewsPath) + 1); return $viewsSubSubdir; } } throw new InvalidParamException( "Unexpected view file '{$currentViewFile}' is out of module's '{$module->className()}' parents chain" ); }
[ "protected", "function", "getViewsSubSubdir", "(", "$", "currentViewFile", ")", "{", "$", "viewsSubSubdir", "=", "false", ";", "$", "currentViewFile", "=", "realpath", "(", "$", "currentViewFile", ")", ";", "$", "currentViewPath", "=", "dirname", "(", "$", "currentViewFile", ")", ";", "$", "module", "=", "$", "this", "->", "context", "->", "module", ";", "$", "pathList", "=", "$", "module", "->", "getBasePathList", "(", ")", ";", "foreach", "(", "$", "pathList", "as", "$", "modulePath", ")", "{", "$", "viewsPath", "=", "realpath", "(", "$", "modulePath", ")", ".", "DIRECTORY_SEPARATOR", ".", "$", "module", "::", "$", "viewsSubdir", ";", "if", "(", "strpos", "(", "$", "currentViewPath", ",", "$", "viewsPath", ")", "===", "0", ")", "{", "$", "viewsSubSubdir", "=", "substr", "(", "$", "currentViewPath", ",", "strlen", "(", "$", "viewsPath", ")", "+", "1", ")", ";", "return", "$", "viewsSubSubdir", ";", "}", "}", "throw", "new", "InvalidParamException", "(", "\"Unexpected view file '{$currentViewFile}' is out of module's '{$module->className()}' parents chain\"", ")", ";", "}" ]
Get views sub subdir. @param string $currentViewFile @return string @throws InvalidParamException if $currentViewFile is out of this module parents path list
[ "Get", "views", "sub", "subdir", "." ]
6c58012ff89225d7d4e42b200cf39e009e9d9dac
https://github.com/asbsoft/yii2-common_2_170212/blob/6c58012ff89225d7d4e42b200cf39e009e9d9dac/web/UniView.php#L385-L404
12,427
stanislav-web/httpstatuses-json
src/HttpStatuses/HttpStatuses.php
HttpStatuses.getStatus
public function getStatus($code) { $filename = __DIR__.'/../../data/'.substr($code, 0,1).'.json'; if(file_exists($filename)) { return json_decode(file_get_contents($filename), true)[$code]; } return []; }
php
public function getStatus($code) { $filename = __DIR__.'/../../data/'.substr($code, 0,1).'.json'; if(file_exists($filename)) { return json_decode(file_get_contents($filename), true)[$code]; } return []; }
[ "public", "function", "getStatus", "(", "$", "code", ")", "{", "$", "filename", "=", "__DIR__", ".", "'/../../data/'", ".", "substr", "(", "$", "code", ",", "0", ",", "1", ")", ".", "'.json'", ";", "if", "(", "file_exists", "(", "$", "filename", ")", ")", "{", "return", "json_decode", "(", "file_get_contents", "(", "$", "filename", ")", ",", "true", ")", "[", "$", "code", "]", ";", "}", "return", "[", "]", ";", "}" ]
Get status full description from code @param int $code @return array
[ "Get", "status", "full", "description", "from", "code" ]
76900fe87a60253361dff44897a61a58839e5729
https://github.com/stanislav-web/httpstatuses-json/blob/76900fe87a60253361dff44897a61a58839e5729/src/HttpStatuses/HttpStatuses.php#L23-L30
12,428
digit-soft/re-action-promise
src/Promise.php
Promise.parentCancellerFunction
protected static function parentCancellerFunction(self &$parent) { return function () use (&$parent) { --$parent->requiredCancelRequests; if ($parent->requiredCancelRequests <= 0) { $parent->cancel(); } $parent = null; }; }
php
protected static function parentCancellerFunction(self &$parent) { return function () use (&$parent) { --$parent->requiredCancelRequests; if ($parent->requiredCancelRequests <= 0) { $parent->cancel(); } $parent = null; }; }
[ "protected", "static", "function", "parentCancellerFunction", "(", "self", "&", "$", "parent", ")", "{", "return", "function", "(", ")", "use", "(", "&", "$", "parent", ")", "{", "--", "$", "parent", "->", "requiredCancelRequests", ";", "if", "(", "$", "parent", "->", "requiredCancelRequests", "<=", "0", ")", "{", "$", "parent", "->", "cancel", "(", ")", ";", "}", "$", "parent", "=", "null", ";", "}", ";", "}" ]
Creates a static parent canceller callback that is not bound to a promise instance. Moving the closure creation to a static method allows us to create a callback that is not bound to a promise instance. By passing the target promise instance by reference, we can still execute its cancellation logic and still clear this reference after invocation (canceller can only ever be called once). This helps avoiding garbage cycles if the parent canceller creates an Exception. These assumptions are covered by the test suite, so if you ever feel like refactoring this, go ahead, any alternative suggestions are welcome! @param ExtendedPromiseInterface $parent @return callable
[ "Creates", "a", "static", "parent", "canceller", "callback", "that", "is", "not", "bound", "to", "a", "promise", "instance", "." ]
9a16b9ca95eeafd3ebcc0a1e8e76ad958c48bac1
https://github.com/digit-soft/re-action-promise/blob/9a16b9ca95eeafd3ebcc0a1e8e76ad958c48bac1/src/Promise.php#L334-L345
12,429
digit-soft/re-action-promise
src/Promise.php
Promise.rejectFunction
protected static function rejectFunction(self &$target) { return function ($reason = null) use (&$target) { if ($target !== null) { $target->reject($reason); $target = null; } }; }
php
protected static function rejectFunction(self &$target) { return function ($reason = null) use (&$target) { if ($target !== null) { $target->reject($reason); $target = null; } }; }
[ "protected", "static", "function", "rejectFunction", "(", "self", "&", "$", "target", ")", "{", "return", "function", "(", "$", "reason", "=", "null", ")", "use", "(", "&", "$", "target", ")", "{", "if", "(", "$", "target", "!==", "null", ")", "{", "$", "target", "->", "reject", "(", "$", "reason", ")", ";", "$", "target", "=", "null", ";", "}", "}", ";", "}" ]
Creates a static rejection callback that is not bound to a promise instance. Moving the closure creation to a static method allows us to create a callback that is not bound to a promise instance. By passing the target promise instance by reference, we can still execute its rejection logic and still clear this reference when settling the promise. This helps avoiding garbage cycles if any callback creates an Exception. These assumptions are covered by the test suite, so if you ever feel like refactoring this, go ahead, any alternative suggestions are welcome! @param ExtendedPromiseInterface $target @return callable
[ "Creates", "a", "static", "rejection", "callback", "that", "is", "not", "bound", "to", "a", "promise", "instance", "." ]
9a16b9ca95eeafd3ebcc0a1e8e76ad958c48bac1
https://github.com/digit-soft/re-action-promise/blob/9a16b9ca95eeafd3ebcc0a1e8e76ad958c48bac1/src/Promise.php#L387-L395
12,430
digit-soft/re-action-promise
src/Promise.php
Promise.notifyFunction
protected static function notifyFunction(&$progressHandlers) { return function ($update = null) use (&$progressHandlers) { foreach ($progressHandlers as $handler) { $handler($update); } }; }
php
protected static function notifyFunction(&$progressHandlers) { return function ($update = null) use (&$progressHandlers) { foreach ($progressHandlers as $handler) { $handler($update); } }; }
[ "protected", "static", "function", "notifyFunction", "(", "&", "$", "progressHandlers", ")", "{", "return", "function", "(", "$", "update", "=", "null", ")", "use", "(", "&", "$", "progressHandlers", ")", "{", "foreach", "(", "$", "progressHandlers", "as", "$", "handler", ")", "{", "$", "handler", "(", "$", "update", ")", ";", "}", "}", ";", "}" ]
Creates a static progress callback that is not bound to a promise instance. Moving the closure creation to a static method allows us to create a callback that is not bound to a promise instance. By passing its progress handlers by reference, we can still execute them when requested and still clear this reference when settling the promise. This helps avoiding garbage cycles if any callback creates an Exception. These assumptions are covered by the test suite, so if you ever feel like refactoring this, go ahead, any alternative suggestions are welcome! @param array $progressHandlers @return callable
[ "Creates", "a", "static", "progress", "callback", "that", "is", "not", "bound", "to", "a", "promise", "instance", "." ]
9a16b9ca95eeafd3ebcc0a1e8e76ad958c48bac1
https://github.com/digit-soft/re-action-promise/blob/9a16b9ca95eeafd3ebcc0a1e8e76ad958c48bac1/src/Promise.php#L412-L419
12,431
sgtlambda/fieldwork
src/fieldwork/components/SelectBox.php
SelectBox.setSelect2Options
private function setSelect2Options ($select2options) { foreach ($select2options as $key => $option) $this->select2options[$key] = $option; return $this; }
php
private function setSelect2Options ($select2options) { foreach ($select2options as $key => $option) $this->select2options[$key] = $option; return $this; }
[ "private", "function", "setSelect2Options", "(", "$", "select2options", ")", "{", "foreach", "(", "$", "select2options", "as", "$", "key", "=>", "$", "option", ")", "$", "this", "->", "select2options", "[", "$", "key", "]", "=", "$", "option", ";", "return", "$", "this", ";", "}" ]
Merges the options @param array $select2options @return $this
[ "Merges", "the", "options" ]
ba18939c9822db4dc84947d90979cfb0da072cb0
https://github.com/sgtlambda/fieldwork/blob/ba18939c9822db4dc84947d90979cfb0da072cb0/src/fieldwork/components/SelectBox.php#L132-L137
12,432
sgtlambda/fieldwork
src/fieldwork/components/SelectBox.php
SelectBox.setPlaceholder
public function setPlaceholder ($placeholder = null) { if ($placeholder === false) $this->usePlaceholder = false; else { $this->setSelect2Options(array( self::SELECT2_OPTION_PLACEHOLDER => $placeholder === null ? $this->label : $placeholder )); $this->usePlaceholder = true; } return $this; }
php
public function setPlaceholder ($placeholder = null) { if ($placeholder === false) $this->usePlaceholder = false; else { $this->setSelect2Options(array( self::SELECT2_OPTION_PLACEHOLDER => $placeholder === null ? $this->label : $placeholder )); $this->usePlaceholder = true; } return $this; }
[ "public", "function", "setPlaceholder", "(", "$", "placeholder", "=", "null", ")", "{", "if", "(", "$", "placeholder", "===", "false", ")", "$", "this", "->", "usePlaceholder", "=", "false", ";", "else", "{", "$", "this", "->", "setSelect2Options", "(", "array", "(", "self", "::", "SELECT2_OPTION_PLACEHOLDER", "=>", "$", "placeholder", "===", "null", "?", "$", "this", "->", "label", ":", "$", "placeholder", ")", ")", ";", "$", "this", "->", "usePlaceholder", "=", "true", ";", "}", "return", "$", "this", ";", "}" ]
Determines the placeholder behaviour. Set to FALSE if the first option should be selected on default. Set to NULL if the label should be used. Otherwise specify a placeholder. @param null|boolean|string $placeholder @return $this
[ "Determines", "the", "placeholder", "behaviour", ".", "Set", "to", "FALSE", "if", "the", "first", "option", "should", "be", "selected", "on", "default", ".", "Set", "to", "NULL", "if", "the", "label", "should", "be", "used", ".", "Otherwise", "specify", "a", "placeholder", "." ]
ba18939c9822db4dc84947d90979cfb0da072cb0
https://github.com/sgtlambda/fieldwork/blob/ba18939c9822db4dc84947d90979cfb0da072cb0/src/fieldwork/components/SelectBox.php#L147-L158
12,433
sgtlambda/fieldwork
src/fieldwork/components/SelectBox.php
SelectBox.isSelected
protected function isSelected ($v) { return $this->value === $v || (is_array($this->value) && in_array($v, $this->value)); }
php
protected function isSelected ($v) { return $this->value === $v || (is_array($this->value) && in_array($v, $this->value)); }
[ "protected", "function", "isSelected", "(", "$", "v", ")", "{", "return", "$", "this", "->", "value", "===", "$", "v", "||", "(", "is_array", "(", "$", "this", "->", "value", ")", "&&", "in_array", "(", "$", "v", ",", "$", "this", "->", "value", ")", ")", ";", "}" ]
Determines whether the given value is currently selected @param $v @return bool
[ "Determines", "whether", "the", "given", "value", "is", "currently", "selected" ]
ba18939c9822db4dc84947d90979cfb0da072cb0
https://github.com/sgtlambda/fieldwork/blob/ba18939c9822db4dc84947d90979cfb0da072cb0/src/fieldwork/components/SelectBox.php#L215-L218
12,434
emaphp/eMapper
lib/eMapper/Fluent/Query/FluentSelect.php
FluentSelect.orderBy
public function orderBy($orderBy = null) { if (is_array($orderBy)) $this->orderByClause = $orderBy; else $this->orderByClause = func_get_args(); return $this; }
php
public function orderBy($orderBy = null) { if (is_array($orderBy)) $this->orderByClause = $orderBy; else $this->orderByClause = func_get_args(); return $this; }
[ "public", "function", "orderBy", "(", "$", "orderBy", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "orderBy", ")", ")", "$", "this", "->", "orderByClause", "=", "$", "orderBy", ";", "else", "$", "this", "->", "orderByClause", "=", "func_get_args", "(", ")", ";", "return", "$", "this", ";", "}" ]
Sets order by clauses @return \eMapper\Fluent\Query\FluentSelect
[ "Sets", "order", "by", "clauses" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Fluent/Query/FluentSelect.php#L93-L99
12,435
emaphp/eMapper
lib/eMapper/Fluent/Query/FluentSelect.php
FluentSelect.groupBy
public function groupBy($groupBy) { if (is_array($groupBy)) $this->groupByClause = $groupBy; else $this->groupByClause = func_get_args(); return $this; }
php
public function groupBy($groupBy) { if (is_array($groupBy)) $this->groupByClause = $groupBy; else $this->groupByClause = func_get_args(); return $this; }
[ "public", "function", "groupBy", "(", "$", "groupBy", ")", "{", "if", "(", "is_array", "(", "$", "groupBy", ")", ")", "$", "this", "->", "groupByClause", "=", "$", "groupBy", ";", "else", "$", "this", "->", "groupByClause", "=", "func_get_args", "(", ")", ";", "return", "$", "this", ";", "}" ]
Sets group by clauses @return \eMapper\Fluent\Query\FluentSelect
[ "Sets", "group", "by", "clauses" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Fluent/Query/FluentSelect.php#L125-L131
12,436
emaphp/eMapper
lib/eMapper/Fluent/Query/FluentSelect.php
FluentSelect.fetch
public function fetch($mappingType = null) { list($query, $args) = $this->build(); //generate a mapper instance if (is_null($mappingType)) $mapper = empty($this->config) ? $this->fluent->getMapper() : $this->fluent->getMapper()->merge($this->config); else { $config = empty($this->config) ? ['map.type' => $mappingType] : array_merge($this->config, ['map.type' => $mappingType]); $mapper = $this->fluent->getMapper()->merge($config); } return empty($args) ? $mapper->query($query) : $mapper->execute($query, $args); }
php
public function fetch($mappingType = null) { list($query, $args) = $this->build(); //generate a mapper instance if (is_null($mappingType)) $mapper = empty($this->config) ? $this->fluent->getMapper() : $this->fluent->getMapper()->merge($this->config); else { $config = empty($this->config) ? ['map.type' => $mappingType] : array_merge($this->config, ['map.type' => $mappingType]); $mapper = $this->fluent->getMapper()->merge($config); } return empty($args) ? $mapper->query($query) : $mapper->execute($query, $args); }
[ "public", "function", "fetch", "(", "$", "mappingType", "=", "null", ")", "{", "list", "(", "$", "query", ",", "$", "args", ")", "=", "$", "this", "->", "build", "(", ")", ";", "//generate a mapper instance", "if", "(", "is_null", "(", "$", "mappingType", ")", ")", "$", "mapper", "=", "empty", "(", "$", "this", "->", "config", ")", "?", "$", "this", "->", "fluent", "->", "getMapper", "(", ")", ":", "$", "this", "->", "fluent", "->", "getMapper", "(", ")", "->", "merge", "(", "$", "this", "->", "config", ")", ";", "else", "{", "$", "config", "=", "empty", "(", "$", "this", "->", "config", ")", "?", "[", "'map.type'", "=>", "$", "mappingType", "]", ":", "array_merge", "(", "$", "this", "->", "config", ",", "[", "'map.type'", "=>", "$", "mappingType", "]", ")", ";", "$", "mapper", "=", "$", "this", "->", "fluent", "->", "getMapper", "(", ")", "->", "merge", "(", "$", "config", ")", ";", "}", "return", "empty", "(", "$", "args", ")", "?", "$", "mapper", "->", "query", "(", "$", "query", ")", ":", "$", "mapper", "->", "execute", "(", "$", "query", ",", "$", "args", ")", ";", "}" ]
Fetchs the current query with an optional mapping type @param string $mappingType @return mixed
[ "Fetchs", "the", "current", "query", "with", "an", "optional", "mapping", "type" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Fluent/Query/FluentSelect.php#L254-L266
12,437
atelierspierrot/library
src/Library/HttpFundamental/Cookie.php
Cookie.exists
public function exists($cookie_name = null) { if (!empty($cookie_name)) { $this->setName($cookie_name); } return isset($_COOKIE[$this->getName()]); }
php
public function exists($cookie_name = null) { if (!empty($cookie_name)) { $this->setName($cookie_name); } return isset($_COOKIE[$this->getName()]); }
[ "public", "function", "exists", "(", "$", "cookie_name", "=", "null", ")", "{", "if", "(", "!", "empty", "(", "$", "cookie_name", ")", ")", "{", "$", "this", "->", "setName", "(", "$", "cookie_name", ")", ";", "}", "return", "isset", "(", "$", "_COOKIE", "[", "$", "this", "->", "getName", "(", ")", "]", ")", ";", "}" ]
Test if a cookie exists @param string $cookie_name @return bool
[ "Test", "if", "a", "cookie", "exists" ]
a2988a11370d13c7e0dc47f9d2d81c664c30b8dd
https://github.com/atelierspierrot/library/blob/a2988a11370d13c7e0dc47f9d2d81c664c30b8dd/src/Library/HttpFundamental/Cookie.php#L441-L447
12,438
atelierspierrot/library
src/Library/HttpFundamental/Cookie.php
Cookie.read
public function read($cookie_name = null) { if (!empty($cookie_name)) { $this->setName($cookie_name); } $val = isset($_COOKIE[$this->getName()]) ? $_COOKIE[$this->getName()] : null; if ($val && is_string($val) && ($this->getFlag() & self::FLATNESS_ARRAY)) { parse_str($val, $tmp_val); if (!empty($tmp_val) && $tmp_val!=$val) { $val = $tmp_val; } } $this->setValue($val); return $this->getValue(); }
php
public function read($cookie_name = null) { if (!empty($cookie_name)) { $this->setName($cookie_name); } $val = isset($_COOKIE[$this->getName()]) ? $_COOKIE[$this->getName()] : null; if ($val && is_string($val) && ($this->getFlag() & self::FLATNESS_ARRAY)) { parse_str($val, $tmp_val); if (!empty($tmp_val) && $tmp_val!=$val) { $val = $tmp_val; } } $this->setValue($val); return $this->getValue(); }
[ "public", "function", "read", "(", "$", "cookie_name", "=", "null", ")", "{", "if", "(", "!", "empty", "(", "$", "cookie_name", ")", ")", "{", "$", "this", "->", "setName", "(", "$", "cookie_name", ")", ";", "}", "$", "val", "=", "isset", "(", "$", "_COOKIE", "[", "$", "this", "->", "getName", "(", ")", "]", ")", "?", "$", "_COOKIE", "[", "$", "this", "->", "getName", "(", ")", "]", ":", "null", ";", "if", "(", "$", "val", "&&", "is_string", "(", "$", "val", ")", "&&", "(", "$", "this", "->", "getFlag", "(", ")", "&", "self", "::", "FLATNESS_ARRAY", ")", ")", "{", "parse_str", "(", "$", "val", ",", "$", "tmp_val", ")", ";", "if", "(", "!", "empty", "(", "$", "tmp_val", ")", "&&", "$", "tmp_val", "!=", "$", "val", ")", "{", "$", "val", "=", "$", "tmp_val", ";", "}", "}", "$", "this", "->", "setValue", "(", "$", "val", ")", ";", "return", "$", "this", "->", "getValue", "(", ")", ";", "}" ]
Get a cookie value @param string $cookie_name @return string|array
[ "Get", "a", "cookie", "value" ]
a2988a11370d13c7e0dc47f9d2d81c664c30b8dd
https://github.com/atelierspierrot/library/blob/a2988a11370d13c7e0dc47f9d2d81c664c30b8dd/src/Library/HttpFundamental/Cookie.php#L455-L469
12,439
atelierspierrot/library
src/Library/HttpFundamental/Cookie.php
Cookie.addInCookie
public function addInCookie($variable_name, $variable_value, $cookie_name = null) { if (!empty($cookie_name)) { $this->setName($cookie_name); } if (!empty($variable_value)) { $this->setValue($variable_value); } return $this ->setName($this->getName().'['.$variable_name.']') ->send(); }
php
public function addInCookie($variable_name, $variable_value, $cookie_name = null) { if (!empty($cookie_name)) { $this->setName($cookie_name); } if (!empty($variable_value)) { $this->setValue($variable_value); } return $this ->setName($this->getName().'['.$variable_name.']') ->send(); }
[ "public", "function", "addInCookie", "(", "$", "variable_name", ",", "$", "variable_value", ",", "$", "cookie_name", "=", "null", ")", "{", "if", "(", "!", "empty", "(", "$", "cookie_name", ")", ")", "{", "$", "this", "->", "setName", "(", "$", "cookie_name", ")", ";", "}", "if", "(", "!", "empty", "(", "$", "variable_value", ")", ")", "{", "$", "this", "->", "setValue", "(", "$", "variable_value", ")", ";", "}", "return", "$", "this", "->", "setName", "(", "$", "this", "->", "getName", "(", ")", ".", "'['", ".", "$", "variable_name", ".", "']'", ")", "->", "send", "(", ")", ";", "}" ]
Add a variable value in a cookie @param string $variable_name @param string $variable_value @param string $cookie_name @return bool
[ "Add", "a", "variable", "value", "in", "a", "cookie" ]
a2988a11370d13c7e0dc47f9d2d81c664c30b8dd
https://github.com/atelierspierrot/library/blob/a2988a11370d13c7e0dc47f9d2d81c664c30b8dd/src/Library/HttpFundamental/Cookie.php#L509-L520
12,440
atelierspierrot/library
src/Library/HttpFundamental/Cookie.php
Cookie.clear
public function clear($cookie_name = null) { if (!empty($cookie_name)) { $this->setName($cookie_name); } return $this ->setValue(null) ->setExpire(-1000) ->send() ; }
php
public function clear($cookie_name = null) { if (!empty($cookie_name)) { $this->setName($cookie_name); } return $this ->setValue(null) ->setExpire(-1000) ->send() ; }
[ "public", "function", "clear", "(", "$", "cookie_name", "=", "null", ")", "{", "if", "(", "!", "empty", "(", "$", "cookie_name", ")", ")", "{", "$", "this", "->", "setName", "(", "$", "cookie_name", ")", ";", "}", "return", "$", "this", "->", "setValue", "(", "null", ")", "->", "setExpire", "(", "-", "1000", ")", "->", "send", "(", ")", ";", "}" ]
Clear a cookie @param string $cookie_name @return bool
[ "Clear", "a", "cookie" ]
a2988a11370d13c7e0dc47f9d2d81c664c30b8dd
https://github.com/atelierspierrot/library/blob/a2988a11370d13c7e0dc47f9d2d81c664c30b8dd/src/Library/HttpFundamental/Cookie.php#L528-L538
12,441
oroinc/OroChainProcessorComponent
ExpressionParser.php
ExpressionParser.parse
public static function parse($value) { if (\is_string($value)) { $operator = null; if (\strpos($value, AbstractMatcher::OPERATOR_AND)) { $operator = AbstractMatcher::OPERATOR_AND; $value = \explode(AbstractMatcher::OPERATOR_AND, $value); } elseif (\strpos($value, AbstractMatcher::OPERATOR_OR)) { $operator = AbstractMatcher::OPERATOR_OR; $value = \explode(AbstractMatcher::OPERATOR_OR, $value); } elseif (0 === \strpos($value, AbstractMatcher::OPERATOR_NOT)) { $value = [AbstractMatcher::OPERATOR_NOT => \substr($value, 1)]; } if (null !== $operator) { return [ $operator => \array_map( function ($val) { return 0 === \strpos($val, AbstractMatcher::OPERATOR_NOT) ? [AbstractMatcher::OPERATOR_NOT => \substr($val, 1)] : $val; }, $value ) ]; } } return $value; }
php
public static function parse($value) { if (\is_string($value)) { $operator = null; if (\strpos($value, AbstractMatcher::OPERATOR_AND)) { $operator = AbstractMatcher::OPERATOR_AND; $value = \explode(AbstractMatcher::OPERATOR_AND, $value); } elseif (\strpos($value, AbstractMatcher::OPERATOR_OR)) { $operator = AbstractMatcher::OPERATOR_OR; $value = \explode(AbstractMatcher::OPERATOR_OR, $value); } elseif (0 === \strpos($value, AbstractMatcher::OPERATOR_NOT)) { $value = [AbstractMatcher::OPERATOR_NOT => \substr($value, 1)]; } if (null !== $operator) { return [ $operator => \array_map( function ($val) { return 0 === \strpos($val, AbstractMatcher::OPERATOR_NOT) ? [AbstractMatcher::OPERATOR_NOT => \substr($val, 1)] : $val; }, $value ) ]; } } return $value; }
[ "public", "static", "function", "parse", "(", "$", "value", ")", "{", "if", "(", "\\", "is_string", "(", "$", "value", ")", ")", "{", "$", "operator", "=", "null", ";", "if", "(", "\\", "strpos", "(", "$", "value", ",", "AbstractMatcher", "::", "OPERATOR_AND", ")", ")", "{", "$", "operator", "=", "AbstractMatcher", "::", "OPERATOR_AND", ";", "$", "value", "=", "\\", "explode", "(", "AbstractMatcher", "::", "OPERATOR_AND", ",", "$", "value", ")", ";", "}", "elseif", "(", "\\", "strpos", "(", "$", "value", ",", "AbstractMatcher", "::", "OPERATOR_OR", ")", ")", "{", "$", "operator", "=", "AbstractMatcher", "::", "OPERATOR_OR", ";", "$", "value", "=", "\\", "explode", "(", "AbstractMatcher", "::", "OPERATOR_OR", ",", "$", "value", ")", ";", "}", "elseif", "(", "0", "===", "\\", "strpos", "(", "$", "value", ",", "AbstractMatcher", "::", "OPERATOR_NOT", ")", ")", "{", "$", "value", "=", "[", "AbstractMatcher", "::", "OPERATOR_NOT", "=>", "\\", "substr", "(", "$", "value", ",", "1", ")", "]", ";", "}", "if", "(", "null", "!==", "$", "operator", ")", "{", "return", "[", "$", "operator", "=>", "\\", "array_map", "(", "function", "(", "$", "val", ")", "{", "return", "0", "===", "\\", "strpos", "(", "$", "val", ",", "AbstractMatcher", "::", "OPERATOR_NOT", ")", "?", "[", "AbstractMatcher", "::", "OPERATOR_NOT", "=>", "\\", "substr", "(", "$", "val", ",", "1", ")", "]", ":", "$", "val", ";", "}", ",", "$", "value", ")", "]", ";", "}", "}", "return", "$", "value", ";", "}" ]
Checks if the given expression is a string and if so, parses it and returns an array contains the parsed expression that is ready to be used in matchers. @param mixed $value @return mixed
[ "Checks", "if", "the", "given", "expression", "is", "a", "string", "and", "if", "so", "parses", "it", "and", "returns", "an", "array", "contains", "the", "parsed", "expression", "that", "is", "ready", "to", "be", "used", "in", "matchers", "." ]
89c9bc60140292c9367a0c3178f760ecbcec6bd2
https://github.com/oroinc/OroChainProcessorComponent/blob/89c9bc60140292c9367a0c3178f760ecbcec6bd2/ExpressionParser.php#L20-L48
12,442
GrupaZero/core
database/migrations/2014_11_16_114113_create_options.php
CreateOptions.seedOptions
private function seedOptions() { // gzero config options $options = [ 'general' => [ 'site_name' => [], 'site_desc' => [], 'default_page_size' => [], 'cookies_policy_url' => [], ], 'seo' => [ 'desc_length' => [], 'google_analytics_id' => [], ] ]; // Propagate Lang options based on gzero config foreach ($options as $categoryKey => $category) { foreach ($options[$categoryKey] as $key => $option) { foreach (Language::all()->toArray() as $lang) { if ($categoryKey != 'general') { $options[$categoryKey][$key][$lang['code']] = config('gzero.' . $categoryKey . '.' . $key); } else { $value = $this->getDefaultValueForGeneral($key); $options[$categoryKey][$key][$lang['code']] = $value; } } } } // Seed options foreach ($options as $category => $option) { OptionCategory::create(['key' => $category]); foreach ($option as $key => $value) { OptionCategory::find($category)->options()->create( ['key' => $key, 'value' => $value] ); } } }
php
private function seedOptions() { // gzero config options $options = [ 'general' => [ 'site_name' => [], 'site_desc' => [], 'default_page_size' => [], 'cookies_policy_url' => [], ], 'seo' => [ 'desc_length' => [], 'google_analytics_id' => [], ] ]; // Propagate Lang options based on gzero config foreach ($options as $categoryKey => $category) { foreach ($options[$categoryKey] as $key => $option) { foreach (Language::all()->toArray() as $lang) { if ($categoryKey != 'general') { $options[$categoryKey][$key][$lang['code']] = config('gzero.' . $categoryKey . '.' . $key); } else { $value = $this->getDefaultValueForGeneral($key); $options[$categoryKey][$key][$lang['code']] = $value; } } } } // Seed options foreach ($options as $category => $option) { OptionCategory::create(['key' => $category]); foreach ($option as $key => $value) { OptionCategory::find($category)->options()->create( ['key' => $key, 'value' => $value] ); } } }
[ "private", "function", "seedOptions", "(", ")", "{", "// gzero config options", "$", "options", "=", "[", "'general'", "=>", "[", "'site_name'", "=>", "[", "]", ",", "'site_desc'", "=>", "[", "]", ",", "'default_page_size'", "=>", "[", "]", ",", "'cookies_policy_url'", "=>", "[", "]", ",", "]", ",", "'seo'", "=>", "[", "'desc_length'", "=>", "[", "]", ",", "'google_analytics_id'", "=>", "[", "]", ",", "]", "]", ";", "// Propagate Lang options based on gzero config", "foreach", "(", "$", "options", "as", "$", "categoryKey", "=>", "$", "category", ")", "{", "foreach", "(", "$", "options", "[", "$", "categoryKey", "]", "as", "$", "key", "=>", "$", "option", ")", "{", "foreach", "(", "Language", "::", "all", "(", ")", "->", "toArray", "(", ")", "as", "$", "lang", ")", "{", "if", "(", "$", "categoryKey", "!=", "'general'", ")", "{", "$", "options", "[", "$", "categoryKey", "]", "[", "$", "key", "]", "[", "$", "lang", "[", "'code'", "]", "]", "=", "config", "(", "'gzero.'", ".", "$", "categoryKey", ".", "'.'", ".", "$", "key", ")", ";", "}", "else", "{", "$", "value", "=", "$", "this", "->", "getDefaultValueForGeneral", "(", "$", "key", ")", ";", "$", "options", "[", "$", "categoryKey", "]", "[", "$", "key", "]", "[", "$", "lang", "[", "'code'", "]", "]", "=", "$", "value", ";", "}", "}", "}", "}", "// Seed options", "foreach", "(", "$", "options", "as", "$", "category", "=>", "$", "option", ")", "{", "OptionCategory", "::", "create", "(", "[", "'key'", "=>", "$", "category", "]", ")", ";", "foreach", "(", "$", "option", "as", "$", "key", "=>", "$", "value", ")", "{", "OptionCategory", "::", "find", "(", "$", "category", ")", "->", "options", "(", ")", "->", "create", "(", "[", "'key'", "=>", "$", "key", ",", "'value'", "=>", "$", "value", "]", ")", ";", "}", "}", "}" ]
Seed options from gzero config to 'main' category @return void
[ "Seed", "options", "from", "gzero", "config", "to", "main", "category" ]
093e515234fa0385b259ba4d8bc7832174a44eab
https://github.com/GrupaZero/core/blob/093e515234fa0385b259ba4d8bc7832174a44eab/database/migrations/2014_11_16_114113_create_options.php#L59-L99
12,443
GrupaZero/core
database/migrations/2014_11_16_114113_create_options.php
CreateOptions.getDefaultValueForGeneral
private function getDefaultValueForGeneral($key) { switch ($key) { case 'site_name': $value = config('app.name'); break; case 'site_desc': $value = "GZERO-CMS Content management system."; break; default: $value = config('gzero.' . $key); return $value; } return $value; }
php
private function getDefaultValueForGeneral($key) { switch ($key) { case 'site_name': $value = config('app.name'); break; case 'site_desc': $value = "GZERO-CMS Content management system."; break; default: $value = config('gzero.' . $key); return $value; } return $value; }
[ "private", "function", "getDefaultValueForGeneral", "(", "$", "key", ")", "{", "switch", "(", "$", "key", ")", "{", "case", "'site_name'", ":", "$", "value", "=", "config", "(", "'app.name'", ")", ";", "break", ";", "case", "'site_desc'", ":", "$", "value", "=", "\"GZERO-CMS Content management system.\"", ";", "break", ";", "default", ":", "$", "value", "=", "config", "(", "'gzero.'", ".", "$", "key", ")", ";", "return", "$", "value", ";", "}", "return", "$", "value", ";", "}" ]
It generates default value for general options @param $key @return mixed|string
[ "It", "generates", "default", "value", "for", "general", "options" ]
093e515234fa0385b259ba4d8bc7832174a44eab
https://github.com/GrupaZero/core/blob/093e515234fa0385b259ba4d8bc7832174a44eab/database/migrations/2014_11_16_114113_create_options.php#L108-L122
12,444
nattreid/form
src/Control/LinkControl.php
LinkControl.link
public function link(?string $link = null): self { $this->control->href = $link; return $this; }
php
public function link(?string $link = null): self { $this->control->href = $link; return $this; }
[ "public", "function", "link", "(", "?", "string", "$", "link", "=", "null", ")", ":", "self", "{", "$", "this", "->", "control", "->", "href", "=", "$", "link", ";", "return", "$", "this", ";", "}" ]
Ulozi link odkazu @param string $link @return self
[ "Ulozi", "link", "odkazu" ]
d8b447f77e2374832e4c52520767847497a2033e
https://github.com/nattreid/form/blob/d8b447f77e2374832e4c52520767847497a2033e/src/Control/LinkControl.php#L34-L38
12,445
monolyth-php/cesession
src/Handler/Memcached.php
Memcached.getKey
private function getKey(string $id = null) : string { $id = $id ?: session_id(); return sprintf('%s/session/%s', session_name(), $id); }
php
private function getKey(string $id = null) : string { $id = $id ?: session_id(); return sprintf('%s/session/%s', session_name(), $id); }
[ "private", "function", "getKey", "(", "string", "$", "id", "=", "null", ")", ":", "string", "{", "$", "id", "=", "$", "id", "?", ":", "session_id", "(", ")", ";", "return", "sprintf", "(", "'%s/session/%s'", ",", "session_name", "(", ")", ",", "$", "id", ")", ";", "}" ]
Helper to get a formatted key for memcached based on a session ID. @param string $id Session ID, defaults to `session_id()`. @return string
[ "Helper", "to", "get", "a", "formatted", "key", "for", "memcached", "based", "on", "a", "session", "ID", "." ]
4b1660396dab801177d34271154f7f6d286de6fa
https://github.com/monolyth-php/cesession/blob/4b1660396dab801177d34271154f7f6d286de6fa/src/Handler/Memcached.php#L29-L33
12,446
asbsoft/yii2module-users_0_170112
controllers/MainController.php
MainController.actionSignup
public function actionSignup($defaultUrl = null) { $user = $this->module->model('User'); $configProfileForm = [ 'user' => $user, 'scenario' => ProfileForm::SCENARIO_CREATE, 'captchaActionUid' => $this->uniqueId . '/' . static::$captchaActionId, ]; $model = $this->module->model('ProfileForm', [$configProfileForm]); $post = Yii::$app->request->post(); $loaded = $model->load($post); if ($loaded && $model->save(true)) { $this->sendSignupEmail($model); if ($defaultUrl === null) { $defaultUrl = Yii::$app->getHomeUrl(); // not null because sometimes go back to signup (without POST) will error } return $this->goBack($defaultUrl); } else { return $this->render('profile-form', [ 'model' => $model, ]); } }
php
public function actionSignup($defaultUrl = null) { $user = $this->module->model('User'); $configProfileForm = [ 'user' => $user, 'scenario' => ProfileForm::SCENARIO_CREATE, 'captchaActionUid' => $this->uniqueId . '/' . static::$captchaActionId, ]; $model = $this->module->model('ProfileForm', [$configProfileForm]); $post = Yii::$app->request->post(); $loaded = $model->load($post); if ($loaded && $model->save(true)) { $this->sendSignupEmail($model); if ($defaultUrl === null) { $defaultUrl = Yii::$app->getHomeUrl(); // not null because sometimes go back to signup (without POST) will error } return $this->goBack($defaultUrl); } else { return $this->render('profile-form', [ 'model' => $model, ]); } }
[ "public", "function", "actionSignup", "(", "$", "defaultUrl", "=", "null", ")", "{", "$", "user", "=", "$", "this", "->", "module", "->", "model", "(", "'User'", ")", ";", "$", "configProfileForm", "=", "[", "'user'", "=>", "$", "user", ",", "'scenario'", "=>", "ProfileForm", "::", "SCENARIO_CREATE", ",", "'captchaActionUid'", "=>", "$", "this", "->", "uniqueId", ".", "'/'", ".", "static", "::", "$", "captchaActionId", ",", "]", ";", "$", "model", "=", "$", "this", "->", "module", "->", "model", "(", "'ProfileForm'", ",", "[", "$", "configProfileForm", "]", ")", ";", "$", "post", "=", "Yii", "::", "$", "app", "->", "request", "->", "post", "(", ")", ";", "$", "loaded", "=", "$", "model", "->", "load", "(", "$", "post", ")", ";", "if", "(", "$", "loaded", "&&", "$", "model", "->", "save", "(", "true", ")", ")", "{", "$", "this", "->", "sendSignupEmail", "(", "$", "model", ")", ";", "if", "(", "$", "defaultUrl", "===", "null", ")", "{", "$", "defaultUrl", "=", "Yii", "::", "$", "app", "->", "getHomeUrl", "(", ")", ";", "// not null because sometimes go back to signup (without POST) will error", "}", "return", "$", "this", "->", "goBack", "(", "$", "defaultUrl", ")", ";", "}", "else", "{", "return", "$", "this", "->", "render", "(", "'profile-form'", ",", "[", "'model'", "=>", "$", "model", ",", "]", ")", ";", "}", "}" ]
Create user's profile. @param string|array $defaultUrl return URL after signup @return mixed
[ "Create", "user", "s", "profile", "." ]
3906fdde2d5fdd54637f2b5246d52fe91ec5f648
https://github.com/asbsoft/yii2module-users_0_170112/blob/3906fdde2d5fdd54637f2b5246d52fe91ec5f648/controllers/MainController.php#L191-L214
12,447
asbsoft/yii2module-users_0_170112
controllers/MainController.php
MainController.actionConfirm
public function actionConfirm($token) { $user = $this->module->model('User'); $user = $this->findModel([ 'auth_key' => $token, 'status' => $user::STATUS_REGISTERED, ]); if (empty($user)) { Yii::$app->session->setFlash('error', Yii::t($this->tcModule, 'Such unconfirmed user not found or already confirmed.') . ' ' . Yii::t($this->tcModule, 'Try to login or signup again.') ); return $this->redirect(['login']); } if ($this->confirmExpireDays) { $confirmExpirePeriod = 60 * 60 * 24 * $this->confirmExpireDays; if (time() > ($user->created_at + $confirmExpirePeriod)) { $user->delete(); Yii::$app->session->setFlash('error', Yii::t($this->tcModule, 'Token expired please register again.')); return $this->redirect(['signup']); } } $user->status = $this->waitModeration ? $user::STATUS_WAIT : $user::STATUS_ACTIVE; $user->auth_key = $user->generateAuthKey(); $result = $user->save(); if ($result) { $msg = Yii::t($this->tcModule, 'Registration confirmed.'); if ($this->waitModeration) { $msg .= ' ' . Yii::t($this->tcModule, 'Wait moderation.'); } Yii::$app->session->setFlash('success', $msg); } else { $msg = Yii::t($this->tcModule, 'User registration confirmation error.'); Yii::trace($msg . ' ' . var_export($user->errors, true) . ' ' . var_export($user->attributes, true)); Yii::$app->session->setFlash('error', $msg . ' ' . Yii::t($this->tcModule, 'Apply to support.')); } return $this->goHome(); }
php
public function actionConfirm($token) { $user = $this->module->model('User'); $user = $this->findModel([ 'auth_key' => $token, 'status' => $user::STATUS_REGISTERED, ]); if (empty($user)) { Yii::$app->session->setFlash('error', Yii::t($this->tcModule, 'Such unconfirmed user not found or already confirmed.') . ' ' . Yii::t($this->tcModule, 'Try to login or signup again.') ); return $this->redirect(['login']); } if ($this->confirmExpireDays) { $confirmExpirePeriod = 60 * 60 * 24 * $this->confirmExpireDays; if (time() > ($user->created_at + $confirmExpirePeriod)) { $user->delete(); Yii::$app->session->setFlash('error', Yii::t($this->tcModule, 'Token expired please register again.')); return $this->redirect(['signup']); } } $user->status = $this->waitModeration ? $user::STATUS_WAIT : $user::STATUS_ACTIVE; $user->auth_key = $user->generateAuthKey(); $result = $user->save(); if ($result) { $msg = Yii::t($this->tcModule, 'Registration confirmed.'); if ($this->waitModeration) { $msg .= ' ' . Yii::t($this->tcModule, 'Wait moderation.'); } Yii::$app->session->setFlash('success', $msg); } else { $msg = Yii::t($this->tcModule, 'User registration confirmation error.'); Yii::trace($msg . ' ' . var_export($user->errors, true) . ' ' . var_export($user->attributes, true)); Yii::$app->session->setFlash('error', $msg . ' ' . Yii::t($this->tcModule, 'Apply to support.')); } return $this->goHome(); }
[ "public", "function", "actionConfirm", "(", "$", "token", ")", "{", "$", "user", "=", "$", "this", "->", "module", "->", "model", "(", "'User'", ")", ";", "$", "user", "=", "$", "this", "->", "findModel", "(", "[", "'auth_key'", "=>", "$", "token", ",", "'status'", "=>", "$", "user", "::", "STATUS_REGISTERED", ",", "]", ")", ";", "if", "(", "empty", "(", "$", "user", ")", ")", "{", "Yii", "::", "$", "app", "->", "session", "->", "setFlash", "(", "'error'", ",", "Yii", "::", "t", "(", "$", "this", "->", "tcModule", ",", "'Such unconfirmed user not found or already confirmed.'", ")", ".", "' '", ".", "Yii", "::", "t", "(", "$", "this", "->", "tcModule", ",", "'Try to login or signup again.'", ")", ")", ";", "return", "$", "this", "->", "redirect", "(", "[", "'login'", "]", ")", ";", "}", "if", "(", "$", "this", "->", "confirmExpireDays", ")", "{", "$", "confirmExpirePeriod", "=", "60", "*", "60", "*", "24", "*", "$", "this", "->", "confirmExpireDays", ";", "if", "(", "time", "(", ")", ">", "(", "$", "user", "->", "created_at", "+", "$", "confirmExpirePeriod", ")", ")", "{", "$", "user", "->", "delete", "(", ")", ";", "Yii", "::", "$", "app", "->", "session", "->", "setFlash", "(", "'error'", ",", "Yii", "::", "t", "(", "$", "this", "->", "tcModule", ",", "'Token expired please register again.'", ")", ")", ";", "return", "$", "this", "->", "redirect", "(", "[", "'signup'", "]", ")", ";", "}", "}", "$", "user", "->", "status", "=", "$", "this", "->", "waitModeration", "?", "$", "user", "::", "STATUS_WAIT", ":", "$", "user", "::", "STATUS_ACTIVE", ";", "$", "user", "->", "auth_key", "=", "$", "user", "->", "generateAuthKey", "(", ")", ";", "$", "result", "=", "$", "user", "->", "save", "(", ")", ";", "if", "(", "$", "result", ")", "{", "$", "msg", "=", "Yii", "::", "t", "(", "$", "this", "->", "tcModule", ",", "'Registration confirmed.'", ")", ";", "if", "(", "$", "this", "->", "waitModeration", ")", "{", "$", "msg", ".=", "' '", ".", "Yii", "::", "t", "(", "$", "this", "->", "tcModule", ",", "'Wait moderation.'", ")", ";", "}", "Yii", "::", "$", "app", "->", "session", "->", "setFlash", "(", "'success'", ",", "$", "msg", ")", ";", "}", "else", "{", "$", "msg", "=", "Yii", "::", "t", "(", "$", "this", "->", "tcModule", ",", "'User registration confirmation error.'", ")", ";", "Yii", "::", "trace", "(", "$", "msg", ".", "' '", ".", "var_export", "(", "$", "user", "->", "errors", ",", "true", ")", ".", "' '", ".", "var_export", "(", "$", "user", "->", "attributes", ",", "true", ")", ")", ";", "Yii", "::", "$", "app", "->", "session", "->", "setFlash", "(", "'error'", ",", "$", "msg", ".", "' '", ".", "Yii", "::", "t", "(", "$", "this", "->", "tcModule", ",", "'Apply to support.'", ")", ")", ";", "}", "return", "$", "this", "->", "goHome", "(", ")", ";", "}" ]
Confirm registration by click on link in email.
[ "Confirm", "registration", "by", "click", "on", "link", "in", "email", "." ]
3906fdde2d5fdd54637f2b5246d52fe91ec5f648
https://github.com/asbsoft/yii2module-users_0_170112/blob/3906fdde2d5fdd54637f2b5246d52fe91ec5f648/controllers/MainController.php#L270-L311
12,448
jaeger-app/email
src/Email.php
Email.setViewOptions
public function setViewOptions($template, array $view_data = array()) { $this->view_options = $view_data; $this->view_template = $template; return $this; }
php
public function setViewOptions($template, array $view_data = array()) { $this->view_options = $view_data; $this->view_template = $template; return $this; }
[ "public", "function", "setViewOptions", "(", "$", "template", ",", "array", "$", "view_data", "=", "array", "(", ")", ")", "{", "$", "this", "->", "view_options", "=", "$", "view_data", ";", "$", "this", "->", "view_template", "=", "$", "template", ";", "return", "$", "this", ";", "}" ]
Compiles the options to use for the view @param string $template @param array $view_data @return \JaegerApp\Email
[ "Compiles", "the", "options", "to", "use", "for", "the", "view" ]
0ab7535e578b2112a929816e39afb6118eaca669
https://github.com/jaeger-app/email/blob/0ab7535e578b2112a929816e39afb6118eaca669/src/Email.php#L199-L204
12,449
jaeger-app/email
src/Email.php
Email.getMailer
public function getMailer() { if (is_null($this->mailer)) { if(class_exists('\Swift')) { if(version_compare(\Swift::VERSION, 4, '<=') && version_compare(\Swift::VERSION, 3, '>=')) { $mailer = new Email\Swift3($this->config); } else { $mailer = new Email\Swift5($this->config); } } else { $mailer = new Email\Swift5($this->config); } $this->mailer = $mailer; } return $this->mailer; }
php
public function getMailer() { if (is_null($this->mailer)) { if(class_exists('\Swift')) { if(version_compare(\Swift::VERSION, 4, '<=') && version_compare(\Swift::VERSION, 3, '>=')) { $mailer = new Email\Swift3($this->config); } else { $mailer = new Email\Swift5($this->config); } } else { $mailer = new Email\Swift5($this->config); } $this->mailer = $mailer; } return $this->mailer; }
[ "public", "function", "getMailer", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "mailer", ")", ")", "{", "if", "(", "class_exists", "(", "'\\Swift'", ")", ")", "{", "if", "(", "version_compare", "(", "\\", "Swift", "::", "VERSION", ",", "4", ",", "'<='", ")", "&&", "version_compare", "(", "\\", "Swift", "::", "VERSION", ",", "3", ",", "'>='", ")", ")", "{", "$", "mailer", "=", "new", "Email", "\\", "Swift3", "(", "$", "this", "->", "config", ")", ";", "}", "else", "{", "$", "mailer", "=", "new", "Email", "\\", "Swift5", "(", "$", "this", "->", "config", ")", ";", "}", "}", "else", "{", "$", "mailer", "=", "new", "Email", "\\", "Swift5", "(", "$", "this", "->", "config", ")", ";", "}", "$", "this", "->", "mailer", "=", "$", "mailer", ";", "}", "return", "$", "this", "->", "mailer", ";", "}" ]
Returns an instance of the mail object @return Email\SwiftAbstract
[ "Returns", "an", "instance", "of", "the", "mail", "object" ]
0ab7535e578b2112a929816e39afb6118eaca669
https://github.com/jaeger-app/email/blob/0ab7535e578b2112a929816e39afb6118eaca669/src/Email.php#L342-L363
12,450
jaeger-app/email
src/Email.php
Email.clear
public function clear() { $this->mailer = null; $this->to = $this->attachemnts = array(); $this->subject = $this->message = false; return $this; }
php
public function clear() { $this->mailer = null; $this->to = $this->attachemnts = array(); $this->subject = $this->message = false; return $this; }
[ "public", "function", "clear", "(", ")", "{", "$", "this", "->", "mailer", "=", "null", ";", "$", "this", "->", "to", "=", "$", "this", "->", "attachemnts", "=", "array", "(", ")", ";", "$", "this", "->", "subject", "=", "$", "this", "->", "message", "=", "false", ";", "return", "$", "this", ";", "}" ]
Resets the email object @return \JaegerApp\Email
[ "Resets", "the", "email", "object" ]
0ab7535e578b2112a929816e39afb6118eaca669
https://github.com/jaeger-app/email/blob/0ab7535e578b2112a929816e39afb6118eaca669/src/Email.php#L370-L376
12,451
jaeger-app/email
src/Email.php
Email.send
public function send(array $vars = array()) { if (count($this->getTo()) == 0) { throw new \InvalidArgumentException('A "To" email address is requried'); } if ($this->getSubject() == '') { throw new \InvalidArgumentException('A subject for the email must be set'); } if ($this->getMessage() == '') { throw new \InvalidArgumentException('There isn\'t a message set'); } $valid_emails = array(); foreach ($this->getTo() as $to) { if (filter_var(trim($to), FILTER_VALIDATE_EMAIL)) { $valid_emails[] = trim($to); } } if (! $valid_emails) { return; } $mailer = $this->getMailer(); $subject = $this->getView()->render($this->getSubject(), $vars); $body_message = $this->getView()->render($this->getMessage(), $vars); $message = $mailer->getMessage($valid_emails, $this->config['from_email'], $this->config['sender_name'], $subject, $body_message, $this->getAttachments(), $this->getMailtype()); if (! $mailer->send($message)) { throw new EmailException($this->getMailer()->ErrorInfo); } $this->clear(); }
php
public function send(array $vars = array()) { if (count($this->getTo()) == 0) { throw new \InvalidArgumentException('A "To" email address is requried'); } if ($this->getSubject() == '') { throw new \InvalidArgumentException('A subject for the email must be set'); } if ($this->getMessage() == '') { throw new \InvalidArgumentException('There isn\'t a message set'); } $valid_emails = array(); foreach ($this->getTo() as $to) { if (filter_var(trim($to), FILTER_VALIDATE_EMAIL)) { $valid_emails[] = trim($to); } } if (! $valid_emails) { return; } $mailer = $this->getMailer(); $subject = $this->getView()->render($this->getSubject(), $vars); $body_message = $this->getView()->render($this->getMessage(), $vars); $message = $mailer->getMessage($valid_emails, $this->config['from_email'], $this->config['sender_name'], $subject, $body_message, $this->getAttachments(), $this->getMailtype()); if (! $mailer->send($message)) { throw new EmailException($this->getMailer()->ErrorInfo); } $this->clear(); }
[ "public", "function", "send", "(", "array", "$", "vars", "=", "array", "(", ")", ")", "{", "if", "(", "count", "(", "$", "this", "->", "getTo", "(", ")", ")", "==", "0", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'A \"To\" email address is requried'", ")", ";", "}", "if", "(", "$", "this", "->", "getSubject", "(", ")", "==", "''", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'A subject for the email must be set'", ")", ";", "}", "if", "(", "$", "this", "->", "getMessage", "(", ")", "==", "''", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'There isn\\'t a message set'", ")", ";", "}", "$", "valid_emails", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getTo", "(", ")", "as", "$", "to", ")", "{", "if", "(", "filter_var", "(", "trim", "(", "$", "to", ")", ",", "FILTER_VALIDATE_EMAIL", ")", ")", "{", "$", "valid_emails", "[", "]", "=", "trim", "(", "$", "to", ")", ";", "}", "}", "if", "(", "!", "$", "valid_emails", ")", "{", "return", ";", "}", "$", "mailer", "=", "$", "this", "->", "getMailer", "(", ")", ";", "$", "subject", "=", "$", "this", "->", "getView", "(", ")", "->", "render", "(", "$", "this", "->", "getSubject", "(", ")", ",", "$", "vars", ")", ";", "$", "body_message", "=", "$", "this", "->", "getView", "(", ")", "->", "render", "(", "$", "this", "->", "getMessage", "(", ")", ",", "$", "vars", ")", ";", "$", "message", "=", "$", "mailer", "->", "getMessage", "(", "$", "valid_emails", ",", "$", "this", "->", "config", "[", "'from_email'", "]", ",", "$", "this", "->", "config", "[", "'sender_name'", "]", ",", "$", "subject", ",", "$", "body_message", ",", "$", "this", "->", "getAttachments", "(", ")", ",", "$", "this", "->", "getMailtype", "(", ")", ")", ";", "if", "(", "!", "$", "mailer", "->", "send", "(", "$", "message", ")", ")", "{", "throw", "new", "EmailException", "(", "$", "this", "->", "getMailer", "(", ")", "->", "ErrorInfo", ")", ";", "}", "$", "this", "->", "clear", "(", ")", ";", "}" ]
Sends the email @param array $vars @throws \InvalidArgumentException @throws \InvalidArgumentException @throws EmailException
[ "Sends", "the", "email" ]
0ab7535e578b2112a929816e39afb6118eaca669
https://github.com/jaeger-app/email/blob/0ab7535e578b2112a929816e39afb6118eaca669/src/Email.php#L386-L421
12,452
ehough/shortstop
src/main/php/ehough/shortstop/impl/exec/command/StreamsCommand.php
ehough_shortstop_impl_exec_command_StreamsCommand.canHandle
public function canHandle(ehough_shortstop_api_HttpRequest $request) { $scheme = $request->getUrl()->getScheme(); return preg_match_all('/https?/', $scheme, $matches) === 1; }
php
public function canHandle(ehough_shortstop_api_HttpRequest $request) { $scheme = $request->getUrl()->getScheme(); return preg_match_all('/https?/', $scheme, $matches) === 1; }
[ "public", "function", "canHandle", "(", "ehough_shortstop_api_HttpRequest", "$", "request", ")", "{", "$", "scheme", "=", "$", "request", "->", "getUrl", "(", ")", "->", "getScheme", "(", ")", ";", "return", "preg_match_all", "(", "'/https?/'", ",", "$", "scheme", ",", "$", "matches", ")", "===", "1", ";", "}" ]
Determines if this transport can handle the given request. @param ehough_shortstop_api_HttpRequest $request The request to handle. @return bool True if this transport can handle the given request. False otherwise.
[ "Determines", "if", "this", "transport", "can", "handle", "the", "given", "request", "." ]
4cef21457741347546c70e8e5c0cef6d3162b257
https://github.com/ehough/shortstop/blob/4cef21457741347546c70e8e5c0cef6d3162b257/src/main/php/ehough/shortstop/impl/exec/command/StreamsCommand.php#L229-L234
12,453
sellerlabs/nucleus
src/SellerLabs/Nucleus/Control/Monad.php
Monad.fmap
public function fmap(callable $closure) { return $this->bind(function ($a) use ($closure) { return $this->of($closure($a)); }); }
php
public function fmap(callable $closure) { return $this->bind(function ($a) use ($closure) { return $this->of($closure($a)); }); }
[ "public", "function", "fmap", "(", "callable", "$", "closure", ")", "{", "return", "$", "this", "->", "bind", "(", "function", "(", "$", "a", ")", "use", "(", "$", "closure", ")", "{", "return", "$", "this", "->", "of", "(", "$", "closure", "(", "$", "a", ")", ")", ";", "}", ")", ";", "}" ]
Apply a function. @param callable|Closure $closure @return MonadInterface
[ "Apply", "a", "function", "." ]
c05d9c23d424a6bd5ab2e29140805cc6e37e4623
https://github.com/sellerlabs/nucleus/blob/c05d9c23d424a6bd5ab2e29140805cc6e37e4623/src/SellerLabs/Nucleus/Control/Monad.php#L45-L50
12,454
jitesoft/php-math
src/Vector2D.php
Vector2D.set
public function set(float $x, float $y) { $this->setX($x); $this->setY($y); }
php
public function set(float $x, float $y) { $this->setX($x); $this->setY($y); }
[ "public", "function", "set", "(", "float", "$", "x", ",", "float", "$", "y", ")", "{", "$", "this", "->", "setX", "(", "$", "x", ")", ";", "$", "this", "->", "setY", "(", "$", "y", ")", ";", "}" ]
Set the X and Y coordinate of the vector. @param float $x X-Coordinate. @param float $y Y-Coordinate.
[ "Set", "the", "X", "and", "Y", "coordinate", "of", "the", "vector", "." ]
1775055e5a14ef30c7df0deeb1fe1ff0775bb581
https://github.com/jitesoft/php-math/blob/1775055e5a14ef30c7df0deeb1fe1ff0775bb581/src/Vector2D.php#L39-L42
12,455
marando/phpSOFA
src/Marando/IAU/iauTaiutc.php
iauTaiutc.Taiutc
public static function Taiutc($tai1, $tai2, &$utc1, &$utc2) { $big1; $i; $j; $a1; $a2; $u1; $u2; $g1; $g2; /* Put the two parts of the TAI into big-first order. */ $big1 = ( $tai1 >= $tai2 ); if ($big1) { $a1 = $tai1; $a2 = $tai2; } else { $a1 = $tai2; $a2 = $tai1; } /* Initial guess for UTC. */ $u1 = $a1; $u2 = $a2; /* Iterate (though in most cases just once is enough). */ for ($i = 0; $i < 3; $i++) { /* Guessed UTC to TAI. */ $j = IAU::Utctai($u1, $u2, $g1, $g2); if ($j < 0) return $j; /* Adjust guessed UTC. */ $u2 += $a1 - $g1; $u2 += $a2 - $g2; } /* Return the UTC result, preserving the TAI order. */ if ($big1) { $utc1 = $u1; $utc2 = $u2; } else { $utc1 = $u2; $utc2 = $u1; } /* Status. */ return $j; }
php
public static function Taiutc($tai1, $tai2, &$utc1, &$utc2) { $big1; $i; $j; $a1; $a2; $u1; $u2; $g1; $g2; /* Put the two parts of the TAI into big-first order. */ $big1 = ( $tai1 >= $tai2 ); if ($big1) { $a1 = $tai1; $a2 = $tai2; } else { $a1 = $tai2; $a2 = $tai1; } /* Initial guess for UTC. */ $u1 = $a1; $u2 = $a2; /* Iterate (though in most cases just once is enough). */ for ($i = 0; $i < 3; $i++) { /* Guessed UTC to TAI. */ $j = IAU::Utctai($u1, $u2, $g1, $g2); if ($j < 0) return $j; /* Adjust guessed UTC. */ $u2 += $a1 - $g1; $u2 += $a2 - $g2; } /* Return the UTC result, preserving the TAI order. */ if ($big1) { $utc1 = $u1; $utc2 = $u2; } else { $utc1 = $u2; $utc2 = $u1; } /* Status. */ return $j; }
[ "public", "static", "function", "Taiutc", "(", "$", "tai1", ",", "$", "tai2", ",", "&", "$", "utc1", ",", "&", "$", "utc2", ")", "{", "$", "big1", ";", "$", "i", ";", "$", "j", ";", "$", "a1", ";", "$", "a2", ";", "$", "u1", ";", "$", "u2", ";", "$", "g1", ";", "$", "g2", ";", "/* Put the two parts of the TAI into big-first order. */", "$", "big1", "=", "(", "$", "tai1", ">=", "$", "tai2", ")", ";", "if", "(", "$", "big1", ")", "{", "$", "a1", "=", "$", "tai1", ";", "$", "a2", "=", "$", "tai2", ";", "}", "else", "{", "$", "a1", "=", "$", "tai2", ";", "$", "a2", "=", "$", "tai1", ";", "}", "/* Initial guess for UTC. */", "$", "u1", "=", "$", "a1", ";", "$", "u2", "=", "$", "a2", ";", "/* Iterate (though in most cases just once is enough). */", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "3", ";", "$", "i", "++", ")", "{", "/* Guessed UTC to TAI. */", "$", "j", "=", "IAU", "::", "Utctai", "(", "$", "u1", ",", "$", "u2", ",", "$", "g1", ",", "$", "g2", ")", ";", "if", "(", "$", "j", "<", "0", ")", "return", "$", "j", ";", "/* Adjust guessed UTC. */", "$", "u2", "+=", "$", "a1", "-", "$", "g1", ";", "$", "u2", "+=", "$", "a2", "-", "$", "g2", ";", "}", "/* Return the UTC result, preserving the TAI order. */", "if", "(", "$", "big1", ")", "{", "$", "utc1", "=", "$", "u1", ";", "$", "utc2", "=", "$", "u2", ";", "}", "else", "{", "$", "utc1", "=", "$", "u2", ";", "$", "utc2", "=", "$", "u1", ";", "}", "/* Status. */", "return", "$", "j", ";", "}" ]
- - - - - - - - - - i a u T a i u t c - - - - - - - - - - Time scale transformation: International Atomic Time, TAI, to Coordinated Universal Time, UTC. This function is part of the International Astronomical Union's SOFA (Standards of Fundamental Astronomy) software collection. Status: canonical. Given: tai1,tai2 double TAI as a 2-part Julian Date (Note 1) Returned: utc1,utc2 double UTC as a 2-part quasi Julian Date (Notes 1-3) Returned (function value): int status: +1 = dubious year (Note 4) 0 = OK -1 = unacceptable date Notes: 1) tai1+tai2 is Julian Date, apportioned in any convenient way between the two arguments, for example where tai1 is the Julian Day Number and tai2 is the fraction of a day. The returned utc1 and utc2 form an analogous pair, except that a special convention is used, to deal with the problem of leap seconds - see the next note. 2) JD cannot unambiguously represent UTC during a leap second unless special measures are taken. The convention in the present function is that the JD day represents UTC days whether the length is 86399, 86400 or 86401 SI seconds. In the 1960-1972 era there were smaller jumps (in either direction) each time the linear UTC(TAI) expression was changed, and these "mini-leaps" are also included in the SOFA convention. 3) The function iauD2dtf can be used to transform the UTC quasi-JD into calendar date and clock time, including UTC leap second handling. 4) The warning status "dubious year" flags UTCs that predate the introduction of the time scale or that are too far in the future to be trusted. See iauDat for further details. Called: iauUtctai UTC to TAI References: McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), IERS Technical Note No. 32, BKG (2004) Explanatory Supplement to the Astronomical Almanac, P. Kenneth Seidelmann (ed), University Science Books (1992) This revision: 2013 September 12 SOFA release 2015-02-09 Copyright (C) 2015 IAU SOFA Board. See notes at end.
[ "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "i", "a", "u", "T", "a", "i", "u", "t", "c", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-" ]
757fa49fe335ae1210eaa7735473fd4388b13f07
https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauTaiutc.php#L73-L124
12,456
kambo-1st/HttpMessage
src/Utils/UriValidator.php
UriValidator.validateQuery
public function validateQuery($query) { if (!is_string($query) && !method_exists($query, '__toString')) { throw new InvalidArgumentException( 'Query must be a string' ); } if (strpos($query, '#') !== false) { throw new InvalidArgumentException( 'Query must not contain a URI fragment' ); } }
php
public function validateQuery($query) { if (!is_string($query) && !method_exists($query, '__toString')) { throw new InvalidArgumentException( 'Query must be a string' ); } if (strpos($query, '#') !== false) { throw new InvalidArgumentException( 'Query must not contain a URI fragment' ); } }
[ "public", "function", "validateQuery", "(", "$", "query", ")", "{", "if", "(", "!", "is_string", "(", "$", "query", ")", "&&", "!", "method_exists", "(", "$", "query", ",", "'__toString'", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Query must be a string'", ")", ";", "}", "if", "(", "strpos", "(", "$", "query", ",", "'#'", ")", "!==", "false", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Query must not contain a URI fragment'", ")", ";", "}", "}" ]
Validate query. Path must NOT contain URI fragment. It can be object, but then the class must implement __toString method. @param string|object $query The query path @return void @throws InvalidArgumentException If the query is invalid.
[ "Validate", "query", "." ]
38877b9d895f279fdd5bdf957d8f23f9808a940a
https://github.com/kambo-1st/HttpMessage/blob/38877b9d895f279fdd5bdf957d8f23f9808a940a/src/Utils/UriValidator.php#L71-L84
12,457
mszewcz/php-light-framework
src/Validator/Specific/EmailAddress.php
EmailAddress.isReserved
private function isReserved(string $host): bool { $hosts = [$host]; if (!\preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $host)) { $tmp = \gethostbynamel($host); $hosts = $tmp !== false ? $tmp : []; } $res = true; $flags = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; foreach ($hosts as $host) { if (\filter_var($host, FILTER_VALIDATE_IP, ['flags' => $flags]) !== false) { $res = false; break; } } return $res; }
php
private function isReserved(string $host): bool { $hosts = [$host]; if (!\preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $host)) { $tmp = \gethostbynamel($host); $hosts = $tmp !== false ? $tmp : []; } $res = true; $flags = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; foreach ($hosts as $host) { if (\filter_var($host, FILTER_VALIDATE_IP, ['flags' => $flags]) !== false) { $res = false; break; } } return $res; }
[ "private", "function", "isReserved", "(", "string", "$", "host", ")", ":", "bool", "{", "$", "hosts", "=", "[", "$", "host", "]", ";", "if", "(", "!", "\\", "preg_match", "(", "'/^([0-9]{1,3}\\.){3}[0-9]{1,3}$/'", ",", "$", "host", ")", ")", "{", "$", "tmp", "=", "\\", "gethostbynamel", "(", "$", "host", ")", ";", "$", "hosts", "=", "$", "tmp", "!==", "false", "?", "$", "tmp", ":", "[", "]", ";", "}", "$", "res", "=", "true", ";", "$", "flags", "=", "FILTER_FLAG_IPV4", "|", "FILTER_FLAG_NO_PRIV_RANGE", "|", "FILTER_FLAG_NO_RES_RANGE", ";", "foreach", "(", "$", "hosts", "as", "$", "host", ")", "{", "if", "(", "\\", "filter_var", "(", "$", "host", ",", "FILTER_VALIDATE_IP", ",", "[", "'flags'", "=>", "$", "flags", "]", ")", "!==", "false", ")", "{", "$", "res", "=", "false", ";", "break", ";", "}", "}", "return", "$", "res", ";", "}" ]
Checks whether host IP is private or reserved @param string $host @return bool
[ "Checks", "whether", "host", "IP", "is", "private", "or", "reserved" ]
4d3b46781c387202c2dfbdb8760151b3ae8ef49c
https://github.com/mszewcz/php-light-framework/blob/4d3b46781c387202c2dfbdb8760151b3ae8ef49c/src/Validator/Specific/EmailAddress.php#L47-L65
12,458
mszewcz/php-light-framework
src/Validator/Specific/EmailAddress.php
EmailAddress.mxCheck
private function mxCheck(string $value = ''): bool { $mxHosts = []; $weight = []; if (@\getmxrr($value, $mxHosts, $weight) !== false) { if (!empty($mxHosts) && !empty($weight)) { $mxHosts = \array_combine($mxHosts, $weight); } \arsort($mxHosts); } elseif (($result = @\gethostbynamel($value)) !== false) { $mxHosts = \array_flip($result); } $isValid = true; if (empty($mxHosts)) { $isValid = false; } elseif ($this->options['deep-mx-check'] === true) { $isValid = $this->deepMxCheck($mxHosts); } if (!$isValid) { $this->setError(self::VALIDATOR_ERROR_EMAIL_INVALID_MX); } return $isValid; }
php
private function mxCheck(string $value = ''): bool { $mxHosts = []; $weight = []; if (@\getmxrr($value, $mxHosts, $weight) !== false) { if (!empty($mxHosts) && !empty($weight)) { $mxHosts = \array_combine($mxHosts, $weight); } \arsort($mxHosts); } elseif (($result = @\gethostbynamel($value)) !== false) { $mxHosts = \array_flip($result); } $isValid = true; if (empty($mxHosts)) { $isValid = false; } elseif ($this->options['deep-mx-check'] === true) { $isValid = $this->deepMxCheck($mxHosts); } if (!$isValid) { $this->setError(self::VALIDATOR_ERROR_EMAIL_INVALID_MX); } return $isValid; }
[ "private", "function", "mxCheck", "(", "string", "$", "value", "=", "''", ")", ":", "bool", "{", "$", "mxHosts", "=", "[", "]", ";", "$", "weight", "=", "[", "]", ";", "if", "(", "@", "\\", "getmxrr", "(", "$", "value", ",", "$", "mxHosts", ",", "$", "weight", ")", "!==", "false", ")", "{", "if", "(", "!", "empty", "(", "$", "mxHosts", ")", "&&", "!", "empty", "(", "$", "weight", ")", ")", "{", "$", "mxHosts", "=", "\\", "array_combine", "(", "$", "mxHosts", ",", "$", "weight", ")", ";", "}", "\\", "arsort", "(", "$", "mxHosts", ")", ";", "}", "elseif", "(", "(", "$", "result", "=", "@", "\\", "gethostbynamel", "(", "$", "value", ")", ")", "!==", "false", ")", "{", "$", "mxHosts", "=", "\\", "array_flip", "(", "$", "result", ")", ";", "}", "$", "isValid", "=", "true", ";", "if", "(", "empty", "(", "$", "mxHosts", ")", ")", "{", "$", "isValid", "=", "false", ";", "}", "elseif", "(", "$", "this", "->", "options", "[", "'deep-mx-check'", "]", "===", "true", ")", "{", "$", "isValid", "=", "$", "this", "->", "deepMxCheck", "(", "$", "mxHosts", ")", ";", "}", "if", "(", "!", "$", "isValid", ")", "{", "$", "this", "->", "setError", "(", "self", "::", "VALIDATOR_ERROR_EMAIL_INVALID_MX", ")", ";", "}", "return", "$", "isValid", ";", "}" ]
Performs MX check @param string $value @return bool
[ "Performs", "MX", "check" ]
4d3b46781c387202c2dfbdb8760151b3ae8ef49c
https://github.com/mszewcz/php-light-framework/blob/4d3b46781c387202c2dfbdb8760151b3ae8ef49c/src/Validator/Specific/EmailAddress.php#L73-L98
12,459
mszewcz/php-light-framework
src/Validator/Specific/EmailAddress.php
EmailAddress.deepMxCheck
private function deepMxCheck(array $value = []): bool { $isValid = false; foreach ($value as $host => $weight) { $res = $this->isReserved($host); if (!$res && (\checkdnsrr($host, 'A') || \checkdnsrr($host, 'AAAA') || \checkdnsrr($host, 'A6'))) { $isValid = true; break; } } return $isValid; }
php
private function deepMxCheck(array $value = []): bool { $isValid = false; foreach ($value as $host => $weight) { $res = $this->isReserved($host); if (!$res && (\checkdnsrr($host, 'A') || \checkdnsrr($host, 'AAAA') || \checkdnsrr($host, 'A6'))) { $isValid = true; break; } } return $isValid; }
[ "private", "function", "deepMxCheck", "(", "array", "$", "value", "=", "[", "]", ")", ":", "bool", "{", "$", "isValid", "=", "false", ";", "foreach", "(", "$", "value", "as", "$", "host", "=>", "$", "weight", ")", "{", "$", "res", "=", "$", "this", "->", "isReserved", "(", "$", "host", ")", ";", "if", "(", "!", "$", "res", "&&", "(", "\\", "checkdnsrr", "(", "$", "host", ",", "'A'", ")", "||", "\\", "checkdnsrr", "(", "$", "host", ",", "'AAAA'", ")", "||", "\\", "checkdnsrr", "(", "$", "host", ",", "'A6'", ")", ")", ")", "{", "$", "isValid", "=", "true", ";", "break", ";", "}", "}", "return", "$", "isValid", ";", "}" ]
Performs deep MX check @param array $value @return bool
[ "Performs", "deep", "MX", "check" ]
4d3b46781c387202c2dfbdb8760151b3ae8ef49c
https://github.com/mszewcz/php-light-framework/blob/4d3b46781c387202c2dfbdb8760151b3ae8ef49c/src/Validator/Specific/EmailAddress.php#L106-L117
12,460
qi-interactive/matacms-rbac
components/DbManager.php
DbManager.deleteAllItemsByUser
public function deleteAllItemsByUser($userId) { if (empty($userId)) { return []; } $command = \Yii::$app->getDb()->createCommand(); $command->delete($this->assignmentTable, 'user_id = :user_id', ['user_id' => $userId]); return $command->execute(); }
php
public function deleteAllItemsByUser($userId) { if (empty($userId)) { return []; } $command = \Yii::$app->getDb()->createCommand(); $command->delete($this->assignmentTable, 'user_id = :user_id', ['user_id' => $userId]); return $command->execute(); }
[ "public", "function", "deleteAllItemsByUser", "(", "$", "userId", ")", "{", "if", "(", "empty", "(", "$", "userId", ")", ")", "{", "return", "[", "]", ";", "}", "$", "command", "=", "\\", "Yii", "::", "$", "app", "->", "getDb", "(", ")", "->", "createCommand", "(", ")", ";", "$", "command", "->", "delete", "(", "$", "this", "->", "assignmentTable", ",", "'user_id = :user_id'", ",", "[", "'user_id'", "=>", "$", "userId", "]", ")", ";", "return", "$", "command", "->", "execute", "(", ")", ";", "}" ]
Deleted roles and permissions assigned to user. @param integer $userId @return array
[ "Deleted", "roles", "and", "permissions", "assigned", "to", "user", "." ]
f273de201006a127b95c332e53f31de02c559130
https://github.com/qi-interactive/matacms-rbac/blob/f273de201006a127b95c332e53f31de02c559130/components/DbManager.php#L102-L111
12,461
neontabs-drupal8/nt8property
src/Batch/NT8PropertyBatch.php
NT8PropertyBatch.propertyBatchLoad
public static function propertyBatchLoad(int $batch_size = 8, int $modify_replace = 0) { $batchSizeList = [ 1 => 1, 2 => 2, 3 => 4, 4 => 8, 5 => 16, 6 => 32, 7 => 64, 8 => 128, 9 => 256, ]; // Get list of properties to reload. $per_page = $batchSizeList[$batch_size] ?? 128; // Get page count. $first_page = \Drupal::service('nt8tabsio.tabs_service')->get( "property", [ "page" => 1, "pageSize" => $per_page ] ); $first_page = json_decode($first_page); $search_instance_id = $first_page->searchId; $total_results = $first_page->totalResults; $batch = [ 'title' => t('Loading all properties from API.'), 'operations' => [], 'progress_message' => t('Processed @current out of @total.'), 'finished' => '\Drupal\nt8property\Batch\NT8PropertyBatch::propertyBatchLoadFinishedCallback', ]; $pages = ceil($total_results / $per_page); $last_page = $total_results - ($per_page * ($pages - 1)); for ($page_counter = 0; $page_counter < $pages; $page_counter++) { $batch["operations"][] = [ '\Drupal\nt8property\Batch\NT8PropertyBatch::propertyBatchLoadCallback', [ $page_counter, [ 'per_page' => $per_page, 'last_page' => $last_page, 'pages' => $pages, ], $search_instance_id, $modify_replace, ], ]; } batch_set($batch); }
php
public static function propertyBatchLoad(int $batch_size = 8, int $modify_replace = 0) { $batchSizeList = [ 1 => 1, 2 => 2, 3 => 4, 4 => 8, 5 => 16, 6 => 32, 7 => 64, 8 => 128, 9 => 256, ]; // Get list of properties to reload. $per_page = $batchSizeList[$batch_size] ?? 128; // Get page count. $first_page = \Drupal::service('nt8tabsio.tabs_service')->get( "property", [ "page" => 1, "pageSize" => $per_page ] ); $first_page = json_decode($first_page); $search_instance_id = $first_page->searchId; $total_results = $first_page->totalResults; $batch = [ 'title' => t('Loading all properties from API.'), 'operations' => [], 'progress_message' => t('Processed @current out of @total.'), 'finished' => '\Drupal\nt8property\Batch\NT8PropertyBatch::propertyBatchLoadFinishedCallback', ]; $pages = ceil($total_results / $per_page); $last_page = $total_results - ($per_page * ($pages - 1)); for ($page_counter = 0; $page_counter < $pages; $page_counter++) { $batch["operations"][] = [ '\Drupal\nt8property\Batch\NT8PropertyBatch::propertyBatchLoadCallback', [ $page_counter, [ 'per_page' => $per_page, 'last_page' => $last_page, 'pages' => $pages, ], $search_instance_id, $modify_replace, ], ]; } batch_set($batch); }
[ "public", "static", "function", "propertyBatchLoad", "(", "int", "$", "batch_size", "=", "8", ",", "int", "$", "modify_replace", "=", "0", ")", "{", "$", "batchSizeList", "=", "[", "1", "=>", "1", ",", "2", "=>", "2", ",", "3", "=>", "4", ",", "4", "=>", "8", ",", "5", "=>", "16", ",", "6", "=>", "32", ",", "7", "=>", "64", ",", "8", "=>", "128", ",", "9", "=>", "256", ",", "]", ";", "// Get list of properties to reload.", "$", "per_page", "=", "$", "batchSizeList", "[", "$", "batch_size", "]", "??", "128", ";", "// Get page count.", "$", "first_page", "=", "\\", "Drupal", "::", "service", "(", "'nt8tabsio.tabs_service'", ")", "->", "get", "(", "\"property\"", ",", "[", "\"page\"", "=>", "1", ",", "\"pageSize\"", "=>", "$", "per_page", "]", ")", ";", "$", "first_page", "=", "json_decode", "(", "$", "first_page", ")", ";", "$", "search_instance_id", "=", "$", "first_page", "->", "searchId", ";", "$", "total_results", "=", "$", "first_page", "->", "totalResults", ";", "$", "batch", "=", "[", "'title'", "=>", "t", "(", "'Loading all properties from API.'", ")", ",", "'operations'", "=>", "[", "]", ",", "'progress_message'", "=>", "t", "(", "'Processed @current out of @total.'", ")", ",", "'finished'", "=>", "'\\Drupal\\nt8property\\Batch\\NT8PropertyBatch::propertyBatchLoadFinishedCallback'", ",", "]", ";", "$", "pages", "=", "ceil", "(", "$", "total_results", "/", "$", "per_page", ")", ";", "$", "last_page", "=", "$", "total_results", "-", "(", "$", "per_page", "*", "(", "$", "pages", "-", "1", ")", ")", ";", "for", "(", "$", "page_counter", "=", "0", ";", "$", "page_counter", "<", "$", "pages", ";", "$", "page_counter", "++", ")", "{", "$", "batch", "[", "\"operations\"", "]", "[", "]", "=", "[", "'\\Drupal\\nt8property\\Batch\\NT8PropertyBatch::propertyBatchLoadCallback'", ",", "[", "$", "page_counter", ",", "[", "'per_page'", "=>", "$", "per_page", ",", "'last_page'", "=>", "$", "last_page", ",", "'pages'", "=>", "$", "pages", ",", "]", ",", "$", "search_instance_id", ",", "$", "modify_replace", ",", "]", ",", "]", ";", "}", "batch_set", "(", "$", "batch", ")", ";", "}" ]
Instantiates and handles a Drupal batch property load. @param int $batch_size The number of properties to request & process per search. The batch size goes up in a 2 ^ n scale. @param int $modify_replace Modify the existing nodes or create new ones (deleting the current). 0 => Modify, 1 => Replace.
[ "Instantiates", "and", "handles", "a", "Drupal", "batch", "property", "load", "." ]
53b630a612c6dc7c90a8ca1ce4ceb41568473447
https://github.com/neontabs-drupal8/nt8property/blob/53b630a612c6dc7c90a8ca1ce4ceb41568473447/src/Batch/NT8PropertyBatch.php#L20-L77
12,462
neontabs-drupal8/nt8property
src/Batch/NT8PropertyBatch.php
NT8PropertyBatch.propertyBatchLoadCallback
public static function propertyBatchLoadCallback($page_counter, $per_page, $search_instance_id, $modify_replace, &$context) { $nt8restService = \Drupal::service('nt8tabsio.tabs_service'); $nt8PropertyMethods = \Drupal::service('nt8property.property_methods'); $pages = $per_page['pages']; $pageSize = $per_page['per_page']; $data = json_decode( $nt8restService->get("property", [ "page" => $page_counter + 1, "pageSize" => $pageSize, "searchId" => $search_instance_id, ] ) ); $results = $data->results; if (!isset($context['results']['count_processed'])) { $context['results']['count_processed'] = 0; } if (!isset($context['results']['nodes_updated'])) { $context['results']['nodes_updated'] = []; } foreach ($results as $result) { $context['results']['count_processed']++; switch ($modify_replace) { case 0: $nodes_updated = $nt8PropertyMethods->updateNodeInstancesFromData($result); $context['results']['nodes_updated'] = array_merge($context['results']['nodes_updated'], $nodes_updated); break; default: $nt8PropertyMethods->createNodeInstanceFromData($result, TRUE); } } }
php
public static function propertyBatchLoadCallback($page_counter, $per_page, $search_instance_id, $modify_replace, &$context) { $nt8restService = \Drupal::service('nt8tabsio.tabs_service'); $nt8PropertyMethods = \Drupal::service('nt8property.property_methods'); $pages = $per_page['pages']; $pageSize = $per_page['per_page']; $data = json_decode( $nt8restService->get("property", [ "page" => $page_counter + 1, "pageSize" => $pageSize, "searchId" => $search_instance_id, ] ) ); $results = $data->results; if (!isset($context['results']['count_processed'])) { $context['results']['count_processed'] = 0; } if (!isset($context['results']['nodes_updated'])) { $context['results']['nodes_updated'] = []; } foreach ($results as $result) { $context['results']['count_processed']++; switch ($modify_replace) { case 0: $nodes_updated = $nt8PropertyMethods->updateNodeInstancesFromData($result); $context['results']['nodes_updated'] = array_merge($context['results']['nodes_updated'], $nodes_updated); break; default: $nt8PropertyMethods->createNodeInstanceFromData($result, TRUE); } } }
[ "public", "static", "function", "propertyBatchLoadCallback", "(", "$", "page_counter", ",", "$", "per_page", ",", "$", "search_instance_id", ",", "$", "modify_replace", ",", "&", "$", "context", ")", "{", "$", "nt8restService", "=", "\\", "Drupal", "::", "service", "(", "'nt8tabsio.tabs_service'", ")", ";", "$", "nt8PropertyMethods", "=", "\\", "Drupal", "::", "service", "(", "'nt8property.property_methods'", ")", ";", "$", "pages", "=", "$", "per_page", "[", "'pages'", "]", ";", "$", "pageSize", "=", "$", "per_page", "[", "'per_page'", "]", ";", "$", "data", "=", "json_decode", "(", "$", "nt8restService", "->", "get", "(", "\"property\"", ",", "[", "\"page\"", "=>", "$", "page_counter", "+", "1", ",", "\"pageSize\"", "=>", "$", "pageSize", ",", "\"searchId\"", "=>", "$", "search_instance_id", ",", "]", ")", ")", ";", "$", "results", "=", "$", "data", "->", "results", ";", "if", "(", "!", "isset", "(", "$", "context", "[", "'results'", "]", "[", "'count_processed'", "]", ")", ")", "{", "$", "context", "[", "'results'", "]", "[", "'count_processed'", "]", "=", "0", ";", "}", "if", "(", "!", "isset", "(", "$", "context", "[", "'results'", "]", "[", "'nodes_updated'", "]", ")", ")", "{", "$", "context", "[", "'results'", "]", "[", "'nodes_updated'", "]", "=", "[", "]", ";", "}", "foreach", "(", "$", "results", "as", "$", "result", ")", "{", "$", "context", "[", "'results'", "]", "[", "'count_processed'", "]", "++", ";", "switch", "(", "$", "modify_replace", ")", "{", "case", "0", ":", "$", "nodes_updated", "=", "$", "nt8PropertyMethods", "->", "updateNodeInstancesFromData", "(", "$", "result", ")", ";", "$", "context", "[", "'results'", "]", "[", "'nodes_updated'", "]", "=", "array_merge", "(", "$", "context", "[", "'results'", "]", "[", "'nodes_updated'", "]", ",", "$", "nodes_updated", ")", ";", "break", ";", "default", ":", "$", "nt8PropertyMethods", "->", "createNodeInstanceFromData", "(", "$", "result", ",", "TRUE", ")", ";", "}", "}", "}" ]
Callback function for drupal property batch load progress. @param $page_counter @param $per_page @param $search_instance_id @param $modify_replace @param $context
[ "Callback", "function", "for", "drupal", "property", "batch", "load", "progress", "." ]
53b630a612c6dc7c90a8ca1ce4ceb41568473447
https://github.com/neontabs-drupal8/nt8property/blob/53b630a612c6dc7c90a8ca1ce4ceb41568473447/src/Batch/NT8PropertyBatch.php#L89-L130
12,463
neontabs-drupal8/nt8property
src/Batch/NT8PropertyBatch.php
NT8PropertyBatch.propertyBatchLoadFinishedCallback
public static function propertyBatchLoadFinishedCallback($success, $results, $operations) { $updated_node_ids = implode(', ', $results['nodes_updated']); $processed = $results['count_processed']; drupal_set_message("Processed $processed nodes. And updated these: [$updated_node_ids] nodes."); }
php
public static function propertyBatchLoadFinishedCallback($success, $results, $operations) { $updated_node_ids = implode(', ', $results['nodes_updated']); $processed = $results['count_processed']; drupal_set_message("Processed $processed nodes. And updated these: [$updated_node_ids] nodes."); }
[ "public", "static", "function", "propertyBatchLoadFinishedCallback", "(", "$", "success", ",", "$", "results", ",", "$", "operations", ")", "{", "$", "updated_node_ids", "=", "implode", "(", "', '", ",", "$", "results", "[", "'nodes_updated'", "]", ")", ";", "$", "processed", "=", "$", "results", "[", "'count_processed'", "]", ";", "drupal_set_message", "(", "\"Processed $processed nodes. And updated these: [$updated_node_ids] nodes.\"", ")", ";", "}" ]
Callback which is fired once the Drupal batch job has finished. @param $success @param $results @param $operations
[ "Callback", "which", "is", "fired", "once", "the", "Drupal", "batch", "job", "has", "finished", "." ]
53b630a612c6dc7c90a8ca1ce4ceb41568473447
https://github.com/neontabs-drupal8/nt8property/blob/53b630a612c6dc7c90a8ca1ce4ceb41568473447/src/Batch/NT8PropertyBatch.php#L139-L145
12,464
devsdmf/slice-http
src/Slice/Http/ResponseAbstract.php
ResponseAbstract.fromString
public static function fromString($response) { $code = self::extractCode($response); $headers = self::extractHeaders($response); $body = self::extractBody($response); $version = self::extractVersion($response); $message = self::extractMessage($response); # FIX FOR MULTIPLE HTTP RESPONSE CODE RETURNED BY SERVER if ($code === 100 && count($headers) === 0 && self::extractCode($body)) { return self::fromString($body); } return new static($code, $headers, $body, $version, $message); }
php
public static function fromString($response) { $code = self::extractCode($response); $headers = self::extractHeaders($response); $body = self::extractBody($response); $version = self::extractVersion($response); $message = self::extractMessage($response); # FIX FOR MULTIPLE HTTP RESPONSE CODE RETURNED BY SERVER if ($code === 100 && count($headers) === 0 && self::extractCode($body)) { return self::fromString($body); } return new static($code, $headers, $body, $version, $message); }
[ "public", "static", "function", "fromString", "(", "$", "response", ")", "{", "$", "code", "=", "self", "::", "extractCode", "(", "$", "response", ")", ";", "$", "headers", "=", "self", "::", "extractHeaders", "(", "$", "response", ")", ";", "$", "body", "=", "self", "::", "extractBody", "(", "$", "response", ")", ";", "$", "version", "=", "self", "::", "extractVersion", "(", "$", "response", ")", ";", "$", "message", "=", "self", "::", "extractMessage", "(", "$", "response", ")", ";", "# FIX FOR MULTIPLE HTTP RESPONSE CODE RETURNED BY SERVER ", "if", "(", "$", "code", "===", "100", "&&", "count", "(", "$", "headers", ")", "===", "0", "&&", "self", "::", "extractCode", "(", "$", "body", ")", ")", "{", "return", "self", "::", "fromString", "(", "$", "body", ")", ";", "}", "return", "new", "static", "(", "$", "code", ",", "$", "headers", ",", "$", "body", ",", "$", "version", ",", "$", "message", ")", ";", "}" ]
Create a new Response object from a string @param string $response @return \Slice\Http\AbstractResponse
[ "Create", "a", "new", "Response", "object", "from", "a", "string" ]
8ab12b42354ff092d88d29d265733186698cb829
https://github.com/devsdmf/slice-http/blob/8ab12b42354ff092d88d29d265733186698cb829/src/Slice/Http/ResponseAbstract.php#L651-L665
12,465
indigophp-archive/fuel-core
lib/Monolog/Handler/ConsoleHandler.php
ConsoleHandler.setColor
public function setColor($level, $foreground_color = 'white', $background_color = null) { if (array_key_exists($level, $this->levels)) { $this->levels[$level][0] = $foreground_color; $this->levels[$level][1] = $background_color; } return $this; }
php
public function setColor($level, $foreground_color = 'white', $background_color = null) { if (array_key_exists($level, $this->levels)) { $this->levels[$level][0] = $foreground_color; $this->levels[$level][1] = $background_color; } return $this; }
[ "public", "function", "setColor", "(", "$", "level", ",", "$", "foreground_color", "=", "'white'", ",", "$", "background_color", "=", "null", ")", "{", "if", "(", "array_key_exists", "(", "$", "level", ",", "$", "this", "->", "levels", ")", ")", "{", "$", "this", "->", "levels", "[", "$", "level", "]", "[", "0", "]", "=", "$", "foreground_color", ";", "$", "this", "->", "levels", "[", "$", "level", "]", "[", "1", "]", "=", "$", "background_color", ";", "}", "return", "$", "this", ";", "}" ]
Sets the colors for a level @param integer $level @param string $foreground_color @param string|null $background_color @return this
[ "Sets", "the", "colors", "for", "a", "level" ]
275462154fb7937f8e1c2c541b31d8e7c5760e39
https://github.com/indigophp-archive/fuel-core/blob/275462154fb7937f8e1c2c541b31d8e7c5760e39/lib/Monolog/Handler/ConsoleHandler.php#L45-L54
12,466
sgoendoer/sonic
src/Identity/EntityAuthData.php
EntityAuthData.getJWT
public function getJWT() { if($this->personalKeyPair === NULL) throw new \Exception("JWT cannot be built without the personalKey"); // create and sign JWT $signer = new Sha512(); $personalPrivateKey = PrivateKey::formatPEM($this->personalKeyPair->getPrivateKey()); $token = (new Builder()) ->set('socialRecord', base64_encode($this->socialRecord->getJSONString())) ->sign($signer, $personalPrivateKey) ->getToken(); return $token->__toString(); }
php
public function getJWT() { if($this->personalKeyPair === NULL) throw new \Exception("JWT cannot be built without the personalKey"); // create and sign JWT $signer = new Sha512(); $personalPrivateKey = PrivateKey::formatPEM($this->personalKeyPair->getPrivateKey()); $token = (new Builder()) ->set('socialRecord', base64_encode($this->socialRecord->getJSONString())) ->sign($signer, $personalPrivateKey) ->getToken(); return $token->__toString(); }
[ "public", "function", "getJWT", "(", ")", "{", "if", "(", "$", "this", "->", "personalKeyPair", "===", "NULL", ")", "throw", "new", "\\", "Exception", "(", "\"JWT cannot be built without the personalKey\"", ")", ";", "// create and sign JWT\r", "$", "signer", "=", "new", "Sha512", "(", ")", ";", "$", "personalPrivateKey", "=", "PrivateKey", "::", "formatPEM", "(", "$", "this", "->", "personalKeyPair", "->", "getPrivateKey", "(", ")", ")", ";", "$", "token", "=", "(", "new", "Builder", "(", ")", ")", "->", "set", "(", "'socialRecord'", ",", "base64_encode", "(", "$", "this", "->", "socialRecord", "->", "getJSONString", "(", ")", ")", ")", "->", "sign", "(", "$", "signer", ",", "$", "personalPrivateKey", ")", "->", "getToken", "(", ")", ";", "return", "$", "token", "->", "__toString", "(", ")", ";", "}" ]
Creates a signed JWT to be pushed to the GSLS. If the personalKeyPair is not set, an exception is thrown @return String The JWT
[ "Creates", "a", "signed", "JWT", "to", "be", "pushed", "to", "the", "GSLS", ".", "If", "the", "personalKeyPair", "is", "not", "set", "an", "exception", "is", "thrown" ]
2c32ebd78607dc3e8558f10a0b7bf881d37fc168
https://github.com/sgoendoer/sonic/blob/2c32ebd78607dc3e8558f10a0b7bf881d37fc168/src/Identity/EntityAuthData.php#L119-L135
12,467
thecmsthread/core-admin
src/Controller/User.php
User.redirect
public function redirect() { if (headers_sent() === false) { header('X-PHP-Response-Code: 403', true, 403); } if (isset($_GET['template']) === false) { return redirect($this->router->generate('login-page')); } else { return 'Redirect: ' . $this->router->generate('login-page'); } }
php
public function redirect() { if (headers_sent() === false) { header('X-PHP-Response-Code: 403', true, 403); } if (isset($_GET['template']) === false) { return redirect($this->router->generate('login-page')); } else { return 'Redirect: ' . $this->router->generate('login-page'); } }
[ "public", "function", "redirect", "(", ")", "{", "if", "(", "headers_sent", "(", ")", "===", "false", ")", "{", "header", "(", "'X-PHP-Response-Code: 403'", ",", "true", ",", "403", ")", ";", "}", "if", "(", "isset", "(", "$", "_GET", "[", "'template'", "]", ")", "===", "false", ")", "{", "return", "redirect", "(", "$", "this", "->", "router", "->", "generate", "(", "'login-page'", ")", ")", ";", "}", "else", "{", "return", "'Redirect: '", ".", "$", "this", "->", "router", "->", "generate", "(", "'login-page'", ")", ";", "}", "}" ]
Redirect to the login page
[ "Redirect", "to", "the", "login", "page" ]
020595646e2dd521683e5352e6d9dbad420c06fb
https://github.com/thecmsthread/core-admin/blob/020595646e2dd521683e5352e6d9dbad420c06fb/src/Controller/User.php#L87-L97
12,468
thecmsthread/core-admin
src/Controller/User.php
User.logout
public function logout() { $this->core->auth()->invalidate(); $this->router->map('GET', '/login', "Auth@showLogin", 'login-page'); return $this->redirect(); }
php
public function logout() { $this->core->auth()->invalidate(); $this->router->map('GET', '/login', "Auth@showLogin", 'login-page'); return $this->redirect(); }
[ "public", "function", "logout", "(", ")", "{", "$", "this", "->", "core", "->", "auth", "(", ")", "->", "invalidate", "(", ")", ";", "$", "this", "->", "router", "->", "map", "(", "'GET'", ",", "'/login'", ",", "\"Auth@showLogin\"", ",", "'login-page'", ")", ";", "return", "$", "this", "->", "redirect", "(", ")", ";", "}" ]
Logout active page
[ "Logout", "active", "page" ]
020595646e2dd521683e5352e6d9dbad420c06fb
https://github.com/thecmsthread/core-admin/blob/020595646e2dd521683e5352e6d9dbad420c06fb/src/Controller/User.php#L118-L123
12,469
aedart/model
src/Traits/Strings/CardOwnerTrait.php
CardOwnerTrait.getCardOwner
public function getCardOwner() : ?string { if ( ! $this->hasCardOwner()) { $this->setCardOwner($this->getDefaultCardOwner()); } return $this->cardOwner; }
php
public function getCardOwner() : ?string { if ( ! $this->hasCardOwner()) { $this->setCardOwner($this->getDefaultCardOwner()); } return $this->cardOwner; }
[ "public", "function", "getCardOwner", "(", ")", ":", "?", "string", "{", "if", "(", "!", "$", "this", "->", "hasCardOwner", "(", ")", ")", "{", "$", "this", "->", "setCardOwner", "(", "$", "this", "->", "getDefaultCardOwner", "(", ")", ")", ";", "}", "return", "$", "this", "->", "cardOwner", ";", "}" ]
Get card owner If no "card owner" value has been set, this method will set and return a default "card owner" value, if any such value is available @see getDefaultCardOwner() @return string|null card owner or null if no card owner has been set
[ "Get", "card", "owner" ]
9a562c1c53a276d01ace0ab71f5305458bea542f
https://github.com/aedart/model/blob/9a562c1c53a276d01ace0ab71f5305458bea542f/src/Traits/Strings/CardOwnerTrait.php#L48-L54
12,470
xloit/xloit-bridge-zend-authentication
src/Adapter/AdapterChain.php
AdapterChain.prependAdapter
public function prependAdapter(AdapterInterface $adapter) { $priority = self::DEFAULT_PRIORITY; if (!$this->adapters->isEmpty()) { $extractedNodes = $this->adapters->toArray(PriorityQueue::EXTR_PRIORITY); rsort($extractedNodes, SORT_NUMERIC); $priority = $extractedNodes[0] + 1; } $this->adapters->insert($adapter, $priority); return $this; }
php
public function prependAdapter(AdapterInterface $adapter) { $priority = self::DEFAULT_PRIORITY; if (!$this->adapters->isEmpty()) { $extractedNodes = $this->adapters->toArray(PriorityQueue::EXTR_PRIORITY); rsort($extractedNodes, SORT_NUMERIC); $priority = $extractedNodes[0] + 1; } $this->adapters->insert($adapter, $priority); return $this; }
[ "public", "function", "prependAdapter", "(", "AdapterInterface", "$", "adapter", ")", "{", "$", "priority", "=", "self", "::", "DEFAULT_PRIORITY", ";", "if", "(", "!", "$", "this", "->", "adapters", "->", "isEmpty", "(", ")", ")", "{", "$", "extractedNodes", "=", "$", "this", "->", "adapters", "->", "toArray", "(", "PriorityQueue", "::", "EXTR_PRIORITY", ")", ";", "rsort", "(", "$", "extractedNodes", ",", "SORT_NUMERIC", ")", ";", "$", "priority", "=", "$", "extractedNodes", "[", "0", "]", "+", "1", ";", "}", "$", "this", "->", "adapters", "->", "insert", "(", "$", "adapter", ",", "$", "priority", ")", ";", "return", "$", "this", ";", "}" ]
Adds a adapter to the beginning of the chain. @param AdapterInterface $adapter @return $this
[ "Adds", "a", "adapter", "to", "the", "beginning", "of", "the", "chain", "." ]
299c6ad8d5756c8db040b39a50ecfcc137c42b72
https://github.com/xloit/xloit-bridge-zend-authentication/blob/299c6ad8d5756c8db040b39a50ecfcc137c42b72/src/Adapter/AdapterChain.php#L107-L122
12,471
xloit/xloit-bridge-zend-authentication
src/Adapter/AdapterChain.php
AdapterChain.merge
public function merge(AdapterChain $adaptersChain) { $adapters = $adaptersChain->adapters->toArray(PriorityQueue::EXTR_BOTH); foreach ($adapters as $item) { $this->attach($item['data'], $item['priority']); } return $this; }
php
public function merge(AdapterChain $adaptersChain) { $adapters = $adaptersChain->adapters->toArray(PriorityQueue::EXTR_BOTH); foreach ($adapters as $item) { $this->attach($item['data'], $item['priority']); } return $this; }
[ "public", "function", "merge", "(", "AdapterChain", "$", "adaptersChain", ")", "{", "$", "adapters", "=", "$", "adaptersChain", "->", "adapters", "->", "toArray", "(", "PriorityQueue", "::", "EXTR_BOTH", ")", ";", "foreach", "(", "$", "adapters", "as", "$", "item", ")", "{", "$", "this", "->", "attach", "(", "$", "item", "[", "'data'", "]", ",", "$", "item", "[", "'priority'", "]", ")", ";", "}", "return", "$", "this", ";", "}" ]
Merge the adapter chain with the one given in parameter. @param AdapterChain $adaptersChain @return $this
[ "Merge", "the", "adapter", "chain", "with", "the", "one", "given", "in", "parameter", "." ]
299c6ad8d5756c8db040b39a50ecfcc137c42b72
https://github.com/xloit/xloit-bridge-zend-authentication/blob/299c6ad8d5756c8db040b39a50ecfcc137c42b72/src/Adapter/AdapterChain.php#L131-L140
12,472
xloit/xloit-bridge-zend-authentication
src/Adapter/AdapterChain.php
AdapterChain.attach
public function attach(AdapterInterface $adapter, $priority = self::DEFAULT_PRIORITY) { $this->adapters->insert($adapter, $priority); return $this; }
php
public function attach(AdapterInterface $adapter, $priority = self::DEFAULT_PRIORITY) { $this->adapters->insert($adapter, $priority); return $this; }
[ "public", "function", "attach", "(", "AdapterInterface", "$", "adapter", ",", "$", "priority", "=", "self", "::", "DEFAULT_PRIORITY", ")", "{", "$", "this", "->", "adapters", "->", "insert", "(", "$", "adapter", ",", "$", "priority", ")", ";", "return", "$", "this", ";", "}" ]
Attach a adapter to the end of the chain. @param AdapterInterface $adapter @param int $priority Priority at which to enqueue adapter; defaults to 1 (higher executes earlier). @return $this
[ "Attach", "a", "adapter", "to", "the", "end", "of", "the", "chain", "." ]
299c6ad8d5756c8db040b39a50ecfcc137c42b72
https://github.com/xloit/xloit-bridge-zend-authentication/blob/299c6ad8d5756c8db040b39a50ecfcc137c42b72/src/Adapter/AdapterChain.php#L150-L155
12,473
xloit/xloit-bridge-zend-authentication
src/Adapter/AdapterChain.php
AdapterChain.getMessages
public function getMessages() { $results = $this->getResults(); $messages = []; foreach ($results as $result) { /** @noinspection SlowArrayOperationsInLoopInspection */ $messages = array_replace_recursive($messages, $result->getMessages()); } return $messages; }
php
public function getMessages() { $results = $this->getResults(); $messages = []; foreach ($results as $result) { /** @noinspection SlowArrayOperationsInLoopInspection */ $messages = array_replace_recursive($messages, $result->getMessages()); } return $messages; }
[ "public", "function", "getMessages", "(", ")", "{", "$", "results", "=", "$", "this", "->", "getResults", "(", ")", ";", "$", "messages", "=", "[", "]", ";", "foreach", "(", "$", "results", "as", "$", "result", ")", "{", "/** @noinspection SlowArrayOperationsInLoopInspection */", "$", "messages", "=", "array_replace_recursive", "(", "$", "messages", ",", "$", "result", "->", "getMessages", "(", ")", ")", ";", "}", "return", "$", "messages", ";", "}" ]
Returns array of validation failure messages. @return array
[ "Returns", "array", "of", "validation", "failure", "messages", "." ]
299c6ad8d5756c8db040b39a50ecfcc137c42b72
https://github.com/xloit/xloit-bridge-zend-authentication/blob/299c6ad8d5756c8db040b39a50ecfcc137c42b72/src/Adapter/AdapterChain.php#L287-L298
12,474
faustbrian/binary
src/Hex/Reader.php
Reader.low
public static function low(string $data, int $offset = 0, $nibble = null): string { return unpack($nibble ? "h{$nibble}" : 'h', $data, $offset)[1]; }
php
public static function low(string $data, int $offset = 0, $nibble = null): string { return unpack($nibble ? "h{$nibble}" : 'h', $data, $offset)[1]; }
[ "public", "static", "function", "low", "(", "string", "$", "data", ",", "int", "$", "offset", "=", "0", ",", "$", "nibble", "=", "null", ")", ":", "string", "{", "return", "unpack", "(", "$", "nibble", "?", "\"h{$nibble}\"", ":", "'h'", ",", "$", "data", ",", "$", "offset", ")", "[", "1", "]", ";", "}" ]
Read a hex string with low nibble first. @param string $data @param int $offset @param mixed $nibble @return string
[ "Read", "a", "hex", "string", "with", "low", "nibble", "first", "." ]
7d845497460c2dabf7e369ec8e55baf989ef74cb
https://github.com/faustbrian/binary/blob/7d845497460c2dabf7e369ec8e55baf989ef74cb/src/Hex/Reader.php#L32-L35
12,475
faustbrian/binary
src/Hex/Reader.php
Reader.high
public static function high(string $data, int $offset = 0, $nibble = null): string { return unpack($nibble ? "H{$nibble}" : 'H', $data, $offset)[1]; }
php
public static function high(string $data, int $offset = 0, $nibble = null): string { return unpack($nibble ? "H{$nibble}" : 'H', $data, $offset)[1]; }
[ "public", "static", "function", "high", "(", "string", "$", "data", ",", "int", "$", "offset", "=", "0", ",", "$", "nibble", "=", "null", ")", ":", "string", "{", "return", "unpack", "(", "$", "nibble", "?", "\"H{$nibble}\"", ":", "'H'", ",", "$", "data", ",", "$", "offset", ")", "[", "1", "]", ";", "}" ]
Read a hex string with high nibble first. @param string $data @param int $offset @param mixed $nibble @return string
[ "Read", "a", "hex", "string", "with", "high", "nibble", "first", "." ]
7d845497460c2dabf7e369ec8e55baf989ef74cb
https://github.com/faustbrian/binary/blob/7d845497460c2dabf7e369ec8e55baf989ef74cb/src/Hex/Reader.php#L46-L49
12,476
alevilar/MtSites
Model/Site.php
Site.fromUser
public function fromUser ( $user_id ) { $sites = $this->User->find('first', array( 'conditions' => array( 'User.id' => $user_id ), 'contain' => array( 'Site', ) )); if (!empty( $sites['Site'] )) { return $sites['Site']; } else { return null; } }
php
public function fromUser ( $user_id ) { $sites = $this->User->find('first', array( 'conditions' => array( 'User.id' => $user_id ), 'contain' => array( 'Site', ) )); if (!empty( $sites['Site'] )) { return $sites['Site']; } else { return null; } }
[ "public", "function", "fromUser", "(", "$", "user_id", ")", "{", "$", "sites", "=", "$", "this", "->", "User", "->", "find", "(", "'first'", ",", "array", "(", "'conditions'", "=>", "array", "(", "'User.id'", "=>", "$", "user_id", ")", ",", "'contain'", "=>", "array", "(", "'Site'", ",", ")", ")", ")", ";", "if", "(", "!", "empty", "(", "$", "sites", "[", "'Site'", "]", ")", ")", "{", "return", "$", "sites", "[", "'Site'", "]", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Me devuelve todos los sitios del usuario @param int $id UserId
[ "Me", "devuelve", "todos", "los", "sitios", "del", "usuario" ]
5b1cdc52a929ca86a220ae12add84c52027a3c20
https://github.com/alevilar/MtSites/blob/5b1cdc52a929ca86a220ae12add84c52027a3c20/Model/Site.php#L173-L189
12,477
alevilar/MtSites
Model/Site.php
Site.buscarUsersComercio
public function buscarUsersComercio() { $currentSiteAlias = MtSites::getSiteName(); $site = $this->find('first', array( 'contain' => array( 'User' => array('conditions' => array('is_admin' => 0)) ), 'conditions' => array( 'Site.alias' => $currentSiteAlias ), )); $users = $site['User']; return $users; }
php
public function buscarUsersComercio() { $currentSiteAlias = MtSites::getSiteName(); $site = $this->find('first', array( 'contain' => array( 'User' => array('conditions' => array('is_admin' => 0)) ), 'conditions' => array( 'Site.alias' => $currentSiteAlias ), )); $users = $site['User']; return $users; }
[ "public", "function", "buscarUsersComercio", "(", ")", "{", "$", "currentSiteAlias", "=", "MtSites", "::", "getSiteName", "(", ")", ";", "$", "site", "=", "$", "this", "->", "find", "(", "'first'", ",", "array", "(", "'contain'", "=>", "array", "(", "'User'", "=>", "array", "(", "'conditions'", "=>", "array", "(", "'is_admin'", "=>", "0", ")", ")", ")", ",", "'conditions'", "=>", "array", "(", "'Site.alias'", "=>", "$", "currentSiteAlias", ")", ",", ")", ")", ";", "$", "users", "=", "$", "site", "[", "'User'", "]", ";", "return", "$", "users", ";", "}" ]
Busca todos los usuarios del comercio @return array de usuarios
[ "Busca", "todos", "los", "usuarios", "del", "comercio" ]
5b1cdc52a929ca86a220ae12add84c52027a3c20
https://github.com/alevilar/MtSites/blob/5b1cdc52a929ca86a220ae12add84c52027a3c20/Model/Site.php#L207-L223
12,478
simplecomplex/php-config
src/CliConfig.php
CliConfig.cmdListStores
protected function cmdListStores() /*: void*/ { /** * @see simplecomplex_cache_cli() */ $container = Dependency::container(); // Validate input. --------------------------------------------- $match = ''; if ( !empty($this->command->arguments['match']) && ($match = trim($this->command->arguments['match'])) !== '' && !preg_match('/^\/.+\/[a-zA-Z]*$/', $match) ) { $this->command->inputErrors[] = '\'match\' argument must be slash delimited regular expression.'; } $get = !empty($this->command->options['get']); if ($this->command->inputErrors) { foreach ($this->command->inputErrors as $msg) { $this->environment->echoMessage( $this->environment->format($msg, 'hangingIndent'), 'notice' ); } // This command's help text. $this->environment->echoMessage("\n" . $this->command); exit; } // Display command and the arg values used.--------------------- // No arg values to list. // Check if the command is doable.------------------------------ // Does that/these store(s) exist? if ($container->has('cache-broker')) { /** @var CacheBroker $cache_broker */ $cache_broker_class = get_class($container->get('cache-broker')); } else { $cache_broker_class = static::CLASS_CACHE_BROKER; } $cache_class = constant($cache_broker_class . '::CACHE_CLASSES')[CacheBroker::CACHE_BASE]; if (!method_exists($cache_class, 'listInstances')) { $this->environment->echoMessage('Cannot retrieve list of cache store instances via class[' . $cache_class . '], has no static method listInstances().', 'error'); exit; } $stores = forward_static_call($cache_class . '::listInstances'); // Do it. $names = []; foreach ($stores as $instance) { if (preg_match('/^config\..+/', $instance->name)) { $name = substr($instance->name, 7); if (!$match || preg_match($match, $name)) { $names[] = $name; } } } sort($names); if ($get) { return join(',', $names); } $this->environment->echoMessage(join("\n", $names)); exit; }
php
protected function cmdListStores() /*: void*/ { /** * @see simplecomplex_cache_cli() */ $container = Dependency::container(); // Validate input. --------------------------------------------- $match = ''; if ( !empty($this->command->arguments['match']) && ($match = trim($this->command->arguments['match'])) !== '' && !preg_match('/^\/.+\/[a-zA-Z]*$/', $match) ) { $this->command->inputErrors[] = '\'match\' argument must be slash delimited regular expression.'; } $get = !empty($this->command->options['get']); if ($this->command->inputErrors) { foreach ($this->command->inputErrors as $msg) { $this->environment->echoMessage( $this->environment->format($msg, 'hangingIndent'), 'notice' ); } // This command's help text. $this->environment->echoMessage("\n" . $this->command); exit; } // Display command and the arg values used.--------------------- // No arg values to list. // Check if the command is doable.------------------------------ // Does that/these store(s) exist? if ($container->has('cache-broker')) { /** @var CacheBroker $cache_broker */ $cache_broker_class = get_class($container->get('cache-broker')); } else { $cache_broker_class = static::CLASS_CACHE_BROKER; } $cache_class = constant($cache_broker_class . '::CACHE_CLASSES')[CacheBroker::CACHE_BASE]; if (!method_exists($cache_class, 'listInstances')) { $this->environment->echoMessage('Cannot retrieve list of cache store instances via class[' . $cache_class . '], has no static method listInstances().', 'error'); exit; } $stores = forward_static_call($cache_class . '::listInstances'); // Do it. $names = []; foreach ($stores as $instance) { if (preg_match('/^config\..+/', $instance->name)) { $name = substr($instance->name, 7); if (!$match || preg_match($match, $name)) { $names[] = $name; } } } sort($names); if ($get) { return join(',', $names); } $this->environment->echoMessage(join("\n", $names)); exit; }
[ "protected", "function", "cmdListStores", "(", ")", "/*: void*/", "{", "/**\n * @see simplecomplex_cache_cli()\n */", "$", "container", "=", "Dependency", "::", "container", "(", ")", ";", "// Validate input. ---------------------------------------------", "$", "match", "=", "''", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "command", "->", "arguments", "[", "'match'", "]", ")", "&&", "(", "$", "match", "=", "trim", "(", "$", "this", "->", "command", "->", "arguments", "[", "'match'", "]", ")", ")", "!==", "''", "&&", "!", "preg_match", "(", "'/^\\/.+\\/[a-zA-Z]*$/'", ",", "$", "match", ")", ")", "{", "$", "this", "->", "command", "->", "inputErrors", "[", "]", "=", "'\\'match\\' argument must be slash delimited regular expression.'", ";", "}", "$", "get", "=", "!", "empty", "(", "$", "this", "->", "command", "->", "options", "[", "'get'", "]", ")", ";", "if", "(", "$", "this", "->", "command", "->", "inputErrors", ")", "{", "foreach", "(", "$", "this", "->", "command", "->", "inputErrors", "as", "$", "msg", ")", "{", "$", "this", "->", "environment", "->", "echoMessage", "(", "$", "this", "->", "environment", "->", "format", "(", "$", "msg", ",", "'hangingIndent'", ")", ",", "'notice'", ")", ";", "}", "// This command's help text.", "$", "this", "->", "environment", "->", "echoMessage", "(", "\"\\n\"", ".", "$", "this", "->", "command", ")", ";", "exit", ";", "}", "// Display command and the arg values used.---------------------", "// No arg values to list.", "// Check if the command is doable.------------------------------", "// Does that/these store(s) exist?", "if", "(", "$", "container", "->", "has", "(", "'cache-broker'", ")", ")", "{", "/** @var CacheBroker $cache_broker */", "$", "cache_broker_class", "=", "get_class", "(", "$", "container", "->", "get", "(", "'cache-broker'", ")", ")", ";", "}", "else", "{", "$", "cache_broker_class", "=", "static", "::", "CLASS_CACHE_BROKER", ";", "}", "$", "cache_class", "=", "constant", "(", "$", "cache_broker_class", ".", "'::CACHE_CLASSES'", ")", "[", "CacheBroker", "::", "CACHE_BASE", "]", ";", "if", "(", "!", "method_exists", "(", "$", "cache_class", ",", "'listInstances'", ")", ")", "{", "$", "this", "->", "environment", "->", "echoMessage", "(", "'Cannot retrieve list of cache store instances via class['", ".", "$", "cache_class", ".", "'], has no static method listInstances().'", ",", "'error'", ")", ";", "exit", ";", "}", "$", "stores", "=", "forward_static_call", "(", "$", "cache_class", ".", "'::listInstances'", ")", ";", "// Do it.", "$", "names", "=", "[", "]", ";", "foreach", "(", "$", "stores", "as", "$", "instance", ")", "{", "if", "(", "preg_match", "(", "'/^config\\..+/'", ",", "$", "instance", "->", "name", ")", ")", "{", "$", "name", "=", "substr", "(", "$", "instance", "->", "name", ",", "7", ")", ";", "if", "(", "!", "$", "match", "||", "preg_match", "(", "$", "match", ",", "$", "name", ")", ")", "{", "$", "names", "[", "]", "=", "$", "name", ";", "}", "}", "}", "sort", "(", "$", "names", ")", ";", "if", "(", "$", "get", ")", "{", "return", "join", "(", "','", ",", "$", "names", ")", ";", "}", "$", "this", "->", "environment", "->", "echoMessage", "(", "join", "(", "\"\\n\"", ",", "$", "names", ")", ")", ";", "exit", ";", "}" ]
List all config stores. A copy of CliCache, except for further check that the cache store name starts with 'config.'. @see \SimpleComplex\Cache\CliCache @return mixed Exits if no/falsy option 'get'.
[ "List", "all", "config", "stores", "." ]
0d8450bc7523e8991452ef70f4f57f3d3e67f0d4
https://github.com/simplecomplex/php-config/blob/0d8450bc7523e8991452ef70f4f57f3d3e67f0d4/src/CliConfig.php#L240-L303
12,479
sgtlambda/jvwp
src/rwmb/RWMB.php
RWMB.addField
public function addField(Field $field) { if (array_search($field, $this->fields) === false) $this->fields[] = $field; }
php
public function addField(Field $field) { if (array_search($field, $this->fields) === false) $this->fields[] = $field; }
[ "public", "function", "addField", "(", "Field", "$", "field", ")", "{", "if", "(", "array_search", "(", "$", "field", ",", "$", "this", "->", "fields", ")", "===", "false", ")", "$", "this", "->", "fields", "[", "]", "=", "$", "field", ";", "}" ]
Adds the field to the MetaBox, if not present @param Field $field
[ "Adds", "the", "field", "to", "the", "MetaBox", "if", "not", "present" ]
85dba59281216ccb9cff580d26063d304350bbe0
https://github.com/sgtlambda/jvwp/blob/85dba59281216ccb9cff580d26063d304350bbe0/src/rwmb/RWMB.php#L27-L31
12,480
sgtlambda/jvwp
src/rwmb/RWMB.php
RWMB.removeField
public function removeField(Field $field) { if (($index = array_search($field, $this->fields)) !== false) array_splice($this->fields, $index, 1); }
php
public function removeField(Field $field) { if (($index = array_search($field, $this->fields)) !== false) array_splice($this->fields, $index, 1); }
[ "public", "function", "removeField", "(", "Field", "$", "field", ")", "{", "if", "(", "(", "$", "index", "=", "array_search", "(", "$", "field", ",", "$", "this", "->", "fields", ")", ")", "!==", "false", ")", "array_splice", "(", "$", "this", "->", "fields", ",", "$", "index", ",", "1", ")", ";", "}" ]
Removes the field from the MetaBox, if present @param Field $field
[ "Removes", "the", "field", "from", "the", "MetaBox", "if", "present" ]
85dba59281216ccb9cff580d26063d304350bbe0
https://github.com/sgtlambda/jvwp/blob/85dba59281216ccb9cff580d26063d304350bbe0/src/rwmb/RWMB.php#L38-L42
12,481
vinala/kernel
src/Foundation/Bus.php
Bus.run
public static function run($type = 'web', $session = true) { $lumos = $type == 'lumos' ? true : false; static::init($type); //Support Surface static::support(); //Version Surface static::version(); //Logging Surface static::logging(); //Input Surface static::input(); if ($type == 'test') { //Mock Surface static::mock(); } //Config Surface static::config($type == 'test' ? true : false); //Environment Surface static::environment(); //Maintenance Surface static::maintenance($lumos); //Time Surface static::time(); //Initiate the Logging Surface static::initLogging(); //Component Surface static::component(); //Cubes Surface static::cubes(); //Collections Surface static::collections(); //Storage Surface static::storage($session); //Strings Surface static::string(); //Access Surface static::access(); //Validation Surface static::validation(); //Call Faker Surface if enabled in Component surface if (Component::isOn('faker')) { static::faker(); } //Cookie Surface static::cookie(); //Router Surface static::router(); //Caches Surface static::caches(); //Security Surface static::security(); //Auth Surface static::auth(); //Call Database Surface if enabled in Component surface if (Component::isOn('database')) { static::database(); } //HTTP Surface static::http(); //Assets Surface static::assets(); //HTML Surface static::html(); //Hypertext Surface //Depracted static::Hypertext(); //Translator Surface static::translator(); //Model Surface static::model(); //Relations Surface static::relations(); //Media Surface static::media(); //Views Surface static::view(); //Controllers Surface static::controller(); //Mail Surface static::mail(); //Data Collection Surface static::dataCollection(); //Files Surface static::file(); //Intro Surface static::intro(); //Plugins Surface static::plugins(); //Lumos Surface static::lumos(); //Atomium Surface static::atomium(); //Proccess Surface static::proccess(); //Setup Surface static::setup(); //Events Surface static::event(); //Tests Surface static::test(); }
php
public static function run($type = 'web', $session = true) { $lumos = $type == 'lumos' ? true : false; static::init($type); //Support Surface static::support(); //Version Surface static::version(); //Logging Surface static::logging(); //Input Surface static::input(); if ($type == 'test') { //Mock Surface static::mock(); } //Config Surface static::config($type == 'test' ? true : false); //Environment Surface static::environment(); //Maintenance Surface static::maintenance($lumos); //Time Surface static::time(); //Initiate the Logging Surface static::initLogging(); //Component Surface static::component(); //Cubes Surface static::cubes(); //Collections Surface static::collections(); //Storage Surface static::storage($session); //Strings Surface static::string(); //Access Surface static::access(); //Validation Surface static::validation(); //Call Faker Surface if enabled in Component surface if (Component::isOn('faker')) { static::faker(); } //Cookie Surface static::cookie(); //Router Surface static::router(); //Caches Surface static::caches(); //Security Surface static::security(); //Auth Surface static::auth(); //Call Database Surface if enabled in Component surface if (Component::isOn('database')) { static::database(); } //HTTP Surface static::http(); //Assets Surface static::assets(); //HTML Surface static::html(); //Hypertext Surface //Depracted static::Hypertext(); //Translator Surface static::translator(); //Model Surface static::model(); //Relations Surface static::relations(); //Media Surface static::media(); //Views Surface static::view(); //Controllers Surface static::controller(); //Mail Surface static::mail(); //Data Collection Surface static::dataCollection(); //Files Surface static::file(); //Intro Surface static::intro(); //Plugins Surface static::plugins(); //Lumos Surface static::lumos(); //Atomium Surface static::atomium(); //Proccess Surface static::proccess(); //Setup Surface static::setup(); //Events Surface static::event(); //Tests Surface static::test(); }
[ "public", "static", "function", "run", "(", "$", "type", "=", "'web'", ",", "$", "session", "=", "true", ")", "{", "$", "lumos", "=", "$", "type", "==", "'lumos'", "?", "true", ":", "false", ";", "static", "::", "init", "(", "$", "type", ")", ";", "//Support Surface", "static", "::", "support", "(", ")", ";", "//Version Surface", "static", "::", "version", "(", ")", ";", "//Logging Surface", "static", "::", "logging", "(", ")", ";", "//Input Surface", "static", "::", "input", "(", ")", ";", "if", "(", "$", "type", "==", "'test'", ")", "{", "//Mock Surface", "static", "::", "mock", "(", ")", ";", "}", "//Config Surface", "static", "::", "config", "(", "$", "type", "==", "'test'", "?", "true", ":", "false", ")", ";", "//Environment Surface", "static", "::", "environment", "(", ")", ";", "//Maintenance Surface", "static", "::", "maintenance", "(", "$", "lumos", ")", ";", "//Time Surface", "static", "::", "time", "(", ")", ";", "//Initiate the Logging Surface", "static", "::", "initLogging", "(", ")", ";", "//Component Surface", "static", "::", "component", "(", ")", ";", "//Cubes Surface", "static", "::", "cubes", "(", ")", ";", "//Collections Surface", "static", "::", "collections", "(", ")", ";", "//Storage Surface", "static", "::", "storage", "(", "$", "session", ")", ";", "//Strings Surface", "static", "::", "string", "(", ")", ";", "//Access Surface", "static", "::", "access", "(", ")", ";", "//Validation Surface", "static", "::", "validation", "(", ")", ";", "//Call Faker Surface if enabled in Component surface", "if", "(", "Component", "::", "isOn", "(", "'faker'", ")", ")", "{", "static", "::", "faker", "(", ")", ";", "}", "//Cookie Surface", "static", "::", "cookie", "(", ")", ";", "//Router Surface", "static", "::", "router", "(", ")", ";", "//Caches Surface", "static", "::", "caches", "(", ")", ";", "//Security Surface", "static", "::", "security", "(", ")", ";", "//Auth Surface", "static", "::", "auth", "(", ")", ";", "//Call Database Surface if enabled in Component surface", "if", "(", "Component", "::", "isOn", "(", "'database'", ")", ")", "{", "static", "::", "database", "(", ")", ";", "}", "//HTTP Surface", "static", "::", "http", "(", ")", ";", "//Assets Surface", "static", "::", "assets", "(", ")", ";", "//HTML Surface", "static", "::", "html", "(", ")", ";", "//Hypertext Surface", "//Depracted", "static", "::", "Hypertext", "(", ")", ";", "//Translator Surface", "static", "::", "translator", "(", ")", ";", "//Model Surface", "static", "::", "model", "(", ")", ";", "//Relations Surface", "static", "::", "relations", "(", ")", ";", "//Media Surface", "static", "::", "media", "(", ")", ";", "//Views Surface", "static", "::", "view", "(", ")", ";", "//Controllers Surface", "static", "::", "controller", "(", ")", ";", "//Mail Surface", "static", "::", "mail", "(", ")", ";", "//Data Collection Surface", "static", "::", "dataCollection", "(", ")", ";", "//Files Surface", "static", "::", "file", "(", ")", ";", "//Intro Surface", "static", "::", "intro", "(", ")", ";", "//Plugins Surface", "static", "::", "plugins", "(", ")", ";", "//Lumos Surface", "static", "::", "lumos", "(", ")", ";", "//Atomium Surface", "static", "::", "atomium", "(", ")", ";", "//Proccess Surface", "static", "::", "proccess", "(", ")", ";", "//Setup Surface", "static", "::", "setup", "(", ")", ";", "//Events Surface", "static", "::", "event", "(", ")", ";", "//Tests Surface", "static", "::", "test", "(", ")", ";", "}" ]
Run the Bus surface. @param bool $lumos @param bool $session @return null
[ "Run", "the", "Bus", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L50-L196
12,482
vinala/kernel
src/Foundation/Bus.php
Bus.call
private static function call(array $files, $folder, $ext = 'php') { foreach ($files as $file) { static::need($folder.$file.'.'.$ext); } }
php
private static function call(array $files, $folder, $ext = 'php') { foreach ($files as $file) { static::need($folder.$file.'.'.$ext); } }
[ "private", "static", "function", "call", "(", "array", "$", "files", ",", "$", "folder", ",", "$", "ext", "=", "'php'", ")", "{", "foreach", "(", "$", "files", "as", "$", "file", ")", "{", "static", "::", "need", "(", "$", "folder", ".", "$", "file", ".", "'.'", ".", "$", "ext", ")", ";", "}", "}" ]
Call files of a folder. @param array $files @param string $folder @return null
[ "Call", "files", "of", "a", "folder", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L264-L269
12,483
vinala/kernel
src/Foundation/Bus.php
Bus.fetch
public static function fetch($pattern, $app = false) { if ($app) { $path = root().'app/'.$pattern.'/*.php'; } else { $path = root().$pattern.'/*.php'; } return glob($path); }
php
public static function fetch($pattern, $app = false) { if ($app) { $path = root().'app/'.$pattern.'/*.php'; } else { $path = root().$pattern.'/*.php'; } return glob($path); }
[ "public", "static", "function", "fetch", "(", "$", "pattern", ",", "$", "app", "=", "false", ")", "{", "if", "(", "$", "app", ")", "{", "$", "path", "=", "root", "(", ")", ".", "'app/'", ".", "$", "pattern", ".", "'/*.php'", ";", "}", "else", "{", "$", "path", "=", "root", "(", ")", ".", "$", "pattern", ".", "'/*.php'", ";", "}", "return", "glob", "(", "$", "path", ")", ";", "}" ]
Fetch files from folder. @param string $pattern @param bool $app : if using app/files @return array
[ "Fetch", "files", "from", "folder", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L293-L302
12,484
vinala/kernel
src/Foundation/Bus.php
Bus.input
private static function input() { $files = ['Input']; $folder = static::$root.'Http'.'/'; self::call($files, $folder); Input::register(); }
php
private static function input() { $files = ['Input']; $folder = static::$root.'Http'.'/'; self::call($files, $folder); Input::register(); }
[ "private", "static", "function", "input", "(", ")", "{", "$", "files", "=", "[", "'Input'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Http'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "Input", "::", "register", "(", ")", ";", "}" ]
Call and init Input surface. @return null
[ "Call", "and", "init", "Input", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L341-L349
12,485
vinala/kernel
src/Foundation/Bus.php
Bus.config
private static function config($test = false) { $files = ['Config', 'Alias']; $folder = static::$root.'Config'.'/'; self::call($files, $folder); // $files = ['ConfigException', 'DatabaseDriverNotFoundException', 'AliasedClassNotFoundException']; $folder = static::$root.'Config/Exceptions'.'/'; self::call($files, $folder); // Config::load(); }
php
private static function config($test = false) { $files = ['Config', 'Alias']; $folder = static::$root.'Config'.'/'; self::call($files, $folder); // $files = ['ConfigException', 'DatabaseDriverNotFoundException', 'AliasedClassNotFoundException']; $folder = static::$root.'Config/Exceptions'.'/'; self::call($files, $folder); // Config::load(); }
[ "private", "static", "function", "config", "(", "$", "test", "=", "false", ")", "{", "$", "files", "=", "[", "'Config'", ",", "'Alias'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Config'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "//", "$", "files", "=", "[", "'ConfigException'", ",", "'DatabaseDriverNotFoundException'", ",", "'AliasedClassNotFoundException'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Config/Exceptions'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "//", "Config", "::", "load", "(", ")", ";", "}" ]
Call Config surface and initiate it. @return null
[ "Call", "Config", "surface", "and", "initiate", "it", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L366-L379
12,486
vinala/kernel
src/Foundation/Bus.php
Bus.maintenance
private static function maintenance($lumos) { $files = ['Maintenance']; $folder = static::$root.'Maintenance'.'/'; self::call($files, $folder); if (!$lumos) { Maintenance::launch(); } }
php
private static function maintenance($lumos) { $files = ['Maintenance']; $folder = static::$root.'Maintenance'.'/'; self::call($files, $folder); if (!$lumos) { Maintenance::launch(); } }
[ "private", "static", "function", "maintenance", "(", "$", "lumos", ")", "{", "$", "files", "=", "[", "'Maintenance'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Maintenance'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "if", "(", "!", "$", "lumos", ")", "{", "Maintenance", "::", "launch", "(", ")", ";", "}", "}" ]
Call the Maintenance surface. @return null
[ "Call", "the", "Maintenance", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L399-L409
12,487
vinala/kernel
src/Foundation/Bus.php
Bus.time
private static function time() { $files = ['DateTime']; $folder = static::$root.'Time'.'/'; self::call($files, $folder); DateTime::setTimezone(); }
php
private static function time() { $files = ['DateTime']; $folder = static::$root.'Time'.'/'; self::call($files, $folder); DateTime::setTimezone(); }
[ "private", "static", "function", "time", "(", ")", "{", "$", "files", "=", "[", "'DateTime'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Time'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "DateTime", "::", "setTimezone", "(", ")", ";", "}" ]
Call Time surface. @return numm
[ "Call", "Time", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L416-L424
12,488
vinala/kernel
src/Foundation/Bus.php
Bus.component
private static function component() { $files = ['Component']; $folder = static::$root.'Foundation'.'/'; self::call($files, $folder); // $files = ['SurfaceDisabledException']; $folder = static::$root.'Foundation/Exceptions'.'/'; self::call($files, $folder); }
php
private static function component() { $files = ['Component']; $folder = static::$root.'Foundation'.'/'; self::call($files, $folder); // $files = ['SurfaceDisabledException']; $folder = static::$root.'Foundation/Exceptions'.'/'; self::call($files, $folder); }
[ "private", "static", "function", "component", "(", ")", "{", "$", "files", "=", "[", "'Component'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Foundation'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "//", "$", "files", "=", "[", "'SurfaceDisabledException'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Foundation/Exceptions'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "}" ]
Call Component surface. @return null
[ "Call", "Component", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L442-L453
12,489
vinala/kernel
src/Foundation/Bus.php
Bus.session
private static function session($session) { $files = ['Session']; $folder = static::$root.'Storage'.'/'; self::call($files, $folder); $files = ['SessionKeyNotFoundException', 'SessionSurfaceIsOffException']; $folder = static::$root.'Storage/Exceptions'.'/'; self::call($files, $folder); //Initiat the class if ($session) { Session::ini(); } }
php
private static function session($session) { $files = ['Session']; $folder = static::$root.'Storage'.'/'; self::call($files, $folder); $files = ['SessionKeyNotFoundException', 'SessionSurfaceIsOffException']; $folder = static::$root.'Storage/Exceptions'.'/'; self::call($files, $folder); //Initiat the class if ($session) { Session::ini(); } }
[ "private", "static", "function", "session", "(", "$", "session", ")", "{", "$", "files", "=", "[", "'Session'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Storage'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "$", "files", "=", "[", "'SessionKeyNotFoundException'", ",", "'SessionSurfaceIsOffException'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Storage/Exceptions'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "//Initiat the class", "if", "(", "$", "session", ")", "{", "Session", "::", "ini", "(", ")", ";", "}", "}" ]
Call Session class. @param bool $session @return null
[ "Call", "Session", "class", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L488-L504
12,490
vinala/kernel
src/Foundation/Bus.php
Bus.storage
private static function storage($session) { //Initiat the class static::session($session); $files = ['Storage']; $folder = static::$root.'Storage'.'/'; self::call($files, $folder); $files = ['NotFoundStorageDiskException']; $folder = static::$root.'Storage/Exceptions'.'/'; self::call($files, $folder); }
php
private static function storage($session) { //Initiat the class static::session($session); $files = ['Storage']; $folder = static::$root.'Storage'.'/'; self::call($files, $folder); $files = ['NotFoundStorageDiskException']; $folder = static::$root.'Storage/Exceptions'.'/'; self::call($files, $folder); }
[ "private", "static", "function", "storage", "(", "$", "session", ")", "{", "//Initiat the class", "static", "::", "session", "(", "$", "session", ")", ";", "$", "files", "=", "[", "'Storage'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Storage'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "$", "files", "=", "[", "'NotFoundStorageDiskException'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Storage/Exceptions'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "}" ]
Call the Storage surface. @return null
[ "Call", "the", "Storage", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L511-L525
12,491
vinala/kernel
src/Foundation/Bus.php
Bus.string
private static function string() { $files = ['Strings']; $folder = static::$root.'Strings'.'/'; self::call($files, $folder); $files = ['StringOutIndexException']; $folder = static::$root.'Strings/Exceptions'.'/'; self::call($files, $folder); }
php
private static function string() { $files = ['Strings']; $folder = static::$root.'Strings'.'/'; self::call($files, $folder); $files = ['StringOutIndexException']; $folder = static::$root.'Strings/Exceptions'.'/'; self::call($files, $folder); }
[ "private", "static", "function", "string", "(", ")", "{", "$", "files", "=", "[", "'Strings'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Strings'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "$", "files", "=", "[", "'StringOutIndexException'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Strings/Exceptions'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "}" ]
Call the String surface. @return null
[ "Call", "the", "String", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L532-L543
12,492
vinala/kernel
src/Foundation/Bus.php
Bus.validation
private static function validation() { $files = ['Validator', 'ValidationResult']; $folder = static::$root.'Validation'.'/'; self::call($files, $folder); //Initiate the validation surface Validator::ini(); }
php
private static function validation() { $files = ['Validator', 'ValidationResult']; $folder = static::$root.'Validation'.'/'; self::call($files, $folder); //Initiate the validation surface Validator::ini(); }
[ "private", "static", "function", "validation", "(", ")", "{", "$", "files", "=", "[", "'Validator'", ",", "'ValidationResult'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Validation'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "//Initiate the validation surface", "Validator", "::", "ini", "(", ")", ";", "}" ]
Call the Validation surface. @return null
[ "Call", "the", "Validation", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L563-L572
12,493
vinala/kernel
src/Foundation/Bus.php
Bus.router
private static function router() { $files = ['Url']; $folder = static::$root.'Router'.'/'; self::call($files, $folder); //New router surface $files = ['Route', 'Routes']; $folder = static::$root.'Http/Router'.'/'; self::call($files, $folder); $files = ['RouteDuplicatedException', 'RouteMiddlewareNotFoundException', 'RouteNotFoundInRoutesRegisterException', 'NotFoundHttpException']; $folder = static::$root.'Http/Router/Exceptions'.'/'; self::call($files, $folder); }
php
private static function router() { $files = ['Url']; $folder = static::$root.'Router'.'/'; self::call($files, $folder); //New router surface $files = ['Route', 'Routes']; $folder = static::$root.'Http/Router'.'/'; self::call($files, $folder); $files = ['RouteDuplicatedException', 'RouteMiddlewareNotFoundException', 'RouteNotFoundInRoutesRegisterException', 'NotFoundHttpException']; $folder = static::$root.'Http/Router/Exceptions'.'/'; self::call($files, $folder); }
[ "private", "static", "function", "router", "(", ")", "{", "$", "files", "=", "[", "'Url'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Router'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "//New router surface", "$", "files", "=", "[", "'Route'", ",", "'Routes'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Http/Router'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "$", "files", "=", "[", "'RouteDuplicatedException'", ",", "'RouteMiddlewareNotFoundException'", ",", "'RouteNotFoundInRoutesRegisterException'", ",", "'NotFoundHttpException'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Http/Router/Exceptions'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "}" ]
Call Router surface. @return null
[ "Call", "Router", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L605-L623
12,494
vinala/kernel
src/Foundation/Bus.php
Bus.caches
private static function caches() { $files = ['Driver', 'FileDriver', 'ArrayDriver', 'PhpFilesDriver', 'ApcDriver', 'PDODriver']; $folder = static::$root.'Caches/Drivers'.'/'; self::call($files, $folder); $files = ['Item', 'Cache']; $folder = static::$root.'Caches'.'/'; self::call($files, $folder); $files = ['CacheItemNotFoundException', 'DriverNotFoundException', 'DatabaseSurfaceDisabledException']; $folder = static::$root.'Caches/Exceptions'.'/'; self::call($files, $folder); }
php
private static function caches() { $files = ['Driver', 'FileDriver', 'ArrayDriver', 'PhpFilesDriver', 'ApcDriver', 'PDODriver']; $folder = static::$root.'Caches/Drivers'.'/'; self::call($files, $folder); $files = ['Item', 'Cache']; $folder = static::$root.'Caches'.'/'; self::call($files, $folder); $files = ['CacheItemNotFoundException', 'DriverNotFoundException', 'DatabaseSurfaceDisabledException']; $folder = static::$root.'Caches/Exceptions'.'/'; self::call($files, $folder); }
[ "private", "static", "function", "caches", "(", ")", "{", "$", "files", "=", "[", "'Driver'", ",", "'FileDriver'", ",", "'ArrayDriver'", ",", "'PhpFilesDriver'", ",", "'ApcDriver'", ",", "'PDODriver'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Caches/Drivers'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "$", "files", "=", "[", "'Item'", ",", "'Cache'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Caches'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "$", "files", "=", "[", "'CacheItemNotFoundException'", ",", "'DriverNotFoundException'", ",", "'DatabaseSurfaceDisabledException'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Caches/Exceptions'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "}" ]
Call Caches surface. @return null
[ "Call", "Caches", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L630-L646
12,495
vinala/kernel
src/Foundation/Bus.php
Bus.auth
private static function auth() { $files = ['Auth']; $folder = static::$root.'Authentication'.'/'; self::call($files, $folder); $files = ['AuthenticationModelNotFoundException']; $folder = static::$root.'Authentication/Exceptions'.'/'; self::call($files, $folder); }
php
private static function auth() { $files = ['Auth']; $folder = static::$root.'Authentication'.'/'; self::call($files, $folder); $files = ['AuthenticationModelNotFoundException']; $folder = static::$root.'Authentication/Exceptions'.'/'; self::call($files, $folder); }
[ "private", "static", "function", "auth", "(", ")", "{", "$", "files", "=", "[", "'Auth'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Authentication'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "$", "files", "=", "[", "'AuthenticationModelNotFoundException'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Authentication/Exceptions'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "}" ]
Call Auth surface. @return null
[ "Call", "Auth", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L666-L677
12,496
vinala/kernel
src/Foundation/Bus.php
Bus.database
public static function database() { $path = static::$root.'Database/'; //-------------------------------------------------------- // Calling drivers //-------------------------------------------------------- $files = ['Driver', 'MysqlDriver']; $folder = $path.'Drivers'.'/'; self::call($files, $folder); //-------------------------------------------------------- // Calling exporters //-------------------------------------------------------- $files = ['Exporter', 'Importer']; $folder = $path.'InOut/Mysql/'; self::call($files, $folder); //-------------------------------------------------------- // Calling Connectors //-------------------------------------------------------- $files = ['MysqlConnector']; $folder = $path.'Connectors'.'/'; self::call($files, $folder); //-------------------------------------------------------- // Calling Exceptions //-------------------------------------------------------- $files = ['ConnectorException', 'QueryException', 'SeedersEmptyException', 'DatabaseArgumentsException', 'DatabaseConnectionException', 'SchemaTableExistsException', 'SchemaTableNotExistException']; $folder = $path.'Exceptions'.'/'; self::call($files, $folder); //-------------------------------------------------------- // Calling Schemas //-------------------------------------------------------- $files = ['Schema', 'MysqlSchema']; $folder = $path.'Schemas'.'/'; self::call($files, $folder); //-------------------------------------------------------- // Calling Database parts //-------------------------------------------------------- $files = ['Migration', 'Seeder', 'DBTable', 'Query', 'Row', 'Database']; $folder = $path; self::call($files, $folder); }
php
public static function database() { $path = static::$root.'Database/'; //-------------------------------------------------------- // Calling drivers //-------------------------------------------------------- $files = ['Driver', 'MysqlDriver']; $folder = $path.'Drivers'.'/'; self::call($files, $folder); //-------------------------------------------------------- // Calling exporters //-------------------------------------------------------- $files = ['Exporter', 'Importer']; $folder = $path.'InOut/Mysql/'; self::call($files, $folder); //-------------------------------------------------------- // Calling Connectors //-------------------------------------------------------- $files = ['MysqlConnector']; $folder = $path.'Connectors'.'/'; self::call($files, $folder); //-------------------------------------------------------- // Calling Exceptions //-------------------------------------------------------- $files = ['ConnectorException', 'QueryException', 'SeedersEmptyException', 'DatabaseArgumentsException', 'DatabaseConnectionException', 'SchemaTableExistsException', 'SchemaTableNotExistException']; $folder = $path.'Exceptions'.'/'; self::call($files, $folder); //-------------------------------------------------------- // Calling Schemas //-------------------------------------------------------- $files = ['Schema', 'MysqlSchema']; $folder = $path.'Schemas'.'/'; self::call($files, $folder); //-------------------------------------------------------- // Calling Database parts //-------------------------------------------------------- $files = ['Migration', 'Seeder', 'DBTable', 'Query', 'Row', 'Database']; $folder = $path; self::call($files, $folder); }
[ "public", "static", "function", "database", "(", ")", "{", "$", "path", "=", "static", "::", "$", "root", ".", "'Database/'", ";", "//--------------------------------------------------------", "// Calling drivers", "//--------------------------------------------------------", "$", "files", "=", "[", "'Driver'", ",", "'MysqlDriver'", "]", ";", "$", "folder", "=", "$", "path", ".", "'Drivers'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "//--------------------------------------------------------", "// Calling exporters", "//--------------------------------------------------------", "$", "files", "=", "[", "'Exporter'", ",", "'Importer'", "]", ";", "$", "folder", "=", "$", "path", ".", "'InOut/Mysql/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "//--------------------------------------------------------", "// Calling Connectors", "//--------------------------------------------------------", "$", "files", "=", "[", "'MysqlConnector'", "]", ";", "$", "folder", "=", "$", "path", ".", "'Connectors'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "//--------------------------------------------------------", "// Calling Exceptions", "//--------------------------------------------------------", "$", "files", "=", "[", "'ConnectorException'", ",", "'QueryException'", ",", "'SeedersEmptyException'", ",", "'DatabaseArgumentsException'", ",", "'DatabaseConnectionException'", ",", "'SchemaTableExistsException'", ",", "'SchemaTableNotExistException'", "]", ";", "$", "folder", "=", "$", "path", ".", "'Exceptions'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "//--------------------------------------------------------", "// Calling Schemas", "//--------------------------------------------------------", "$", "files", "=", "[", "'Schema'", ",", "'MysqlSchema'", "]", ";", "$", "folder", "=", "$", "path", ".", "'Schemas'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "//--------------------------------------------------------", "// Calling Database parts", "//--------------------------------------------------------", "$", "files", "=", "[", "'Migration'", ",", "'Seeder'", ",", "'DBTable'", ",", "'Query'", ",", "'Row'", ",", "'Database'", "]", ";", "$", "folder", "=", "$", "path", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "}" ]
Call Database surface. @return null
[ "Call", "Database", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L684-L741
12,497
vinala/kernel
src/Foundation/Bus.php
Bus.http
private static function http() { $files = ['Http', 'Request']; $folder = static::$root.'Http'.'/'; self::call($files, $folder); static::links(); static::redirect(); static::middleware(); }
php
private static function http() { $files = ['Http', 'Request']; $folder = static::$root.'Http'.'/'; self::call($files, $folder); static::links(); static::redirect(); static::middleware(); }
[ "private", "static", "function", "http", "(", ")", "{", "$", "files", "=", "[", "'Http'", ",", "'Request'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Http'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "static", "::", "links", "(", ")", ";", "static", "::", "redirect", "(", ")", ";", "static", "::", "middleware", "(", ")", ";", "}" ]
Call HTTP surface. @return null
[ "Call", "HTTP", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L748-L758
12,498
vinala/kernel
src/Foundation/Bus.php
Bus.links
private static function links() { $files = ['Link']; $folder = static::$root.'Http/Links'.'/'; self::call($files, $folder); $files = ['LinkKeyNotFoundException']; $folder = static::$root.'Http/Links/Exceptions'.'/'; self::call($files, $folder); }
php
private static function links() { $files = ['Link']; $folder = static::$root.'Http/Links'.'/'; self::call($files, $folder); $files = ['LinkKeyNotFoundException']; $folder = static::$root.'Http/Links/Exceptions'.'/'; self::call($files, $folder); }
[ "private", "static", "function", "links", "(", ")", "{", "$", "files", "=", "[", "'Link'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Http/Links'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "$", "files", "=", "[", "'LinkKeyNotFoundException'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Http/Links/Exceptions'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "}" ]
Call the Links surface. @return null
[ "Call", "the", "Links", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L765-L776
12,499
vinala/kernel
src/Foundation/Bus.php
Bus.middleware
private static function middleware() { $files = ['Filters', 'Middleware']; $folder = static::$root.'Http/Middleware'.'/'; self::call($files, $folder); $files = ['MiddlewareNotFoundException', 'MiddlewareWallException']; $folder = static::$root.'Http/Middleware/Exceptions'.'/'; self::call($files, $folder); }
php
private static function middleware() { $files = ['Filters', 'Middleware']; $folder = static::$root.'Http/Middleware'.'/'; self::call($files, $folder); $files = ['MiddlewareNotFoundException', 'MiddlewareWallException']; $folder = static::$root.'Http/Middleware/Exceptions'.'/'; self::call($files, $folder); }
[ "private", "static", "function", "middleware", "(", ")", "{", "$", "files", "=", "[", "'Filters'", ",", "'Middleware'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Http/Middleware'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "$", "files", "=", "[", "'MiddlewareNotFoundException'", ",", "'MiddlewareWallException'", "]", ";", "$", "folder", "=", "static", "::", "$", "root", ".", "'Http/Middleware/Exceptions'", ".", "'/'", ";", "self", "::", "call", "(", "$", "files", ",", "$", "folder", ")", ";", "}" ]
Call the Middleware surface. @return null
[ "Call", "the", "Middleware", "surface", "." ]
346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a
https://github.com/vinala/kernel/blob/346c8a4dca48fd1ab88fdc9f7004ecb7bce6a67a/src/Foundation/Bus.php#L796-L807