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
230,900
DevGroup-ru/yii2-jstree-widget
src/actions/nestedset/NodeMoveAction.php
NodeMoveAction.getCount
protected function getCount($condition) { $class = $this->className; return $class::find() ->select(['id', $this->leftAttribute, $this->rightAttribute, $this->rootAttribute]) ->where($condition) ->count(); }
php
protected function getCount($condition) { $class = $this->className; return $class::find() ->select(['id', $this->leftAttribute, $this->rightAttribute, $this->rootAttribute]) ->where($condition) ->count(); }
[ "protected", "function", "getCount", "(", "$", "condition", ")", "{", "$", "class", "=", "$", "this", "->", "className", ";", "return", "$", "class", "::", "find", "(", ")", "->", "select", "(", "[", "'id'", ",", "$", "this", "->", "leftAttribute", "...
Returns count of records to be modified while reordering @param array $condition @return int|string
[ "Returns", "count", "of", "records", "to", "be", "modified", "while", "reordering" ]
6ae0311254eb757a13fc5c318d6a15544d84b105
https://github.com/DevGroup-ru/yii2-jstree-widget/blob/6ae0311254eb757a13fc5c318d6a15544d84b105/src/actions/nestedset/NodeMoveAction.php#L496-L503
230,901
DevGroup-ru/yii2-jstree-widget
src/actions/nestedset/NodeMoveAction.php
NodeMoveAction.applyRootCondition
protected function applyRootCondition(&$condition) { if (false !== $this->rootAttribute) { $condition[] = [$this->rootAttribute => $this->node->{$this->rootAttribute}]; } }
php
protected function applyRootCondition(&$condition) { if (false !== $this->rootAttribute) { $condition[] = [$this->rootAttribute => $this->node->{$this->rootAttribute}]; } }
[ "protected", "function", "applyRootCondition", "(", "&", "$", "condition", ")", "{", "if", "(", "false", "!==", "$", "this", "->", "rootAttribute", ")", "{", "$", "condition", "[", "]", "=", "[", "$", "this", "->", "rootAttribute", "=>", "$", "this", "...
Applies tree root condition if multi root @param $condition
[ "Applies", "tree", "root", "condition", "if", "multi", "root" ]
6ae0311254eb757a13fc5c318d6a15544d84b105
https://github.com/DevGroup-ru/yii2-jstree-widget/blob/6ae0311254eb757a13fc5c318d6a15544d84b105/src/actions/nestedset/NodeMoveAction.php#L526-L531
230,902
jpunanua/yii2-seotools
Component.php
Component.getRoute
public function getRoute() { if (is_null($this->route)) { $this->route = Yii::$app->request->getHostInfo() . '/' . Yii::$app->request->getPathInfo(); } return $this->route; }
php
public function getRoute() { if (is_null($this->route)) { $this->route = Yii::$app->request->getHostInfo() . '/' . Yii::$app->request->getPathInfo(); } return $this->route; }
[ "public", "function", "getRoute", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "route", ")", ")", "{", "$", "this", "->", "route", "=", "Yii", "::", "$", "app", "->", "request", "->", "getHostInfo", "(", ")", ".", "'/'", ".", "Yii...
Devuelve la url absoluta con el path @return string
[ "Devuelve", "la", "url", "absoluta", "con", "el", "path" ]
076c18a9ddad2db795fd2248009d9f1db1cf6033
https://github.com/jpunanua/yii2-seotools/blob/076c18a9ddad2db795fd2248009d9f1db1cf6033/Component.php#L68-L73
230,903
jpunanua/yii2-seotools
Component.php
Component.setAuthor
public function setAuthor($author) { if (!empty($author)) { Yii::$app->view->registerMetaTag(['name' => 'author', 'content' => $author], 'author'); } return $this; }
php
public function setAuthor($author) { if (!empty($author)) { Yii::$app->view->registerMetaTag(['name' => 'author', 'content' => $author], 'author'); } return $this; }
[ "public", "function", "setAuthor", "(", "$", "author", ")", "{", "if", "(", "!", "empty", "(", "$", "author", ")", ")", "{", "Yii", "::", "$", "app", "->", "view", "->", "registerMetaTag", "(", "[", "'name'", "=>", "'author'", ",", "'content'", "=>",...
Register the author meta @param string $author
[ "Register", "the", "author", "meta" ]
076c18a9ddad2db795fd2248009d9f1db1cf6033
https://github.com/jpunanua/yii2-seotools/blob/076c18a9ddad2db795fd2248009d9f1db1cf6033/Component.php#L147-L153
230,904
jpunanua/yii2-seotools
Component.php
Component.setOpenGraphType
public function setOpenGraphType($type) { if (!empty($type)) { Yii::$app->view->registerMetaTag(['name' => 'og:type', 'content' => $type], 'og:type'); } return $this; }
php
public function setOpenGraphType($type) { if (!empty($type)) { Yii::$app->view->registerMetaTag(['name' => 'og:type', 'content' => $type], 'og:type'); } return $this; }
[ "public", "function", "setOpenGraphType", "(", "$", "type", ")", "{", "if", "(", "!", "empty", "(", "$", "type", ")", ")", "{", "Yii", "::", "$", "app", "->", "view", "->", "registerMetaTag", "(", "[", "'name'", "=>", "'og:type'", ",", "'content'", "...
Register Open Graph Type meta @param string $type
[ "Register", "Open", "Graph", "Type", "meta" ]
076c18a9ddad2db795fd2248009d9f1db1cf6033
https://github.com/jpunanua/yii2-seotools/blob/076c18a9ddad2db795fd2248009d9f1db1cf6033/Component.php#L159-L165
230,905
jpunanua/yii2-seotools
Component.php
Component.setTitle
public function setTitle($title) { if (!empty($title)) { Yii::$app->view->registerMetaTag(['name' => 'title', 'content' => $title], 'title'); Yii::$app->view->registerMetaTag(['name' => 'og:title', 'content' => $title], 'og:title'); Yii::$app->view->title = $title; } return $this; }
php
public function setTitle($title) { if (!empty($title)) { Yii::$app->view->registerMetaTag(['name' => 'title', 'content' => $title], 'title'); Yii::$app->view->registerMetaTag(['name' => 'og:title', 'content' => $title], 'og:title'); Yii::$app->view->title = $title; } return $this; }
[ "public", "function", "setTitle", "(", "$", "title", ")", "{", "if", "(", "!", "empty", "(", "$", "title", ")", ")", "{", "Yii", "::", "$", "app", "->", "view", "->", "registerMetaTag", "(", "[", "'name'", "=>", "'title'", ",", "'content'", "=>", "...
Register title meta and open graph title meta @param string $title
[ "Register", "title", "meta", "and", "open", "graph", "title", "meta" ]
076c18a9ddad2db795fd2248009d9f1db1cf6033
https://github.com/jpunanua/yii2-seotools/blob/076c18a9ddad2db795fd2248009d9f1db1cf6033/Component.php#L171-L179
230,906
jpunanua/yii2-seotools
Component.php
Component.setDescription
public function setDescription($description) { if (!empty($description)) { Yii::$app->view->registerMetaTag(['name' => 'description', 'content' => $description], 'description'); Yii::$app->view->registerMetaTag(['name' => 'og:description', 'content' => $description], 'og:description'); } return $this; }
php
public function setDescription($description) { if (!empty($description)) { Yii::$app->view->registerMetaTag(['name' => 'description', 'content' => $description], 'description'); Yii::$app->view->registerMetaTag(['name' => 'og:description', 'content' => $description], 'og:description'); } return $this; }
[ "public", "function", "setDescription", "(", "$", "description", ")", "{", "if", "(", "!", "empty", "(", "$", "description", ")", ")", "{", "Yii", "::", "$", "app", "->", "view", "->", "registerMetaTag", "(", "[", "'name'", "=>", "'description'", ",", ...
Register description meta and open graph description meta @param string $description
[ "Register", "description", "meta", "and", "open", "graph", "description", "meta" ]
076c18a9ddad2db795fd2248009d9f1db1cf6033
https://github.com/jpunanua/yii2-seotools/blob/076c18a9ddad2db795fd2248009d9f1db1cf6033/Component.php#L185-L192
230,907
jpunanua/yii2-seotools
Component.php
Component.setKeywords
public function setKeywords($keywords) { if (!empty($keywords)) { Yii::$app->view->registerMetaTag(['name' => 'keywords', 'content' => $keywords], 'keywords'); } return $this; }
php
public function setKeywords($keywords) { if (!empty($keywords)) { Yii::$app->view->registerMetaTag(['name' => 'keywords', 'content' => $keywords], 'keywords'); } return $this; }
[ "public", "function", "setKeywords", "(", "$", "keywords", ")", "{", "if", "(", "!", "empty", "(", "$", "keywords", ")", ")", "{", "Yii", "::", "$", "app", "->", "view", "->", "registerMetaTag", "(", "[", "'name'", "=>", "'keywords'", ",", "'content'",...
Register keywords meta @param string $keywords
[ "Register", "keywords", "meta" ]
076c18a9ddad2db795fd2248009d9f1db1cf6033
https://github.com/jpunanua/yii2-seotools/blob/076c18a9ddad2db795fd2248009d9f1db1cf6033/Component.php#L198-L204
230,908
cygnite/framework
src/Cygnite/Console/Command/MigrationCommand.php
MigrationCommand.process
public function process() { // Migrate init - to create migration table $type = $this->argument('type'); $migration = Migrator::instance($this); $migration->getLatestMigration() ->setMigrationClassName(); if ($type == '' || $type == 'up') { $migration->updateMigration(); } else { $migration->updateMigration('down'); } $this->info('Migration Completed Successfully!'); }
php
public function process() { // Migrate init - to create migration table $type = $this->argument('type'); $migration = Migrator::instance($this); $migration->getLatestMigration() ->setMigrationClassName(); if ($type == '' || $type == 'up') { $migration->updateMigration(); } else { $migration->updateMigration('down'); } $this->info('Migration Completed Successfully!'); }
[ "public", "function", "process", "(", ")", "{", "// Migrate init - to create migration table", "$", "type", "=", "$", "this", "->", "argument", "(", "'type'", ")", ";", "$", "migration", "=", "Migrator", "::", "instance", "(", "$", "this", ")", ";", "$", "...
Execute Command To Run Migration. @return mixed|void
[ "Execute", "Command", "To", "Run", "Migration", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Console/Command/MigrationCommand.php#L83-L99
230,909
cygnite/framework
src/Cygnite/Console/Command/ControllerGeneratorCommand.php
ControllerGeneratorCommand.process
public function process() { // Your controller name $this->controller = Inflector::classify($this->argument('name')).'Controller'; // By default we will generate basic controller, if resource set then we will generate // REST-ful Resource controller $this->setControllerType(); try { $this->makeController(); } catch (\Exception $e) { throw $e; } $this->info('Controller '.$this->controller.' Generated Successfully By Cygnite Cli.'); }
php
public function process() { // Your controller name $this->controller = Inflector::classify($this->argument('name')).'Controller'; // By default we will generate basic controller, if resource set then we will generate // REST-ful Resource controller $this->setControllerType(); try { $this->makeController(); } catch (\Exception $e) { throw $e; } $this->info('Controller '.$this->controller.' Generated Successfully By Cygnite Cli.'); }
[ "public", "function", "process", "(", ")", "{", "// Your controller name", "$", "this", "->", "controller", "=", "Inflector", "::", "classify", "(", "$", "this", "->", "argument", "(", "'name'", ")", ")", ".", "'Controller'", ";", "// By default we will generate...
We will execute the controller command and generate classes. @throws \Exception @return mixed|void
[ "We", "will", "execute", "the", "controller", "command", "and", "generate", "classes", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Console/Command/ControllerGeneratorCommand.php#L87-L103
230,910
johnstevenson/winbox-args
src/Args.php
Args.escapeCommand
public static function escapeCommand(array $args, $meta = true) { $cmd = self::escape(array_shift($args), $meta, true); foreach ($args as $arg) { $cmd .= ' '.self::escape($arg, $meta); } return $cmd; }
php
public static function escapeCommand(array $args, $meta = true) { $cmd = self::escape(array_shift($args), $meta, true); foreach ($args as $arg) { $cmd .= ' '.self::escape($arg, $meta); } return $cmd; }
[ "public", "static", "function", "escapeCommand", "(", "array", "$", "args", ",", "$", "meta", "=", "true", ")", "{", "$", "cmd", "=", "self", "::", "escape", "(", "array_shift", "(", "$", "args", ")", ",", "$", "meta", ",", "true", ")", ";", "forea...
Escapes an array of arguments that make up a shell command The first argument must be the module (executable) to be invoked. @param array $args A list of arguments, with the module name first @param bool $meta Additionally escape cmd.exe meta characters @return string The escaped command line
[ "Escapes", "an", "array", "of", "arguments", "that", "make", "up", "a", "shell", "command" ]
e46a6a190e99d07933175319c112d2f5c10cc2b5
https://github.com/johnstevenson/winbox-args/blob/e46a6a190e99d07933175319c112d2f5c10cc2b5/src/Args.php#L85-L93
230,911
cygnite/framework
src/Cygnite/Cache/Storage/Redis.php
Redis.get
public function get($key) { $data = $this->connection()->get($this->prefix.$key); if (!is_null($data)) { return (is_numeric($data)) ? $data : unserialize($data); } }
php
public function get($key) { $data = $this->connection()->get($this->prefix.$key); if (!is_null($data)) { return (is_numeric($data)) ? $data : unserialize($data); } }
[ "public", "function", "get", "(", "$", "key", ")", "{", "$", "data", "=", "$", "this", "->", "connection", "(", ")", "->", "get", "(", "$", "this", "->", "prefix", ".", "$", "key", ")", ";", "if", "(", "!", "is_null", "(", "$", "data", ")", "...
Get the item from redis memory. @param $key @return int|mixed|null|string
[ "Get", "the", "item", "from", "redis", "memory", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Cache/Storage/Redis.php#L102-L109
230,912
ctbsea/phalapi-smarty
src/Smarty/sysplugins/smarty_internal_compile_shared_inheritance.php
Smarty_Internal_Compile_Shared_Inheritance.registerInit
public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) { if ($initChildSequence || !isset($compiler->_cache['inheritanceInit'])) { $compiler->registerPostCompileCallback(array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'), array($initChildSequence), 'inheritanceInit', $initChildSequence); $compiler->_cache['inheritanceInit'] = true; } }
php
public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) { if ($initChildSequence || !isset($compiler->_cache['inheritanceInit'])) { $compiler->registerPostCompileCallback(array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'), array($initChildSequence), 'inheritanceInit', $initChildSequence); $compiler->_cache['inheritanceInit'] = true; } }
[ "public", "function", "registerInit", "(", "Smarty_Internal_TemplateCompilerBase", "$", "compiler", ",", "$", "initChildSequence", "=", "false", ")", "{", "if", "(", "$", "initChildSequence", "||", "!", "isset", "(", "$", "compiler", "->", "_cache", "[", "'inher...
Register post compile callback to compile inheritance initialization code @param \Smarty_Internal_TemplateCompilerBase $compiler @param bool|false $initChildSequence if true force child template
[ "Register", "post", "compile", "callback", "to", "compile", "inheritance", "initialization", "code" ]
4d40da3e4482c0749f3cfd1605265a109a1c495f
https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_compile_shared_inheritance.php#L25-L33
230,913
ctbsea/phalapi-smarty
src/Smarty/sysplugins/smarty_internal_compile_shared_inheritance.php
Smarty_Internal_Compile_Shared_Inheritance.postCompile
static function postCompile(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) { $compiler->prefixCompiledCode .= "<?php \$_smarty_tpl->ext->_inheritance->init(\$_smarty_tpl, " . var_export($initChildSequence, true) . ");\n?>\n"; }
php
static function postCompile(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) { $compiler->prefixCompiledCode .= "<?php \$_smarty_tpl->ext->_inheritance->init(\$_smarty_tpl, " . var_export($initChildSequence, true) . ");\n?>\n"; }
[ "static", "function", "postCompile", "(", "Smarty_Internal_TemplateCompilerBase", "$", "compiler", ",", "$", "initChildSequence", "=", "false", ")", "{", "$", "compiler", "->", "prefixCompiledCode", ".=", "\"<?php \\$_smarty_tpl->ext->_inheritance->init(\\$_smarty_tpl, \"", "...
Compile inheritance initialization code as prefix @param \Smarty_Internal_TemplateCompilerBase $compiler @param bool|false $initChildSequence if true force child template
[ "Compile", "inheritance", "initialization", "code", "as", "prefix" ]
4d40da3e4482c0749f3cfd1605265a109a1c495f
https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_compile_shared_inheritance.php#L41-L45
230,914
inetprocess/libsugarcrm
src/Installer.php
Installer.deletePath
public function deletePath() { $this->getLogger()->info("Removing installation path {$this->getPath()}..."); $this->fs->remove($this->getPath()); $this->getLogger()->info("Path {$this->getPath()} was successfully removed."); }
php
public function deletePath() { $this->getLogger()->info("Removing installation path {$this->getPath()}..."); $this->fs->remove($this->getPath()); $this->getLogger()->info("Path {$this->getPath()} was successfully removed."); }
[ "public", "function", "deletePath", "(", ")", "{", "$", "this", "->", "getLogger", "(", ")", "->", "info", "(", "\"Removing installation path {$this->getPath()}...\"", ")", ";", "$", "this", "->", "fs", "->", "remove", "(", "$", "this", "->", "getPath", "(",...
Remove sugar installation path
[ "Remove", "sugar", "installation", "path" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Installer.php#L66-L71
230,915
inetprocess/libsugarcrm
src/Installer.php
Installer.runSugarInstaller
public function runSugarInstaller() { $installer_res = $this->runSubProcessInstaller(); // find the bottle message if (preg_match('/<bottle>(.*)<\/bottle>/s', $installer_res, $msg) === 1) { $this->getLogger()->info('The web installer was successfully completed.'); $this->getLogger()->info("Web installer: {$msg[1]}"); } elseif (preg_match('/Exit (.*)/s', $installer_res, $msg)) { $this->getLogger()->info("Web installer: {$msg[1]}"); throw new InstallerException( 'The web installer failed. Check your config_si.php file.' ); } else { $this->getLogger()->debug("Web installer: {$installer_res}"); throw new InstallerException( 'The web installer failed and return an unknown error. Check the install.log file on Sugar.' ); } }
php
public function runSugarInstaller() { $installer_res = $this->runSubProcessInstaller(); // find the bottle message if (preg_match('/<bottle>(.*)<\/bottle>/s', $installer_res, $msg) === 1) { $this->getLogger()->info('The web installer was successfully completed.'); $this->getLogger()->info("Web installer: {$msg[1]}"); } elseif (preg_match('/Exit (.*)/s', $installer_res, $msg)) { $this->getLogger()->info("Web installer: {$msg[1]}"); throw new InstallerException( 'The web installer failed. Check your config_si.php file.' ); } else { $this->getLogger()->debug("Web installer: {$installer_res}"); throw new InstallerException( 'The web installer failed and return an unknown error. Check the install.log file on Sugar.' ); } }
[ "public", "function", "runSugarInstaller", "(", ")", "{", "$", "installer_res", "=", "$", "this", "->", "runSubProcessInstaller", "(", ")", ";", "// find the bottle message", "if", "(", "preg_match", "(", "'/<bottle>(.*)<\\/bottle>/s'", ",", "$", "installer_res", ",...
Run the sugar install script. This doesn't require a web server.
[ "Run", "the", "sugar", "install", "script", ".", "This", "doesn", "t", "require", "a", "web", "server", "." ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Installer.php#L189-L207
230,916
inetprocess/libsugarcrm
src/Installer.php
Installer.run
public function run($force = false) { if (!is_readable($this->config)) { throw new InstallerException("Missing or unreadable config_si file {$this->config}."); } $this->getLogger()->notice("Installing SugarCRM into {$this->getPath()}..."); if ($this->fs->exists($this->getPath())) { if (!$this->fs->isEmpty($this->getPath())) { if ($force === true) { $this->deletePath(); $this->createPath(); } else { throw new InstallerException( "The target path {$this->getPath()} is not empty. " ."Use --force to remove {$this->getPath()} and its contents before installing." ); } } } else { $this->createPath(); } // At this point we should have an empty dir for path. $this->extract(); $this->copyConfigSi(); $this->runSugarInstaller(); $this->deleteConfigSi(); $this->getLogger()->notice('Installation complete.'); }
php
public function run($force = false) { if (!is_readable($this->config)) { throw new InstallerException("Missing or unreadable config_si file {$this->config}."); } $this->getLogger()->notice("Installing SugarCRM into {$this->getPath()}..."); if ($this->fs->exists($this->getPath())) { if (!$this->fs->isEmpty($this->getPath())) { if ($force === true) { $this->deletePath(); $this->createPath(); } else { throw new InstallerException( "The target path {$this->getPath()} is not empty. " ."Use --force to remove {$this->getPath()} and its contents before installing." ); } } } else { $this->createPath(); } // At this point we should have an empty dir for path. $this->extract(); $this->copyConfigSi(); $this->runSugarInstaller(); $this->deleteConfigSi(); $this->getLogger()->notice('Installation complete.'); }
[ "public", "function", "run", "(", "$", "force", "=", "false", ")", "{", "if", "(", "!", "is_readable", "(", "$", "this", "->", "config", ")", ")", "{", "throw", "new", "InstallerException", "(", "\"Missing or unreadable config_si file {$this->config}.\"", ")", ...
Run the complete installation process. @param force If true then remove install directory first.
[ "Run", "the", "complete", "installation", "process", "." ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Installer.php#L214-L241
230,917
ARCANEDEV/GeoIP
src/Cache.php
Cache.store
private function store() { return empty($this->tags) ? $this->store : $this->store->tags($this->tags); }
php
private function store() { return empty($this->tags) ? $this->store : $this->store->tags($this->tags); }
[ "private", "function", "store", "(", ")", "{", "return", "empty", "(", "$", "this", "->", "tags", ")", "?", "$", "this", "->", "store", ":", "$", "this", "->", "store", "->", "tags", "(", "$", "this", "->", "tags", ")", ";", "}" ]
Get the store instance. @return \Illuminate\Contracts\Cache\Repository
[ "Get", "the", "store", "instance", "." ]
2b7b5590cbbbb99e9d1a3a2c85ce9e39dd39b318
https://github.com/ARCANEDEV/GeoIP/blob/2b7b5590cbbbb99e9d1a3a2c85ce9e39dd39b318/src/Cache.php#L57-L60
230,918
ARCANEDEV/GeoIP
src/Cache.php
Cache.set
public function set($key, array $location) { $this->store()->put($key, $location, $this->expires); }
php
public function set($key, array $location) { $this->store()->put($key, $location, $this->expires); }
[ "public", "function", "set", "(", "$", "key", ",", "array", "$", "location", ")", "{", "$", "this", "->", "store", "(", ")", "->", "put", "(", "$", "key", ",", "$", "location", ",", "$", "this", "->", "expires", ")", ";", "}" ]
Set an item in cache. @param string $key @param array $location
[ "Set", "an", "item", "in", "cache", "." ]
2b7b5590cbbbb99e9d1a3a2c85ce9e39dd39b318
https://github.com/ARCANEDEV/GeoIP/blob/2b7b5590cbbbb99e9d1a3a2c85ce9e39dd39b318/src/Cache.php#L85-L88
230,919
ctbsea/phalapi-smarty
src/Smarty/sysplugins/smarty_internal_method_configload.php
Smarty_Internal_Method_ConfigLoad._loadConfigVars
public function _loadConfigVars(Smarty_Internal_Template $tpl, $_config_vars) { $this->_assignConfigVars($tpl->parent, $tpl, $_config_vars); $scope = $tpl->source->scope; if (!$scope && !$tpl->scope) { return; } foreach (array($scope, $tpl->scope) as $s) { $s = ($bubble_up = $s >= Smarty::SCOPE_BUBBLE_UP) ? $s - Smarty::SCOPE_BUBBLE_UP : $s; if ($bubble_up && $s) { $ptr = $tpl->parent->parent; if (isset($ptr)) { $this->_assignConfigVars($ptr, $tpl, $_config_vars); $ptr = $ptr->parent; } if ($s == Smarty::SCOPE_PARENT) { continue; } while (isset($ptr) && $ptr->_objType == 2) { $this->_assignConfigVars($ptr, $tpl, $_config_vars); $ptr = $ptr->parent; } if ($s == Smarty::SCOPE_TPL_ROOT) { continue; } elseif ($s == Smarty::SCOPE_SMARTY) { $this->_assignConfigVars($tpl->smarty, $tpl, $_config_vars); } elseif ($s == Smarty::SCOPE_GLOBAL) { $this->_assignConfigVars($tpl->smarty, $tpl, $_config_vars); } elseif ($s == Smarty::SCOPE_ROOT) { while (isset($ptr->parent)) { $ptr = $ptr->parent; } $this->_assignConfigVars($ptr, $tpl, $_config_vars); } } } }
php
public function _loadConfigVars(Smarty_Internal_Template $tpl, $_config_vars) { $this->_assignConfigVars($tpl->parent, $tpl, $_config_vars); $scope = $tpl->source->scope; if (!$scope && !$tpl->scope) { return; } foreach (array($scope, $tpl->scope) as $s) { $s = ($bubble_up = $s >= Smarty::SCOPE_BUBBLE_UP) ? $s - Smarty::SCOPE_BUBBLE_UP : $s; if ($bubble_up && $s) { $ptr = $tpl->parent->parent; if (isset($ptr)) { $this->_assignConfigVars($ptr, $tpl, $_config_vars); $ptr = $ptr->parent; } if ($s == Smarty::SCOPE_PARENT) { continue; } while (isset($ptr) && $ptr->_objType == 2) { $this->_assignConfigVars($ptr, $tpl, $_config_vars); $ptr = $ptr->parent; } if ($s == Smarty::SCOPE_TPL_ROOT) { continue; } elseif ($s == Smarty::SCOPE_SMARTY) { $this->_assignConfigVars($tpl->smarty, $tpl, $_config_vars); } elseif ($s == Smarty::SCOPE_GLOBAL) { $this->_assignConfigVars($tpl->smarty, $tpl, $_config_vars); } elseif ($s == Smarty::SCOPE_ROOT) { while (isset($ptr->parent)) { $ptr = $ptr->parent; } $this->_assignConfigVars($ptr, $tpl, $_config_vars); } } } }
[ "public", "function", "_loadConfigVars", "(", "Smarty_Internal_Template", "$", "tpl", ",", "$", "_config_vars", ")", "{", "$", "this", "->", "_assignConfigVars", "(", "$", "tpl", "->", "parent", ",", "$", "tpl", ",", "$", "_config_vars", ")", ";", "$", "sc...
load config variables into template object @param \Smarty_Internal_Template $tpl @param array $_config_vars
[ "load", "config", "variables", "into", "template", "object" ]
4d40da3e4482c0749f3cfd1605265a109a1c495f
https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_method_configload.php#L82-L118
230,920
ctbsea/phalapi-smarty
src/Smarty/sysplugins/smarty_internal_method_configload.php
Smarty_Internal_Method_ConfigLoad._assignConfigVars
public function _assignConfigVars(Smarty_Internal_Data $scope_ptr, Smarty_Internal_Template $tpl, $_config_vars) { // copy global config vars foreach ($_config_vars['vars'] as $variable => $value) { if ($tpl->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) { $scope_ptr->config_vars[$variable] = $value; } else { $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value); } } // scan sections $sections = $tpl->source->config_sections; if (!empty($sections)) { foreach ((array) $sections as $tpl_section) { if (isset($_config_vars['sections'][$tpl_section])) { foreach ($_config_vars['sections'][$tpl_section]['vars'] as $variable => $value) { if ($tpl->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) { $scope_ptr->config_vars[$variable] = $value; } else { $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value); } } } } } }
php
public function _assignConfigVars(Smarty_Internal_Data $scope_ptr, Smarty_Internal_Template $tpl, $_config_vars) { // copy global config vars foreach ($_config_vars['vars'] as $variable => $value) { if ($tpl->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) { $scope_ptr->config_vars[$variable] = $value; } else { $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value); } } // scan sections $sections = $tpl->source->config_sections; if (!empty($sections)) { foreach ((array) $sections as $tpl_section) { if (isset($_config_vars['sections'][$tpl_section])) { foreach ($_config_vars['sections'][$tpl_section]['vars'] as $variable => $value) { if ($tpl->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) { $scope_ptr->config_vars[$variable] = $value; } else { $scope_ptr->config_vars[$variable] = array_merge((array) $scope_ptr->config_vars[$variable], (array) $value); } } } } } }
[ "public", "function", "_assignConfigVars", "(", "Smarty_Internal_Data", "$", "scope_ptr", ",", "Smarty_Internal_Template", "$", "tpl", ",", "$", "_config_vars", ")", "{", "// copy global config vars", "foreach", "(", "$", "_config_vars", "[", "'vars'", "]", "as", "$...
Assign all config variables in given scope @param \Smarty_Internal_Data $scope_ptr @param \Smarty_Internal_Template $tpl @param array $_config_vars
[ "Assign", "all", "config", "variables", "in", "given", "scope" ]
4d40da3e4482c0749f3cfd1605265a109a1c495f
https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_method_configload.php#L127-L154
230,921
ctbsea/phalapi-smarty
src/Smarty/sysplugins/smarty_internal_method_configload.php
Smarty_Internal_Method_ConfigLoad._getConfigVariable
public function _getConfigVariable(Smarty_Internal_Template $tpl, $varName, $errorEnable = true) { $_ptr = $tpl; while ($_ptr !== null) { if (isset($_ptr->config_vars[$varName])) { // found it, return it return $_ptr->config_vars[$varName]; } // not found, try at parent $_ptr = $_ptr->parent; } if ($tpl->smarty->error_unassigned && $errorEnable) { // force a notice $x = $$varName; } return null; }
php
public function _getConfigVariable(Smarty_Internal_Template $tpl, $varName, $errorEnable = true) { $_ptr = $tpl; while ($_ptr !== null) { if (isset($_ptr->config_vars[$varName])) { // found it, return it return $_ptr->config_vars[$varName]; } // not found, try at parent $_ptr = $_ptr->parent; } if ($tpl->smarty->error_unassigned && $errorEnable) { // force a notice $x = $$varName; } return null; }
[ "public", "function", "_getConfigVariable", "(", "Smarty_Internal_Template", "$", "tpl", ",", "$", "varName", ",", "$", "errorEnable", "=", "true", ")", "{", "$", "_ptr", "=", "$", "tpl", ";", "while", "(", "$", "_ptr", "!==", "null", ")", "{", "if", "...
gets a config variable value @param \Smarty_Internal_Template $tpl template object @param string $varName the name of the config variable @param bool $errorEnable @return mixed the value of the config variable
[ "gets", "a", "config", "variable", "value" ]
4d40da3e4482c0749f3cfd1605265a109a1c495f
https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_method_configload.php#L165-L181
230,922
jpunanua/yii2-seotools
controllers/ManageController.php
ManageController.actionCreate
public function actionCreate() { $model = new Meta(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id_meta]); } else { return $this->render('create', [ 'model' => $model, ]); } }
php
public function actionCreate() { $model = new Meta(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id_meta]); } else { return $this->render('create', [ 'model' => $model, ]); } }
[ "public", "function", "actionCreate", "(", ")", "{", "$", "model", "=", "new", "Meta", "(", ")", ";", "if", "(", "$", "model", "->", "load", "(", "Yii", "::", "$", "app", "->", "request", "->", "post", "(", ")", ")", "&&", "$", "model", "->", "...
Creates a new MetaBase model. If creation is successful, the browser will be redirected to the 'view' page. @return mixed
[ "Creates", "a", "new", "MetaBase", "model", ".", "If", "creation", "is", "successful", "the", "browser", "will", "be", "redirected", "to", "the", "view", "page", "." ]
076c18a9ddad2db795fd2248009d9f1db1cf6033
https://github.com/jpunanua/yii2-seotools/blob/076c18a9ddad2db795fd2248009d9f1db1cf6033/controllers/ManageController.php#L80-L91
230,923
cygnite/framework
src/Cygnite/Database/Table/Schema.php
Schema.on
public function on($connection) { $this->setDatabase($connection); $this->_connection = null; $this->setDatabaseConnection($this->getDatabase()); return $this; }
php
public function on($connection) { $this->setDatabase($connection); $this->_connection = null; $this->setDatabaseConnection($this->getDatabase()); return $this; }
[ "public", "function", "on", "(", "$", "connection", ")", "{", "$", "this", "->", "setDatabase", "(", "$", "connection", ")", ";", "$", "this", "->", "_connection", "=", "null", ";", "$", "this", "->", "setDatabaseConnection", "(", "$", "this", "->", "g...
Set the connection object. @param $connection @return $this
[ "Set", "the", "connection", "object", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Table/Schema.php#L112-L120
230,924
cygnite/framework
src/Cygnite/Database/Table/Schema.php
Schema.make
public static function make($table, Closure $closure) { if (is_array($table)) { $table = isset($table['table']) ? $table['table'] : $table; $database = isset($table['database']) ? $table['database'] : null; $schema = new static($table, $database); } else { $schema = new static($table); } $callback = $closure($schema); /* | Set database connection name */ $schema->on($schema->getDatabase()); $schema->run(); return $callback; }
php
public static function make($table, Closure $closure) { if (is_array($table)) { $table = isset($table['table']) ? $table['table'] : $table; $database = isset($table['database']) ? $table['database'] : null; $schema = new static($table, $database); } else { $schema = new static($table); } $callback = $closure($schema); /* | Set database connection name */ $schema->on($schema->getDatabase()); $schema->run(); return $callback; }
[ "public", "static", "function", "make", "(", "$", "table", ",", "Closure", "$", "closure", ")", "{", "if", "(", "is_array", "(", "$", "table", ")", ")", "{", "$", "table", "=", "isset", "(", "$", "table", "[", "'table'", "]", ")", "?", "$", "tabl...
Create database schema and return the schema instance. @param $table @param callable $closure @return mixed
[ "Create", "database", "schema", "and", "return", "the", "schema", "instance", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Table/Schema.php#L168-L186
230,925
cygnite/framework
src/Cygnite/Database/Table/Schema.php
Schema.drop
public function drop($table = '') { $tableName = ''; $tableName = ($table !== '') ? $table : $this->tableName; $this->schema = strtoupper(__FUNCTION__).' TABLE IF EXISTS `'.$this->database.'`.`'.$tableName.'`'.PHP_EOL; return $this; }
php
public function drop($table = '') { $tableName = ''; $tableName = ($table !== '') ? $table : $this->tableName; $this->schema = strtoupper(__FUNCTION__).' TABLE IF EXISTS `'.$this->database.'`.`'.$tableName.'`'.PHP_EOL; return $this; }
[ "public", "function", "drop", "(", "$", "table", "=", "''", ")", "{", "$", "tableName", "=", "''", ";", "$", "tableName", "=", "(", "$", "table", "!==", "''", ")", "?", "$", "table", ":", "$", "this", "->", "tableName", ";", "$", "this", "->", ...
Drop table if exists. @param string $table @return $this
[ "Drop", "table", "if", "exists", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Table/Schema.php#L315-L326
230,926
cygnite/framework
src/Cygnite/Database/Table/Schema.php
Schema.rename
public function rename($tableNames = []) { $schema = ''; $schema .= strtoupper(__FUNCTION__).' TABLE '.PHP_EOL; if (is_array($tableNames)) { $i = 0; $arrCount = count($tableNames); foreach ($tableNames as $key => $value) { $schema .= '`'.$key.'` TO `'.$value.'`'; $comma = ($i < $arrCount - 1) ? ',' : ''; $schema .= $comma.PHP_EOL; $i++; } } else { $schema .= '`'.$this->database.'.`'.$this->tableName.'` TO `'.$tableNames.'`'.PHP_EOL; } $this->schema = $schema; return $this; }
php
public function rename($tableNames = []) { $schema = ''; $schema .= strtoupper(__FUNCTION__).' TABLE '.PHP_EOL; if (is_array($tableNames)) { $i = 0; $arrCount = count($tableNames); foreach ($tableNames as $key => $value) { $schema .= '`'.$key.'` TO `'.$value.'`'; $comma = ($i < $arrCount - 1) ? ',' : ''; $schema .= $comma.PHP_EOL; $i++; } } else { $schema .= '`'.$this->database.'.`'.$this->tableName.'` TO `'.$tableNames.'`'.PHP_EOL; } $this->schema = $schema; return $this; }
[ "public", "function", "rename", "(", "$", "tableNames", "=", "[", "]", ")", "{", "$", "schema", "=", "''", ";", "$", "schema", ".=", "strtoupper", "(", "__FUNCTION__", ")", ".", "' TABLE '", ".", "PHP_EOL", ";", "if", "(", "is_array", "(", "$", "tabl...
Rename the database table. @param array|string $tableNames @return this pointer
[ "Rename", "the", "database", "table", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Table/Schema.php#L335-L360
230,927
cygnite/framework
src/Cygnite/Database/Table/Schema.php
Schema.hasTable
public function hasTable($table = '') { $tableName = ''; $tableName = ($table !== '') ? $table : $this->tableName; $this->schema = "SHOW TABLES LIKE '".$tableName."'"; $this->checkSchemaExistence = true; return $this; }
php
public function hasTable($table = '') { $tableName = ''; $tableName = ($table !== '') ? $table : $this->tableName; $this->schema = "SHOW TABLES LIKE '".$tableName."'"; $this->checkSchemaExistence = true; return $this; }
[ "public", "function", "hasTable", "(", "$", "table", "=", "''", ")", "{", "$", "tableName", "=", "''", ";", "$", "tableName", "=", "(", "$", "table", "!==", "''", ")", "?", "$", "table", ":", "$", "this", "->", "tableName", ";", "$", "this", "->"...
Check table Existence. @param string $table @return $this
[ "Check", "table", "Existence", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Table/Schema.php#L369-L380
230,928
cygnite/framework
src/Cygnite/Database/Table/Schema.php
Schema.hasColumn
public function hasColumn($column) { $this->schema = self::SELECT.' COUNT(COLUMN_NAME) FROM '.$this->getSchemaQuery()." AND COLUMN_NAME = '".$column."' "; $this->checkSchemaExistence = true; return $this; }
php
public function hasColumn($column) { $this->schema = self::SELECT.' COUNT(COLUMN_NAME) FROM '.$this->getSchemaQuery()." AND COLUMN_NAME = '".$column."' "; $this->checkSchemaExistence = true; return $this; }
[ "public", "function", "hasColumn", "(", "$", "column", ")", "{", "$", "this", "->", "schema", "=", "self", "::", "SELECT", ".", "' COUNT(COLUMN_NAME) FROM\n '", ".", "$", "this", "->", "getSchemaQuery", "(", ")", ".", "\"\n ...
Check if column exists. @param $column @return $this
[ "Check", "if", "column", "exists", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Table/Schema.php#L524-L533
230,929
cygnite/framework
src/Cygnite/Database/Table/Schema.php
Schema.addPrimaryKey
public function addPrimaryKey($columns) { $schema = self::SELECT.' EXISTS ( '.self::SELECT.' * FROM '.$this->_informationSchema.'.COLUMNS WHERE '.$this->_tableSchema."= '".$this->database."' AND TABLE_NAME ='".$this->tableName."' AND COLUMN_KEY = 'PRI' ) AS has_primary_key;"; $hasPrimaryKey = $this->_connection->prepare($schema)->execute(); if ($hasPrimaryKey === true) { $query = ''; $query = self::ALTER_TABLE.'`'.$this->tableName.'` CHANGE `'.$this->primaryKey.'` `'.$this->primaryKey.'` INT( 11 ) NOT NULL'; $primaryKey = $this->_connection->prepare($query)->execute(); $schemaString = ''; $schemaString = $this->commands($columns); $this->schema = static::ALTER_TABLE.' `'.$this->database.'`.`'.$this->tableName.'` DROP PRIMARY KEY, ADD CONSTRAINT PK_'.strtoupper($this->tableName).'_ID PRIMARY KEY ('.$schemaString.')'; } else { $this->schema = static::ALTER_TABLE.' `'.$this->database.'`.`'.$this->tableName.'` ADD '.'PRIMARY KEY ('.$columns.')'; } return $this; }
php
public function addPrimaryKey($columns) { $schema = self::SELECT.' EXISTS ( '.self::SELECT.' * FROM '.$this->_informationSchema.'.COLUMNS WHERE '.$this->_tableSchema."= '".$this->database."' AND TABLE_NAME ='".$this->tableName."' AND COLUMN_KEY = 'PRI' ) AS has_primary_key;"; $hasPrimaryKey = $this->_connection->prepare($schema)->execute(); if ($hasPrimaryKey === true) { $query = ''; $query = self::ALTER_TABLE.'`'.$this->tableName.'` CHANGE `'.$this->primaryKey.'` `'.$this->primaryKey.'` INT( 11 ) NOT NULL'; $primaryKey = $this->_connection->prepare($query)->execute(); $schemaString = ''; $schemaString = $this->commands($columns); $this->schema = static::ALTER_TABLE.' `'.$this->database.'`.`'.$this->tableName.'` DROP PRIMARY KEY, ADD CONSTRAINT PK_'.strtoupper($this->tableName).'_ID PRIMARY KEY ('.$schemaString.')'; } else { $this->schema = static::ALTER_TABLE.' `'.$this->database.'`.`'.$this->tableName.'` ADD '.'PRIMARY KEY ('.$columns.')'; } return $this; }
[ "public", "function", "addPrimaryKey", "(", "$", "columns", ")", "{", "$", "schema", "=", "self", "::", "SELECT", ".", "' EXISTS\n (\n '", ".", "self", "::", "SELECT", ".", "' * FROM '", ".", "$", "this", "->", "_information...
String for single column and array for multiple column. @param $columns @return $this
[ "String", "for", "single", "column", "and", "array", "for", "multiple", "column", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Table/Schema.php#L542-L573
230,930
cygnite/framework
src/Cygnite/Database/Table/Schema.php
Schema.unique
public function unique($column, $keyConstraint = '') { $alter = ''; $alter = static::ALTER_TABLE.' `'.$this->tableName.'` ADD '; if (is_array($column)) { // build query unique key for multiple columns $columns = $this->commands($column); $this->schema = $alter.' CONSTRAINT UC_'.strtoupper($this->tableName).'_'.strtoupper($keyConstraint).'_ID '.strtoupper(__FUNCTION__).' ('.$columns.')'; } if (is_string($column)) { $this->schema = $alter.' '.strtoupper(__FUNCTION__).' ('.$column.');'; } return $this; }
php
public function unique($column, $keyConstraint = '') { $alter = ''; $alter = static::ALTER_TABLE.' `'.$this->tableName.'` ADD '; if (is_array($column)) { // build query unique key for multiple columns $columns = $this->commands($column); $this->schema = $alter.' CONSTRAINT UC_'.strtoupper($this->tableName).'_'.strtoupper($keyConstraint).'_ID '.strtoupper(__FUNCTION__).' ('.$columns.')'; } if (is_string($column)) { $this->schema = $alter.' '.strtoupper(__FUNCTION__).' ('.$column.');'; } return $this; }
[ "public", "function", "unique", "(", "$", "column", ",", "$", "keyConstraint", "=", "''", ")", "{", "$", "alter", "=", "''", ";", "$", "alter", "=", "static", "::", "ALTER_TABLE", ".", "' `'", ".", "$", "this", "->", "tableName", ".", "'` ADD '", ";"...
Create unique key index. @param $column @param string $keyConstraint @return $this
[ "Create", "unique", "key", "index", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Table/Schema.php#L622-L641
230,931
cygnite/framework
src/Cygnite/Database/Table/Schema.php
Schema.dropUnique
public function dropUnique($keyConstraint = '') { // ALTER TABLE Persons DROP CONSTRAINT uc_PersonID // MYSQL QUERY $this->schema = static::ALTER_TABLE.' `'.$this->tableName.'` DROP INDEX UC_'.strtoupper($this->tableName).'_'.strtoupper($keyConstraint).'_ID'; return $this; }
php
public function dropUnique($keyConstraint = '') { // ALTER TABLE Persons DROP CONSTRAINT uc_PersonID // MYSQL QUERY $this->schema = static::ALTER_TABLE.' `'.$this->tableName.'` DROP INDEX UC_'.strtoupper($this->tableName).'_'.strtoupper($keyConstraint).'_ID'; return $this; }
[ "public", "function", "dropUnique", "(", "$", "keyConstraint", "=", "''", ")", "{", "// ALTER TABLE Persons DROP CONSTRAINT uc_PersonID", "// MYSQL QUERY", "$", "this", "->", "schema", "=", "static", "::", "ALTER_TABLE", ".", "' `'", ".", "$", "this", "->", "table...
Drop unique key index. @param string $keyConstraint @return $this
[ "Drop", "unique", "key", "index", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Table/Schema.php#L650-L659
230,932
cygnite/framework
src/Cygnite/Database/Table/Schema.php
Schema.index
public function index($columnName, $indexName = '') { $indexName = ($indexName !== '') ? $indexName : $columnName; $this->schema = 'CREATE INDEX '.strtoupper($indexName).'_INDEX ON `'.$this->tableName.'` ('.$columnName.')'; return $this; }
php
public function index($columnName, $indexName = '') { $indexName = ($indexName !== '') ? $indexName : $columnName; $this->schema = 'CREATE INDEX '.strtoupper($indexName).'_INDEX ON `'.$this->tableName.'` ('.$columnName.')'; return $this; }
[ "public", "function", "index", "(", "$", "columnName", ",", "$", "indexName", "=", "''", ")", "{", "$", "indexName", "=", "(", "$", "indexName", "!==", "''", ")", "?", "$", "indexName", ":", "$", "columnName", ";", "$", "this", "->", "schema", "=", ...
Create index for the column. @param $columnName @param string $indexName @return $this
[ "Create", "index", "for", "the", "column", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Table/Schema.php#L669-L676
230,933
cygnite/framework
src/Cygnite/Database/Table/Schema.php
Schema.dropIndex
public function dropIndex($indexName) { $this->schema = static::ALTER_TABLE.' `'.$this->tableName.'` DROP INDEX '.strtoupper($indexName).'_INDEX'; return $this; }
php
public function dropIndex($indexName) { $this->schema = static::ALTER_TABLE.' `'.$this->tableName.'` DROP INDEX '.strtoupper($indexName).'_INDEX'; return $this; }
[ "public", "function", "dropIndex", "(", "$", "indexName", ")", "{", "$", "this", "->", "schema", "=", "static", "::", "ALTER_TABLE", ".", "' `'", ".", "$", "this", "->", "tableName", ".", "'`\n DROP INDEX '", ".", "strtoupper", "(", "$", "indexNam...
Drop index from the column. @param $indexName @return $this
[ "Drop", "index", "from", "the", "column", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Table/Schema.php#L685-L691
230,934
cygnite/framework
src/Cygnite/Database/Table/Schema.php
Schema.run
public function run() { if (is_object($this->connection())) { try { $stmt = $this->connection()->prepare($this->schema); if ($this->checkSchemaExistence) { return $stmt->rowCount(); } elseif ($return = $stmt->execute()) { return $return; } else { return false; } } catch (\PDOException $e) { throw new \Exception($e->getMessage()); } } }
php
public function run() { if (is_object($this->connection())) { try { $stmt = $this->connection()->prepare($this->schema); if ($this->checkSchemaExistence) { return $stmt->rowCount(); } elseif ($return = $stmt->execute()) { return $return; } else { return false; } } catch (\PDOException $e) { throw new \Exception($e->getMessage()); } } }
[ "public", "function", "run", "(", ")", "{", "if", "(", "is_object", "(", "$", "this", "->", "connection", "(", ")", ")", ")", "{", "try", "{", "$", "stmt", "=", "$", "this", "->", "connection", "(", ")", "->", "prepare", "(", "$", "this", "->", ...
Build schema and return result set. @throws \Exception @return bool
[ "Build", "schema", "and", "return", "result", "set", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Table/Schema.php#L761-L778
230,935
AppShed/extension-api
src/AppShed/Remote/XML/DOMDocument.php
DOMDocument.createElement
public function createElement($tag, $attributes = null) { $node = parent::createElement($tag); $text = false; if (is_string($attributes)) { $node->setAttribute('class', $attributes); } else { if (is_array($attributes)) { foreach ($attributes as $key => $value) { if ($key == 'text') { $node->appendChild($this->createTextNode($value)); $text = true; } else { if (!is_null($value)) { $node->setAttribute($key, $value); } } } } } if (!$text && !in_array($tag, ['img', 'br', 'input'])) { $node->appendChild($this->createTextNode('')); } return $node; }
php
public function createElement($tag, $attributes = null) { $node = parent::createElement($tag); $text = false; if (is_string($attributes)) { $node->setAttribute('class', $attributes); } else { if (is_array($attributes)) { foreach ($attributes as $key => $value) { if ($key == 'text') { $node->appendChild($this->createTextNode($value)); $text = true; } else { if (!is_null($value)) { $node->setAttribute($key, $value); } } } } } if (!$text && !in_array($tag, ['img', 'br', 'input'])) { $node->appendChild($this->createTextNode('')); } return $node; }
[ "public", "function", "createElement", "(", "$", "tag", ",", "$", "attributes", "=", "null", ")", "{", "$", "node", "=", "parent", "::", "createElement", "(", "$", "tag", ")", ";", "$", "text", "=", "false", ";", "if", "(", "is_string", "(", "$", "...
Create a new domelement with either a class or array of attributes given @param string $tag @param string|array $attributes if its a string it will be the class attribute @return \DOMElement
[ "Create", "a", "new", "domelement", "with", "either", "a", "class", "or", "array", "of", "attributes", "given" ]
c030f489e419cc5240f6e48b828b9349bb27cfaf
https://github.com/AppShed/extension-api/blob/c030f489e419cc5240f6e48b828b9349bb27cfaf/src/AppShed/Remote/XML/DOMDocument.php#L28-L52
230,936
inetprocess/libsugarcrm
src/Team.php
Team.getTeamsFromTeamSet
public function getTeamsFromTeamSet($teamSetId) { require_once('modules/Teams/TeamSetManager.php'); $teams = \TeamSetManager::getTeamsFromSet($teamSetId); // Fetch more details from the team foreach ($teams as $key => $team) { $teamFields = $this->sugarBean->getBean('Teams', $team['id'])->fetched_row; $teams[$key] = array_merge($team, $teamFields); } return $teams; }
php
public function getTeamsFromTeamSet($teamSetId) { require_once('modules/Teams/TeamSetManager.php'); $teams = \TeamSetManager::getTeamsFromSet($teamSetId); // Fetch more details from the team foreach ($teams as $key => $team) { $teamFields = $this->sugarBean->getBean('Teams', $team['id'])->fetched_row; $teams[$key] = array_merge($team, $teamFields); } return $teams; }
[ "public", "function", "getTeamsFromTeamSet", "(", "$", "teamSetId", ")", "{", "require_once", "(", "'modules/Teams/TeamSetManager.php'", ")", ";", "$", "teams", "=", "\\", "TeamSetManager", "::", "getTeamsFromSet", "(", "$", "teamSetId", ")", ";", "// Fetch more det...
Returns an array of teams from a team set id @param string $teamSetId UUID from SugarCRM. @return array List of teams with metadata
[ "Returns", "an", "array", "of", "teams", "from", "a", "team", "set", "id" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Team.php#L60-L72
230,937
inetprocess/libsugarcrm
src/Team.php
Team.getTeamMembers
public function getTeamMembers($teamId) { $team = $this->sugarBean->getBean('Teams', $teamId); $users = $team->get_team_members(); foreach ($users as $key => $user) { $users[$key] = $user->fetched_row; } return $users; }
php
public function getTeamMembers($teamId) { $team = $this->sugarBean->getBean('Teams', $teamId); $users = $team->get_team_members(); foreach ($users as $key => $user) { $users[$key] = $user->fetched_row; } return $users; }
[ "public", "function", "getTeamMembers", "(", "$", "teamId", ")", "{", "$", "team", "=", "$", "this", "->", "sugarBean", "->", "getBean", "(", "'Teams'", ",", "$", "teamId", ")", ";", "$", "users", "=", "$", "team", "->", "get_team_members", "(", ")", ...
Returns an array of members from a team @param string $teamId UUID from SugarCRM. @return array List of users with metadata
[ "Returns", "an", "array", "of", "members", "from", "a", "team" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Team.php#L81-L91
230,938
inetprocess/libsugarcrm
src/Database/AbstractTablesDiff.php
AbstractTablesDiff.diff
public function diff($base, $new, $mode = self::DIFF_ALL, array $field_ids = array()) { if (!empty($field_ids)) { $field_ids = array_flip($field_ids); $base = array_intersect_key($base, $field_ids); $new = array_intersect_key($new, $field_ids); } $res = array( self::ADD => array(), self::DEL => array(), self::UPDATE => array() ); if ($mode & self::DIFF_ADD) { $res[self::ADD] = array_diff_key($new, $base); } if ($mode & self::DIFF_DEL) { $res[self::DEL] = array_diff_key($base, $new); } if ($mode & self::DIFF_UPDATE) { // Update array will have common fields with different data. $common = array_intersect_key($new, $base); foreach ($common as $key => $newData) { $new_data = array_diff_assoc($newData, $base[$key]); if (!empty($new_data)) { $res[self::UPDATE][$key][self::BASE] = $base[$key]; $res[self::UPDATE][$key][self::MODIFIED] = $new_data; } } } return $res; }
php
public function diff($base, $new, $mode = self::DIFF_ALL, array $field_ids = array()) { if (!empty($field_ids)) { $field_ids = array_flip($field_ids); $base = array_intersect_key($base, $field_ids); $new = array_intersect_key($new, $field_ids); } $res = array( self::ADD => array(), self::DEL => array(), self::UPDATE => array() ); if ($mode & self::DIFF_ADD) { $res[self::ADD] = array_diff_key($new, $base); } if ($mode & self::DIFF_DEL) { $res[self::DEL] = array_diff_key($base, $new); } if ($mode & self::DIFF_UPDATE) { // Update array will have common fields with different data. $common = array_intersect_key($new, $base); foreach ($common as $key => $newData) { $new_data = array_diff_assoc($newData, $base[$key]); if (!empty($new_data)) { $res[self::UPDATE][$key][self::BASE] = $base[$key]; $res[self::UPDATE][$key][self::MODIFIED] = $new_data; } } } return $res; }
[ "public", "function", "diff", "(", "$", "base", ",", "$", "new", ",", "$", "mode", "=", "self", "::", "DIFF_ALL", ",", "array", "$", "field_ids", "=", "array", "(", ")", ")", "{", "if", "(", "!", "empty", "(", "$", "field_ids", ")", ")", "{", "...
Compute the difference between two metadata arrays. @param $base Base or old array. @param $new New array with new definitions. @param $add If true find new fields. Default: true @param $del If true find fields to delete. Default: true @param $update if true find modified fields; Default: true @param $field_ids Array for field name to filter the results. @return array Return a 3-row array for add, del and update fields.
[ "Compute", "the", "difference", "between", "two", "metadata", "arrays", "." ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Database/AbstractTablesDiff.php#L114-L145
230,939
inetprocess/libsugarcrm
src/Database/AbstractTablesDiff.php
AbstractTablesDiff.createUpdateQuery
public function createUpdateQuery(array $field_data) { return $this->getQueryFactory() ->createUpdateQuery($this->tableName, $field_data[self::BASE]['id'], $field_data[self::MODIFIED]); }
php
public function createUpdateQuery(array $field_data) { return $this->getQueryFactory() ->createUpdateQuery($this->tableName, $field_data[self::BASE]['id'], $field_data[self::MODIFIED]); }
[ "public", "function", "createUpdateQuery", "(", "array", "$", "field_data", ")", "{", "return", "$", "this", "->", "getQueryFactory", "(", ")", "->", "createUpdateQuery", "(", "$", "this", "->", "tableName", ",", "$", "field_data", "[", "self", "::", "BASE",...
Build query to update fields.
[ "Build", "query", "to", "update", "fields", "." ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Database/AbstractTablesDiff.php#L168-L172
230,940
inetprocess/libsugarcrm
src/Database/AbstractTablesDiff.php
AbstractTablesDiff.generateQueries
public function generateQueries(array $diff_res) { $queries = array(); foreach ($diff_res[self::ADD] as $new_field) { $queries[] = $this->createAddQuery($new_field); } foreach ($diff_res[self::DEL] as $del_field) { $queries[] = $this->createDeleteQuery($del_field); } foreach ($diff_res[self::UPDATE] as $mod_field) { $queries[] = $this->createUpdateQuery($mod_field); } return $queries; }
php
public function generateQueries(array $diff_res) { $queries = array(); foreach ($diff_res[self::ADD] as $new_field) { $queries[] = $this->createAddQuery($new_field); } foreach ($diff_res[self::DEL] as $del_field) { $queries[] = $this->createDeleteQuery($del_field); } foreach ($diff_res[self::UPDATE] as $mod_field) { $queries[] = $this->createUpdateQuery($mod_field); } return $queries; }
[ "public", "function", "generateQueries", "(", "array", "$", "diff_res", ")", "{", "$", "queries", "=", "array", "(", ")", ";", "foreach", "(", "$", "diff_res", "[", "self", "::", "ADD", "]", "as", "$", "new_field", ")", "{", "$", "queries", "[", "]",...
Get the queries for a diff result
[ "Get", "the", "queries", "for", "a", "diff", "result" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Database/AbstractTablesDiff.php#L185-L198
230,941
inetprocess/libsugarcrm
src/Database/AbstractTablesDiff.php
AbstractTablesDiff.generateSqlQueries
public function generateSqlQueries(array $diff_res) { $queries = $this->generateQueries($diff_res); $sql = ''; foreach ($queries as $query) { $sql .= $this->getSqlQuery($query) . ";\n"; } return $sql; }
php
public function generateSqlQueries(array $diff_res) { $queries = $this->generateQueries($diff_res); $sql = ''; foreach ($queries as $query) { $sql .= $this->getSqlQuery($query) . ";\n"; } return $sql; }
[ "public", "function", "generateSqlQueries", "(", "array", "$", "diff_res", ")", "{", "$", "queries", "=", "$", "this", "->", "generateQueries", "(", "$", "diff_res", ")", ";", "$", "sql", "=", "''", ";", "foreach", "(", "$", "queries", "as", "$", "quer...
Get the all the sql queries for a diff result.
[ "Get", "the", "all", "the", "sql", "queries", "for", "a", "diff", "result", "." ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Database/AbstractTablesDiff.php#L203-L211
230,942
inetprocess/libsugarcrm
src/Database/AbstractTablesDiff.php
AbstractTablesDiff.executeQueries
public function executeQueries(array $diff_res) { $this->getLogger()->debug('Running sql queries.'); $queries = $this->generateQueries($diff_res); foreach ($queries as $query) { $query->execute(); } }
php
public function executeQueries(array $diff_res) { $this->getLogger()->debug('Running sql queries.'); $queries = $this->generateQueries($diff_res); foreach ($queries as $query) { $query->execute(); } }
[ "public", "function", "executeQueries", "(", "array", "$", "diff_res", ")", "{", "$", "this", "->", "getLogger", "(", ")", "->", "debug", "(", "'Running sql queries.'", ")", ";", "$", "queries", "=", "$", "this", "->", "generateQueries", "(", "$", "diff_re...
Execute DB queries for a diff result
[ "Execute", "DB", "queries", "for", "a", "diff", "result" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Database/AbstractTablesDiff.php#L216-L223
230,943
inetprocess/libsugarcrm
src/Database/AbstractTablesDiff.php
AbstractTablesDiff.getMergedData
public function getMergedData(array $base, array $diff_res) { $res = $base + $diff_res[self::ADD]; $res = array_diff_key($res, $diff_res[self::DEL]); foreach ($diff_res[self::UPDATE] as $field_id => $values) { $new_values = array_merge($values[self::BASE], $values[self::MODIFIED]); $res[$field_id] = $new_values; } return $res; }
php
public function getMergedData(array $base, array $diff_res) { $res = $base + $diff_res[self::ADD]; $res = array_diff_key($res, $diff_res[self::DEL]); foreach ($diff_res[self::UPDATE] as $field_id => $values) { $new_values = array_merge($values[self::BASE], $values[self::MODIFIED]); $res[$field_id] = $new_values; } return $res; }
[ "public", "function", "getMergedData", "(", "array", "$", "base", ",", "array", "$", "diff_res", ")", "{", "$", "res", "=", "$", "base", "+", "$", "diff_res", "[", "self", "::", "ADD", "]", ";", "$", "res", "=", "array_diff_key", "(", "$", "res", "...
Merge base metadata array with modifications from diff result
[ "Merge", "base", "metadata", "array", "with", "modifications", "from", "diff", "result" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Database/AbstractTablesDiff.php#L228-L237
230,944
inetprocess/libsugarcrm
src/Database/AbstractTablesDiff.php
AbstractTablesDiff.writeFile
public function writeFile(array $diff_res) { $base = array(); if (is_readable($this->defFile)) { $base = $this->loadFromFile(); } $merged_data = $this->getMergedData($base, $diff_res); ksort($merged_data); $yaml = Yaml::dump(array_values($merged_data)); if (@file_put_contents($this->defFile, $yaml) === false) { throw new SugarException("Unable to dump metadata file to {$this->defFile}."); } }
php
public function writeFile(array $diff_res) { $base = array(); if (is_readable($this->defFile)) { $base = $this->loadFromFile(); } $merged_data = $this->getMergedData($base, $diff_res); ksort($merged_data); $yaml = Yaml::dump(array_values($merged_data)); if (@file_put_contents($this->defFile, $yaml) === false) { throw new SugarException("Unable to dump metadata file to {$this->defFile}."); } }
[ "public", "function", "writeFile", "(", "array", "$", "diff_res", ")", "{", "$", "base", "=", "array", "(", ")", ";", "if", "(", "is_readable", "(", "$", "this", "->", "defFile", ")", ")", "{", "$", "base", "=", "$", "this", "->", "loadFromFile", "...
Write to file
[ "Write", "to", "file" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Database/AbstractTablesDiff.php#L242-L254
230,945
cygnite/framework
src/Cygnite/Foundation/Bootstrappers/ViewBootstraper.php
ViewBootstraper.run
public function run() { // Configure view & widget class. ViewFactory::make(\Cygnite\Mvc\View\View::class, $this->container, function ($v) { $v->setContainer($this->container); // Configure widget and register into container. $widget = new \Cygnite\Mvc\View\Widget($this->paths, $v->getOutput()); $this->container->set('widget', $widget); }); }
php
public function run() { // Configure view & widget class. ViewFactory::make(\Cygnite\Mvc\View\View::class, $this->container, function ($v) { $v->setContainer($this->container); // Configure widget and register into container. $widget = new \Cygnite\Mvc\View\Widget($this->paths, $v->getOutput()); $this->container->set('widget', $widget); }); }
[ "public", "function", "run", "(", ")", "{", "// Configure view & widget class.", "ViewFactory", "::", "make", "(", "\\", "Cygnite", "\\", "Mvc", "\\", "View", "\\", "View", "::", "class", ",", "$", "this", "->", "container", ",", "function", "(", "$", "v",...
Create, configure view and store view instance in container
[ "Create", "configure", "view", "and", "store", "view", "instance", "in", "container" ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Foundation/Bootstrappers/ViewBootstraper.php#L40-L50
230,946
cygnite/framework
src/Cygnite/Common/SessionManager/Manager.php
Manager.get
public function get($key = null, $default = null) { if ($key === null) { return $this->all(); } return $this->getStackReference($this->storage, explode(self::SEPARATOR, $key), $default); }
php
public function get($key = null, $default = null) { if ($key === null) { return $this->all(); } return $this->getStackReference($this->storage, explode(self::SEPARATOR, $key), $default); }
[ "public", "function", "get", "(", "$", "key", "=", "null", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "key", "===", "null", ")", "{", "return", "$", "this", "->", "all", "(", ")", ";", "}", "return", "$", "this", "->", "getStac...
Get value from the storage if exists. @param string $key @param mixed $default @return mixed
[ "Get", "value", "from", "the", "storage", "if", "exists", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/SessionManager/Manager.php#L31-L38
230,947
cygnite/framework
src/Cygnite/Common/SessionManager/Manager.php
Manager.set
public function set($key, $value = null) { if ($key === null) { array_push($this->storage, $value); return $this; } if (is_array($key)) { foreach ($key as $key => $value) { $this->storage[$key] = $value; } return $this; } $this->setValueToStack($this->storage, explode(self::SEPARATOR, $key), $value); return $this; }
php
public function set($key, $value = null) { if ($key === null) { array_push($this->storage, $value); return $this; } if (is_array($key)) { foreach ($key as $key => $value) { $this->storage[$key] = $value; } return $this; } $this->setValueToStack($this->storage, explode(self::SEPARATOR, $key), $value); return $this; }
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", "=", "null", ")", "{", "if", "(", "$", "key", "===", "null", ")", "{", "array_push", "(", "$", "this", "->", "storage", ",", "$", "value", ")", ";", "return", "$", "this", ";", "}...
Sets value to session storage. @param string $key @param mixed $value @return $this
[ "Sets", "value", "to", "session", "storage", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/SessionManager/Manager.php#L77-L96
230,948
cygnite/framework
src/Cygnite/Common/SessionManager/Manager.php
Manager.has
public function has($key = null) { if ($key === null) { return $this->count() > 0; } $arr = &$this->getStackByReference($key); return is_array($arr) ? array_key_exists($key, $arr) : false; }
php
public function has($key = null) { if ($key === null) { return $this->count() > 0; } $arr = &$this->getStackByReference($key); return is_array($arr) ? array_key_exists($key, $arr) : false; }
[ "public", "function", "has", "(", "$", "key", "=", "null", ")", "{", "if", "(", "$", "key", "===", "null", ")", "{", "return", "$", "this", "->", "count", "(", ")", ">", "0", ";", "}", "$", "arr", "=", "&", "$", "this", "->", "getStackByReferen...
We will check if session key exists return boolean value. @param string $key @return bool
[ "We", "will", "check", "if", "session", "key", "exists", "return", "boolean", "value", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/SessionManager/Manager.php#L106-L115
230,949
cygnite/framework
src/Cygnite/Common/SessionManager/Manager.php
Manager.delete
public function delete($key = null) { if ($key === null) { $this->reset(); return $this; } $arr = &$this->getStackByReference($key); if (is_array($arr) && array_key_exists($key, $arr)) { unset($arr[$key]); } return $this; }
php
public function delete($key = null) { if ($key === null) { $this->reset(); return $this; } $arr = &$this->getStackByReference($key); if (is_array($arr) && array_key_exists($key, $arr)) { unset($arr[$key]); } return $this; }
[ "public", "function", "delete", "(", "$", "key", "=", "null", ")", "{", "if", "(", "$", "key", "===", "null", ")", "{", "$", "this", "->", "reset", "(", ")", ";", "return", "$", "this", ";", "}", "$", "arr", "=", "&", "$", "this", "->", "getS...
Remove key from the stack if key given null we will remove all values. @param string $key attribute to remove from @return $this
[ "Remove", "key", "from", "the", "stack", "if", "key", "given", "null", "we", "will", "remove", "all", "values", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/SessionManager/Manager.php#L125-L140
230,950
cygnite/framework
src/Cygnite/Common/SessionManager/Manager.php
Manager.&
protected function &getStackByReference(&$key) { $key = explode(self::SEPARATOR, $key); if (count($key) > 1) { $arr = &$this->getStackReference($this->storage, array_slice($key, 0, -1), false); } else { $arr = &$this->storage; } $key = array_slice($key, -1); $key = reset($key); return $arr; }
php
protected function &getStackByReference(&$key) { $key = explode(self::SEPARATOR, $key); if (count($key) > 1) { $arr = &$this->getStackReference($this->storage, array_slice($key, 0, -1), false); } else { $arr = &$this->storage; } $key = array_slice($key, -1); $key = reset($key); return $arr; }
[ "protected", "function", "&", "getStackByReference", "(", "&", "$", "key", ")", "{", "$", "key", "=", "explode", "(", "self", "::", "SEPARATOR", ",", "$", "key", ")", ";", "if", "(", "count", "(", "$", "key", ")", ">", "1", ")", "{", "$", "arr", ...
Return the array reference. @param string $key @return mixed
[ "Return", "the", "array", "reference", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/SessionManager/Manager.php#L167-L181
230,951
cygnite/framework
src/Cygnite/Common/SessionManager/Manager.php
Manager.&
protected function &getStackReference(&$array, $keys, $default = null) { $key = array_shift($keys); if (!isset($array[$key])) { return $default; } if (empty($keys)) { return $array[$key]; } return $this->getStackReference($array[$key], $keys, $default); }
php
protected function &getStackReference(&$array, $keys, $default = null) { $key = array_shift($keys); if (!isset($array[$key])) { return $default; } if (empty($keys)) { return $array[$key]; } return $this->getStackReference($array[$key], $keys, $default); }
[ "protected", "function", "&", "getStackReference", "(", "&", "$", "array", ",", "$", "keys", ",", "$", "default", "=", "null", ")", "{", "$", "key", "=", "array_shift", "(", "$", "keys", ")", ";", "if", "(", "!", "isset", "(", "$", "array", "[", ...
Returns array element matching key. @param array $array @param array $keys @param mixed $default @return string
[ "Returns", "array", "element", "matching", "key", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/SessionManager/Manager.php#L192-L205
230,952
cygnite/framework
src/Cygnite/Common/Mail/Mailer.php
Mailer.compose
public static function compose($callback = null) { $mailer = new static(); $mailer->setSwiftMailer(new \Swift_Mailer($mailer->getTransportInstance())); if (!is_null($callback) && $callback instanceof Closure) { return $callback($mailer, $mailer->message()); } return $mailer; }
php
public static function compose($callback = null) { $mailer = new static(); $mailer->setSwiftMailer(new \Swift_Mailer($mailer->getTransportInstance())); if (!is_null($callback) && $callback instanceof Closure) { return $callback($mailer, $mailer->message()); } return $mailer; }
[ "public", "static", "function", "compose", "(", "$", "callback", "=", "null", ")", "{", "$", "mailer", "=", "new", "static", "(", ")", ";", "$", "mailer", "->", "setSwiftMailer", "(", "new", "\\", "Swift_Mailer", "(", "$", "mailer", "->", "getTransportIn...
Get the instance of the Mailer. @param null $callback @return static
[ "Get", "the", "instance", "of", "the", "Mailer", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/Mail/Mailer.php#L83-L93
230,953
cygnite/framework
src/Cygnite/Common/Mail/Mailer.php
Mailer.setSmtpConfig
public function setSmtpConfig($swiftSmtpTransport, $attributes) { foreach ($attributes as $key => $value) { $method = 'set'.ucfirst($key); $swiftSmtpTransport->{$method}($value); } }
php
public function setSmtpConfig($swiftSmtpTransport, $attributes) { foreach ($attributes as $key => $value) { $method = 'set'.ucfirst($key); $swiftSmtpTransport->{$method}($value); } }
[ "public", "function", "setSmtpConfig", "(", "$", "swiftSmtpTransport", ",", "$", "attributes", ")", "{", "foreach", "(", "$", "attributes", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "method", "=", "'set'", ".", "ucfirst", "(", "$", "key", ")...
Set Email configurations dynamically to SwiftMailer. @param $swiftSmtpTransport @param $attributes
[ "Set", "Email", "configurations", "dynamically", "to", "SwiftMailer", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/Mail/Mailer.php#L138-L144
230,954
cygnite/framework
src/Cygnite/Common/Mail/Mailer.php
Mailer.createSmtpTransport
protected function createSmtpTransport() { $this->smtpTransport = SmtpTransport::newInstance(); $this->setSmtpConfig($this->smtpTransport, $this->emailConfig['smtp']); }
php
protected function createSmtpTransport() { $this->smtpTransport = SmtpTransport::newInstance(); $this->setSmtpConfig($this->smtpTransport, $this->emailConfig['smtp']); }
[ "protected", "function", "createSmtpTransport", "(", ")", "{", "$", "this", "->", "smtpTransport", "=", "SmtpTransport", "::", "newInstance", "(", ")", ";", "$", "this", "->", "setSmtpConfig", "(", "$", "this", "->", "smtpTransport", ",", "$", "this", "->", ...
Set SMTP transport. @param null @return void
[ "Set", "SMTP", "transport", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/Mail/Mailer.php#L153-L158
230,955
cygnite/framework
src/Cygnite/Common/Mail/Mailer.php
Mailer.send
public function send($message) { if (!$message instanceof MailMessage) { throw new \InvalidArgumentException( sprintf('Mailer::%s expect instance of Swift_Message.', __FUNCTION__) ); } return $this->swift->send($message, $this->failedRecipients); }
php
public function send($message) { if (!$message instanceof MailMessage) { throw new \InvalidArgumentException( sprintf('Mailer::%s expect instance of Swift_Message.', __FUNCTION__) ); } return $this->swift->send($message, $this->failedRecipients); }
[ "public", "function", "send", "(", "$", "message", ")", "{", "if", "(", "!", "$", "message", "instanceof", "MailMessage", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Mailer::%s expect instance of Swift_Message.'", ",", "__FUN...
Send email with message. @param your $message @throws \InvalidArgumentException @return unknown
[ "Send", "email", "with", "message", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/Mail/Mailer.php#L257-L266
230,956
ctbsea/phalapi-smarty
src/Smarty/sysplugins/smarty_internal_method_addautoloadfilters.php
Smarty_Internal_Method_AddAutoloadFilters.addAutoloadFilters
public function addAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null) { $smarty = isset($obj->smarty) ? $obj->smarty : $obj; if ($type !== null) { $this->_checkFilterType($type); if (!empty($smarty->autoload_filters[$type])) { $smarty->autoload_filters[$type] = array_merge($smarty->autoload_filters[$type], (array) $filters); } else { $smarty->autoload_filters[$type] = (array) $filters; } } else { foreach ((array) $filters as $type => $value) { $this->_checkFilterType($type); if (!empty($smarty->autoload_filters[$type])) { $smarty->autoload_filters[$type] = array_merge($smarty->autoload_filters[$type], (array) $value); } else { $smarty->autoload_filters[$type] = (array) $value; } } } return $obj; }
php
public function addAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null) { $smarty = isset($obj->smarty) ? $obj->smarty : $obj; if ($type !== null) { $this->_checkFilterType($type); if (!empty($smarty->autoload_filters[$type])) { $smarty->autoload_filters[$type] = array_merge($smarty->autoload_filters[$type], (array) $filters); } else { $smarty->autoload_filters[$type] = (array) $filters; } } else { foreach ((array) $filters as $type => $value) { $this->_checkFilterType($type); if (!empty($smarty->autoload_filters[$type])) { $smarty->autoload_filters[$type] = array_merge($smarty->autoload_filters[$type], (array) $value); } else { $smarty->autoload_filters[$type] = (array) $value; } } } return $obj; }
[ "public", "function", "addAutoloadFilters", "(", "Smarty_Internal_TemplateBase", "$", "obj", ",", "$", "filters", ",", "$", "type", "=", "null", ")", "{", "$", "smarty", "=", "isset", "(", "$", "obj", "->", "smarty", ")", "?", "$", "obj", "->", "smarty",...
Add autoload filters @api Smarty::setAutoloadFilters() @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj @param array $filters filters to load automatically @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types @return \Smarty|\Smarty_Internal_Template
[ "Add", "autoload", "filters" ]
4d40da3e4482c0749f3cfd1605265a109a1c495f
https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_method_addautoloadfilters.php#L29-L50
230,957
cygnite/framework
src/Cygnite/Common/SessionManager/Native/Session.php
Session.startSession
protected function startSession() { if (@session_status() === \PHP_SESSION_ACTIVE) { throw new SessionNotStartedException('Session started already!'); } if (ini_get('session.use_cookies') && headers_sent($file, $line)) { throw new SessionNotStartedException(sprintf('Unable to start session, headers already sent by "%s" at line %d.', $file, $line)); } $this->setSessionConfig(); /* | We will start session, if fails | we will throw exception to user */ if (!session_start()) { throw new SessionNotStartedException('Unable to start session'); } }
php
protected function startSession() { if (@session_status() === \PHP_SESSION_ACTIVE) { throw new SessionNotStartedException('Session started already!'); } if (ini_get('session.use_cookies') && headers_sent($file, $line)) { throw new SessionNotStartedException(sprintf('Unable to start session, headers already sent by "%s" at line %d.', $file, $line)); } $this->setSessionConfig(); /* | We will start session, if fails | we will throw exception to user */ if (!session_start()) { throw new SessionNotStartedException('Unable to start session'); } }
[ "protected", "function", "startSession", "(", ")", "{", "if", "(", "@", "session_status", "(", ")", "===", "\\", "PHP_SESSION_ACTIVE", ")", "{", "throw", "new", "SessionNotStartedException", "(", "'Session started already!'", ")", ";", "}", "if", "(", "ini_get",...
Starts session. @throws \RuntimeException
[ "Starts", "session", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/SessionManager/Native/Session.php#L100-L119
230,958
cygnite/framework
src/Cygnite/Common/SessionManager/Native/Session.php
Session.checkReferer
protected function checkReferer() { if (!empty($_SERVER['HTTP_REFERER'])) { $url = parse_url($_SERVER['HTTP_REFERER']); $hostUrl = (array_key_exists('port', $url)) ? $url['host'].':'.$url['port'] : $url['host']; if ($hostUrl != $_SERVER['HTTP_HOST']) { session_destroy(); // destroy fake session } } }
php
protected function checkReferer() { if (!empty($_SERVER['HTTP_REFERER'])) { $url = parse_url($_SERVER['HTTP_REFERER']); $hostUrl = (array_key_exists('port', $url)) ? $url['host'].':'.$url['port'] : $url['host']; if ($hostUrl != $_SERVER['HTTP_HOST']) { session_destroy(); // destroy fake session } } }
[ "protected", "function", "checkReferer", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "_SERVER", "[", "'HTTP_REFERER'", "]", ")", ")", "{", "$", "url", "=", "parse_url", "(", "$", "_SERVER", "[", "'HTTP_REFERER'", "]", ")", ";", "$", "hostUrl", ...
We will check referer url from the same server or not else we will destroy the session.
[ "We", "will", "check", "referer", "url", "from", "the", "same", "server", "or", "not", "else", "we", "will", "destroy", "the", "session", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/SessionManager/Native/Session.php#L148-L159
230,959
cygnite/framework
src/Cygnite/Common/SessionManager/Native/Session.php
Session.regenerate
public function regenerate() { // we will regenerate session ID session_regenerate_id(true); session_write_close(); if (isset($_SESSION)) { $data = $_SESSION; session_start(); $_SESSION = $data; } else { session_start(); } // we will store session global variable reference into storage property $this->storage = &$_SESSION; return $this; }
php
public function regenerate() { // we will regenerate session ID session_regenerate_id(true); session_write_close(); if (isset($_SESSION)) { $data = $_SESSION; session_start(); $_SESSION = $data; } else { session_start(); } // we will store session global variable reference into storage property $this->storage = &$_SESSION; return $this; }
[ "public", "function", "regenerate", "(", ")", "{", "// we will regenerate session ID", "session_regenerate_id", "(", "true", ")", ";", "session_write_close", "(", ")", ";", "if", "(", "isset", "(", "$", "_SESSION", ")", ")", "{", "$", "data", "=", "$", "_SES...
Regenerate the session ID. @return $this
[ "Regenerate", "the", "session", "ID", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Common/SessionManager/Native/Session.php#L166-L185
230,960
inetprocess/libsugarcrm
src/Bean.php
Bean.getBean
public function getBean($module, $id = null, $params = array(), $deleted = true, $useCache = false) { if ($useCache && class_exists('BeanFactory')) { return \BeanFactory::getBean($module, $id, $params, $deleted); } // If I use an old version of SugarCRM, do exactly what BeanFactory does // Check if params is an array, if not use old arguments if (isset($params) && !is_array($params)) { $params = array('encode' => $params); } // Pull values from $params array $encode = isset($params['encode']) ? $params['encode'] : true; $deleted = isset($params['deleted']) ? $params['deleted'] : $deleted; // Module exists? Load it if (!array_key_exists($module, $this->beanList)) { throw new \InvalidArgumentException($module . ' does not exist in SugarCRM, I cannot retrieve anything'); } $beanClass = $this->beanList[$module]; if (!class_exists($beanClass)) { throw new SugarException("Class $beanClass does not exist"); } $bean = new $beanClass(); if (!is_null($id)) { $this->getLogger()->debug($this->logPrefix . "Retrieving $module with ID '$id' (deleted = $deleted)"); // to change the parent bean, but not the related (e.g. change Account Name of Opportunity) if (!empty($params['disable_row_level_security'])) { $bean->disable_row_level_security = true; } $result = $bean->retrieve($id, $encode, $deleted); if (is_null($result)) { $this->getLogger()->info($this->logPrefix . 'Nothing to retrieve.'); return false; } } return $bean; }
php
public function getBean($module, $id = null, $params = array(), $deleted = true, $useCache = false) { if ($useCache && class_exists('BeanFactory')) { return \BeanFactory::getBean($module, $id, $params, $deleted); } // If I use an old version of SugarCRM, do exactly what BeanFactory does // Check if params is an array, if not use old arguments if (isset($params) && !is_array($params)) { $params = array('encode' => $params); } // Pull values from $params array $encode = isset($params['encode']) ? $params['encode'] : true; $deleted = isset($params['deleted']) ? $params['deleted'] : $deleted; // Module exists? Load it if (!array_key_exists($module, $this->beanList)) { throw new \InvalidArgumentException($module . ' does not exist in SugarCRM, I cannot retrieve anything'); } $beanClass = $this->beanList[$module]; if (!class_exists($beanClass)) { throw new SugarException("Class $beanClass does not exist"); } $bean = new $beanClass(); if (!is_null($id)) { $this->getLogger()->debug($this->logPrefix . "Retrieving $module with ID '$id' (deleted = $deleted)"); // to change the parent bean, but not the related (e.g. change Account Name of Opportunity) if (!empty($params['disable_row_level_security'])) { $bean->disable_row_level_security = true; } $result = $bean->retrieve($id, $encode, $deleted); if (is_null($result)) { $this->getLogger()->info($this->logPrefix . 'Nothing to retrieve.'); return false; } } return $bean; }
[ "public", "function", "getBean", "(", "$", "module", ",", "$", "id", "=", "null", ",", "$", "params", "=", "array", "(", ")", ",", "$", "deleted", "=", "true", ",", "$", "useCache", "=", "false", ")", "{", "if", "(", "$", "useCache", "&&", "class...
Get a Bean from SugarCRM @param string $module Module's name @param string $id UUID @param array $params list of params @param boolean $deleted Retrieve the bean even if it's deleted @param boolean $useCache @throws \InvalidArgumentException @return SugarBean SugarCRM Bean
[ "Get", "a", "Bean", "from", "SugarCRM" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Bean.php#L170-L211
230,961
inetprocess/libsugarcrm
src/Bean.php
Bean.deleteBean
public function deleteBean($module, $id, $disableSecurity = false) { $bean = $this->getBean($module, $id, array('disable_row_level_security' => $disableSecurity)); if ($bean === false) { throw new \InvalidArgumentException("Can't delete that record."); } $bean->mark_deleted($id); }
php
public function deleteBean($module, $id, $disableSecurity = false) { $bean = $this->getBean($module, $id, array('disable_row_level_security' => $disableSecurity)); if ($bean === false) { throw new \InvalidArgumentException("Can't delete that record."); } $bean->mark_deleted($id); }
[ "public", "function", "deleteBean", "(", "$", "module", ",", "$", "id", ",", "$", "disableSecurity", "=", "false", ")", "{", "$", "bean", "=", "$", "this", "->", "getBean", "(", "$", "module", ",", "$", "id", ",", "array", "(", "'disable_row_level_secu...
Delete a bean @param string $module Module's name @param string $id UUID
[ "Delete", "a", "bean" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Bean.php#L232-L239
230,962
inetprocess/libsugarcrm
src/Bean.php
Bean.getList
public function getList($module, $where = array(), $limit = 100, $offset = 0, $deleted = 0) { $this->getLogger()->debug($this->logPrefix . "__getList : module = $module | offset = $offset | limit = $limit"); $records = array(); // Get the beans and build the WHERE $oBeans = $this->getBean($module); if (count($where) > 0) { $where = "{$oBeans->table_name}." . implode(" AND {$oBeans->table_name}.", $where); } else { $where = ''; } $this->getLogger()->debug($this->logPrefix . "I'll add the where: $where"); // First the deleted if asked $aDeletedBeans = array(); if ($deleted == 1) { $aDeletedBeans = $oBeans->get_list('', $where, $offset, $limit, $limit, 1); $aDeletedBeans = $aDeletedBeans['list']; $limit-= count($aDeletedBeans); } $this->getLogger()->debug($this->logPrefix . '__getList : got ' . count($aDeletedBeans) . ' deleted records.'); // Get the non-deleted rows if I have less than limit - deleted retrieved $aNotDeletedBeans = array(); if ($limit > 0) { $aNotDeletedBeans = $oBeans->get_list('', $where, $offset, $limit, $limit, 0); $aNotDeletedBeans = $aNotDeletedBeans['list']; } $this->getLogger()->debug($this->logPrefix . '__getList : got ' . count($aNotDeletedBeans) . ' NOT deleted records.'); // Merge everything $aBeans = array_merge($aNotDeletedBeans, $aDeletedBeans); $this->getLogger()->debug($this->logPrefix . '__getList : got ' . count($aBeans) . " records (deleted = $deleted)"); // change the deleted value because it's not the same for getBean $deleted = ($deleted == 1 ? false : true); foreach ($aBeans as $oBean) { // ReRetrieve to have the fetched row // It's not the best way but I need raw data $sugarId = $oBean->id; $oBean = $this->getBean($module, $sugarId, true, $deleted); $records[] = $oBean; // Clean Memory $this->cleanMemory(); } $this->getLogger()->debug($this->logPrefix . '__getList : Sending back ' . count($records) . ' records'); return $records; }
php
public function getList($module, $where = array(), $limit = 100, $offset = 0, $deleted = 0) { $this->getLogger()->debug($this->logPrefix . "__getList : module = $module | offset = $offset | limit = $limit"); $records = array(); // Get the beans and build the WHERE $oBeans = $this->getBean($module); if (count($where) > 0) { $where = "{$oBeans->table_name}." . implode(" AND {$oBeans->table_name}.", $where); } else { $where = ''; } $this->getLogger()->debug($this->logPrefix . "I'll add the where: $where"); // First the deleted if asked $aDeletedBeans = array(); if ($deleted == 1) { $aDeletedBeans = $oBeans->get_list('', $where, $offset, $limit, $limit, 1); $aDeletedBeans = $aDeletedBeans['list']; $limit-= count($aDeletedBeans); } $this->getLogger()->debug($this->logPrefix . '__getList : got ' . count($aDeletedBeans) . ' deleted records.'); // Get the non-deleted rows if I have less than limit - deleted retrieved $aNotDeletedBeans = array(); if ($limit > 0) { $aNotDeletedBeans = $oBeans->get_list('', $where, $offset, $limit, $limit, 0); $aNotDeletedBeans = $aNotDeletedBeans['list']; } $this->getLogger()->debug($this->logPrefix . '__getList : got ' . count($aNotDeletedBeans) . ' NOT deleted records.'); // Merge everything $aBeans = array_merge($aNotDeletedBeans, $aDeletedBeans); $this->getLogger()->debug($this->logPrefix . '__getList : got ' . count($aBeans) . " records (deleted = $deleted)"); // change the deleted value because it's not the same for getBean $deleted = ($deleted == 1 ? false : true); foreach ($aBeans as $oBean) { // ReRetrieve to have the fetched row // It's not the best way but I need raw data $sugarId = $oBean->id; $oBean = $this->getBean($module, $sugarId, true, $deleted); $records[] = $oBean; // Clean Memory $this->cleanMemory(); } $this->getLogger()->debug($this->logPrefix . '__getList : Sending back ' . count($records) . ' records'); return $records; }
[ "public", "function", "getList", "(", "$", "module", ",", "$", "where", "=", "array", "(", ")", ",", "$", "limit", "=", "100", ",", "$", "offset", "=", "0", ",", "$", "deleted", "=", "0", ")", "{", "$", "this", "->", "getLogger", "(", ")", "->"...
Get a list of records directly from the database @param string $module Module's name @param array $where @param integer $limit @param integer $offset @param integer $deleted Get Deleted Records only @throws \InvalidArgumentException @return array List of records found
[ "Get", "a", "list", "of", "records", "directly", "from", "the", "database" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Bean.php#L254-L309
230,963
inetprocess/libsugarcrm
src/Bean.php
Bean.searchBeans
public function searchBeans($module, array $searchFields, $deleted = 0, $limit = 100) { global $db; // Search the related record ID $sugarBean = $this->getBean($module); // Make sure the fields criteras are set correctly $searchFields = array_map(function ($critera) { return array_replace(array( 'value' => '', 'operator' => '=', ), is_array($critera) ? $critera : array('value' => $critera)); }, $searchFields); foreach ($searchFields as $searchField => $critera) { // Check the the fields are defined correctly if (!isset($sugarBean->field_defs[$searchField])) { $msg = "{$searchField} ({$critera['value']}) not in Sugar for module $module, can't search on it"; throw new \RuntimeException($msg); } } // Try to get the records with the same DB ID // what is the parent sql table ? by default the normal one // but maybe the _cstm ? $whereCriteras = array(); $moduleFields = $this->getModuleFields($module); foreach ($searchFields as $searchField => $critera) { // Search my field in the module fields $searchField = '`' . $moduleFields[$searchField]['Table'] . '`.`' . $searchField . '`'; $whereCriteras[] = "$searchField " . $critera['operator'] . " " . $db->quoted($critera['value']); } $where = implode(' AND ', $whereCriteras); $msg = "Searching a record from '{$module}' with $where (deleted = {$deleted})"; $this->getLogger()->info($this->logPrefix . $msg); $aList = $sugarBean->get_list('', $where, 0, $limit, $limit, $deleted); // Clean Memory $this->cleanMemory(); return $aList['list']; }
php
public function searchBeans($module, array $searchFields, $deleted = 0, $limit = 100) { global $db; // Search the related record ID $sugarBean = $this->getBean($module); // Make sure the fields criteras are set correctly $searchFields = array_map(function ($critera) { return array_replace(array( 'value' => '', 'operator' => '=', ), is_array($critera) ? $critera : array('value' => $critera)); }, $searchFields); foreach ($searchFields as $searchField => $critera) { // Check the the fields are defined correctly if (!isset($sugarBean->field_defs[$searchField])) { $msg = "{$searchField} ({$critera['value']}) not in Sugar for module $module, can't search on it"; throw new \RuntimeException($msg); } } // Try to get the records with the same DB ID // what is the parent sql table ? by default the normal one // but maybe the _cstm ? $whereCriteras = array(); $moduleFields = $this->getModuleFields($module); foreach ($searchFields as $searchField => $critera) { // Search my field in the module fields $searchField = '`' . $moduleFields[$searchField]['Table'] . '`.`' . $searchField . '`'; $whereCriteras[] = "$searchField " . $critera['operator'] . " " . $db->quoted($critera['value']); } $where = implode(' AND ', $whereCriteras); $msg = "Searching a record from '{$module}' with $where (deleted = {$deleted})"; $this->getLogger()->info($this->logPrefix . $msg); $aList = $sugarBean->get_list('', $where, 0, $limit, $limit, $deleted); // Clean Memory $this->cleanMemory(); return $aList['list']; }
[ "public", "function", "searchBeans", "(", "$", "module", ",", "array", "$", "searchFields", ",", "$", "deleted", "=", "0", ",", "$", "limit", "=", "100", ")", "{", "global", "$", "db", ";", "// Search the related record ID", "$", "sugarBean", "=", "$", "...
Search a bean from a specific module and with WHERE criteras @param string $module Sugar's Module name @param array $searchFields List of fields where to search with their value @param boolean $deleted Search for deleted record @throws \Exception|\RuntimeException @return array List of Records
[ "Search", "a", "bean", "from", "a", "specific", "module", "and", "with", "WHERE", "criteras" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Bean.php#L322-L363
230,964
inetprocess/libsugarcrm
src/Bean.php
Bean.updateBean
public function updateBean(\SugarBean $sugarBean, array $data, $saveMode) { $code = self::SUGAR_NOTCHANGED; // Save my ID if (!empty($sugarBean->id)) { $this->lastUpdatedId = $sugarBean->id; } $changedValues = $this->updateBeanFields($sugarBean, $data); if ($changedValues === 0) { if (!($saveMode & self::MODE_UPDATE)) { $msg = 'Error: Won\'t create an empty bean.'; $this->getLogger()->info($this->logPrefix . $msg); throw new UpdateBeanException($msg, self::SUGAR_FIELDS_NOT_MODIFIED); } // Update mode, this is not an error we just notify that nothing changed. $msg = 'Not Saving the bean because the records are identical.'; $this->getLogger()->info($this->logPrefix . $msg); return $code; } $this->updateBeanFieldsFromCurrentUser($sugarBean); if ($saveMode === self::MODE_DRY_RUN) { $this->getLogger()->info($this->logPrefix . 'Dry run. Won\'t save anything.'); return $code; } if (empty($sugarBean->id)) { // We have a new Bean if ($saveMode & self::MODE_CREATE) { $code = self::SUGAR_CREATED; $this->getLogger()->info($this->logPrefix . 'Creating a new record.'); } else { $msg = 'Won\'t create a new record with an empty id when not in CREATE mode.'; $this->getLogger()->info($this->logPrefix . $msg); throw new UpdateBeanException($msg, self::SUGAR_NOTCHANGED); } } else { if ($saveMode & self::MODE_UPDATE) { $code = self::SUGAR_UPDATED; $this->getLogger()->info($this->logPrefix . "Updating record with id '{$sugarBean->id}'."); } elseif ($saveMode & self::MODE_CREATE_WITH_ID) { $sugarBean->new_with_id = 1; $code = self::SUGAR_CREATED; $this->getLogger()->info($this->logPrefix . "Creating new record with id '{$sugarBean->id}'."); } else { $msg = "Will not save record with id '{$sugarBean->id}'. Because not in UPDATE or CREATE_WITH_ID mode."; $this->getLogger()->info($this->logPrefix . $msg); throw new UpdateBeanException($msg, self::SUGAR_NOTCHANGED); } } $sugarBean->save(); // save my new ID $this->lastUpdatedId = $sugarBean->id; $msg = "Bean with ID {$sugarBean->id} saved because {$changedValues} value(s) ha(s)ve been changed"; $this->getLogger()->info($this->logPrefix . $msg); // clean memory $this->cleanMemory(); return $code; }
php
public function updateBean(\SugarBean $sugarBean, array $data, $saveMode) { $code = self::SUGAR_NOTCHANGED; // Save my ID if (!empty($sugarBean->id)) { $this->lastUpdatedId = $sugarBean->id; } $changedValues = $this->updateBeanFields($sugarBean, $data); if ($changedValues === 0) { if (!($saveMode & self::MODE_UPDATE)) { $msg = 'Error: Won\'t create an empty bean.'; $this->getLogger()->info($this->logPrefix . $msg); throw new UpdateBeanException($msg, self::SUGAR_FIELDS_NOT_MODIFIED); } // Update mode, this is not an error we just notify that nothing changed. $msg = 'Not Saving the bean because the records are identical.'; $this->getLogger()->info($this->logPrefix . $msg); return $code; } $this->updateBeanFieldsFromCurrentUser($sugarBean); if ($saveMode === self::MODE_DRY_RUN) { $this->getLogger()->info($this->logPrefix . 'Dry run. Won\'t save anything.'); return $code; } if (empty($sugarBean->id)) { // We have a new Bean if ($saveMode & self::MODE_CREATE) { $code = self::SUGAR_CREATED; $this->getLogger()->info($this->logPrefix . 'Creating a new record.'); } else { $msg = 'Won\'t create a new record with an empty id when not in CREATE mode.'; $this->getLogger()->info($this->logPrefix . $msg); throw new UpdateBeanException($msg, self::SUGAR_NOTCHANGED); } } else { if ($saveMode & self::MODE_UPDATE) { $code = self::SUGAR_UPDATED; $this->getLogger()->info($this->logPrefix . "Updating record with id '{$sugarBean->id}'."); } elseif ($saveMode & self::MODE_CREATE_WITH_ID) { $sugarBean->new_with_id = 1; $code = self::SUGAR_CREATED; $this->getLogger()->info($this->logPrefix . "Creating new record with id '{$sugarBean->id}'."); } else { $msg = "Will not save record with id '{$sugarBean->id}'. Because not in UPDATE or CREATE_WITH_ID mode."; $this->getLogger()->info($this->logPrefix . $msg); throw new UpdateBeanException($msg, self::SUGAR_NOTCHANGED); } } $sugarBean->save(); // save my new ID $this->lastUpdatedId = $sugarBean->id; $msg = "Bean with ID {$sugarBean->id} saved because {$changedValues} value(s) ha(s)ve been changed"; $this->getLogger()->info($this->logPrefix . $msg); // clean memory $this->cleanMemory(); return $code; }
[ "public", "function", "updateBean", "(", "\\", "SugarBean", "$", "sugarBean", ",", "array", "$", "data", ",", "$", "saveMode", ")", "{", "$", "code", "=", "self", "::", "SUGAR_NOTCHANGED", ";", "// Save my ID", "if", "(", "!", "empty", "(", "$", "sugarBe...
Update a SugarCRM Bean @param \SugarBean $bean @param array $data Array of field => value @param integer $saveMode DRY_RUN / CREATE / UPDATE / CREATE_WITH_ID @throws Inet\SugarCRM\Exception\UpdateBeanException if trying to create or update a bean when not in the correct mode. If trying to create an empty bean. @return int Return code
[ "Update", "a", "SugarCRM", "Bean" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Bean.php#L378-L446
230,965
inetprocess/libsugarcrm
src/Bean.php
Bean.updateBeanFields
public function updateBeanFields(\SugarBean $sugarBean, array $fields) { $changedValues = 0; $nonEmptyFields = array('date_entered'); $moduleFields = $this->getModuleFields($sugarBean->module_name); $moduleRels = $this->getModuleRelationships($sugarBean->module_name, 'one'); foreach ($fields as $field => $value) { // It does not exist in Sugar if (!array_key_exists($field, $moduleFields) && !array_key_exists($field, $moduleRels) && !array_key_exists($field, $sugarBean->field_defs) ) { $this->getLogger()->error($this->logPrefix . "$field doesn't seem to exist in Sugar"); } // Field value and new value are the same // or I ignore empty values if ((isset($sugarBean->$field) && $sugarBean->$field == htmlspecialchars($value, ENT_QUOTES)) || (in_array($field, $nonEmptyFields) && empty($value))) { $this->getLogger()->debug($this->logPrefix . "Skipping $field, values are same or value is empty"); continue; } // force the update of some fields if ($field === 'date_modified') { $sugarBean->update_date_modified = false; } if ($field === 'created_by') { $sugarBean->set_created_by = false; } if ($field === 'modified_user_id') { $sugarBean->update_modified_by = false; } $sugarBean->$field = $value; $this->getLogger()->debug($this->logPrefix . "Saving $field, value has changed"); $changedValues++; } return $changedValues; }
php
public function updateBeanFields(\SugarBean $sugarBean, array $fields) { $changedValues = 0; $nonEmptyFields = array('date_entered'); $moduleFields = $this->getModuleFields($sugarBean->module_name); $moduleRels = $this->getModuleRelationships($sugarBean->module_name, 'one'); foreach ($fields as $field => $value) { // It does not exist in Sugar if (!array_key_exists($field, $moduleFields) && !array_key_exists($field, $moduleRels) && !array_key_exists($field, $sugarBean->field_defs) ) { $this->getLogger()->error($this->logPrefix . "$field doesn't seem to exist in Sugar"); } // Field value and new value are the same // or I ignore empty values if ((isset($sugarBean->$field) && $sugarBean->$field == htmlspecialchars($value, ENT_QUOTES)) || (in_array($field, $nonEmptyFields) && empty($value))) { $this->getLogger()->debug($this->logPrefix . "Skipping $field, values are same or value is empty"); continue; } // force the update of some fields if ($field === 'date_modified') { $sugarBean->update_date_modified = false; } if ($field === 'created_by') { $sugarBean->set_created_by = false; } if ($field === 'modified_user_id') { $sugarBean->update_modified_by = false; } $sugarBean->$field = $value; $this->getLogger()->debug($this->logPrefix . "Saving $field, value has changed"); $changedValues++; } return $changedValues; }
[ "public", "function", "updateBeanFields", "(", "\\", "SugarBean", "$", "sugarBean", ",", "array", "$", "fields", ")", "{", "$", "changedValues", "=", "0", ";", "$", "nonEmptyFields", "=", "array", "(", "'date_entered'", ")", ";", "$", "moduleFields", "=", ...
Update fields of a SugarCRM Bean @param \SugarBean $bean @param array $fields Array of field name => value @return integer Number of changed fields.
[ "Update", "fields", "of", "a", "SugarCRM", "Bean" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Bean.php#L457-L496
230,966
inetprocess/libsugarcrm
src/Bean.php
Bean.countRecords
public function countRecords($module, array $whereCriteras = array(), $deleted = false) { $bean = $this->getBean($module); // build the where $where = ($deleted ? 'WHERE 1 = 1' : 'WHERE deleted = 0'); if (!empty($whereCriteras)) { $where.= ' AND ' . implode(' AND ', $whereCriteras); } $this->getLogger()->info($this->logPrefix . "Going to count the record with '{$where}'."); // shot the query $sql = "SELECT * FROM {$bean->table_name} $where"; $countSql = $bean->create_list_count_query($sql); $countRes = (int)$bean->db->getOne($countSql); if ($bean->db->database->error) { throw new \RuntimeException('The query to Count records failed'); } if ($countRes === 0) { $this->getLogger()->info($this->logPrefix . "Query '$sql' gave 0 result."); } return $countRes; }
php
public function countRecords($module, array $whereCriteras = array(), $deleted = false) { $bean = $this->getBean($module); // build the where $where = ($deleted ? 'WHERE 1 = 1' : 'WHERE deleted = 0'); if (!empty($whereCriteras)) { $where.= ' AND ' . implode(' AND ', $whereCriteras); } $this->getLogger()->info($this->logPrefix . "Going to count the record with '{$where}'."); // shot the query $sql = "SELECT * FROM {$bean->table_name} $where"; $countSql = $bean->create_list_count_query($sql); $countRes = (int)$bean->db->getOne($countSql); if ($bean->db->database->error) { throw new \RuntimeException('The query to Count records failed'); } if ($countRes === 0) { $this->getLogger()->info($this->logPrefix . "Query '$sql' gave 0 result."); } return $countRes; }
[ "public", "function", "countRecords", "(", "$", "module", ",", "array", "$", "whereCriteras", "=", "array", "(", ")", ",", "$", "deleted", "=", "false", ")", "{", "$", "bean", "=", "$", "this", "->", "getBean", "(", "$", "module", ")", ";", "// build...
Count Records for a Sugar Module @param string $module SugarCRM Module's Name @param array $whereCriteras Search Criteras + values @param boolean $deleted Take deleted records into account @throws \InvalidArgumentException @return integer Total number of records
[ "Count", "Records", "for", "a", "Sugar", "Module" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Bean.php#L529-L553
230,967
inetprocess/libsugarcrm
src/Bean.php
Bean.getModuleRelationships
public function getModuleRelationships($module, $type = 'all') { // Check in cache if (isset($this->moduleRels[$module][$type])) { $this->getLogger()->debug($this->logPrefix . 'Got rels for this module in cache'); return $this->moduleRels[$module][$type]; } $sugarBean = $this->getBean($module); $data = array(); $rels = $sugarBean->get_linked_fields(); // removing the "right side" of a relationship foreach ($rels as $props) { $relName = $props['relationship']; $relationship = new \Relationship(); $relationship->retrieve_by_name($relName); // Id is empty: fake relationship, especially for users if (empty($relationship->id)) { continue; } // Just rename the relationship if I ask only the beans directly related if ($type == 'one' && (array_key_exists('side', $props) && $props['side'] == 'right' || array_key_exists('link_type', $props) && $props['link_type'] == 'one') ) { $relName = $props['name']; } // I am in a many to One, ignore other if ($type == 'one' && $relName == $relationship->relationship_name) { continue; } // Write data $data[$relName] = array( 'relationship_name' => $relName, 'lhs_key' => $relationship->lhs_key, 'lhs_module' => $relationship->lhs_module, 'relationship_type' => $relationship->relationship_type, 'rhs_module' => $relationship->rhs_module, 'rhs_key' => $relationship->rhs_key, 'join_table' => $relationship->join_table, 'join_key_lhs' => $relationship->join_key_lhs, 'join_key_rhs' => $relationship->join_key_rhs, ); } // sort it ksort($data); // cache it $this->moduleRels[$module][$type] = $data; return $data; }
php
public function getModuleRelationships($module, $type = 'all') { // Check in cache if (isset($this->moduleRels[$module][$type])) { $this->getLogger()->debug($this->logPrefix . 'Got rels for this module in cache'); return $this->moduleRels[$module][$type]; } $sugarBean = $this->getBean($module); $data = array(); $rels = $sugarBean->get_linked_fields(); // removing the "right side" of a relationship foreach ($rels as $props) { $relName = $props['relationship']; $relationship = new \Relationship(); $relationship->retrieve_by_name($relName); // Id is empty: fake relationship, especially for users if (empty($relationship->id)) { continue; } // Just rename the relationship if I ask only the beans directly related if ($type == 'one' && (array_key_exists('side', $props) && $props['side'] == 'right' || array_key_exists('link_type', $props) && $props['link_type'] == 'one') ) { $relName = $props['name']; } // I am in a many to One, ignore other if ($type == 'one' && $relName == $relationship->relationship_name) { continue; } // Write data $data[$relName] = array( 'relationship_name' => $relName, 'lhs_key' => $relationship->lhs_key, 'lhs_module' => $relationship->lhs_module, 'relationship_type' => $relationship->relationship_type, 'rhs_module' => $relationship->rhs_module, 'rhs_key' => $relationship->rhs_key, 'join_table' => $relationship->join_table, 'join_key_lhs' => $relationship->join_key_lhs, 'join_key_rhs' => $relationship->join_key_rhs, ); } // sort it ksort($data); // cache it $this->moduleRels[$module][$type] = $data; return $data; }
[ "public", "function", "getModuleRelationships", "(", "$", "module", ",", "$", "type", "=", "'all'", ")", "{", "// Check in cache", "if", "(", "isset", "(", "$", "this", "->", "moduleRels", "[", "$", "module", "]", "[", "$", "type", "]", ")", ")", "{", ...
Get relationships for a specific module @param string $module SugarCRM Module's name @param string $type Could be either 'all' or 'one'. One will give only the rels as "fields" @throws \InvalidArgumentException @return array List of relationships
[ "Get", "relationships", "for", "a", "specific", "module" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Bean.php#L723-L778
230,968
inetprocess/libsugarcrm
src/Bean.php
Bean.getModuleTable
public function getModuleTable($module) { $sugarBean = $this->getBean($module); $tableName = $sugarBean->table_name; if (empty($tableName)) { throw new SugarException("$module returns an empty table name"); } return $sugarBean->table_name; }
php
public function getModuleTable($module) { $sugarBean = $this->getBean($module); $tableName = $sugarBean->table_name; if (empty($tableName)) { throw new SugarException("$module returns an empty table name"); } return $sugarBean->table_name; }
[ "public", "function", "getModuleTable", "(", "$", "module", ")", "{", "$", "sugarBean", "=", "$", "this", "->", "getBean", "(", "$", "module", ")", ";", "$", "tableName", "=", "$", "sugarBean", "->", "table_name", ";", "if", "(", "empty", "(", "$", "...
Returns the table's name for a module @param string $module Module's name @throws \InvalidArgumentException @return string Returns the table name
[ "Returns", "the", "table", "s", "name", "for", "a", "module" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Bean.php#L789-L798
230,969
inetprocess/libsugarcrm
src/Bean.php
Bean.getModuleCustomTable
public function getModuleCustomTable($module) { $sugarBean = $this->getBean($module); $customTable = $sugarBean->get_custom_table_name(); $data = $this->db->query("SHOW TABLES LIKE '$customTable'"); if (empty($data)) { return ''; } return $customTable; }
php
public function getModuleCustomTable($module) { $sugarBean = $this->getBean($module); $customTable = $sugarBean->get_custom_table_name(); $data = $this->db->query("SHOW TABLES LIKE '$customTable'"); if (empty($data)) { return ''; } return $customTable; }
[ "public", "function", "getModuleCustomTable", "(", "$", "module", ")", "{", "$", "sugarBean", "=", "$", "this", "->", "getBean", "(", "$", "module", ")", ";", "$", "customTable", "=", "$", "sugarBean", "->", "get_custom_table_name", "(", ")", ";", "$", "...
Returns the custom table's name for a module @param string $module Module's name @throws \InvalidArgumentException @return string Returns the table name
[ "Returns", "the", "custom", "table", "s", "name", "for", "a", "module" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Bean.php#L809-L819
230,970
inetprocess/libsugarcrm
src/Bean.php
Bean.applyLabelsToField
public function applyLabelsToField($module_definition, $field_name, $value) { $key = $field_name; if (array_key_exists($field_name, $module_definition)) { $field_definition = $module_definition[$field_name]; if (isset($field_definition['vname'])) { $field_name = $field_definition['vname']; } if (isset($field_definition['type'])) { switch ($field_definition['type']) { case 'enum': if (isset($field_definition['options_list'][$value])) { $value = $field_definition['options_list'][$value]; } break; case 'bool': $value = $value ? self::BOOL_TRUE : self::BOOL_FALSE; break; } } } return array($field_name, $value); }
php
public function applyLabelsToField($module_definition, $field_name, $value) { $key = $field_name; if (array_key_exists($field_name, $module_definition)) { $field_definition = $module_definition[$field_name]; if (isset($field_definition['vname'])) { $field_name = $field_definition['vname']; } if (isset($field_definition['type'])) { switch ($field_definition['type']) { case 'enum': if (isset($field_definition['options_list'][$value])) { $value = $field_definition['options_list'][$value]; } break; case 'bool': $value = $value ? self::BOOL_TRUE : self::BOOL_FALSE; break; } } } return array($field_name, $value); }
[ "public", "function", "applyLabelsToField", "(", "$", "module_definition", ",", "$", "field_name", ",", "$", "value", ")", "{", "$", "key", "=", "$", "field_name", ";", "if", "(", "array_key_exists", "(", "$", "field_name", ",", "$", "module_definition", ")"...
Return an array with the field_name and the value after replacing by a label when available. @param $module_definition Module definition fetch with language as in getModuleFields. @param $field_name Technical name of the field @param $value Value fetched from db. Enums will be replaced by label from list. @return array Array with a field_name and value.
[ "Return", "an", "array", "with", "the", "field_name", "and", "the", "value", "after", "replacing", "by", "a", "label", "when", "available", "." ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Bean.php#L868-L890
230,971
inetprocess/libsugarcrm
src/Bean.php
Bean.beanToArray
public function beanToArray(array $fields_name, \SugarBean $bean, $pretty = false, $lang = 'en_us') { $module_definition = null; if ($pretty) { $module_definition = $this->getModuleFields($bean->module_name, $lang); } $fields = array(); foreach ($fields_name as $field_name) { $key = $field_name; $value = $bean->$field_name; if (!is_null($module_definition)) { list($key, $value) = $this->applyLabelsToField($module_definition, $key, $value); } $fields[$key] = $value; } return $fields; }
php
public function beanToArray(array $fields_name, \SugarBean $bean, $pretty = false, $lang = 'en_us') { $module_definition = null; if ($pretty) { $module_definition = $this->getModuleFields($bean->module_name, $lang); } $fields = array(); foreach ($fields_name as $field_name) { $key = $field_name; $value = $bean->$field_name; if (!is_null($module_definition)) { list($key, $value) = $this->applyLabelsToField($module_definition, $key, $value); } $fields[$key] = $value; } return $fields; }
[ "public", "function", "beanToArray", "(", "array", "$", "fields_name", ",", "\\", "SugarBean", "$", "bean", ",", "$", "pretty", "=", "false", ",", "$", "lang", "=", "'en_us'", ")", "{", "$", "module_definition", "=", "null", ";", "if", "(", "$", "prett...
Fetch values for fields name from bean @param $pretty if true, will return the display name from the language. @param $lang language to use in pretty mode. Default to en_us. @return An array of key => value pairs.
[ "Fetch", "values", "for", "fields", "name", "from", "bean" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Bean.php#L900-L916
230,972
inetprocess/libsugarcrm
src/Bean.php
Bean.beanListToArray
public function beanListToArray(array $fields_name, array $bean_list, $pretty = false, $lang = 'en_us') { $ret = array(); foreach ($bean_list as $bean) { $ret[] = $this->beanToArray($fields_name, $bean, $pretty, $lang); } return $ret; }
php
public function beanListToArray(array $fields_name, array $bean_list, $pretty = false, $lang = 'en_us') { $ret = array(); foreach ($bean_list as $bean) { $ret[] = $this->beanToArray($fields_name, $bean, $pretty, $lang); } return $ret; }
[ "public", "function", "beanListToArray", "(", "array", "$", "fields_name", ",", "array", "$", "bean_list", ",", "$", "pretty", "=", "false", ",", "$", "lang", "=", "'en_us'", ")", "{", "$", "ret", "=", "array", "(", ")", ";", "foreach", "(", "$", "be...
Convert an array of \SugarBean objects to an array of arrays matching the Beans. @param $fields_name Only the fields named in this array will be present. @param $bean_list An array of SugarBean objects. @param $pretty If true, return the fields using the labels. @param $lang Language to use if pretty is true. Default to english. @return array An array of arrays with bean fields as keys.
[ "Convert", "an", "array", "of", "\\", "SugarBean", "objects", "to", "an", "array", "of", "arrays", "matching", "the", "Beans", "." ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Bean.php#L928-L935
230,973
marein/php-nchan-client
src/Nchan.php
Nchan.channel
public function channel(string $name): Channel { return new Channel( $this->baseUrl->append($name), $this->client ); }
php
public function channel(string $name): Channel { return new Channel( $this->baseUrl->append($name), $this->client ); }
[ "public", "function", "channel", "(", "string", "$", "name", ")", ":", "Channel", "{", "return", "new", "Channel", "(", "$", "this", "->", "baseUrl", "->", "append", "(", "$", "name", ")", ",", "$", "this", "->", "client", ")", ";", "}" ]
Create the api for the given channel name. @param string $name @return Channel @throws InvalidUrlException
[ "Create", "the", "api", "for", "the", "given", "channel", "name", "." ]
958d7ccb06e49139f3bf720ff3f1bd9dbe33caa9
https://github.com/marein/php-nchan-client/blob/958d7ccb06e49139f3bf720ff3f1bd9dbe33caa9/src/Nchan.php#L47-L53
230,974
marein/php-nchan-client
src/Nchan.php
Nchan.status
public function status(string $path): Status { return new Status( $this->baseUrl->append($path), $this->client ); }
php
public function status(string $path): Status { return new Status( $this->baseUrl->append($path), $this->client ); }
[ "public", "function", "status", "(", "string", "$", "path", ")", ":", "Status", "{", "return", "new", "Status", "(", "$", "this", "->", "baseUrl", "->", "append", "(", "$", "path", ")", ",", "$", "this", "->", "client", ")", ";", "}" ]
Create the api for the given status path. The path must be configured with the "nchan_stub_status;" directive. @param string $path @return Status @throws InvalidUrlException
[ "Create", "the", "api", "for", "the", "given", "status", "path", ".", "The", "path", "must", "be", "configured", "with", "the", "nchan_stub_status", ";", "directive", "." ]
958d7ccb06e49139f3bf720ff3f1bd9dbe33caa9
https://github.com/marein/php-nchan-client/blob/958d7ccb06e49139f3bf720ff3f1bd9dbe33caa9/src/Nchan.php#L63-L69
230,975
franzliedke/lti
src/ToolProvider.php
ToolProvider.handleRequest
public function handleRequest(ServerRequestInterface $request) { $requestBody = (array) $request->getParsedBody(); // Set debug mode $this->debugMode = isset($requestBody['custom_debug']) && (strtolower($requestBody['custom_debug']) == 'true'); // Set return URL if available if (isset($requestBody['launch_presentation_return_url'])) { $this->returnUrl = $requestBody['launch_presentation_return_url']; } else if (isset($requestBody['content_item_return_url'])) { $this->returnUrl = $requestBody['content_item_return_url']; } // Perform action if ($this->authenticate($request)) { $this->doCallback($requestBody); } $this->result(); }
php
public function handleRequest(ServerRequestInterface $request) { $requestBody = (array) $request->getParsedBody(); // Set debug mode $this->debugMode = isset($requestBody['custom_debug']) && (strtolower($requestBody['custom_debug']) == 'true'); // Set return URL if available if (isset($requestBody['launch_presentation_return_url'])) { $this->returnUrl = $requestBody['launch_presentation_return_url']; } else if (isset($requestBody['content_item_return_url'])) { $this->returnUrl = $requestBody['content_item_return_url']; } // Perform action if ($this->authenticate($request)) { $this->doCallback($requestBody); } $this->result(); }
[ "public", "function", "handleRequest", "(", "ServerRequestInterface", "$", "request", ")", "{", "$", "requestBody", "=", "(", "array", ")", "$", "request", "->", "getParsedBody", "(", ")", ";", "// Set debug mode", "$", "this", "->", "debugMode", "=", "isset",...
Process an incoming request @param ServerRequestInterface $request @return mixed Returns TRUE or FALSE, a redirection URL or HTML @throws Exception
[ "Process", "an", "incoming", "request" ]
131cf331f2cb87fcc29049ac739c8751e9e5133b
https://github.com/franzliedke/lti/blob/131cf331f2cb87fcc29049ac739c8751e9e5133b/src/ToolProvider.php#L276-L296
230,976
franzliedke/lti
src/ToolProvider.php
ToolProvider.getConsumers
public function getConsumers() { // Initialise data connector $this->storage = AbstractStorage::getStorage($this->storage); return $this->storage->toolConsumerList(); }
php
public function getConsumers() { // Initialise data connector $this->storage = AbstractStorage::getStorage($this->storage); return $this->storage->toolConsumerList(); }
[ "public", "function", "getConsumers", "(", ")", "{", "// Initialise data connector", "$", "this", "->", "storage", "=", "AbstractStorage", "::", "getStorage", "(", "$", "this", "->", "storage", ")", ";", "return", "$", "this", "->", "storage", "->", "toolConsu...
Get an array of defined tool consumers @return array Array of ToolConsumer objects
[ "Get", "an", "array", "of", "defined", "tool", "consumers" ]
131cf331f2cb87fcc29049ac739c8751e9e5133b
https://github.com/franzliedke/lti/blob/131cf331f2cb87fcc29049ac739c8751e9e5133b/src/ToolProvider.php#L319-L325
230,977
franzliedke/lti
src/ToolProvider.php
ToolProvider.sendForm
public static function sendForm($url, $params, $target = '') { $page = <<< EOD <html> <head> <title>IMS LTI message</title> <script type="text/javascript"> //<![CDATA[ function doOnLoad() { document.forms[0].submit(); } window.onload=doOnLoad; //]]> </script> </head> <body> <form action="{$url}" method="post" target="" encType="application/x-www-form-urlencoded"> EOD; foreach ($params as $key => $value) { $key = htmlentities($key, ENT_COMPAT | ENT_HTML401, 'UTF-8'); $value = htmlentities($value, ENT_COMPAT | ENT_HTML401, 'UTF-8'); $page .= <<< EOD <input type="hidden" name="{$key}" value="{$value}" /> EOD; } $page .= <<< EOD </form> </body> </html> EOD; return $page; }
php
public static function sendForm($url, $params, $target = '') { $page = <<< EOD <html> <head> <title>IMS LTI message</title> <script type="text/javascript"> //<![CDATA[ function doOnLoad() { document.forms[0].submit(); } window.onload=doOnLoad; //]]> </script> </head> <body> <form action="{$url}" method="post" target="" encType="application/x-www-form-urlencoded"> EOD; foreach ($params as $key => $value) { $key = htmlentities($key, ENT_COMPAT | ENT_HTML401, 'UTF-8'); $value = htmlentities($value, ENT_COMPAT | ENT_HTML401, 'UTF-8'); $page .= <<< EOD <input type="hidden" name="{$key}" value="{$value}" /> EOD; } $page .= <<< EOD </form> </body> </html> EOD; return $page; }
[ "public", "static", "function", "sendForm", "(", "$", "url", ",", "$", "params", ",", "$", "target", "=", "''", ")", "{", "$", "page", "=", " <<< EOD\n<html>\n<head>\n<title>IMS LTI message</title>\n<script type=\"text/javascript\">\n//<![CDATA[\nfunction doOnLoad() {\n docu...
Generate a web page containing an auto-submitted form of parameters. @param string $url URL to which the form should be submitted @param array $params Array of form parameters @param string $target Name of target (optional) @return string
[ "Generate", "a", "web", "page", "containing", "an", "auto", "-", "submitted", "form", "of", "parameters", "." ]
131cf331f2cb87fcc29049ac739c8751e9e5133b
https://github.com/franzliedke/lti/blob/131cf331f2cb87fcc29049ac739c8751e9e5133b/src/ToolProvider.php#L359-L396
230,978
cygnite/framework
src/Cygnite/Database/Table/Seeder.php
Seeder.executeOnly
public function executeOnly($class) { /* | We will check if user requesting for seeding multiple table | Then we will filter out only those class to seed from the | specified seeder array */ if ($exp = string_split($class, ',')) { $this->seeders = $this->filterClass($exp); } else { $hasClass = (in_array($class, $this->seeders)) ? true : false; if ($hasClass) { $this->seeders = $this->filterClass([$class]); } } }
php
public function executeOnly($class) { /* | We will check if user requesting for seeding multiple table | Then we will filter out only those class to seed from the | specified seeder array */ if ($exp = string_split($class, ',')) { $this->seeders = $this->filterClass($exp); } else { $hasClass = (in_array($class, $this->seeders)) ? true : false; if ($hasClass) { $this->seeders = $this->filterClass([$class]); } } }
[ "public", "function", "executeOnly", "(", "$", "class", ")", "{", "/*\n | We will check if user requesting for seeding multiple table\n | Then we will filter out only those class to seed from the\n | specified seeder array\n */", "if", "(", "$", "exp", "=", ...
Filter out other class and set only class to seed. @param $class
[ "Filter", "out", "other", "class", "and", "set", "only", "class", "to", "seed", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Table/Seeder.php#L27-L43
230,979
ctbsea/phalapi-smarty
src/Smarty/sysplugins/smarty_internal_data.php
Smarty_Internal_Data.assign
public function assign($tpl_var, $value = null, $nocache = false) { if (is_array($tpl_var)) { foreach ($tpl_var as $_key => $_val) { if ($_key != '') { $this->tpl_vars[$_key] = new Smarty_Variable($_val, $nocache); if ($this->_objType == 2 && $this->scope) { $this->ext->_updateScope->updateScope($this, $_key); } } } } else { if ($tpl_var != '') { $this->tpl_vars[$tpl_var] = new Smarty_Variable($value, $nocache); if ($this->_objType == 2 && $this->scope) { $this->ext->_updateScope->updateScope($this, $tpl_var); } } } return $this; }
php
public function assign($tpl_var, $value = null, $nocache = false) { if (is_array($tpl_var)) { foreach ($tpl_var as $_key => $_val) { if ($_key != '') { $this->tpl_vars[$_key] = new Smarty_Variable($_val, $nocache); if ($this->_objType == 2 && $this->scope) { $this->ext->_updateScope->updateScope($this, $_key); } } } } else { if ($tpl_var != '') { $this->tpl_vars[$tpl_var] = new Smarty_Variable($value, $nocache); if ($this->_objType == 2 && $this->scope) { $this->ext->_updateScope->updateScope($this, $tpl_var); } } } return $this; }
[ "public", "function", "assign", "(", "$", "tpl_var", ",", "$", "value", "=", "null", ",", "$", "nocache", "=", "false", ")", "{", "if", "(", "is_array", "(", "$", "tpl_var", ")", ")", "{", "foreach", "(", "$", "tpl_var", "as", "$", "_key", "=>", ...
assigns a Smarty variable @param array|string $tpl_var the template variable name(s) @param mixed $value the value to assign @param boolean $nocache if true any output of this variable will be not cached @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
[ "assigns", "a", "Smarty", "variable" ]
4d40da3e4482c0749f3cfd1605265a109a1c495f
https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_data.php#L90-L110
230,980
ctbsea/phalapi-smarty
src/Smarty/sysplugins/smarty_internal_data.php
Smarty_Internal_Data.getTemplateVars
public function getTemplateVars($varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true) { return $this->ext->getTemplateVars->getTemplateVars($this, $varName, $_ptr, $searchParents); }
php
public function getTemplateVars($varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true) { return $this->ext->getTemplateVars->getTemplateVars($this, $varName, $_ptr, $searchParents); }
[ "public", "function", "getTemplateVars", "(", "$", "varName", "=", "null", ",", "Smarty_Internal_Data", "$", "_ptr", "=", "null", ",", "$", "searchParents", "=", "true", ")", "{", "return", "$", "this", "->", "ext", "->", "getTemplateVars", "->", "getTemplat...
Returns a single or all template variables @api Smarty::getTemplateVars() @link http://www.smarty.net/docs/en/api.get.template.vars.tpl @param string $varName variable name or null @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object @param bool $searchParents include parent templates? @return mixed variable value or or array of variables
[ "Returns", "a", "single", "or", "all", "template", "variables" ]
4d40da3e4482c0749f3cfd1605265a109a1c495f
https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_data.php#L185-L188
230,981
ctbsea/phalapi-smarty
src/Smarty/sysplugins/smarty_internal_data.php
Smarty_Internal_Data.getVariable
public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true, $error_enable = true){ return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable); }
php
public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true, $error_enable = true){ return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable); }
[ "public", "function", "getVariable", "(", "$", "variable", "=", "null", ",", "Smarty_Internal_Data", "$", "_ptr", "=", "null", ",", "$", "searchParents", "=", "true", ",", "$", "error_enable", "=", "true", ")", "{", "return", "$", "this", "->", "ext", "-...
gets the object of a Smarty variable @param string $variable the name of the Smarty variable @param Smarty_Internal_Data $_ptr optional pointer to data object @param boolean $searchParents search also in parent data @param bool $error_enable @return Smarty_Variable|Smarty_Undefined_Variable the object of the variable @deprecated since 3.1.28 please use Smarty_Internal_Data::getTemplateVars() instead.
[ "gets", "the", "object", "of", "a", "Smarty", "variable" ]
4d40da3e4482c0749f3cfd1605265a109a1c495f
https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_data.php#L201-L203
230,982
ctbsea/phalapi-smarty
src/Smarty/sysplugins/smarty_internal_data.php
Smarty_Internal_Data._mergeVars
public function _mergeVars(Smarty_Internal_Data $data = null) { if (isset($data)) { if (!empty($this->tpl_vars)) { $data->tpl_vars = array_merge($this->tpl_vars, $data->tpl_vars); } if (!empty($this->config_vars)) { $data->config_vars = array_merge($this->config_vars, $data->config_vars); } } else { $data = $this; } if (isset($this->parent)) { $this->parent->_mergeVars($data); } }
php
public function _mergeVars(Smarty_Internal_Data $data = null) { if (isset($data)) { if (!empty($this->tpl_vars)) { $data->tpl_vars = array_merge($this->tpl_vars, $data->tpl_vars); } if (!empty($this->config_vars)) { $data->config_vars = array_merge($this->config_vars, $data->config_vars); } } else { $data = $this; } if (isset($this->parent)) { $this->parent->_mergeVars($data); } }
[ "public", "function", "_mergeVars", "(", "Smarty_Internal_Data", "$", "data", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "data", ")", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "tpl_vars", ")", ")", "{", "$", "data", "->",...
Follow the parent chain an merge template and config variables @param \Smarty_Internal_Data|null $data
[ "Follow", "the", "parent", "chain", "an", "merge", "template", "and", "config", "variables" ]
4d40da3e4482c0749f3cfd1605265a109a1c495f
https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_data.php#L210-L225
230,983
ctbsea/phalapi-smarty
src/Smarty/sysplugins/smarty_internal_method_compilealltemplates.php
Smarty_Internal_Method_CompileAllTemplates.compileAll
protected function compileAll(Smarty $smarty, $extension, $force_compile, $time_limit, $max_errors, $isConfig = false) { // switch off time limit if (function_exists('set_time_limit')) { @set_time_limit($time_limit); } $_count = 0; $_error_count = 0; $sourceDir = $isConfig ? $smarty->getConfigDir() : $smarty->getTemplateDir(); // loop over array of source directories foreach ($sourceDir as $_dir) { $_dir_1 = new RecursiveDirectoryIterator($_dir); $_dir_2 = new RecursiveIteratorIterator($_dir_1); foreach ($_dir_2 as $_fileinfo) { $_file = $_fileinfo->getFilename(); if (substr(basename($_fileinfo->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) { continue; } if (!substr_compare($_file, $extension, - strlen($extension)) == 0) { continue; } if ($_fileinfo->getPath() == !substr($_dir, 0, - 1)) { $_file = substr($_fileinfo->getPath(), strlen($_dir)) . DS . $_file; } echo "\n<br>", $_dir, '---', $_file; flush(); $_start_time = microtime(true); $_smarty = clone $smarty; $_smarty->force_compile = $force_compile; try { /* @var Smarty_Internal_Template $_tpl */ $_tpl = new $smarty->template_class($_file, $_smarty); $_tpl->caching = Smarty::CACHING_OFF; $_tpl->source = $isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl); if ($_tpl->mustCompile()) { $_tpl->compileTemplateSource(); $_count ++; echo ' compiled in ', microtime(true) - $_start_time, ' seconds'; flush(); } else { echo ' is up to date'; flush(); } } catch (Exception $e) { echo "\n<br> ------>Error: ", $e->getMessage(), "<br><br>\n"; $_error_count ++; } // free memory unset($_tpl); $_smarty->_cache['template_objects'] = array(); if ($max_errors !== null && $_error_count == $max_errors) { echo "\n<br><br>too many errors\n"; exit(); } } } echo "\n<br>"; return $_count; }
php
protected function compileAll(Smarty $smarty, $extension, $force_compile, $time_limit, $max_errors, $isConfig = false) { // switch off time limit if (function_exists('set_time_limit')) { @set_time_limit($time_limit); } $_count = 0; $_error_count = 0; $sourceDir = $isConfig ? $smarty->getConfigDir() : $smarty->getTemplateDir(); // loop over array of source directories foreach ($sourceDir as $_dir) { $_dir_1 = new RecursiveDirectoryIterator($_dir); $_dir_2 = new RecursiveIteratorIterator($_dir_1); foreach ($_dir_2 as $_fileinfo) { $_file = $_fileinfo->getFilename(); if (substr(basename($_fileinfo->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) { continue; } if (!substr_compare($_file, $extension, - strlen($extension)) == 0) { continue; } if ($_fileinfo->getPath() == !substr($_dir, 0, - 1)) { $_file = substr($_fileinfo->getPath(), strlen($_dir)) . DS . $_file; } echo "\n<br>", $_dir, '---', $_file; flush(); $_start_time = microtime(true); $_smarty = clone $smarty; $_smarty->force_compile = $force_compile; try { /* @var Smarty_Internal_Template $_tpl */ $_tpl = new $smarty->template_class($_file, $_smarty); $_tpl->caching = Smarty::CACHING_OFF; $_tpl->source = $isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl); if ($_tpl->mustCompile()) { $_tpl->compileTemplateSource(); $_count ++; echo ' compiled in ', microtime(true) - $_start_time, ' seconds'; flush(); } else { echo ' is up to date'; flush(); } } catch (Exception $e) { echo "\n<br> ------>Error: ", $e->getMessage(), "<br><br>\n"; $_error_count ++; } // free memory unset($_tpl); $_smarty->_cache['template_objects'] = array(); if ($max_errors !== null && $_error_count == $max_errors) { echo "\n<br><br>too many errors\n"; exit(); } } } echo "\n<br>"; return $_count; }
[ "protected", "function", "compileAll", "(", "Smarty", "$", "smarty", ",", "$", "extension", ",", "$", "force_compile", ",", "$", "time_limit", ",", "$", "max_errors", ",", "$", "isConfig", "=", "false", ")", "{", "// switch off time limit", "if", "(", "funct...
Compile all template or config files @param \Smarty $smarty @param string $extension template file name extension @param bool $force_compile force all to recompile @param int $time_limit set maximum execution time @param int $max_errors set maximum allowed errors @param bool $isConfig flag true if called for config files @return int number of template files compiled
[ "Compile", "all", "template", "or", "config", "files" ]
4d40da3e4482c0749f3cfd1605265a109a1c495f
https://github.com/ctbsea/phalapi-smarty/blob/4d40da3e4482c0749f3cfd1605265a109a1c495f/src/Smarty/sysplugins/smarty_internal_method_compilealltemplates.php#L51-L110
230,984
cygnite/framework
src/Cygnite/Database/Connections/Connector.php
Connector.create
public function create() { $pdo = null; try { $pdo = $this->connect(); } catch (\Exception $e) { $pdo = null; if ($this->isLostConnection($e)) { $pdo = $this->reconnect(); } throw new \LogicException('Connection lost and no reconnector available.'); } return $pdo; }
php
public function create() { $pdo = null; try { $pdo = $this->connect(); } catch (\Exception $e) { $pdo = null; if ($this->isLostConnection($e)) { $pdo = $this->reconnect(); } throw new \LogicException('Connection lost and no reconnector available.'); } return $pdo; }
[ "public", "function", "create", "(", ")", "{", "$", "pdo", "=", "null", ";", "try", "{", "$", "pdo", "=", "$", "this", "->", "connect", "(", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "$", "pdo", "=", "null", ";", "if...
Return PDO connection object. If connection lost will try again to connect. @return PDO
[ "Return", "PDO", "connection", "object", ".", "If", "connection", "lost", "will", "try", "again", "to", "connect", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Database/Connections/Connector.php#L47-L62
230,985
inetprocess/libsugarcrm
src/Utils.php
Utils.arrayToMultiselect
public function arrayToMultiselect(array $values) { // First clean the array foreach ($values as $k => $v) { if (empty($v)) { unset($values[$k]); } } // Encode $values = (empty($values) ? '^^' : encodeMultienumValue($values)); // Then return the array return $values; }
php
public function arrayToMultiselect(array $values) { // First clean the array foreach ($values as $k => $v) { if (empty($v)) { unset($values[$k]); } } // Encode $values = (empty($values) ? '^^' : encodeMultienumValue($values)); // Then return the array return $values; }
[ "public", "function", "arrayToMultiselect", "(", "array", "$", "values", ")", "{", "// First clean the array", "foreach", "(", "$", "values", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "empty", "(", "$", "v", ")", ")", "{", "unset", "(", "$...
Encode a multienum from Sugar @param string $multiselect MultiEnum from DB @return array Multienum as Array
[ "Encode", "a", "multienum", "from", "Sugar" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Utils.php#L60-L74
230,986
inetprocess/libsugarcrm
src/Utils.php
Utils.multiselectToArray
public function multiselectToArray($values) { // Unencode $values = unencodeMultienum($values); // First clean the array foreach ($values as $k => $v) { if (empty($v)) { unset($values[$k]); } } // Then return the array return $values; }
php
public function multiselectToArray($values) { // Unencode $values = unencodeMultienum($values); // First clean the array foreach ($values as $k => $v) { if (empty($v)) { unset($values[$k]); } } // Then return the array return $values; }
[ "public", "function", "multiselectToArray", "(", "$", "values", ")", "{", "// Unencode", "$", "values", "=", "unencodeMultienum", "(", "$", "values", ")", ";", "// First clean the array", "foreach", "(", "$", "values", "as", "$", "k", "=>", "$", "v", ")", ...
Decode a multienum from Sugar @param string $multiselect MultiEnum from DB @return array Multienum as Array
[ "Decode", "a", "multienum", "from", "Sugar" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Utils.php#L83-L97
230,987
inetprocess/libsugarcrm
src/Utils.php
Utils.addDropdown
public function addDropdown($name, array $values, $lang) { require_once('modules/ModuleBuilder/MB/ModuleBuilder.php'); require_once('modules/ModuleBuilder/parsers/parser.dropdown.php'); $_REQUEST['view_package'] = 'studio'; //need this in parser.dropdown.php $parser = new \ParserDropDown(); $json = \getJSONobj(); // Change the values to array of arrays $dpValues = array(); foreach ($values as $key => $value) { $dpValues[] = array($key, $value); } $params = array( 'view_package' => 'studio', 'dropdown_name' => $name, 'list_value' => $json->encode($dpValues), 'dropdown_lang' => $lang, ); $parser->saveDropDown($params); }
php
public function addDropdown($name, array $values, $lang) { require_once('modules/ModuleBuilder/MB/ModuleBuilder.php'); require_once('modules/ModuleBuilder/parsers/parser.dropdown.php'); $_REQUEST['view_package'] = 'studio'; //need this in parser.dropdown.php $parser = new \ParserDropDown(); $json = \getJSONobj(); // Change the values to array of arrays $dpValues = array(); foreach ($values as $key => $value) { $dpValues[] = array($key, $value); } $params = array( 'view_package' => 'studio', 'dropdown_name' => $name, 'list_value' => $json->encode($dpValues), 'dropdown_lang' => $lang, ); $parser->saveDropDown($params); }
[ "public", "function", "addDropdown", "(", "$", "name", ",", "array", "$", "values", ",", "$", "lang", ")", "{", "require_once", "(", "'modules/ModuleBuilder/MB/ModuleBuilder.php'", ")", ";", "require_once", "(", "'modules/ModuleBuilder/parsers/parser.dropdown.php'", ")"...
Add a dropdown in SugarCRM @param string $name Dropdown's name @param array $values Values for the dropdown @param string $lang Language @return void
[ "Add", "a", "dropdown", "in", "SugarCRM" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Utils.php#L144-L166
230,988
inetprocess/libsugarcrm
src/Utils.php
Utils.getDropdown
public function getDropdown($name, $lang = 'fr_FR') { $listStrings = \return_app_list_strings_language($lang); if (!array_key_exists($name, $listStrings)) { return false; } return $listStrings[$name]; }
php
public function getDropdown($name, $lang = 'fr_FR') { $listStrings = \return_app_list_strings_language($lang); if (!array_key_exists($name, $listStrings)) { return false; } return $listStrings[$name]; }
[ "public", "function", "getDropdown", "(", "$", "name", ",", "$", "lang", "=", "'fr_FR'", ")", "{", "$", "listStrings", "=", "\\", "return_app_list_strings_language", "(", "$", "lang", ")", ";", "if", "(", "!", "array_key_exists", "(", "$", "name", ",", "...
Get the displayed value for a dropdown in SugarCRM @param string $name Dropdown's name @param string $lang Language @return array
[ "Get", "the", "displayed", "value", "for", "a", "dropdown", "in", "SugarCRM" ]
493bb105c29996dc583181431fcb0987fd1fed70
https://github.com/inetprocess/libsugarcrm/blob/493bb105c29996dc583181431fcb0987fd1fed70/src/Utils.php#L176-L184
230,989
cygnite/framework
src/Cygnite/Foundation/Http/Kernel.php
Kernel.setRouter
public function setRouter($request) { $this->container->set('request', $request); $this->container->make(\Cygnite\Router\Router::class); $this->container->get('router')->setRequest($request); $this->router = $this->container->get('router'); }
php
public function setRouter($request) { $this->container->set('request', $request); $this->container->make(\Cygnite\Router\Router::class); $this->container->get('router')->setRequest($request); $this->router = $this->container->get('router'); }
[ "public", "function", "setRouter", "(", "$", "request", ")", "{", "$", "this", "->", "container", "->", "set", "(", "'request'", ",", "$", "request", ")", ";", "$", "this", "->", "container", "->", "make", "(", "\\", "Cygnite", "\\", "Router", "\\", ...
Set Router and Request instance into Container @param $router @param $request
[ "Set", "Router", "and", "Request", "instance", "into", "Container" ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Foundation/Http/Kernel.php#L62-L68
230,990
cygnite/framework
src/Cygnite/Foundation/Http/Kernel.php
Kernel.handle
public function handle($request) : ResponseInterface { $this->setRouter($request); try { $response = $this->sendRequestThroughRouter($request); /* * Check whether return value is a instance of Response, * otherwise we will try to fetch the response form container, * create a response and return to the browser. * */ if (!$response instanceof ResponseInterface && !is_array($response)) { $r = $this->container->has('response') ? $this->container->get('response') : ''; $response = Response::make($r); } } catch (\Exception $e) { $this->handleException($e); } catch (Throwable $e) { $this->handleException($e); } return $response; }
php
public function handle($request) : ResponseInterface { $this->setRouter($request); try { $response = $this->sendRequestThroughRouter($request); /* * Check whether return value is a instance of Response, * otherwise we will try to fetch the response form container, * create a response and return to the browser. * */ if (!$response instanceof ResponseInterface && !is_array($response)) { $r = $this->container->has('response') ? $this->container->get('response') : ''; $response = Response::make($r); } } catch (\Exception $e) { $this->handleException($e); } catch (Throwable $e) { $this->handleException($e); } return $response; }
[ "public", "function", "handle", "(", "$", "request", ")", ":", "ResponseInterface", "{", "$", "this", "->", "setRouter", "(", "$", "request", ")", ";", "try", "{", "$", "response", "=", "$", "this", "->", "sendRequestThroughRouter", "(", "$", "request", ...
Handle the request and dispatch to routes. @param $request @throws Exception|\Exception @return array|ResponseInterface|mixed|static
[ "Handle", "the", "request", "and", "dispatch", "to", "routes", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Foundation/Http/Kernel.php#L77-L100
230,991
cygnite/framework
src/Cygnite/Foundation/Http/Kernel.php
Kernel.sendRequestThroughRouter
protected function sendRequestThroughRouter($request) { $this->app->bootApplication($request); $this->pipeline = new Pipeline($this->container); return $this->pipeline ->send($request) ->through($this->parseMiddlewareToPipelines($this->getMiddleware()), 'handle') ->then($this->dispatchToRouter()) ->run(); }
php
protected function sendRequestThroughRouter($request) { $this->app->bootApplication($request); $this->pipeline = new Pipeline($this->container); return $this->pipeline ->send($request) ->through($this->parseMiddlewareToPipelines($this->getMiddleware()), 'handle') ->then($this->dispatchToRouter()) ->run(); }
[ "protected", "function", "sendRequestThroughRouter", "(", "$", "request", ")", "{", "$", "this", "->", "app", "->", "bootApplication", "(", "$", "request", ")", ";", "$", "this", "->", "pipeline", "=", "new", "Pipeline", "(", "$", "this", "->", "container"...
Prepare pipeline requests and send through router. @param $request @return mixed
[ "Prepare", "pipeline", "requests", "and", "send", "through", "router", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Foundation/Http/Kernel.php#L146-L156
230,992
cygnite/framework
src/Cygnite/Foundation/Http/Kernel.php
Kernel.parseMiddlewareToPipelines
protected function parseMiddlewareToPipelines(array $middlewares) : array { $pipes = []; // check all types and store value into pipes array foreach ($middlewares as $middleware) { if (is_object($middleware)) { $pipes[] = $middleware; } elseif (string_has($middleware, ':')) { $pipes[] = $middleware; } else { $pipes[] = $this->container->make($middleware); } } return $pipes; }
php
protected function parseMiddlewareToPipelines(array $middlewares) : array { $pipes = []; // check all types and store value into pipes array foreach ($middlewares as $middleware) { if (is_object($middleware)) { $pipes[] = $middleware; } elseif (string_has($middleware, ':')) { $pipes[] = $middleware; } else { $pipes[] = $this->container->make($middleware); } } return $pipes; }
[ "protected", "function", "parseMiddlewareToPipelines", "(", "array", "$", "middlewares", ")", ":", "array", "{", "$", "pipes", "=", "[", "]", ";", "// check all types and store value into pipes array", "foreach", "(", "$", "middlewares", "as", "$", "middleware", ")"...
Parse Middlewares to pipelines @param array $middlewares @return array
[ "Parse", "Middlewares", "to", "pipelines" ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Foundation/Http/Kernel.php#L180-L195
230,993
cygnite/framework
src/Cygnite/Foundation/Http/Kernel.php
Kernel.dispatchToRouter
protected function dispatchToRouter() : Closure { return function ($request) { return $this->router->setContainer($this->container)->dispatch($request); }; }
php
protected function dispatchToRouter() : Closure { return function ($request) { return $this->router->setContainer($this->container)->dispatch($request); }; }
[ "protected", "function", "dispatchToRouter", "(", ")", ":", "Closure", "{", "return", "function", "(", "$", "request", ")", "{", "return", "$", "this", "->", "router", "->", "setContainer", "(", "$", "this", "->", "container", ")", "->", "dispatch", "(", ...
Application booted, let's dispatch the routes. @return callable
[ "Application", "booted", "let", "s", "dispatch", "the", "routes", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Foundation/Http/Kernel.php#L202-L207
230,994
cygnite/framework
src/Cygnite/Foundation/Http/Kernel.php
Kernel.shutdown
public function shutdown($request, $response) { $routeMiddlewares = $this->router->getMiddlewares(); $middlewares = array_merge(array_filter([$routeMiddlewares]), $this->getMiddleware()); foreach ($middlewares as $middleware) { list($name, $parameters) = $this->pipeline->parsePipeString($middleware); $instance = $this->container->make($name); if (method_exists($instance, 'shutdown')) { $instance->shutdown($request, $response); } } }
php
public function shutdown($request, $response) { $routeMiddlewares = $this->router->getMiddlewares(); $middlewares = array_merge(array_filter([$routeMiddlewares]), $this->getMiddleware()); foreach ($middlewares as $middleware) { list($name, $parameters) = $this->pipeline->parsePipeString($middleware); $instance = $this->container->make($name); if (method_exists($instance, 'shutdown')) { $instance->shutdown($request, $response); } } }
[ "public", "function", "shutdown", "(", "$", "request", ",", "$", "response", ")", "{", "$", "routeMiddlewares", "=", "$", "this", "->", "router", "->", "getMiddlewares", "(", ")", ";", "$", "middlewares", "=", "array_merge", "(", "array_filter", "(", "[", ...
Fire shutdown method of middleware class. @param $request @param $response
[ "Fire", "shutdown", "method", "of", "middleware", "class", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Foundation/Http/Kernel.php#L242-L257
230,995
tapestry-cloud/tapestry
src/Entities/Taxonomy.php
Taxonomy.getFileList
public function getFileList($order = 'desc') { $order = strtolower(trim($order)); // Order Files by date newer to older $this->items->sortMultiDimension(function ($a, $b) use ($order) { if ($a == $b) { return 0; } if ($order === 'asc') { return ($a < $b) ? -1 : 1; } return ($a > $b) ? -1 : 1; }); return $this->items->all(); }
php
public function getFileList($order = 'desc') { $order = strtolower(trim($order)); // Order Files by date newer to older $this->items->sortMultiDimension(function ($a, $b) use ($order) { if ($a == $b) { return 0; } if ($order === 'asc') { return ($a < $b) ? -1 : 1; } return ($a > $b) ? -1 : 1; }); return $this->items->all(); }
[ "public", "function", "getFileList", "(", "$", "order", "=", "'desc'", ")", "{", "$", "order", "=", "strtolower", "(", "trim", "(", "$", "order", ")", ")", ";", "// Order Files by date newer to older", "$", "this", "->", "items", "->", "sortMultiDimension", ...
Returns an ordered list of the file uid's that have been bucketed into this taxonomy. The list is ordered by the files date. @param string $order @return array
[ "Returns", "an", "ordered", "list", "of", "the", "file", "uid", "s", "that", "have", "been", "bucketed", "into", "this", "taxonomy", ".", "The", "list", "is", "ordered", "by", "the", "files", "date", "." ]
f3fc980b2484ccbe609a7f811c65b91254e8720e
https://github.com/tapestry-cloud/tapestry/blob/f3fc980b2484ccbe609a7f811c65b91254e8720e/src/Entities/Taxonomy.php#L65-L81
230,996
cygnite/framework
src/Cygnite/Mvc/View/Composer.php
Composer.create
public function create($view = null, array $data = []) { if (is_null($view)) { return $this; } return $this->render($view, $data, true)->content(); }
php
public function create($view = null, array $data = []) { if (is_null($view)) { return $this; } return $this->render($view, $data, true)->content(); }
[ "public", "function", "create", "(", "$", "view", "=", "null", ",", "array", "$", "data", "=", "[", "]", ")", "{", "if", "(", "is_null", "(", "$", "view", ")", ")", "{", "return", "$", "this", ";", "}", "return", "$", "this", "->", "render", "(...
Create view and render it. This is alias of render method. <code> View::create('view-name', $data); $view = View::create(); </code> @param $view @param array $data @return mixed
[ "Create", "view", "and", "render", "it", ".", "This", "is", "alias", "of", "render", "method", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Mvc/View/Composer.php#L59-L66
230,997
cygnite/framework
src/Cygnite/Mvc/View/Composer.php
Composer.compose
public function compose(string $view, array $data = [], \Closure $callback = null) { if ($callback instanceof \Closure) { $content = $this->render($view, $data, true)->content(); return $callback($this, $content); } return $this->render($view, $data, true)->content(); }
php
public function compose(string $view, array $data = [], \Closure $callback = null) { if ($callback instanceof \Closure) { $content = $this->render($view, $data, true)->content(); return $callback($this, $content); } return $this->render($view, $data, true)->content(); }
[ "public", "function", "compose", "(", "string", "$", "view", ",", "array", "$", "data", "=", "[", "]", ",", "\\", "Closure", "$", "callback", "=", "null", ")", "{", "if", "(", "$", "callback", "instanceof", "\\", "Closure", ")", "{", "$", "content", ...
This function is alias of create method If user want to access render function statically. <code> View::compose('view-name', $data); View::compose('view-name', $data, function ($view, $content) { $view->setLayout('layouts.base'); }); </code> @param string $view @param array $data @param callable|\Closure $callback @return mixed
[ "This", "function", "is", "alias", "of", "create", "method", "If", "user", "want", "to", "access", "render", "function", "statically", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Mvc/View/Composer.php#L86-L95
230,998
cygnite/framework
src/Cygnite/Mvc/View/Composer.php
Composer.render
public function render(string $view, array $params = [], $return = false) { $params = array_merge($params, ['view' => $this]); /* * Check if template engine is set as true * then call template and return from here */ if ($this->templateEngine !== false) { return $this->template($view, $params, $return); } $this->widgetName = $view; $this['__return_output__'] = $return; $this->__set('parameters', $params); $path = $this->getPath(Inflector::toDirectorySeparator($view)); /* | Throw exception is view file is not readable */ if (!file_exists($path) && !is_readable($path)) { throw new ViewNotFoundException("Requested view doesn't exists in path $path"); } $this->registerViewEvent($view); $this->layout = Inflector::toDirectorySeparator($this->getLayout()); if ($this->layout !== '') { // render view page into the layout $this->renderLayoutView($path, $this->getTwigViewPath().DS, $params)->displayContent(); return $this; } $this->viewPath = $path; $this->load()->displayContent(); return $this; }
php
public function render(string $view, array $params = [], $return = false) { $params = array_merge($params, ['view' => $this]); /* * Check if template engine is set as true * then call template and return from here */ if ($this->templateEngine !== false) { return $this->template($view, $params, $return); } $this->widgetName = $view; $this['__return_output__'] = $return; $this->__set('parameters', $params); $path = $this->getPath(Inflector::toDirectorySeparator($view)); /* | Throw exception is view file is not readable */ if (!file_exists($path) && !is_readable($path)) { throw new ViewNotFoundException("Requested view doesn't exists in path $path"); } $this->registerViewEvent($view); $this->layout = Inflector::toDirectorySeparator($this->getLayout()); if ($this->layout !== '') { // render view page into the layout $this->renderLayoutView($path, $this->getTwigViewPath().DS, $params)->displayContent(); return $this; } $this->viewPath = $path; $this->load()->displayContent(); return $this; }
[ "public", "function", "render", "(", "string", "$", "view", ",", "array", "$", "params", "=", "[", "]", ",", "$", "return", "=", "false", ")", "{", "$", "params", "=", "array_merge", "(", "$", "params", ",", "[", "'view'", "=>", "$", "this", "]", ...
This function is to load requested view file. Render PHP View With Layout: ------------------------------- $this->render('Apps.Views.home:welcome', []); $content = $this->render('Apps.Views.home:welcome', [], true)->content(); return Response::make($content); Render Twig template: --------------------- //path : Views/home/index.html.twig $this->render('home.index', $data); $content = $this->render('home.index', $data, true); return Response::make($content); @param $view @param array $params @param bool $return @throws Exceptions\ViewNotFoundException @return $this|mixed
[ "This", "function", "is", "to", "load", "requested", "view", "file", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Mvc/View/Composer.php#L123-L159
230,999
cygnite/framework
src/Cygnite/Mvc/View/Composer.php
Composer.registerViewEvent
protected function registerViewEvent(string $view) { if ($this->has($view)) { $class = $this->get($view); if (is_callable($class)) { return $class($this); } $this->viewShared = $this->container()->make($class); if (!method_exists($this->viewShared, 'creating')) { throw new ViewEventNotFoundException("Event not resgistered for the view $view."); } $this->viewShared->creating($this); } }
php
protected function registerViewEvent(string $view) { if ($this->has($view)) { $class = $this->get($view); if (is_callable($class)) { return $class($this); } $this->viewShared = $this->container()->make($class); if (!method_exists($this->viewShared, 'creating')) { throw new ViewEventNotFoundException("Event not resgistered for the view $view."); } $this->viewShared->creating($this); } }
[ "protected", "function", "registerViewEvent", "(", "string", "$", "view", ")", "{", "if", "(", "$", "this", "->", "has", "(", "$", "view", ")", ")", "{", "$", "class", "=", "$", "this", "->", "get", "(", "$", "view", ")", ";", "if", "(", "is_call...
Firing events for the view. @param $view @throws ViewNotFoundException
[ "Firing", "events", "for", "the", "view", "." ]
58d0cc1c946415eb0867d76218bd35166e999093
https://github.com/cygnite/framework/blob/58d0cc1c946415eb0867d76218bd35166e999093/src/Cygnite/Mvc/View/Composer.php#L167-L183