repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
Marwelln/basset
src/Basset/Directory.php
Directory.add
public function add($name, Closure $callback = null) { try { $path = $this->finder->find($name); if (isset($this->assets[$path])) { $asset = $this->assets[$path]; } else { $asset = $this->factory->get('asset')->make($path); $asset->isRemote() and $asset->raw(); } is_callable($callback) and call_user_func($callback, $asset); return $this->assets[$path] = $asset; } catch (AssetNotFoundException $e) { $this->getLogger()->error(sprintf('Asset "%s" could not be found in "%s"', $name, $this->path)); return $this->factory->get('asset')->make(null); } }
php
public function add($name, Closure $callback = null) { try { $path = $this->finder->find($name); if (isset($this->assets[$path])) { $asset = $this->assets[$path]; } else { $asset = $this->factory->get('asset')->make($path); $asset->isRemote() and $asset->raw(); } is_callable($callback) and call_user_func($callback, $asset); return $this->assets[$path] = $asset; } catch (AssetNotFoundException $e) { $this->getLogger()->error(sprintf('Asset "%s" could not be found in "%s"', $name, $this->path)); return $this->factory->get('asset')->make(null); } }
[ "public", "function", "add", "(", "$", "name", ",", "Closure", "$", "callback", "=", "null", ")", "{", "try", "{", "$", "path", "=", "$", "this", "->", "finder", "->", "find", "(", "$", "name", ")", ";", "if", "(", "isset", "(", "$", "this", "-...
Find and add an asset to the directory. @param string $name @param \Closure $callback @return \Basset\Asset
[ "Find", "and", "add", "an", "asset", "to", "the", "directory", "." ]
bd8567b83e1562c83ef92aa1b83eed8b2ee3f267
https://github.com/Marwelln/basset/blob/bd8567b83e1562c83ef92aa1b83eed8b2ee3f267/src/Basset/Directory.php#L77-L104
train
Marwelln/basset
src/Basset/Directory.php
Directory.javascript
public function javascript($name, Closure $callback = null) { return $this->add($name, function($asset) use ($callback) { $asset->setGroup('javascripts'); is_callable($callback) and call_user_func($callback, $asset); }); }
php
public function javascript($name, Closure $callback = null) { return $this->add($name, function($asset) use ($callback) { $asset->setGroup('javascripts'); is_callable($callback) and call_user_func($callback, $asset); }); }
[ "public", "function", "javascript", "(", "$", "name", ",", "Closure", "$", "callback", "=", "null", ")", "{", "return", "$", "this", "->", "add", "(", "$", "name", ",", "function", "(", "$", "asset", ")", "use", "(", "$", "callback", ")", "{", "$",...
Find and add a javascript asset to the directory. @param string $name @param \Closure $callback @return \Basset\Asset
[ "Find", "and", "add", "a", "javascript", "asset", "to", "the", "directory", "." ]
bd8567b83e1562c83ef92aa1b83eed8b2ee3f267
https://github.com/Marwelln/basset/blob/bd8567b83e1562c83ef92aa1b83eed8b2ee3f267/src/Basset/Directory.php#L113-L121
train
Marwelln/basset
src/Basset/Directory.php
Directory.directory
public function directory($path, Closure $callback = null) { try { $path = $this->finder->setWorkingDirectory($path); $this->directories[$path] = new Directory($this->factory, $this->finder, $path); // Once we've set the working directory we'll fire the callback so that any added assets // are relative to the working directory. After the callback we can revert the working // directory. is_callable($callback) and call_user_func($callback, $this->directories[$path]); $this->finder->resetWorkingDirectory(); return $this->directories[$path]; } catch (DirectoryNotFoundException $e) { $this->getLogger()->error(sprintf('Directory "%s" could not be found in "%s"', $path, $this->path)); return new Directory($this->factory, $this->finder, null); } }
php
public function directory($path, Closure $callback = null) { try { $path = $this->finder->setWorkingDirectory($path); $this->directories[$path] = new Directory($this->factory, $this->finder, $path); // Once we've set the working directory we'll fire the callback so that any added assets // are relative to the working directory. After the callback we can revert the working // directory. is_callable($callback) and call_user_func($callback, $this->directories[$path]); $this->finder->resetWorkingDirectory(); return $this->directories[$path]; } catch (DirectoryNotFoundException $e) { $this->getLogger()->error(sprintf('Directory "%s" could not be found in "%s"', $path, $this->path)); return new Directory($this->factory, $this->finder, null); } }
[ "public", "function", "directory", "(", "$", "path", ",", "Closure", "$", "callback", "=", "null", ")", "{", "try", "{", "$", "path", "=", "$", "this", "->", "finder", "->", "setWorkingDirectory", "(", "$", "path", ")", ";", "$", "this", "->", "direc...
Change the working directory. @param string $path @param \Closure $callback @return \Basset\Collection|\Basset\Directory
[ "Change", "the", "working", "directory", "." ]
bd8567b83e1562c83ef92aa1b83eed8b2ee3f267
https://github.com/Marwelln/basset/blob/bd8567b83e1562c83ef92aa1b83eed8b2ee3f267/src/Basset/Directory.php#L147-L170
train
Marwelln/basset
src/Basset/Directory.php
Directory.requireDirectory
public function requireDirectory($path = null) { if ( ! is_null($path)) { return $this->directory($path)->requireDirectory(); } if ($iterator = $this->iterateDirectory($this->path)) { return $this->processRequire($iterator); } return $this; }
php
public function requireDirectory($path = null) { if ( ! is_null($path)) { return $this->directory($path)->requireDirectory(); } if ($iterator = $this->iterateDirectory($this->path)) { return $this->processRequire($iterator); } return $this; }
[ "public", "function", "requireDirectory", "(", "$", "path", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "path", ")", ")", "{", "return", "$", "this", "->", "directory", "(", "$", "path", ")", "->", "requireDirectory", "(", ")", ";", ...
Require a directory. @param string $path @return \Basset\Directory
[ "Require", "a", "directory", "." ]
bd8567b83e1562c83ef92aa1b83eed8b2ee3f267
https://github.com/Marwelln/basset/blob/bd8567b83e1562c83ef92aa1b83eed8b2ee3f267/src/Basset/Directory.php#L208-L221
train
Marwelln/basset
src/Basset/Directory.php
Directory.requireTree
public function requireTree($path = null) { if ( ! is_null($path)) { return $this->directory($path)->requireTree(); } if ($iterator = $this->recursivelyIterateDirectory($this->path)) { return $this->processRequire($iterator); } return $this; }
php
public function requireTree($path = null) { if ( ! is_null($path)) { return $this->directory($path)->requireTree(); } if ($iterator = $this->recursivelyIterateDirectory($this->path)) { return $this->processRequire($iterator); } return $this; }
[ "public", "function", "requireTree", "(", "$", "path", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "path", ")", ")", "{", "return", "$", "this", "->", "directory", "(", "$", "path", ")", "->", "requireTree", "(", ")", ";", "}", "i...
Require a directory tree. @param string $path @return \Basset\Directory
[ "Require", "a", "directory", "tree", "." ]
bd8567b83e1562c83ef92aa1b83eed8b2ee3f267
https://github.com/Marwelln/basset/blob/bd8567b83e1562c83ef92aa1b83eed8b2ee3f267/src/Basset/Directory.php#L229-L242
train
Marwelln/basset
src/Basset/Directory.php
Directory.processRequire
protected function processRequire(Iterator $iterator) { // sort iterator by name $iterator = new SortingIterator($iterator, 'strnatcasecmp'); // Spin through each of the files within the iterator and if their a valid asset they // are added to the array of assets for this directory. foreach ($iterator as $file) { if ( ! $file->isFile()) continue; $this->add($file->getPathname()); } return $this; }
php
protected function processRequire(Iterator $iterator) { // sort iterator by name $iterator = new SortingIterator($iterator, 'strnatcasecmp'); // Spin through each of the files within the iterator and if their a valid asset they // are added to the array of assets for this directory. foreach ($iterator as $file) { if ( ! $file->isFile()) continue; $this->add($file->getPathname()); } return $this; }
[ "protected", "function", "processRequire", "(", "Iterator", "$", "iterator", ")", "{", "// sort iterator by name", "$", "iterator", "=", "new", "SortingIterator", "(", "$", "iterator", ",", "'strnatcasecmp'", ")", ";", "// Spin through each of the files within the iterato...
Process a require of either the directory or tree. @param \Iterator $iterator @return \Basset\Directory
[ "Process", "a", "require", "of", "either", "the", "directory", "or", "tree", "." ]
bd8567b83e1562c83ef92aa1b83eed8b2ee3f267
https://github.com/Marwelln/basset/blob/bd8567b83e1562c83ef92aa1b83eed8b2ee3f267/src/Basset/Directory.php#L250-L265
train
Marwelln/basset
src/Basset/Directory.php
Directory.except
public function except($assets) { $assets = array_flatten(func_get_args()); // Store the directory instance on a variable that we can inject into the scope of // the closure below. This allows us to call the path conversion method. $directory = $this; $this->assets = $this->assets->filter(function($asset) use ($assets, $directory) { $path = $directory->getPathRelativeToDirectory($asset->getRelativePath()); return ! in_array($path, $assets); }); return $this; }
php
public function except($assets) { $assets = array_flatten(func_get_args()); // Store the directory instance on a variable that we can inject into the scope of // the closure below. This allows us to call the path conversion method. $directory = $this; $this->assets = $this->assets->filter(function($asset) use ($assets, $directory) { $path = $directory->getPathRelativeToDirectory($asset->getRelativePath()); return ! in_array($path, $assets); }); return $this; }
[ "public", "function", "except", "(", "$", "assets", ")", "{", "$", "assets", "=", "array_flatten", "(", "func_get_args", "(", ")", ")", ";", "// Store the directory instance on a variable that we can inject into the scope of", "// the closure below. This allows us to call the p...
Exclude an array of assets. @param string|array $assets @return \Basset\Directory
[ "Exclude", "an", "array", "of", "assets", "." ]
bd8567b83e1562c83ef92aa1b83eed8b2ee3f267
https://github.com/Marwelln/basset/blob/bd8567b83e1562c83ef92aa1b83eed8b2ee3f267/src/Basset/Directory.php#L273-L289
train
Marwelln/basset
src/Basset/Directory.php
Directory.getPathRelativeToDirectory
public function getPathRelativeToDirectory($path) { // Get the last segment of the directory as asset paths will be relative to this // path. We can then replace this segment with nothing in the assets path. $directoryLastSegment = substr($this->path, strrpos($this->path, '/') + 1); return trim(preg_replace('/^'.$directoryLastSegment.'/', '', $path), '/'); }
php
public function getPathRelativeToDirectory($path) { // Get the last segment of the directory as asset paths will be relative to this // path. We can then replace this segment with nothing in the assets path. $directoryLastSegment = substr($this->path, strrpos($this->path, '/') + 1); return trim(preg_replace('/^'.$directoryLastSegment.'/', '', $path), '/'); }
[ "public", "function", "getPathRelativeToDirectory", "(", "$", "path", ")", "{", "// Get the last segment of the directory as asset paths will be relative to this", "// path. We can then replace this segment with nothing in the assets path.", "$", "directoryLastSegment", "=", "substr", "(...
Get a path relative from the current directory's path. @param string $path @return string
[ "Get", "a", "path", "relative", "from", "the", "current", "directory", "s", "path", "." ]
bd8567b83e1562c83ef92aa1b83eed8b2ee3f267
https://github.com/Marwelln/basset/blob/bd8567b83e1562c83ef92aa1b83eed8b2ee3f267/src/Basset/Directory.php#L321-L328
train
Marwelln/basset
src/Basset/Directory.php
Directory.rawOnEnvironment
public function rawOnEnvironment($environment) { $this->assets->each(function($asset) use ($environment) { $asset->rawOnEnvironment($environment); }); return $this; }
php
public function rawOnEnvironment($environment) { $this->assets->each(function($asset) use ($environment) { $asset->rawOnEnvironment($environment); }); return $this; }
[ "public", "function", "rawOnEnvironment", "(", "$", "environment", ")", "{", "$", "this", "->", "assets", "->", "each", "(", "function", "(", "$", "asset", ")", "use", "(", "$", "environment", ")", "{", "$", "asset", "->", "rawOnEnvironment", "(", "$", ...
All assets within directory will be served raw on a given environment. @return \Basset\Directory
[ "All", "assets", "within", "directory", "will", "be", "served", "raw", "on", "a", "given", "environment", "." ]
bd8567b83e1562c83ef92aa1b83eed8b2ee3f267
https://github.com/Marwelln/basset/blob/bd8567b83e1562c83ef92aa1b83eed8b2ee3f267/src/Basset/Directory.php#L347-L352
train
Marwelln/basset
src/Basset/Directory.php
Directory.getAssets
public function getAssets() { $assets = $this->assets; // Spin through each directory and recursively merge the current directories assets // on to the directories assets. This maintains the order of adding in the array // structure. $this->directories->each(function($directory) use (&$assets) { $assets = $directory->getAssets()->merge($assets); }); // Spin through each of the filters and apply them to each of the assets. Every filter // is applied and then later during the build will be removed if it does not apply // to a given asset. $this->filters->each(function($filter) use (&$assets) { $assets->each(function($asset) use ($filter) { $asset->apply($filter); }); }); return $assets; }
php
public function getAssets() { $assets = $this->assets; // Spin through each directory and recursively merge the current directories assets // on to the directories assets. This maintains the order of adding in the array // structure. $this->directories->each(function($directory) use (&$assets) { $assets = $directory->getAssets()->merge($assets); }); // Spin through each of the filters and apply them to each of the assets. Every filter // is applied and then later during the build will be removed if it does not apply // to a given asset. $this->filters->each(function($filter) use (&$assets) { $assets->each(function($asset) use ($filter) { $asset->apply($filter); }); }); return $assets; }
[ "public", "function", "getAssets", "(", ")", "{", "$", "assets", "=", "$", "this", "->", "assets", ";", "// Spin through each directory and recursively merge the current directories assets", "// on to the directories assets. This maintains the order of adding in the array", "// struc...
Get all the assets. @return \Illuminate\Support\Collection
[ "Get", "all", "the", "assets", "." ]
bd8567b83e1562c83ef92aa1b83eed8b2ee3f267
https://github.com/Marwelln/basset/blob/bd8567b83e1562c83ef92aa1b83eed8b2ee3f267/src/Basset/Directory.php#L369-L390
train
hyyan/jaguar
src/Jaguar/Gradient/LinearGradient.php
LinearGradient.setType
public function setType($type) { if (!in_array($type, self::$supported)) { throw new \InvalidArgumentException(sprintf( 'Invalid LinearGradient Gradient Type ""', (string) $type )); } $this->type = $type; }
php
public function setType($type) { if (!in_array($type, self::$supported)) { throw new \InvalidArgumentException(sprintf( 'Invalid LinearGradient Gradient Type ""', (string) $type )); } $this->type = $type; }
[ "public", "function", "setType", "(", "$", "type", ")", "{", "if", "(", "!", "in_array", "(", "$", "type", ",", "self", "::", "$", "supported", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Invalid LinearGradient G...
Set LinearGradient type @param string $type @throws \InvalidArgumentException
[ "Set", "LinearGradient", "type" ]
ddfe1e65838e86aea4e9cf36a588fe7dcf853576
https://github.com/hyyan/jaguar/blob/ddfe1e65838e86aea4e9cf36a588fe7dcf853576/src/Jaguar/Gradient/LinearGradient.php#L50-L58
train
melisplatform/melis-engine
src/Model/Tables/MelisPageTreeTable.php
MelisPageTreeTable.getFullDatasPage
public function getFullDatasPage($id, $type = '') { $select = $this->tableGateway->getSql()->select(); $select->columns(array('*')); $select->join('melis_cms_page_lang', 'melis_cms_page_lang.plang_page_id = melis_cms_page_tree.tree_page_id', array('plang_lang_id')); $select->join('melis_cms_lang', 'melis_cms_lang.lang_cms_id = melis_cms_page_lang.plang_lang_id', array('*'), $select::JOIN_LEFT); $select->join('melis_cms_page_style', 'melis_cms_page_tree.tree_page_id = melis_cms_page_style.pstyle_page_id', array(), $select::JOIN_LEFT); $select->join('melis_cms_style', ' melis_cms_style.style_id = melis_cms_page_style.pstyle_style_id', array('*'), $select::JOIN_LEFT); if ($type == 'published' || $type == '') $select->join('melis_cms_page_published', 'melis_cms_page_published.page_id = melis_cms_page_tree.tree_page_id', array('*'), $select::JOIN_LEFT); if ($type == 'saved') $select->join('melis_cms_page_saved', 'melis_cms_page_saved.page_id = melis_cms_page_tree.tree_page_id', array('*'), $select::JOIN_LEFT); if ($type == '') { $columns = $this->aliasColumnsFromTableDefinition('MelisEngine\MelisPageColumns', 's_'); $select->join('melis_cms_page_saved', 'melis_cms_page_saved.page_id = melis_cms_page_tree.tree_page_id', $columns, $select::JOIN_LEFT); } $select->join('melis_cms_page_seo', 'melis_cms_page_seo.pseo_id = melis_cms_page_tree.tree_page_id', array('*'), $select::JOIN_LEFT); $select->where('tree_page_id = ' . $id); $resultSet = $this->tableGateway->selectWith($select); return $resultSet; }
php
public function getFullDatasPage($id, $type = '') { $select = $this->tableGateway->getSql()->select(); $select->columns(array('*')); $select->join('melis_cms_page_lang', 'melis_cms_page_lang.plang_page_id = melis_cms_page_tree.tree_page_id', array('plang_lang_id')); $select->join('melis_cms_lang', 'melis_cms_lang.lang_cms_id = melis_cms_page_lang.plang_lang_id', array('*'), $select::JOIN_LEFT); $select->join('melis_cms_page_style', 'melis_cms_page_tree.tree_page_id = melis_cms_page_style.pstyle_page_id', array(), $select::JOIN_LEFT); $select->join('melis_cms_style', ' melis_cms_style.style_id = melis_cms_page_style.pstyle_style_id', array('*'), $select::JOIN_LEFT); if ($type == 'published' || $type == '') $select->join('melis_cms_page_published', 'melis_cms_page_published.page_id = melis_cms_page_tree.tree_page_id', array('*'), $select::JOIN_LEFT); if ($type == 'saved') $select->join('melis_cms_page_saved', 'melis_cms_page_saved.page_id = melis_cms_page_tree.tree_page_id', array('*'), $select::JOIN_LEFT); if ($type == '') { $columns = $this->aliasColumnsFromTableDefinition('MelisEngine\MelisPageColumns', 's_'); $select->join('melis_cms_page_saved', 'melis_cms_page_saved.page_id = melis_cms_page_tree.tree_page_id', $columns, $select::JOIN_LEFT); } $select->join('melis_cms_page_seo', 'melis_cms_page_seo.pseo_id = melis_cms_page_tree.tree_page_id', array('*'), $select::JOIN_LEFT); $select->where('tree_page_id = ' . $id); $resultSet = $this->tableGateway->selectWith($select); return $resultSet; }
[ "public", "function", "getFullDatasPage", "(", "$", "id", ",", "$", "type", "=", "''", ")", "{", "$", "select", "=", "$", "this", "->", "tableGateway", "->", "getSql", "(", ")", "->", "select", "(", ")", ";", "$", "select", "->", "columns", "(", "a...
Gets full datas for a page from tree, page saved, paged published, lang @param int $id PageId @param string $type saved or published to limit
[ "Gets", "full", "datas", "for", "a", "page", "from", "tree", "page", "saved", "paged", "published", "lang" ]
99d4a579aa312e9073ab642c21aae9b2cca6f236
https://github.com/melisplatform/melis-engine/blob/99d4a579aa312e9073ab642c21aae9b2cca6f236/src/Model/Tables/MelisPageTreeTable.php#L27-L64
train
melisplatform/melis-engine
src/Model/Tables/MelisPageTreeTable.php
MelisPageTreeTable.getPageChildrenByidPage
public function getPageChildrenByidPage($id, $publishedOnly = 0) { $select = $this->tableGateway->getSql()->select(); $select->columns(array('*')); $select->join('melis_cms_page_lang', 'melis_cms_page_lang.plang_page_id = melis_cms_page_tree.tree_page_id', array('plang_lang_id')); $select->join('melis_cms_lang', 'melis_cms_lang.lang_cms_id = melis_cms_page_lang.plang_lang_id', array('*'), $select::JOIN_LEFT); $select->join('melis_cms_page_published', 'melis_cms_page_published.page_id = melis_cms_page_tree.tree_page_id', array('*'), $select::JOIN_LEFT); $select->join('melis_cms_page_style', 'melis_cms_page_tree.tree_page_id = melis_cms_page_style.pstyle_page_id', array(), $select::JOIN_LEFT); $select->join('melis_cms_style', ' melis_cms_style.style_id = melis_cms_page_style.pstyle_style_id', array('*'), $select::JOIN_LEFT); if ($publishedOnly == 1) $select->where('melis_cms_page_published.page_status=1'); if ($publishedOnly == 0) { $columns = $this->aliasColumnsFromTableDefinition('MelisEngine\MelisPageColumns', 's_'); $select->join('melis_cms_page_saved', 'melis_cms_page_saved.page_id = melis_cms_page_tree.tree_page_id', $columns, $select::JOIN_LEFT); } $select->join('melis_cms_page_seo', 'melis_cms_page_seo.pseo_id = melis_cms_page_tree.tree_page_id', array('*'), $select::JOIN_LEFT); $select->join('melis_cms_page_default_urls', 'melis_cms_page_default_urls.purl_page_id = melis_cms_page_tree.tree_page_id', array('*'), $select::JOIN_LEFT); $select->where('tree_father_page_id = ' . $id); $select->order('tree_page_order ASC'); $resultSet = $this->tableGateway->selectWith($select); return $resultSet; }
php
public function getPageChildrenByidPage($id, $publishedOnly = 0) { $select = $this->tableGateway->getSql()->select(); $select->columns(array('*')); $select->join('melis_cms_page_lang', 'melis_cms_page_lang.plang_page_id = melis_cms_page_tree.tree_page_id', array('plang_lang_id')); $select->join('melis_cms_lang', 'melis_cms_lang.lang_cms_id = melis_cms_page_lang.plang_lang_id', array('*'), $select::JOIN_LEFT); $select->join('melis_cms_page_published', 'melis_cms_page_published.page_id = melis_cms_page_tree.tree_page_id', array('*'), $select::JOIN_LEFT); $select->join('melis_cms_page_style', 'melis_cms_page_tree.tree_page_id = melis_cms_page_style.pstyle_page_id', array(), $select::JOIN_LEFT); $select->join('melis_cms_style', ' melis_cms_style.style_id = melis_cms_page_style.pstyle_style_id', array('*'), $select::JOIN_LEFT); if ($publishedOnly == 1) $select->where('melis_cms_page_published.page_status=1'); if ($publishedOnly == 0) { $columns = $this->aliasColumnsFromTableDefinition('MelisEngine\MelisPageColumns', 's_'); $select->join('melis_cms_page_saved', 'melis_cms_page_saved.page_id = melis_cms_page_tree.tree_page_id', $columns, $select::JOIN_LEFT); } $select->join('melis_cms_page_seo', 'melis_cms_page_seo.pseo_id = melis_cms_page_tree.tree_page_id', array('*'), $select::JOIN_LEFT); $select->join('melis_cms_page_default_urls', 'melis_cms_page_default_urls.purl_page_id = melis_cms_page_tree.tree_page_id', array('*'), $select::JOIN_LEFT); $select->where('tree_father_page_id = ' . $id); $select->order('tree_page_order ASC'); $resultSet = $this->tableGateway->selectWith($select); return $resultSet; }
[ "public", "function", "getPageChildrenByidPage", "(", "$", "id", ",", "$", "publishedOnly", "=", "0", ")", "{", "$", "select", "=", "$", "this", "->", "tableGateway", "->", "getSql", "(", ")", "->", "select", "(", ")", ";", "$", "select", "->", "column...
Gets the children of a page @param int $id parent page id @param int $publishedOnly If true, only published children page will be brought back
[ "Gets", "the", "children", "of", "a", "page" ]
99d4a579aa312e9073ab642c21aae9b2cca6f236
https://github.com/melisplatform/melis-engine/blob/99d4a579aa312e9073ab642c21aae9b2cca6f236/src/Model/Tables/MelisPageTreeTable.php#L72-L112
train
melisplatform/melis-engine
src/Model/Tables/MelisPageTreeTable.php
MelisPageTreeTable.getPagesBySearchValue
public function getPagesBySearchValue($value, $type = '') { $select = $this->tableGateway->getSql()->select(); $select->columns(array('tree_page_id')); if ($type == 'published' || $type == ''){ $select->join('melis_cms_page_published', 'melis_cms_page_published.page_id = melis_cms_page_tree.tree_page_id', array(), $select::JOIN_LEFT); } if ($type == 'saved'){ $select->join('melis_cms_page_saved', 'melis_cms_page_saved.page_id = melis_cms_page_tree.tree_page_id', array(), $select::JOIN_LEFT); } $select->join('melis_cms_page_style', 'melis_cms_page_tree.tree_page_id = melis_cms_page_style.pstyle_page_id', array(), $select::JOIN_LEFT); $select->join('melis_cms_style', ' melis_cms_style.style_id = melis_cms_page_style.pstyle_style_id', array('*'), $select::JOIN_LEFT); $search = '%'.$value.'%'; $select->where->NEST->like('page_name', $search) ->or->like('melis_cms_page_tree.tree_page_id', $search); $resultSet = $this->tableGateway->selectWith($select); return $resultSet; }
php
public function getPagesBySearchValue($value, $type = '') { $select = $this->tableGateway->getSql()->select(); $select->columns(array('tree_page_id')); if ($type == 'published' || $type == ''){ $select->join('melis_cms_page_published', 'melis_cms_page_published.page_id = melis_cms_page_tree.tree_page_id', array(), $select::JOIN_LEFT); } if ($type == 'saved'){ $select->join('melis_cms_page_saved', 'melis_cms_page_saved.page_id = melis_cms_page_tree.tree_page_id', array(), $select::JOIN_LEFT); } $select->join('melis_cms_page_style', 'melis_cms_page_tree.tree_page_id = melis_cms_page_style.pstyle_page_id', array(), $select::JOIN_LEFT); $select->join('melis_cms_style', ' melis_cms_style.style_id = melis_cms_page_style.pstyle_style_id', array('*'), $select::JOIN_LEFT); $search = '%'.$value.'%'; $select->where->NEST->like('page_name', $search) ->or->like('melis_cms_page_tree.tree_page_id', $search); $resultSet = $this->tableGateway->selectWith($select); return $resultSet; }
[ "public", "function", "getPagesBySearchValue", "(", "$", "value", ",", "$", "type", "=", "''", ")", "{", "$", "select", "=", "$", "this", "->", "tableGateway", "->", "getSql", "(", ")", "->", "select", "(", ")", ";", "$", "select", "->", "columns", "...
This function searches for page name or page id @param string $value The search value @param string $type saved or published to limit returns resultset page ids
[ "This", "function", "searches", "for", "page", "name", "or", "page", "id" ]
99d4a579aa312e9073ab642c21aae9b2cca6f236
https://github.com/melisplatform/melis-engine/blob/99d4a579aa312e9073ab642c21aae9b2cca6f236/src/Model/Tables/MelisPageTreeTable.php#L175-L202
train
melisplatform/melis-engine
src/Model/Tables/MelisTemplateTable.php
MelisTemplateTable.getSortedTemplates
public function getSortedTemplates() { $select = new Select('melis_cms_template'); $select->order('tpl_zf2_website_folder ASC'); $select->order('tpl_name ASC'); $resultSet = $this->tableGateway->selectWith($select); return $resultSet; }
php
public function getSortedTemplates() { $select = new Select('melis_cms_template'); $select->order('tpl_zf2_website_folder ASC'); $select->order('tpl_name ASC'); $resultSet = $this->tableGateway->selectWith($select); return $resultSet; }
[ "public", "function", "getSortedTemplates", "(", ")", "{", "$", "select", "=", "new", "Select", "(", "'melis_cms_template'", ")", ";", "$", "select", "->", "order", "(", "'tpl_zf2_website_folder ASC'", ")", ";", "$", "select", "->", "order", "(", "'tpl_name AS...
Retrieves the data from the Template table in alphabetical order @return NULL|\Zend\Db\ResultSet\ResultSetInterface
[ "Retrieves", "the", "data", "from", "the", "Template", "table", "in", "alphabetical", "order" ]
99d4a579aa312e9073ab642c21aae9b2cca6f236
https://github.com/melisplatform/melis-engine/blob/99d4a579aa312e9073ab642c21aae9b2cca6f236/src/Model/Tables/MelisTemplateTable.php#L29-L39
train
hyyan/jaguar
src/Jaguar/Action/Preset/AbstractPreset.php
AbstractPreset.getOverlayCanvas
public function getOverlayCanvas($file) { $canvas = new Canvas(); $canvas->fromFile(Util::getResourcePath('Preset/'.$file)); return $canvas; }
php
public function getOverlayCanvas($file) { $canvas = new Canvas(); $canvas->fromFile(Util::getResourcePath('Preset/'.$file)); return $canvas; }
[ "public", "function", "getOverlayCanvas", "(", "$", "file", ")", "{", "$", "canvas", "=", "new", "Canvas", "(", ")", ";", "$", "canvas", "->", "fromFile", "(", "Util", "::", "getResourcePath", "(", "'Preset/'", ".", "$", "file", ")", ")", ";", "return"...
Get overlay canvas @param string $file @return \Jaguar\CanvasInterface
[ "Get", "overlay", "canvas" ]
ddfe1e65838e86aea4e9cf36a588fe7dcf853576
https://github.com/hyyan/jaguar/blob/ddfe1e65838e86aea4e9cf36a588fe7dcf853576/src/Jaguar/Action/Preset/AbstractPreset.php#L27-L33
train
mvccore/mvccore
src/MvcCore/Response/Headers.php
Headers.&
public function & SetDisabledHeaders ($disabledHeaders) { /** @var $this \MvcCore\Response */ $this->disabledHeaders = []; $args = func_get_args(); if (count($args) === 1 && is_array($args[0])) $args = $args[0]; foreach ($args as $arg) $this->disabledHeaders[$arg] = TRUE; return $this; }
php
public function & SetDisabledHeaders ($disabledHeaders) { /** @var $this \MvcCore\Response */ $this->disabledHeaders = []; $args = func_get_args(); if (count($args) === 1 && is_array($args[0])) $args = $args[0]; foreach ($args as $arg) $this->disabledHeaders[$arg] = TRUE; return $this; }
[ "public", "function", "&", "SetDisabledHeaders", "(", "$", "disabledHeaders", ")", "{", "/** @var $this \\MvcCore\\Response */", "$", "this", "->", "disabledHeaders", "=", "[", "]", ";", "$", "args", "=", "func_get_args", "(", ")", ";", "if", "(", "count", "("...
Set disabled headers, never sent except if there is rendered exception in development environment. @param \string[] $disabledHeaders,... @return \MvcCore\Response|\MvcCore\IResponse
[ "Set", "disabled", "headers", "never", "sent", "except", "if", "there", "is", "rendered", "exception", "in", "development", "environment", "." ]
5e580a2803bbccea8168316c4c6b963e1910e0bf
https://github.com/mvccore/mvccore/blob/5e580a2803bbccea8168316c4c6b963e1910e0bf/src/MvcCore/Response/Headers.php#L128-L136
train
Brotzka/Laravel-Translation-Manager
src/TranslationManagerServiceProvider.php
TranslationManagerServiceProvider.registerCommands
private function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ \Brotzka\TranslationManager\Module\Console\Commands\TranslationToDatabase::class, \Brotzka\TranslationManager\Module\Console\Commands\TranslationToFile::class ]); } }
php
private function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ \Brotzka\TranslationManager\Module\Console\Commands\TranslationToDatabase::class, \Brotzka\TranslationManager\Module\Console\Commands\TranslationToFile::class ]); } }
[ "private", "function", "registerCommands", "(", ")", "{", "if", "(", "$", "this", "->", "app", "->", "runningInConsole", "(", ")", ")", "{", "$", "this", "->", "commands", "(", "[", "\\", "Brotzka", "\\", "TranslationManager", "\\", "Module", "\\", "Cons...
Registering artisan commands
[ "Registering", "artisan", "commands" ]
46275f605bd25f81f5645e91b78496eea46d04ce
https://github.com/Brotzka/Laravel-Translation-Manager/blob/46275f605bd25f81f5645e91b78496eea46d04ce/src/TranslationManagerServiceProvider.php#L33-L41
train
mvccore/mvccore
src/MvcCore/Config/IniDump.php
IniDump.Dump
public function Dump () { $environment = static::GetEnvironment(TRUE); list($sections, $envSpecifics) = $this->dumpSectionsInfo(); $levelKey = ''; $basicData = []; $sectionsData = []; foreach ($this->data as $key => & $value) { if (is_object($value) || is_array($value)) { if ($sectionsData) $sectionsData[] = ''; $sectionType = isset($sections[$key]) ? $sections[$key] : 0; $environmentSpecificSection = $sectionType === 3; if ($sectionType) { unset($sections[$key]); $sectionsData[] = ($environmentSpecificSection ? '[' . $environment . ' > ' . $key . ']' : '[' . $key . ']'); $levelKey = ''; } else { $levelKey = (string) $key; } $this->dumpRecursive($levelKey, $value, $sectionsData); if ($environmentSpecificSection && isset($envSpecifics[$key])) { foreach ($envSpecifics[$key] as $envName => $sectionLines) { if ($envName === $environment) continue; $sectionsData[] = ''; foreach ($sectionLines as $sectionLine) $sectionsData[] = $sectionLine; } } } else { $basicData[] = $key . ' = ' . $this->dumpScalarValue($value); } } $result = ''; if ($basicData) $result = implode(PHP_EOL, $basicData); if ($sectionsData) $result .= PHP_EOL . PHP_EOL . implode(PHP_EOL, $sectionsData); return $result; }
php
public function Dump () { $environment = static::GetEnvironment(TRUE); list($sections, $envSpecifics) = $this->dumpSectionsInfo(); $levelKey = ''; $basicData = []; $sectionsData = []; foreach ($this->data as $key => & $value) { if (is_object($value) || is_array($value)) { if ($sectionsData) $sectionsData[] = ''; $sectionType = isset($sections[$key]) ? $sections[$key] : 0; $environmentSpecificSection = $sectionType === 3; if ($sectionType) { unset($sections[$key]); $sectionsData[] = ($environmentSpecificSection ? '[' . $environment . ' > ' . $key . ']' : '[' . $key . ']'); $levelKey = ''; } else { $levelKey = (string) $key; } $this->dumpRecursive($levelKey, $value, $sectionsData); if ($environmentSpecificSection && isset($envSpecifics[$key])) { foreach ($envSpecifics[$key] as $envName => $sectionLines) { if ($envName === $environment) continue; $sectionsData[] = ''; foreach ($sectionLines as $sectionLine) $sectionsData[] = $sectionLine; } } } else { $basicData[] = $key . ' = ' . $this->dumpScalarValue($value); } } $result = ''; if ($basicData) $result = implode(PHP_EOL, $basicData); if ($sectionsData) $result .= PHP_EOL . PHP_EOL . implode(PHP_EOL, $sectionsData); return $result; }
[ "public", "function", "Dump", "(", ")", "{", "$", "environment", "=", "static", "::", "GetEnvironment", "(", "TRUE", ")", ";", "list", "(", "$", "sections", ",", "$", "envSpecifics", ")", "=", "$", "this", "->", "dumpSectionsInfo", "(", ")", ";", "$", ...
Dump configuration data in INI syntax with originally loaded sections and environment dependency support. This method try to load original INI file if exists and creates INI sections by original file. Or all data are rendered in plain structure without any section. If there is in original config file any section for different environment, this method dumps that section content immediately after current environment section, so all data for different environment stays there. @return string
[ "Dump", "configuration", "data", "in", "INI", "syntax", "with", "originally", "loaded", "sections", "and", "environment", "dependency", "support", ".", "This", "method", "try", "to", "load", "original", "INI", "file", "if", "exists", "and", "creates", "INI", "...
5e580a2803bbccea8168316c4c6b963e1910e0bf
https://github.com/mvccore/mvccore/blob/5e580a2803bbccea8168316c4c6b963e1910e0bf/src/MvcCore/Config/IniDump.php#L28-L65
train
mvccore/mvccore
src/MvcCore/Config/IniDump.php
IniDump.dumpScalarValue
protected function dumpScalarValue ($value) { if (is_numeric($value)) { return (string) $value; } else if (is_bool($value)) { return $value ? 'true' : 'false'; } else if ($value === NULL) { return 'null'; } else { static $specialChars = [ '=', '/', '.', '#', '&', '!', '?', '-', '@', "'", '"', '*', '^', '[', ']', '(', ')', '{', '}', '<', '>', '\n', '\r', ]; $valueStr = (string) $value; $specialCharCaught = FALSE; foreach ($specialChars as $specialChar) { if (mb_strpos($valueStr, $specialChar)) { $specialCharCaught = TRUE; break; } } if ($specialCharCaught) { return '"' . addcslashes($valueStr, '"') . '"'; } else { return $valueStr; } } }
php
protected function dumpScalarValue ($value) { if (is_numeric($value)) { return (string) $value; } else if (is_bool($value)) { return $value ? 'true' : 'false'; } else if ($value === NULL) { return 'null'; } else { static $specialChars = [ '=', '/', '.', '#', '&', '!', '?', '-', '@', "'", '"', '*', '^', '[', ']', '(', ')', '{', '}', '<', '>', '\n', '\r', ]; $valueStr = (string) $value; $specialCharCaught = FALSE; foreach ($specialChars as $specialChar) { if (mb_strpos($valueStr, $specialChar)) { $specialCharCaught = TRUE; break; } } if ($specialCharCaught) { return '"' . addcslashes($valueStr, '"') . '"'; } else { return $valueStr; } } }
[ "protected", "function", "dumpScalarValue", "(", "$", "value", ")", "{", "if", "(", "is_numeric", "(", "$", "value", ")", ")", "{", "return", "(", "string", ")", "$", "value", ";", "}", "else", "if", "(", "is_bool", "(", "$", "value", ")", ")", "{"...
Dump any PHP scalar value into INI syntax by special local static configuration array. @param mixed $value @return string
[ "Dump", "any", "PHP", "scalar", "value", "into", "INI", "syntax", "by", "special", "local", "static", "configuration", "array", "." ]
5e580a2803bbccea8168316c4c6b963e1910e0bf
https://github.com/mvccore/mvccore/blob/5e580a2803bbccea8168316c4c6b963e1910e0bf/src/MvcCore/Config/IniDump.php#L136-L162
train
PatternBuilder/pattern-builder-lib-php
src/Property/LeafProperty.php
LeafProperty.initDefaultProperties
public function initDefaultProperties() { if (isset($this->schema) && $this->setPropertyDefaultValue($this->schema)) { $this->property_value = $this->schema->default; } }
php
public function initDefaultProperties() { if (isset($this->schema) && $this->setPropertyDefaultValue($this->schema)) { $this->property_value = $this->schema->default; } }
[ "public", "function", "initDefaultProperties", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "schema", ")", "&&", "$", "this", "->", "setPropertyDefaultValue", "(", "$", "this", "->", "schema", ")", ")", "{", "$", "this", "->", "property_val...
Instantiate the property default value.
[ "Instantiate", "the", "property", "default", "value", "." ]
6cdbb4e62a560e05b29ebfbd223581be2ace9176
https://github.com/PatternBuilder/pattern-builder-lib-php/blob/6cdbb4e62a560e05b29ebfbd223581be2ace9176/src/Property/LeafProperty.php#L29-L34
train
Marwelln/basset
src/Basset/Console/BuildCommand.php
BuildCommand.gatherCollections
protected function gatherCollections() { if ( ! is_null($collection = $this->input->getArgument('collection'))) { if ( ! $this->environment->has($collection)) { $this->comment('['.$collection.'] Collection not found.'); return array(); } $this->comment('Gathering assets for collection...'); $collections = array($collection => $this->environment->collection($collection)); } else { $this->comment('Gathering all collections to build...'); $collections = $this->environment->all(); } $this->line(''); return $collections; }
php
protected function gatherCollections() { if ( ! is_null($collection = $this->input->getArgument('collection'))) { if ( ! $this->environment->has($collection)) { $this->comment('['.$collection.'] Collection not found.'); return array(); } $this->comment('Gathering assets for collection...'); $collections = array($collection => $this->environment->collection($collection)); } else { $this->comment('Gathering all collections to build...'); $collections = $this->environment->all(); } $this->line(''); return $collections; }
[ "protected", "function", "gatherCollections", "(", ")", "{", "if", "(", "!", "is_null", "(", "$", "collection", "=", "$", "this", "->", "input", "->", "getArgument", "(", "'collection'", ")", ")", ")", "{", "if", "(", "!", "$", "this", "->", "environme...
Gather the collections to be built. @return array
[ "Gather", "the", "collections", "to", "be", "built", "." ]
bd8567b83e1562c83ef92aa1b83eed8b2ee3f267
https://github.com/Marwelln/basset/blob/bd8567b83e1562c83ef92aa1b83eed8b2ee3f267/src/Basset/Console/BuildCommand.php#L158-L183
train
Marwelln/basset
src/Basset/Factory/AssetFactory.php
AssetFactory.make
public function make($path) { $absolutePath = $this->buildAbsolutePath($path); $relativePath = $this->buildRelativePath($absolutePath); $asset = new Asset($this->files, $this->factory, $this->appEnvironment, $absolutePath, $relativePath); return $asset->setOrder($this->nextAssetOrder()); }
php
public function make($path) { $absolutePath = $this->buildAbsolutePath($path); $relativePath = $this->buildRelativePath($absolutePath); $asset = new Asset($this->files, $this->factory, $this->appEnvironment, $absolutePath, $relativePath); return $asset->setOrder($this->nextAssetOrder()); }
[ "public", "function", "make", "(", "$", "path", ")", "{", "$", "absolutePath", "=", "$", "this", "->", "buildAbsolutePath", "(", "$", "path", ")", ";", "$", "relativePath", "=", "$", "this", "->", "buildRelativePath", "(", "$", "absolutePath", ")", ";", ...
Make a new asset instance. @param string $path @return \Basset\Asset
[ "Make", "a", "new", "asset", "instance", "." ]
bd8567b83e1562c83ef92aa1b83eed8b2ee3f267
https://github.com/Marwelln/basset/blob/bd8567b83e1562c83ef92aa1b83eed8b2ee3f267/src/Basset/Factory/AssetFactory.php#L57-L66
train
Marwelln/basset
src/Basset/Factory/AssetFactory.php
AssetFactory.buildRelativePath
public function buildRelativePath($path) { if (is_null($path)) return $path; $relativePath = str_replace(array(realpath($this->publicPath), '\\'), array('', '/'), $path); // If the asset is not a remote asset then we'll trim the relative path even further to remove // any unnecessary leading or trailing slashes. This will leave us with a nice relative path. if ( ! starts_with($path, '//') and ! (bool) filter_var($path, FILTER_VALIDATE_URL)) { $relativePath = trim($relativePath, '/'); // If the given path is the same as the built relative path then the asset appears to be // outside of the public directory. If this is the case then we'll use an MD5 hash of // the assets path as the relative path to the asset. if (trim(str_replace('\\', '/', $path), '/') == trim($relativePath, '/')) { $path = pathinfo($path); $relativePath = md5($path['dirname']).'/'.$path['basename']; } } return $relativePath; }
php
public function buildRelativePath($path) { if (is_null($path)) return $path; $relativePath = str_replace(array(realpath($this->publicPath), '\\'), array('', '/'), $path); // If the asset is not a remote asset then we'll trim the relative path even further to remove // any unnecessary leading or trailing slashes. This will leave us with a nice relative path. if ( ! starts_with($path, '//') and ! (bool) filter_var($path, FILTER_VALIDATE_URL)) { $relativePath = trim($relativePath, '/'); // If the given path is the same as the built relative path then the asset appears to be // outside of the public directory. If this is the case then we'll use an MD5 hash of // the assets path as the relative path to the asset. if (trim(str_replace('\\', '/', $path), '/') == trim($relativePath, '/')) { $path = pathinfo($path); $relativePath = md5($path['dirname']).'/'.$path['basename']; } } return $relativePath; }
[ "public", "function", "buildRelativePath", "(", "$", "path", ")", "{", "if", "(", "is_null", "(", "$", "path", ")", ")", "return", "$", "path", ";", "$", "relativePath", "=", "str_replace", "(", "array", "(", "realpath", "(", "$", "this", "->", "public...
Build the relative path to an asset. @param string $path @return string
[ "Build", "the", "relative", "path", "to", "an", "asset", "." ]
bd8567b83e1562c83ef92aa1b83eed8b2ee3f267
https://github.com/Marwelln/basset/blob/bd8567b83e1562c83ef92aa1b83eed8b2ee3f267/src/Basset/Factory/AssetFactory.php#L87-L111
train
mvccore/mvccore
src/MvcCore/Config/ReadWrite.php
ReadWrite.&
public static function & GetConfig ($appRootRelativePath) { if (!isset(self::$configsCache[$appRootRelativePath])) { $app = self::$app ?: self::$app = & \MvcCore\Application::GetInstance(); $systemConfigClass = $app->GetConfigClass(); $system = $systemConfigClass::GetSystemConfigPath() === '/' . ltrim($appRootRelativePath, '/'); self::$configsCache[$appRootRelativePath] = & self::getConfigInstance( $appRootRelativePath, $system ); } return self::$configsCache[$appRootRelativePath]; }
php
public static function & GetConfig ($appRootRelativePath) { if (!isset(self::$configsCache[$appRootRelativePath])) { $app = self::$app ?: self::$app = & \MvcCore\Application::GetInstance(); $systemConfigClass = $app->GetConfigClass(); $system = $systemConfigClass::GetSystemConfigPath() === '/' . ltrim($appRootRelativePath, '/'); self::$configsCache[$appRootRelativePath] = & self::getConfigInstance( $appRootRelativePath, $system ); } return self::$configsCache[$appRootRelativePath]; }
[ "public", "static", "function", "&", "GetConfig", "(", "$", "appRootRelativePath", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "configsCache", "[", "$", "appRootRelativePath", "]", ")", ")", "{", "$", "app", "=", "self", "::", "$", "app"...
Get cached config INI file as `stdClass`es and `array`s, placed relatively from application document root. @param string $appRootRelativePath Any config relative path like `'/%appPath%/website.ini'`. @return \MvcCore\Config|\MvcCore\IConfig|bool
[ "Get", "cached", "config", "INI", "file", "as", "stdClass", "es", "and", "array", "s", "placed", "relatively", "from", "application", "document", "root", "." ]
5e580a2803bbccea8168316c4c6b963e1910e0bf
https://github.com/mvccore/mvccore/blob/5e580a2803bbccea8168316c4c6b963e1910e0bf/src/MvcCore/Config/ReadWrite.php#L64-L74
train
mvccore/mvccore
src/MvcCore/Config/ReadWrite.php
ReadWrite.&
protected static function & getConfigInstance ($appRootRelativePath, $systemConfig = FALSE) { $app = self::$app ?: self::$app = & \MvcCore\Application::GetInstance(); $appRoot = self::$appRoot ?: self::$appRoot = $app->GetRequest()->GetAppRoot(); $fullPath = $appRoot . '/' . str_replace( '%appPath%', $app->GetAppDir(), ltrim($appRootRelativePath, '/') ); if (!file_exists($fullPath)) { $result = FALSE; } else { $systemConfigClass = $app->GetConfigClass(); $result = $systemConfigClass::CreateInstance(); if (!$result->Read($fullPath, $systemConfig)) $result = FALSE; } return $result; }
php
protected static function & getConfigInstance ($appRootRelativePath, $systemConfig = FALSE) { $app = self::$app ?: self::$app = & \MvcCore\Application::GetInstance(); $appRoot = self::$appRoot ?: self::$appRoot = $app->GetRequest()->GetAppRoot(); $fullPath = $appRoot . '/' . str_replace( '%appPath%', $app->GetAppDir(), ltrim($appRootRelativePath, '/') ); if (!file_exists($fullPath)) { $result = FALSE; } else { $systemConfigClass = $app->GetConfigClass(); $result = $systemConfigClass::CreateInstance(); if (!$result->Read($fullPath, $systemConfig)) $result = FALSE; } return $result; }
[ "protected", "static", "function", "&", "getConfigInstance", "(", "$", "appRootRelativePath", ",", "$", "systemConfig", "=", "FALSE", ")", "{", "$", "app", "=", "self", "::", "$", "app", "?", ":", "self", "::", "$", "app", "=", "&", "\\", "MvcCore", "\...
Try to load and parse config file by app root relative path. If config contains system data, try to detect environment. @param string $appRootRelativePath @param bool $systemConfig @return \MvcCore\Config|\MvcCore\IConfig|bool
[ "Try", "to", "load", "and", "parse", "config", "file", "by", "app", "root", "relative", "path", ".", "If", "config", "contains", "system", "data", "try", "to", "detect", "environment", "." ]
5e580a2803bbccea8168316c4c6b963e1910e0bf
https://github.com/mvccore/mvccore/blob/5e580a2803bbccea8168316c4c6b963e1910e0bf/src/MvcCore/Config/ReadWrite.php#L109-L124
train
cpliakas/psolr
src/PSolr/Client/SolrClient.php
SolrClient.normalizeParams
public function normalizeParams(RequestHandler $handler, $params) { if (is_string($params)) { $params = array('q' => $params); } elseif (!is_array($params)) { $params = (array) $params; } return array_merge($handler->getDefaultParams(), $params); }
php
public function normalizeParams(RequestHandler $handler, $params) { if (is_string($params)) { $params = array('q' => $params); } elseif (!is_array($params)) { $params = (array) $params; } return array_merge($handler->getDefaultParams(), $params); }
[ "public", "function", "normalizeParams", "(", "RequestHandler", "$", "handler", ",", "$", "params", ")", "{", "if", "(", "is_string", "(", "$", "params", ")", ")", "{", "$", "params", "=", "array", "(", "'q'", "=>", "$", "params", ")", ";", "}", "els...
Normalizes and merges default params. @param \PSolr\Client\RequestHandler $handler @param mixed $params @return array
[ "Normalizes", "and", "merges", "default", "params", "." ]
43098fa346a706f481e7a1408664d4582f7ce675
https://github.com/cpliakas/psolr/blob/43098fa346a706f481e7a1408664d4582f7ce675/src/PSolr/Client/SolrClient.php#L174-L182
train
mvccore/mvccore
src/MvcCore/Tool/OopChecking.php
OopChecking.CheckClassInterface
public static function CheckClassInterface ($testClassName, $interfaceName, $checkStaticMethods = FALSE, $throwException = TRUE) { $result = FALSE; $errorMsg = ''; // check given test class for all implemented instance methods by given interface $interfaceName = trim($interfaceName, '\\'); $testClassType = new \ReflectionClass($testClassName); if (in_array($interfaceName, $testClassType->getInterfaceNames(), TRUE)) { $result = TRUE; } else { $errorMsg = "Class `$testClassName` doesn't implement interface `$interfaceName`."; } if ($result && $checkStaticMethods) { // check given test class for all implemented static methods by given interface $allStaticsImplemented = TRUE; $interfaceMethods = static::checkClassInterfaceGetPublicStaticMethods($interfaceName); foreach ($interfaceMethods as $methodName) { if (!$testClassType->hasMethod($methodName)) { $allStaticsImplemented = FALSE; $errorMsg = "Class `$testClassName` doesn't implement static method `$methodName` from interface `$interfaceName`."; break; } $testClassStaticMethod = $testClassType->getMethod($methodName); if (!$testClassStaticMethod->isStatic()) { $allStaticsImplemented = FALSE; $errorMsg = "Class `$testClassName` doesn't implement static method `$methodName` from interface `$interfaceName`, method is not static."; break; } // arguments compatibility in presented static method are automatically checked by PHP } if (!$allStaticsImplemented) $result = FALSE; } // return result or thrown an exception if ($result) return TRUE; if (!$throwException) return FALSE; $selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__; throw new \InvalidArgumentException("[".$selfClass."] " . $errorMsg); }
php
public static function CheckClassInterface ($testClassName, $interfaceName, $checkStaticMethods = FALSE, $throwException = TRUE) { $result = FALSE; $errorMsg = ''; // check given test class for all implemented instance methods by given interface $interfaceName = trim($interfaceName, '\\'); $testClassType = new \ReflectionClass($testClassName); if (in_array($interfaceName, $testClassType->getInterfaceNames(), TRUE)) { $result = TRUE; } else { $errorMsg = "Class `$testClassName` doesn't implement interface `$interfaceName`."; } if ($result && $checkStaticMethods) { // check given test class for all implemented static methods by given interface $allStaticsImplemented = TRUE; $interfaceMethods = static::checkClassInterfaceGetPublicStaticMethods($interfaceName); foreach ($interfaceMethods as $methodName) { if (!$testClassType->hasMethod($methodName)) { $allStaticsImplemented = FALSE; $errorMsg = "Class `$testClassName` doesn't implement static method `$methodName` from interface `$interfaceName`."; break; } $testClassStaticMethod = $testClassType->getMethod($methodName); if (!$testClassStaticMethod->isStatic()) { $allStaticsImplemented = FALSE; $errorMsg = "Class `$testClassName` doesn't implement static method `$methodName` from interface `$interfaceName`, method is not static."; break; } // arguments compatibility in presented static method are automatically checked by PHP } if (!$allStaticsImplemented) $result = FALSE; } // return result or thrown an exception if ($result) return TRUE; if (!$throwException) return FALSE; $selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__; throw new \InvalidArgumentException("[".$selfClass."] " . $errorMsg); }
[ "public", "static", "function", "CheckClassInterface", "(", "$", "testClassName", ",", "$", "interfaceName", ",", "$", "checkStaticMethods", "=", "FALSE", ",", "$", "throwException", "=", "TRUE", ")", "{", "$", "result", "=", "FALSE", ";", "$", "errorMsg", "...
Check if given class implements given interface, else throw an exception. @param string $testClassName Full test class name. @param string $interfaceName Full interface class name. @param bool $checkStaticMethods Check implementation of all static methods by interface static methods. @param bool $throwException If `TRUE`, throw an exception if something is not implemented or if `FALSE` return `FALSE` only. @throws \InvalidArgumentException @return bool
[ "Check", "if", "given", "class", "implements", "given", "interface", "else", "throw", "an", "exception", "." ]
5e580a2803bbccea8168316c4c6b963e1910e0bf
https://github.com/mvccore/mvccore/blob/5e580a2803bbccea8168316c4c6b963e1910e0bf/src/MvcCore/Tool/OopChecking.php#L35-L71
train
mvccore/mvccore
src/MvcCore/Tool/OopChecking.php
OopChecking.CheckClassTrait
public static function CheckClassTrait ($testClassName, $traitName, $checkParentClasses = FALSE, $throwException = TRUE) { $result = FALSE; $errorMsg = ''; // check given test class for all implemented instance methods by given interface $testClassType = new \ReflectionClass($testClassName); if (in_array($traitName, $testClassType->getTraitNames(), TRUE)) { $result = TRUE; } else if ($checkParentClasses) { $currentClassType = $testClassType; while (TRUE) { $parentClass = $currentClassType->getParentClass(); if ($parentClass === FALSE) break; $parentClassType = new \ReflectionClass($parentClass->getName()); if (in_array($traitName, $parentClassType->getTraitNames(), TRUE)) { $result = TRUE; break; } else { $currentClassType = $parentClassType; } } } if (!$result) $errorMsg = "Class `$testClassName` doesn't implement trait `$traitName`."; // return result or thrown an exception if ($result) return TRUE; if (!$throwException) return FALSE; $selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__; throw new \InvalidArgumentException("[".$selfClass."] " . $errorMsg); }
php
public static function CheckClassTrait ($testClassName, $traitName, $checkParentClasses = FALSE, $throwException = TRUE) { $result = FALSE; $errorMsg = ''; // check given test class for all implemented instance methods by given interface $testClassType = new \ReflectionClass($testClassName); if (in_array($traitName, $testClassType->getTraitNames(), TRUE)) { $result = TRUE; } else if ($checkParentClasses) { $currentClassType = $testClassType; while (TRUE) { $parentClass = $currentClassType->getParentClass(); if ($parentClass === FALSE) break; $parentClassType = new \ReflectionClass($parentClass->getName()); if (in_array($traitName, $parentClassType->getTraitNames(), TRUE)) { $result = TRUE; break; } else { $currentClassType = $parentClassType; } } } if (!$result) $errorMsg = "Class `$testClassName` doesn't implement trait `$traitName`."; // return result or thrown an exception if ($result) return TRUE; if (!$throwException) return FALSE; $selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__; throw new \InvalidArgumentException("[".$selfClass."] " . $errorMsg); }
[ "public", "static", "function", "CheckClassTrait", "(", "$", "testClassName", ",", "$", "traitName", ",", "$", "checkParentClasses", "=", "FALSE", ",", "$", "throwException", "=", "TRUE", ")", "{", "$", "result", "=", "FALSE", ";", "$", "errorMsg", "=", "'...
Check if given class implements given trait, else throw an exception. @param string $testClassName Full test class name. @param string $traitName Full trait class name. @param bool $checkParentClasses If `TRUE`, trait implementation will be checked on all parent classes until success. Default is `FALSE`. @param bool $throwException If `TRUE`, throw an exception if trait is not implemented or if `FALSE` return `FALSE` only. @throws \InvalidArgumentException @return boolean
[ "Check", "if", "given", "class", "implements", "given", "trait", "else", "throw", "an", "exception", "." ]
5e580a2803bbccea8168316c4c6b963e1910e0bf
https://github.com/mvccore/mvccore/blob/5e580a2803bbccea8168316c4c6b963e1910e0bf/src/MvcCore/Tool/OopChecking.php#L82-L110
train
mvccore/mvccore
src/MvcCore/Tool/OopChecking.php
OopChecking.&
protected static function & checkClassInterfaceGetPublicStaticMethods ($interfaceName) { if (!isset(static::$interfacesStaticMethodsCache[$interfaceName])) { $methods = []; $interfaceType = new \ReflectionClass($interfaceName); $publicOrStaticMethods = $interfaceType->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_STATIC); /** @var $publicOrStaticMethod \ReflectionMethod */ foreach ($publicOrStaticMethods as $publicOrStaticMethod) { // filter methods for public and also static method only if ($publicOrStaticMethod->isStatic() && $publicOrStaticMethod->isPublic()) { $methods[] = $publicOrStaticMethod->getName(); } } static::$interfacesStaticMethodsCache[$interfaceName] = $methods; } return static::$interfacesStaticMethodsCache[$interfaceName]; }
php
protected static function & checkClassInterfaceGetPublicStaticMethods ($interfaceName) { if (!isset(static::$interfacesStaticMethodsCache[$interfaceName])) { $methods = []; $interfaceType = new \ReflectionClass($interfaceName); $publicOrStaticMethods = $interfaceType->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_STATIC); /** @var $publicOrStaticMethod \ReflectionMethod */ foreach ($publicOrStaticMethods as $publicOrStaticMethod) { // filter methods for public and also static method only if ($publicOrStaticMethod->isStatic() && $publicOrStaticMethod->isPublic()) { $methods[] = $publicOrStaticMethod->getName(); } } static::$interfacesStaticMethodsCache[$interfaceName] = $methods; } return static::$interfacesStaticMethodsCache[$interfaceName]; }
[ "protected", "static", "function", "&", "checkClassInterfaceGetPublicStaticMethods", "(", "$", "interfaceName", ")", "{", "if", "(", "!", "isset", "(", "static", "::", "$", "interfacesStaticMethodsCache", "[", "$", "interfaceName", "]", ")", ")", "{", "$", "meth...
Complete array with only static and also only public method names by given interface name. Return completed array and cache it in static local array. @param string $interfaceName @return array
[ "Complete", "array", "with", "only", "static", "and", "also", "only", "public", "method", "names", "by", "given", "interface", "name", ".", "Return", "completed", "array", "and", "cache", "it", "in", "static", "local", "array", "." ]
5e580a2803bbccea8168316c4c6b963e1910e0bf
https://github.com/mvccore/mvccore/blob/5e580a2803bbccea8168316c4c6b963e1910e0bf/src/MvcCore/Tool/OopChecking.php#L118-L133
train
Okipa/laravel-html-helper
src/HtmlAttributes.php
HtmlAttributes.generateHtmlString
protected function generateHtmlString(...$attributesList): HtmlString { $attributesArray = $this->buildAttributesArray(...$attributesList); $html = $this->buildHtmlString($attributesArray); return new HtmlString($html); }
php
protected function generateHtmlString(...$attributesList): HtmlString { $attributesArray = $this->buildAttributesArray(...$attributesList); $html = $this->buildHtmlString($attributesArray); return new HtmlString($html); }
[ "protected", "function", "generateHtmlString", "(", "...", "$", "attributesList", ")", ":", "HtmlString", "{", "$", "attributesArray", "=", "$", "this", "->", "buildAttributesArray", "(", "...", "$", "attributesList", ")", ";", "$", "html", "=", "$", "this", ...
Render html attributes from the given attributes list. @param mixed $attributesList @return \Illuminate\Support\HtmlString @throws \Exception
[ "Render", "html", "attributes", "from", "the", "given", "attributes", "list", "." ]
62def79c2421dd4d39600a5c77f08837d3b15da5
https://github.com/Okipa/laravel-html-helper/blob/62def79c2421dd4d39600a5c77f08837d3b15da5/src/HtmlAttributes.php#L31-L37
train
Okipa/laravel-html-helper
src/HtmlAttributes.php
HtmlAttributes.buildHtmlString
protected function buildHtmlString(array $attributesArray): string { $html = ''; foreach ($attributesArray as $key => $attribute) { $spacer = strlen($html) ? ' ' : ''; if ($key && is_string($key)) { $html .= $spacer . $key . ($attribute ? '="' . $attribute . '"' : ''); } else { $html .= $spacer . $attribute; } } return $html; }
php
protected function buildHtmlString(array $attributesArray): string { $html = ''; foreach ($attributesArray as $key => $attribute) { $spacer = strlen($html) ? ' ' : ''; if ($key && is_string($key)) { $html .= $spacer . $key . ($attribute ? '="' . $attribute . '"' : ''); } else { $html .= $spacer . $attribute; } } return $html; }
[ "protected", "function", "buildHtmlString", "(", "array", "$", "attributesArray", ")", ":", "string", "{", "$", "html", "=", "''", ";", "foreach", "(", "$", "attributesArray", "as", "$", "key", "=>", "$", "attribute", ")", "{", "$", "spacer", "=", "strle...
Build the html string from the attributes array. @param array $attributesArray @return string
[ "Build", "the", "html", "string", "from", "the", "attributes", "array", "." ]
62def79c2421dd4d39600a5c77f08837d3b15da5
https://github.com/Okipa/laravel-html-helper/blob/62def79c2421dd4d39600a5c77f08837d3b15da5/src/HtmlAttributes.php#L106-L119
train
Crell/HtmlModel
src/StatusCodeContainerTrait.php
StatusCodeContainerTrait.withStatusCode
public function withStatusCode(int $code) { if ($this->statusCode == $code) { return $this; } $that = clone($this); $that->statusCode = $code; return $that; }
php
public function withStatusCode(int $code) { if ($this->statusCode == $code) { return $this; } $that = clone($this); $that->statusCode = $code; return $that; }
[ "public", "function", "withStatusCode", "(", "int", "$", "code", ")", "{", "if", "(", "$", "this", "->", "statusCode", "==", "$", "code", ")", "{", "return", "$", "this", ";", "}", "$", "that", "=", "clone", "(", "$", "this", ")", ";", "$", "that...
Returns a copy of the page with the status code set. @param int $code The status code to set. @return static
[ "Returns", "a", "copy", "of", "the", "page", "with", "the", "status", "code", "set", "." ]
e3de382180730aff2f2b4f1b0b8bff7a2d86e175
https://github.com/Crell/HtmlModel/blob/e3de382180730aff2f2b4f1b0b8bff7a2d86e175/src/StatusCodeContainerTrait.php#L35-L44
train
hyyan/jaguar
src/Jaguar/Drawable/Text.php
Text.setLineSpacing
public function setLineSpacing($spacing) { if ($spacing < 0) { throw new \InvalidArgumentException(sprintf( 'Invalid Line Spacing "%s" - Spacing Must Be Greater Than Zero' , (string) $spacing )); } $this->spacing = (float) $spacing; return $this; }
php
public function setLineSpacing($spacing) { if ($spacing < 0) { throw new \InvalidArgumentException(sprintf( 'Invalid Line Spacing "%s" - Spacing Must Be Greater Than Zero' , (string) $spacing )); } $this->spacing = (float) $spacing; return $this; }
[ "public", "function", "setLineSpacing", "(", "$", "spacing", ")", "{", "if", "(", "$", "spacing", "<", "0", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Invalid Line Spacing \"%s\" - Spacing Must Be Greater Than Zero'", ",", "("...
Set the line spacing @param float $spacing @return \Jaguar\Draw\Text
[ "Set", "the", "line", "spacing" ]
ddfe1e65838e86aea4e9cf36a588fe7dcf853576
https://github.com/hyyan/jaguar/blob/ddfe1e65838e86aea4e9cf36a588fe7dcf853576/src/Jaguar/Drawable/Text.php#L183-L194
train
hyyan/jaguar
src/Jaguar/Drawable/Text.php
Text.getBoundingBox
public function getBoundingBox($padding = 10) { $bare = imageftbbox( $this->getFontSize() , 0 , $this->getFont() , $this->getString() , array('linespacing' => $this->getLineSpacing()) ); $a = deg2rad($this->getAngle()); $ca = cos($a); $sa = sin($a); $rect = array(); for ($i = 0; $i < 7; $i += 2) { $rect[$i] = round($bare[$i] * $ca + $bare[$i + 1] * $sa); $rect[$i + 1] = round($bare[$i + 1] * $ca - $bare[$i] * $sa); } $minX = min(array($rect[0], $rect[2], $rect[4], $rect[6])); $maxX = max(array($rect[0], $rect[2], $rect[4], $rect[6])); $minY = min(array($rect[1], $rect[3], $rect[5], $rect[7])); $maxY = max(array($rect[1], $rect[3], $rect[5], $rect[7])); $dx = $this->getCoordinate()->getX() - abs($minX) - 1; $dy = $this->getCoordinate()->getY() - abs($minY) - 1 + $this->getFontSize(); $width = $maxX - $minX; $height = $maxY - $minY; $padding = (int) $padding; $dimension = new Dimension( $width + 2 + ($padding * 2) , $height + 2 + ($padding * 2) ); $coordinate = new Coordinate( $dx - $padding , $dy - $padding ); return new Box($dimension, $coordinate); }
php
public function getBoundingBox($padding = 10) { $bare = imageftbbox( $this->getFontSize() , 0 , $this->getFont() , $this->getString() , array('linespacing' => $this->getLineSpacing()) ); $a = deg2rad($this->getAngle()); $ca = cos($a); $sa = sin($a); $rect = array(); for ($i = 0; $i < 7; $i += 2) { $rect[$i] = round($bare[$i] * $ca + $bare[$i + 1] * $sa); $rect[$i + 1] = round($bare[$i + 1] * $ca - $bare[$i] * $sa); } $minX = min(array($rect[0], $rect[2], $rect[4], $rect[6])); $maxX = max(array($rect[0], $rect[2], $rect[4], $rect[6])); $minY = min(array($rect[1], $rect[3], $rect[5], $rect[7])); $maxY = max(array($rect[1], $rect[3], $rect[5], $rect[7])); $dx = $this->getCoordinate()->getX() - abs($minX) - 1; $dy = $this->getCoordinate()->getY() - abs($minY) - 1 + $this->getFontSize(); $width = $maxX - $minX; $height = $maxY - $minY; $padding = (int) $padding; $dimension = new Dimension( $width + 2 + ($padding * 2) , $height + 2 + ($padding * 2) ); $coordinate = new Coordinate( $dx - $padding , $dy - $padding ); return new Box($dimension, $coordinate); }
[ "public", "function", "getBoundingBox", "(", "$", "padding", "=", "10", ")", "{", "$", "bare", "=", "imageftbbox", "(", "$", "this", "->", "getFontSize", "(", ")", ",", "0", ",", "$", "this", "->", "getFont", "(", ")", ",", "$", "this", "->", "getS...
Get bouding box for the current text object @param integer $padding text padding @return \Jaguar\Box
[ "Get", "bouding", "box", "for", "the", "current", "text", "object" ]
ddfe1e65838e86aea4e9cf36a588fe7dcf853576
https://github.com/hyyan/jaguar/blob/ddfe1e65838e86aea4e9cf36a588fe7dcf853576/src/Jaguar/Drawable/Text.php#L241-L282
train
BlueTeaNL/JIRA-Rest-API-Bundle
DependencyInjection/Compiler/EndpointCompilerPass.php
EndpointCompilerPass.createAuthentication
protected function createAuthentication(ContainerBuilder $container, $authentication, $type) { if ($authentication['type'] == 'basic' && (!isset($authentication['username']) || !isset($authentication['password']))) { throw new \LogicException('Username and password are mandatory if using the basic authentication'); } if ($authentication['type'] == 'basic') { // Create an authentication service $authenticationDefinition = new Definition( 'Bluetea\Api\Authentication\BasicAuthentication', array('username' => $authentication['username'], 'password' => $authentication['password']) ); } elseif ($authentication['type'] == 'anonymous') { // Create an authentication service $authenticationDefinition = new Definition( 'Bluetea\Api\Authentication\AnonymousAuthentication' ); } else { throw new InvalidConfigurationException('Invalid authentication'); } $container->setDefinition(sprintf('jira_rest_api.%s_authentication', $type), $authenticationDefinition); }
php
protected function createAuthentication(ContainerBuilder $container, $authentication, $type) { if ($authentication['type'] == 'basic' && (!isset($authentication['username']) || !isset($authentication['password']))) { throw new \LogicException('Username and password are mandatory if using the basic authentication'); } if ($authentication['type'] == 'basic') { // Create an authentication service $authenticationDefinition = new Definition( 'Bluetea\Api\Authentication\BasicAuthentication', array('username' => $authentication['username'], 'password' => $authentication['password']) ); } elseif ($authentication['type'] == 'anonymous') { // Create an authentication service $authenticationDefinition = new Definition( 'Bluetea\Api\Authentication\AnonymousAuthentication' ); } else { throw new InvalidConfigurationException('Invalid authentication'); } $container->setDefinition(sprintf('jira_rest_api.%s_authentication', $type), $authenticationDefinition); }
[ "protected", "function", "createAuthentication", "(", "ContainerBuilder", "$", "container", ",", "$", "authentication", ",", "$", "type", ")", "{", "if", "(", "$", "authentication", "[", "'type'", "]", "==", "'basic'", "&&", "(", "!", "isset", "(", "$", "a...
Create authentication services @param ContainerBuilder $container @param $authentication @param $type @throws \LogicException @throws \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
[ "Create", "authentication", "services" ]
1bde41926cacb9bb8ce1d314c69d10e0330bf1c2
https://github.com/BlueTeaNL/JIRA-Rest-API-Bundle/blob/1bde41926cacb9bb8ce1d314c69d10e0330bf1c2/DependencyInjection/Compiler/EndpointCompilerPass.php#L59-L81
train
BlueTeaNL/JIRA-Rest-API-Bundle
DependencyInjection/Compiler/EndpointCompilerPass.php
EndpointCompilerPass.createApiClient
protected function createApiClient(ContainerBuilder $container, $apiClient, $baseUrl, $type) { if ($apiClient == 'guzzle') { // Create an API client service $apiClientDefinition = new Definition( 'Bluetea\Api\Client\GuzzleClient', array($baseUrl, new Reference(sprintf('jira_rest_api.%s_authentication', $type))) ); $apiClientDefinition->addMethodCall('setContentType', array('application/json')); $apiClientDefinition->addMethodCall('setAccept', array('application/json')); } else { throw new \LogicException('Invalid api client'); } $container->setDefinition(sprintf('jira_rest_api.%s_api_client', $type), $apiClientDefinition); }
php
protected function createApiClient(ContainerBuilder $container, $apiClient, $baseUrl, $type) { if ($apiClient == 'guzzle') { // Create an API client service $apiClientDefinition = new Definition( 'Bluetea\Api\Client\GuzzleClient', array($baseUrl, new Reference(sprintf('jira_rest_api.%s_authentication', $type))) ); $apiClientDefinition->addMethodCall('setContentType', array('application/json')); $apiClientDefinition->addMethodCall('setAccept', array('application/json')); } else { throw new \LogicException('Invalid api client'); } $container->setDefinition(sprintf('jira_rest_api.%s_api_client', $type), $apiClientDefinition); }
[ "protected", "function", "createApiClient", "(", "ContainerBuilder", "$", "container", ",", "$", "apiClient", ",", "$", "baseUrl", ",", "$", "type", ")", "{", "if", "(", "$", "apiClient", "==", "'guzzle'", ")", "{", "// Create an API client service", "$", "api...
Create API client @param ContainerBuilder $container @param $apiClient @param $baseUrl @param $type @throws \LogicException
[ "Create", "API", "client" ]
1bde41926cacb9bb8ce1d314c69d10e0330bf1c2
https://github.com/BlueTeaNL/JIRA-Rest-API-Bundle/blob/1bde41926cacb9bb8ce1d314c69d10e0330bf1c2/DependencyInjection/Compiler/EndpointCompilerPass.php#L92-L106
train
BlueTeaNL/JIRA-Rest-API-Bundle
DependencyInjection/Compiler/EndpointCompilerPass.php
EndpointCompilerPass.initializeEndpoints
protected function initializeEndpoints(ContainerBuilder $container, $availableApi) { // Add the jira api client to the jira endpoints if (isset($availableApi['jira'])) { $taggedEndpoints = $container->findTaggedServiceIds('jira_rest_api.jira_endpoint'); foreach ($taggedEndpoints as $serviceId => $attributes) { $endpoint = $container->getDefinition($serviceId); // Override the arguments to prevent errors $endpoint->setArguments(array(new Reference('jira_rest_api.jira_api_client'))); } } // Add the crowd api client to the jira endpoints if (isset($availableApi['crowd'])) { $taggedEndpoints = $container->findTaggedServiceIds('jira_rest_api.crowd_endpoint'); foreach ($taggedEndpoints as $serviceId => $attributes) { $endpoint = $container->getDefinition($serviceId); // Override the arguments to prevent errors $endpoint->setArguments(array(new Reference('jira_rest_api.crowd_api_client'))); } } }
php
protected function initializeEndpoints(ContainerBuilder $container, $availableApi) { // Add the jira api client to the jira endpoints if (isset($availableApi['jira'])) { $taggedEndpoints = $container->findTaggedServiceIds('jira_rest_api.jira_endpoint'); foreach ($taggedEndpoints as $serviceId => $attributes) { $endpoint = $container->getDefinition($serviceId); // Override the arguments to prevent errors $endpoint->setArguments(array(new Reference('jira_rest_api.jira_api_client'))); } } // Add the crowd api client to the jira endpoints if (isset($availableApi['crowd'])) { $taggedEndpoints = $container->findTaggedServiceIds('jira_rest_api.crowd_endpoint'); foreach ($taggedEndpoints as $serviceId => $attributes) { $endpoint = $container->getDefinition($serviceId); // Override the arguments to prevent errors $endpoint->setArguments(array(new Reference('jira_rest_api.crowd_api_client'))); } } }
[ "protected", "function", "initializeEndpoints", "(", "ContainerBuilder", "$", "container", ",", "$", "availableApi", ")", "{", "// Add the jira api client to the jira endpoints", "if", "(", "isset", "(", "$", "availableApi", "[", "'jira'", "]", ")", ")", "{", "$", ...
Initialize API endpoints @param ContainerBuilder $container @param $availableApi
[ "Initialize", "API", "endpoints" ]
1bde41926cacb9bb8ce1d314c69d10e0330bf1c2
https://github.com/BlueTeaNL/JIRA-Rest-API-Bundle/blob/1bde41926cacb9bb8ce1d314c69d10e0330bf1c2/DependencyInjection/Compiler/EndpointCompilerPass.php#L114-L135
train
maximebf/CacheCache
src/CacheCache/LoggingBackend.php
LoggingBackend.log
protected function log($operation, $id = null, $ttl = null, $hit = null) { $message = strtoupper($operation); if ($id !== null) { $id = implode(', ', (array) $id); if ($ttl !== null) { $message = sprintf('%s(%s, ttl=%s)', $message, $id, $ttl); } else { $message = sprintf('%s(%s)', $message, $id); } } if ($hit !== null) { $message .= ' = ' . ($hit ? 'HIT' : 'MISS'); } $this->logger->addRecord($this->logLevel, $message); }
php
protected function log($operation, $id = null, $ttl = null, $hit = null) { $message = strtoupper($operation); if ($id !== null) { $id = implode(', ', (array) $id); if ($ttl !== null) { $message = sprintf('%s(%s, ttl=%s)', $message, $id, $ttl); } else { $message = sprintf('%s(%s)', $message, $id); } } if ($hit !== null) { $message .= ' = ' . ($hit ? 'HIT' : 'MISS'); } $this->logger->addRecord($this->logLevel, $message); }
[ "protected", "function", "log", "(", "$", "operation", ",", "$", "id", "=", "null", ",", "$", "ttl", "=", "null", ",", "$", "hit", "=", "null", ")", "{", "$", "message", "=", "strtoupper", "(", "$", "operation", ")", ";", "if", "(", "$", "id", ...
Logs an operation @param string $operation @param string|array $id @param int $ttl @param bool $hit
[ "Logs", "an", "operation" ]
eb64a3748aad4ddaf236ef4738a83267576a0f97
https://github.com/maximebf/CacheCache/blob/eb64a3748aad4ddaf236ef4738a83267576a0f97/src/CacheCache/LoggingBackend.php#L90-L105
train
undera/pwe
PWE/Core/PWELogger.php
PWELogger.debug_print
private static function debug_print($file, $level, $format, $data) { array_shift($data); foreach ($data as $k => $v) { if (is_string($v)) { $data[$k] = str_replace("\n", ' ', $v); } elseif ($v instanceof \Exception) { $data[$k] = $v->__toString(); } elseif (!is_numeric($v)) { $data[$k] = str_replace("\n", " ", json_encode($v)); } } $mtime = microtime(true); $time = 1000 * ($mtime - intval($mtime)); $trace = debug_backtrace(); $location = $trace[2]['function']; for ($n = 2; $n < sizeof($trace); $n++) { if (isset($trace[$n]['class'])) { $location = $trace[$n]['class']; break; } } $id = isset($_SERVER['REMOTE_PORT']) ? $_SERVER['REMOTE_PORT'] : getmypid(); $msg = sizeof($data) ? vsprintf($format, $data) : $format; error_log(sprintf("[%s.%03d %s %s %s] %s\n", date('d.m.Y H:m:s'), $time, $id, $level, $location, $msg), 3, $file); }
php
private static function debug_print($file, $level, $format, $data) { array_shift($data); foreach ($data as $k => $v) { if (is_string($v)) { $data[$k] = str_replace("\n", ' ', $v); } elseif ($v instanceof \Exception) { $data[$k] = $v->__toString(); } elseif (!is_numeric($v)) { $data[$k] = str_replace("\n", " ", json_encode($v)); } } $mtime = microtime(true); $time = 1000 * ($mtime - intval($mtime)); $trace = debug_backtrace(); $location = $trace[2]['function']; for ($n = 2; $n < sizeof($trace); $n++) { if (isset($trace[$n]['class'])) { $location = $trace[$n]['class']; break; } } $id = isset($_SERVER['REMOTE_PORT']) ? $_SERVER['REMOTE_PORT'] : getmypid(); $msg = sizeof($data) ? vsprintf($format, $data) : $format; error_log(sprintf("[%s.%03d %s %s %s] %s\n", date('d.m.Y H:m:s'), $time, $id, $level, $location, $msg), 3, $file); }
[ "private", "static", "function", "debug_print", "(", "$", "file", ",", "$", "level", ",", "$", "format", ",", "$", "data", ")", "{", "array_shift", "(", "$", "data", ")", ";", "foreach", "(", "$", "data", "as", "$", "k", "=>", "$", "v", ")", "{",...
date time id path level msg
[ "date", "time", "id", "path", "level", "msg" ]
4795f3a9755657c2a8be8ef3236992580b7954b3
https://github.com/undera/pwe/blob/4795f3a9755657c2a8be8ef3236992580b7954b3/PWE/Core/PWELogger.php#L70-L99
train
t9221823420/yii2-base
src/traits/_/DBRecordTrait.php
DBRecordTrait.getListQuery
public static function getListQuery( ?array $condition = [], $key = null, $value = null, $indexBy = true, $orderBy = true, $alias = null ) { if( !$alias && is_subclass_of( get_called_class(), ActiveRecord::class ) ) { $table = Yii::$app->db->schema->getRawTableName( ( get_called_class() )::tableName() ); } else if( $alias ) { $table = $alias; } else { $table = ''; } !$table ?: $table .= '.'; $key = $key ?? static::primaryKey()[0]; $value = $value ?? $key; $query = static::find() ->select( [ $table . $value, $table . $key, ] ) ->andFilterWhere( $condition ?? [] ) ; if( $orderBy === true ) { // $query->orderBy( $table . $value ); } else if( $orderBy !== false ) { // $query->orderBy( $table . $orderBy ); } if( $indexBy === true ) { // $query->indexBy( $key ); } else if( $indexBy !== false ) { // $query->indexBy( $indexBy ); } return $query; }
php
public static function getListQuery( ?array $condition = [], $key = null, $value = null, $indexBy = true, $orderBy = true, $alias = null ) { if( !$alias && is_subclass_of( get_called_class(), ActiveRecord::class ) ) { $table = Yii::$app->db->schema->getRawTableName( ( get_called_class() )::tableName() ); } else if( $alias ) { $table = $alias; } else { $table = ''; } !$table ?: $table .= '.'; $key = $key ?? static::primaryKey()[0]; $value = $value ?? $key; $query = static::find() ->select( [ $table . $value, $table . $key, ] ) ->andFilterWhere( $condition ?? [] ) ; if( $orderBy === true ) { // $query->orderBy( $table . $value ); } else if( $orderBy !== false ) { // $query->orderBy( $table . $orderBy ); } if( $indexBy === true ) { // $query->indexBy( $key ); } else if( $indexBy !== false ) { // $query->indexBy( $indexBy ); } return $query; }
[ "public", "static", "function", "getListQuery", "(", "?", "array", "$", "condition", "=", "[", "]", ",", "$", "key", "=", "null", ",", "$", "value", "=", "null", ",", "$", "indexBy", "=", "true", ",", "$", "orderBy", "=", "true", ",", "$", "alias",...
Return records as Array id => column for dropdowns @param $key @param $value @param bool $orderBy @return array
[ "Return", "records", "as", "Array", "id", "=", ">", "column", "for", "dropdowns" ]
61be4e46c41dd466722a38b952defd3e872ed3dd
https://github.com/t9221823420/yii2-base/blob/61be4e46c41dd466722a38b952defd3e872ed3dd/src/traits/_/DBRecordTrait.php#L32-L73
train
t9221823420/yii2-base
src/traits/_/DBRecordTrait.php
DBRecordTrait.getRawAttributes
public function getRawAttributes( ?array $only = null, ?array $except = [], ?bool $schemaOnly = false ) { $values = []; if( $only === null ) { $only = $this->attributes( $only, $except, $schemaOnly ); } foreach( $only as $name ) { $values[ $name ] = $this->getAttribute( $name ); } if( $except ) { $values = array_diff_key( $values, array_flip( $except ) ); } /* foreach( $except as $name ) { unset( $values[ $name ] ); } */ return $values; }
php
public function getRawAttributes( ?array $only = null, ?array $except = [], ?bool $schemaOnly = false ) { $values = []; if( $only === null ) { $only = $this->attributes( $only, $except, $schemaOnly ); } foreach( $only as $name ) { $values[ $name ] = $this->getAttribute( $name ); } if( $except ) { $values = array_diff_key( $values, array_flip( $except ) ); } /* foreach( $except as $name ) { unset( $values[ $name ] ); } */ return $values; }
[ "public", "function", "getRawAttributes", "(", "?", "array", "$", "only", "=", "null", ",", "?", "array", "$", "except", "=", "[", "]", ",", "?", "bool", "$", "schemaOnly", "=", "false", ")", "{", "$", "values", "=", "[", "]", ";", "if", "(", "$"...
Returns attribute values. @param array $only list of attributes whose value needs to be returned. Defaults to null, meaning all attributes listed in [[attributes()]] will be returned. If it is an array, only the attributes in the array will be returned. @param array $except list of attributes whose value should NOT be returned. @return array attribute values (name => value).
[ "Returns", "attribute", "values", "." ]
61be4e46c41dd466722a38b952defd3e872ed3dd
https://github.com/t9221823420/yii2-base/blob/61be4e46c41dd466722a38b952defd3e872ed3dd/src/traits/_/DBRecordTrait.php#L206-L229
train
minkphp/SahiClient
src/Connection.php
Connection.start
public function start($browserName) { if (!$this->customSidProvided) { $this->sid = uniqid(); $this->executeCommand('launchPreconfiguredBrowser', array('browserType' => $browserName)); } }
php
public function start($browserName) { if (!$this->customSidProvided) { $this->sid = uniqid(); $this->executeCommand('launchPreconfiguredBrowser', array('browserType' => $browserName)); } }
[ "public", "function", "start", "(", "$", "browserName", ")", "{", "if", "(", "!", "$", "this", "->", "customSidProvided", ")", "{", "$", "this", "->", "sid", "=", "uniqid", "(", ")", ";", "$", "this", "->", "executeCommand", "(", "'launchPreconfiguredBro...
Starts browser. @param string $browserName (firefox, ie, safari, chrome, opera)
[ "Starts", "browser", "." ]
edd87e8445c4a1c28233eeae5f226fac7afc5ed8
https://github.com/minkphp/SahiClient/blob/edd87e8445c4a1c28233eeae5f226fac7afc5ed8/src/Connection.php#L118-L124
train
minkphp/SahiClient
src/Connection.php
Connection.executeCommand
public function executeCommand($command, array $parameters = array()) { $content = $this->post( sprintf('http://%s:%d/_s_/dyn/Driver_%s', $this->host, $this->port, $command), array_merge($parameters, array('sahisid' => $this->sid)) )->getContent(); if (false !== strpos($content, 'SAHI_ERROR')) { throw new Exception\ConnectionException('Sahi proxy error. Full response:' . PHP_EOL . $content); } return $content; }
php
public function executeCommand($command, array $parameters = array()) { $content = $this->post( sprintf('http://%s:%d/_s_/dyn/Driver_%s', $this->host, $this->port, $command), array_merge($parameters, array('sahisid' => $this->sid)) )->getContent(); if (false !== strpos($content, 'SAHI_ERROR')) { throw new Exception\ConnectionException('Sahi proxy error. Full response:' . PHP_EOL . $content); } return $content; }
[ "public", "function", "executeCommand", "(", "$", "command", ",", "array", "$", "parameters", "=", "array", "(", ")", ")", "{", "$", "content", "=", "$", "this", "->", "post", "(", "sprintf", "(", "'http://%s:%d/_s_/dyn/Driver_%s'", ",", "$", "this", "->",...
Execute Sahi command & returns its response. @param string $command Sahi command @param array $parameters parameters @return string command response @throws Exception\ConnectionException
[ "Execute", "Sahi", "command", "&", "returns", "its", "response", "." ]
edd87e8445c4a1c28233eeae5f226fac7afc5ed8
https://github.com/minkphp/SahiClient/blob/edd87e8445c4a1c28233eeae5f226fac7afc5ed8/src/Connection.php#L183-L195
train
minkphp/SahiClient
src/Connection.php
Connection.executeStep
public function executeStep($step, $limit = null) { $this->executeCommand('setStep', array('step' => $step)); $limit = $limit ?: $this->limit; $check = 'false'; while ('true' !== $check) { usleep(100000); if (--$limit <= 0) { throw new Exception\ConnectionException( 'Command execution time limit reached: `' . $step . '`' ); } $check = $this->executeCommand('doneStep'); if (0 === mb_strpos($check, 'error:')) { throw new Exception\ConnectionException($check); } } }
php
public function executeStep($step, $limit = null) { $this->executeCommand('setStep', array('step' => $step)); $limit = $limit ?: $this->limit; $check = 'false'; while ('true' !== $check) { usleep(100000); if (--$limit <= 0) { throw new Exception\ConnectionException( 'Command execution time limit reached: `' . $step . '`' ); } $check = $this->executeCommand('doneStep'); if (0 === mb_strpos($check, 'error:')) { throw new Exception\ConnectionException($check); } } }
[ "public", "function", "executeStep", "(", "$", "step", ",", "$", "limit", "=", "null", ")", "{", "$", "this", "->", "executeCommand", "(", "'setStep'", ",", "array", "(", "'step'", "=>", "$", "step", ")", ")", ";", "$", "limit", "=", "$", "limit", ...
Execute Sahi step. @param string $step step command @param integer $limit time limit (value of 10 === 1 second) @throws Exception\ConnectionException if step execution has errors
[ "Execute", "Sahi", "step", "." ]
edd87e8445c4a1c28233eeae5f226fac7afc5ed8
https://github.com/minkphp/SahiClient/blob/edd87e8445c4a1c28233eeae5f226fac7afc5ed8/src/Connection.php#L205-L224
train
minkphp/SahiClient
src/Connection.php
Connection.evaluateJavascript
public function evaluateJavascript($expression, $limit = null) { $key = '___lastValue___' . uniqid(); $this->executeStep( sprintf("_sahi.setServerVarPlain(%s, JSON.stringify(%s))", json_encode($key), $expression), $limit ); $resp = $this->executeCommand('getVariable', array('key' => $key)); return json_decode($resp, true); }
php
public function evaluateJavascript($expression, $limit = null) { $key = '___lastValue___' . uniqid(); $this->executeStep( sprintf("_sahi.setServerVarPlain(%s, JSON.stringify(%s))", json_encode($key), $expression), $limit ); $resp = $this->executeCommand('getVariable', array('key' => $key)); return json_decode($resp, true); }
[ "public", "function", "evaluateJavascript", "(", "$", "expression", ",", "$", "limit", "=", "null", ")", "{", "$", "key", "=", "'___lastValue___'", ".", "uniqid", "(", ")", ";", "$", "this", "->", "executeStep", "(", "sprintf", "(", "\"_sahi.setServerVarPlai...
Evaluates JS expression on the browser and returns it's value. @param string $expression JS expression @param integer $limit time limit (value of 10 === 1 second) @return mixed
[ "Evaluates", "JS", "expression", "on", "the", "browser", "and", "returns", "it", "s", "value", "." ]
edd87e8445c4a1c28233eeae5f226fac7afc5ed8
https://github.com/minkphp/SahiClient/blob/edd87e8445c4a1c28233eeae5f226fac7afc5ed8/src/Connection.php#L234-L245
train
minkphp/SahiClient
src/Connection.php
Connection.post
private function post($url, array $query = array()) { return $this->browser->post($url, array(), $this->prepareQueryString($query)); }
php
private function post($url, array $query = array()) { return $this->browser->post($url, array(), $this->prepareQueryString($query)); }
[ "private", "function", "post", "(", "$", "url", ",", "array", "$", "query", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "browser", "->", "post", "(", "$", "url", ",", "array", "(", ")", ",", "$", "this", "->", "prepareQueryString...
Send POST request to specified URL. @param string $url URL @param array $query POST query parameters @return Buzz\Message\Response response
[ "Send", "POST", "request", "to", "specified", "URL", "." ]
edd87e8445c4a1c28233eeae5f226fac7afc5ed8
https://github.com/minkphp/SahiClient/blob/edd87e8445c4a1c28233eeae5f226fac7afc5ed8/src/Connection.php#L266-L269
train
minkphp/SahiClient
src/Connection.php
Connection.prepareQueryString
private function prepareQueryString(array $query) { $items = array(); foreach ($query as $key => $val) { $items[] = $key . '=' . urlencode($val); } return implode('&', $items); }
php
private function prepareQueryString(array $query) { $items = array(); foreach ($query as $key => $val) { $items[] = $key . '=' . urlencode($val); } return implode('&', $items); }
[ "private", "function", "prepareQueryString", "(", "array", "$", "query", ")", "{", "$", "items", "=", "array", "(", ")", ";", "foreach", "(", "$", "query", "as", "$", "key", "=>", "$", "val", ")", "{", "$", "items", "[", "]", "=", "$", "key", "."...
Convert array parameters to POST parameters. @param array $query parameters @return string query string (key1=val1&key2=val2)
[ "Convert", "array", "parameters", "to", "POST", "parameters", "." ]
edd87e8445c4a1c28233eeae5f226fac7afc5ed8
https://github.com/minkphp/SahiClient/blob/edd87e8445c4a1c28233eeae5f226fac7afc5ed8/src/Connection.php#L278-L286
train
nanbando/core
src/Core/Plugin/PluginRegistry.php
PluginRegistry.getPlugin
public function getPlugin($name) { if (!$this->has($name)) { throw new PluginNotFoundException($name, array_keys($this->plugins)); } return $this->plugins[$name]; }
php
public function getPlugin($name) { if (!$this->has($name)) { throw new PluginNotFoundException($name, array_keys($this->plugins)); } return $this->plugins[$name]; }
[ "public", "function", "getPlugin", "(", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "has", "(", "$", "name", ")", ")", "{", "throw", "new", "PluginNotFoundException", "(", "$", "name", ",", "array_keys", "(", "$", "this", "->", "plugins...
Returns plugin by name. @param string $name @return PluginInterface @throws PluginNotFoundException
[ "Returns", "plugin", "by", "name", "." ]
790f5c6339753bffafb50a846ccb6bab81f26877
https://github.com/nanbando/core/blob/790f5c6339753bffafb50a846ccb6bab81f26877/src/Core/Plugin/PluginRegistry.php#L29-L36
train
excelwebzone/EWZSearchBundle
src/Lucene/LuceneIndexManager.php
LuceneIndexManager.getIndex
public function getIndex($indexName) { if (array_key_exists($indexName, $this->indices)) { return $this->indices[$indexName]; } return null; }
php
public function getIndex($indexName) { if (array_key_exists($indexName, $this->indices)) { return $this->indices[$indexName]; } return null; }
[ "public", "function", "getIndex", "(", "$", "indexName", ")", "{", "if", "(", "array_key_exists", "(", "$", "indexName", ",", "$", "this", "->", "indices", ")", ")", "{", "return", "$", "this", "->", "indices", "[", "$", "indexName", "]", ";", "}", "...
Get the specified lucene search-index @param string $indexName @return LuceneSearch
[ "Get", "the", "specified", "lucene", "search", "-", "index" ]
f1cdb2317c9fc31606d82d1cdee9654af936aff3
https://github.com/excelwebzone/EWZSearchBundle/blob/f1cdb2317c9fc31606d82d1cdee9654af936aff3/src/Lucene/LuceneIndexManager.php#L35-L42
train
melisplatform/melis-front
src/Navigation/MelisFrontNavigation.php
MelisFrontNavigation.getChildrenRecursive
public function getChildrenRecursive($idPage) { $results = array(); $melisTree = $this->serviceLocator->get('MelisEngineTree'); $publishedOnly = 1; $pages = $melisTree->getPageChildren($idPage,$publishedOnly); if ($pages) { $rpages = $pages->toArray(); foreach ($rpages as $page) { $tmp = $this->formatPageInArray($page); $children = $this->getChildrenRecursive($page['tree_page_id']); if (!empty($children)) $tmp['pages'] = $children; $results[] = $tmp; } } return $results; }
php
public function getChildrenRecursive($idPage) { $results = array(); $melisTree = $this->serviceLocator->get('MelisEngineTree'); $publishedOnly = 1; $pages = $melisTree->getPageChildren($idPage,$publishedOnly); if ($pages) { $rpages = $pages->toArray(); foreach ($rpages as $page) { $tmp = $this->formatPageInArray($page); $children = $this->getChildrenRecursive($page['tree_page_id']); if (!empty($children)) $tmp['pages'] = $children; $results[] = $tmp; } } return $results; }
[ "public", "function", "getChildrenRecursive", "(", "$", "idPage", ")", "{", "$", "results", "=", "array", "(", ")", ";", "$", "melisTree", "=", "$", "this", "->", "serviceLocator", "->", "get", "(", "'MelisEngineTree'", ")", ";", "$", "publishedOnly", "=",...
Get subpages recursively @param int $idPage @return array Pages
[ "Get", "subpages", "recursively" ]
5e03e32687970bb2201e4205612d5539500dc514
https://github.com/melisplatform/melis-front/blob/5e03e32687970bb2201e4205612d5539500dc514/src/Navigation/MelisFrontNavigation.php#L84-L110
train
melisplatform/melis-front
src/Navigation/MelisFrontNavigation.php
MelisFrontNavigation.getAllSubpages
public function getAllSubpages($pageId) { $results = array(); //Services $melisTree = $this->serviceLocator->get('MelisEngineTree'); $pagePub = $this->getServiceLocator()->get('MelisEngineTablePagePublished'); $pageSave = $this->getServiceLocator()->get('MelisEngineTablePageSaved'); $pageSearchType = null; $pages = $melisTree->getPageChildren($pageId,2); if($pages) { $rpages = $pages->toArray(); foreach ($rpages as $page) { $pageStat = $page['page_status'] ?? null; //if the page is published if($pageStat){ $pageData = $pagePub->getEntryById($page['tree_page_id'])->current(); $pageSearchType = $pageData->page_search_type ?? null; } //if the page is unpublished else{ $pageData = $pageSave->getEntryById($page['tree_page_id'])->current(); //if the unpublishedData is not present in page_saved table if(!$pageData){ //Get the pageData in page_published table $pageData = $pagePub->getEntryById($page['tree_page_id'])->current(); } $pageSearchType = $pageData->page_search_type ?? null; } $tmp = $this->formatPageInArray($page,$pageSearchType); $children = $this->getAllSubpages($page['tree_page_id'] ?? null); if (!empty($children)) $tmp['pages'] = $children; $results[] = $tmp; } } return $results; }
php
public function getAllSubpages($pageId) { $results = array(); //Services $melisTree = $this->serviceLocator->get('MelisEngineTree'); $pagePub = $this->getServiceLocator()->get('MelisEngineTablePagePublished'); $pageSave = $this->getServiceLocator()->get('MelisEngineTablePageSaved'); $pageSearchType = null; $pages = $melisTree->getPageChildren($pageId,2); if($pages) { $rpages = $pages->toArray(); foreach ($rpages as $page) { $pageStat = $page['page_status'] ?? null; //if the page is published if($pageStat){ $pageData = $pagePub->getEntryById($page['tree_page_id'])->current(); $pageSearchType = $pageData->page_search_type ?? null; } //if the page is unpublished else{ $pageData = $pageSave->getEntryById($page['tree_page_id'])->current(); //if the unpublishedData is not present in page_saved table if(!$pageData){ //Get the pageData in page_published table $pageData = $pagePub->getEntryById($page['tree_page_id'])->current(); } $pageSearchType = $pageData->page_search_type ?? null; } $tmp = $this->formatPageInArray($page,$pageSearchType); $children = $this->getAllSubpages($page['tree_page_id'] ?? null); if (!empty($children)) $tmp['pages'] = $children; $results[] = $tmp; } } return $results; }
[ "public", "function", "getAllSubpages", "(", "$", "pageId", ")", "{", "$", "results", "=", "array", "(", ")", ";", "//Services", "$", "melisTree", "=", "$", "this", "->", "serviceLocator", "->", "get", "(", "'MelisEngineTree'", ")", ";", "$", "pagePub", ...
Get all Subpages including published and unplublished @param $pageId @return array
[ "Get", "all", "Subpages", "including", "published", "and", "unplublished" ]
5e03e32687970bb2201e4205612d5539500dc514
https://github.com/melisplatform/melis-front/blob/5e03e32687970bb2201e4205612d5539500dc514/src/Navigation/MelisFrontNavigation.php#L210-L255
train
jbouzekri/FileUploaderBundle
Twig/CropExtension.php
CropExtension.getCropEndpoint
public function getCropEndpoint( $endpoint, $parameters = array(), $absolute = UrlGeneratorInterface::ABSOLUTE_PATH ) { $parameters = array_merge($parameters, array('endpoint' => $endpoint)); return $this->router->generate($this->routeName, $parameters, $absolute); }
php
public function getCropEndpoint( $endpoint, $parameters = array(), $absolute = UrlGeneratorInterface::ABSOLUTE_PATH ) { $parameters = array_merge($parameters, array('endpoint' => $endpoint)); return $this->router->generate($this->routeName, $parameters, $absolute); }
[ "public", "function", "getCropEndpoint", "(", "$", "endpoint", ",", "$", "parameters", "=", "array", "(", ")", ",", "$", "absolute", "=", "UrlGeneratorInterface", "::", "ABSOLUTE_PATH", ")", "{", "$", "parameters", "=", "array_merge", "(", "$", "parameters", ...
Get crop endpoint url @param $endpoint @param array $parameters @param int $absolute @return string
[ "Get", "crop", "endpoint", "url" ]
592e7ed827eaa4e7f8f6f52947ca5e5a86835f6c
https://github.com/jbouzekri/FileUploaderBundle/blob/592e7ed827eaa4e7f8f6f52947ca5e5a86835f6c/Twig/CropExtension.php#L67-L75
train
rchouinard/rych-otp
src/HOTP.php
HOTP.setDigits
public function setDigits($digits) { $digits = abs(intval($digits)); if ($digits < 1 || $digits > 10) { throw new \InvalidArgumentException('Digits must be a number between 1 and 10 inclusive'); } $this->digits = $digits; return $this; }
php
public function setDigits($digits) { $digits = abs(intval($digits)); if ($digits < 1 || $digits > 10) { throw new \InvalidArgumentException('Digits must be a number between 1 and 10 inclusive'); } $this->digits = $digits; return $this; }
[ "public", "function", "setDigits", "(", "$", "digits", ")", "{", "$", "digits", "=", "abs", "(", "intval", "(", "$", "digits", ")", ")", ";", "if", "(", "$", "digits", "<", "1", "||", "$", "digits", ">", "10", ")", "{", "throw", "new", "\\", "I...
Set the number of digits in the one-time password @param integer $digits The number of digits. @return self Returns an instance of self for method chaining. @throws \InvalidArgumentException Thrown if the requested number of digits is outside of the inclusive range 1-10.
[ "Set", "the", "number", "of", "digits", "in", "the", "one", "-", "time", "password" ]
b3c7fc11284c546cd291f14fb383a7d49ab23832
https://github.com/rchouinard/rych-otp/blob/b3c7fc11284c546cd291f14fb383a7d49ab23832/src/HOTP.php#L99-L108
train
rchouinard/rych-otp
src/HOTP.php
HOTP.setHashFunction
public function setHashFunction($hashFunction) { $hashFunction = strtolower($hashFunction); if (!in_array($hashFunction, hash_algos())) { throw new \InvalidArgumentException("$hashFunction is not a supported hash function"); } $this->hashFunction = $hashFunction; return $this; }
php
public function setHashFunction($hashFunction) { $hashFunction = strtolower($hashFunction); if (!in_array($hashFunction, hash_algos())) { throw new \InvalidArgumentException("$hashFunction is not a supported hash function"); } $this->hashFunction = $hashFunction; return $this; }
[ "public", "function", "setHashFunction", "(", "$", "hashFunction", ")", "{", "$", "hashFunction", "=", "strtolower", "(", "$", "hashFunction", ")", ";", "if", "(", "!", "in_array", "(", "$", "hashFunction", ",", "hash_algos", "(", ")", ")", ")", "{", "th...
Set the hash function @param string $hashFunction The hash function. @return self Returns an instance of self for method chaining. @throws \InvalidArgumentException Thrown if the supplied hash function is not supported.
[ "Set", "the", "hash", "function" ]
b3c7fc11284c546cd291f14fb383a7d49ab23832
https://github.com/rchouinard/rych-otp/blob/b3c7fc11284c546cd291f14fb383a7d49ab23832/src/HOTP.php#L128-L137
train
rchouinard/rych-otp
src/HOTP.php
HOTP.setWindow
public function setWindow($window) { $window = abs(intval($window)); $this->window = $window; return $this; }
php
public function setWindow($window) { $window = abs(intval($window)); $this->window = $window; return $this; }
[ "public", "function", "setWindow", "(", "$", "window", ")", "{", "$", "window", "=", "abs", "(", "intval", "(", "$", "window", ")", ")", ";", "$", "this", "->", "window", "=", "$", "window", ";", "return", "$", "this", ";", "}" ]
Set the window value @param integer $window The window value. @return self Returns an instance of self for method chaining.
[ "Set", "the", "window", "value" ]
b3c7fc11284c546cd291f14fb383a7d49ab23832
https://github.com/rchouinard/rych-otp/blob/b3c7fc11284c546cd291f14fb383a7d49ab23832/src/HOTP.php#L170-L176
train
excelwebzone/EWZSearchBundle
src/Lucene/Document.php
Document.getFieldType
public function getFieldType($fieldName) { if (!array_key_exists($fieldName, $this->_fields)) { throw new \Exception("Field name \"$fieldName\" not found in document."); } return $this->_fields[$fieldName]->getType (); }
php
public function getFieldType($fieldName) { if (!array_key_exists($fieldName, $this->_fields)) { throw new \Exception("Field name \"$fieldName\" not found in document."); } return $this->_fields[$fieldName]->getType (); }
[ "public", "function", "getFieldType", "(", "$", "fieldName", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "fieldName", ",", "$", "this", "->", "_fields", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"Field name \\\"$fieldName\\\" not fou...
Returns type for a named field in this document. @param string $fieldName @return string @throws \Exception
[ "Returns", "type", "for", "a", "named", "field", "in", "this", "document", "." ]
f1cdb2317c9fc31606d82d1cdee9654af936aff3
https://github.com/excelwebzone/EWZSearchBundle/blob/f1cdb2317c9fc31606d82d1cdee9654af936aff3/src/Lucene/Document.php#L18-L25
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.message
public function message($type, $destination, $messagearray, $priority = SMARTIRC_MEDIUM ) { if (!is_array($messagearray)) { $messagearray = array($messagearray); } switch ($type) { case SMARTIRC_TYPE_CHANNEL: case SMARTIRC_TYPE_QUERY: foreach ($messagearray as $message) { $this->send('PRIVMSG '.$destination.' :'.$message, $priority); } break; case SMARTIRC_TYPE_ACTION: foreach ($messagearray as $message) { $this->send('PRIVMSG '.$destination.' :'.chr(1).'ACTION ' .$message.chr(1), $priority ); } break; case SMARTIRC_TYPE_NOTICE: foreach ($messagearray as $message) { $this->send('NOTICE '.$destination.' :'.$message, $priority); } break; case SMARTIRC_TYPE_CTCP: // backwards compatibility case SMARTIRC_TYPE_CTCP_REPLY: foreach ($messagearray as $message) { $this->send('NOTICE '.$destination.' :'.chr(1).$message .chr(1), $priority ); } break; case SMARTIRC_TYPE_CTCP_REQUEST: foreach ($messagearray as $message) { $this->send('PRIVMSG '.$destination.' :'.chr(1).$message .chr(1), $priority ); } break; default: return false; } return $this; }
php
public function message($type, $destination, $messagearray, $priority = SMARTIRC_MEDIUM ) { if (!is_array($messagearray)) { $messagearray = array($messagearray); } switch ($type) { case SMARTIRC_TYPE_CHANNEL: case SMARTIRC_TYPE_QUERY: foreach ($messagearray as $message) { $this->send('PRIVMSG '.$destination.' :'.$message, $priority); } break; case SMARTIRC_TYPE_ACTION: foreach ($messagearray as $message) { $this->send('PRIVMSG '.$destination.' :'.chr(1).'ACTION ' .$message.chr(1), $priority ); } break; case SMARTIRC_TYPE_NOTICE: foreach ($messagearray as $message) { $this->send('NOTICE '.$destination.' :'.$message, $priority); } break; case SMARTIRC_TYPE_CTCP: // backwards compatibility case SMARTIRC_TYPE_CTCP_REPLY: foreach ($messagearray as $message) { $this->send('NOTICE '.$destination.' :'.chr(1).$message .chr(1), $priority ); } break; case SMARTIRC_TYPE_CTCP_REQUEST: foreach ($messagearray as $message) { $this->send('PRIVMSG '.$destination.' :'.chr(1).$message .chr(1), $priority ); } break; default: return false; } return $this; }
[ "public", "function", "message", "(", "$", "type", ",", "$", "destination", ",", "$", "messagearray", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "if", "(", "!", "is_array", "(", "$", "messagearray", ")", ")", "{", "$", "messagearray", "=", ...
sends a new message Sends a message to a channel or user. @see DOCUMENTATION @param integer $type specifies the type, like QUERY/ACTION or CTCP see 'Message Types' @param string $destination can be a user or channel @param mixed $messagearray the message @param integer $priority the priority level of the message @return boolean|Net_SmartIRC @api
[ "sends", "a", "new", "message" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L42-L93
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.join
public function join($channelarray, $key = null, $priority = SMARTIRC_MEDIUM) { if (!is_array($channelarray)) { $channelarray = array($channelarray); } $channellist = implode(',', $channelarray); if ($key !== null) { foreach ($channelarray as $idx => $value) { $this->send('JOIN '.$value.' '.$key, $priority); } } else { foreach ($channelarray as $idx => $value) { $this->send('JOIN '.$value, $priority); } } return $this; }
php
public function join($channelarray, $key = null, $priority = SMARTIRC_MEDIUM) { if (!is_array($channelarray)) { $channelarray = array($channelarray); } $channellist = implode(',', $channelarray); if ($key !== null) { foreach ($channelarray as $idx => $value) { $this->send('JOIN '.$value.' '.$key, $priority); } } else { foreach ($channelarray as $idx => $value) { $this->send('JOIN '.$value, $priority); } } return $this; }
[ "public", "function", "join", "(", "$", "channelarray", ",", "$", "key", "=", "null", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "if", "(", "!", "is_array", "(", "$", "channelarray", ")", ")", "{", "$", "channelarray", "=", "array", "(", ...
Joins one or more IRC channels with an optional key. @param mixed $channelarray @param string $key @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "Joins", "one", "or", "more", "IRC", "channels", "with", "an", "optional", "key", "." ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L105-L124
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.part
public function part($channelarray, $reason = null, $priority = SMARTIRC_MEDIUM ) { if (!is_array($channelarray)) { $channelarray = array($channelarray); } $channellist = implode(',', $channelarray); if ($reason !== null) { $this->send('PART '.$channellist.' :'.$reason, $priority); } else { $this->send('PART '.$channellist, $priority); } return $this; }
php
public function part($channelarray, $reason = null, $priority = SMARTIRC_MEDIUM ) { if (!is_array($channelarray)) { $channelarray = array($channelarray); } $channellist = implode(',', $channelarray); if ($reason !== null) { $this->send('PART '.$channellist.' :'.$reason, $priority); } else { $this->send('PART '.$channellist, $priority); } return $this; }
[ "public", "function", "part", "(", "$", "channelarray", ",", "$", "reason", "=", "null", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "if", "(", "!", "is_array", "(", "$", "channelarray", ")", ")", "{", "$", "channelarray", "=", "array", "("...
parts from one or more IRC channels with an optional reason @param mixed $channelarray @param string $reason @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "parts", "from", "one", "or", "more", "IRC", "channels", "with", "an", "optional", "reason" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L135-L150
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.kick
public function kick($channel, $nicknamearray, $reason = null, $priority = SMARTIRC_MEDIUM ) { if (!is_array($nicknamearray)) { $nicknamearray = array($nicknamearray); } $nicknamelist = implode(',', $nicknamearray); if ($reason !== null) { $this->send('KICK '.$channel.' '.$nicknamelist.' :'.$reason, $priority); } else { $this->send('KICK '.$channel.' '.$nicknamelist, $priority); } return $this; }
php
public function kick($channel, $nicknamearray, $reason = null, $priority = SMARTIRC_MEDIUM ) { if (!is_array($nicknamearray)) { $nicknamearray = array($nicknamearray); } $nicknamelist = implode(',', $nicknamearray); if ($reason !== null) { $this->send('KICK '.$channel.' '.$nicknamelist.' :'.$reason, $priority); } else { $this->send('KICK '.$channel.' '.$nicknamelist, $priority); } return $this; }
[ "public", "function", "kick", "(", "$", "channel", ",", "$", "nicknamearray", ",", "$", "reason", "=", "null", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "if", "(", "!", "is_array", "(", "$", "nicknamearray", ")", ")", "{", "$", "nicknamea...
Kicks one or more user from an IRC channel with an optional reason. @param string $channel @param mixed $nicknamearray @param string $reason @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "Kicks", "one", "or", "more", "user", "from", "an", "IRC", "channel", "with", "an", "optional", "reason", "." ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L162-L177
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.getList
public function getList($channelarray = null, $priority = SMARTIRC_MEDIUM) { if ($channelarray !== null) { if (!is_array($channelarray)) { $channelarray = array($channelarray); } $channellist = implode(',', $channelarray); $this->send('LIST '.$channellist, $priority); } else { $this->send('LIST', $priority); } return $this; }
php
public function getList($channelarray = null, $priority = SMARTIRC_MEDIUM) { if ($channelarray !== null) { if (!is_array($channelarray)) { $channelarray = array($channelarray); } $channellist = implode(',', $channelarray); $this->send('LIST '.$channellist, $priority); } else { $this->send('LIST', $priority); } return $this; }
[ "public", "function", "getList", "(", "$", "channelarray", "=", "null", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "if", "(", "$", "channelarray", "!==", "null", ")", "{", "if", "(", "!", "is_array", "(", "$", "channelarray", ")", ")", "{"...
gets a list of one ore more channels Requests a full channellist if $channelarray is not given. (use it with care, usually its a looooong list) @param mixed $channelarray @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "gets", "a", "list", "of", "one", "ore", "more", "channels" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L190-L203
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.setTopic
public function setTopic($channel, $newtopic, $priority = SMARTIRC_MEDIUM) { $this->send('TOPIC '.$channel.' :'.$newtopic, $priority); return $this; }
php
public function setTopic($channel, $newtopic, $priority = SMARTIRC_MEDIUM) { $this->send('TOPIC '.$channel.' :'.$newtopic, $priority); return $this; }
[ "public", "function", "setTopic", "(", "$", "channel", ",", "$", "newtopic", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "$", "this", "->", "send", "(", "'TOPIC '", ".", "$", "channel", ".", "' :'", ".", "$", "newtopic", ",", "$", "priority...
sets a new topic of a channel @param string $channel @param string $newtopic @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "sets", "a", "new", "topic", "of", "a", "channel" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L239-L243
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.mode
public function mode($target, $newmode = null, $priority = SMARTIRC_MEDIUM) { if ($newmode !== null) { $this->send('MODE '.$target.' '.$newmode, $priority); } else { $this->send('MODE '.$target, $priority); } return $this; }
php
public function mode($target, $newmode = null, $priority = SMARTIRC_MEDIUM) { if ($newmode !== null) { $this->send('MODE '.$target.' '.$newmode, $priority); } else { $this->send('MODE '.$target, $priority); } return $this; }
[ "public", "function", "mode", "(", "$", "target", ",", "$", "newmode", "=", "null", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "if", "(", "$", "newmode", "!==", "null", ")", "{", "$", "this", "->", "send", "(", "'MODE '", ".", "$", "ta...
sets or gets the mode of an user or channel Changes/requests the mode of the given target. @param string $target the target, can be an user (only yourself) or a channel @param string $newmode the new mode like +mt @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "sets", "or", "gets", "the", "mode", "of", "an", "user", "or", "channel" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L270-L278
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.founder
public function founder($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '+q '.$nickname, $priority); }
php
public function founder($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '+q '.$nickname, $priority); }
[ "public", "function", "founder", "(", "$", "channel", ",", "$", "nickname", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "return", "$", "this", "->", "mode", "(", "$", "channel", ",", "'+q '", ".", "$", "nickname", ",", "$", "priority", ")",...
founders an user in the given channel @param string $channel @param string $nickname @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "founders", "an", "user", "in", "the", "given", "channel" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L289-L292
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.defounder
public function defounder($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '-q '.$nickname, $priority); }
php
public function defounder($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '-q '.$nickname, $priority); }
[ "public", "function", "defounder", "(", "$", "channel", ",", "$", "nickname", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "return", "$", "this", "->", "mode", "(", "$", "channel", ",", "'-q '", ".", "$", "nickname", ",", "$", "priority", ")...
defounders an user in the given channel @param string $channel @param string $nickname @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "defounders", "an", "user", "in", "the", "given", "channel" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L303-L306
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.admin
public function admin($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '+a '.$nickname, $priority); }
php
public function admin($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '+a '.$nickname, $priority); }
[ "public", "function", "admin", "(", "$", "channel", ",", "$", "nickname", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "return", "$", "this", "->", "mode", "(", "$", "channel", ",", "'+a '", ".", "$", "nickname", ",", "$", "priority", ")", ...
admins an user in the given channel @param string $channel @param string $nickname @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "admins", "an", "user", "in", "the", "given", "channel" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L317-L320
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.deadmin
public function deadmin($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '-a '.$nickname, $priority); }
php
public function deadmin($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '-a '.$nickname, $priority); }
[ "public", "function", "deadmin", "(", "$", "channel", ",", "$", "nickname", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "return", "$", "this", "->", "mode", "(", "$", "channel", ",", "'-a '", ".", "$", "nickname", ",", "$", "priority", ")",...
deadmins an user in the given channel @param string $channel @param string $nickname @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "deadmins", "an", "user", "in", "the", "given", "channel" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L331-L334
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.op
public function op($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '+o '.$nickname, $priority); }
php
public function op($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '+o '.$nickname, $priority); }
[ "public", "function", "op", "(", "$", "channel", ",", "$", "nickname", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "return", "$", "this", "->", "mode", "(", "$", "channel", ",", "'+o '", ".", "$", "nickname", ",", "$", "priority", ")", ";...
ops an user in the given channel @param string $channel @param string $nickname @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "ops", "an", "user", "in", "the", "given", "channel" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L345-L348
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.deop
public function deop($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '-o '.$nickname, $priority); }
php
public function deop($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '-o '.$nickname, $priority); }
[ "public", "function", "deop", "(", "$", "channel", ",", "$", "nickname", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "return", "$", "this", "->", "mode", "(", "$", "channel", ",", "'-o '", ".", "$", "nickname", ",", "$", "priority", ")", ...
deops an user in the given channel @param string $channel @param string $nickname @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "deops", "an", "user", "in", "the", "given", "channel" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L359-L362
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.hop
public function hop($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '+h '.$nickname, $priority); }
php
public function hop($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '+h '.$nickname, $priority); }
[ "public", "function", "hop", "(", "$", "channel", ",", "$", "nickname", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "return", "$", "this", "->", "mode", "(", "$", "channel", ",", "'+h '", ".", "$", "nickname", ",", "$", "priority", ")", "...
hops an user in the given channel @param string $channel @param string $nickname @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "hops", "an", "user", "in", "the", "given", "channel" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L373-L376
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.dehop
public function dehop($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '-h '.$nickname, $priority); }
php
public function dehop($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '-h '.$nickname, $priority); }
[ "public", "function", "dehop", "(", "$", "channel", ",", "$", "nickname", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "return", "$", "this", "->", "mode", "(", "$", "channel", ",", "'-h '", ".", "$", "nickname", ",", "$", "priority", ")", ...
dehops an user in the given channel @param string $channel @param string $nickname @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "dehops", "an", "user", "in", "the", "given", "channel" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L387-L390
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.voice
public function voice($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '+v '.$nickname, $priority); }
php
public function voice($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '+v '.$nickname, $priority); }
[ "public", "function", "voice", "(", "$", "channel", ",", "$", "nickname", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "return", "$", "this", "->", "mode", "(", "$", "channel", ",", "'+v '", ".", "$", "nickname", ",", "$", "priority", ")", ...
voice a user in the given channel @param string $channel @param string $nickname @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "voice", "a", "user", "in", "the", "given", "channel" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L401-L404
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.devoice
public function devoice($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '-v '.$nickname, $priority); }
php
public function devoice($channel, $nickname, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '-v '.$nickname, $priority); }
[ "public", "function", "devoice", "(", "$", "channel", ",", "$", "nickname", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "return", "$", "this", "->", "mode", "(", "$", "channel", ",", "'-v '", ".", "$", "nickname", ",", "$", "priority", ")",...
devoice a user in the given channel @param string $channel @param string $nickname @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "devoice", "a", "user", "in", "the", "given", "channel" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L415-L418
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.ban
public function ban($channel, $hostmask = null, $priority = SMARTIRC_MEDIUM) { if ($hostmask !== null) { $this->mode($channel, '+b '.$hostmask, $priority); } else { $this->mode($channel, 'b', $priority); } return $this; }
php
public function ban($channel, $hostmask = null, $priority = SMARTIRC_MEDIUM) { if ($hostmask !== null) { $this->mode($channel, '+b '.$hostmask, $priority); } else { $this->mode($channel, 'b', $priority); } return $this; }
[ "public", "function", "ban", "(", "$", "channel", ",", "$", "hostmask", "=", "null", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "if", "(", "$", "hostmask", "!==", "null", ")", "{", "$", "this", "->", "mode", "(", "$", "channel", ",", "...
bans a hostmask for the given channel or requests the current banlist The banlist will be requested if no hostmask is specified @param string $channel @param string $hostmask @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "bans", "a", "hostmask", "for", "the", "given", "channel", "or", "requests", "the", "current", "banlist" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L431-L439
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.unban
public function unban($channel, $hostmask, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '-b '.$hostmask, $priority); }
php
public function unban($channel, $hostmask, $priority = SMARTIRC_MEDIUM) { return $this->mode($channel, '-b '.$hostmask, $priority); }
[ "public", "function", "unban", "(", "$", "channel", ",", "$", "hostmask", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "return", "$", "this", "->", "mode", "(", "$", "channel", ",", "'-b '", ".", "$", "hostmask", ",", "$", "priority", ")", ...
unbans a hostmask on the given channel @param string $channel @param string $hostmask @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "unbans", "a", "hostmask", "on", "the", "given", "channel" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L450-L453
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.invite
public function invite($nickname, $channel, $priority = SMARTIRC_MEDIUM) { return $this->send('INVITE '.$nickname.' '.$channel, $priority); }
php
public function invite($nickname, $channel, $priority = SMARTIRC_MEDIUM) { return $this->send('INVITE '.$nickname.' '.$channel, $priority); }
[ "public", "function", "invite", "(", "$", "nickname", ",", "$", "channel", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "return", "$", "this", "->", "send", "(", "'INVITE '", ".", "$", "nickname", ".", "' '", ".", "$", "channel", ",", "$", ...
invites a user to the specified channel @param string $nickname @param string $channel @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "invites", "a", "user", "to", "the", "specified", "channel" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L464-L467
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.changeNick
public function changeNick($newnick, $priority = SMARTIRC_MEDIUM) { $this->_nick = $newnick; return $this->send('NICK '.$newnick, $priority); }
php
public function changeNick($newnick, $priority = SMARTIRC_MEDIUM) { $this->_nick = $newnick; return $this->send('NICK '.$newnick, $priority); }
[ "public", "function", "changeNick", "(", "$", "newnick", ",", "$", "priority", "=", "SMARTIRC_MEDIUM", ")", "{", "$", "this", "->", "_nick", "=", "$", "newnick", ";", "return", "$", "this", "->", "send", "(", "'NICK '", ".", "$", "newnick", ",", "$", ...
changes the own nickname Trys to set a new nickname, nickcollisions are handled. @param string $newnick @param integer $priority message priority, default is SMARTIRC_MEDIUM @return Net_SmartIRC @api
[ "changes", "the", "own", "nickname" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L479-L483
train
pear/Net_SmartIRC
Net/SmartIRC/irccommands.php
Net_SmartIRC_irccommands.quit
public function quit($quitmessage = null, $priority = SMARTIRC_CRITICAL) { if ($quitmessage !== null) { $this->send('QUIT :'.$quitmessage, $priority); } else { $this->send('QUIT', $priority); } return $this->disconnect(true); }
php
public function quit($quitmessage = null, $priority = SMARTIRC_CRITICAL) { if ($quitmessage !== null) { $this->send('QUIT :'.$quitmessage, $priority); } else { $this->send('QUIT', $priority); } return $this->disconnect(true); }
[ "public", "function", "quit", "(", "$", "quitmessage", "=", "null", ",", "$", "priority", "=", "SMARTIRC_CRITICAL", ")", "{", "if", "(", "$", "quitmessage", "!==", "null", ")", "{", "$", "this", "->", "send", "(", "'QUIT :'", ".", "$", "quitmessage", "...
sends QUIT to IRC server and disconnects @param string $quitmessage optional quitmessage @param integer $priority message priority, default is SMARTIRC_CRITICAL @return Net_SmartIRC @api
[ "sends", "QUIT", "to", "IRC", "server", "and", "disconnects" ]
2f54571993599e3c78c00204be31eb785e252b81
https://github.com/pear/Net_SmartIRC/blob/2f54571993599e3c78c00204be31eb785e252b81/Net/SmartIRC/irccommands.php#L533-L542
train
brightnucleus/shortcodes
src/ShortcodeAttsParser.php
ShortcodeAttsParser.parse_atts
public function parse_atts( $atts, $tag ) { $atts = \shortcode_atts( $this->default_atts(), $this->validated_atts( (array) $atts ), $tag ); return $atts; }
php
public function parse_atts( $atts, $tag ) { $atts = \shortcode_atts( $this->default_atts(), $this->validated_atts( (array) $atts ), $tag ); return $atts; }
[ "public", "function", "parse_atts", "(", "$", "atts", ",", "$", "tag", ")", "{", "$", "atts", "=", "\\", "shortcode_atts", "(", "$", "this", "->", "default_atts", "(", ")", ",", "$", "this", "->", "validated_atts", "(", "(", "array", ")", "$", "atts"...
Parse and validate the shortcode's attributes. @since 0.1.0 @param array $atts Attributes passed to the shortcode. @param string $tag Tag of the shortcode. @return array Validated attributes of the shortcode.
[ "Parse", "and", "validate", "the", "shortcode", "s", "attributes", "." ]
5db6fa3c18db856ab550e56960a844d6aa99dabb
https://github.com/brightnucleus/shortcodes/blob/5db6fa3c18db856ab550e56960a844d6aa99dabb/src/ShortcodeAttsParser.php#L53-L61
train
brightnucleus/shortcodes
src/ShortcodeAttsParser.php
ShortcodeAttsParser.default_atts
protected function default_atts() { $atts = array(); if ( ! $this->hasConfigKey( 'atts' ) ) { return $atts; } $atts_config = $this->getConfigKey( 'atts' ); array_walk( $atts_config, function ( $att_properties, $att_label ) use ( &$atts ) { $atts[ $att_label ] = $att_properties['default']; } ); return $atts; }
php
protected function default_atts() { $atts = array(); if ( ! $this->hasConfigKey( 'atts' ) ) { return $atts; } $atts_config = $this->getConfigKey( 'atts' ); array_walk( $atts_config, function ( $att_properties, $att_label ) use ( &$atts ) { $atts[ $att_label ] = $att_properties['default']; } ); return $atts; }
[ "protected", "function", "default_atts", "(", ")", "{", "$", "atts", "=", "array", "(", ")", ";", "if", "(", "!", "$", "this", "->", "hasConfigKey", "(", "'atts'", ")", ")", "{", "return", "$", "atts", ";", "}", "$", "atts_config", "=", "$", "this"...
Return an array of default attributes read from the configuration array. @since 0.1.0 @return array Default attributes.
[ "Return", "an", "array", "of", "default", "attributes", "read", "from", "the", "configuration", "array", "." ]
5db6fa3c18db856ab550e56960a844d6aa99dabb
https://github.com/brightnucleus/shortcodes/blob/5db6fa3c18db856ab550e56960a844d6aa99dabb/src/ShortcodeAttsParser.php#L70-L86
train
brightnucleus/shortcodes
src/ShortcodeAttsParser.php
ShortcodeAttsParser.validated_atts
protected function validated_atts( $atts ) { if ( ! $this->hasConfigKey( 'atts' ) ) { return $atts; } $atts_config = $this->getConfigKey( 'atts' ); array_walk( $atts_config, function ( $att_properties, $att_label ) use ( &$atts ) { if ( array_key_exists( $att_label, $atts ) ) { $validate_function = $att_properties['validate']; $atts[ $att_label ] = $validate_function( $atts[ $att_label ] ); } } ); return $atts; }
php
protected function validated_atts( $atts ) { if ( ! $this->hasConfigKey( 'atts' ) ) { return $atts; } $atts_config = $this->getConfigKey( 'atts' ); array_walk( $atts_config, function ( $att_properties, $att_label ) use ( &$atts ) { if ( array_key_exists( $att_label, $atts ) ) { $validate_function = $att_properties['validate']; $atts[ $att_label ] = $validate_function( $atts[ $att_label ] ); } } ); return $atts; }
[ "protected", "function", "validated_atts", "(", "$", "atts", ")", "{", "if", "(", "!", "$", "this", "->", "hasConfigKey", "(", "'atts'", ")", ")", "{", "return", "$", "atts", ";", "}", "$", "atts_config", "=", "$", "this", "->", "getConfigKey", "(", ...
Return an array of validated attributes checked against the configuration array. @since 0.1.0 @param array $atts Attributes that were passed to the shortcode. @return array Validated attributes.
[ "Return", "an", "array", "of", "validated", "attributes", "checked", "against", "the", "configuration", "array", "." ]
5db6fa3c18db856ab550e56960a844d6aa99dabb
https://github.com/brightnucleus/shortcodes/blob/5db6fa3c18db856ab550e56960a844d6aa99dabb/src/ShortcodeAttsParser.php#L97-L114
train
CatsSystem/swoole-etcd
etcd/LeaseClient.php
LeaseClient.LeaseGrant
public function LeaseGrant(LeaseGrantRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/etcdserverpb.Lease/LeaseGrant', $argument, ['\Etcdserverpb\LeaseGrantResponse', 'decode'], $metadata, $options ); }
php
public function LeaseGrant(LeaseGrantRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/etcdserverpb.Lease/LeaseGrant', $argument, ['\Etcdserverpb\LeaseGrantResponse', 'decode'], $metadata, $options ); }
[ "public", "function", "LeaseGrant", "(", "LeaseGrantRequest", "$", "argument", ",", "$", "metadata", "=", "[", "]", ",", "$", "options", "=", "[", "]", ")", "{", "return", "$", "this", "->", "_simpleRequest", "(", "'/etcdserverpb.Lease/LeaseGrant'", ",", "$"...
LeaseGrant creates a lease which expires if the server does not receive a keepAlive within a given time to live period. All keys attached to the lease will be expired and deleted if the lease expires. Each expired key generates a delete event in the event history. @param LeaseGrantRequest $argument input argument @param array $metadata metadata @param array $options call options @return UnaryCall
[ "LeaseGrant", "creates", "a", "lease", "which", "expires", "if", "the", "server", "does", "not", "receive", "a", "keepAlive", "within", "a", "given", "time", "to", "live", "period", ".", "All", "keys", "attached", "to", "the", "lease", "will", "be", "expir...
9fe824bbcc39a1cc1609b22ffa030287e7e8912d
https://github.com/CatsSystem/swoole-etcd/blob/9fe824bbcc39a1cc1609b22ffa030287e7e8912d/etcd/LeaseClient.php#L39-L48
train
CatsSystem/swoole-etcd
etcd/LeaseClient.php
LeaseClient.LeaseRevoke
public function LeaseRevoke(LeaseRevokeRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/etcdserverpb.Lease/LeaseRevoke', $argument, ['\Etcdserverpb\LeaseRevokeResponse', 'decode'], $metadata, $options ); }
php
public function LeaseRevoke(LeaseRevokeRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/etcdserverpb.Lease/LeaseRevoke', $argument, ['\Etcdserverpb\LeaseRevokeResponse', 'decode'], $metadata, $options ); }
[ "public", "function", "LeaseRevoke", "(", "LeaseRevokeRequest", "$", "argument", ",", "$", "metadata", "=", "[", "]", ",", "$", "options", "=", "[", "]", ")", "{", "return", "$", "this", "->", "_simpleRequest", "(", "'/etcdserverpb.Lease/LeaseRevoke'", ",", ...
LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted. @param LeaseRevokeRequest $argument input argument @param array $metadata metadata @param array $options call options @return UnaryCall
[ "LeaseRevoke", "revokes", "a", "lease", ".", "All", "keys", "attached", "to", "the", "lease", "will", "expire", "and", "be", "deleted", "." ]
9fe824bbcc39a1cc1609b22ffa030287e7e8912d
https://github.com/CatsSystem/swoole-etcd/blob/9fe824bbcc39a1cc1609b22ffa030287e7e8912d/etcd/LeaseClient.php#L57-L66
train
CatsSystem/swoole-etcd
etcd/LeaseClient.php
LeaseClient.LeaseTimeToLive
public function LeaseTimeToLive(LeaseTimeToLiveRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/etcdserverpb.Lease/LeaseTimeToLive', $argument, ['\Etcdserverpb\LeaseTimeToLiveResponse', 'decode'], $metadata, $options ); }
php
public function LeaseTimeToLive(LeaseTimeToLiveRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/etcdserverpb.Lease/LeaseTimeToLive', $argument, ['\Etcdserverpb\LeaseTimeToLiveResponse', 'decode'], $metadata, $options ); }
[ "public", "function", "LeaseTimeToLive", "(", "LeaseTimeToLiveRequest", "$", "argument", ",", "$", "metadata", "=", "[", "]", ",", "$", "options", "=", "[", "]", ")", "{", "return", "$", "this", "->", "_simpleRequest", "(", "'/etcdserverpb.Lease/LeaseTimeToLive'...
LeaseTimeToLive retrieves lease information. @param LeaseTimeToLiveRequest $argument input argument @param array $metadata metadata @param array $options call options @return UnaryCall
[ "LeaseTimeToLive", "retrieves", "lease", "information", "." ]
9fe824bbcc39a1cc1609b22ffa030287e7e8912d
https://github.com/CatsSystem/swoole-etcd/blob/9fe824bbcc39a1cc1609b22ffa030287e7e8912d/etcd/LeaseClient.php#L91-L100
train
rovangju/carbon-nbd
src/CarbonExt/NBD/Calculator.php
Calculator.isExcluded
public function isExcluded(Carbon $dt) { foreach ($this->exclusions() as $exc) { if ($dt->eq($exc)) { return TRUE; } } foreach ($this->callbacks() as $fn) { if ($fn($dt) == TRUE) { return TRUE; } } return FALSE; }
php
public function isExcluded(Carbon $dt) { foreach ($this->exclusions() as $exc) { if ($dt->eq($exc)) { return TRUE; } } foreach ($this->callbacks() as $fn) { if ($fn($dt) == TRUE) { return TRUE; } } return FALSE; }
[ "public", "function", "isExcluded", "(", "Carbon", "$", "dt", ")", "{", "foreach", "(", "$", "this", "->", "exclusions", "(", ")", "as", "$", "exc", ")", "{", "if", "(", "$", "dt", "->", "eq", "(", "$", "exc", ")", ")", "{", "return", "TRUE", "...
Determine if a date is a non-business day @param Carbon $dt @return bool
[ "Determine", "if", "a", "date", "is", "a", "non", "-", "business", "day" ]
d43356bdf80b6d7cd7821d6f18371e225bb0e3ab
https://github.com/rovangju/carbon-nbd/blob/d43356bdf80b6d7cd7821d6f18371e225bb0e3ab/src/CarbonExt/NBD/Calculator.php#L79-L95
train
rovangju/carbon-nbd
src/CarbonExt/NBD/Calculator.php
Calculator.nbd
public function nbd(Carbon $dt = NULL) { if (($dt instanceof Carbon) == FALSE) { $dt = new Carbon(); } if ($this->deadline()) { if ($this->deadline()->lt($dt)) { $dt->addDay(); } } else { $dt->addDay(); } /* Time becomes irrelevant */ $dt->setTime(0,0,0); $iters = 0; while ($this->isExcluded($dt)) { if ($iters == static::$N_MAX_ITER) { throw new \RuntimeException('Maximum iterations met for next business day calculation'); } $dt->addDay(); $iters++; } return $dt; }
php
public function nbd(Carbon $dt = NULL) { if (($dt instanceof Carbon) == FALSE) { $dt = new Carbon(); } if ($this->deadline()) { if ($this->deadline()->lt($dt)) { $dt->addDay(); } } else { $dt->addDay(); } /* Time becomes irrelevant */ $dt->setTime(0,0,0); $iters = 0; while ($this->isExcluded($dt)) { if ($iters == static::$N_MAX_ITER) { throw new \RuntimeException('Maximum iterations met for next business day calculation'); } $dt->addDay(); $iters++; } return $dt; }
[ "public", "function", "nbd", "(", "Carbon", "$", "dt", "=", "NULL", ")", "{", "if", "(", "(", "$", "dt", "instanceof", "Carbon", ")", "==", "FALSE", ")", "{", "$", "dt", "=", "new", "Carbon", "(", ")", ";", "}", "if", "(", "$", "this", "->", ...
Determine the next business day @param Carbon $dt Day to check @throws \RuntimeException @return Carbon Next business day (DATE ONLY, times will be zeroed out)
[ "Determine", "the", "next", "business", "day" ]
d43356bdf80b6d7cd7821d6f18371e225bb0e3ab
https://github.com/rovangju/carbon-nbd/blob/d43356bdf80b6d7cd7821d6f18371e225bb0e3ab/src/CarbonExt/NBD/Calculator.php#L124-L154
train
protobuf-php/google-protobuf-proto
src/google/protobuf/SourceCodeInfo.php
SourceCodeInfo.addLocation
public function addLocation(\google\protobuf\SourceCodeInfo\Location $value) { if ($this->location === null) { $this->location = new \Protobuf\MessageCollection(); } $this->location->add($value); }
php
public function addLocation(\google\protobuf\SourceCodeInfo\Location $value) { if ($this->location === null) { $this->location = new \Protobuf\MessageCollection(); } $this->location->add($value); }
[ "public", "function", "addLocation", "(", "\\", "google", "\\", "protobuf", "\\", "SourceCodeInfo", "\\", "Location", "$", "value", ")", "{", "if", "(", "$", "this", "->", "location", "===", "null", ")", "{", "$", "this", "->", "location", "=", "new", ...
Add a new element to 'location' @param \google\protobuf\SourceCodeInfo\Location $value
[ "Add", "a", "new", "element", "to", "location" ]
da1827b4a23fccd4eb998a8d4bcd972f2330bc29
https://github.com/protobuf-php/google-protobuf-proto/blob/da1827b4a23fccd4eb998a8d4bcd972f2330bc29/src/google/protobuf/SourceCodeInfo.php#L69-L76
train
axllent/silverstripe-minifier
src/Minifier.php
Minifier.minify
public function minify($content, $type, $fileName) { if ($type == 'css') { $minifier = new Minify\CSS(); $minifier->add($content); return $minifier->minify(); } elseif ($type == 'js') { $minifier = new Minify\JS(); $minifier->add($content); return $minifier->minify() . ';'; } return $content; }
php
public function minify($content, $type, $fileName) { if ($type == 'css') { $minifier = new Minify\CSS(); $minifier->add($content); return $minifier->minify(); } elseif ($type == 'js') { $minifier = new Minify\JS(); $minifier->add($content); return $minifier->minify() . ';'; } return $content; }
[ "public", "function", "minify", "(", "$", "content", ",", "$", "type", ",", "$", "fileName", ")", "{", "if", "(", "$", "type", "==", "'css'", ")", "{", "$", "minifier", "=", "new", "Minify", "\\", "CSS", "(", ")", ";", "$", "minifier", "->", "add...
Minify the given content @param string $content @param string $type Either js or css @param string $filename Name of file to display in case of error @return string minified content
[ "Minify", "the", "given", "content" ]
8f2a743be8003e09979037584056101d34d028b0
https://github.com/axllent/silverstripe-minifier/blob/8f2a743be8003e09979037584056101d34d028b0/src/Minifier.php#L18-L30
train
melisplatform/melis-front
src/Listener/MelisFrontSEODispatchRouterRegularUrlListener.php
MelisFrontSEODispatchRouterRegularUrlListener.redirectPageSEO301
public function redirectPageSEO301($e, $idpage) { $sm = $e->getApplication()->getServiceManager(); $router = $e->getRouter(); $uri = $router->getRequestUri(); // Check for defined SEO 301 redirection $uri = $uri->getPath(); if (substr($uri, 0, 1) == '/') $uri = substr($uri, 1, strlen($uri)); $melisTablePageSeo = $sm->get('MelisEngineTablePageSeo'); $datasPageSeo = $melisTablePageSeo->getEntryById($idpage); if (!empty($datasPageSeo)) { $datasPageSeo = $datasPageSeo->current(); if (!empty($datasPageSeo) && !empty($datasPageSeo->pseo_url_301)) { if (substr($datasPageSeo->pseo_url_301, 0, 4) != 'http') $newuri = '/' . $datasPageSeo->pseo_url_301; else $newuri = $datasPageSeo->pseo_url_301; $newuri .= $this->getQueryParameters($e); return $newuri; } } return null; }
php
public function redirectPageSEO301($e, $idpage) { $sm = $e->getApplication()->getServiceManager(); $router = $e->getRouter(); $uri = $router->getRequestUri(); // Check for defined SEO 301 redirection $uri = $uri->getPath(); if (substr($uri, 0, 1) == '/') $uri = substr($uri, 1, strlen($uri)); $melisTablePageSeo = $sm->get('MelisEngineTablePageSeo'); $datasPageSeo = $melisTablePageSeo->getEntryById($idpage); if (!empty($datasPageSeo)) { $datasPageSeo = $datasPageSeo->current(); if (!empty($datasPageSeo) && !empty($datasPageSeo->pseo_url_301)) { if (substr($datasPageSeo->pseo_url_301, 0, 4) != 'http') $newuri = '/' . $datasPageSeo->pseo_url_301; else $newuri = $datasPageSeo->pseo_url_301; $newuri .= $this->getQueryParameters($e); return $newuri; } } return null; }
[ "public", "function", "redirectPageSEO301", "(", "$", "e", ",", "$", "idpage", ")", "{", "$", "sm", "=", "$", "e", "->", "getApplication", "(", ")", "->", "getServiceManager", "(", ")", ";", "$", "router", "=", "$", "e", "->", "getRouter", "(", ")", ...
This function handles the basic SEO 301 for Melis pages. This will be used when a page is unpublished @param MvcEvent $e @param int $idpage @return string|NULL The URL of the 301 page defined in SEO
[ "This", "function", "handles", "the", "basic", "SEO", "301", "for", "Melis", "pages", ".", "This", "will", "be", "used", "when", "a", "page", "is", "unpublished" ]
5e03e32687970bb2201e4205612d5539500dc514
https://github.com/melisplatform/melis-front/blob/5e03e32687970bb2201e4205612d5539500dc514/src/Listener/MelisFrontSEODispatchRouterRegularUrlListener.php#L267-L296
train
hostnet/entity-tracker-component
src/Listener/EntityChangedListener.php
EntityChangedListener.preFlush
public function preFlush(PreFlushEventArgs $event) { $em = $event->getEntityManager(); $changes = $this->meta_mutation_provider->getFullChangeSet($em); foreach ($changes as $updates) { if (0 === count($updates)) { continue; } if (false === $this->meta_annotation_provider->isTracked($em, current($updates))) { continue; } foreach ($updates as $entity) { if ($entity instanceof Proxy && !$entity->__isInitialized()) { continue; } $original = $this->meta_mutation_provider->createOriginalEntity($em, $entity); $mutated_fields = $this->meta_mutation_provider->getMutatedFields($em, $entity, $original); if (null === $original || !empty($mutated_fields)) { $this->logger->debug( 'Going to notify a change (preFlush) to {entity_class}, which has {mutated_fields}', [ 'entity_class' => get_class($entity), 'mutated_fields' => $mutated_fields ] ); $em->getEventManager()->dispatchEvent( Events::ENTITY_CHANGED, new EntityChangedEvent($em, $entity, $original, $mutated_fields) ); } } } }
php
public function preFlush(PreFlushEventArgs $event) { $em = $event->getEntityManager(); $changes = $this->meta_mutation_provider->getFullChangeSet($em); foreach ($changes as $updates) { if (0 === count($updates)) { continue; } if (false === $this->meta_annotation_provider->isTracked($em, current($updates))) { continue; } foreach ($updates as $entity) { if ($entity instanceof Proxy && !$entity->__isInitialized()) { continue; } $original = $this->meta_mutation_provider->createOriginalEntity($em, $entity); $mutated_fields = $this->meta_mutation_provider->getMutatedFields($em, $entity, $original); if (null === $original || !empty($mutated_fields)) { $this->logger->debug( 'Going to notify a change (preFlush) to {entity_class}, which has {mutated_fields}', [ 'entity_class' => get_class($entity), 'mutated_fields' => $mutated_fields ] ); $em->getEventManager()->dispatchEvent( Events::ENTITY_CHANGED, new EntityChangedEvent($em, $entity, $original, $mutated_fields) ); } } } }
[ "public", "function", "preFlush", "(", "PreFlushEventArgs", "$", "event", ")", "{", "$", "em", "=", "$", "event", "->", "getEntityManager", "(", ")", ";", "$", "changes", "=", "$", "this", "->", "meta_mutation_provider", "->", "getFullChangeSet", "(", "$", ...
Pre Flush event callback Checks if the entity contains an @Tracked (or derived) annotation. If so, it will attempt to calculate changes made and dispatch 'Events::ENTITY_CHANGED' with the current and original entity states. Note that the original entity is not managed. @param PreFlushEventArgs $event
[ "Pre", "Flush", "event", "callback" ]
08601d9db4faf7804f9097460e2149da3aa4fda3
https://github.com/hostnet/entity-tracker-component/blob/08601d9db4faf7804f9097460e2149da3aa4fda3/src/Listener/EntityChangedListener.php#L70-L108
train
dreamfactorysoftware/df-system
src/Resources/UserProfileResource.php
UserProfileResource.handleGET
protected function handleGET() { $user = Session::user(); if (empty($user)) { throw new UnauthorizedException('There is no valid session for the current request.'); } $data = [ 'username' => $user->username, 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'name' => $user->name, 'email' => $user->email, 'phone' => $user->phone, 'security_question' => $user->security_question, 'default_app_id' => $user->default_app_id, 'oauth_provider' => (!empty($user->oauth_provider)) ? $user->oauth_provider : '', 'adldap' => (!empty($user->adldap)) ? $user->adldap : '' ]; return $data; }
php
protected function handleGET() { $user = Session::user(); if (empty($user)) { throw new UnauthorizedException('There is no valid session for the current request.'); } $data = [ 'username' => $user->username, 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'name' => $user->name, 'email' => $user->email, 'phone' => $user->phone, 'security_question' => $user->security_question, 'default_app_id' => $user->default_app_id, 'oauth_provider' => (!empty($user->oauth_provider)) ? $user->oauth_provider : '', 'adldap' => (!empty($user->adldap)) ? $user->adldap : '' ]; return $data; }
[ "protected", "function", "handleGET", "(", ")", "{", "$", "user", "=", "Session", "::", "user", "(", ")", ";", "if", "(", "empty", "(", "$", "user", ")", ")", "{", "throw", "new", "UnauthorizedException", "(", "'There is no valid session for the current reques...
Fetches user profile. @return array @throws UnauthorizedException
[ "Fetches", "user", "profile", "." ]
18f91d7630d3cdaef85611c5b668c0521130593e
https://github.com/dreamfactorysoftware/df-system/blob/18f91d7630d3cdaef85611c5b668c0521130593e/src/Resources/UserProfileResource.php#L37-L59
train
dreamfactorysoftware/df-system
src/Resources/UserProfileResource.php
UserProfileResource.handlePOST
protected function handlePOST() { if (empty($payload = $this->getPayloadData())) { throw new BadRequestException('No data supplied for operation.'); } $data = [ 'username' => array_get($payload, 'username'), 'first_name' => array_get($payload, 'first_name'), 'last_name' => array_get($payload, 'last_name'), 'name' => array_get($payload, 'name'), 'email' => array_get($payload, 'email'), 'phone' => array_get($payload, 'phone'), 'security_question' => array_get($payload, 'security_question'), 'security_answer' => array_get($payload, 'security_answer'), 'default_app_id' => array_get($payload, 'default_app_id') ]; $data = array_filter($data, function ($value) { return !is_null($value); }); $user = Session::user(); if (empty($user)) { throw new NotFoundException('No user session found.'); } $oldToken = Session::getSessionToken(); $email = $user->email; $user->update($data); if (!empty($oldToken) && $email !== array_get($data, 'email', $email)) { // Email change invalidates token. Need to create a new token. $forever = JWTUtilities::isForever($oldToken); Session::setUserInfoWithJWT($user, $forever); $newToken = Session::getSessionToken(); return ['success' => true, 'session_token' => $newToken]; } return ['success' => true]; }
php
protected function handlePOST() { if (empty($payload = $this->getPayloadData())) { throw new BadRequestException('No data supplied for operation.'); } $data = [ 'username' => array_get($payload, 'username'), 'first_name' => array_get($payload, 'first_name'), 'last_name' => array_get($payload, 'last_name'), 'name' => array_get($payload, 'name'), 'email' => array_get($payload, 'email'), 'phone' => array_get($payload, 'phone'), 'security_question' => array_get($payload, 'security_question'), 'security_answer' => array_get($payload, 'security_answer'), 'default_app_id' => array_get($payload, 'default_app_id') ]; $data = array_filter($data, function ($value) { return !is_null($value); }); $user = Session::user(); if (empty($user)) { throw new NotFoundException('No user session found.'); } $oldToken = Session::getSessionToken(); $email = $user->email; $user->update($data); if (!empty($oldToken) && $email !== array_get($data, 'email', $email)) { // Email change invalidates token. Need to create a new token. $forever = JWTUtilities::isForever($oldToken); Session::setUserInfoWithJWT($user, $forever); $newToken = Session::getSessionToken(); return ['success' => true, 'session_token' => $newToken]; } return ['success' => true]; }
[ "protected", "function", "handlePOST", "(", ")", "{", "if", "(", "empty", "(", "$", "payload", "=", "$", "this", "->", "getPayloadData", "(", ")", ")", ")", "{", "throw", "new", "BadRequestException", "(", "'No data supplied for operation.'", ")", ";", "}", ...
Updates user profile. @return array @throws NotFoundException @throws \Exception
[ "Updates", "user", "profile", "." ]
18f91d7630d3cdaef85611c5b668c0521130593e
https://github.com/dreamfactorysoftware/df-system/blob/18f91d7630d3cdaef85611c5b668c0521130593e/src/Resources/UserProfileResource.php#L68-L110
train
protobuf-php/google-protobuf-proto
src/google/protobuf/ServiceDescriptorProto.php
ServiceDescriptorProto.addMethod
public function addMethod(\google\protobuf\MethodDescriptorProto $value) { if ($this->method === null) { $this->method = new \Protobuf\MessageCollection(); } $this->method->add($value); }
php
public function addMethod(\google\protobuf\MethodDescriptorProto $value) { if ($this->method === null) { $this->method = new \Protobuf\MessageCollection(); } $this->method->add($value); }
[ "public", "function", "addMethod", "(", "\\", "google", "\\", "protobuf", "\\", "MethodDescriptorProto", "$", "value", ")", "{", "if", "(", "$", "this", "->", "method", "===", "null", ")", "{", "$", "this", "->", "method", "=", "new", "\\", "Protobuf", ...
Add a new element to 'method' @param \google\protobuf\MethodDescriptorProto $value
[ "Add", "a", "new", "element", "to", "method" ]
da1827b4a23fccd4eb998a8d4bcd972f2330bc29
https://github.com/protobuf-php/google-protobuf-proto/blob/da1827b4a23fccd4eb998a8d4bcd972f2330bc29/src/google/protobuf/ServiceDescriptorProto.php#L113-L120
train
LearningLocker/Moodle-xAPI-Translator
src/Events/CourseCompleted.php
CourseCompleted.read
public function read(array $opts) { return [array_merge(parent::read($opts)[0], [ 'recipe' => 'course_completed', 'user_id' => $opts['relateduser']->id, 'user_url' => $opts['relateduser']->url, 'user_name' => $opts['relateduser']->fullname, ])]; }
php
public function read(array $opts) { return [array_merge(parent::read($opts)[0], [ 'recipe' => 'course_completed', 'user_id' => $opts['relateduser']->id, 'user_url' => $opts['relateduser']->url, 'user_name' => $opts['relateduser']->fullname, ])]; }
[ "public", "function", "read", "(", "array", "$", "opts", ")", "{", "return", "[", "array_merge", "(", "parent", "::", "read", "(", "$", "opts", ")", "[", "0", "]", ",", "[", "'recipe'", "=>", "'course_completed'", ",", "'user_id'", "=>", "$", "opts", ...
overides CourseViewed recipe. @param array $opts @return array
[ "overides", "CourseViewed", "recipe", "." ]
5d196b5059f0f5dcdd98f784ad814a39cd5d736c
https://github.com/LearningLocker/Moodle-xAPI-Translator/blob/5d196b5059f0f5dcdd98f784ad814a39cd5d736c/src/Events/CourseCompleted.php#L23-L30
train
LearningLocker/Moodle-xAPI-Translator
src/Events/QuestionSubmitted.php
QuestionSubmitted.expandQuestion
protected function expandQuestion($question, $questions) { if ($question->qtype == 'randomsamatch') { $subquestions = []; foreach ($questions as $otherquestion) { if ($otherquestion->qtype == 'shortanswer') { foreach ($otherquestion->answers as $answer) { if (intval($answer->fraction) === 1) { array_push( $subquestions, (object) [ "id" => $answer->id, "questiontext" => $otherquestion->questiontext, "answertext" => $answer->answer ] ); // Only take the first correct answer because that's what Moodle does. break; } } } } $question->match = (object) [ 'subquestions' => $subquestions ]; } return $question; }
php
protected function expandQuestion($question, $questions) { if ($question->qtype == 'randomsamatch') { $subquestions = []; foreach ($questions as $otherquestion) { if ($otherquestion->qtype == 'shortanswer') { foreach ($otherquestion->answers as $answer) { if (intval($answer->fraction) === 1) { array_push( $subquestions, (object) [ "id" => $answer->id, "questiontext" => $otherquestion->questiontext, "answertext" => $answer->answer ] ); // Only take the first correct answer because that's what Moodle does. break; } } } } $question->match = (object) [ 'subquestions' => $subquestions ]; } return $question; }
[ "protected", "function", "expandQuestion", "(", "$", "question", ",", "$", "questions", ")", "{", "if", "(", "$", "question", "->", "qtype", "==", "'randomsamatch'", ")", "{", "$", "subquestions", "=", "[", "]", ";", "foreach", "(", "$", "questions", "as...
For certain question types, expands question data by pulling from other questions. @param PHPObj $question @param Array $questions @return PHPObj $question
[ "For", "certain", "question", "types", "expands", "question", "data", "by", "pulling", "from", "other", "questions", "." ]
5d196b5059f0f5dcdd98f784ad814a39cd5d736c
https://github.com/LearningLocker/Moodle-xAPI-Translator/blob/5d196b5059f0f5dcdd98f784ad814a39cd5d736c/src/Events/QuestionSubmitted.php#L38-L65
train
LearningLocker/Moodle-xAPI-Translator
src/Events/QuestionSubmitted.php
QuestionSubmitted.resultFromState
public function resultFromState($translatorevent, $questionAttempt, $submittedState) { $maxMark = isset($questionAttempt->maxmark) ? $questionAttempt->maxmark : 100; $scaledScore = $submittedState->fraction; $rawScore = $scaledScore * floatval($maxMark); switch ($submittedState->state) { case "todo": $translatorevent['attempt_completed'] = false; $translatorevent['attempt_success'] = null; break; case "gaveup": $translatorevent['attempt_completed'] = false; $translatorevent['attempt_success'] = false; break; case "complete": $translatorevent['attempt_completed'] = true; $translatorevent['attempt_success'] = null; break; case "gradedwrong": $translatorevent['attempt_completed'] = true; $translatorevent['attempt_success'] = false; $translatorevent['attempt_score_scaled'] = $scaledScore; $translatorevent['attempt_score_raw'] = $rawScore; break; case "gradedpartial": $translatorevent['attempt_completed'] = true; $translatorevent['attempt_success'] = false; $translatorevent['attempt_score_scaled'] = $scaledScore; $translatorevent['attempt_score_raw'] = $rawScore; break; case "gradedright": $translatorevent['attempt_completed'] = true; $translatorevent['attempt_success'] = true; $translatorevent['attempt_score_scaled'] = $scaledScore; $translatorevent['attempt_score_raw'] = $rawScore; break; default: $translatorevent['attempt_completed'] = null; $translatorevent['attempt_success'] = null; break; } return $translatorevent; }
php
public function resultFromState($translatorevent, $questionAttempt, $submittedState) { $maxMark = isset($questionAttempt->maxmark) ? $questionAttempt->maxmark : 100; $scaledScore = $submittedState->fraction; $rawScore = $scaledScore * floatval($maxMark); switch ($submittedState->state) { case "todo": $translatorevent['attempt_completed'] = false; $translatorevent['attempt_success'] = null; break; case "gaveup": $translatorevent['attempt_completed'] = false; $translatorevent['attempt_success'] = false; break; case "complete": $translatorevent['attempt_completed'] = true; $translatorevent['attempt_success'] = null; break; case "gradedwrong": $translatorevent['attempt_completed'] = true; $translatorevent['attempt_success'] = false; $translatorevent['attempt_score_scaled'] = $scaledScore; $translatorevent['attempt_score_raw'] = $rawScore; break; case "gradedpartial": $translatorevent['attempt_completed'] = true; $translatorevent['attempt_success'] = false; $translatorevent['attempt_score_scaled'] = $scaledScore; $translatorevent['attempt_score_raw'] = $rawScore; break; case "gradedright": $translatorevent['attempt_completed'] = true; $translatorevent['attempt_success'] = true; $translatorevent['attempt_score_scaled'] = $scaledScore; $translatorevent['attempt_score_raw'] = $rawScore; break; default: $translatorevent['attempt_completed'] = null; $translatorevent['attempt_success'] = null; break; } return $translatorevent; }
[ "public", "function", "resultFromState", "(", "$", "translatorevent", ",", "$", "questionAttempt", ",", "$", "submittedState", ")", "{", "$", "maxMark", "=", "isset", "(", "$", "questionAttempt", "->", "maxmark", ")", "?", "$", "questionAttempt", "->", "maxmar...
Add some result data to translator event for an individual question attempt based on Moodle's question attempt state @param [String => Mixed] $translatorevent @param PHPObj $questionAttempt @param PHPObj $submittedState @return [String => Mixed]
[ "Add", "some", "result", "data", "to", "translator", "event", "for", "an", "individual", "question", "attempt", "based", "on", "Moodle", "s", "question", "attempt", "state" ]
5d196b5059f0f5dcdd98f784ad814a39cd5d736c
https://github.com/LearningLocker/Moodle-xAPI-Translator/blob/5d196b5059f0f5dcdd98f784ad814a39cd5d736c/src/Events/QuestionSubmitted.php#L148-L191
train
LearningLocker/Moodle-xAPI-Translator
src/Events/QuestionSubmitted.php
QuestionSubmitted.numericStatement
public function numericStatement($translatorevent, $questionAttempt, $question) { $translatorevent['interaction_type'] = 'numeric'; $correctAnswerId = null; foreach ($question->answers as $answer) { if (intval($answer->fraction) === 1) { $correctAnswerId = $answer->id; } } $tolerance = 0; $toleranceType = 2; $answersdata = []; if ($question->qtype == "numerical") { $answersdata = $question->numerical->answers; } else if (strpos($question->qtype, 'calculated') === 0) { $answersdata = $question->calculated->answers; } if (!is_null($correctAnswerId) && count($answersdata) > 0) { foreach ($answersdata as $answerdata) { if(isset($answerdata->answer)){ if ($answerdata->answer == $correctAnswerId) { $tolerance = floatval($answerdata->tolerance); if (isset($answerdata->tolerancetype)) { $toleranceType = intval($answerdata->tolerancetype); } } } } } $rigthtanswer = floatval($questionAttempt->rightanswer); if ($tolerance > 0) { $toleranceMax = $rigthtanswer + $tolerance; $toleranceMin = $rigthtanswer - $tolerance; switch ($toleranceType) { case 1: $toleranceMax = $rigthtanswer + ($rigthtanswer * $tolerance); $toleranceMin = $rigthtanswer - ($rigthtanswer * $tolerance); break; case 3: $toleranceMax = $rigthtanswer + ($rigthtanswer * $tolerance); $toleranceMin = $rigthtanswer / (1 + $tolerance); break; default: break; } $rigthtanswerstring = strval($toleranceMin) . '[:]' . strval($toleranceMax); $translatorevent['interaction_correct_responses'] = [$rigthtanswerstring]; } else { $translatorevent['interaction_correct_responses'] = [$questionAttempt->rightanswer]; } return $translatorevent; }
php
public function numericStatement($translatorevent, $questionAttempt, $question) { $translatorevent['interaction_type'] = 'numeric'; $correctAnswerId = null; foreach ($question->answers as $answer) { if (intval($answer->fraction) === 1) { $correctAnswerId = $answer->id; } } $tolerance = 0; $toleranceType = 2; $answersdata = []; if ($question->qtype == "numerical") { $answersdata = $question->numerical->answers; } else if (strpos($question->qtype, 'calculated') === 0) { $answersdata = $question->calculated->answers; } if (!is_null($correctAnswerId) && count($answersdata) > 0) { foreach ($answersdata as $answerdata) { if(isset($answerdata->answer)){ if ($answerdata->answer == $correctAnswerId) { $tolerance = floatval($answerdata->tolerance); if (isset($answerdata->tolerancetype)) { $toleranceType = intval($answerdata->tolerancetype); } } } } } $rigthtanswer = floatval($questionAttempt->rightanswer); if ($tolerance > 0) { $toleranceMax = $rigthtanswer + $tolerance; $toleranceMin = $rigthtanswer - $tolerance; switch ($toleranceType) { case 1: $toleranceMax = $rigthtanswer + ($rigthtanswer * $tolerance); $toleranceMin = $rigthtanswer - ($rigthtanswer * $tolerance); break; case 3: $toleranceMax = $rigthtanswer + ($rigthtanswer * $tolerance); $toleranceMin = $rigthtanswer / (1 + $tolerance); break; default: break; } $rigthtanswerstring = strval($toleranceMin) . '[:]' . strval($toleranceMax); $translatorevent['interaction_correct_responses'] = [$rigthtanswerstring]; } else { $translatorevent['interaction_correct_responses'] = [$questionAttempt->rightanswer]; } return $translatorevent; }
[ "public", "function", "numericStatement", "(", "$", "translatorevent", ",", "$", "questionAttempt", ",", "$", "question", ")", "{", "$", "translatorevent", "[", "'interaction_type'", "]", "=", "'numeric'", ";", "$", "correctAnswerId", "=", "null", ";", "foreach"...
Add data specifc to numeric question types to a translator event. @param [String => Mixed] $translatorevent @param PHPObj $questionAttempt @param PHPObj $question @return [String => Mixed]
[ "Add", "data", "specifc", "to", "numeric", "question", "types", "to", "a", "translator", "event", "." ]
5d196b5059f0f5dcdd98f784ad814a39cd5d736c
https://github.com/LearningLocker/Moodle-xAPI-Translator/blob/5d196b5059f0f5dcdd98f784ad814a39cd5d736c/src/Events/QuestionSubmitted.php#L258-L315
train
LearningLocker/Moodle-xAPI-Translator
src/Events/QuestionSubmitted.php
QuestionSubmitted.shortanswerStatement
public function shortanswerStatement($translatorevent, $questionAttempt, $question) { $translatorevent['interaction_type'] = 'fill-in'; $translatorevent['interaction_correct_responses'] = []; foreach ($question->answers as $answer) { if (intval($answer->fraction) === 1) { $correctResponse; if ($question->shortanswer->options->usecase == '1') { $correctResponse = '{case_matters=true}'.$answer->answer; } else { $correctResponse = '{case_matters=false}'.$answer->answer; } array_push($translatorevent['interaction_correct_responses'], $correctResponse); } } return $translatorevent; }
php
public function shortanswerStatement($translatorevent, $questionAttempt, $question) { $translatorevent['interaction_type'] = 'fill-in'; $translatorevent['interaction_correct_responses'] = []; foreach ($question->answers as $answer) { if (intval($answer->fraction) === 1) { $correctResponse; if ($question->shortanswer->options->usecase == '1') { $correctResponse = '{case_matters=true}'.$answer->answer; } else { $correctResponse = '{case_matters=false}'.$answer->answer; } array_push($translatorevent['interaction_correct_responses'], $correctResponse); } } return $translatorevent; }
[ "public", "function", "shortanswerStatement", "(", "$", "translatorevent", ",", "$", "questionAttempt", ",", "$", "question", ")", "{", "$", "translatorevent", "[", "'interaction_type'", "]", "=", "'fill-in'", ";", "$", "translatorevent", "[", "'interaction_correct_...
Add data specifc to shortanswer question types to a translator event. @param [String => Mixed] $translatorevent @param PHPObj $questionAttempt @param PHPObj $question @return [String => Mixed]
[ "Add", "data", "specifc", "to", "shortanswer", "question", "types", "to", "a", "translator", "event", "." ]
5d196b5059f0f5dcdd98f784ad814a39cd5d736c
https://github.com/LearningLocker/Moodle-xAPI-Translator/blob/5d196b5059f0f5dcdd98f784ad814a39cd5d736c/src/Events/QuestionSubmitted.php#L324-L342
train
LearningLocker/Moodle-xAPI-Translator
src/Events/QuestionSubmitted.php
QuestionSubmitted.matchStatement
public function matchStatement($translatorevent, $questionAttempt, $question) { $translatorevent['interaction_type'] = 'matching'; $targets = []; $sources = []; $correctResponses = []; $responseTargetsPos = []; $responseSourcesPos = []; foreach ($question->match->subquestions as $subquestion) { $target = strip_tags($subquestion->questiontext); $source = strip_tags($subquestion->answertext); $targetId = 'moodle_quiz_question_target_'.$subquestion->id; $sourceId = 'moodle_quiz_question_source_'.$subquestion->id; $targets[$targetId] = $target; $sources[$sourceId] = $source; array_push( $correctResponses, $sourceId.'[.]'.$targetId ); // Get the positions of the target and source within the response string. $responseTargetsPos[strpos($questionAttempt->responsesummary, $target)] = $targetId; $responseSourcesPos[strpos($questionAttempt->responsesummary, $source)] = $sourceId; } // Get ordered and indexed lists of target and source. ksort($responseTargetsPos); $responseTargets = array_values($responseTargetsPos); ksort($responseSourcesPos); $responseSources = array_values($responseSourcesPos); $translatorevent['attempt_response'] = ''; if (count($responseTargets) == count($responseSources) && count($responseTargets) > 0) { $responses = []; foreach ($responseTargets as $index => $targetId) { array_push( $responses, $responseSources[$index].'[.]'.$targetId ); } $translatorevent['attempt_response'] = implode('[,]', $responses); } $translatorevent['interaction_target'] = $targets; $translatorevent['interaction_source'] = $sources; $translatorevent['interaction_correct_responses'] = [implode('[,]', $correctResponses)]; return $translatorevent; }
php
public function matchStatement($translatorevent, $questionAttempt, $question) { $translatorevent['interaction_type'] = 'matching'; $targets = []; $sources = []; $correctResponses = []; $responseTargetsPos = []; $responseSourcesPos = []; foreach ($question->match->subquestions as $subquestion) { $target = strip_tags($subquestion->questiontext); $source = strip_tags($subquestion->answertext); $targetId = 'moodle_quiz_question_target_'.$subquestion->id; $sourceId = 'moodle_quiz_question_source_'.$subquestion->id; $targets[$targetId] = $target; $sources[$sourceId] = $source; array_push( $correctResponses, $sourceId.'[.]'.$targetId ); // Get the positions of the target and source within the response string. $responseTargetsPos[strpos($questionAttempt->responsesummary, $target)] = $targetId; $responseSourcesPos[strpos($questionAttempt->responsesummary, $source)] = $sourceId; } // Get ordered and indexed lists of target and source. ksort($responseTargetsPos); $responseTargets = array_values($responseTargetsPos); ksort($responseSourcesPos); $responseSources = array_values($responseSourcesPos); $translatorevent['attempt_response'] = ''; if (count($responseTargets) == count($responseSources) && count($responseTargets) > 0) { $responses = []; foreach ($responseTargets as $index => $targetId) { array_push( $responses, $responseSources[$index].'[.]'.$targetId ); } $translatorevent['attempt_response'] = implode('[,]', $responses); } $translatorevent['interaction_target'] = $targets; $translatorevent['interaction_source'] = $sources; $translatorevent['interaction_correct_responses'] = [implode('[,]', $correctResponses)]; return $translatorevent; }
[ "public", "function", "matchStatement", "(", "$", "translatorevent", ",", "$", "questionAttempt", ",", "$", "question", ")", "{", "$", "translatorevent", "[", "'interaction_type'", "]", "=", "'matching'", ";", "$", "targets", "=", "[", "]", ";", "$", "source...
Add data specifc to matching question types to a translator event. @param [String => Mixed] $translatorevent @param PHPObj $questionAttempt @param PHPObj $question @return [String => Mixed]
[ "Add", "data", "specifc", "to", "matching", "question", "types", "to", "a", "translator", "event", "." ]
5d196b5059f0f5dcdd98f784ad814a39cd5d736c
https://github.com/LearningLocker/Moodle-xAPI-Translator/blob/5d196b5059f0f5dcdd98f784ad814a39cd5d736c/src/Events/QuestionSubmitted.php#L351-L401
train