id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
235,900
Sowapps/orpheus-publisher
src/Publisher/PermanentObject/PermanentObject.php
PermanentObject.getSQLAdapter
public static function getSQLAdapter() { $classData = null; static::getClassData($classData); if( !isset($classData->sqlAdapter) || !$classData->sqlAdapter ) { $classData->sqlAdapter = SQLAdapter::getInstance(static::$DBInstance); } // This after $knownClassData classData return $classData->sqlAdapter; }
php
public static function getSQLAdapter() { $classData = null; static::getClassData($classData); if( !isset($classData->sqlAdapter) || !$classData->sqlAdapter ) { $classData->sqlAdapter = SQLAdapter::getInstance(static::$DBInstance); } // This after $knownClassData classData return $classData->sqlAdapter; }
[ "public", "static", "function", "getSQLAdapter", "(", ")", "{", "$", "classData", "=", "null", ";", "static", "::", "getClassData", "(", "$", "classData", ")", ";", "if", "(", "!", "isset", "(", "$", "classData", "->", "sqlAdapter", ")", "||", "!", "$", "classData", "->", "sqlAdapter", ")", "{", "$", "classData", "->", "sqlAdapter", "=", "SQLAdapter", "::", "getInstance", "(", "static", "::", "$", "DBInstance", ")", ";", "}", "// This after $knownClassData classData", "return", "$", "classData", "->", "sqlAdapter", ";", "}" ]
Get the SQL Adapter of this class @return SQLAdapter
[ "Get", "the", "SQL", "Adapter", "of", "this", "class" ]
e33508538a0aa6f7491d724ca1cb09893203bfba
https://github.com/Sowapps/orpheus-publisher/blob/e33508538a0aa6f7491d724ca1cb09893203bfba/src/Publisher/PermanentObject/PermanentObject.php#L1402-L1410
235,901
asika32764/joomla-framework-console
Option/OptionSet.php
OptionSet.offsetGet
public function offsetGet($name) { $name = $this->resolveAlias($name); if (!$this->offsetExists($name)) { return null; } return parent::offsetGet($name); }
php
public function offsetGet($name) { $name = $this->resolveAlias($name); if (!$this->offsetExists($name)) { return null; } return parent::offsetGet($name); }
[ "public", "function", "offsetGet", "(", "$", "name", ")", "{", "$", "name", "=", "$", "this", "->", "resolveAlias", "(", "$", "name", ")", ";", "if", "(", "!", "$", "this", "->", "offsetExists", "(", "$", "name", ")", ")", "{", "return", "null", ";", "}", "return", "parent", "::", "offsetGet", "(", "$", "name", ")", ";", "}" ]
Get an option by name. @param mixed $name Option name to get option. @return Option|null Return option object if exists. @since 1.0
[ "Get", "an", "option", "by", "name", "." ]
fe28cf9e1c694049e015121e2bd041268e814249
https://github.com/asika32764/joomla-framework-console/blob/fe28cf9e1c694049e015121e2bd041268e814249/Option/OptionSet.php#L68-L78
235,902
asika32764/joomla-framework-console
Option/OptionSet.php
OptionSet.setAlias
public function setAlias($aliases, $option) { $aliases = (array) $aliases; foreach ($aliases as $alias) { $this->aliases[$alias] = $option; } return $this; }
php
public function setAlias($aliases, $option) { $aliases = (array) $aliases; foreach ($aliases as $alias) { $this->aliases[$alias] = $option; } return $this; }
[ "public", "function", "setAlias", "(", "$", "aliases", ",", "$", "option", ")", "{", "$", "aliases", "=", "(", "array", ")", "$", "aliases", ";", "foreach", "(", "$", "aliases", "as", "$", "alias", ")", "{", "$", "this", "->", "aliases", "[", "$", "alias", "]", "=", "$", "option", ";", "}", "return", "$", "this", ";", "}" ]
Set Alias of an option. @param array|string $aliases An alias of a option, can be array. @param string $option The option which we want to add alias. @return OptionSet Return self to support chaining. @since 1.0
[ "Set", "Alias", "of", "an", "option", "." ]
fe28cf9e1c694049e015121e2bd041268e814249
https://github.com/asika32764/joomla-framework-console/blob/fe28cf9e1c694049e015121e2bd041268e814249/Option/OptionSet.php#L132-L142
235,903
asika32764/joomla-framework-console
Option/OptionSet.php
OptionSet.resolveAlias
protected function resolveAlias($alias) { if (!empty($this->aliases[$alias])) { return $this->aliases[$alias]; } return $alias; }
php
protected function resolveAlias($alias) { if (!empty($this->aliases[$alias])) { return $this->aliases[$alias]; } return $alias; }
[ "protected", "function", "resolveAlias", "(", "$", "alias", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "aliases", "[", "$", "alias", "]", ")", ")", "{", "return", "$", "this", "->", "aliases", "[", "$", "alias", "]", ";", "}", "return", "$", "alias", ";", "}" ]
Resolve alias for an option. @param string $alias An alias to help us get option name. @return string Return name if found, or return alias as name. @since 1.0
[ "Resolve", "alias", "for", "an", "option", "." ]
fe28cf9e1c694049e015121e2bd041268e814249
https://github.com/asika32764/joomla-framework-console/blob/fe28cf9e1c694049e015121e2bd041268e814249/Option/OptionSet.php#L153-L161
235,904
hiqdev/hidev-readme
src/components/Readme.php
Readme.renderSections
public function renderSections($sections = null) { if ($sections === null) { $sections = $this->getSections(); } $res = ''; foreach ($sections as $section) { $res .= $this->renderSection($section); } return $res; }
php
public function renderSections($sections = null) { if ($sections === null) { $sections = $this->getSections(); } $res = ''; foreach ($sections as $section) { $res .= $this->renderSection($section); } return $res; }
[ "public", "function", "renderSections", "(", "$", "sections", "=", "null", ")", "{", "if", "(", "$", "sections", "===", "null", ")", "{", "$", "sections", "=", "$", "this", "->", "getSections", "(", ")", ";", "}", "$", "res", "=", "''", ";", "foreach", "(", "$", "sections", "as", "$", "section", ")", "{", "$", "res", ".=", "$", "this", "->", "renderSection", "(", "$", "section", ")", ";", "}", "return", "$", "res", ";", "}" ]
Render all configured sections. @return string
[ "Render", "all", "configured", "sections", "." ]
87e3fe8a464d1b25a94eed072b50c877174f6083
https://github.com/hiqdev/hidev-readme/blob/87e3fe8a464d1b25a94eed072b50c877174f6083/src/components/Readme.php#L138-L149
235,905
hiqdev/hidev-readme
src/components/Readme.php
Readme.renderBadges
public function renderBadges() { $badges = $this->badges; if (!$badges) { return ''; } $pm = $this->take('package')->getPackageManager(); $res = ''; foreach ($badges as $badge => $tpl) { if (!$tpl) { $tpl = $this->knownBadges[$badge]; } if ($tpl === 'disabled') { continue; } $res .= $this->renderBadge($tpl) . "\n"; } return $res ? "\n$res" : ''; }
php
public function renderBadges() { $badges = $this->badges; if (!$badges) { return ''; } $pm = $this->take('package')->getPackageManager(); $res = ''; foreach ($badges as $badge => $tpl) { if (!$tpl) { $tpl = $this->knownBadges[$badge]; } if ($tpl === 'disabled') { continue; } $res .= $this->renderBadge($tpl) . "\n"; } return $res ? "\n$res" : ''; }
[ "public", "function", "renderBadges", "(", ")", "{", "$", "badges", "=", "$", "this", "->", "badges", ";", "if", "(", "!", "$", "badges", ")", "{", "return", "''", ";", "}", "$", "pm", "=", "$", "this", "->", "take", "(", "'package'", ")", "->", "getPackageManager", "(", ")", ";", "$", "res", "=", "''", ";", "foreach", "(", "$", "badges", "as", "$", "badge", "=>", "$", "tpl", ")", "{", "if", "(", "!", "$", "tpl", ")", "{", "$", "tpl", "=", "$", "this", "->", "knownBadges", "[", "$", "badge", "]", ";", "}", "if", "(", "$", "tpl", "===", "'disabled'", ")", "{", "continue", ";", "}", "$", "res", ".=", "$", "this", "->", "renderBadge", "(", "$", "tpl", ")", ".", "\"\\n\"", ";", "}", "return", "$", "res", "?", "\"\\n$res\"", ":", "''", ";", "}" ]
Render all configured badges. @return string
[ "Render", "all", "configured", "badges", "." ]
87e3fe8a464d1b25a94eed072b50c877174f6083
https://github.com/hiqdev/hidev-readme/blob/87e3fe8a464d1b25a94eed072b50c877174f6083/src/components/Readme.php#L155-L174
235,906
hiqdev/hidev-readme
src/components/Readme.php
Readme.renderBadge
public function renderBadge($template) { $tpl = $this->getTwig()->createTemplate($template); return $tpl->render(['app' => Yii::$app]); }
php
public function renderBadge($template) { $tpl = $this->getTwig()->createTemplate($template); return $tpl->render(['app' => Yii::$app]); }
[ "public", "function", "renderBadge", "(", "$", "template", ")", "{", "$", "tpl", "=", "$", "this", "->", "getTwig", "(", ")", "->", "createTemplate", "(", "$", "template", ")", ";", "return", "$", "tpl", "->", "render", "(", "[", "'app'", "=>", "Yii", "::", "$", "app", "]", ")", ";", "}" ]
Render badge by given template. @param string $template string to render @return string
[ "Render", "badge", "by", "given", "template", "." ]
87e3fe8a464d1b25a94eed072b50c877174f6083
https://github.com/hiqdev/hidev-readme/blob/87e3fe8a464d1b25a94eed072b50c877174f6083/src/components/Readme.php#L181-L186
235,907
hiqdev/hidev-readme
src/components/Readme.php
Readme.getTwig
public function getTwig() { if ($this->_twig === null) { $this->_twig = new \Twig_Environment(new \Twig_Loader_Array()); } return $this->_twig; }
php
public function getTwig() { if ($this->_twig === null) { $this->_twig = new \Twig_Environment(new \Twig_Loader_Array()); } return $this->_twig; }
[ "public", "function", "getTwig", "(", ")", "{", "if", "(", "$", "this", "->", "_twig", "===", "null", ")", "{", "$", "this", "->", "_twig", "=", "new", "\\", "Twig_Environment", "(", "new", "\\", "Twig_Loader_Array", "(", ")", ")", ";", "}", "return", "$", "this", "->", "_twig", ";", "}" ]
Twig getter. @return \Twig_Environment
[ "Twig", "getter", "." ]
87e3fe8a464d1b25a94eed072b50c877174f6083
https://github.com/hiqdev/hidev-readme/blob/87e3fe8a464d1b25a94eed072b50c877174f6083/src/components/Readme.php#L192-L199
235,908
registripe/registripe-core
code/emails/EventRegistrationDetailsEmail.php
EventRegistrationDetailsEmail.factory
public static function factory(EventRegistration $registration) { $email = new self(); $siteconfig = SiteConfig::current_site_config(); $email->setTo($registration->Email); $email->setSubject(sprintf( 'Registration Details For %s (%s)', $registration->Event()->Title, $siteconfig->Title)); $email->populateTemplate(array( 'Registration' => $registration, 'SiteConfig' => $siteconfig )); singleton(get_class())->extend('updateEmail', $email, $registration); return $email; }
php
public static function factory(EventRegistration $registration) { $email = new self(); $siteconfig = SiteConfig::current_site_config(); $email->setTo($registration->Email); $email->setSubject(sprintf( 'Registration Details For %s (%s)', $registration->Event()->Title, $siteconfig->Title)); $email->populateTemplate(array( 'Registration' => $registration, 'SiteConfig' => $siteconfig )); singleton(get_class())->extend('updateEmail', $email, $registration); return $email; }
[ "public", "static", "function", "factory", "(", "EventRegistration", "$", "registration", ")", "{", "$", "email", "=", "new", "self", "(", ")", ";", "$", "siteconfig", "=", "SiteConfig", "::", "current_site_config", "(", ")", ";", "$", "email", "->", "setTo", "(", "$", "registration", "->", "Email", ")", ";", "$", "email", "->", "setSubject", "(", "sprintf", "(", "'Registration Details For %s (%s)'", ",", "$", "registration", "->", "Event", "(", ")", "->", "Title", ",", "$", "siteconfig", "->", "Title", ")", ")", ";", "$", "email", "->", "populateTemplate", "(", "array", "(", "'Registration'", "=>", "$", "registration", ",", "'SiteConfig'", "=>", "$", "siteconfig", ")", ")", ";", "singleton", "(", "get_class", "(", ")", ")", "->", "extend", "(", "'updateEmail'", ",", "$", "email", ",", "$", "registration", ")", ";", "return", "$", "email", ";", "}" ]
Creates an email instance from a registration object. @param EventRegistration $registration @return EventRegistrationDetailsEmail
[ "Creates", "an", "email", "instance", "from", "a", "registration", "object", "." ]
e52b3340aef323067ebfa9bd5fa07cb81bb63db9
https://github.com/registripe/registripe-core/blob/e52b3340aef323067ebfa9bd5fa07cb81bb63db9/code/emails/EventRegistrationDetailsEmail.php#L17-L34
235,909
asbsoft/yii2module-modmgr_1_161205
models/Modmgr.php
Modmgr.loadData
public function loadData($installModel) { $this->is_active = false; $this->create_at = new Expression('NOW()'); // server time $this->module_id = $installModel->moduleId; $this->parent_uid = $installModel->parentUid; $fileBody = file_get_contents($installModel->moduleClassFile->tempName); //$regexp = "/namespace[ \t]+([A-Za-z0-9\\_]+);/"; //?? $regexp = "/namespace[ \t]+([^;]+);/"; $n = preg_match($regexp, $fileBody, $found); if ($n < 1) { $this->addError('module_class', $error = Yii::t($this->tc, "Can't find namespace in module class file")); return; } else { $this->module_class = $found[1] . "\\" . basename($installModel->moduleClassFile->name, '.php'); $cmd = "return {$this->module_class}::className();"; if(function_exists('runkit_lint') && !runkit_lint($cmd)) { $this->addError('module_class', $error = Yii::t($this->tc, 'Module class file has errors')); return; } //*?? try { $className = @eval($cmd); if ($className != $this->module_class) { $this->addError('module_class', $error = Yii::t($this->tc, 'Bad module class file')); return; } } catch (Exception $e) { // not catch syntax error $this->addError('module_class', $error = Yii::t($this->tc, $e->getMessage())); return; } /**/ $configDefault = $this->buildDefaultConfig($this->module_class); $this->config_default = var_export($configDefault, true); $this->name = empty($configDefault['params']['label']) ? ('Module ' . dirname($this->module_class)) : $configDefault['params']['label']; $config = []; if (isset($configDefault['params'])) { $config['params'] = $configDefault['params']; } if (isset($configDefault['routesConfig'])) { $config['routesConfig'] = $configDefault['routesConfig']; } else { //$config['routesConfig'] = []; //!! error if not-UniModule } $this->config_text = var_export($config, true); } }
php
public function loadData($installModel) { $this->is_active = false; $this->create_at = new Expression('NOW()'); // server time $this->module_id = $installModel->moduleId; $this->parent_uid = $installModel->parentUid; $fileBody = file_get_contents($installModel->moduleClassFile->tempName); //$regexp = "/namespace[ \t]+([A-Za-z0-9\\_]+);/"; //?? $regexp = "/namespace[ \t]+([^;]+);/"; $n = preg_match($regexp, $fileBody, $found); if ($n < 1) { $this->addError('module_class', $error = Yii::t($this->tc, "Can't find namespace in module class file")); return; } else { $this->module_class = $found[1] . "\\" . basename($installModel->moduleClassFile->name, '.php'); $cmd = "return {$this->module_class}::className();"; if(function_exists('runkit_lint') && !runkit_lint($cmd)) { $this->addError('module_class', $error = Yii::t($this->tc, 'Module class file has errors')); return; } //*?? try { $className = @eval($cmd); if ($className != $this->module_class) { $this->addError('module_class', $error = Yii::t($this->tc, 'Bad module class file')); return; } } catch (Exception $e) { // not catch syntax error $this->addError('module_class', $error = Yii::t($this->tc, $e->getMessage())); return; } /**/ $configDefault = $this->buildDefaultConfig($this->module_class); $this->config_default = var_export($configDefault, true); $this->name = empty($configDefault['params']['label']) ? ('Module ' . dirname($this->module_class)) : $configDefault['params']['label']; $config = []; if (isset($configDefault['params'])) { $config['params'] = $configDefault['params']; } if (isset($configDefault['routesConfig'])) { $config['routesConfig'] = $configDefault['routesConfig']; } else { //$config['routesConfig'] = []; //!! error if not-UniModule } $this->config_text = var_export($config, true); } }
[ "public", "function", "loadData", "(", "$", "installModel", ")", "{", "$", "this", "->", "is_active", "=", "false", ";", "$", "this", "->", "create_at", "=", "new", "Expression", "(", "'NOW()'", ")", ";", "// server time", "$", "this", "->", "module_id", "=", "$", "installModel", "->", "moduleId", ";", "$", "this", "->", "parent_uid", "=", "$", "installModel", "->", "parentUid", ";", "$", "fileBody", "=", "file_get_contents", "(", "$", "installModel", "->", "moduleClassFile", "->", "tempName", ")", ";", "//$regexp = \"/namespace[ \\t]+([A-Za-z0-9\\\\_]+);/\"; //??", "$", "regexp", "=", "\"/namespace[ \\t]+([^;]+);/\"", ";", "$", "n", "=", "preg_match", "(", "$", "regexp", ",", "$", "fileBody", ",", "$", "found", ")", ";", "if", "(", "$", "n", "<", "1", ")", "{", "$", "this", "->", "addError", "(", "'module_class'", ",", "$", "error", "=", "Yii", "::", "t", "(", "$", "this", "->", "tc", ",", "\"Can't find namespace in module class file\"", ")", ")", ";", "return", ";", "}", "else", "{", "$", "this", "->", "module_class", "=", "$", "found", "[", "1", "]", ".", "\"\\\\\"", ".", "basename", "(", "$", "installModel", "->", "moduleClassFile", "->", "name", ",", "'.php'", ")", ";", "$", "cmd", "=", "\"return {$this->module_class}::className();\"", ";", "if", "(", "function_exists", "(", "'runkit_lint'", ")", "&&", "!", "runkit_lint", "(", "$", "cmd", ")", ")", "{", "$", "this", "->", "addError", "(", "'module_class'", ",", "$", "error", "=", "Yii", "::", "t", "(", "$", "this", "->", "tc", ",", "'Module class file has errors'", ")", ")", ";", "return", ";", "}", "//*??", "try", "{", "$", "className", "=", "@", "eval", "(", "$", "cmd", ")", ";", "if", "(", "$", "className", "!=", "$", "this", "->", "module_class", ")", "{", "$", "this", "->", "addError", "(", "'module_class'", ",", "$", "error", "=", "Yii", "::", "t", "(", "$", "this", "->", "tc", ",", "'Bad module class file'", ")", ")", ";", "return", ";", "}", "}", "catch", "(", "Exception", "$", "e", ")", "{", "// not catch syntax error", "$", "this", "->", "addError", "(", "'module_class'", ",", "$", "error", "=", "Yii", "::", "t", "(", "$", "this", "->", "tc", ",", "$", "e", "->", "getMessage", "(", ")", ")", ")", ";", "return", ";", "}", "/**/", "$", "configDefault", "=", "$", "this", "->", "buildDefaultConfig", "(", "$", "this", "->", "module_class", ")", ";", "$", "this", "->", "config_default", "=", "var_export", "(", "$", "configDefault", ",", "true", ")", ";", "$", "this", "->", "name", "=", "empty", "(", "$", "configDefault", "[", "'params'", "]", "[", "'label'", "]", ")", "?", "(", "'Module '", ".", "dirname", "(", "$", "this", "->", "module_class", ")", ")", ":", "$", "configDefault", "[", "'params'", "]", "[", "'label'", "]", ";", "$", "config", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "configDefault", "[", "'params'", "]", ")", ")", "{", "$", "config", "[", "'params'", "]", "=", "$", "configDefault", "[", "'params'", "]", ";", "}", "if", "(", "isset", "(", "$", "configDefault", "[", "'routesConfig'", "]", ")", ")", "{", "$", "config", "[", "'routesConfig'", "]", "=", "$", "configDefault", "[", "'routesConfig'", "]", ";", "}", "else", "{", "//$config['routesConfig'] = []; //!! error if not-UniModule", "}", "$", "this", "->", "config_text", "=", "var_export", "(", "$", "config", ",", "true", ")", ";", "}", "}" ]
Load data from install model
[ "Load", "data", "from", "install", "model" ]
febe4c5a66430ea762ee425947c42c957812bff1
https://github.com/asbsoft/yii2module-modmgr_1_161205/blob/febe4c5a66430ea762ee425947c42c957812bff1/models/Modmgr.php#L213-L267
235,910
asbsoft/yii2module-modmgr_1_161205
models/Modmgr.php
Modmgr.isActive
protected static function isActive($dbId) { if (!isset(static::$_modulesData[$dbId])) { $result = static::findOne($dbId); static::$_modulesData[$dbId] = $result; } if (empty(static::$_modulesData[$dbId])) { return false; } else { $isActive = static::$_modulesData[$dbId]->is_active; return $isActive; } }
php
protected static function isActive($dbId) { if (!isset(static::$_modulesData[$dbId])) { $result = static::findOne($dbId); static::$_modulesData[$dbId] = $result; } if (empty(static::$_modulesData[$dbId])) { return false; } else { $isActive = static::$_modulesData[$dbId]->is_active; return $isActive; } }
[ "protected", "static", "function", "isActive", "(", "$", "dbId", ")", "{", "if", "(", "!", "isset", "(", "static", "::", "$", "_modulesData", "[", "$", "dbId", "]", ")", ")", "{", "$", "result", "=", "static", "::", "findOne", "(", "$", "dbId", ")", ";", "static", "::", "$", "_modulesData", "[", "$", "dbId", "]", "=", "$", "result", ";", "}", "if", "(", "empty", "(", "static", "::", "$", "_modulesData", "[", "$", "dbId", "]", ")", ")", "{", "return", "false", ";", "}", "else", "{", "$", "isActive", "=", "static", "::", "$", "_modulesData", "[", "$", "dbId", "]", "->", "is_active", ";", "return", "$", "isActive", ";", "}", "}" ]
Check if active dynamicly attached module
[ "Check", "if", "active", "dynamicly", "attached", "module" ]
febe4c5a66430ea762ee425947c42c957812bff1
https://github.com/asbsoft/yii2module-modmgr_1_161205/blob/febe4c5a66430ea762ee425947c42c957812bff1/models/Modmgr.php#L286-L298
235,911
asbsoft/yii2module-modmgr_1_161205
models/Modmgr.php
Modmgr.hasUnactiveContainer
public function hasUnactiveContainer() { $parent = $this->parent_uid; if (preg_match_all('|\{(\d+)\}|', $parent, $matches)) { if (!empty($matches[1])) { foreach($matches[1] as $nextDbId) { if (!static::isActive($nextDbId)) return true; } } } return false; }
php
public function hasUnactiveContainer() { $parent = $this->parent_uid; if (preg_match_all('|\{(\d+)\}|', $parent, $matches)) { if (!empty($matches[1])) { foreach($matches[1] as $nextDbId) { if (!static::isActive($nextDbId)) return true; } } } return false; }
[ "public", "function", "hasUnactiveContainer", "(", ")", "{", "$", "parent", "=", "$", "this", "->", "parent_uid", ";", "if", "(", "preg_match_all", "(", "'|\\{(\\d+)\\}|'", ",", "$", "parent", ",", "$", "matches", ")", ")", "{", "if", "(", "!", "empty", "(", "$", "matches", "[", "1", "]", ")", ")", "{", "foreach", "(", "$", "matches", "[", "1", "]", "as", "$", "nextDbId", ")", "{", "if", "(", "!", "static", "::", "isActive", "(", "$", "nextDbId", ")", ")", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Check if this module has unactive container
[ "Check", "if", "this", "module", "has", "unactive", "container" ]
febe4c5a66430ea762ee425947c42c957812bff1
https://github.com/asbsoft/yii2module-modmgr_1_161205/blob/febe4c5a66430ea762ee425947c42c957812bff1/models/Modmgr.php#L300-L311
235,912
asbsoft/yii2module-modmgr_1_161205
models/Modmgr.php
Modmgr.correctParents
public function correctParents($oldSubmodulesParentUid, $newSubmodulesParentUid) { if ($oldSubmodulesParentUid === $newSubmodulesParentUid) return; $query = static::find()->where(['like', 'parent_uid', "{$oldSubmodulesParentUid}%", false]); $list = $query->all(); foreach ($list as $item) { if (0 === strpos($item->parent_uid, $oldSubmodulesParentUid)) { $item->parent_uid = $newSubmodulesParentUid . mb_substr($item->parent_uid, mb_strlen($oldSubmodulesParentUid)); $item->save(); } } }
php
public function correctParents($oldSubmodulesParentUid, $newSubmodulesParentUid) { if ($oldSubmodulesParentUid === $newSubmodulesParentUid) return; $query = static::find()->where(['like', 'parent_uid', "{$oldSubmodulesParentUid}%", false]); $list = $query->all(); foreach ($list as $item) { if (0 === strpos($item->parent_uid, $oldSubmodulesParentUid)) { $item->parent_uid = $newSubmodulesParentUid . mb_substr($item->parent_uid, mb_strlen($oldSubmodulesParentUid)); $item->save(); } } }
[ "public", "function", "correctParents", "(", "$", "oldSubmodulesParentUid", ",", "$", "newSubmodulesParentUid", ")", "{", "if", "(", "$", "oldSubmodulesParentUid", "===", "$", "newSubmodulesParentUid", ")", "return", ";", "$", "query", "=", "static", "::", "find", "(", ")", "->", "where", "(", "[", "'like'", ",", "'parent_uid'", ",", "\"{$oldSubmodulesParentUid}%\"", ",", "false", "]", ")", ";", "$", "list", "=", "$", "query", "->", "all", "(", ")", ";", "foreach", "(", "$", "list", "as", "$", "item", ")", "{", "if", "(", "0", "===", "strpos", "(", "$", "item", "->", "parent_uid", ",", "$", "oldSubmodulesParentUid", ")", ")", "{", "$", "item", "->", "parent_uid", "=", "$", "newSubmodulesParentUid", ".", "mb_substr", "(", "$", "item", "->", "parent_uid", ",", "mb_strlen", "(", "$", "oldSubmodulesParentUid", ")", ")", ";", "$", "item", "->", "save", "(", ")", ";", "}", "}", "}" ]
Correct parent_uid chain if module-container change it's own name or container
[ "Correct", "parent_uid", "chain", "if", "module", "-", "container", "change", "it", "s", "own", "name", "or", "container" ]
febe4c5a66430ea762ee425947c42c957812bff1
https://github.com/asbsoft/yii2module-modmgr_1_161205/blob/febe4c5a66430ea762ee425947c42c957812bff1/models/Modmgr.php#L314-L327
235,913
Apatis/Http-Message
src/Stream.php
Stream.processStreamCallback
private function processStreamCallback(string $task, ...$params) { if (! isset($this->stream)) { throw new \RuntimeException('Stream is detached'); } $task = strtolower($task); $fn = 'f'; if ($this->streamType === 'ZLIB') { if ($task === 'stat') { return false; } $fn = 'gz'; } // default using f$task -> eg fopen() on gzip using gzopen $fn .= $task; if (! function_exists($fn)) { return false; } switch ($task) { case 'seek': case 'write': if ($task === 'seek' && ! $this->seekable) { throw new \RuntimeException('Stream is not seekable'); } elseif ($task === 'write' && ! $this->writable) { throw new \RuntimeException('Cannot write to a non-writable stream'); } if (isset($params[1])) { return $fn($this->stream, $params[0], $params[1]); } return $fn($this->stream, $params[0]); case 'read': return $fn($this->stream, $params[0]); default: return $fn($this->stream, ...$params); } }
php
private function processStreamCallback(string $task, ...$params) { if (! isset($this->stream)) { throw new \RuntimeException('Stream is detached'); } $task = strtolower($task); $fn = 'f'; if ($this->streamType === 'ZLIB') { if ($task === 'stat') { return false; } $fn = 'gz'; } // default using f$task -> eg fopen() on gzip using gzopen $fn .= $task; if (! function_exists($fn)) { return false; } switch ($task) { case 'seek': case 'write': if ($task === 'seek' && ! $this->seekable) { throw new \RuntimeException('Stream is not seekable'); } elseif ($task === 'write' && ! $this->writable) { throw new \RuntimeException('Cannot write to a non-writable stream'); } if (isset($params[1])) { return $fn($this->stream, $params[0], $params[1]); } return $fn($this->stream, $params[0]); case 'read': return $fn($this->stream, $params[0]); default: return $fn($this->stream, ...$params); } }
[ "private", "function", "processStreamCallback", "(", "string", "$", "task", ",", "...", "$", "params", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "stream", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Stream is detached'", ")", ";", "}", "$", "task", "=", "strtolower", "(", "$", "task", ")", ";", "$", "fn", "=", "'f'", ";", "if", "(", "$", "this", "->", "streamType", "===", "'ZLIB'", ")", "{", "if", "(", "$", "task", "===", "'stat'", ")", "{", "return", "false", ";", "}", "$", "fn", "=", "'gz'", ";", "}", "// default using f$task -> eg fopen() on gzip using gzopen", "$", "fn", ".=", "$", "task", ";", "if", "(", "!", "function_exists", "(", "$", "fn", ")", ")", "{", "return", "false", ";", "}", "switch", "(", "$", "task", ")", "{", "case", "'seek'", ":", "case", "'write'", ":", "if", "(", "$", "task", "===", "'seek'", "&&", "!", "$", "this", "->", "seekable", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Stream is not seekable'", ")", ";", "}", "elseif", "(", "$", "task", "===", "'write'", "&&", "!", "$", "this", "->", "writable", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Cannot write to a non-writable stream'", ")", ";", "}", "if", "(", "isset", "(", "$", "params", "[", "1", "]", ")", ")", "{", "return", "$", "fn", "(", "$", "this", "->", "stream", ",", "$", "params", "[", "0", "]", ",", "$", "params", "[", "1", "]", ")", ";", "}", "return", "$", "fn", "(", "$", "this", "->", "stream", ",", "$", "params", "[", "0", "]", ")", ";", "case", "'read'", ":", "return", "$", "fn", "(", "$", "this", "->", "stream", ",", "$", "params", "[", "0", "]", ")", ";", "default", ":", "return", "$", "fn", "(", "$", "this", "->", "stream", ",", "...", "$", "params", ")", ";", "}", "}" ]
Helper callback processor @param string $task @param array ...$params @return array|bool|int|string @access private
[ "Helper", "callback", "processor" ]
9ede3f8bcdd2400b238e0624a4af8f09c60da222
https://github.com/Apatis/Http-Message/blob/9ede3f8bcdd2400b238e0624a4af8f09c60da222/src/Stream.php#L168-L205
235,914
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.checkBoxRow
public function checkBoxRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CHECKBOX, $model, $attribute, null, $htmlOptions); }
php
public function checkBoxRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CHECKBOX, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "checkBoxRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_CHECKBOX", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a checkbox input row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "checkbox", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L71-L74
235,915
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.toggleButtonRow
public function toggleButtonRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TOGGLEBUTTON, $model, $attribute, null, $htmlOptions); }
php
public function toggleButtonRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TOGGLEBUTTON, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "toggleButtonRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_TOGGLEBUTTON", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a toggle input row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes (options key sets the options for the toggle component) @return string the generated row
[ "Renders", "a", "toggle", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L83-L86
235,916
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.checkBoxListRow
public function checkBoxListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CHECKBOXLIST, $model, $attribute, $data, $htmlOptions); }
php
public function checkBoxListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CHECKBOXLIST, $model, $attribute, $data, $htmlOptions); }
[ "public", "function", "checkBoxListRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "data", "=", "array", "(", ")", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_CHECKBOXLIST", ",", "$", "model", ",", "$", "attribute", ",", "$", "data", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a checkbox list input row. @param CModel $model the data model @param string $attribute the attribute @param array $data the list data @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "checkbox", "list", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L96-L99
235,917
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.checkBoxListInlineRow
public function checkBoxListInlineRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CHECKBOXLIST_INLINE, $model, $attribute, $data, $htmlOptions); }
php
public function checkBoxListInlineRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CHECKBOXLIST_INLINE, $model, $attribute, $data, $htmlOptions); }
[ "public", "function", "checkBoxListInlineRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "data", "=", "array", "(", ")", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_CHECKBOXLIST_INLINE", ",", "$", "model", ",", "$", "attribute", ",", "$", "data", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a checkbox list inline input row. @param CModel $model the data model @param string $attribute the attribute @param array $data the list data @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "checkbox", "list", "inline", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L109-L112
235,918
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.dropDownListRow
public function dropDownListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_DROPDOWN, $model, $attribute, $data, $htmlOptions); }
php
public function dropDownListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_DROPDOWN, $model, $attribute, $data, $htmlOptions); }
[ "public", "function", "dropDownListRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "data", "=", "array", "(", ")", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_DROPDOWN", ",", "$", "model", ",", "$", "attribute", ",", "$", "data", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a drop-down list input row. @param CModel $model the data model @param string $attribute the attribute @param array $data the list data @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "drop", "-", "down", "list", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L122-L125
235,919
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.fileFieldRow
public function fileFieldRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_FILE, $model, $attribute, null, $htmlOptions); }
php
public function fileFieldRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_FILE, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "fileFieldRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_FILE", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a file field input row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "file", "field", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L134-L137
235,920
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.passwordFieldRow
public function passwordFieldRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_PASSWORD, $model, $attribute, null, $htmlOptions); }
php
public function passwordFieldRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_PASSWORD, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "passwordFieldRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_PASSWORD", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a password field input row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "password", "field", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L146-L149
235,921
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.radioButtonRow
public function radioButtonRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIO, $model, $attribute, null, $htmlOptions); }
php
public function radioButtonRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIO, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "radioButtonRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_RADIO", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a radio button input row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "radio", "button", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L158-L161
235,922
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.radioButtonListRow
public function radioButtonListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIOLIST, $model, $attribute, $data, $htmlOptions); }
php
public function radioButtonListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIOLIST, $model, $attribute, $data, $htmlOptions); }
[ "public", "function", "radioButtonListRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "data", "=", "array", "(", ")", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_RADIOLIST", ",", "$", "model", ",", "$", "attribute", ",", "$", "data", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a radio button list input row. @param CModel $model the data model @param string $attribute the attribute @param array $data the list data @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "radio", "button", "list", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L171-L174
235,923
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.radioButtonListInlineRow
public function radioButtonListInlineRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIOLIST_INLINE, $model, $attribute, $data, $htmlOptions); }
php
public function radioButtonListInlineRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIOLIST_INLINE, $model, $attribute, $data, $htmlOptions); }
[ "public", "function", "radioButtonListInlineRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "data", "=", "array", "(", ")", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_RADIOLIST_INLINE", ",", "$", "model", ",", "$", "attribute", ",", "$", "data", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a radio button list inline input row. @param CModel $model the data model @param string $attribute the attribute @param array $data the list data @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "radio", "button", "list", "inline", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L184-L187
235,924
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.radioButtonGroupsListRow
public function radioButtonGroupsListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIOBUTTONGROUPSLIST, $model, $attribute, $data, $htmlOptions); }
php
public function radioButtonGroupsListRow($model, $attribute, $data = array(), $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_RADIOBUTTONGROUPSLIST, $model, $attribute, $data, $htmlOptions); }
[ "public", "function", "radioButtonGroupsListRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "data", "=", "array", "(", ")", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_RADIOBUTTONGROUPSLIST", ",", "$", "model", ",", "$", "attribute", ",", "$", "data", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a radio button list input row using Button Groups. @param CModel $model the data model @param string $attribute the attribute @param array $data the list data @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "radio", "button", "list", "input", "row", "using", "Button", "Groups", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L197-L200
235,925
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.textFieldRow
public function textFieldRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TEXT, $model, $attribute, null, $htmlOptions); }
php
public function textFieldRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TEXT, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "textFieldRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_TEXT", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a text field input row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "text", "field", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L209-L212
235,926
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.textAreaRow
public function textAreaRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TEXTAREA, $model, $attribute, null, $htmlOptions); }
php
public function textAreaRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TEXTAREA, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "textAreaRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_TEXTAREA", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a text area input row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Renders", "a", "text", "area", "input", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L221-L224
235,927
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.redactorRow
public function redactorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_REDACTOR, $model, $attribute, null, $htmlOptions); }
php
public function redactorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_REDACTOR, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "redactorRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_REDACTOR", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a WYSIWYG redactor editor @param $model @param $attribute @param array $htmlOptions @return string
[ "Renders", "a", "WYSIWYG", "redactor", "editor" ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L233-L236
235,928
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.markdownEditorRow
public function markdownEditorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_MARKDOWNEDITOR, $model, $attribute, null, $htmlOptions); }
php
public function markdownEditorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_MARKDOWNEDITOR, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "markdownEditorRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_MARKDOWNEDITOR", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a WYSIWYG Markdown editor @param $model @param $attribute @param array $htmlOptions @return string
[ "Renders", "a", "WYSIWYG", "Markdown", "editor" ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L245-L248
235,929
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.html5EditorRow
public function html5EditorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_HTML5EDITOR, $model, $attribute, null, $htmlOptions); }
php
public function html5EditorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_HTML5EDITOR, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "html5EditorRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_HTML5EDITOR", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a WYSIWYG bootstrap editor @param $model @param $attribute @param array $htmlOptions @return string
[ "Renders", "a", "WYSIWYG", "bootstrap", "editor" ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L257-L260
235,930
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.ckEditorRow
public function ckEditorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CKEDITOR, $model, $attribute, null, $htmlOptions); }
php
public function ckEditorRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CKEDITOR, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "ckEditorRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_CKEDITOR", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a WYSIWYG ckeditor @param $model @param $attribute @param array $htmlOptions @return string
[ "Renders", "a", "WYSIWYG", "ckeditor" ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L269-L272
235,931
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.captchaRow
public function captchaRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CAPTCHA, $model, $attribute, null, $htmlOptions); }
php
public function captchaRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_CAPTCHA, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "captchaRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_CAPTCHA", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a captcha row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row @since 0.9.3
[ "Renders", "a", "captcha", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L282-L285
235,932
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.uneditableRow
public function uneditableRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_UNEDITABLE, $model, $attribute, null, $htmlOptions); }
php
public function uneditableRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_UNEDITABLE, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "uneditableRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_UNEDITABLE", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders an uneditable text field row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row @since 0.9.5
[ "Renders", "an", "uneditable", "text", "field", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L295-L298
235,933
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.datepickerRow
public function datepickerRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_DATEPICKER, $model, $attribute, null, $htmlOptions); }
php
public function datepickerRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_DATEPICKER, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "datepickerRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_DATEPICKER", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a datepicker field row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes. 'events' and 'options' key specify the events and configuration options of datepicker respectively. @return string the generated row @since 1.0.2 Booster
[ "Renders", "a", "datepicker", "field", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L309-L312
235,934
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.colorpickerRow
public function colorpickerRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_COLORPICKER, $model, $attribute, null, $htmlOptions); }
php
public function colorpickerRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_COLORPICKER, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "colorpickerRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_COLORPICKER", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a colorpicker field row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes. 'events' and 'options' key specify the events and configuration options of colorpicker respectively. @return string the generated row @since 1.0.3 Booster
[ "Renders", "a", "colorpicker", "field", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L323-L326
235,935
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.timepickerRow
public function timepickerRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TIMEPICKER, $model, $attribute, null, $htmlOptions); }
php
public function timepickerRow($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_TIMEPICKER, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "timepickerRow", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_TIMEPICKER", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a timepicker field row. @param CModel $model the data model @param string $attribute the attribute @param array $htmlOptions additional HTML attributes @return string the generated row @since 0.10.0
[ "Renders", "a", "timepicker", "field", "row", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L347-L350
235,936
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.select2Row
public function select2Row($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_SELECT2, $model, $attribute, null, $htmlOptions); }
php
public function select2Row($model, $attribute, $htmlOptions = array()) { return $this->inputRow(CiiInput::TYPE_SELECT2, $model, $attribute, null, $htmlOptions); }
[ "public", "function", "select2Row", "(", "$", "model", ",", "$", "attribute", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "inputRow", "(", "CiiInput", "::", "TYPE_SELECT2", ",", "$", "model", ",", "$", "attribute", ",", "null", ",", "$", "htmlOptions", ")", ";", "}" ]
Renders a select2 field row @param $model @param $attribute @param array $htmlOptions @return string
[ "Renders", "a", "select2", "field", "row" ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L359-L362
235,937
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.radioButtonGroupsList
public function radioButtonGroupsList($model, $attribute, $data, $htmlOptions = array()) { $buttons = array(); $scripts = array(); $hiddenFieldId = CHtml::getIdByName(get_class($model) . '[' . $attribute . ']'); $buttonType = isset($htmlOptions['type']) ? $htmlOptions['type'] : null; foreach ($data as $key => $value) { $btnId = CHtml::getIdByName(get_class($model) . '[' . $attribute . '][' . $key . ']'); $button = array(); $button['label'] = $value; $button['htmlOptions'] = array( 'value' => $key, 'id' => $btnId, 'class' => (isset($model->$attribute) && $model->$attribute == $key ? 'active': ''), ); $buttons[] = $button; // event as ordinary input $scripts[] = "\$('#" . $btnId . "').click(function(){ \$('#" . $hiddenFieldId . "').val('" . $key . "').trigger('change'); });"; } Yii::app()->controller->widget('bootstrap.widgets.CiiButtonGroup', array( 'buttonType' => 'button', 'toggle' => 'radio', 'htmlOptions' => $htmlOptions, 'buttons' => $buttons, 'type' => $buttonType, )); echo $this->hiddenField($model, $attribute); Yii::app()->clientScript->registerScript('radiobuttongrouplist-' . $attribute, implode("\n", $scripts)); }
php
public function radioButtonGroupsList($model, $attribute, $data, $htmlOptions = array()) { $buttons = array(); $scripts = array(); $hiddenFieldId = CHtml::getIdByName(get_class($model) . '[' . $attribute . ']'); $buttonType = isset($htmlOptions['type']) ? $htmlOptions['type'] : null; foreach ($data as $key => $value) { $btnId = CHtml::getIdByName(get_class($model) . '[' . $attribute . '][' . $key . ']'); $button = array(); $button['label'] = $value; $button['htmlOptions'] = array( 'value' => $key, 'id' => $btnId, 'class' => (isset($model->$attribute) && $model->$attribute == $key ? 'active': ''), ); $buttons[] = $button; // event as ordinary input $scripts[] = "\$('#" . $btnId . "').click(function(){ \$('#" . $hiddenFieldId . "').val('" . $key . "').trigger('change'); });"; } Yii::app()->controller->widget('bootstrap.widgets.CiiButtonGroup', array( 'buttonType' => 'button', 'toggle' => 'radio', 'htmlOptions' => $htmlOptions, 'buttons' => $buttons, 'type' => $buttonType, )); echo $this->hiddenField($model, $attribute); Yii::app()->clientScript->registerScript('radiobuttongrouplist-' . $attribute, implode("\n", $scripts)); }
[ "public", "function", "radioButtonGroupsList", "(", "$", "model", ",", "$", "attribute", ",", "$", "data", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "$", "buttons", "=", "array", "(", ")", ";", "$", "scripts", "=", "array", "(", ")", ";", "$", "hiddenFieldId", "=", "CHtml", "::", "getIdByName", "(", "get_class", "(", "$", "model", ")", ".", "'['", ".", "$", "attribute", ".", "']'", ")", ";", "$", "buttonType", "=", "isset", "(", "$", "htmlOptions", "[", "'type'", "]", ")", "?", "$", "htmlOptions", "[", "'type'", "]", ":", "null", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "btnId", "=", "CHtml", "::", "getIdByName", "(", "get_class", "(", "$", "model", ")", ".", "'['", ".", "$", "attribute", ".", "']['", ".", "$", "key", ".", "']'", ")", ";", "$", "button", "=", "array", "(", ")", ";", "$", "button", "[", "'label'", "]", "=", "$", "value", ";", "$", "button", "[", "'htmlOptions'", "]", "=", "array", "(", "'value'", "=>", "$", "key", ",", "'id'", "=>", "$", "btnId", ",", "'class'", "=>", "(", "isset", "(", "$", "model", "->", "$", "attribute", ")", "&&", "$", "model", "->", "$", "attribute", "==", "$", "key", "?", "'active'", ":", "''", ")", ",", ")", ";", "$", "buttons", "[", "]", "=", "$", "button", ";", "// event as ordinary input", "$", "scripts", "[", "]", "=", "\"\\$('#\"", ".", "$", "btnId", ".", "\"').click(function(){\n \\$('#\"", ".", "$", "hiddenFieldId", ".", "\"').val('\"", ".", "$", "key", ".", "\"').trigger('change');\n });\"", ";", "}", "Yii", "::", "app", "(", ")", "->", "controller", "->", "widget", "(", "'bootstrap.widgets.CiiButtonGroup'", ",", "array", "(", "'buttonType'", "=>", "'button'", ",", "'toggle'", "=>", "'radio'", ",", "'htmlOptions'", "=>", "$", "htmlOptions", ",", "'buttons'", "=>", "$", "buttons", ",", "'type'", "=>", "$", "buttonType", ",", ")", ")", ";", "echo", "$", "this", "->", "hiddenField", "(", "$", "model", ",", "$", "attribute", ")", ";", "Yii", "::", "app", "(", ")", "->", "clientScript", "->", "registerScript", "(", "'radiobuttongrouplist-'", ".", "$", "attribute", ",", "implode", "(", "\"\\n\"", ",", "$", "scripts", ")", ")", ";", "}" ]
Renders a radio button list for a model attribute using Button Groups. @param CModel $model the data model @param string $attribute the attribute @param array $data value-label pairs used to generate the radio button list. @param array $htmlOptions additional HTML options. @return string the generated radio button list @since 0.9.5
[ "Renders", "a", "radio", "button", "list", "for", "a", "model", "attribute", "using", "Button", "Groups", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L407-L444
235,938
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.inputRow
public function inputRow($type, $model, $attribute, $data = null, $htmlOptions = array()) { ob_start(); Yii::app()->controller->widget($this->getInputClassName(), array( 'type' => $type, 'form' => $this, 'model' => $model, 'attribute' => $attribute, 'data' => $data, 'htmlOptions' => $htmlOptions, )); return ob_get_clean(); }
php
public function inputRow($type, $model, $attribute, $data = null, $htmlOptions = array()) { ob_start(); Yii::app()->controller->widget($this->getInputClassName(), array( 'type' => $type, 'form' => $this, 'model' => $model, 'attribute' => $attribute, 'data' => $data, 'htmlOptions' => $htmlOptions, )); return ob_get_clean(); }
[ "public", "function", "inputRow", "(", "$", "type", ",", "$", "model", ",", "$", "attribute", ",", "$", "data", "=", "null", ",", "$", "htmlOptions", "=", "array", "(", ")", ")", "{", "ob_start", "(", ")", ";", "Yii", "::", "app", "(", ")", "->", "controller", "->", "widget", "(", "$", "this", "->", "getInputClassName", "(", ")", ",", "array", "(", "'type'", "=>", "$", "type", ",", "'form'", "=>", "$", "this", ",", "'model'", "=>", "$", "model", ",", "'attribute'", "=>", "$", "attribute", ",", "'data'", "=>", "$", "data", ",", "'htmlOptions'", "=>", "$", "htmlOptions", ",", ")", ")", ";", "return", "ob_get_clean", "(", ")", ";", "}" ]
Creates an input row of a specific type. @param string $type the input type @param CModel $model the data model @param string $attribute the attribute @param array $data the data for list inputs @param array $htmlOptions additional HTML attributes @return string the generated row
[ "Creates", "an", "input", "row", "of", "a", "specific", "type", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L671-L683
235,939
ciims/cii
widgets/CiiBaseActiveForm.php
CiiBaseActiveForm.getInputClassName
protected function getInputClassName() { if (isset($this->input)) return $this->input; else { switch ($this->type) { case self::TYPE_HORIZONTAL: return self::INPUT_HORIZONTAL; break; case self::TYPE_INLINE: return self::INPUT_INLINE; break; case self::TYPE_SEARCH: return self::INPUT_SEARCH; break; case self::TYPE_VERTICAL: default: return self::INPUT_VERTICAL; break; } } }
php
protected function getInputClassName() { if (isset($this->input)) return $this->input; else { switch ($this->type) { case self::TYPE_HORIZONTAL: return self::INPUT_HORIZONTAL; break; case self::TYPE_INLINE: return self::INPUT_INLINE; break; case self::TYPE_SEARCH: return self::INPUT_SEARCH; break; case self::TYPE_VERTICAL: default: return self::INPUT_VERTICAL; break; } } }
[ "protected", "function", "getInputClassName", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "input", ")", ")", "return", "$", "this", "->", "input", ";", "else", "{", "switch", "(", "$", "this", "->", "type", ")", "{", "case", "self", "::", "TYPE_HORIZONTAL", ":", "return", "self", "::", "INPUT_HORIZONTAL", ";", "break", ";", "case", "self", "::", "TYPE_INLINE", ":", "return", "self", "::", "INPUT_INLINE", ";", "break", ";", "case", "self", "::", "TYPE_SEARCH", ":", "return", "self", "::", "INPUT_SEARCH", ";", "break", ";", "case", "self", "::", "TYPE_VERTICAL", ":", "default", ":", "return", "self", "::", "INPUT_VERTICAL", ";", "break", ";", "}", "}", "}" ]
Returns the input widget class name suitable for the form. @return string the class name
[ "Returns", "the", "input", "widget", "class", "name", "suitable", "for", "the", "form", "." ]
cc8550b9a3a6a0bf0214554679de8743d50dc9ef
https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/CiiBaseActiveForm.php#L689-L715
235,940
eix/core
src/php/main/Eix/Services/Net/Mail/Message.php
Message.send
public function send() { $settings = Application::getSettings()->mail; $mailTransport = new Transport( @$settings->smtp->host ? : 'localhost', @$settings->smtp->port ? : 25, @$settings->smtp->timeout ? : 15 ); $mailTransport->setUser( @$settings->smtp->user, @$settings->smtp->password ); $mailTransport->addMessage($this); $mailTransport->send(); }
php
public function send() { $settings = Application::getSettings()->mail; $mailTransport = new Transport( @$settings->smtp->host ? : 'localhost', @$settings->smtp->port ? : 25, @$settings->smtp->timeout ? : 15 ); $mailTransport->setUser( @$settings->smtp->user, @$settings->smtp->password ); $mailTransport->addMessage($this); $mailTransport->send(); }
[ "public", "function", "send", "(", ")", "{", "$", "settings", "=", "Application", "::", "getSettings", "(", ")", "->", "mail", ";", "$", "mailTransport", "=", "new", "Transport", "(", "@", "$", "settings", "->", "smtp", "->", "host", "?", ":", "'localhost'", ",", "@", "$", "settings", "->", "smtp", "->", "port", "?", ":", "25", ",", "@", "$", "settings", "->", "smtp", "->", "timeout", "?", ":", "15", ")", ";", "$", "mailTransport", "->", "setUser", "(", "@", "$", "settings", "->", "smtp", "->", "user", ",", "@", "$", "settings", "->", "smtp", "->", "password", ")", ";", "$", "mailTransport", "->", "addMessage", "(", "$", "this", ")", ";", "$", "mailTransport", "->", "send", "(", ")", ";", "}" ]
Sends the current mail message.
[ "Sends", "the", "current", "mail", "message", "." ]
a5b4c09cc168221e85804fdfeb78e519a0415466
https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Net/Mail/Message.php#L180-L197
235,941
nonetallt/jinitialize-core
src/Input/Input.php
Input.walk
private function walk(callable $cb) { foreach($this->values() as $key => $value) { $cb($key, $value); } }
php
private function walk(callable $cb) { foreach($this->values() as $key => $value) { $cb($key, $value); } }
[ "private", "function", "walk", "(", "callable", "$", "cb", ")", "{", "foreach", "(", "$", "this", "->", "values", "(", ")", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "cb", "(", "$", "key", ",", "$", "value", ")", ";", "}", "}" ]
Apply a callback to each input value
[ "Apply", "a", "callback", "to", "each", "input", "value" ]
284fbd72b7c1d6f5f8f265dfe2589c0d99b6a88f
https://github.com/nonetallt/jinitialize-core/blob/284fbd72b7c1d6f5f8f265dfe2589c0d99b6a88f/src/Input/Input.php#L139-L144
235,942
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.setDefaultConfig
protected function setDefaultConfig() { //database prefix $this->config['db.prefix'] = ''; //dynamic sql environment id $this->config['env.id'] = 'default'; //dynamic sql environment class $this->config['env.class'] = 'eMapper\Dynamic\Environment\DynamicSQLEnvironment'; //default relation depth $this->config['depth.current'] = 0; //default relation depth limit $this->config['depth.limit'] = 1; //cache metakey $this->config['cache.metakey'] = '__cache__'; }
php
protected function setDefaultConfig() { //database prefix $this->config['db.prefix'] = ''; //dynamic sql environment id $this->config['env.id'] = 'default'; //dynamic sql environment class $this->config['env.class'] = 'eMapper\Dynamic\Environment\DynamicSQLEnvironment'; //default relation depth $this->config['depth.current'] = 0; //default relation depth limit $this->config['depth.limit'] = 1; //cache metakey $this->config['cache.metakey'] = '__cache__'; }
[ "protected", "function", "setDefaultConfig", "(", ")", "{", "//database prefix", "$", "this", "->", "config", "[", "'db.prefix'", "]", "=", "''", ";", "//dynamic sql environment id", "$", "this", "->", "config", "[", "'env.id'", "]", "=", "'default'", ";", "//dynamic sql environment class", "$", "this", "->", "config", "[", "'env.class'", "]", "=", "'eMapper\\Dynamic\\Environment\\DynamicSQLEnvironment'", ";", "//default relation depth", "$", "this", "->", "config", "[", "'depth.current'", "]", "=", "0", ";", "//default relation depth limit", "$", "this", "->", "config", "[", "'depth.limit'", "]", "=", "1", ";", "//cache metakey", "$", "this", "->", "config", "[", "'cache.metakey'", "]", "=", "'__cache__'", ";", "}" ]
Applies default configuration options
[ "Applies", "default", "configuration", "options" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L84-L102
235,943
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.addType
public function addType($type, TypeHandler $typeHandler, $alias = null) { $this->typeManager->setTypeHandler($type, $typeHandler); if (!is_null($alias)) { if (is_array($alias)) { foreach ($alias as $al) $this->typeManager->addAlias($type, $al); } else $this->typeManager->addAlias($type, $alias); } }
php
public function addType($type, TypeHandler $typeHandler, $alias = null) { $this->typeManager->setTypeHandler($type, $typeHandler); if (!is_null($alias)) { if (is_array($alias)) { foreach ($alias as $al) $this->typeManager->addAlias($type, $al); } else $this->typeManager->addAlias($type, $alias); } }
[ "public", "function", "addType", "(", "$", "type", ",", "TypeHandler", "$", "typeHandler", ",", "$", "alias", "=", "null", ")", "{", "$", "this", "->", "typeManager", "->", "setTypeHandler", "(", "$", "type", ",", "$", "typeHandler", ")", ";", "if", "(", "!", "is_null", "(", "$", "alias", ")", ")", "{", "if", "(", "is_array", "(", "$", "alias", ")", ")", "{", "foreach", "(", "$", "alias", "as", "$", "al", ")", "$", "this", "->", "typeManager", "->", "addAlias", "(", "$", "type", ",", "$", "al", ")", ";", "}", "else", "$", "this", "->", "typeManager", "->", "addAlias", "(", "$", "type", ",", "$", "alias", ")", ";", "}", "}" ]
Adds a new type handler @param string $type @param \eMapper\Type\TypeHandler $typeHandler @param string | array $alias
[ "Adds", "a", "new", "type", "handler" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L189-L200
235,944
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.sql
public function sql($query, $args = []) { if (!is_string($query) || empty($query)) throw new \InvalidArgumentException("Query is not a valid string"); //open connection $this->driver->connect(); //build statement $stmt = $this->driver->buildStatement($this->typeManager); //build query $query = $stmt->format($query, $args, $this->config); //invoke debug callback if ($this->hasOption('callback.debug')) { $callback = $this->getOption('callback.debug'); if ($callback instanceof \Closure) $callback->__invoke($query); } //run query $result = $this->driver->query($query); //check query execution if ($result === false) $this->driver->throwQueryException($stmt); return $result; }
php
public function sql($query, $args = []) { if (!is_string($query) || empty($query)) throw new \InvalidArgumentException("Query is not a valid string"); //open connection $this->driver->connect(); //build statement $stmt = $this->driver->buildStatement($this->typeManager); //build query $query = $stmt->format($query, $args, $this->config); //invoke debug callback if ($this->hasOption('callback.debug')) { $callback = $this->getOption('callback.debug'); if ($callback instanceof \Closure) $callback->__invoke($query); } //run query $result = $this->driver->query($query); //check query execution if ($result === false) $this->driver->throwQueryException($stmt); return $result; }
[ "public", "function", "sql", "(", "$", "query", ",", "$", "args", "=", "[", "]", ")", "{", "if", "(", "!", "is_string", "(", "$", "query", ")", "||", "empty", "(", "$", "query", ")", ")", "throw", "new", "\\", "InvalidArgumentException", "(", "\"Query is not a valid string\"", ")", ";", "//open connection", "$", "this", "->", "driver", "->", "connect", "(", ")", ";", "//build statement", "$", "stmt", "=", "$", "this", "->", "driver", "->", "buildStatement", "(", "$", "this", "->", "typeManager", ")", ";", "//build query", "$", "query", "=", "$", "stmt", "->", "format", "(", "$", "query", ",", "$", "args", ",", "$", "this", "->", "config", ")", ";", "//invoke debug callback", "if", "(", "$", "this", "->", "hasOption", "(", "'callback.debug'", ")", ")", "{", "$", "callback", "=", "$", "this", "->", "getOption", "(", "'callback.debug'", ")", ";", "if", "(", "$", "callback", "instanceof", "\\", "Closure", ")", "$", "callback", "->", "__invoke", "(", "$", "query", ")", ";", "}", "//run query", "$", "result", "=", "$", "this", "->", "driver", "->", "query", "(", "$", "query", ")", ";", "//check query execution", "if", "(", "$", "result", "===", "false", ")", "$", "this", "->", "driver", "->", "throwQueryException", "(", "$", "stmt", ")", ";", "return", "$", "result", ";", "}" ]
Runs a query @param string $query @return mixed
[ "Runs", "a", "query" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L655-L683
235,945
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.query
public function query($query) { $args = func_get_args(); $query = array_shift($args); return $this->execute($query, $args); }
php
public function query($query) { $args = func_get_args(); $query = array_shift($args); return $this->execute($query, $args); }
[ "public", "function", "query", "(", "$", "query", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "$", "query", "=", "array_shift", "(", "$", "args", ")", ";", "return", "$", "this", "->", "execute", "(", "$", "query", ",", "$", "args", ")", ";", "}" ]
Executes a query with the given arguments @param string $query @return mixed
[ "Executes", "a", "query", "with", "the", "given", "arguments" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L690-L694
235,946
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.beginTransaction
public function beginTransaction() { $this->connect(); if ($this->txStatus == self::TX_NOT_STARTED) { $this->txStatus = self::TX_STARTED; $this->txCounter = 1; return $this->driver->begin(); } $this->txCounter++; return false; }
php
public function beginTransaction() { $this->connect(); if ($this->txStatus == self::TX_NOT_STARTED) { $this->txStatus = self::TX_STARTED; $this->txCounter = 1; return $this->driver->begin(); } $this->txCounter++; return false; }
[ "public", "function", "beginTransaction", "(", ")", "{", "$", "this", "->", "connect", "(", ")", ";", "if", "(", "$", "this", "->", "txStatus", "==", "self", "::", "TX_NOT_STARTED", ")", "{", "$", "this", "->", "txStatus", "=", "self", "::", "TX_STARTED", ";", "$", "this", "->", "txCounter", "=", "1", ";", "return", "$", "this", "->", "driver", "->", "begin", "(", ")", ";", "}", "$", "this", "->", "txCounter", "++", ";", "return", "false", ";", "}" ]
Begins a transaction
[ "Begins", "a", "transaction" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L733-L744
235,947
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.commit
public function commit() { if ($this->txStatus == self::TX_STARTED && $this->txCounter == 1) { $this->txStatus = self::TX_NOT_STARTED; $this->txCounter = 0; return $this->driver->commit(); } $this->txCounter--; return false; }
php
public function commit() { if ($this->txStatus == self::TX_STARTED && $this->txCounter == 1) { $this->txStatus = self::TX_NOT_STARTED; $this->txCounter = 0; return $this->driver->commit(); } $this->txCounter--; return false; }
[ "public", "function", "commit", "(", ")", "{", "if", "(", "$", "this", "->", "txStatus", "==", "self", "::", "TX_STARTED", "&&", "$", "this", "->", "txCounter", "==", "1", ")", "{", "$", "this", "->", "txStatus", "=", "self", "::", "TX_NOT_STARTED", ";", "$", "this", "->", "txCounter", "=", "0", ";", "return", "$", "this", "->", "driver", "->", "commit", "(", ")", ";", "}", "$", "this", "->", "txCounter", "--", ";", "return", "false", ";", "}" ]
Commits current transaction
[ "Commits", "current", "transaction" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L749-L758
235,948
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.rollback
public function rollback() { $this->txStatus = self::TX_NOT_STARTED; $this->txCounter = 0; return $this->driver->rollback(); }
php
public function rollback() { $this->txStatus = self::TX_NOT_STARTED; $this->txCounter = 0; return $this->driver->rollback(); }
[ "public", "function", "rollback", "(", ")", "{", "$", "this", "->", "txStatus", "=", "self", "::", "TX_NOT_STARTED", ";", "$", "this", "->", "txCounter", "=", "0", ";", "return", "$", "this", "->", "driver", "->", "rollback", "(", ")", ";", "}" ]
Rollbacks current transaction
[ "Rollbacks", "current", "transaction" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L763-L767
235,949
emaphp/eMapper
lib/eMapper/Mapper.php
Mapper.newManager
public function newManager($classname) { $profile = Profiler::getClassProfile($classname); if (!$profile->isEntity()) throw new \InvalidArgumentException(sprintf("Class %s is not declared as an entity", $profile->reflectionClass->getName())); return new Manager($this, $profile); }
php
public function newManager($classname) { $profile = Profiler::getClassProfile($classname); if (!$profile->isEntity()) throw new \InvalidArgumentException(sprintf("Class %s is not declared as an entity", $profile->reflectionClass->getName())); return new Manager($this, $profile); }
[ "public", "function", "newManager", "(", "$", "classname", ")", "{", "$", "profile", "=", "Profiler", "::", "getClassProfile", "(", "$", "classname", ")", ";", "if", "(", "!", "$", "profile", "->", "isEntity", "(", ")", ")", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "\"Class %s is not declared as an entity\"", ",", "$", "profile", "->", "reflectionClass", "->", "getName", "(", ")", ")", ")", ";", "return", "new", "Manager", "(", "$", "this", ",", "$", "profile", ")", ";", "}" ]
Returns a new Manager instance @param string $classname @throws \InvalidArgumentException @return \eMapper\ORM\Manager
[ "Returns", "a", "new", "Manager", "instance" ]
df7100e601d2a1363d07028a786b6ceb22271829
https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Mapper.php#L805-L810
235,950
SetBased/php-abc-phing
src/Task/OptimizeResourceTask.php
OptimizeResourceTask.main
public function main() { // Get base info about project. $this->prepareProjectData(); // Get all info about source files. $this->getInfoSourceFiles(); // Get all info about resource files. $this->getInfoResourceFiles(); // Prepare all place holders. $this->preparePlaceHolders(); // Replace references to resource files with references to optimized/minimized resource files. $this->processingSourceFiles(); // Compress and rename files with hash. $this->processResourceFiles(); // Create pre-compressed versions of the optimized/minimized resource files. if ($this->gzipFlag) $this->gzipCompressOptimizedResourceFiles(); // Remove original resource files that are optimized/minimized. $this->unlinkResourceFiles(); }
php
public function main() { // Get base info about project. $this->prepareProjectData(); // Get all info about source files. $this->getInfoSourceFiles(); // Get all info about resource files. $this->getInfoResourceFiles(); // Prepare all place holders. $this->preparePlaceHolders(); // Replace references to resource files with references to optimized/minimized resource files. $this->processingSourceFiles(); // Compress and rename files with hash. $this->processResourceFiles(); // Create pre-compressed versions of the optimized/minimized resource files. if ($this->gzipFlag) $this->gzipCompressOptimizedResourceFiles(); // Remove original resource files that are optimized/minimized. $this->unlinkResourceFiles(); }
[ "public", "function", "main", "(", ")", "{", "// Get base info about project.", "$", "this", "->", "prepareProjectData", "(", ")", ";", "// Get all info about source files.", "$", "this", "->", "getInfoSourceFiles", "(", ")", ";", "// Get all info about resource files.", "$", "this", "->", "getInfoResourceFiles", "(", ")", ";", "// Prepare all place holders.", "$", "this", "->", "preparePlaceHolders", "(", ")", ";", "// Replace references to resource files with references to optimized/minimized resource files.", "$", "this", "->", "processingSourceFiles", "(", ")", ";", "// Compress and rename files with hash.", "$", "this", "->", "processResourceFiles", "(", ")", ";", "// Create pre-compressed versions of the optimized/minimized resource files.", "if", "(", "$", "this", "->", "gzipFlag", ")", "$", "this", "->", "gzipCompressOptimizedResourceFiles", "(", ")", ";", "// Remove original resource files that are optimized/minimized.", "$", "this", "->", "unlinkResourceFiles", "(", ")", ";", "}" ]
Main method of this Phing task.
[ "Main", "method", "of", "this", "Phing", "task", "." ]
eb3d337ceafa7c1ae0caa5b70074dfea03d94017
https://github.com/SetBased/php-abc-phing/blob/eb3d337ceafa7c1ae0caa5b70074dfea03d94017/src/Task/OptimizeResourceTask.php#L59-L84
235,951
SetBased/php-abc-phing
src/Task/OptimizeResourceTask.php
OptimizeResourceTask.getClasses
protected function getClasses(string $phpCode): array { $tokens = token_get_all($phpCode); $mode = ''; $namespace = ''; $classes = []; foreach ($tokens as $i => $token) { // If this token is the namespace declaring, then flag that the next tokens will be the namespace name if (is_array($token) && $token[0]==T_NAMESPACE) { $mode = 'namespace'; $namespace = ''; continue; } // If this token is the class declaring, then flag that the next tokens will be the class name if (is_array($token) && in_array($token[0], [T_CLASS, T_INTERFACE, T_TRAIT])) { $mode = 'class'; continue; } // While we're grabbing the namespace name... if ($mode=='namespace') { // If the token is a string or the namespace separator... if (is_array($token) && in_array($token[0], [T_STRING, T_NS_SEPARATOR])) { //Append the token's value to the name of the namespace $namespace .= $token[1]; } elseif (is_array($token) && $token[0]==T_WHITESPACE) { // Ignore whitespace. } elseif ($token===';') { // If the token is the semicolon, then we're done with the namespace declaration $mode = ''; } elseif ($token==='{') { throw new LogicException('Bracketed syntax for namespace not supported.'); } else { throw new LogicException("Unexpected token %s", print_r($token, true)); } } // While we're grabbing the class name... if ($mode=='class') { // If the token is a string, it's the name of the class if (is_array($token) && $token[0]==T_STRING) { // Store the token's value as the class name $classes[$token[2]] = ['namespace' => $namespace, 'class' => $token[1], 'line' => $token[2]]; $mode = ''; } } } return $classes; }
php
protected function getClasses(string $phpCode): array { $tokens = token_get_all($phpCode); $mode = ''; $namespace = ''; $classes = []; foreach ($tokens as $i => $token) { // If this token is the namespace declaring, then flag that the next tokens will be the namespace name if (is_array($token) && $token[0]==T_NAMESPACE) { $mode = 'namespace'; $namespace = ''; continue; } // If this token is the class declaring, then flag that the next tokens will be the class name if (is_array($token) && in_array($token[0], [T_CLASS, T_INTERFACE, T_TRAIT])) { $mode = 'class'; continue; } // While we're grabbing the namespace name... if ($mode=='namespace') { // If the token is a string or the namespace separator... if (is_array($token) && in_array($token[0], [T_STRING, T_NS_SEPARATOR])) { //Append the token's value to the name of the namespace $namespace .= $token[1]; } elseif (is_array($token) && $token[0]==T_WHITESPACE) { // Ignore whitespace. } elseif ($token===';') { // If the token is the semicolon, then we're done with the namespace declaration $mode = ''; } elseif ($token==='{') { throw new LogicException('Bracketed syntax for namespace not supported.'); } else { throw new LogicException("Unexpected token %s", print_r($token, true)); } } // While we're grabbing the class name... if ($mode=='class') { // If the token is a string, it's the name of the class if (is_array($token) && $token[0]==T_STRING) { // Store the token's value as the class name $classes[$token[2]] = ['namespace' => $namespace, 'class' => $token[1], 'line' => $token[2]]; $mode = ''; } } } return $classes; }
[ "protected", "function", "getClasses", "(", "string", "$", "phpCode", ")", ":", "array", "{", "$", "tokens", "=", "token_get_all", "(", "$", "phpCode", ")", ";", "$", "mode", "=", "''", ";", "$", "namespace", "=", "''", ";", "$", "classes", "=", "[", "]", ";", "foreach", "(", "$", "tokens", "as", "$", "i", "=>", "$", "token", ")", "{", "// If this token is the namespace declaring, then flag that the next tokens will be the namespace name", "if", "(", "is_array", "(", "$", "token", ")", "&&", "$", "token", "[", "0", "]", "==", "T_NAMESPACE", ")", "{", "$", "mode", "=", "'namespace'", ";", "$", "namespace", "=", "''", ";", "continue", ";", "}", "// If this token is the class declaring, then flag that the next tokens will be the class name", "if", "(", "is_array", "(", "$", "token", ")", "&&", "in_array", "(", "$", "token", "[", "0", "]", ",", "[", "T_CLASS", ",", "T_INTERFACE", ",", "T_TRAIT", "]", ")", ")", "{", "$", "mode", "=", "'class'", ";", "continue", ";", "}", "// While we're grabbing the namespace name...", "if", "(", "$", "mode", "==", "'namespace'", ")", "{", "// If the token is a string or the namespace separator...", "if", "(", "is_array", "(", "$", "token", ")", "&&", "in_array", "(", "$", "token", "[", "0", "]", ",", "[", "T_STRING", ",", "T_NS_SEPARATOR", "]", ")", ")", "{", "//Append the token's value to the name of the namespace", "$", "namespace", ".=", "$", "token", "[", "1", "]", ";", "}", "elseif", "(", "is_array", "(", "$", "token", ")", "&&", "$", "token", "[", "0", "]", "==", "T_WHITESPACE", ")", "{", "// Ignore whitespace.", "}", "elseif", "(", "$", "token", "===", "';'", ")", "{", "// If the token is the semicolon, then we're done with the namespace declaration", "$", "mode", "=", "''", ";", "}", "elseif", "(", "$", "token", "===", "'{'", ")", "{", "throw", "new", "LogicException", "(", "'Bracketed syntax for namespace not supported.'", ")", ";", "}", "else", "{", "throw", "new", "LogicException", "(", "\"Unexpected token %s\"", ",", "print_r", "(", "$", "token", ",", "true", ")", ")", ";", "}", "}", "// While we're grabbing the class name...", "if", "(", "$", "mode", "==", "'class'", ")", "{", "// If the token is a string, it's the name of the class", "if", "(", "is_array", "(", "$", "token", ")", "&&", "$", "token", "[", "0", "]", "==", "T_STRING", ")", "{", "// Store the token's value as the class name", "$", "classes", "[", "$", "token", "[", "2", "]", "]", "=", "[", "'namespace'", "=>", "$", "namespace", ",", "'class'", "=>", "$", "token", "[", "1", "]", ",", "'line'", "=>", "$", "token", "[", "2", "]", "]", ";", "$", "mode", "=", "''", ";", "}", "}", "}", "return", "$", "classes", ";", "}" ]
Returns an array with classes and namespaces defined in PHP code. @param string $phpCode The PHP code. @return array
[ "Returns", "an", "array", "with", "classes", "and", "namespaces", "defined", "in", "PHP", "code", "." ]
eb3d337ceafa7c1ae0caa5b70074dfea03d94017
https://github.com/SetBased/php-abc-phing/blob/eb3d337ceafa7c1ae0caa5b70074dfea03d94017/src/Task/OptimizeResourceTask.php#L138-L207
235,952
SetBased/php-abc-phing
src/Task/OptimizeResourceTask.php
OptimizeResourceTask.getInfoSourceFiles
private function getInfoSourceFiles(): void { $this->logVerbose('Get resource files info.'); // Get the base dir of the sources. $dir = $this->getProject()->getReference($this->sourcesFilesetId)->getDir($this->getProject()); foreach ($this->sourceFileNames as $theFileName) { $filename = $dir.'/'.$theFileName; $real_path = realpath($filename); $this->sourceFilesInfo[$real_path] = $filename; } $suc = ksort($this->sourceFilesInfo); if ($suc===false) $this->logError("ksort failed."); }
php
private function getInfoSourceFiles(): void { $this->logVerbose('Get resource files info.'); // Get the base dir of the sources. $dir = $this->getProject()->getReference($this->sourcesFilesetId)->getDir($this->getProject()); foreach ($this->sourceFileNames as $theFileName) { $filename = $dir.'/'.$theFileName; $real_path = realpath($filename); $this->sourceFilesInfo[$real_path] = $filename; } $suc = ksort($this->sourceFilesInfo); if ($suc===false) $this->logError("ksort failed."); }
[ "private", "function", "getInfoSourceFiles", "(", ")", ":", "void", "{", "$", "this", "->", "logVerbose", "(", "'Get resource files info.'", ")", ";", "// Get the base dir of the sources.", "$", "dir", "=", "$", "this", "->", "getProject", "(", ")", "->", "getReference", "(", "$", "this", "->", "sourcesFilesetId", ")", "->", "getDir", "(", "$", "this", "->", "getProject", "(", ")", ")", ";", "foreach", "(", "$", "this", "->", "sourceFileNames", "as", "$", "theFileName", ")", "{", "$", "filename", "=", "$", "dir", ".", "'/'", ".", "$", "theFileName", ";", "$", "real_path", "=", "realpath", "(", "$", "filename", ")", ";", "$", "this", "->", "sourceFilesInfo", "[", "$", "real_path", "]", "=", "$", "filename", ";", "}", "$", "suc", "=", "ksort", "(", "$", "this", "->", "sourceFilesInfo", ")", ";", "if", "(", "$", "suc", "===", "false", ")", "$", "this", "->", "logError", "(", "\"ksort failed.\"", ")", ";", "}" ]
Gets full path for each source file in the source fileset.
[ "Gets", "full", "path", "for", "each", "source", "file", "in", "the", "source", "fileset", "." ]
eb3d337ceafa7c1ae0caa5b70074dfea03d94017
https://github.com/SetBased/php-abc-phing/blob/eb3d337ceafa7c1ae0caa5b70074dfea03d94017/src/Task/OptimizeResourceTask.php#L336-L352
235,953
SetBased/php-abc-phing
src/Task/OptimizeResourceTask.php
OptimizeResourceTask.getResourceFilesInSource
private function getResourceFilesInSource(string $sourceFileContent): array { $resource_files = []; foreach ($this->getResourcesInfo() as $file_info) { if (strpos($sourceFileContent, $file_info['path_name_in_sources_with_hash'])!==false) { $resource_files[] = $file_info; } } return $resource_files; }
php
private function getResourceFilesInSource(string $sourceFileContent): array { $resource_files = []; foreach ($this->getResourcesInfo() as $file_info) { if (strpos($sourceFileContent, $file_info['path_name_in_sources_with_hash'])!==false) { $resource_files[] = $file_info; } } return $resource_files; }
[ "private", "function", "getResourceFilesInSource", "(", "string", "$", "sourceFileContent", ")", ":", "array", "{", "$", "resource_files", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getResourcesInfo", "(", ")", "as", "$", "file_info", ")", "{", "if", "(", "strpos", "(", "$", "sourceFileContent", ",", "$", "file_info", "[", "'path_name_in_sources_with_hash'", "]", ")", "!==", "false", ")", "{", "$", "resource_files", "[", "]", "=", "$", "file_info", ";", "}", "}", "return", "$", "resource_files", ";", "}" ]
Returns an array with info about resource files referenced from a source file. @param string $sourceFileContent Content of updated source file. @return array
[ "Returns", "an", "array", "with", "info", "about", "resource", "files", "referenced", "from", "a", "source", "file", "." ]
eb3d337ceafa7c1ae0caa5b70074dfea03d94017
https://github.com/SetBased/php-abc-phing/blob/eb3d337ceafa7c1ae0caa5b70074dfea03d94017/src/Task/OptimizeResourceTask.php#L391-L403
235,954
samurai-fw/samurai
src/Samurai/Component/Cache/ArrayCache.php
ArrayCache.cache
public function cache($key, $value, $expire = null) { $this->_caches[$key] = $value; return true; }
php
public function cache($key, $value, $expire = null) { $this->_caches[$key] = $value; return true; }
[ "public", "function", "cache", "(", "$", "key", ",", "$", "value", ",", "$", "expire", "=", "null", ")", "{", "$", "this", "->", "_caches", "[", "$", "key", "]", "=", "$", "value", ";", "return", "true", ";", "}" ]
expire not supported. {@inheritdoc}
[ "expire", "not", "supported", "." ]
7ca3847b13f86e2847a17ab5e8e4e20893021d5a
https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Samurai/Component/Cache/ArrayCache.php#L57-L61
235,955
nattreid/gallery
src/Control/Gallery.php
Gallery.handleDeleteAllImages
public function handleDeleteAllImages(): void { if ($this->request->isAjax()) { $result = $this->getStorage()->delete(); foreach ($result as $row) { $this->imageStorage->delete($row); } $this->redrawControl('gallery'); } else { throw new AbortException; } }
php
public function handleDeleteAllImages(): void { if ($this->request->isAjax()) { $result = $this->getStorage()->delete(); foreach ($result as $row) { $this->imageStorage->delete($row); } $this->redrawControl('gallery'); } else { throw new AbortException; } }
[ "public", "function", "handleDeleteAllImages", "(", ")", ":", "void", "{", "if", "(", "$", "this", "->", "request", "->", "isAjax", "(", ")", ")", "{", "$", "result", "=", "$", "this", "->", "getStorage", "(", ")", "->", "delete", "(", ")", ";", "foreach", "(", "$", "result", "as", "$", "row", ")", "{", "$", "this", "->", "imageStorage", "->", "delete", "(", "$", "row", ")", ";", "}", "$", "this", "->", "redrawControl", "(", "'gallery'", ")", ";", "}", "else", "{", "throw", "new", "AbortException", ";", "}", "}" ]
Smaze vsechny obrazky z modelu @secured @throws AbortException
[ "Smaze", "vsechny", "obrazky", "z", "modelu" ]
1f2a222ab157f7184ffdd623aa12eee98cad0cdb
https://github.com/nattreid/gallery/blob/1f2a222ab157f7184ffdd623aa12eee98cad0cdb/src/Control/Gallery.php#L140-L152
235,956
nattreid/gallery
src/Control/Gallery.php
Gallery.handleDeleteImages
public function handleDeleteImages(string $json): void { if ($this->request->isAjax()) { $data = Json::decode($json); $result = $this->getStorage()->delete($data); foreach ($result as $row) { $this->imageStorage->delete($row); } $this->redrawControl('gallery'); } else { throw new AbortException; } }
php
public function handleDeleteImages(string $json): void { if ($this->request->isAjax()) { $data = Json::decode($json); $result = $this->getStorage()->delete($data); foreach ($result as $row) { $this->imageStorage->delete($row); } $this->redrawControl('gallery'); } else { throw new AbortException; } }
[ "public", "function", "handleDeleteImages", "(", "string", "$", "json", ")", ":", "void", "{", "if", "(", "$", "this", "->", "request", "->", "isAjax", "(", ")", ")", "{", "$", "data", "=", "Json", "::", "decode", "(", "$", "json", ")", ";", "$", "result", "=", "$", "this", "->", "getStorage", "(", ")", "->", "delete", "(", "$", "data", ")", ";", "foreach", "(", "$", "result", "as", "$", "row", ")", "{", "$", "this", "->", "imageStorage", "->", "delete", "(", "$", "row", ")", ";", "}", "$", "this", "->", "redrawControl", "(", "'gallery'", ")", ";", "}", "else", "{", "throw", "new", "AbortException", ";", "}", "}" ]
Smaze vybrane obrazky @param string $json @secured @throws \Nette\Utils\JsonException @throws AbortException
[ "Smaze", "vybrane", "obrazky" ]
1f2a222ab157f7184ffdd623aa12eee98cad0cdb
https://github.com/nattreid/gallery/blob/1f2a222ab157f7184ffdd623aa12eee98cad0cdb/src/Control/Gallery.php#L161-L175
235,957
nattreid/gallery
src/Control/Gallery.php
Gallery.handleNextImage
public function handleNextImage(int $id): void { if ($this->request->isAjax()) { $row = $this->getStorage()->getNext($id); if ($row) { $this->template->viewImage = $row; $this->redrawControl('image'); } else { throw new AbortException; } } else { throw new AbortException; } }
php
public function handleNextImage(int $id): void { if ($this->request->isAjax()) { $row = $this->getStorage()->getNext($id); if ($row) { $this->template->viewImage = $row; $this->redrawControl('image'); } else { throw new AbortException; } } else { throw new AbortException; } }
[ "public", "function", "handleNextImage", "(", "int", "$", "id", ")", ":", "void", "{", "if", "(", "$", "this", "->", "request", "->", "isAjax", "(", ")", ")", "{", "$", "row", "=", "$", "this", "->", "getStorage", "(", ")", "->", "getNext", "(", "$", "id", ")", ";", "if", "(", "$", "row", ")", "{", "$", "this", "->", "template", "->", "viewImage", "=", "$", "row", ";", "$", "this", "->", "redrawControl", "(", "'image'", ")", ";", "}", "else", "{", "throw", "new", "AbortException", ";", "}", "}", "else", "{", "throw", "new", "AbortException", ";", "}", "}" ]
Zobrazi dalsi obrazek @param int $id @secured @throws AbortException
[ "Zobrazi", "dalsi", "obrazek" ]
1f2a222ab157f7184ffdd623aa12eee98cad0cdb
https://github.com/nattreid/gallery/blob/1f2a222ab157f7184ffdd623aa12eee98cad0cdb/src/Control/Gallery.php#L218-L231
235,958
nattreid/gallery
src/Control/Gallery.php
Gallery.handlePreviousImage
public function handlePreviousImage(int $id): void { if ($this->request->isAjax()) { $row = $this->getStorage()->getPrevious($id); if ($row) { $this->template->viewImage = $row; $this->redrawControl('image'); } else { throw new AbortException; } } else { throw new AbortException; } }
php
public function handlePreviousImage(int $id): void { if ($this->request->isAjax()) { $row = $this->getStorage()->getPrevious($id); if ($row) { $this->template->viewImage = $row; $this->redrawControl('image'); } else { throw new AbortException; } } else { throw new AbortException; } }
[ "public", "function", "handlePreviousImage", "(", "int", "$", "id", ")", ":", "void", "{", "if", "(", "$", "this", "->", "request", "->", "isAjax", "(", ")", ")", "{", "$", "row", "=", "$", "this", "->", "getStorage", "(", ")", "->", "getPrevious", "(", "$", "id", ")", ";", "if", "(", "$", "row", ")", "{", "$", "this", "->", "template", "->", "viewImage", "=", "$", "row", ";", "$", "this", "->", "redrawControl", "(", "'image'", ")", ";", "}", "else", "{", "throw", "new", "AbortException", ";", "}", "}", "else", "{", "throw", "new", "AbortException", ";", "}", "}" ]
Zobrazi predchozi obrazek @param int $id @secured @throws AbortException
[ "Zobrazi", "predchozi", "obrazek" ]
1f2a222ab157f7184ffdd623aa12eee98cad0cdb
https://github.com/nattreid/gallery/blob/1f2a222ab157f7184ffdd623aa12eee98cad0cdb/src/Control/Gallery.php#L239-L252
235,959
nattreid/gallery
src/Control/Gallery.php
Gallery.handleUpdatePosition
public function handleUpdatePosition(string $json): void { if ($this->request->isAjax()) { $data = Json::decode($json); $this->getStorage()->updatePosition($data); } throw new AbortException; }
php
public function handleUpdatePosition(string $json): void { if ($this->request->isAjax()) { $data = Json::decode($json); $this->getStorage()->updatePosition($data); } throw new AbortException; }
[ "public", "function", "handleUpdatePosition", "(", "string", "$", "json", ")", ":", "void", "{", "if", "(", "$", "this", "->", "request", "->", "isAjax", "(", ")", ")", "{", "$", "data", "=", "Json", "::", "decode", "(", "$", "json", ")", ";", "$", "this", "->", "getStorage", "(", ")", "->", "updatePosition", "(", "$", "data", ")", ";", "}", "throw", "new", "AbortException", ";", "}" ]
Aktualizuje poradi obrazku @param string $json @secured @throws \Nette\Utils\JsonException @throws AbortException
[ "Aktualizuje", "poradi", "obrazku" ]
1f2a222ab157f7184ffdd623aa12eee98cad0cdb
https://github.com/nattreid/gallery/blob/1f2a222ab157f7184ffdd623aa12eee98cad0cdb/src/Control/Gallery.php#L261-L268
235,960
nattreid/gallery
src/Control/Gallery.php
Gallery.setForeignKey
public function setForeignKey(string $keyName, int $value): void { if ($this->storage instanceof NetteDatabaseStorage) { $this->storage->setForeignKey($keyName, $value); } elseif ($this->storage instanceof NextrasOrmStorage) { $this->storage->setForeignKey($keyName, $value); } else { throw new InvalidArgumentException('Storage is not database'); } }
php
public function setForeignKey(string $keyName, int $value): void { if ($this->storage instanceof NetteDatabaseStorage) { $this->storage->setForeignKey($keyName, $value); } elseif ($this->storage instanceof NextrasOrmStorage) { $this->storage->setForeignKey($keyName, $value); } else { throw new InvalidArgumentException('Storage is not database'); } }
[ "public", "function", "setForeignKey", "(", "string", "$", "keyName", ",", "int", "$", "value", ")", ":", "void", "{", "if", "(", "$", "this", "->", "storage", "instanceof", "NetteDatabaseStorage", ")", "{", "$", "this", "->", "storage", "->", "setForeignKey", "(", "$", "keyName", ",", "$", "value", ")", ";", "}", "elseif", "(", "$", "this", "->", "storage", "instanceof", "NextrasOrmStorage", ")", "{", "$", "this", "->", "storage", "->", "setForeignKey", "(", "$", "keyName", ",", "$", "value", ")", ";", "}", "else", "{", "throw", "new", "InvalidArgumentException", "(", "'Storage is not database'", ")", ";", "}", "}" ]
Nastavi cizi klic @param string $keyName @param int $value
[ "Nastavi", "cizi", "klic" ]
1f2a222ab157f7184ffdd623aa12eee98cad0cdb
https://github.com/nattreid/gallery/blob/1f2a222ab157f7184ffdd623aa12eee98cad0cdb/src/Control/Gallery.php#L292-L301
235,961
gorriecoe/silverstripe-htmltag
src/view/HTMLTag.php
HTMLTag.addAttribute
public function addAttribute($name = null, $value) { if ($value) { $this->attributes[$name] = $value; } return $this; }
php
public function addAttribute($name = null, $value) { if ($value) { $this->attributes[$name] = $value; } return $this; }
[ "public", "function", "addAttribute", "(", "$", "name", "=", "null", ",", "$", "value", ")", "{", "if", "(", "$", "value", ")", "{", "$", "this", "->", "attributes", "[", "$", "name", "]", "=", "$", "value", ";", "}", "return", "$", "this", ";", "}" ]
Defines an HTML attribute to add @param string $name Attribute name @param string $value Attribute value @return HTMLTag $this
[ "Defines", "an", "HTML", "attribute", "to", "add" ]
53a0e075977e7c56af0046b8c91406f417b7aad1
https://github.com/gorriecoe/silverstripe-htmltag/blob/53a0e075977e7c56af0046b8c91406f417b7aad1/src/view/HTMLTag.php#L89-L95
235,962
gorriecoe/silverstripe-htmltag
src/view/HTMLTag.php
HTMLTag.setClass
public function setClass($value) { $classes = []; foreach (explode(' ', $value) as $class) { $classes[$class] = $class; } $this->classes = $classes; return $this; }
php
public function setClass($value) { $classes = []; foreach (explode(' ', $value) as $class) { $classes[$class] = $class; } $this->classes = $classes; return $this; }
[ "public", "function", "setClass", "(", "$", "value", ")", "{", "$", "classes", "=", "[", "]", ";", "foreach", "(", "explode", "(", "' '", ",", "$", "value", ")", "as", "$", "class", ")", "{", "$", "classes", "[", "$", "class", "]", "=", "$", "class", ";", "}", "$", "this", "->", "classes", "=", "$", "classes", ";", "return", "$", "this", ";", "}" ]
Defines CSS classes @param string $value CSS class @return HTMLTag $this
[ "Defines", "CSS", "classes" ]
53a0e075977e7c56af0046b8c91406f417b7aad1
https://github.com/gorriecoe/silverstripe-htmltag/blob/53a0e075977e7c56af0046b8c91406f417b7aad1/src/view/HTMLTag.php#L133-L141
235,963
gorriecoe/silverstripe-htmltag
src/view/HTMLTag.php
HTMLTag.Render
public function Render() { $string = $this->string; $tag = $this->tag; $classes = $this->classes; if (Count($classes)) { if ($classPrefix = $this->classPrefix) { foreach ($classes as $key => $value) { $prefixedClass = $classPrefix . '__' . $value; $classes[$prefixedClass] = $prefixedClass; } } $this->addAttribute('class', implode(' ', $classes)); } if ($this->isVoidElement() && $string) { if ($voidAttributeName = $this->VoidElements[$tag]) { $this->addAttribute($voidAttributeName, $string); } else { throw new InvalidArgumentException("Void element \"{$tag}\" cannot have string"); } } $attributes = []; foreach ($this->attributes as $name => $value) { $attributes[] = sprintf( '%s="%s"', $name, Convert::raw2att($value) ); } $attributes = Count($attributes) ? ' ' . implode(' ', $attributes) : ''; if ($this->isVoidElement()) { return "<{$tag}{$attributes} />"; } if (!isset($string) || !$string || $string == '') { return null; } return "<{$tag}{$attributes}>{$string}</{$tag}>"; }
php
public function Render() { $string = $this->string; $tag = $this->tag; $classes = $this->classes; if (Count($classes)) { if ($classPrefix = $this->classPrefix) { foreach ($classes as $key => $value) { $prefixedClass = $classPrefix . '__' . $value; $classes[$prefixedClass] = $prefixedClass; } } $this->addAttribute('class', implode(' ', $classes)); } if ($this->isVoidElement() && $string) { if ($voidAttributeName = $this->VoidElements[$tag]) { $this->addAttribute($voidAttributeName, $string); } else { throw new InvalidArgumentException("Void element \"{$tag}\" cannot have string"); } } $attributes = []; foreach ($this->attributes as $name => $value) { $attributes[] = sprintf( '%s="%s"', $name, Convert::raw2att($value) ); } $attributes = Count($attributes) ? ' ' . implode(' ', $attributes) : ''; if ($this->isVoidElement()) { return "<{$tag}{$attributes} />"; } if (!isset($string) || !$string || $string == '') { return null; } return "<{$tag}{$attributes}>{$string}</{$tag}>"; }
[ "public", "function", "Render", "(", ")", "{", "$", "string", "=", "$", "this", "->", "string", ";", "$", "tag", "=", "$", "this", "->", "tag", ";", "$", "classes", "=", "$", "this", "->", "classes", ";", "if", "(", "Count", "(", "$", "classes", ")", ")", "{", "if", "(", "$", "classPrefix", "=", "$", "this", "->", "classPrefix", ")", "{", "foreach", "(", "$", "classes", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "prefixedClass", "=", "$", "classPrefix", ".", "'__'", ".", "$", "value", ";", "$", "classes", "[", "$", "prefixedClass", "]", "=", "$", "prefixedClass", ";", "}", "}", "$", "this", "->", "addAttribute", "(", "'class'", ",", "implode", "(", "' '", ",", "$", "classes", ")", ")", ";", "}", "if", "(", "$", "this", "->", "isVoidElement", "(", ")", "&&", "$", "string", ")", "{", "if", "(", "$", "voidAttributeName", "=", "$", "this", "->", "VoidElements", "[", "$", "tag", "]", ")", "{", "$", "this", "->", "addAttribute", "(", "$", "voidAttributeName", ",", "$", "string", ")", ";", "}", "else", "{", "throw", "new", "InvalidArgumentException", "(", "\"Void element \\\"{$tag}\\\" cannot have string\"", ")", ";", "}", "}", "$", "attributes", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "attributes", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "attributes", "[", "]", "=", "sprintf", "(", "'%s=\"%s\"'", ",", "$", "name", ",", "Convert", "::", "raw2att", "(", "$", "value", ")", ")", ";", "}", "$", "attributes", "=", "Count", "(", "$", "attributes", ")", "?", "' '", ".", "implode", "(", "' '", ",", "$", "attributes", ")", ":", "''", ";", "if", "(", "$", "this", "->", "isVoidElement", "(", ")", ")", "{", "return", "\"<{$tag}{$attributes} />\"", ";", "}", "if", "(", "!", "isset", "(", "$", "string", ")", "||", "!", "$", "string", "||", "$", "string", "==", "''", ")", "{", "return", "null", ";", "}", "return", "\"<{$tag}{$attributes}>{$string}</{$tag}>\"", ";", "}" ]
Returns the rendered html markup @return string
[ "Returns", "the", "rendered", "html", "markup" ]
53a0e075977e7c56af0046b8c91406f417b7aad1
https://github.com/gorriecoe/silverstripe-htmltag/blob/53a0e075977e7c56af0046b8c91406f417b7aad1/src/view/HTMLTag.php#L205-L248
235,964
jaredtking/jaqb
src/ConnectionManager.php
ConnectionManager.get
public function get($id) { if (isset($this->connections[$id])) { return $this->connections[$id]; } if (!isset($this->config[$id])) { throw new JAQBException('No configuration or connection has been supplied for the ID "'.$id.'".'); } $this->connections[$id] = $this->buildFromConfig($this->config[$id], $id); return $this->connections[$id]; }
php
public function get($id) { if (isset($this->connections[$id])) { return $this->connections[$id]; } if (!isset($this->config[$id])) { throw new JAQBException('No configuration or connection has been supplied for the ID "'.$id.'".'); } $this->connections[$id] = $this->buildFromConfig($this->config[$id], $id); return $this->connections[$id]; }
[ "public", "function", "get", "(", "$", "id", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "connections", "[", "$", "id", "]", ")", ")", "{", "return", "$", "this", "->", "connections", "[", "$", "id", "]", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "config", "[", "$", "id", "]", ")", ")", "{", "throw", "new", "JAQBException", "(", "'No configuration or connection has been supplied for the ID \"'", ".", "$", "id", ".", "'\".'", ")", ";", "}", "$", "this", "->", "connections", "[", "$", "id", "]", "=", "$", "this", "->", "buildFromConfig", "(", "$", "this", "->", "config", "[", "$", "id", "]", ",", "$", "id", ")", ";", "return", "$", "this", "->", "connections", "[", "$", "id", "]", ";", "}" ]
Gets a database connection by ID. @param string $id @throws JAQBException if the connection does not exist @return QueryBuilder
[ "Gets", "a", "database", "connection", "by", "ID", "." ]
04a853b530fcc12a9863349d3d0da6377d1b9995
https://github.com/jaredtking/jaqb/blob/04a853b530fcc12a9863349d3d0da6377d1b9995/src/ConnectionManager.php#L65-L78
235,965
jaredtking/jaqb
src/ConnectionManager.php
ConnectionManager.getDefault
public function getDefault() { // get the memoized default if ($this->default) { return $this->get($this->default); } // no configurations available // check for existing connections if (0 === count($this->config)) { if (1 === count($this->connections)) { $this->default = array_keys($this->connections)[0]; return $this->get($this->default); } elseif (count($this->connections) > 1) { throw new JAQBException('Could not determine the default connection because multiple connections were available and the default has not been set.'); } throw new JAQBException('The default connection is not available because no configurations have been supplied.'); } // handle the case where there is a single configuration if (1 === count($this->config)) { $this->default = array_keys($this->config)[0]; return $this->get($this->default); } // handle multiple configurations foreach ($this->config as $k => $v) { if (array_value($v, 'default')) { $this->default = $k; return $this->get($this->default); } } throw new JAQBException('There is no default connection.'); }
php
public function getDefault() { // get the memoized default if ($this->default) { return $this->get($this->default); } // no configurations available // check for existing connections if (0 === count($this->config)) { if (1 === count($this->connections)) { $this->default = array_keys($this->connections)[0]; return $this->get($this->default); } elseif (count($this->connections) > 1) { throw new JAQBException('Could not determine the default connection because multiple connections were available and the default has not been set.'); } throw new JAQBException('The default connection is not available because no configurations have been supplied.'); } // handle the case where there is a single configuration if (1 === count($this->config)) { $this->default = array_keys($this->config)[0]; return $this->get($this->default); } // handle multiple configurations foreach ($this->config as $k => $v) { if (array_value($v, 'default')) { $this->default = $k; return $this->get($this->default); } } throw new JAQBException('There is no default connection.'); }
[ "public", "function", "getDefault", "(", ")", "{", "// get the memoized default", "if", "(", "$", "this", "->", "default", ")", "{", "return", "$", "this", "->", "get", "(", "$", "this", "->", "default", ")", ";", "}", "// no configurations available", "// check for existing connections", "if", "(", "0", "===", "count", "(", "$", "this", "->", "config", ")", ")", "{", "if", "(", "1", "===", "count", "(", "$", "this", "->", "connections", ")", ")", "{", "$", "this", "->", "default", "=", "array_keys", "(", "$", "this", "->", "connections", ")", "[", "0", "]", ";", "return", "$", "this", "->", "get", "(", "$", "this", "->", "default", ")", ";", "}", "elseif", "(", "count", "(", "$", "this", "->", "connections", ")", ">", "1", ")", "{", "throw", "new", "JAQBException", "(", "'Could not determine the default connection because multiple connections were available and the default has not been set.'", ")", ";", "}", "throw", "new", "JAQBException", "(", "'The default connection is not available because no configurations have been supplied.'", ")", ";", "}", "// handle the case where there is a single configuration", "if", "(", "1", "===", "count", "(", "$", "this", "->", "config", ")", ")", "{", "$", "this", "->", "default", "=", "array_keys", "(", "$", "this", "->", "config", ")", "[", "0", "]", ";", "return", "$", "this", "->", "get", "(", "$", "this", "->", "default", ")", ";", "}", "// handle multiple configurations", "foreach", "(", "$", "this", "->", "config", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "array_value", "(", "$", "v", ",", "'default'", ")", ")", "{", "$", "this", "->", "default", "=", "$", "k", ";", "return", "$", "this", "->", "get", "(", "$", "this", "->", "default", ")", ";", "}", "}", "throw", "new", "JAQBException", "(", "'There is no default connection.'", ")", ";", "}" ]
Gets the default database connection. @throws JAQBException if there is not a default connection @return QueryBuilder
[ "Gets", "the", "default", "database", "connection", "." ]
04a853b530fcc12a9863349d3d0da6377d1b9995
https://github.com/jaredtking/jaqb/blob/04a853b530fcc12a9863349d3d0da6377d1b9995/src/ConnectionManager.php#L87-L125
235,966
jaredtking/jaqb
src/ConnectionManager.php
ConnectionManager.add
public function add($id, QueryBuilder $connection) { if (isset($this->connections[$id])) { throw new InvalidArgumentException('A connection with the ID "'.$id.'" already exists.'); } $this->connections[$id] = $connection; $this->default = false; return $this; }
php
public function add($id, QueryBuilder $connection) { if (isset($this->connections[$id])) { throw new InvalidArgumentException('A connection with the ID "'.$id.'" already exists.'); } $this->connections[$id] = $connection; $this->default = false; return $this; }
[ "public", "function", "add", "(", "$", "id", ",", "QueryBuilder", "$", "connection", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "connections", "[", "$", "id", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'A connection with the ID \"'", ".", "$", "id", ".", "'\" already exists.'", ")", ";", "}", "$", "this", "->", "connections", "[", "$", "id", "]", "=", "$", "connection", ";", "$", "this", "->", "default", "=", "false", ";", "return", "$", "this", ";", "}" ]
Adds a connection. @param string $id @param QueryBuilder $connection @throws InvalidArgumentException if a connection with the given ID already exists @return $this
[ "Adds", "a", "connection", "." ]
04a853b530fcc12a9863349d3d0da6377d1b9995
https://github.com/jaredtking/jaqb/blob/04a853b530fcc12a9863349d3d0da6377d1b9995/src/ConnectionManager.php#L137-L147
235,967
jaredtking/jaqb
src/ConnectionManager.php
ConnectionManager.buildDsn
public function buildDsn(array $config, $id) { if (!isset($config['type'])) { throw new JAQBException('Missing connection type for configuration "'.$id.'"!'); } $dsn = $config['type'].':'; $params = []; foreach (self::$connectionParams as $j => $k) { if (isset($config[$j])) { $params[] = $k.'='.$config[$j]; } } $dsn .= implode(';', $params); return $dsn; }
php
public function buildDsn(array $config, $id) { if (!isset($config['type'])) { throw new JAQBException('Missing connection type for configuration "'.$id.'"!'); } $dsn = $config['type'].':'; $params = []; foreach (self::$connectionParams as $j => $k) { if (isset($config[$j])) { $params[] = $k.'='.$config[$j]; } } $dsn .= implode(';', $params); return $dsn; }
[ "public", "function", "buildDsn", "(", "array", "$", "config", ",", "$", "id", ")", "{", "if", "(", "!", "isset", "(", "$", "config", "[", "'type'", "]", ")", ")", "{", "throw", "new", "JAQBException", "(", "'Missing connection type for configuration \"'", ".", "$", "id", ".", "'\"!'", ")", ";", "}", "$", "dsn", "=", "$", "config", "[", "'type'", "]", ".", "':'", ";", "$", "params", "=", "[", "]", ";", "foreach", "(", "self", "::", "$", "connectionParams", "as", "$", "j", "=>", "$", "k", ")", "{", "if", "(", "isset", "(", "$", "config", "[", "$", "j", "]", ")", ")", "{", "$", "params", "[", "]", "=", "$", "k", ".", "'='", ".", "$", "config", "[", "$", "j", "]", ";", "}", "}", "$", "dsn", ".=", "implode", "(", "';'", ",", "$", "params", ")", ";", "return", "$", "dsn", ";", "}" ]
Builds a PDO DSN string from a JAQB connection configuration. @param array $config @param string $id configuration ID @throws JAQBException if the configuration is invalid @return string
[ "Builds", "a", "PDO", "DSN", "string", "from", "a", "JAQB", "connection", "configuration", "." ]
04a853b530fcc12a9863349d3d0da6377d1b9995
https://github.com/jaredtking/jaqb/blob/04a853b530fcc12a9863349d3d0da6377d1b9995/src/ConnectionManager.php#L188-L204
235,968
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.initializeUserSession
public function initializeUserSession(WebRequest $request, Response $response, User $user) { // If the session already has user data ... if ($request->getSessionData('userUuid') !== false) { $sessionToken = $request->getSessionData('userSessionToken'); $sessionTokenLifetime = $request->getSessionData('userSessionTokenLifetime'); // Cleanup the session $this->cleanupSession($request); // Save the old session token for some requests in the next 60 seconds if ($sessionToken !== false) { $request->setSessionData('oldUserSessionToken', $sessionToken); $request->setSessionData('oldUserSessionTokenLifetime', $sessionTokenLifetime); } } // Regenerate the session $this->regenerateSession($request); $sessionToken = md5($user->getUuid()) . '-' . md5(uniqid()); $sessionTokenLifeTime = time() + 300; $request->setSessionData('userUuid', $user->getUuid()); $request->setSessionData('userSessionToken', $sessionToken); $request->setSessionData('userSessionTokenLifetime', $sessionTokenLifeTime); setcookie($sessionToken, $sessionTokenLifeTime, 0, '/', '', $request->isSsl()); }
php
public function initializeUserSession(WebRequest $request, Response $response, User $user) { // If the session already has user data ... if ($request->getSessionData('userUuid') !== false) { $sessionToken = $request->getSessionData('userSessionToken'); $sessionTokenLifetime = $request->getSessionData('userSessionTokenLifetime'); // Cleanup the session $this->cleanupSession($request); // Save the old session token for some requests in the next 60 seconds if ($sessionToken !== false) { $request->setSessionData('oldUserSessionToken', $sessionToken); $request->setSessionData('oldUserSessionTokenLifetime', $sessionTokenLifetime); } } // Regenerate the session $this->regenerateSession($request); $sessionToken = md5($user->getUuid()) . '-' . md5(uniqid()); $sessionTokenLifeTime = time() + 300; $request->setSessionData('userUuid', $user->getUuid()); $request->setSessionData('userSessionToken', $sessionToken); $request->setSessionData('userSessionTokenLifetime', $sessionTokenLifeTime); setcookie($sessionToken, $sessionTokenLifeTime, 0, '/', '', $request->isSsl()); }
[ "public", "function", "initializeUserSession", "(", "WebRequest", "$", "request", ",", "Response", "$", "response", ",", "User", "$", "user", ")", "{", "// If the session already has user data ...", "if", "(", "$", "request", "->", "getSessionData", "(", "'userUuid'", ")", "!==", "false", ")", "{", "$", "sessionToken", "=", "$", "request", "->", "getSessionData", "(", "'userSessionToken'", ")", ";", "$", "sessionTokenLifetime", "=", "$", "request", "->", "getSessionData", "(", "'userSessionTokenLifetime'", ")", ";", "// Cleanup the session", "$", "this", "->", "cleanupSession", "(", "$", "request", ")", ";", "// Save the old session token for some requests in the next 60 seconds", "if", "(", "$", "sessionToken", "!==", "false", ")", "{", "$", "request", "->", "setSessionData", "(", "'oldUserSessionToken'", ",", "$", "sessionToken", ")", ";", "$", "request", "->", "setSessionData", "(", "'oldUserSessionTokenLifetime'", ",", "$", "sessionTokenLifetime", ")", ";", "}", "}", "// Regenerate the session", "$", "this", "->", "regenerateSession", "(", "$", "request", ")", ";", "$", "sessionToken", "=", "md5", "(", "$", "user", "->", "getUuid", "(", ")", ")", ".", "'-'", ".", "md5", "(", "uniqid", "(", ")", ")", ";", "$", "sessionTokenLifeTime", "=", "time", "(", ")", "+", "300", ";", "$", "request", "->", "setSessionData", "(", "'userUuid'", ",", "$", "user", "->", "getUuid", "(", ")", ")", ";", "$", "request", "->", "setSessionData", "(", "'userSessionToken'", ",", "$", "sessionToken", ")", ";", "$", "request", "->", "setSessionData", "(", "'userSessionTokenLifetime'", ",", "$", "sessionTokenLifeTime", ")", ";", "setcookie", "(", "$", "sessionToken", ",", "$", "sessionTokenLifeTime", ",", "0", ",", "'/'", ",", "''", ",", "$", "request", "->", "isSsl", "(", ")", ")", ";", "}" ]
Initializes the user session @access public @param \Zepi\Turbo\Request\WebRequest $request @param \Zepi\Turbo\Response\Response $response @param \Zepi\Web\AccessControl\Entity\User $user
[ "Initializes", "the", "user", "session" ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L84-L112
235,969
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.reinitializeSession
public function reinitializeSession(Framework $framework, WebRequest $request, Response $response) { // Sets the correct name: session_name('ZTSM'); // Start the session session_start(); // If the session wasn't started before, we start it now... if ($request->getSessionData('sessionStarted') === false) { $this->startSession($request); } // Validate the session data $valid = $this->validateSessionData($request); // If the session not is valid we redirect to the start of everything if (!$valid) { $response->redirectTo(''); } // There is a 1% chance that we regenerate the session if (mt_rand(1, 100) <= 1) { $this->regenerateSession($request); } // Initialize the user session if ($request->getSessionData('userUuid') !== false) { $this->reinitializeUserSession($framework, $request, $response); } }
php
public function reinitializeSession(Framework $framework, WebRequest $request, Response $response) { // Sets the correct name: session_name('ZTSM'); // Start the session session_start(); // If the session wasn't started before, we start it now... if ($request->getSessionData('sessionStarted') === false) { $this->startSession($request); } // Validate the session data $valid = $this->validateSessionData($request); // If the session not is valid we redirect to the start of everything if (!$valid) { $response->redirectTo(''); } // There is a 1% chance that we regenerate the session if (mt_rand(1, 100) <= 1) { $this->regenerateSession($request); } // Initialize the user session if ($request->getSessionData('userUuid') !== false) { $this->reinitializeUserSession($framework, $request, $response); } }
[ "public", "function", "reinitializeSession", "(", "Framework", "$", "framework", ",", "WebRequest", "$", "request", ",", "Response", "$", "response", ")", "{", "// Sets the correct name:", "session_name", "(", "'ZTSM'", ")", ";", "// Start the session", "session_start", "(", ")", ";", "// If the session wasn't started before, we start it now...", "if", "(", "$", "request", "->", "getSessionData", "(", "'sessionStarted'", ")", "===", "false", ")", "{", "$", "this", "->", "startSession", "(", "$", "request", ")", ";", "}", "// Validate the session data", "$", "valid", "=", "$", "this", "->", "validateSessionData", "(", "$", "request", ")", ";", "// If the session not is valid we redirect to the start of everything", "if", "(", "!", "$", "valid", ")", "{", "$", "response", "->", "redirectTo", "(", "''", ")", ";", "}", "// There is a 1% chance that we regenerate the session", "if", "(", "mt_rand", "(", "1", ",", "100", ")", "<=", "1", ")", "{", "$", "this", "->", "regenerateSession", "(", "$", "request", ")", ";", "}", "// Initialize the user session", "if", "(", "$", "request", "->", "getSessionData", "(", "'userUuid'", ")", "!==", "false", ")", "{", "$", "this", "->", "reinitializeUserSession", "(", "$", "framework", ",", "$", "request", ",", "$", "response", ")", ";", "}", "}" ]
Initializes the session @access public @param \Zepi\Turbo\Request\WebRequest $request @param \Zepi\Turbo\Response\Response $response
[ "Initializes", "the", "session" ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L121-L151
235,970
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.logoutUser
public function logoutUser(WebRequest $request, Response $response) { $this->cleanupSession($request); $request->removeSession(); }
php
public function logoutUser(WebRequest $request, Response $response) { $this->cleanupSession($request); $request->removeSession(); }
[ "public", "function", "logoutUser", "(", "WebRequest", "$", "request", ",", "Response", "$", "response", ")", "{", "$", "this", "->", "cleanupSession", "(", "$", "request", ")", ";", "$", "request", "->", "removeSession", "(", ")", ";", "}" ]
Logouts the logged in user @access public @param \Zepi\Turbo\Request\WebRequest $request @param \Zepi\Turbo\Response\Response $response
[ "Logouts", "the", "logged", "in", "user" ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L160-L165
235,971
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.reinitializeUserSession
protected function reinitializeUserSession(Framework $framework, WebRequest $request, Response $response) { $token = $request->getSessionData('userSessionToken'); $lifetime = $request->getSessionData('userSessionTokenLifetime'); list($notValid, $token, $lifetime, $userUuid) = $this->verifyToken($request, $token, $lifetime); // We do not load any user session because this session isn't // okey. Our session token is not set or the lifetime is invalid or expired. // This is maybe an expired session or a hijacking attack... if ($notValid) { $this->cleanupSession($request); $this->regenerateSession($request); return false; } // Load the user $user = $this->userManager->getUserForUuid($userUuid); // If the user is disabled we cannot initialize the session if (!$user->hasAccess('\\Global\\*') && $user->hasAccess('\\Global\\Disabled')) { return false; } // Generate a new session object $session = new Session($user, $token, $lifetime); $request->setSession($session); // Generate a new token if the lifetime expires soon... if ($lifetime - 30 < time()) { $this->initializeUserSession($request, $response, $user); } return true; }
php
protected function reinitializeUserSession(Framework $framework, WebRequest $request, Response $response) { $token = $request->getSessionData('userSessionToken'); $lifetime = $request->getSessionData('userSessionTokenLifetime'); list($notValid, $token, $lifetime, $userUuid) = $this->verifyToken($request, $token, $lifetime); // We do not load any user session because this session isn't // okey. Our session token is not set or the lifetime is invalid or expired. // This is maybe an expired session or a hijacking attack... if ($notValid) { $this->cleanupSession($request); $this->regenerateSession($request); return false; } // Load the user $user = $this->userManager->getUserForUuid($userUuid); // If the user is disabled we cannot initialize the session if (!$user->hasAccess('\\Global\\*') && $user->hasAccess('\\Global\\Disabled')) { return false; } // Generate a new session object $session = new Session($user, $token, $lifetime); $request->setSession($session); // Generate a new token if the lifetime expires soon... if ($lifetime - 30 < time()) { $this->initializeUserSession($request, $response, $user); } return true; }
[ "protected", "function", "reinitializeUserSession", "(", "Framework", "$", "framework", ",", "WebRequest", "$", "request", ",", "Response", "$", "response", ")", "{", "$", "token", "=", "$", "request", "->", "getSessionData", "(", "'userSessionToken'", ")", ";", "$", "lifetime", "=", "$", "request", "->", "getSessionData", "(", "'userSessionTokenLifetime'", ")", ";", "list", "(", "$", "notValid", ",", "$", "token", ",", "$", "lifetime", ",", "$", "userUuid", ")", "=", "$", "this", "->", "verifyToken", "(", "$", "request", ",", "$", "token", ",", "$", "lifetime", ")", ";", "// We do not load any user session because this session isn't ", "// okey. Our session token is not set or the lifetime is invalid or expired.", "// This is maybe an expired session or a hijacking attack...", "if", "(", "$", "notValid", ")", "{", "$", "this", "->", "cleanupSession", "(", "$", "request", ")", ";", "$", "this", "->", "regenerateSession", "(", "$", "request", ")", ";", "return", "false", ";", "}", "// Load the user", "$", "user", "=", "$", "this", "->", "userManager", "->", "getUserForUuid", "(", "$", "userUuid", ")", ";", "// If the user is disabled we cannot initialize the session", "if", "(", "!", "$", "user", "->", "hasAccess", "(", "'\\\\Global\\\\*'", ")", "&&", "$", "user", "->", "hasAccess", "(", "'\\\\Global\\\\Disabled'", ")", ")", "{", "return", "false", ";", "}", "// Generate a new session object", "$", "session", "=", "new", "Session", "(", "$", "user", ",", "$", "token", ",", "$", "lifetime", ")", ";", "$", "request", "->", "setSession", "(", "$", "session", ")", ";", "// Generate a new token if the lifetime expires soon...", "if", "(", "$", "lifetime", "-", "30", "<", "time", "(", ")", ")", "{", "$", "this", "->", "initializeUserSession", "(", "$", "request", ",", "$", "response", ",", "$", "user", ")", ";", "}", "return", "true", ";", "}" ]
Verifies the session tokens and the session token life time and loads the user for the session. @access protected @param \Zepi\Turbo\Framework $framework @param \Zepi\Turbo\Request\WebRequest $request @param \Zepi\Turbo\Response\Response $response @return boolean
[ "Verifies", "the", "session", "tokens", "and", "the", "session", "token", "life", "time", "and", "loads", "the", "user", "for", "the", "session", "." ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L177-L212
235,972
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.verifyToken
protected function verifyToken(WebRequest $request, $token, $lifetime) { $notValid = false; // Cookie does not exists - this is maybe a session hijacking attack if ($request->getCookieData($token) === false) { $notValid = true; } // Check for the old data if ($notValid && $request->getSessionData('oldUserSessionToken') !== false) { $token = $request->getSessionData('oldUserSessionToken'); $lifetime = $request->getSessionData('oldUserSessionTokenLifetime'); // Look for the old session token cookie... if ($request->getCookieData($token) === false) { $notValid = true; } } // Check the lifetime of the cookie and the session if (!$notValid && $request->getCookieData($token) != $lifetime) { $notValid = true; } // If the session token expired more than 30 minutes ago // the session isn't valid anymore if (!$notValid && $lifetime < time() - 1800) { $notValid = true; } $userUuid = $request->getSessionData('userUuid'); // If the given uuid doesn't exists, this session can't be valid if (!$notValid && !$this->userManager->hasUserForUuid($userUuid)) { $notValid = true; } return array($notValid, $token, $lifetime, $userUuid); }
php
protected function verifyToken(WebRequest $request, $token, $lifetime) { $notValid = false; // Cookie does not exists - this is maybe a session hijacking attack if ($request->getCookieData($token) === false) { $notValid = true; } // Check for the old data if ($notValid && $request->getSessionData('oldUserSessionToken') !== false) { $token = $request->getSessionData('oldUserSessionToken'); $lifetime = $request->getSessionData('oldUserSessionTokenLifetime'); // Look for the old session token cookie... if ($request->getCookieData($token) === false) { $notValid = true; } } // Check the lifetime of the cookie and the session if (!$notValid && $request->getCookieData($token) != $lifetime) { $notValid = true; } // If the session token expired more than 30 minutes ago // the session isn't valid anymore if (!$notValid && $lifetime < time() - 1800) { $notValid = true; } $userUuid = $request->getSessionData('userUuid'); // If the given uuid doesn't exists, this session can't be valid if (!$notValid && !$this->userManager->hasUserForUuid($userUuid)) { $notValid = true; } return array($notValid, $token, $lifetime, $userUuid); }
[ "protected", "function", "verifyToken", "(", "WebRequest", "$", "request", ",", "$", "token", ",", "$", "lifetime", ")", "{", "$", "notValid", "=", "false", ";", "// Cookie does not exists - this is maybe a session hijacking attack", "if", "(", "$", "request", "->", "getCookieData", "(", "$", "token", ")", "===", "false", ")", "{", "$", "notValid", "=", "true", ";", "}", "// Check for the old data", "if", "(", "$", "notValid", "&&", "$", "request", "->", "getSessionData", "(", "'oldUserSessionToken'", ")", "!==", "false", ")", "{", "$", "token", "=", "$", "request", "->", "getSessionData", "(", "'oldUserSessionToken'", ")", ";", "$", "lifetime", "=", "$", "request", "->", "getSessionData", "(", "'oldUserSessionTokenLifetime'", ")", ";", "// Look for the old session token cookie...", "if", "(", "$", "request", "->", "getCookieData", "(", "$", "token", ")", "===", "false", ")", "{", "$", "notValid", "=", "true", ";", "}", "}", "// Check the lifetime of the cookie and the session", "if", "(", "!", "$", "notValid", "&&", "$", "request", "->", "getCookieData", "(", "$", "token", ")", "!=", "$", "lifetime", ")", "{", "$", "notValid", "=", "true", ";", "}", "// If the session token expired more than 30 minutes ago", "// the session isn't valid anymore", "if", "(", "!", "$", "notValid", "&&", "$", "lifetime", "<", "time", "(", ")", "-", "1800", ")", "{", "$", "notValid", "=", "true", ";", "}", "$", "userUuid", "=", "$", "request", "->", "getSessionData", "(", "'userUuid'", ")", ";", "// If the given uuid doesn't exists, this session can't be valid", "if", "(", "!", "$", "notValid", "&&", "!", "$", "this", "->", "userManager", "->", "hasUserForUuid", "(", "$", "userUuid", ")", ")", "{", "$", "notValid", "=", "true", ";", "}", "return", "array", "(", "$", "notValid", ",", "$", "token", ",", "$", "lifetime", ",", "$", "userUuid", ")", ";", "}" ]
Verifies the given session token and lifetime @param \Zepi\Turbo\Request\WebRequest $request @param string $token @param string $lifetime @return array
[ "Verifies", "the", "given", "session", "token", "and", "lifetime" ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L222-L261
235,973
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.startSession
protected function startSession(WebRequest $request) { // Save the nonce base on the session $request->setSessionData('nonceBase', md5(uniqid())); // Save the ip address on the session $request->setSessionData('ipAddress', $_SERVER['REMOTE_ADDR']); // Save the user agent on the session if (isset($_SERVER['HTTP_USER_AGENT'])) { $request->setSessionData('userAgent', $_SERVER['HTTP_USER_AGENT']); } // Save the boolean that we started the session $request->setSessionData('sessionStarted', true); }
php
protected function startSession(WebRequest $request) { // Save the nonce base on the session $request->setSessionData('nonceBase', md5(uniqid())); // Save the ip address on the session $request->setSessionData('ipAddress', $_SERVER['REMOTE_ADDR']); // Save the user agent on the session if (isset($_SERVER['HTTP_USER_AGENT'])) { $request->setSessionData('userAgent', $_SERVER['HTTP_USER_AGENT']); } // Save the boolean that we started the session $request->setSessionData('sessionStarted', true); }
[ "protected", "function", "startSession", "(", "WebRequest", "$", "request", ")", "{", "// Save the nonce base on the session", "$", "request", "->", "setSessionData", "(", "'nonceBase'", ",", "md5", "(", "uniqid", "(", ")", ")", ")", ";", "// Save the ip address on the session", "$", "request", "->", "setSessionData", "(", "'ipAddress'", ",", "$", "_SERVER", "[", "'REMOTE_ADDR'", "]", ")", ";", "// Save the user agent on the session", "if", "(", "isset", "(", "$", "_SERVER", "[", "'HTTP_USER_AGENT'", "]", ")", ")", "{", "$", "request", "->", "setSessionData", "(", "'userAgent'", ",", "$", "_SERVER", "[", "'HTTP_USER_AGENT'", "]", ")", ";", "}", "// Save the boolean that we started the session", "$", "request", "->", "setSessionData", "(", "'sessionStarted'", ",", "true", ")", ";", "}" ]
Starts the session and saves the base session informations. @access protected @param \Zepi\Turbo\Request\WebRequest $request
[ "Starts", "the", "session", "and", "saves", "the", "base", "session", "informations", "." ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L269-L284
235,974
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.cleanupSession
protected function cleanupSession(WebRequest $request) { $sessionToken = $request->getSessionData('userSessionToken'); setcookie($sessionToken, 0, time() - 60, '/', '', $request->isSsl()); $oldSessionToken = $request->getSessionData('oldUserSessionToken'); if ($oldSessionToken != '') { setcookie($oldSessionToken, 0, time() - 60, '/', '', $request->isSsl()); } $request->deleteSessionData('userUuid'); $request->deleteSessionData('userSessionToken'); $request->deleteSessionData('userSessionTokenLifetime'); $request->deleteSessionData('oldUserSessionToken'); $request->deleteSessionData('oldUserSessionTokenLifetime'); }
php
protected function cleanupSession(WebRequest $request) { $sessionToken = $request->getSessionData('userSessionToken'); setcookie($sessionToken, 0, time() - 60, '/', '', $request->isSsl()); $oldSessionToken = $request->getSessionData('oldUserSessionToken'); if ($oldSessionToken != '') { setcookie($oldSessionToken, 0, time() - 60, '/', '', $request->isSsl()); } $request->deleteSessionData('userUuid'); $request->deleteSessionData('userSessionToken'); $request->deleteSessionData('userSessionTokenLifetime'); $request->deleteSessionData('oldUserSessionToken'); $request->deleteSessionData('oldUserSessionTokenLifetime'); }
[ "protected", "function", "cleanupSession", "(", "WebRequest", "$", "request", ")", "{", "$", "sessionToken", "=", "$", "request", "->", "getSessionData", "(", "'userSessionToken'", ")", ";", "setcookie", "(", "$", "sessionToken", ",", "0", ",", "time", "(", ")", "-", "60", ",", "'/'", ",", "''", ",", "$", "request", "->", "isSsl", "(", ")", ")", ";", "$", "oldSessionToken", "=", "$", "request", "->", "getSessionData", "(", "'oldUserSessionToken'", ")", ";", "if", "(", "$", "oldSessionToken", "!=", "''", ")", "{", "setcookie", "(", "$", "oldSessionToken", ",", "0", ",", "time", "(", ")", "-", "60", ",", "'/'", ",", "''", ",", "$", "request", "->", "isSsl", "(", ")", ")", ";", "}", "$", "request", "->", "deleteSessionData", "(", "'userUuid'", ")", ";", "$", "request", "->", "deleteSessionData", "(", "'userSessionToken'", ")", ";", "$", "request", "->", "deleteSessionData", "(", "'userSessionTokenLifetime'", ")", ";", "$", "request", "->", "deleteSessionData", "(", "'oldUserSessionToken'", ")", ";", "$", "request", "->", "deleteSessionData", "(", "'oldUserSessionTokenLifetime'", ")", ";", "}" ]
Removes all user and token data from the session @access protected @param \Zepi\Turbo\Request\WebRequest $request
[ "Removes", "all", "user", "and", "token", "data", "from", "the", "session" ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L292-L307
235,975
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.validateSessionData
protected function validateSessionData(WebRequest $request) { if ($request->getSessionData('isObsolete') && $request->getSessionData('maxLifetime') < time()) { return false; } return true; }
php
protected function validateSessionData(WebRequest $request) { if ($request->getSessionData('isObsolete') && $request->getSessionData('maxLifetime') < time()) { return false; } return true; }
[ "protected", "function", "validateSessionData", "(", "WebRequest", "$", "request", ")", "{", "if", "(", "$", "request", "->", "getSessionData", "(", "'isObsolete'", ")", "&&", "$", "request", "->", "getSessionData", "(", "'maxLifetime'", ")", "<", "time", "(", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Validates the session. If the session is obsolete and the max lieftime is reached the function will return false, otherwise true. @access protected @param \Zepi\Turbo\Request\WebRequest $request @return boolean
[ "Validates", "the", "session", ".", "If", "the", "session", "is", "obsolete", "and", "the", "max", "lieftime", "is", "reached", "the", "function", "will", "return", "false", "otherwise", "true", "." ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L317-L324
235,976
zepi/turbo-base
Zepi/Web/AccessControl/src/Manager/SessionManager.php
SessionManager.regenerateSession
protected function regenerateSession(WebRequest $request) { // Let the old session expire... $request->setSessionData('isObsolete', true); $request->setSessionData('maxLifetime', time() + 60); // Regenerate the session id but don't delete the old one session_regenerate_id(false); // Get the new session id $newSessionId = session_id(); // Close both sessions to free them for other requests session_write_close(); // Start the session with the new id session_id($newSessionId); session_start(); // Delete the temporary session data $request->deleteSessionData('isObsolete'); $request->deleteSessionData('maxLifetime'); }
php
protected function regenerateSession(WebRequest $request) { // Let the old session expire... $request->setSessionData('isObsolete', true); $request->setSessionData('maxLifetime', time() + 60); // Regenerate the session id but don't delete the old one session_regenerate_id(false); // Get the new session id $newSessionId = session_id(); // Close both sessions to free them for other requests session_write_close(); // Start the session with the new id session_id($newSessionId); session_start(); // Delete the temporary session data $request->deleteSessionData('isObsolete'); $request->deleteSessionData('maxLifetime'); }
[ "protected", "function", "regenerateSession", "(", "WebRequest", "$", "request", ")", "{", "// Let the old session expire...", "$", "request", "->", "setSessionData", "(", "'isObsolete'", ",", "true", ")", ";", "$", "request", "->", "setSessionData", "(", "'maxLifetime'", ",", "time", "(", ")", "+", "60", ")", ";", "// Regenerate the session id but don't delete the old one", "session_regenerate_id", "(", "false", ")", ";", "// Get the new session id", "$", "newSessionId", "=", "session_id", "(", ")", ";", "// Close both sessions to free them for other requests", "session_write_close", "(", ")", ";", "// Start the session with the new id", "session_id", "(", "$", "newSessionId", ")", ";", "session_start", "(", ")", ";", "// Delete the temporary session data", "$", "request", "->", "deleteSessionData", "(", "'isObsolete'", ")", ";", "$", "request", "->", "deleteSessionData", "(", "'maxLifetime'", ")", ";", "}" ]
Regenerates the session. It makes the old session id obsolete and generates a new session id. @access protected @param \Zepi\Turbo\Request\WebRequest $request
[ "Regenerates", "the", "session", ".", "It", "makes", "the", "old", "session", "id", "obsolete", "and", "generates", "a", "new", "session", "id", "." ]
9a36d8c7649317f55f91b2adf386bd1f04ec02a3
https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/Manager/SessionManager.php#L333-L355
235,977
joffreydemetz/utilities
src/Timer/Timer.php
Timer.addTimer
public function addTimer(Timer $timer) { if ( false === ($step=$this->currentStep()) ){ throw new \Exception('No current step'); } $step->setTimer($timer); return $this; }
php
public function addTimer(Timer $timer) { if ( false === ($step=$this->currentStep()) ){ throw new \Exception('No current step'); } $step->setTimer($timer); return $this; }
[ "public", "function", "addTimer", "(", "Timer", "$", "timer", ")", "{", "if", "(", "false", "===", "(", "$", "step", "=", "$", "this", "->", "currentStep", "(", ")", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'No current step'", ")", ";", "}", "$", "step", "->", "setTimer", "(", "$", "timer", ")", ";", "return", "$", "this", ";", "}" ]
Add timer to current step
[ "Add", "timer", "to", "current", "step" ]
aa62a178bc463c10067a2ff2992d39c6f0037b9f
https://github.com/joffreydemetz/utilities/blob/aa62a178bc463c10067a2ff2992d39c6f0037b9f/src/Timer/Timer.php#L161-L169
235,978
joffreydemetz/utilities
src/Timer/Timer.php
Timer.addMessage
public function addMessage(string $message) { if ( false === ($step=$this->currentStep()) ){ throw new \Exception('No current step'); } $step->addMessage($message); return $this; }
php
public function addMessage(string $message) { if ( false === ($step=$this->currentStep()) ){ throw new \Exception('No current step'); } $step->addMessage($message); return $this; }
[ "public", "function", "addMessage", "(", "string", "$", "message", ")", "{", "if", "(", "false", "===", "(", "$", "step", "=", "$", "this", "->", "currentStep", "(", ")", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'No current step'", ")", ";", "}", "$", "step", "->", "addMessage", "(", "$", "message", ")", ";", "return", "$", "this", ";", "}" ]
Add message to current step
[ "Add", "message", "to", "current", "step" ]
aa62a178bc463c10067a2ff2992d39c6f0037b9f
https://github.com/joffreydemetz/utilities/blob/aa62a178bc463c10067a2ff2992d39c6f0037b9f/src/Timer/Timer.php#L174-L182
235,979
nattreid/app-manager
src/Helpers/Logs.php
Logs.getFile
public function getFile(string $id): ?FileResponse { $log = $this->getLog($id); if ($log) { $file = $log->name; if (Strings::endsWith($file, '.html')) { $contentType = 'text/html'; } else { $contentType = 'text/plain'; } return new FileResponse($this->path . $file, $file, $contentType, false); } return null; }
php
public function getFile(string $id): ?FileResponse { $log = $this->getLog($id); if ($log) { $file = $log->name; if (Strings::endsWith($file, '.html')) { $contentType = 'text/html'; } else { $contentType = 'text/plain'; } return new FileResponse($this->path . $file, $file, $contentType, false); } return null; }
[ "public", "function", "getFile", "(", "string", "$", "id", ")", ":", "?", "FileResponse", "{", "$", "log", "=", "$", "this", "->", "getLog", "(", "$", "id", ")", ";", "if", "(", "$", "log", ")", "{", "$", "file", "=", "$", "log", "->", "name", ";", "if", "(", "Strings", "::", "endsWith", "(", "$", "file", ",", "'.html'", ")", ")", "{", "$", "contentType", "=", "'text/html'", ";", "}", "else", "{", "$", "contentType", "=", "'text/plain'", ";", "}", "return", "new", "FileResponse", "(", "$", "this", "->", "path", ".", "$", "file", ",", "$", "file", ",", "$", "contentType", ",", "false", ")", ";", "}", "return", "null", ";", "}" ]
Vrati soubor ke stazeni @param string $id @return FileResponse|null @throws BadRequestException
[ "Vrati", "soubor", "ke", "stazeni" ]
7821d09a0b3e58ba9c6eb81d44e35aacce55de75
https://github.com/nattreid/app-manager/blob/7821d09a0b3e58ba9c6eb81d44e35aacce55de75/src/Helpers/Logs.php#L117-L130
235,980
bearframework/emails-addon
classes/Emails/Email/Recipients.php
Recipients.add
public function add(string $email, string $name = null): void { $recipient = $this->make(); $recipient->email = $email; if ($name !== null) { $recipient->name = $name; } $this->set($recipient); }
php
public function add(string $email, string $name = null): void { $recipient = $this->make(); $recipient->email = $email; if ($name !== null) { $recipient->name = $name; } $this->set($recipient); }
[ "public", "function", "add", "(", "string", "$", "email", ",", "string", "$", "name", "=", "null", ")", ":", "void", "{", "$", "recipient", "=", "$", "this", "->", "make", "(", ")", ";", "$", "recipient", "->", "email", "=", "$", "email", ";", "if", "(", "$", "name", "!==", "null", ")", "{", "$", "recipient", "->", "name", "=", "$", "name", ";", "}", "$", "this", "->", "set", "(", "$", "recipient", ")", ";", "}" ]
Add a recipient. @param string $email The recipient email address. @param string|null $name The recipient name.
[ "Add", "a", "recipient", "." ]
43a68c47e2b1d231dc69a324249ff5f6827201ca
https://github.com/bearframework/emails-addon/blob/43a68c47e2b1d231dc69a324249ff5f6827201ca/classes/Emails/Email/Recipients.php#L34-L42
235,981
RowlandOti/ooglee-core
src/OoGlee/Domain/Providers/HashingServiceProvider.php
HashingServiceProvider.register
public function register() { // Bind the returned class to the namespace 'Ooglee\Domain\Contracts\IHashingService' $this->app->singleton('Ooglee\Domain\Contracts\IHashingService', function($app) { //$hasher = $this->app['config']['ioc.app.hasher']; $hasher = \Config::get('ooglee::ioc.app.hasher'); //return new HashingService(new HasherExample()); return new HashingService(new $hasher); }); }
php
public function register() { // Bind the returned class to the namespace 'Ooglee\Domain\Contracts\IHashingService' $this->app->singleton('Ooglee\Domain\Contracts\IHashingService', function($app) { //$hasher = $this->app['config']['ioc.app.hasher']; $hasher = \Config::get('ooglee::ioc.app.hasher'); //return new HashingService(new HasherExample()); return new HashingService(new $hasher); }); }
[ "public", "function", "register", "(", ")", "{", "// Bind the returned class to the namespace 'Ooglee\\Domain\\Contracts\\IHashingService'\r", "$", "this", "->", "app", "->", "singleton", "(", "'Ooglee\\Domain\\Contracts\\IHashingService'", ",", "function", "(", "$", "app", ")", "{", "//$hasher = $this->app['config']['ioc.app.hasher'];\r", "$", "hasher", "=", "\\", "Config", "::", "get", "(", "'ooglee::ioc.app.hasher'", ")", ";", "//return new HashingService(new HasherExample());\r", "return", "new", "HashingService", "(", "new", "$", "hasher", ")", ";", "}", ")", ";", "}" ]
Registers the service in the IoC Container
[ "Registers", "the", "service", "in", "the", "IoC", "Container" ]
6cd8a8e58e37749e1c58e99063ea72c9d37a98bc
https://github.com/RowlandOti/ooglee-core/blob/6cd8a8e58e37749e1c58e99063ea72c9d37a98bc/src/OoGlee/Domain/Providers/HashingServiceProvider.php#L15-L25
235,982
cubiche/cqt
src/Cubiche/Tools/CodeQualityTool.php
CodeQualityTool.checkComposer
private function checkComposer() { $composerJsonDetected = false; $composerLockDetected = false; foreach (GitUtils::extractCommitedFiles() as $file) { if ($file === 'composer.json') { $composerJsonDetected = true; } if ($file === 'composer.lock') { $composerLockDetected = true; } } if ($composerJsonDetected && !$composerLockDetected) { $this->output->writeln( '<bg=yellow;fg=black> composer.lock must be commited if composer.json is modified! </bg=yellow;fg=black>' ); } }
php
private function checkComposer() { $composerJsonDetected = false; $composerLockDetected = false; foreach (GitUtils::extractCommitedFiles() as $file) { if ($file === 'composer.json') { $composerJsonDetected = true; } if ($file === 'composer.lock') { $composerLockDetected = true; } } if ($composerJsonDetected && !$composerLockDetected) { $this->output->writeln( '<bg=yellow;fg=black> composer.lock must be commited if composer.json is modified! </bg=yellow;fg=black>' ); } }
[ "private", "function", "checkComposer", "(", ")", "{", "$", "composerJsonDetected", "=", "false", ";", "$", "composerLockDetected", "=", "false", ";", "foreach", "(", "GitUtils", "::", "extractCommitedFiles", "(", ")", "as", "$", "file", ")", "{", "if", "(", "$", "file", "===", "'composer.json'", ")", "{", "$", "composerJsonDetected", "=", "true", ";", "}", "if", "(", "$", "file", "===", "'composer.lock'", ")", "{", "$", "composerLockDetected", "=", "true", ";", "}", "}", "if", "(", "$", "composerJsonDetected", "&&", "!", "$", "composerLockDetected", ")", "{", "$", "this", "->", "output", "->", "writeln", "(", "'<bg=yellow;fg=black>\n composer.lock must be commited if composer.json is modified!\n </bg=yellow;fg=black>'", ")", ";", "}", "}" ]
Check composer.json and composer.lock files
[ "Check", "composer", ".", "json", "and", "composer", ".", "lock", "files" ]
5cae76821df0b3ad442f629c62d39fe8e455c8c7
https://github.com/cubiche/cqt/blob/5cae76821df0b3ad442f629c62d39fe8e455c8c7/src/Cubiche/Tools/CodeQualityTool.php#L96-L115
235,983
helionogueir/foldercreator
core/folder/Delete.class.php
Delete.rm
public function rm(string $directory): bool { if (is_dir($directory)) { foreach (new DirectoryIterator(Path::replaceOSSeparator($directory)) as $fileInfo) { if (!$fileInfo->isDot()) { if ($fileInfo->isDir()) { $this->rm($fileInfo->getPathname()); @rmdir($fileInfo->getPathname()); } else if ($fileInfo->isFile()) { @unlink($fileInfo->getPathname()); } } } @rmdir($directory); } return !file_exists($directory); }
php
public function rm(string $directory): bool { if (is_dir($directory)) { foreach (new DirectoryIterator(Path::replaceOSSeparator($directory)) as $fileInfo) { if (!$fileInfo->isDot()) { if ($fileInfo->isDir()) { $this->rm($fileInfo->getPathname()); @rmdir($fileInfo->getPathname()); } else if ($fileInfo->isFile()) { @unlink($fileInfo->getPathname()); } } } @rmdir($directory); } return !file_exists($directory); }
[ "public", "function", "rm", "(", "string", "$", "directory", ")", ":", "bool", "{", "if", "(", "is_dir", "(", "$", "directory", ")", ")", "{", "foreach", "(", "new", "DirectoryIterator", "(", "Path", "::", "replaceOSSeparator", "(", "$", "directory", ")", ")", "as", "$", "fileInfo", ")", "{", "if", "(", "!", "$", "fileInfo", "->", "isDot", "(", ")", ")", "{", "if", "(", "$", "fileInfo", "->", "isDir", "(", ")", ")", "{", "$", "this", "->", "rm", "(", "$", "fileInfo", "->", "getPathname", "(", ")", ")", ";", "@", "rmdir", "(", "$", "fileInfo", "->", "getPathname", "(", ")", ")", ";", "}", "else", "if", "(", "$", "fileInfo", "->", "isFile", "(", ")", ")", "{", "@", "unlink", "(", "$", "fileInfo", "->", "getPathname", "(", ")", ")", ";", "}", "}", "}", "@", "rmdir", "(", "$", "directory", ")", ";", "}", "return", "!", "file_exists", "(", "$", "directory", ")", ";", "}" ]
- Delete directory and sub directory recursive @param string $directory Path of directory @return bool Return if directory to be remove
[ "-", "Delete", "directory", "and", "sub", "directory", "recursive" ]
64bf53c924efec4e581d4acbe183e4a004cd4cae
https://github.com/helionogueir/foldercreator/blob/64bf53c924efec4e581d4acbe183e4a004cd4cae/core/folder/Delete.class.php#L20-L35
235,984
xuzhenjun130/X-framework
Controller.php
Controller.getLayoutPath
public function getLayoutPath() { $ref = new \ReflectionClass($this); return dirname(dirname($ref->getFileName())) . '/views/layouts/' . $this->layout . '.php'; }
php
public function getLayoutPath() { $ref = new \ReflectionClass($this); return dirname(dirname($ref->getFileName())) . '/views/layouts/' . $this->layout . '.php'; }
[ "public", "function", "getLayoutPath", "(", ")", "{", "$", "ref", "=", "new", "\\", "ReflectionClass", "(", "$", "this", ")", ";", "return", "dirname", "(", "dirname", "(", "$", "ref", "->", "getFileName", "(", ")", ")", ")", ".", "'/views/layouts/'", ".", "$", "this", "->", "layout", ".", "'.php'", ";", "}" ]
get layouts path @return string @throws \ReflectionException
[ "get", "layouts", "path" ]
07b91c572d7fff79c46e9fb45389f03a6d53725f
https://github.com/xuzhenjun130/X-framework/blob/07b91c572d7fff79c46e9fb45389f03a6d53725f/Controller.php#L102-L106
235,985
easy-system/es-view-helpers
src/Helper/Url.php
Url.fromRoute
public function fromRoute($name, array $params = []) { $router = $this->getRouter(); $route = $router->get($name); return $route->assemble($params); }
php
public function fromRoute($name, array $params = []) { $router = $this->getRouter(); $route = $router->get($name); return $route->assemble($params); }
[ "public", "function", "fromRoute", "(", "$", "name", ",", "array", "$", "params", "=", "[", "]", ")", "{", "$", "router", "=", "$", "this", "->", "getRouter", "(", ")", ";", "$", "route", "=", "$", "router", "->", "get", "(", "$", "name", ")", ";", "return", "$", "route", "->", "assemble", "(", "$", "params", ")", ";", "}" ]
Gets url from route. @param string $name The route name @param array $params Optional; the route parameters @return string The url
[ "Gets", "url", "from", "route", "." ]
39755d07dea63d525fb85d989bb095c89d805e9a
https://github.com/easy-system/es-view-helpers/blob/39755d07dea63d525fb85d989bb095c89d805e9a/src/Helper/Url.php#L57-L63
235,986
easy-system/es-view-helpers
src/Helper/Url.php
Url.absolute
public function absolute($relative = null) { $host = $this->getHost(); if (null !== $relative) { $relative = '/' . ltrim($relative, '/'); } return $host . $relative; }
php
public function absolute($relative = null) { $host = $this->getHost(); if (null !== $relative) { $relative = '/' . ltrim($relative, '/'); } return $host . $relative; }
[ "public", "function", "absolute", "(", "$", "relative", "=", "null", ")", "{", "$", "host", "=", "$", "this", "->", "getHost", "(", ")", ";", "if", "(", "null", "!==", "$", "relative", ")", "{", "$", "relative", "=", "'/'", ".", "ltrim", "(", "$", "relative", ",", "'/'", ")", ";", "}", "return", "$", "host", ".", "$", "relative", ";", "}" ]
Gets the absolute address. @param null|string $relative Optional; the relative address @return string Absolute address
[ "Gets", "the", "absolute", "address", "." ]
39755d07dea63d525fb85d989bb095c89d805e9a
https://github.com/easy-system/es-view-helpers/blob/39755d07dea63d525fb85d989bb095c89d805e9a/src/Helper/Url.php#L72-L81
235,987
sgtlambda/jvwp
src/admin/pages/log/Message.php
Message.render
public function render () { $short = !empty($this->detailed) ? "<p><strong>{$this->short}</strong></p>" : "<p>{$this->short}</p>"; $detailed = !empty($this->detailed) ? "<p>{$this->detailed}</p>" : ""; $classes = implode(' ', $this->getClasses()); return '<div class="' . $classes . '">' . $short . $detailed . '</div>'; }
php
public function render () { $short = !empty($this->detailed) ? "<p><strong>{$this->short}</strong></p>" : "<p>{$this->short}</p>"; $detailed = !empty($this->detailed) ? "<p>{$this->detailed}</p>" : ""; $classes = implode(' ', $this->getClasses()); return '<div class="' . $classes . '">' . $short . $detailed . '</div>'; }
[ "public", "function", "render", "(", ")", "{", "$", "short", "=", "!", "empty", "(", "$", "this", "->", "detailed", ")", "?", "\"<p><strong>{$this->short}</strong></p>\"", ":", "\"<p>{$this->short}</p>\"", ";", "$", "detailed", "=", "!", "empty", "(", "$", "this", "->", "detailed", ")", "?", "\"<p>{$this->detailed}</p>\"", ":", "\"\"", ";", "$", "classes", "=", "implode", "(", "' '", ",", "$", "this", "->", "getClasses", "(", ")", ")", ";", "return", "'<div class=\"'", ".", "$", "classes", ".", "'\">'", ".", "$", "short", ".", "$", "detailed", ".", "'</div>'", ";", "}" ]
Renders the log message to HTML markup @return string
[ "Renders", "the", "log", "message", "to", "HTML", "markup" ]
85dba59281216ccb9cff580d26063d304350bbe0
https://github.com/sgtlambda/jvwp/blob/85dba59281216ccb9cff580d26063d304350bbe0/src/admin/pages/log/Message.php#L37-L43
235,988
singularphp/console
src/Singular/Console/Command/CommandLocator.php
CommandLocator.locate
public function locate($pack) { $finder = new Finder(); $packDirectory = $this->packs[$pack]->getDirectory(); $commandDir = $packDirectory.DIRECTORY_SEPARATOR."Command"; if (is_dir($commandDir)) { foreach ($finder->name("*.php")->in($packDirectory.DIRECTORY_SEPARATOR."Command") as $file) { $commandClass = str_replace('.php','' , $file->getFilename()); $fullClassName = "\\".$this->packs[$pack]->getNameSpace()."\\Command\\".$commandClass; if (class_exists($fullClassName)) { $command = new $fullClassName; if ($command instanceof \Singular\Console\Command\Command) { $this->console->add($command); } } } } }
php
public function locate($pack) { $finder = new Finder(); $packDirectory = $this->packs[$pack]->getDirectory(); $commandDir = $packDirectory.DIRECTORY_SEPARATOR."Command"; if (is_dir($commandDir)) { foreach ($finder->name("*.php")->in($packDirectory.DIRECTORY_SEPARATOR."Command") as $file) { $commandClass = str_replace('.php','' , $file->getFilename()); $fullClassName = "\\".$this->packs[$pack]->getNameSpace()."\\Command\\".$commandClass; if (class_exists($fullClassName)) { $command = new $fullClassName; if ($command instanceof \Singular\Console\Command\Command) { $this->console->add($command); } } } } }
[ "public", "function", "locate", "(", "$", "pack", ")", "{", "$", "finder", "=", "new", "Finder", "(", ")", ";", "$", "packDirectory", "=", "$", "this", "->", "packs", "[", "$", "pack", "]", "->", "getDirectory", "(", ")", ";", "$", "commandDir", "=", "$", "packDirectory", ".", "DIRECTORY_SEPARATOR", ".", "\"Command\"", ";", "if", "(", "is_dir", "(", "$", "commandDir", ")", ")", "{", "foreach", "(", "$", "finder", "->", "name", "(", "\"*.php\"", ")", "->", "in", "(", "$", "packDirectory", ".", "DIRECTORY_SEPARATOR", ".", "\"Command\"", ")", "as", "$", "file", ")", "{", "$", "commandClass", "=", "str_replace", "(", "'.php'", ",", "''", ",", "$", "file", "->", "getFilename", "(", ")", ")", ";", "$", "fullClassName", "=", "\"\\\\\"", ".", "$", "this", "->", "packs", "[", "$", "pack", "]", "->", "getNameSpace", "(", ")", ".", "\"\\\\Command\\\\\"", ".", "$", "commandClass", ";", "if", "(", "class_exists", "(", "$", "fullClassName", ")", ")", "{", "$", "command", "=", "new", "$", "fullClassName", ";", "if", "(", "$", "command", "instanceof", "\\", "Singular", "\\", "Console", "\\", "Command", "\\", "Command", ")", "{", "$", "this", "->", "console", "->", "add", "(", "$", "command", ")", ";", "}", "}", "}", "}", "}" ]
Localiza a registra os comandos de um pacote automaticamente. @param string $pack
[ "Localiza", "a", "registra", "os", "comandos", "de", "um", "pacote", "automaticamente", "." ]
b3f4fbffb8c04a80dc79c45e79cbe6b56061032e
https://github.com/singularphp/console/blob/b3f4fbffb8c04a80dc79c45e79cbe6b56061032e/src/Singular/Console/Command/CommandLocator.php#L23-L43
235,989
extendsframework/extends-application
src/Http/Renderer/Json/JsonRenderer.php
JsonRenderer.stringifyBody
protected function stringifyBody(ResponseInterface $response): string { $body = $response->getBody(); if ($body === null) { return ''; } return json_encode($body, JSON_PARTIAL_OUTPUT_ON_ERROR); }
php
protected function stringifyBody(ResponseInterface $response): string { $body = $response->getBody(); if ($body === null) { return ''; } return json_encode($body, JSON_PARTIAL_OUTPUT_ON_ERROR); }
[ "protected", "function", "stringifyBody", "(", "ResponseInterface", "$", "response", ")", ":", "string", "{", "$", "body", "=", "$", "response", "->", "getBody", "(", ")", ";", "if", "(", "$", "body", "===", "null", ")", "{", "return", "''", ";", "}", "return", "json_encode", "(", "$", "body", ",", "JSON_PARTIAL_OUTPUT_ON_ERROR", ")", ";", "}" ]
Stringify response body to JSON string. @param ResponseInterface $response @return string
[ "Stringify", "response", "body", "to", "JSON", "string", "." ]
89b74594310e60542d5714e2db33ae0feb0f9d34
https://github.com/extendsframework/extends-application/blob/89b74594310e60542d5714e2db33ae0feb0f9d34/src/Http/Renderer/Json/JsonRenderer.php#L80-L88
235,990
extendsframework/extends-application
src/Http/Renderer/Json/JsonRenderer.php
JsonRenderer.addHeaders
protected function addHeaders(ResponseInterface $response, string $body): ResponseInterface { return $response ->andHeader('Content-Type', 'application/json') ->andHeader('Content-Length', (string)strlen($body)); }
php
protected function addHeaders(ResponseInterface $response, string $body): ResponseInterface { return $response ->andHeader('Content-Type', 'application/json') ->andHeader('Content-Length', (string)strlen($body)); }
[ "protected", "function", "addHeaders", "(", "ResponseInterface", "$", "response", ",", "string", "$", "body", ")", ":", "ResponseInterface", "{", "return", "$", "response", "->", "andHeader", "(", "'Content-Type'", ",", "'application/json'", ")", "->", "andHeader", "(", "'Content-Length'", ",", "(", "string", ")", "strlen", "(", "$", "body", ")", ")", ";", "}" ]
Add Content-Length header to response. @param ResponseInterface $response @param string $body @return ResponseInterface
[ "Add", "Content", "-", "Length", "header", "to", "response", "." ]
89b74594310e60542d5714e2db33ae0feb0f9d34
https://github.com/extendsframework/extends-application/blob/89b74594310e60542d5714e2db33ae0feb0f9d34/src/Http/Renderer/Json/JsonRenderer.php#L97-L102
235,991
Aurora-Framework/Helper
src/Helper/Form.php
Form.hidden
public function hidden($name, $value = null, $attributes = null) { return '<input type="hidden" name="'.$name.'" value="'.$this->getValue($name, $value).'" '.(($attributes !== null) ? $this->attributes($attributes) : "").' />'; }
php
public function hidden($name, $value = null, $attributes = null) { return '<input type="hidden" name="'.$name.'" value="'.$this->getValue($name, $value).'" '.(($attributes !== null) ? $this->attributes($attributes) : "").' />'; }
[ "public", "function", "hidden", "(", "$", "name", ",", "$", "value", "=", "null", ",", "$", "attributes", "=", "null", ")", "{", "return", "'<input type=\"hidden\" name=\"'", ".", "$", "name", ".", "'\" value=\"'", ".", "$", "this", "->", "getValue", "(", "$", "name", ",", "$", "value", ")", ".", "'\" '", ".", "(", "(", "$", "attributes", "!==", "null", ")", "?", "$", "this", "->", "attributes", "(", "$", "attributes", ")", ":", "\"\"", ")", ".", "' />'", ";", "}" ]
Generates hidden input for form @method hidden @param string $name Name of input (unique) @param string $value Value for input @param array|string $attributes Attributes for input @return string Hidden input
[ "Generates", "hidden", "input", "for", "form" ]
1d0fa09d641d994cf7d8136f4aff220342419804
https://github.com/Aurora-Framework/Helper/blob/1d0fa09d641d994cf7d8136f4aff220342419804/src/Helper/Form.php#L79-L82
235,992
Aurora-Framework/Helper
src/Helper/Form.php
Form.input
public function input($name, $value = null, $attributes = null) { return '<input type="text" name="'.$name.'" value="'.$this->getValue($name, $value).'" '.(($attributes !== null) ? $this->attributes($attributes) : "").'/>'; }
php
public function input($name, $value = null, $attributes = null) { return '<input type="text" name="'.$name.'" value="'.$this->getValue($name, $value).'" '.(($attributes !== null) ? $this->attributes($attributes) : "").'/>'; }
[ "public", "function", "input", "(", "$", "name", ",", "$", "value", "=", "null", ",", "$", "attributes", "=", "null", ")", "{", "return", "'<input type=\"text\" name=\"'", ".", "$", "name", ".", "'\" value=\"'", ".", "$", "this", "->", "getValue", "(", "$", "name", ",", "$", "value", ")", ".", "'\" '", ".", "(", "(", "$", "attributes", "!==", "null", ")", "?", "$", "this", "->", "attributes", "(", "$", "attributes", ")", ":", "\"\"", ")", ".", "'/>'", ";", "}" ]
Generates text input @method input @param string $name Name of input (unique) @param string $value Value for input @param array|string $attributes Attributes for input @return string Input with text type
[ "Generates", "text", "input" ]
1d0fa09d641d994cf7d8136f4aff220342419804
https://github.com/Aurora-Framework/Helper/blob/1d0fa09d641d994cf7d8136f4aff220342419804/src/Helper/Form.php#L92-L95
235,993
Aurora-Framework/Helper
src/Helper/Form.php
Form.password
public function password($name, $value = null, $attributes = null) { return '<input type="password" name="'.$name.'" value="'.$this->getValue($name, $value).'" '.(($attributes !== null) ? $this->attributes($attributes) : "").'/>'; }
php
public function password($name, $value = null, $attributes = null) { return '<input type="password" name="'.$name.'" value="'.$this->getValue($name, $value).'" '.(($attributes !== null) ? $this->attributes($attributes) : "").'/>'; }
[ "public", "function", "password", "(", "$", "name", ",", "$", "value", "=", "null", ",", "$", "attributes", "=", "null", ")", "{", "return", "'<input type=\"password\" name=\"'", ".", "$", "name", ".", "'\" value=\"'", ".", "$", "this", "->", "getValue", "(", "$", "name", ",", "$", "value", ")", ".", "'\" '", ".", "(", "(", "$", "attributes", "!==", "null", ")", "?", "$", "this", "->", "attributes", "(", "$", "attributes", ")", ":", "\"\"", ")", ".", "'/>'", ";", "}" ]
Generates password input @method password @param string $name Name of input (unique) @param string $value Value for input @param array|string $attributes Attributes for input @return string Input with password type
[ "Generates", "password", "input" ]
1d0fa09d641d994cf7d8136f4aff220342419804
https://github.com/Aurora-Framework/Helper/blob/1d0fa09d641d994cf7d8136f4aff220342419804/src/Helper/Form.php#L105-L108
235,994
Aurora-Framework/Helper
src/Helper/Form.php
Form.submit
public function submit($name, $value = null, $attributes = null) { return '<input type="submit" name="'.$name.'" '.(($attributes !== null) ? $this->attributes($attributes) : "").' value="'.$this->getValue($name, $value).'" />'; }
php
public function submit($name, $value = null, $attributes = null) { return '<input type="submit" name="'.$name.'" '.(($attributes !== null) ? $this->attributes($attributes) : "").' value="'.$this->getValue($name, $value).'" />'; }
[ "public", "function", "submit", "(", "$", "name", ",", "$", "value", "=", "null", ",", "$", "attributes", "=", "null", ")", "{", "return", "'<input type=\"submit\" name=\"'", ".", "$", "name", ".", "'\" '", ".", "(", "(", "$", "attributes", "!==", "null", ")", "?", "$", "this", "->", "attributes", "(", "$", "attributes", ")", ":", "\"\"", ")", ".", "' value=\"'", ".", "$", "this", "->", "getValue", "(", "$", "name", ",", "$", "value", ")", ".", "'\" />'", ";", "}" ]
Generates submit button @method password @param string $name Name of input (unique) @param string $value Value for input @param array|string $attributes Attributes for input @return string Input with submit type
[ "Generates", "submit", "button" ]
1d0fa09d641d994cf7d8136f4aff220342419804
https://github.com/Aurora-Framework/Helper/blob/1d0fa09d641d994cf7d8136f4aff220342419804/src/Helper/Form.php#L230-L233
235,995
yuncms/yuncms-article
backend/controllers/CategoryController.php
CategoryController.actionIndex
public function actionIndex() { $query = ArticleCategory::find()->orderBy(['sort' => SORT_ASC]); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'pagination' => false ]); return $this->render('index', [ 'dataProvider' => $dataProvider, ]); }
php
public function actionIndex() { $query = ArticleCategory::find()->orderBy(['sort' => SORT_ASC]); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'pagination' => false ]); return $this->render('index', [ 'dataProvider' => $dataProvider, ]); }
[ "public", "function", "actionIndex", "(", ")", "{", "$", "query", "=", "ArticleCategory", "::", "find", "(", ")", "->", "orderBy", "(", "[", "'sort'", "=>", "SORT_ASC", "]", ")", ";", "$", "dataProvider", "=", "new", "ActiveDataProvider", "(", "[", "'query'", "=>", "$", "query", ",", "'pagination'", "=>", "false", "]", ")", ";", "return", "$", "this", "->", "render", "(", "'index'", ",", "[", "'dataProvider'", "=>", "$", "dataProvider", ",", "]", ")", ";", "}" ]
Lists all Category models. @return mixed
[ "Lists", "all", "Category", "models", "." ]
07f19d9048aaf156b0447bbe5d3485af9c456585
https://github.com/yuncms/yuncms-article/blob/07f19d9048aaf156b0447bbe5d3485af9c456585/backend/controllers/CategoryController.php#L53-L63
235,996
ekyna/UserBundle
Entity/GroupRepository.php
GroupRepository.findOneByRole
public function findOneByRole($role) { $qb = $this->createQueryBuilder('g'); return $qb ->andWhere($qb->expr()->like('g.roles', $qb->expr()->literal('%"'.strtoupper($role).'"%'))) ->orderBy('g.position', 'DESC') ->setMaxResults(1) ->getQuery() ->getOneOrNullResult() ; }
php
public function findOneByRole($role) { $qb = $this->createQueryBuilder('g'); return $qb ->andWhere($qb->expr()->like('g.roles', $qb->expr()->literal('%"'.strtoupper($role).'"%'))) ->orderBy('g.position', 'DESC') ->setMaxResults(1) ->getQuery() ->getOneOrNullResult() ; }
[ "public", "function", "findOneByRole", "(", "$", "role", ")", "{", "$", "qb", "=", "$", "this", "->", "createQueryBuilder", "(", "'g'", ")", ";", "return", "$", "qb", "->", "andWhere", "(", "$", "qb", "->", "expr", "(", ")", "->", "like", "(", "'g.roles'", ",", "$", "qb", "->", "expr", "(", ")", "->", "literal", "(", "'%\"'", ".", "strtoupper", "(", "$", "role", ")", ".", "'\"%'", ")", ")", ")", "->", "orderBy", "(", "'g.position'", ",", "'DESC'", ")", "->", "setMaxResults", "(", "1", ")", "->", "getQuery", "(", ")", "->", "getOneOrNullResult", "(", ")", ";", "}" ]
Finds the lower privilege level group having the given role. @param string $role @return GroupInterface|null @throws \Doctrine\ORM\NonUniqueResultException
[ "Finds", "the", "lower", "privilege", "level", "group", "having", "the", "given", "role", "." ]
e38d56aee978148a312a923b9e70bdaad1a381bf
https://github.com/ekyna/UserBundle/blob/e38d56aee978148a312a923b9e70bdaad1a381bf/Entity/GroupRepository.php#L36-L47
235,997
bpolaszek/bentools-pdoextended
src/BenTools/PDOExtended/CacheHandler/ArrayCache.php
ArrayCache.exists
public function exists($key) { if (!array_key_exists($key, $this->storage)) return false; if ($this->storage[$key]['expires'] > 0 && time() > $this->storage[$key]['expires']) return false; return true; }
php
public function exists($key) { if (!array_key_exists($key, $this->storage)) return false; if ($this->storage[$key]['expires'] > 0 && time() > $this->storage[$key]['expires']) return false; return true; }
[ "public", "function", "exists", "(", "$", "key", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "storage", ")", ")", "return", "false", ";", "if", "(", "$", "this", "->", "storage", "[", "$", "key", "]", "[", "'expires'", "]", ">", "0", "&&", "time", "(", ")", ">", "$", "this", "->", "storage", "[", "$", "key", "]", "[", "'expires'", "]", ")", "return", "false", ";", "return", "true", ";", "}" ]
Checks if data exists in cache @param $key @return bool|string[]
[ "Checks", "if", "data", "exists", "in", "cache" ]
805baa1330987984ea67fd6154411edbd951ee7f
https://github.com/bpolaszek/bentools-pdoextended/blob/805baa1330987984ea67fd6154411edbd951ee7f/src/BenTools/PDOExtended/CacheHandler/ArrayCache.php#L34-L42
235,998
radphp/migrations-bundle
Library/ConfigurationTrait.php
ConfigurationTrait.getConfig
public function getConfig() { if ($this->configuration) { return $this->configuration; } $dir = APP_DIR . DS . 'Resource' . DS . 'migrations'; $migrationTable = 'phinxlog'; if ($bundleName = $this->input->getOption('bundle')) { $dir = Bundles::getPath($bundleName) . DS . 'Resource' . DS . 'migrations'; } return $this->configuration = new Config([ 'paths' => [ 'migrations' => $dir ], 'environments' => [ 'default_migration_table' => $migrationTable, 'default_database' => getenv('RAD_ENVIRONMENT'), getenv('RAD_ENVIRONMENT') => \Rad\Configure\Config::get('migrations.environments.' . getenv('RAD_ENVIRONMENT')) ] ]); }
php
public function getConfig() { if ($this->configuration) { return $this->configuration; } $dir = APP_DIR . DS . 'Resource' . DS . 'migrations'; $migrationTable = 'phinxlog'; if ($bundleName = $this->input->getOption('bundle')) { $dir = Bundles::getPath($bundleName) . DS . 'Resource' . DS . 'migrations'; } return $this->configuration = new Config([ 'paths' => [ 'migrations' => $dir ], 'environments' => [ 'default_migration_table' => $migrationTable, 'default_database' => getenv('RAD_ENVIRONMENT'), getenv('RAD_ENVIRONMENT') => \Rad\Configure\Config::get('migrations.environments.' . getenv('RAD_ENVIRONMENT')) ] ]); }
[ "public", "function", "getConfig", "(", ")", "{", "if", "(", "$", "this", "->", "configuration", ")", "{", "return", "$", "this", "->", "configuration", ";", "}", "$", "dir", "=", "APP_DIR", ".", "DS", ".", "'Resource'", ".", "DS", ".", "'migrations'", ";", "$", "migrationTable", "=", "'phinxlog'", ";", "if", "(", "$", "bundleName", "=", "$", "this", "->", "input", "->", "getOption", "(", "'bundle'", ")", ")", "{", "$", "dir", "=", "Bundles", "::", "getPath", "(", "$", "bundleName", ")", ".", "DS", ".", "'Resource'", ".", "DS", ".", "'migrations'", ";", "}", "return", "$", "this", "->", "configuration", "=", "new", "Config", "(", "[", "'paths'", "=>", "[", "'migrations'", "=>", "$", "dir", "]", ",", "'environments'", "=>", "[", "'default_migration_table'", "=>", "$", "migrationTable", ",", "'default_database'", "=>", "getenv", "(", "'RAD_ENVIRONMENT'", ")", ",", "getenv", "(", "'RAD_ENVIRONMENT'", ")", "=>", "\\", "Rad", "\\", "Configure", "\\", "Config", "::", "get", "(", "'migrations.environments.'", ".", "getenv", "(", "'RAD_ENVIRONMENT'", ")", ")", "]", "]", ")", ";", "}" ]
Overrides the original method from phinx in order to return a tailored Config object containing the connection details for the database. @return Phinx\Config\Config
[ "Overrides", "the", "original", "method", "from", "phinx", "in", "order", "to", "return", "a", "tailored", "Config", "object", "containing", "the", "connection", "details", "for", "the", "database", "." ]
5cb3cb75a4df18cf4d1fe6a6b33a281bfba73c51
https://github.com/radphp/migrations-bundle/blob/5cb3cb75a4df18cf4d1fe6a6b33a281bfba73c51/Library/ConfigurationTrait.php#L35-L58
235,999
jakecleary/ultrapress-library
src/Ultra/Helpers/PostObject.php
PostObject.image
public static function image($itemId, $size) { if(has_post_thumbnail($itemId)) { return wp_get_attachment_image_src( get_post_thumbnail_id($itemId), $size )[0]; } return false; }
php
public static function image($itemId, $size) { if(has_post_thumbnail($itemId)) { return wp_get_attachment_image_src( get_post_thumbnail_id($itemId), $size )[0]; } return false; }
[ "public", "static", "function", "image", "(", "$", "itemId", ",", "$", "size", ")", "{", "if", "(", "has_post_thumbnail", "(", "$", "itemId", ")", ")", "{", "return", "wp_get_attachment_image_src", "(", "get_post_thumbnail_id", "(", "$", "itemId", ")", ",", "$", "size", ")", "[", "0", "]", ";", "}", "return", "false", ";", "}" ]
Grab the URL for the featured image in a specific size. @param integer $itemId The item (post) ID @param string $size The image size you need @return string|boolean The image's url OR false
[ "Grab", "the", "URL", "for", "the", "featured", "image", "in", "a", "specific", "size", "." ]
84ca5d1dae8eb16de8c886787575ea41f9332ae2
https://github.com/jakecleary/ultrapress-library/blob/84ca5d1dae8eb16de8c886787575ea41f9332ae2/src/Ultra/Helpers/PostObject.php#L46-L56