repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
mothership-ec/composer
src/Composer/Plugin/PluginManager.php
PluginManager.lookupInstalledPackage
protected function lookupInstalledPackage(Pool $pool, Link $link) { $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint()); return (!empty($packages)) ? $packages[0] : null; }
php
protected function lookupInstalledPackage(Pool $pool, Link $link) { $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint()); return (!empty($packages)) ? $packages[0] : null; }
[ "protected", "function", "lookupInstalledPackage", "(", "Pool", "$", "pool", ",", "Link", "$", "link", ")", "{", "$", "packages", "=", "$", "pool", "->", "whatProvides", "(", "$", "link", "->", "getTarget", "(", ")", ",", "$", "link", "->", "getConstrain...
Resolves a package link to a package in the installed pool Since dependencies are already installed this should always find one. @param Pool $pool Pool of installed packages only @param Link $link Package link to look up @return PackageInterface|null The found package
[ "Resolves", "a", "package", "link", "to", "a", "package", "in", "the", "installed", "pool" ]
train
https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Plugin/PluginManager.php#L187-L192
mothership-ec/composer
src/Composer/Plugin/PluginManager.php
PluginManager.registerPackage
public function registerPackage(PackageInterface $package, $failOnMissingClasses = false) { $oldInstallerPlugin = ($package->getType() === 'composer-installer'); if (in_array($package->getName(), $this->registeredPlugins)) { return; } $extra = $package->getExtra(); ...
php
public function registerPackage(PackageInterface $package, $failOnMissingClasses = false) { $oldInstallerPlugin = ($package->getType() === 'composer-installer'); if (in_array($package->getName(), $this->registeredPlugins)) { return; } $extra = $package->getExtra(); ...
[ "public", "function", "registerPackage", "(", "PackageInterface", "$", "package", ",", "$", "failOnMissingClasses", "=", "false", ")", "{", "$", "oldInstallerPlugin", "=", "(", "$", "package", "->", "getType", "(", ")", "===", "'composer-installer'", ")", ";", ...
Register a plugin package, activate it etc. If it's of type composer-installer it is registered as an installer instead for BC @param PackageInterface $package @param bool $failOnMissingClasses By default this silently skips plugins that can not be found, but if set to true it fails with an exception @th...
[ "Register", "a", "plugin", "package", "activate", "it", "etc", "." ]
train
https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Plugin/PluginManager.php#L205-L262
zhouyl/mellivora
Mellivora/Database/Query/Builder.php
Builder.prepareValueAndOperator
protected function prepareValueAndOperator($value, $operator, $useDefault = false) { if ($useDefault) { return [$operator, '=']; } if ($this->invalidOperatorAndValue($operator, $value)) { throw new InvalidArgumentException('Illegal operator and value combination.'); ...
php
protected function prepareValueAndOperator($value, $operator, $useDefault = false) { if ($useDefault) { return [$operator, '=']; } if ($this->invalidOperatorAndValue($operator, $value)) { throw new InvalidArgumentException('Illegal operator and value combination.'); ...
[ "protected", "function", "prepareValueAndOperator", "(", "$", "value", ",", "$", "operator", ",", "$", "useDefault", "=", "false", ")", "{", "if", "(", "$", "useDefault", ")", "{", "return", "[", "$", "operator", ",", "'='", "]", ";", "}", "if", "(", ...
Prepare the value and operator for a where clause. @param string $value @param string $operator @param bool $useDefault @throws \InvalidArgumentException @return array
[ "Prepare", "the", "value", "and", "operator", "for", "a", "where", "clause", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Builder.php#L632-L642
zhouyl/mellivora
Mellivora/Database/Query/Builder.php
Builder.whereColumn
public function whereColumn($first, $operator = null, $second = null, $boolean = 'and') { // If the column is an array, we will assume it is an array of key-value pairs // and can add them each as a where clause. We will maintain the boolean we // received when the method was called and pass...
php
public function whereColumn($first, $operator = null, $second = null, $boolean = 'and') { // If the column is an array, we will assume it is an array of key-value pairs // and can add them each as a where clause. We will maintain the boolean we // received when the method was called and pass...
[ "public", "function", "whereColumn", "(", "$", "first", ",", "$", "operator", "=", "null", ",", "$", "second", "=", "null", ",", "$", "boolean", "=", "'and'", ")", "{", "// If the column is an array, we will assume it is an array of key-value pairs", "// and can add t...
Add a "where" clause comparing two columns to the query. @param array|string $first @param null|string $operator @param null|string $second @param null|string $boolean @return \Mellivora\Database\Query\Builder|static
[ "Add", "a", "where", "clause", "comparing", "two", "columns", "to", "the", "query", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Builder.php#L697-L727
zhouyl/mellivora
Mellivora/Database/Query/Builder.php
Builder.whereIn
public function whereIn($column, $values, $boolean = 'and', $not = false) { $type = $not ? 'NotIn' : 'In'; // If the value is a query builder instance we will assume the developer wants to // look for any values that exists within this given query. So we will add the // query accord...
php
public function whereIn($column, $values, $boolean = 'and', $not = false) { $type = $not ? 'NotIn' : 'In'; // If the value is a query builder instance we will assume the developer wants to // look for any values that exists within this given query. So we will add the // query accord...
[ "public", "function", "whereIn", "(", "$", "column", ",", "$", "values", ",", "$", "boolean", "=", "'and'", ",", "$", "not", "=", "false", ")", "{", "$", "type", "=", "$", "not", "?", "'NotIn'", ":", "'In'", ";", "// If the value is a query builder insta...
Add a "where in" clause to the query. @param string $column @param mixed $values @param string $boolean @param bool $not @return $this
[ "Add", "a", "where", "in", "clause", "to", "the", "query", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Builder.php#L784-L826
zhouyl/mellivora
Mellivora/Database/Query/Builder.php
Builder.whereDate
public function whereDate($column, $operator, $value = null, $boolean = 'and') { list($value, $operator) = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); return $this->addDateBasedWhere('Date', $column, $operator, $value, $boo...
php
public function whereDate($column, $operator, $value = null, $boolean = 'and') { list($value, $operator) = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); return $this->addDateBasedWhere('Date', $column, $operator, $value, $boo...
[ "public", "function", "whereDate", "(", "$", "column", ",", "$", "operator", ",", "$", "value", "=", "null", ",", "$", "boolean", "=", "'and'", ")", "{", "list", "(", "$", "value", ",", "$", "operator", ")", "=", "$", "this", "->", "prepareValueAndOp...
Add a "where date" statement to the query. @param string $column @param string $operator @param mixed $value @param string $boolean @return \Mellivora\Database\Query\Builder|static
[ "Add", "a", "where", "date", "statement", "to", "the", "query", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Builder.php#L1041-L1050
zhouyl/mellivora
Mellivora/Database/Query/Builder.php
Builder.groupBy
public function groupBy(...$groups) { foreach ($groups as $group) { $this->groups = array_merge( (array) $this->groups, array_wrap($group) ); } return $this; }
php
public function groupBy(...$groups) { foreach ($groups as $group) { $this->groups = array_merge( (array) $this->groups, array_wrap($group) ); } return $this; }
[ "public", "function", "groupBy", "(", "...", "$", "groups", ")", "{", "foreach", "(", "$", "groups", "as", "$", "group", ")", "{", "$", "this", "->", "groups", "=", "array_merge", "(", "(", "array", ")", "$", "this", "->", "groups", ",", "array_wrap"...
Add a "group by" clause to the query. @param array ...$groups @return $this
[ "Add", "a", "group", "by", "clause", "to", "the", "query", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Builder.php#L1409-L1419
zhouyl/mellivora
Mellivora/Database/Query/Builder.php
Builder.limit
public function limit($value) { $property = $this->unions ? 'unionLimit' : 'limit'; if ($value >= 0) { $this->{$property} = $value; } return $this; }
php
public function limit($value) { $property = $this->unions ? 'unionLimit' : 'limit'; if ($value >= 0) { $this->{$property} = $value; } return $this; }
[ "public", "function", "limit", "(", "$", "value", ")", "{", "$", "property", "=", "$", "this", "->", "unions", "?", "'unionLimit'", ":", "'limit'", ";", "if", "(", "$", "value", ">=", "0", ")", "{", "$", "this", "->", "{", "$", "property", "}", "...
Set the "limit" value of the query. @param int $value @return $this
[ "Set", "the", "limit", "value", "of", "the", "query", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Builder.php#L1627-L1636
zhouyl/mellivora
Mellivora/Database/Query/Builder.php
Builder.get
public function get($columns = ['*']) { $original = $this->columns; if (is_null($original)) { $this->columns = $columns; } $results = $this->processor->processSelect($this, $this->runSelect()); $this->columns = $original; return collect($results); ...
php
public function get($columns = ['*']) { $original = $this->columns; if (is_null($original)) { $this->columns = $columns; } $results = $this->processor->processSelect($this, $this->runSelect()); $this->columns = $original; return collect($results); ...
[ "public", "function", "get", "(", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "original", "=", "$", "this", "->", "columns", ";", "if", "(", "is_null", "(", "$", "original", ")", ")", "{", "$", "this", "->", "columns", "=", "$", "columns...
Execute the query as a "select" statement. @param array $columns @return \Mellivora\Support\Collection
[ "Execute", "the", "query", "as", "a", "select", "statement", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Builder.php#L1811-L1824
zhouyl/mellivora
Mellivora/Database/Query/Builder.php
Builder.getCountForPagination
public function getCountForPagination($columns = ['*']) { $results = $this->runPaginationCountQuery($columns); // Once we have run the pagination count query, we will get the resulting count and // take into account what type of query it was. When there is a group by we will // just...
php
public function getCountForPagination($columns = ['*']) { $results = $this->runPaginationCountQuery($columns); // Once we have run the pagination count query, we will get the resulting count and // take into account what type of query it was. When there is a group by we will // just...
[ "public", "function", "getCountForPagination", "(", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "results", "=", "$", "this", "->", "runPaginationCountQuery", "(", "$", "columns", ")", ";", "// Once we have run the pagination count query, we will get the resul...
Get the count of the total records for the paginator. @param array $columns @return int
[ "Get", "the", "count", "of", "the", "total", "records", "for", "the", "paginator", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Builder.php#L1895-L1913
zhouyl/mellivora
Mellivora/Database/Query/Builder.php
Builder.runPaginationCountQuery
protected function runPaginationCountQuery($columns = ['*']) { return $this->cloneWithout(['columns', 'orders', 'limit', 'offset']) ->cloneWithoutBindings(['select', 'order']) ->setAggregate('count', $this->withoutSelectAliases($columns)) ->get()->all(); }
php
protected function runPaginationCountQuery($columns = ['*']) { return $this->cloneWithout(['columns', 'orders', 'limit', 'offset']) ->cloneWithoutBindings(['select', 'order']) ->setAggregate('count', $this->withoutSelectAliases($columns)) ->get()->all(); }
[ "protected", "function", "runPaginationCountQuery", "(", "$", "columns", "=", "[", "'*'", "]", ")", "{", "return", "$", "this", "->", "cloneWithout", "(", "[", "'columns'", ",", "'orders'", ",", "'limit'", ",", "'offset'", "]", ")", "->", "cloneWithoutBindin...
Run a pagiantion count query. @param array $columns @return array
[ "Run", "a", "pagiantion", "count", "query", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Builder.php#L1922-L1928
zhouyl/mellivora
Mellivora/Database/Query/Builder.php
Builder.aggregate
public function aggregate($function, $columns = ['*']) { $results = $this->cloneWithout(['columns']) ->cloneWithoutBindings(['select']) ->setAggregate($function, $columns) ->get($columns); if (!$results->isEmpty()) { return array_change_key_case((arra...
php
public function aggregate($function, $columns = ['*']) { $results = $this->cloneWithout(['columns']) ->cloneWithoutBindings(['select']) ->setAggregate($function, $columns) ->get($columns); if (!$results->isEmpty()) { return array_change_key_case((arra...
[ "public", "function", "aggregate", "(", "$", "function", ",", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "results", "=", "$", "this", "->", "cloneWithout", "(", "[", "'columns'", "]", ")", "->", "cloneWithoutBindings", "(", "[", "'select'", "...
Execute an aggregate function on the database. @param string $function @param array $columns @return mixed
[ "Execute", "an", "aggregate", "function", "on", "the", "database", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Builder.php#L2231-L2241
zhouyl/mellivora
Mellivora/Database/Query/Builder.php
Builder.cloneWithout
public function cloneWithout(array $except) { return tap(clone $this, function ($clone) use ($except) { foreach ($except as $property) { $clone->{$property} = null; } }); }
php
public function cloneWithout(array $except) { return tap(clone $this, function ($clone) use ($except) { foreach ($except as $property) { $clone->{$property} = null; } }); }
[ "public", "function", "cloneWithout", "(", "array", "$", "except", ")", "{", "return", "tap", "(", "clone", "$", "this", ",", "function", "(", "$", "clone", ")", "use", "(", "$", "except", ")", "{", "foreach", "(", "$", "except", "as", "$", "property...
Clone the query without the given properties. @param array $except @return static
[ "Clone", "the", "query", "without", "the", "given", "properties", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Builder.php#L2621-L2628
surebert/surebert-framework
src/sb/Ebook/Epub/OPF.php
OPF.addToSpine
public function addToSpine($idref, $linear = 'yes') { $itemref = $this->spine->appendChild($this->createElement('itemref')); $itemref->setAttribute('idref', $idref); $itemref->setAttribute('linear', 'yes'); return $itemref; }
php
public function addToSpine($idref, $linear = 'yes') { $itemref = $this->spine->appendChild($this->createElement('itemref')); $itemref->setAttribute('idref', $idref); $itemref->setAttribute('linear', 'yes'); return $itemref; }
[ "public", "function", "addToSpine", "(", "$", "idref", ",", "$", "linear", "=", "'yes'", ")", "{", "$", "itemref", "=", "$", "this", "->", "spine", "->", "appendChild", "(", "$", "this", "->", "createElement", "(", "'itemref'", ")", ")", ";", "$", "i...
The item id e.g. a chapter id @param string $idref @param string $linear
[ "The", "item", "id", "e", ".", "g", ".", "a", "chapter", "id" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Ebook/Epub/OPF.php#L89-L96
surebert/surebert-framework
src/sb/Ebook/Epub/OPF.php
OPF.setRelation
public function setRelation($relation) { $this->relation = $this->metadata->appendChild($this->createElement('dc:relation')); $txt = $this->createTextNode($relation); $this->relation->appendChild($txt); return $txt; }
php
public function setRelation($relation) { $this->relation = $this->metadata->appendChild($this->createElement('dc:relation')); $txt = $this->createTextNode($relation); $this->relation->appendChild($txt); return $txt; }
[ "public", "function", "setRelation", "(", "$", "relation", ")", "{", "$", "this", "->", "relation", "=", "$", "this", "->", "metadata", "->", "appendChild", "(", "$", "this", "->", "createElement", "(", "'dc:relation'", ")", ")", ";", "$", "txt", "=", ...
publisher URL
[ "publisher", "URL" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Ebook/Epub/OPF.php#L144-L151
surebert/surebert-framework
src/sb/Ebook/Epub/OPF.php
OPF.setAuthor
public function setAuthor($author, $sort_key = '') { $this->creator = $this->metadata->appendChild($this->createElement('dc:creator')); $this->creator->setAttribute('opf:role', "aut"); $txt = $this->createTextNode($author); $this->creator->appendChild($txt); if ($sort_key) { ...
php
public function setAuthor($author, $sort_key = '') { $this->creator = $this->metadata->appendChild($this->createElement('dc:creator')); $this->creator->setAttribute('opf:role', "aut"); $txt = $this->createTextNode($author); $this->creator->appendChild($txt); if ($sort_key) { ...
[ "public", "function", "setAuthor", "(", "$", "author", ",", "$", "sort_key", "=", "''", ")", "{", "$", "this", "->", "creator", "=", "$", "this", "->", "metadata", "->", "appendChild", "(", "$", "this", "->", "createElement", "(", "'dc:creator'", ")", ...
Book author or creator, optional. . @param string $author Used for the dc:creator metadata parameter in the OPF file @param string $sort_key is basically how the name is to be sorted, usually it's "Lastname, First names" where the $author is the straight "Firstnames Lastname"
[ "Book", "author", "or", "creator", "optional", ".", "." ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Ebook/Epub/OPF.php#L182-L191
thecodingmachine/interop.silex.di
src/Mouf/Interop/Silex/Application.php
Application.offsetGet
public function offsetGet($id) { if ($this->rootContainer) { try { return $this->rootContainer->get($id); } catch (NotFoundException $ex) { // Fallback to pimple if offsetGet fails. return $this->pimpleContainer[$id]; } } else { return $this->pimpleContainer[$id]; } }
php
public function offsetGet($id) { if ($this->rootContainer) { try { return $this->rootContainer->get($id); } catch (NotFoundException $ex) { // Fallback to pimple if offsetGet fails. return $this->pimpleContainer[$id]; } } else { return $this->pimpleContainer[$id]; } }
[ "public", "function", "offsetGet", "(", "$", "id", ")", "{", "if", "(", "$", "this", "->", "rootContainer", ")", "{", "try", "{", "return", "$", "this", "->", "rootContainer", "->", "get", "(", "$", "id", ")", ";", "}", "catch", "(", "NotFoundExcepti...
Gets a parameter or an object, first from the root container, then from Pimple if nothing is found in root container. It is expected that the root container will be a composite container with Pimple being part of it, therefore, the fallback to Pimple is just here by security. @param string $id The unique identifier fo...
[ "Gets", "a", "parameter", "or", "an", "object", "first", "from", "the", "root", "container", "then", "from", "Pimple", "if", "nothing", "is", "found", "in", "root", "container", ".", "It", "is", "expected", "that", "the", "root", "container", "will", "be",...
train
https://github.com/thecodingmachine/interop.silex.di/blob/14f7682bf9db3f4aab50d6f1c216df405b8aaa6d/src/Mouf/Interop/Silex/Application.php#L66-L78
thecodingmachine/interop.silex.di
src/Mouf/Interop/Silex/Application.php
Application.offsetExists
public function offsetExists($id) { if ($this->rootContainer) { try { return $this->rootContainer->has($id); } catch (NotFoundException $ex) { // Fallback to pimple if offsetExists fails. return $this->pimpleContainer->offsetExists($id); } } else { return $this->pimpleContainer->offsetExist...
php
public function offsetExists($id) { if ($this->rootContainer) { try { return $this->rootContainer->has($id); } catch (NotFoundException $ex) { // Fallback to pimple if offsetExists fails. return $this->pimpleContainer->offsetExists($id); } } else { return $this->pimpleContainer->offsetExist...
[ "public", "function", "offsetExists", "(", "$", "id", ")", "{", "if", "(", "$", "this", "->", "rootContainer", ")", "{", "try", "{", "return", "$", "this", "->", "rootContainer", "->", "has", "(", "$", "id", ")", ";", "}", "catch", "(", "NotFoundExce...
Check existence of a parameter or an object, first in the root container, then in Pimple if nothing is found in root container. It is expected that the root container will be a composite container with Pimple being part of it, therefore, the fallback to Pimple is just here by security. @param string $id The unique ide...
[ "Check", "existence", "of", "a", "parameter", "or", "an", "object", "first", "in", "the", "root", "container", "then", "in", "Pimple", "if", "nothing", "is", "found", "in", "root", "container", ".", "It", "is", "expected", "that", "the", "root", "container...
train
https://github.com/thecodingmachine/interop.silex.di/blob/14f7682bf9db3f4aab50d6f1c216df405b8aaa6d/src/Mouf/Interop/Silex/Application.php#L100-L112
xiewulong/yii2-fileupload
oss/libs/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php
DebugClassLoader.loadClass
public function loadClass($class) { if ($file = $this->classFinder->findFile($class)) { require $file; if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) { if (false !== strpos($...
php
public function loadClass($class) { if ($file = $this->classFinder->findFile($class)) { require $file; if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) { if (false !== strpos($...
[ "public", "function", "loadClass", "(", "$", "class", ")", "{", "if", "(", "$", "file", "=", "$", "this", "->", "classFinder", "->", "findFile", "(", "$", "class", ")", ")", "{", "require", "$", "file", ";", "if", "(", "!", "class_exists", "(", "$"...
Loads the given class or interface. @param string $class The name of the class @return Boolean|null True, if loaded @throws \RuntimeException
[ "Loads", "the", "given", "class", "or", "interface", "." ]
train
https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php#L93-L108
SporkCode/Spork
src/View/Helper/GoogleAnalytic.php
GoogleAnalytic.createService
public function createService(ServiceLocatorInterface $viewHelperManager) { $serviceLocator = $viewHelperManager->getServiceLocator(); $config = $serviceLocator->has('config') ? $serviceLocator->get('config') : array(); if (isset($config['google_analytics'])) { $this->config($con...
php
public function createService(ServiceLocatorInterface $viewHelperManager) { $serviceLocator = $viewHelperManager->getServiceLocator(); $config = $serviceLocator->has('config') ? $serviceLocator->get('config') : array(); if (isset($config['google_analytics'])) { $this->config($con...
[ "public", "function", "createService", "(", "ServiceLocatorInterface", "$", "viewHelperManager", ")", "{", "$", "serviceLocator", "=", "$", "viewHelperManager", "->", "getServiceLocator", "(", ")", ";", "$", "config", "=", "$", "serviceLocator", "->", "has", "(", ...
Create and configure helper instance @see \Zend\ServiceManager\FactoryInterface::createService() @param ServiceLocatorInterface $viewHelperManager @return \Spork\View\Helper\GoogleAnalytic
[ "Create", "and", "configure", "helper", "instance" ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/GoogleAnalytic.php#L45-L54
SporkCode/Spork
src/View/Helper/GoogleAnalytic.php
GoogleAnalytic.config
public function config(array $options) { foreach ($options as $key => $value) { $method = 'set' . $key; if (method_exists($this, $method)) { call_user_func(array($this, $method), $value); } } }
php
public function config(array $options) { foreach ($options as $key => $value) { $method = 'set' . $key; if (method_exists($this, $method)) { call_user_func(array($this, $method), $value); } } }
[ "public", "function", "config", "(", "array", "$", "options", ")", "{", "foreach", "(", "$", "options", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "method", "=", "'set'", ".", "$", "key", ";", "if", "(", "method_exists", "(", "$", "this",...
Configure helper @param array $options
[ "Configure", "helper" ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/GoogleAnalytic.php#L81-L89
SporkCode/Spork
src/View/Helper/GoogleAnalytic.php
GoogleAnalytic.initialize
public function initialize() { if (true == $this->initialized) { return; } $this->initialized = true; if (null !== $this->trackingId) { $trackerId = $this->trackingId; $inlineScript = $this->getView()->plugin('inlineScript'); $...
php
public function initialize() { if (true == $this->initialized) { return; } $this->initialized = true; if (null !== $this->trackingId) { $trackerId = $this->trackingId; $inlineScript = $this->getView()->plugin('inlineScript'); $...
[ "public", "function", "initialize", "(", ")", "{", "if", "(", "true", "==", "$", "this", "->", "initialized", ")", "{", "return", ";", "}", "$", "this", "->", "initialized", "=", "true", ";", "if", "(", "null", "!==", "$", "this", "->", "trackingId",...
Inject Google Analytics tracker code into InlineScript helper. This should only be called once after the helper is completely configured.
[ "Inject", "Google", "Analytics", "tracker", "code", "into", "InlineScript", "helper", ".", "This", "should", "only", "be", "called", "once", "after", "the", "helper", "is", "completely", "configured", "." ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/GoogleAnalytic.php#L95-L115
zhouyl/mellivora
Mellivora/Cache/MemcachedConnector.php
MemcachedConnector.getCacheAdapter
public function getCacheAdapter() { $client = MemcachedAdapter::createConnection( $this->config['servers'], $this->config['options'] ); return new MemcachedAdapter( $client, $this->config['namespace'], $this->config['lifetime'] ...
php
public function getCacheAdapter() { $client = MemcachedAdapter::createConnection( $this->config['servers'], $this->config['options'] ); return new MemcachedAdapter( $client, $this->config['namespace'], $this->config['lifetime'] ...
[ "public", "function", "getCacheAdapter", "(", ")", "{", "$", "client", "=", "MemcachedAdapter", "::", "createConnection", "(", "$", "this", "->", "config", "[", "'servers'", "]", ",", "$", "this", "->", "config", "[", "'options'", "]", ")", ";", "return", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Cache/MemcachedConnector.php#L35-L47
zhouyl/mellivora
Mellivora/Cache/MemcachedConnector.php
MemcachedConnector.getSimpleCacheAdapter
public function getSimpleCacheAdapter() { $client = MemcachedCache::createConnection( $this->config['servers'], $this->config['options'] ); return new MemcachedCache( $client, $this->config['namespace'], $this->config['lifetime'] ...
php
public function getSimpleCacheAdapter() { $client = MemcachedCache::createConnection( $this->config['servers'], $this->config['options'] ); return new MemcachedCache( $client, $this->config['namespace'], $this->config['lifetime'] ...
[ "public", "function", "getSimpleCacheAdapter", "(", ")", "{", "$", "client", "=", "MemcachedCache", "::", "createConnection", "(", "$", "this", "->", "config", "[", "'servers'", "]", ",", "$", "this", "->", "config", "[", "'options'", "]", ")", ";", "retur...
{@inheritdoc}
[ "{" ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Cache/MemcachedConnector.php#L52-L64
dave-redfern/somnambulist-value-objects
src/Types/DateTime/Traits/Factory.php
Factory.now
public static function now($tz = null) { return static::parse('now', TimeZone::create(($tz instanceof TimeZone ? (string)$tz : $tz))); }
php
public static function now($tz = null) { return static::parse('now', TimeZone::create(($tz instanceof TimeZone ? (string)$tz : $tz))); }
[ "public", "static", "function", "now", "(", "$", "tz", "=", "null", ")", "{", "return", "static", "::", "parse", "(", "'now'", ",", "TimeZone", "::", "create", "(", "(", "$", "tz", "instanceof", "TimeZone", "?", "(", "string", ")", "$", "tz", ":", ...
@param null|string $tz @return DateTime
[ "@param", "null|string", "$tz" ]
train
https://github.com/dave-redfern/somnambulist-value-objects/blob/dbae7fea7140b36e105ed3f5e21a42316ea3061f/src/Types/DateTime/Traits/Factory.php#L39-L42
dave-redfern/somnambulist-value-objects
src/Types/DateTime/Traits/Factory.php
Factory.create
public static function create($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, TimeZone $tz = null) { [$nowYear, $nowMonth, $nowDay, $nowHour, $nowMin, $nowSec] = explode('-', date('Y-n-j-G-i-s', time())); $year = $year ?? $nowYear; $month =...
php
public static function create($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, TimeZone $tz = null) { [$nowYear, $nowMonth, $nowDay, $nowHour, $nowMin, $nowSec] = explode('-', date('Y-n-j-G-i-s', time())); $year = $year ?? $nowYear; $month =...
[ "public", "static", "function", "create", "(", "$", "year", "=", "null", ",", "$", "month", "=", "null", ",", "$", "day", "=", "null", ",", "$", "hour", "=", "null", ",", "$", "minute", "=", "null", ",", "$", "second", "=", "null", ",", "TimeZone...
Create a DateTime instance Based on Carbon::create with the following differences: * if you require an hour, you must specify minutes and seconds as 0 (zero) * TimeZone should be specified using the value object @param null|int $year @param null|int $month @param null|int $day @param null|int $hou...
[ "Create", "a", "DateTime", "instance" ]
train
https://github.com/dave-redfern/somnambulist-value-objects/blob/dbae7fea7140b36e105ed3f5e21a42316ea3061f/src/Types/DateTime/Traits/Factory.php#L74-L92
dave-redfern/somnambulist-value-objects
src/Types/DateTime/Traits/Factory.php
Factory.createFromFormat
public static function createFromFormat($format, $time, $object = null) { if ($object !== null) { $dt = parent::createFromFormat($format, $time, $object); } else { $dt = parent::createFromFormat($format, $time); } $lastErrors = parent::getLastErrors(); ...
php
public static function createFromFormat($format, $time, $object = null) { if ($object !== null) { $dt = parent::createFromFormat($format, $time, $object); } else { $dt = parent::createFromFormat($format, $time); } $lastErrors = parent::getLastErrors(); ...
[ "public", "static", "function", "createFromFormat", "(", "$", "format", ",", "$", "time", ",", "$", "object", "=", "null", ")", "{", "if", "(", "$", "object", "!==", "null", ")", "{", "$", "dt", "=", "parent", "::", "createFromFormat", "(", "$", "for...
@param string $format @param string $time @param null|DateTimeZone $object @return DateTime
[ "@param", "string", "$format", "@param", "string", "$time", "@param", "null|DateTimeZone", "$object" ]
train
https://github.com/dave-redfern/somnambulist-value-objects/blob/dbae7fea7140b36e105ed3f5e21a42316ea3061f/src/Types/DateTime/Traits/Factory.php#L131-L146
GrupaZero/api
src/Gzero/Api/Transformer/AbstractTransformer.php
AbstractTransformer.entityToArray
protected function entityToArray($class, $object) { if (is_object($object) && get_class($object) == $class) { $object = $object->toArray(); } return $object; }
php
protected function entityToArray($class, $object) { if (is_object($object) && get_class($object) == $class) { $object = $object->toArray(); } return $object; }
[ "protected", "function", "entityToArray", "(", "$", "class", ",", "$", "object", ")", "{", "if", "(", "is_object", "(", "$", "object", ")", "&&", "get_class", "(", "$", "object", ")", "==", "$", "class", ")", "{", "$", "object", "=", "$", "object", ...
Return entity transformed to array @param string $class Entity class @param mixed $object Entity object or array @return array
[ "Return", "entity", "transformed", "to", "array" ]
train
https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Transformer/AbstractTransformer.php#L27-L33
surebert/surebert-framework
src/sb/Event.php
Event.getArg
public function getArg($key='') { if(isset($this->args[$key])){ return $this->args[$key]; } else { return null; } }
php
public function getArg($key='') { if(isset($this->args[$key])){ return $this->args[$key]; } else { return null; } }
[ "public", "function", "getArg", "(", "$", "key", "=", "''", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "args", "[", "$", "key", "]", ")", ")", "{", "return", "$", "this", "->", "args", "[", "$", "key", "]", ";", "}", "else", "{", ...
Gets the event _args value for a specific key if passed @param string $key the specific key to fetch @return mixed Whatever value the key holds or the full array if no key is specified
[ "Gets", "the", "event", "_args", "value", "for", "a", "specific", "key", "if", "passed" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Event.php#L108-L116
hanamura/wp-model
src/WPModel/User.php
User._initUser
protected function _initUser() { if (!isset($this->_user) && $this->_id) { $this->_user = get_user_by('id', $this->_id); } }
php
protected function _initUser() { if (!isset($this->_user) && $this->_id) { $this->_user = get_user_by('id', $this->_id); } }
[ "protected", "function", "_initUser", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_user", ")", "&&", "$", "this", "->", "_id", ")", "{", "$", "this", "->", "_user", "=", "get_user_by", "(", "'id'", ",", "$", "this", "->", "_i...
init user
[ "init", "user" ]
train
https://github.com/hanamura/wp-model/blob/69925d1c2072e6e78a0b36b5e84d270839cc7419/src/WPModel/User.php#L85-L90
hanamura/wp-model
src/WPModel/User.php
User._meta
protected function _meta() { if (!isset($this->_meta)) { $this->_meta = new UserMeta($this->id); } return $this->_meta; }
php
protected function _meta() { if (!isset($this->_meta)) { $this->_meta = new UserMeta($this->id); } return $this->_meta; }
[ "protected", "function", "_meta", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_meta", ")", ")", "{", "$", "this", "->", "_meta", "=", "new", "UserMeta", "(", "$", "this", "->", "id", ")", ";", "}", "return", "$", "this", "-...
method properties
[ "method", "properties" ]
train
https://github.com/hanamura/wp-model/blob/69925d1c2072e6e78a0b36b5e84d270839cc7419/src/WPModel/User.php#L95-L101
Daursu/xero
src/Daursu/Xero/lib/XeroOAuth.php
XeroOAuth.curlit
private function curlit() { $this->request_params = array(); // configure curl $c = curl_init (); $useragent = (isset ( $this->config ['user_agent'] )) ? (empty ( $this->config ['user_agent'] ) ? 'XeroOAuth-PHP' : $this->config ['user_agent']) : 'XeroOAuth-PHP'; curl_setopt_array ( $c, array ( CURLOPT_U...
php
private function curlit() { $this->request_params = array(); // configure curl $c = curl_init (); $useragent = (isset ( $this->config ['user_agent'] )) ? (empty ( $this->config ['user_agent'] ) ? 'XeroOAuth-PHP' : $this->config ['user_agent']) : 'XeroOAuth-PHP'; curl_setopt_array ( $c, array ( CURLOPT_U...
[ "private", "function", "curlit", "(", ")", "{", "$", "this", "->", "request_params", "=", "array", "(", ")", ";", "// configure curl", "$", "c", "=", "curl_init", "(", ")", ";", "$", "useragent", "=", "(", "isset", "(", "$", "this", "->", "config", "...
Makes a curl request. Takes no parameters as all should have been prepared by the request method @return void response data is stored in the class variable 'response'
[ "Makes", "a", "curl", "request", ".", "Takes", "no", "parameters", "as", "all", "should", "have", "been", "prepared", "by", "the", "request", "method" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/lib/XeroOAuth.php#L238-L372
Daursu/xero
src/Daursu/Xero/lib/XeroOAuth.php
XeroOAuth.request
function request($method, $url, $params = array(), $xml = "", $format = 'xml') { // removed these as function parameters for now $useauth = true; $multipart = false; if (isset ( $format )) { switch ($format) { case "pdf" : $this->headers ['Accept'] = 'application/pdf'; break; case "json" :...
php
function request($method, $url, $params = array(), $xml = "", $format = 'xml') { // removed these as function parameters for now $useauth = true; $multipart = false; if (isset ( $format )) { switch ($format) { case "pdf" : $this->headers ['Accept'] = 'application/pdf'; break; case "json" :...
[ "function", "request", "(", "$", "method", ",", "$", "url", ",", "$", "params", "=", "array", "(", ")", ",", "$", "xml", "=", "\"\"", ",", "$", "format", "=", "'xml'", ")", "{", "// removed these as function parameters for now", "$", "useauth", "=", "tru...
Make an HTTP request using this library. This method doesn't return anything. Instead the response should be inspected directly. @param string $method the HTTP method being used. e.g. POST, GET, HEAD etc @param string $url the request URL without query string parameters @param array $params the request parameters as a...
[ "Make", "an", "HTTP", "request", "using", "this", "library", ".", "This", "method", "doesn", "t", "return", "anything", ".", "Instead", "the", "response", "should", "be", "inspected", "directly", "." ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/lib/XeroOAuth.php#L402-L477
Daursu/xero
src/Daursu/Xero/lib/XeroOAuth.php
XeroOAuth.parseResponse
function parseResponse($response, $format) { if (isset ( $format )) { switch ($format) { case "pdf" : $theResponse = $response; break; case "json" : $theResponse = json_decode ( $response, true ); break; default : $theResponse = simplexml_load_string ( $response ); break; ...
php
function parseResponse($response, $format) { if (isset ( $format )) { switch ($format) { case "pdf" : $theResponse = $response; break; case "json" : $theResponse = json_decode ( $response, true ); break; default : $theResponse = simplexml_load_string ( $response ); break; ...
[ "function", "parseResponse", "(", "$", "response", ",", "$", "format", ")", "{", "if", "(", "isset", "(", "$", "format", ")", ")", "{", "switch", "(", "$", "format", ")", "{", "case", "\"pdf\"", ":", "$", "theResponse", "=", "$", "response", ";", "...
Convert the response into usable data @param string $response the raw response from the API @param string $format the format of the response @return string the concatenation of the host, API version and API method
[ "Convert", "the", "response", "into", "usable", "data" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/lib/XeroOAuth.php#L488-L503
Daursu/xero
src/Daursu/Xero/lib/XeroOAuth.php
XeroOAuth.url
function url($request, $api = "core") { if ($request == "RequestToken") { $this->config ['host'] = $this->config ['site'] . '/oauth/'; } elseif ($request == "Authorize") { $this->config ['host'] = $this->config ['authorize_url']; $request = ""; } elseif ($request == "AccessToken") { $this->config ['ho...
php
function url($request, $api = "core") { if ($request == "RequestToken") { $this->config ['host'] = $this->config ['site'] . '/oauth/'; } elseif ($request == "Authorize") { $this->config ['host'] = $this->config ['authorize_url']; $request = ""; } elseif ($request == "AccessToken") { $this->config ['ho...
[ "function", "url", "(", "$", "request", ",", "$", "api", "=", "\"core\"", ")", "{", "if", "(", "$", "request", "==", "\"RequestToken\"", ")", "{", "$", "this", "->", "config", "[", "'host'", "]", "=", "$", "this", "->", "config", "[", "'site'", "]"...
Utility function to create the request URL in the requested format @param string $request the API method without extension @return string the concatenation of the host, API version and API method
[ "Utility", "function", "to", "create", "the", "request", "URL", "in", "the", "requested", "format" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/lib/XeroOAuth.php#L512-L538
Daursu/xero
src/Daursu/Xero/lib/XeroOAuth.php
XeroOAuth.php_self
public static function php_self($dropqs = true) { $url = sprintf ( '%s://%s%s', empty ( $_SERVER ['HTTPS'] ) ? (@$_SERVER ['SERVER_PORT'] == '443' ? 'https' : 'http') : 'http', $_SERVER ['SERVER_NAME'], $_SERVER ['REQUEST_URI'] ); $parts = parse_url ( $url ); $port = $_SERVER ['SERVER_PORT']; $scheme = $parts...
php
public static function php_self($dropqs = true) { $url = sprintf ( '%s://%s%s', empty ( $_SERVER ['HTTPS'] ) ? (@$_SERVER ['SERVER_PORT'] == '443' ? 'https' : 'http') : 'http', $_SERVER ['SERVER_NAME'], $_SERVER ['REQUEST_URI'] ); $parts = parse_url ( $url ); $port = $_SERVER ['SERVER_PORT']; $scheme = $parts...
[ "public", "static", "function", "php_self", "(", "$", "dropqs", "=", "true", ")", "{", "$", "url", "=", "sprintf", "(", "'%s://%s%s'", ",", "empty", "(", "$", "_SERVER", "[", "'HTTPS'", "]", ")", "?", "(", "@", "$", "_SERVER", "[", "'SERVER_PORT'", "...
Returns the current URL. This is instead of PHP_SELF which is unsafe @param bool $dropqs whether to drop the querystring or not. Default true @return string the current URL
[ "Returns", "the", "current", "URL", ".", "This", "is", "instead", "of", "PHP_SELF", "which", "is", "unsafe" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/lib/XeroOAuth.php#L573-L594
Daursu/xero
src/Daursu/Xero/lib/XeroOAuth.php
XeroOAuth.diagnostics
function diagnostics() { $testOutput = array (); if ($this->config ['application_type'] == 'Partner') { if (! file_get_contents ( $this->config ['curl_ssl_cert'] )) { $testOutput ['ssl_cert_error'] = "Can't read the Xero Entrust cert. You need one for partner API applications. http://developer.xero.com/docum...
php
function diagnostics() { $testOutput = array (); if ($this->config ['application_type'] == 'Partner') { if (! file_get_contents ( $this->config ['curl_ssl_cert'] )) { $testOutput ['ssl_cert_error'] = "Can't read the Xero Entrust cert. You need one for partner API applications. http://developer.xero.com/docum...
[ "function", "diagnostics", "(", ")", "{", "$", "testOutput", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "config", "[", "'application_type'", "]", "==", "'Partner'", ")", "{", "if", "(", "!", "file_get_contents", "(", "$", "this", "->", ...
/* Run some basic checks on our config options etc to make sure all is ok
[ "/", "*", "Run", "some", "basic", "checks", "on", "our", "config", "options", "etc", "to", "make", "sure", "all", "is", "ok" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/lib/XeroOAuth.php#L599-L644
ganlvtech/php-simple-cas-proxy
src/PhpCasProxy.php
PhpCasProxy.filterService
protected function filterService() { if (empty($_GET['service'])) { return false; } if (is_null($this->service_filter)) { return true; } return (true == call_user_func($this->service_filter, $_GET['service'])); }
php
protected function filterService() { if (empty($_GET['service'])) { return false; } if (is_null($this->service_filter)) { return true; } return (true == call_user_func($this->service_filter, $_GET['service'])); }
[ "protected", "function", "filterService", "(", ")", "{", "if", "(", "empty", "(", "$", "_GET", "[", "'service'", "]", ")", ")", "{", "return", "false", ";", "}", "if", "(", "is_null", "(", "$", "this", "->", "service_filter", ")", ")", "{", "return",...
Validate if the proxied service is authenticated @return bool
[ "Validate", "if", "the", "proxied", "service", "is", "authenticated" ]
train
https://github.com/ganlvtech/php-simple-cas-proxy/blob/eda8628b424db83d4b243bc2fa9d47cde0faba39/src/PhpCasProxy.php#L76-L85
ganlvtech/php-simple-cas-proxy
src/PhpCasProxy.php
PhpCasProxy.proxy
public function proxy() { $path_info = trim(self::getPathInfo(), '/'); if (!empty($this->my_cas_context)) { if (strpos($path_info, $this->my_cas_context) !== 0) { return false; } $path_info = substr($path_info, strlen($this->my_cas_context)); ...
php
public function proxy() { $path_info = trim(self::getPathInfo(), '/'); if (!empty($this->my_cas_context)) { if (strpos($path_info, $this->my_cas_context) !== 0) { return false; } $path_info = substr($path_info, strlen($this->my_cas_context)); ...
[ "public", "function", "proxy", "(", ")", "{", "$", "path_info", "=", "trim", "(", "self", "::", "getPathInfo", "(", ")", ",", "'/'", ")", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "my_cas_context", ")", ")", "{", "if", "(", "strpos", ...
Auto proxy the following several routes (according to $_SERVER['PATH_INFO'] and $_GET) If matched, redirect. Otherwise, return false and nothing happened. /login?service= client -> proxy server /login?service=&gateway= client -> proxy server /?service=&ticket= CAS server -> ...
[ "Auto", "proxy", "the", "following", "several", "routes", "(", "according", "to", "$_SERVER", "[", "PATH_INFO", "]", "and", "$_GET", ")", "If", "matched", "redirect", ".", "Otherwise", "return", "false", "and", "nothing", "happened", ".", "/", "login?service",...
train
https://github.com/ganlvtech/php-simple-cas-proxy/blob/eda8628b424db83d4b243bc2fa9d47cde0faba39/src/PhpCasProxy.php#L99-L133
ganlvtech/php-simple-cas-proxy
src/PhpCasProxy.php
PhpCasProxy.login
public function login($service, $gateway = false) { $query = array( 'service' => $this->my_service . '?' . http_build_query(array( 'service' => $service, )), ); if ($gateway) { $query['gateway'] = $gateway; } self::h...
php
public function login($service, $gateway = false) { $query = array( 'service' => $this->my_service . '?' . http_build_query(array( 'service' => $service, )), ); if ($gateway) { $query['gateway'] = $gateway; } self::h...
[ "public", "function", "login", "(", "$", "service", ",", "$", "gateway", "=", "false", ")", "{", "$", "query", "=", "array", "(", "'service'", "=>", "$", "this", "->", "my_service", ".", "'?'", ".", "http_build_query", "(", "array", "(", "'service'", "...
From proxied service to CAS server @param string $service @param string|bool $gateway @return bool always true, but never reach.
[ "From", "proxied", "service", "to", "CAS", "server" ]
train
https://github.com/ganlvtech/php-simple-cas-proxy/blob/eda8628b424db83d4b243bc2fa9d47cde0faba39/src/PhpCasProxy.php#L143-L156
ganlvtech/php-simple-cas-proxy
src/PhpCasProxy.php
PhpCasProxy.back
public function back($service, $ticket = '') { $parts = parse_url($service); if (isset($parts['query'])) { parse_str($parts['query'], $query); } else { $query = array(); } if (!empty($ticket)) { $query['ticket'] = $ticket; } ...
php
public function back($service, $ticket = '') { $parts = parse_url($service); if (isset($parts['query'])) { parse_str($parts['query'], $query); } else { $query = array(); } if (!empty($ticket)) { $query['ticket'] = $ticket; } ...
[ "public", "function", "back", "(", "$", "service", ",", "$", "ticket", "=", "''", ")", "{", "$", "parts", "=", "parse_url", "(", "$", "service", ")", ";", "if", "(", "isset", "(", "$", "parts", "[", "'query'", "]", ")", ")", "{", "parse_str", "("...
From CAS server back to proxied service @param string $service proxied service @param string $ticket @return bool always true, but never reach.
[ "From", "CAS", "server", "back", "to", "proxied", "service" ]
train
https://github.com/ganlvtech/php-simple-cas-proxy/blob/eda8628b424db83d4b243bc2fa9d47cde0faba39/src/PhpCasProxy.php#L166-L181
ganlvtech/php-simple-cas-proxy
src/PhpCasProxy.php
PhpCasProxy.serviceValidate
public function serviceValidate($service, $ticket, $timeout = 10) { header('Content-Type: text/xml; charset=UTF-8'); exit(self::file_get_contents($this->server['service_validate_url'] . '?' . http_build_query(array( 'service' => $this->my_service . '?' . http_build_query(array( ...
php
public function serviceValidate($service, $ticket, $timeout = 10) { header('Content-Type: text/xml; charset=UTF-8'); exit(self::file_get_contents($this->server['service_validate_url'] . '?' . http_build_query(array( 'service' => $this->my_service . '?' . http_build_query(array( ...
[ "public", "function", "serviceValidate", "(", "$", "service", ",", "$", "ticket", ",", "$", "timeout", "=", "10", ")", "{", "header", "(", "'Content-Type: text/xml; charset=UTF-8'", ")", ";", "exit", "(", "self", "::", "file_get_contents", "(", "$", "this", ...
Pass service validate http response @param string $service proxied service @param string $ticket CAS ticket @param int $timeout @return bool always true, but never reach.
[ "Pass", "service", "validate", "http", "response" ]
train
https://github.com/ganlvtech/php-simple-cas-proxy/blob/eda8628b424db83d4b243bc2fa9d47cde0faba39/src/PhpCasProxy.php#L192-L203
ganlvtech/php-simple-cas-proxy
src/PhpCasProxy.php
PhpCasProxy.file_get_contents
protected static function file_get_contents($url, $timeout) { $opts = array( 'http' => array( 'timeout' => $timeout, ), ); return file_get_contents($url, false, stream_context_create($opts)); }
php
protected static function file_get_contents($url, $timeout) { $opts = array( 'http' => array( 'timeout' => $timeout, ), ); return file_get_contents($url, false, stream_context_create($opts)); }
[ "protected", "static", "function", "file_get_contents", "(", "$", "url", ",", "$", "timeout", ")", "{", "$", "opts", "=", "array", "(", "'http'", "=>", "array", "(", "'timeout'", "=>", "$", "timeout", ",", ")", ",", ")", ";", "return", "file_get_contents...
Send GET request @param string $url URL @param int $timeout Timeout(seconds) @return string Text response
[ "Send", "GET", "request" ]
train
https://github.com/ganlvtech/php-simple-cas-proxy/blob/eda8628b424db83d4b243bc2fa9d47cde0faba39/src/PhpCasProxy.php#L246-L254
arndtteunissen/column-layout
Classes/DataProcessing/FoundationColumnClasses.php
FoundationColumnClasses.process
public function process( ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData ) { if (empty($processorConfiguration['layoutConfig']) || empty($processedData[$processorConfiguration['layoutConfig']])) { ...
php
public function process( ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData ) { if (empty($processorConfiguration['layoutConfig']) || empty($processedData[$processorConfiguration['layoutConfig']])) { ...
[ "public", "function", "process", "(", "ContentObjectRenderer", "$", "cObj", ",", "array", "$", "contentObjectConfiguration", ",", "array", "$", "processorConfiguration", ",", "array", "$", "processedData", ")", "{", "if", "(", "empty", "(", "$", "processorConfigur...
{@inheritdoc}
[ "{" ]
train
https://github.com/arndtteunissen/column-layout/blob/ad737068eef3b084d4d0e3a48e6a3d8277af9560/Classes/DataProcessing/FoundationColumnClasses.php#L24-L40
SporkCode/Spork
src/Mvc/Listener/Limit/LimitStrategy.php
LimitStrategy.attach
public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach(MvcEvent::EVENT_BOOTSTRAP, array( $this, 'initialize' ), 1001); $this->listeners[] = $events->attach(MvcEvent::EVENT_BOOTSTRAP, array( ...
php
public function attach(EventManagerInterface $events) { $this->listeners[] = $events->attach(MvcEvent::EVENT_BOOTSTRAP, array( $this, 'initialize' ), 1001); $this->listeners[] = $events->attach(MvcEvent::EVENT_BOOTSTRAP, array( ...
[ "public", "function", "attach", "(", "EventManagerInterface", "$", "events", ")", "{", "$", "this", "->", "listeners", "[", "]", "=", "$", "events", "->", "attach", "(", "MvcEvent", "::", "EVENT_BOOTSTRAP", ",", "array", "(", "$", "this", ",", "'initialize...
Attach event listeners @param EventManagerInterface $events @see \Zend\EventManager\ListenerAggregateInterface::attach()
[ "Attach", "event", "listeners" ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/Limit/LimitStrategy.php#L98-L110
SporkCode/Spork
src/Mvc/Listener/Limit/LimitStrategy.php
LimitStrategy.detach
public function detach(EventManagerInterface $events) { foreach ($this->listeners as $listener) { $events->detach($listener); } }
php
public function detach(EventManagerInterface $events) { foreach ($this->listeners as $listener) { $events->detach($listener); } }
[ "public", "function", "detach", "(", "EventManagerInterface", "$", "events", ")", "{", "foreach", "(", "$", "this", "->", "listeners", "as", "$", "listener", ")", "{", "$", "events", "->", "detach", "(", "$", "listener", ")", ";", "}", "}" ]
Detach event listeners @param EventManagerInterface $events @see \Zend\EventManager\ListenerAggregateInterface::detach()
[ "Detach", "event", "listeners" ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/Limit/LimitStrategy.php#L118-L123
SporkCode/Spork
src/Mvc/Listener/Limit/LimitStrategy.php
LimitStrategy.setServiceLocator
public function setServiceLocator(ServiceLocatorInterface $serviceLocator) { $this->getActionPlugins()->setServiceLocator($serviceLocator); $this->getStoragePlugins()->setServiceLocator($serviceLocator); }
php
public function setServiceLocator(ServiceLocatorInterface $serviceLocator) { $this->getActionPlugins()->setServiceLocator($serviceLocator); $this->getStoragePlugins()->setServiceLocator($serviceLocator); }
[ "public", "function", "setServiceLocator", "(", "ServiceLocatorInterface", "$", "serviceLocator", ")", "{", "$", "this", "->", "getActionPlugins", "(", ")", "->", "setServiceLocator", "(", "$", "serviceLocator", ")", ";", "$", "this", "->", "getStoragePlugins", "(...
Set service locator @see \Zend\ServiceManager\ServiceLocatorAwareInterface::setServiceLocator() @param ServiceLocatorInterface $serviceLocator
[ "Set", "service", "locator" ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/Limit/LimitStrategy.php#L142-L146
SporkCode/Spork
src/Mvc/Listener/Limit/LimitStrategy.php
LimitStrategy.getActionPlugins
public function getActionPlugins() { if (null === $this->actionPlugins) { $this->setActionPlugins(new Action\PluginManager()); } return $this->actionPlugins; }
php
public function getActionPlugins() { if (null === $this->actionPlugins) { $this->setActionPlugins(new Action\PluginManager()); } return $this->actionPlugins; }
[ "public", "function", "getActionPlugins", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "actionPlugins", ")", "{", "$", "this", "->", "setActionPlugins", "(", "new", "Action", "\\", "PluginManager", "(", ")", ")", ";", "}", "return", "$", ...
Get action plugin manager @return \Zend\ServiceManager\AbstractPluginManager
[ "Get", "action", "plugin", "manager" ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/Limit/LimitStrategy.php#L153-L159
SporkCode/Spork
src/Mvc/Listener/Limit/LimitStrategy.php
LimitStrategy.setLimits
public function setLimits(array $limits) { $this->limits = array(); foreach ($limits as $limit) { $this->setLimit($limit); } }
php
public function setLimits(array $limits) { $this->limits = array(); foreach ($limits as $limit) { $this->setLimit($limit); } }
[ "public", "function", "setLimits", "(", "array", "$", "limits", ")", "{", "$", "this", "->", "limits", "=", "array", "(", ")", ";", "foreach", "(", "$", "limits", "as", "$", "limit", ")", "{", "$", "this", "->", "setLimit", "(", "$", "limit", ")", ...
Set limits @param array $limits
[ "Set", "limits" ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/Limit/LimitStrategy.php#L186-L192
SporkCode/Spork
src/Mvc/Listener/Limit/LimitStrategy.php
LimitStrategy.setLimit
public function setLimit($limit) { if (is_array($limit)) { $spec = $limit; if (!isset($spec['name'])) { throw new \Exception("Cannot create Limit: Name missing from configuration."); } $name = $spec['name']; $limit = isset($spec['li...
php
public function setLimit($limit) { if (is_array($limit)) { $spec = $limit; if (!isset($spec['name'])) { throw new \Exception("Cannot create Limit: Name missing from configuration."); } $name = $spec['name']; $limit = isset($spec['li...
[ "public", "function", "setLimit", "(", "$", "limit", ")", "{", "if", "(", "is_array", "(", "$", "limit", ")", ")", "{", "$", "spec", "=", "$", "limit", ";", "if", "(", "!", "isset", "(", "$", "spec", "[", "'name'", "]", ")", ")", "{", "throw", ...
Set a limit @param Limit|array $limit @throws \Exception
[ "Set", "a", "limit" ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/Limit/LimitStrategy.php#L200-L237
SporkCode/Spork
src/Mvc/Listener/Limit/LimitStrategy.php
LimitStrategy.setStorage
public function setStorage($storage) { if (is_string($storage)) { $storage = $this->getStoragePlugins()->get($storage); } elseif (is_array($storage)) { if (!isset($storage['name'])) { throw new \Exception('Invalid Storage configuration: Name required.'); ...
php
public function setStorage($storage) { if (is_string($storage)) { $storage = $this->getStoragePlugins()->get($storage); } elseif (is_array($storage)) { if (!isset($storage['name'])) { throw new \Exception('Invalid Storage configuration: Name required.'); ...
[ "public", "function", "setStorage", "(", "$", "storage", ")", "{", "if", "(", "is_string", "(", "$", "storage", ")", ")", "{", "$", "storage", "=", "$", "this", "->", "getStoragePlugins", "(", ")", "->", "get", "(", "$", "storage", ")", ";", "}", "...
Set storage instance @param StorageInterface|string|array $storage @return \Spork\Mvc\Listener\Limit\LimitStrategy @throws \Exception on invalid type
[ "Set", "storage", "instance" ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/Limit/LimitStrategy.php#L278-L295
SporkCode/Spork
src/Mvc/Listener/Limit/LimitStrategy.php
LimitStrategy.getStoragePlugins
public function getStoragePlugins() { if (null === $this->storagePlugins) { $this->setStoragePlugins(new Storage\PluginManager()); } return $this->storagePlugins; }
php
public function getStoragePlugins() { if (null === $this->storagePlugins) { $this->setStoragePlugins(new Storage\PluginManager()); } return $this->storagePlugins; }
[ "public", "function", "getStoragePlugins", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "storagePlugins", ")", "{", "$", "this", "->", "setStoragePlugins", "(", "new", "Storage", "\\", "PluginManager", "(", ")", ")", ";", "}", "return", "$...
Get storage plugin manager @return \Zend\ServiceManager\AbstractPluginManager
[ "Get", "storage", "plugin", "manager" ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/Limit/LimitStrategy.php#L302-L308
SporkCode/Spork
src/Mvc/Listener/Limit/LimitStrategy.php
LimitStrategy.initialize
public function initialize(MvcEvent $event) { $appConfig = $event->getApplication()->getServiceManager()->get('config'); if (array_key_exists(self::CONFIG_KEY, $appConfig)) { $this->configure($appConfig[self::CONFIG_KEY]); } $event->getApplication() -...
php
public function initialize(MvcEvent $event) { $appConfig = $event->getApplication()->getServiceManager()->get('config'); if (array_key_exists(self::CONFIG_KEY, $appConfig)) { $this->configure($appConfig[self::CONFIG_KEY]); } $event->getApplication() -...
[ "public", "function", "initialize", "(", "MvcEvent", "$", "event", ")", "{", "$", "appConfig", "=", "$", "event", "->", "getApplication", "(", ")", "->", "getServiceManager", "(", ")", "->", "get", "(", "'config'", ")", ";", "if", "(", "array_key_exists", ...
Configure instance and inject it into controller plugin manager @param MvcEvent $event
[ "Configure", "instance", "and", "inject", "it", "into", "controller", "plugin", "manager" ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/Limit/LimitStrategy.php#L337-L348
SporkCode/Spork
src/Mvc/Listener/Limit/LimitStrategy.php
LimitStrategy.check
public function check(MvcEvent $event) { foreach ($this->limits as $limit) { if ($this->storage->check($this->remoteAddress->getIpAddress(), $limit)) { foreach ($limit->getActions() as $action) { $action($event); } } } }
php
public function check(MvcEvent $event) { foreach ($this->limits as $limit) { if ($this->storage->check($this->remoteAddress->getIpAddress(), $limit)) { foreach ($limit->getActions() as $action) { $action($event); } } } }
[ "public", "function", "check", "(", "MvcEvent", "$", "event", ")", "{", "foreach", "(", "$", "this", "->", "limits", "as", "$", "limit", ")", "{", "if", "(", "$", "this", "->", "storage", "->", "check", "(", "$", "this", "->", "remoteAddress", "->", ...
Test limits and take actions if they have been exceeded @param MvcEvent $event
[ "Test", "limits", "and", "take", "actions", "if", "they", "have", "been", "exceeded" ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/Limit/LimitStrategy.php#L355-L364
SporkCode/Spork
src/Mvc/Listener/Limit/LimitStrategy.php
LimitStrategy.configure
protected function configure(array $options) { if (isset($options['actionPluginManager'])) { $config = new Config($options['actionPluginManager']); $config->configureServiceManager($this->getActionPlugins()); unset($options['actionPluginManager']); } ...
php
protected function configure(array $options) { if (isset($options['actionPluginManager'])) { $config = new Config($options['actionPluginManager']); $config->configureServiceManager($this->getActionPlugins()); unset($options['actionPluginManager']); } ...
[ "protected", "function", "configure", "(", "array", "$", "options", ")", "{", "if", "(", "isset", "(", "$", "options", "[", "'actionPluginManager'", "]", ")", ")", "{", "$", "config", "=", "new", "Config", "(", "$", "options", "[", "'actionPluginManager'",...
Configure instance @param array $options
[ "Configure", "instance" ]
train
https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/Mvc/Listener/Limit/LimitStrategy.php#L371-L404
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/mbox/mbox_transport.php
ezcMailMboxTransport.findFirstMessage
private function findFirstMessage() { $data = fgets( $this->fh ); fseek( $this->fh, 0 ); if ( substr( $data, 0, 18 ) === 'From MAILER-DAEMON' ) { return $this->findNextMessage(); } else { return 0; } }
php
private function findFirstMessage() { $data = fgets( $this->fh ); fseek( $this->fh, 0 ); if ( substr( $data, 0, 18 ) === 'From MAILER-DAEMON' ) { return $this->findNextMessage(); } else { return 0; } }
[ "private", "function", "findFirstMessage", "(", ")", "{", "$", "data", "=", "fgets", "(", "$", "this", "->", "fh", ")", ";", "fseek", "(", "$", "this", "->", "fh", ",", "0", ")", ";", "if", "(", "substr", "(", "$", "data", ",", "0", ",", "18", ...
Finds the position of the first message while skipping a possible header. Mbox files can contain a header which does not describe an email message. This method skips over this optional header by checking for a specific From MAILER-DAEMON header. @return int
[ "Finds", "the", "position", "of", "the", "first", "message", "while", "skipping", "a", "possible", "header", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/mbox/mbox_transport.php#L63-L75
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/mbox/mbox_transport.php
ezcMailMboxTransport.findNextMessage
private function findNextMessage() { do { $data = fgets( $this->fh ); } while ( !feof( $this->fh ) && substr( $data, 0, 5 ) !== "From " ); if ( feof( $this->fh ) ) { return false; } return ftell( $this->fh ); }
php
private function findNextMessage() { do { $data = fgets( $this->fh ); } while ( !feof( $this->fh ) && substr( $data, 0, 5 ) !== "From " ); if ( feof( $this->fh ) ) { return false; } return ftell( $this->fh ); }
[ "private", "function", "findNextMessage", "(", ")", "{", "do", "{", "$", "data", "=", "fgets", "(", "$", "this", "->", "fh", ")", ";", "}", "while", "(", "!", "feof", "(", "$", "this", "->", "fh", ")", "&&", "substr", "(", "$", "data", ",", "0"...
Reads through the Mbox file and stops at the next message. Messages in Mbox files are separated with lines starting with "From " and this function reads to the next "From " marker. It then returns the current posistion in the file. If EOF is detected during reading the function returns false instead. @return int
[ "Reads", "through", "the", "Mbox", "file", "and", "stops", "at", "the", "next", "message", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/mbox/mbox_transport.php#L87-L99
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/mbox/mbox_transport.php
ezcMailMboxTransport.listMessages
public function listMessages() { $messages = array(); fseek( $this->fh, 0 ); // Skip the first mail as this is the mbox header $position = $this->findFirstMessage(); if ( $position === false ) { return $messages; } // Continue reading throu...
php
public function listMessages() { $messages = array(); fseek( $this->fh, 0 ); // Skip the first mail as this is the mbox header $position = $this->findFirstMessage(); if ( $position === false ) { return $messages; } // Continue reading throu...
[ "public", "function", "listMessages", "(", ")", "{", "$", "messages", "=", "array", "(", ")", ";", "fseek", "(", "$", "this", "->", "fh", ",", "0", ")", ";", "// Skip the first mail as this is the mbox header", "$", "position", "=", "$", "this", "->", "fin...
This function reads through the whole mbox and returns starting positions of the messages. @return array(int=>int)
[ "This", "function", "reads", "through", "the", "whole", "mbox", "and", "returns", "starting", "positions", "of", "the", "messages", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/mbox/mbox_transport.php#L106-L127
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/mbox/mbox_transport.php
ezcMailMboxTransport.fetchByMessageNr
public function fetchByMessageNr( $number ) { $messages = $this->listMessages(); if ( !isset( $messages[$number] ) ) { throw new ezcMailNoSuchMessageException( $number ); } return new ezcMailMboxSet( $this->fh, array( 0 => $messages[$number] ) ); }
php
public function fetchByMessageNr( $number ) { $messages = $this->listMessages(); if ( !isset( $messages[$number] ) ) { throw new ezcMailNoSuchMessageException( $number ); } return new ezcMailMboxSet( $this->fh, array( 0 => $messages[$number] ) ); }
[ "public", "function", "fetchByMessageNr", "(", "$", "number", ")", "{", "$", "messages", "=", "$", "this", "->", "listMessages", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "messages", "[", "$", "number", "]", ")", ")", "{", "throw", "new", "...
Returns an ezcMailMboxSet containing only the $number -th message in the mbox. @throws ezcMailNoSuchMessageException if the message $number is out of range. @param int $number @return ezcMailMboxSet
[ "Returns", "an", "ezcMailMboxSet", "containing", "only", "the", "$number", "-", "th", "message", "in", "the", "mbox", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/mbox/mbox_transport.php#L148-L156
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/mbox/mbox_transport.php
ezcMailMboxTransport.fetchFromOffset
public function fetchFromOffset( $offset, $count = 0 ) { if ( $count < 0 ) { throw new ezcMailInvalidLimitException( $offset, $count ); } $messages = $this->listMessages(); if ( !isset( $messages[$offset] ) ) { throw new ezcMailOffsetOutOfRange...
php
public function fetchFromOffset( $offset, $count = 0 ) { if ( $count < 0 ) { throw new ezcMailInvalidLimitException( $offset, $count ); } $messages = $this->listMessages(); if ( !isset( $messages[$offset] ) ) { throw new ezcMailOffsetOutOfRange...
[ "public", "function", "fetchFromOffset", "(", "$", "offset", ",", "$", "count", "=", "0", ")", "{", "if", "(", "$", "count", "<", "0", ")", "{", "throw", "new", "ezcMailInvalidLimitException", "(", "$", "offset", ",", "$", "count", ")", ";", "}", "$"...
Returns an ezcMailMboxSet with $count messages starting from $offset. Fetches $count messages starting from the $offset and returns them as a ezcMailMboxSet. If $count is not specified or if it is 0, it fetches all messages starting from the $offset. @throws ezcMailInvalidLimitException if $count is negative. @throws...
[ "Returns", "an", "ezcMailMboxSet", "with", "$count", "messages", "starting", "from", "$offset", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/mbox/mbox_transport.php#L173-L193
glynnforrest/active-doctrine
src/ActiveDoctrine/Selector/AbstractSelector.php
AbstractSelector.quoteIdentifier
protected function quoteIdentifier($identifier) { $c = $this->quote_char; return $c . str_replace($c, $c.$c, $identifier) . $c; }
php
protected function quoteIdentifier($identifier) { $c = $this->quote_char; return $c . str_replace($c, $c.$c, $identifier) . $c; }
[ "protected", "function", "quoteIdentifier", "(", "$", "identifier", ")", "{", "$", "c", "=", "$", "this", "->", "quote_char", ";", "return", "$", "c", ".", "str_replace", "(", "$", "c", ",", "$", "c", ".", "$", "c", ",", "$", "identifier", ")", "."...
Quote an identifier so it can be used as a table or column name. Composite identifiers (table.column) are not supported because selectors operate on one table only. @see Doctrine\DBAL\Platforms\AbstractPlatform#quoteSingleIdentifier() It has been added here so selectors don't rely on Connection or Platform instances. ...
[ "Quote", "an", "identifier", "so", "it", "can", "be", "used", "as", "a", "table", "or", "column", "name", ".", "Composite", "identifiers", "(", "table", ".", "column", ")", "are", "not", "supported", "because", "selectors", "operate", "on", "one", "table",...
train
https://github.com/glynnforrest/active-doctrine/blob/fcf8c434c7df4704966107bf9a95c005a0b37168/src/ActiveDoctrine/Selector/AbstractSelector.php#L76-L81
glynnforrest/active-doctrine
src/ActiveDoctrine/Selector/AbstractSelector.php
AbstractSelector.getParams
public function getParams() { //exit early if no types are set if (empty($this->types)) { return $this->params; } $params = []; $num_params = count($this->params); for ($i = 0; $i < $num_params; $i++) { $value = $this->params[$i]; ...
php
public function getParams() { //exit early if no types are set if (empty($this->types)) { return $this->params; } $params = []; $num_params = count($this->params); for ($i = 0; $i < $num_params; $i++) { $value = $this->params[$i]; ...
[ "public", "function", "getParams", "(", ")", "{", "//exit early if no types are set", "if", "(", "empty", "(", "$", "this", "->", "types", ")", ")", "{", "return", "$", "this", "->", "params", ";", "}", "$", "params", "=", "[", "]", ";", "$", "num_para...
Get the parameters to be used in the prepared query, converted to the correct database type. @return array The parameters
[ "Get", "the", "parameters", "to", "be", "used", "in", "the", "prepared", "query", "converted", "to", "the", "correct", "database", "type", "." ]
train
https://github.com/glynnforrest/active-doctrine/blob/fcf8c434c7df4704966107bf9a95c005a0b37168/src/ActiveDoctrine/Selector/AbstractSelector.php#L107-L128
glynnforrest/active-doctrine
src/ActiveDoctrine/Selector/AbstractSelector.php
AbstractSelector.execute
public function execute() { $stmt = $this->connection->prepare($this->getSQL()); $stmt->execute($this->getParams()); return $this->counting ? (int) $stmt->fetchColumn() : $stmt->fetchAll(); }
php
public function execute() { $stmt = $this->connection->prepare($this->getSQL()); $stmt->execute($this->getParams()); return $this->counting ? (int) $stmt->fetchColumn() : $stmt->fetchAll(); }
[ "public", "function", "execute", "(", ")", "{", "$", "stmt", "=", "$", "this", "->", "connection", "->", "prepare", "(", "$", "this", "->", "getSQL", "(", ")", ")", ";", "$", "stmt", "->", "execute", "(", "$", "this", "->", "getParams", "(", ")", ...
Prepare and execute the current SQL query, returning an array of the results. @return array The results
[ "Prepare", "and", "execute", "the", "current", "SQL", "query", "returning", "an", "array", "of", "the", "results", "." ]
train
https://github.com/glynnforrest/active-doctrine/blob/fcf8c434c7df4704966107bf9a95c005a0b37168/src/ActiveDoctrine/Selector/AbstractSelector.php#L146-L152
glynnforrest/active-doctrine
src/ActiveDoctrine/Selector/AbstractSelector.php
AbstractSelector.fromConnection
public static function fromConnection(Connection $connection, $table, array $types = []) { $name = $connection->getDriver()->getName(); switch ($name) { case 'pdo_mysql': return new MysqlSelector($connection, $table, $types); case 'pdo_sqlite': return new Sqli...
php
public static function fromConnection(Connection $connection, $table, array $types = []) { $name = $connection->getDriver()->getName(); switch ($name) { case 'pdo_mysql': return new MysqlSelector($connection, $table, $types); case 'pdo_sqlite': return new Sqli...
[ "public", "static", "function", "fromConnection", "(", "Connection", "$", "connection", ",", "$", "table", ",", "array", "$", "types", "=", "[", "]", ")", "{", "$", "name", "=", "$", "connection", "->", "getDriver", "(", ")", "->", "getName", "(", ")",...
Get a vendor-specific selector based on a connection instance. @param Connection $connection A connection instance @param string $table The table to select from @return AbstractSelector A selector instance @throws DBALException
[ "Get", "a", "vendor", "-", "specific", "selector", "based", "on", "a", "connection", "instance", "." ]
train
https://github.com/glynnforrest/active-doctrine/blob/fcf8c434c7df4704966107bf9a95c005a0b37168/src/ActiveDoctrine/Selector/AbstractSelector.php#L162-L173
glynnforrest/active-doctrine
src/ActiveDoctrine/Selector/AbstractSelector.php
AbstractSelector.addParam
protected function addParam($column, $value) { if (is_array($value)) { $this->params = array_merge($this->params, $value); $this->param_columns = array_merge($this->param_columns, array_fill(0, count($value), $column)); return; } $this->params[] = $value; ...
php
protected function addParam($column, $value) { if (is_array($value)) { $this->params = array_merge($this->params, $value); $this->param_columns = array_merge($this->param_columns, array_fill(0, count($value), $column)); return; } $this->params[] = $value; ...
[ "protected", "function", "addParam", "(", "$", "column", ",", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "$", "this", "->", "params", "=", "array_merge", "(", "$", "this", "->", "params", ",", "$", "value", ")"...
Add a param to be executed in the query. To ensure the order of parameters, this should be called during the buildSQL method. @param string $column @param mixed $value
[ "Add", "a", "param", "to", "be", "executed", "in", "the", "query", ".", "To", "ensure", "the", "order", "of", "parameters", "this", "should", "be", "called", "during", "the", "buildSQL", "method", "." ]
train
https://github.com/glynnforrest/active-doctrine/blob/fcf8c434c7df4704966107bf9a95c005a0b37168/src/ActiveDoctrine/Selector/AbstractSelector.php#L182-L191
glynnforrest/active-doctrine
src/ActiveDoctrine/Selector/AbstractSelector.php
AbstractSelector.where
public function where($column, $expression = null, $value = null) { return $this->doWhere(self::AND_WHERE, $column, $expression, $value); }
php
public function where($column, $expression = null, $value = null) { return $this->doWhere(self::AND_WHERE, $column, $expression, $value); }
[ "public", "function", "where", "(", "$", "column", ",", "$", "expression", "=", "null", ",", "$", "value", "=", "null", ")", "{", "return", "$", "this", "->", "doWhere", "(", "self", "::", "AND_WHERE", ",", "$", "column", ",", "$", "expression", ",",...
Add a 'where' clause to the query. @param string $column The column name @param string $expression The comparison, e.g. '=' or '<' @param string $value The value
[ "Add", "a", "where", "clause", "to", "the", "query", "." ]
train
https://github.com/glynnforrest/active-doctrine/blob/fcf8c434c7df4704966107bf9a95c005a0b37168/src/ActiveDoctrine/Selector/AbstractSelector.php#L225-L228
glynnforrest/active-doctrine
src/ActiveDoctrine/Selector/AbstractSelector.php
AbstractSelector.orWhere
public function orWhere($column, $expression = null, $value = null) { return $this->doWhere(self::OR_WHERE, $column, $expression, $value); }
php
public function orWhere($column, $expression = null, $value = null) { return $this->doWhere(self::OR_WHERE, $column, $expression, $value); }
[ "public", "function", "orWhere", "(", "$", "column", ",", "$", "expression", "=", "null", ",", "$", "value", "=", "null", ")", "{", "return", "$", "this", "->", "doWhere", "(", "self", "::", "OR_WHERE", ",", "$", "column", ",", "$", "expression", ","...
Add an 'or where' clause to the query. @param string $column The column name @param string $expression The comparison, e.g. '=' or '<' @param string $value The value
[ "Add", "an", "or", "where", "clause", "to", "the", "query", "." ]
train
https://github.com/glynnforrest/active-doctrine/blob/fcf8c434c7df4704966107bf9a95c005a0b37168/src/ActiveDoctrine/Selector/AbstractSelector.php#L249-L252
glynnforrest/active-doctrine
src/ActiveDoctrine/Selector/AbstractSelector.php
AbstractSelector.whereIn
public function whereIn($column, array $values) { $this->where[] = [self::AND_WHERE_IN, $column, $values]; return $this; }
php
public function whereIn($column, array $values) { $this->where[] = [self::AND_WHERE_IN, $column, $values]; return $this; }
[ "public", "function", "whereIn", "(", "$", "column", ",", "array", "$", "values", ")", "{", "$", "this", "->", "where", "[", "]", "=", "[", "self", "::", "AND_WHERE_IN", ",", "$", "column", ",", "$", "values", "]", ";", "return", "$", "this", ";", ...
Add a 'where in' clause to the query. @param string $column The column name @param array $values A list of values to query with
[ "Add", "a", "where", "in", "clause", "to", "the", "query", "." ]
train
https://github.com/glynnforrest/active-doctrine/blob/fcf8c434c7df4704966107bf9a95c005a0b37168/src/ActiveDoctrine/Selector/AbstractSelector.php#L260-L265
glynnforrest/active-doctrine
src/ActiveDoctrine/Selector/AbstractSelector.php
AbstractSelector.andWhereIn
public function andWhereIn($column, array $values) { $this->where[] = [self::AND_WHERE_IN, $column, $values]; return $this; }
php
public function andWhereIn($column, array $values) { $this->where[] = [self::AND_WHERE_IN, $column, $values]; return $this; }
[ "public", "function", "andWhereIn", "(", "$", "column", ",", "array", "$", "values", ")", "{", "$", "this", "->", "where", "[", "]", "=", "[", "self", "::", "AND_WHERE_IN", ",", "$", "column", ",", "$", "values", "]", ";", "return", "$", "this", ";...
Add an 'and where in' clause to the query. @param string $column The column name @param array $values A list of values to query with
[ "Add", "an", "and", "where", "in", "clause", "to", "the", "query", "." ]
train
https://github.com/glynnforrest/active-doctrine/blob/fcf8c434c7df4704966107bf9a95c005a0b37168/src/ActiveDoctrine/Selector/AbstractSelector.php#L273-L278
glynnforrest/active-doctrine
src/ActiveDoctrine/Selector/AbstractSelector.php
AbstractSelector.orWhereIn
public function orWhereIn($column, array $values) { $this->where[] = [self::OR_WHERE_IN, $column, $values]; return $this; }
php
public function orWhereIn($column, array $values) { $this->where[] = [self::OR_WHERE_IN, $column, $values]; return $this; }
[ "public", "function", "orWhereIn", "(", "$", "column", ",", "array", "$", "values", ")", "{", "$", "this", "->", "where", "[", "]", "=", "[", "self", "::", "OR_WHERE_IN", ",", "$", "column", ",", "$", "values", "]", ";", "return", "$", "this", ";",...
Add an 'or where in' clause to the query. @param string $column The column name @param array $values A list of values to query with
[ "Add", "an", "or", "where", "in", "clause", "to", "the", "query", "." ]
train
https://github.com/glynnforrest/active-doctrine/blob/fcf8c434c7df4704966107bf9a95c005a0b37168/src/ActiveDoctrine/Selector/AbstractSelector.php#L286-L291
glynnforrest/active-doctrine
src/ActiveDoctrine/Selector/AbstractSelector.php
AbstractSelector.orderBy
public function orderBy($column, $sort = 'ASC') { $sort = strtoupper($sort); if ($sort !== 'DESC') { $sort = 'ASC'; } $this->order_by[$column] = $sort; return $this; }
php
public function orderBy($column, $sort = 'ASC') { $sort = strtoupper($sort); if ($sort !== 'DESC') { $sort = 'ASC'; } $this->order_by[$column] = $sort; return $this; }
[ "public", "function", "orderBy", "(", "$", "column", ",", "$", "sort", "=", "'ASC'", ")", "{", "$", "sort", "=", "strtoupper", "(", "$", "sort", ")", ";", "if", "(", "$", "sort", "!==", "'DESC'", ")", "{", "$", "sort", "=", "'ASC'", ";", "}", "...
Add an 'order by' clause to the query. @param string $column The column name @param string $sort The sort order, either 'ASC' or 'DESC'
[ "Add", "an", "order", "by", "clause", "to", "the", "query", "." ]
train
https://github.com/glynnforrest/active-doctrine/blob/fcf8c434c7df4704966107bf9a95c005a0b37168/src/ActiveDoctrine/Selector/AbstractSelector.php#L299-L308
alevilar/ristorantino-vendor
Risto/Controller/ClientesController.php
ClientesController.index
public function index() { $this->Cliente->recursive = 0; $descuentoMaximo = Configure::read('Mozo.descuento_maximo'); $currentRole = $this->Session->read('Auth.User.role'); $this->Prg->commonProcess(); $this->Paginator->...
php
public function index() { $this->Cliente->recursive = 0; $descuentoMaximo = Configure::read('Mozo.descuento_maximo'); $currentRole = $this->Session->read('Auth.User.role'); $this->Prg->commonProcess(); $this->Paginator->...
[ "public", "function", "index", "(", ")", "{", "$", "this", "->", "Cliente", "->", "recursive", "=", "0", ";", "$", "descuentoMaximo", "=", "Configure", "::", "read", "(", "'Mozo.descuento_maximo'", ")", ";", "$", "currentRole", "=", "$", "this", "->", "S...
index method @return void
[ "index", "method" ]
train
https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Risto/Controller/ClientesController.php#L20-L41
alevilar/ristorantino-vendor
Risto/Controller/ClientesController.php
ClientesController.delete
public function delete($id = null) { $this->Cliente->id = $id; if (!$this->Cliente->exists()) { throw new NotFoundException(__('Invalid %s', Configure::read('Mesa.tituloCliente'))); } $this->request->allowMethod('post', 'delete'); if ($this->Cliente->delete()) { $this->Session->setFlash(__('The %s has b...
php
public function delete($id = null) { $this->Cliente->id = $id; if (!$this->Cliente->exists()) { throw new NotFoundException(__('Invalid %s', Configure::read('Mesa.tituloCliente'))); } $this->request->allowMethod('post', 'delete'); if ($this->Cliente->delete()) { $this->Session->setFlash(__('The %s has b...
[ "public", "function", "delete", "(", "$", "id", "=", "null", ")", "{", "$", "this", "->", "Cliente", "->", "id", "=", "$", "id", ";", "if", "(", "!", "$", "this", "->", "Cliente", "->", "exists", "(", ")", ")", "{", "throw", "new", "NotFoundExcep...
delete method @throws NotFoundException @param string $id @return void
[ "delete", "method" ]
train
https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Risto/Controller/ClientesController.php#L114-L126
jakubkratina/larachartie
src/DataTable/DataTable.php
DataTable.addColumn
public function addColumn($type, $label) { $this->columns[] = $this->columnsFactory->create($type, $label); return $this; }
php
public function addColumn($type, $label) { $this->columns[] = $this->columnsFactory->create($type, $label); return $this; }
[ "public", "function", "addColumn", "(", "$", "type", ",", "$", "label", ")", "{", "$", "this", "->", "columns", "[", "]", "=", "$", "this", "->", "columnsFactory", "->", "create", "(", "$", "type", ",", "$", "label", ")", ";", "return", "$", "this"...
{@inheritdoc}
[ "{" ]
train
https://github.com/jakubkratina/larachartie/blob/96c535650d61a2a6c1c1b12d374e5e59d33239f6/src/DataTable/DataTable.php#L97-L102
superjimpupcake/Pupcake
src/Pupcake/Pupcake.php
Pupcake.on
public function on($event_name, $handler_callback) { $event = null; if (!isset($this->event_queue[$event_name])) { $event = new Event($event_name); $this->event_queue[$event_name] = $event; } $event = $this->event_queue[$event_name]; $event->setHandle...
php
public function on($event_name, $handler_callback) { $event = null; if (!isset($this->event_queue[$event_name])) { $event = new Event($event_name); $this->event_queue[$event_name] = $event; } $event = $this->event_queue[$event_name]; $event->setHandle...
[ "public", "function", "on", "(", "$", "event_name", ",", "$", "handler_callback", ")", "{", "$", "event", "=", "null", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "event_queue", "[", "$", "event_name", "]", ")", ")", "{", "$", "event", "=...
add a callback to the event, one event, one handler callback the handler callback is swappable, so later handler callback can override previous handler callback
[ "add", "a", "callback", "to", "the", "event", "one", "event", "one", "handler", "callback", "the", "handler", "callback", "is", "swappable", "so", "later", "handler", "callback", "can", "override", "previous", "handler", "callback" ]
train
https://github.com/superjimpupcake/Pupcake/blob/2f962818646e4e1d65f5d008eeb953cb41ebb3e0/src/Pupcake/Pupcake.php#L48-L58
superjimpupcake/Pupcake
src/Pupcake/Pupcake.php
Pupcake.trigger
public function trigger($event_name, $default_handler_callback = "", $event_properties = array()) { $event = null; if (isset($this->event_queue[$event_name])) { //if the event already exists, use the handler callback for the event instead of the default handler callback $event = $this->e...
php
public function trigger($event_name, $default_handler_callback = "", $event_properties = array()) { $event = null; if (isset($this->event_queue[$event_name])) { //if the event already exists, use the handler callback for the event instead of the default handler callback $event = $this->e...
[ "public", "function", "trigger", "(", "$", "event_name", ",", "$", "default_handler_callback", "=", "\"\"", ",", "$", "event_properties", "=", "array", "(", ")", ")", "{", "$", "event", "=", "null", ";", "if", "(", "isset", "(", "$", "this", "->", "eve...
trigger an event with a default handler callback
[ "trigger", "an", "event", "with", "a", "default", "handler", "callback" ]
train
https://github.com/superjimpupcake/Pupcake/blob/2f962818646e4e1d65f5d008eeb953cb41ebb3e0/src/Pupcake/Pupcake.php#L71-L98
superjimpupcake/Pupcake
src/Pupcake/Pupcake.php
Pupcake.usePlugin
public function usePlugin($plugin_name, $config = array()) { if (!isset($this->plugins[$plugin_name])) { $plugin_name = str_replace(".", "\\", $plugin_name); //allow plugin name to use . sign $plugin_class_name = $plugin_name."\Main"; $this->plugins[$plugin_na...
php
public function usePlugin($plugin_name, $config = array()) { if (!isset($this->plugins[$plugin_name])) { $plugin_name = str_replace(".", "\\", $plugin_name); //allow plugin name to use . sign $plugin_class_name = $plugin_name."\Main"; $this->plugins[$plugin_na...
[ "public", "function", "usePlugin", "(", "$", "plugin_name", ",", "$", "config", "=", "array", "(", ")", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "plugins", "[", "$", "plugin_name", "]", ")", ")", "{", "$", "plugin_name", "=", "str...
tell the sytem to use a plugin
[ "tell", "the", "sytem", "to", "use", "a", "plugin" ]
train
https://github.com/superjimpupcake/Pupcake/blob/2f962818646e4e1d65f5d008eeb953cb41ebb3e0/src/Pupcake/Pupcake.php#L103-L114
superjimpupcake/Pupcake
src/Pupcake/Pupcake.php
Pupcake.loadAllPlugins
public function loadAllPlugins() { if (count($this->plugins) > 0) { foreach ($this->plugins as $plugin_name => $plugin) { $event_helpers = $plugin->getEventHelperCallbacks(); if (count($event_helpers) > 0) { foreach ($event_helpers as $event_na...
php
public function loadAllPlugins() { if (count($this->plugins) > 0) { foreach ($this->plugins as $plugin_name => $plugin) { $event_helpers = $plugin->getEventHelperCallbacks(); if (count($event_helpers) > 0) { foreach ($event_helpers as $event_na...
[ "public", "function", "loadAllPlugins", "(", ")", "{", "if", "(", "count", "(", "$", "this", "->", "plugins", ")", ">", "0", ")", "{", "foreach", "(", "$", "this", "->", "plugins", "as", "$", "plugin_name", "=>", "$", "plugin", ")", "{", "$", "even...
load all plugins
[ "load", "all", "plugins" ]
train
https://github.com/superjimpupcake/Pupcake/blob/2f962818646e4e1d65f5d008eeb953cb41ebb3e0/src/Pupcake/Pupcake.php#L119-L147
codezero-be/laravel-localizer
src/Stores/CookieStore.php
CookieStore.store
public function store($locale) { $name = Config::get('localizer.cookie-name'); $minutes = Config::get('localizer.cookie-minutes'); Cookie::queue($name, $locale, $minutes); }
php
public function store($locale) { $name = Config::get('localizer.cookie-name'); $minutes = Config::get('localizer.cookie-minutes'); Cookie::queue($name, $locale, $minutes); }
[ "public", "function", "store", "(", "$", "locale", ")", "{", "$", "name", "=", "Config", "::", "get", "(", "'localizer.cookie-name'", ")", ";", "$", "minutes", "=", "Config", "::", "get", "(", "'localizer.cookie-minutes'", ")", ";", "Cookie", "::", "queue"...
Store the given locale. @param string $locale @return void
[ "Store", "the", "given", "locale", "." ]
train
https://github.com/codezero-be/laravel-localizer/blob/812692796a73bd38fc205404d8ef90df5bfa0d83/src/Stores/CookieStore.php#L17-L23
hametuha/wpametu
src/WPametu/UI/Field/TokenInput.php
TokenInput.get_field_arguments
protected function get_field_arguments(){ $args = parent::get_field_arguments(); $args['class'] = 'token-input'; $url = $this->get_endpoint(); if( !empty($this->args) ){ $url = add_query_arg($this->args, $url); } $args['data-endpoint'] = $url; $args['p...
php
protected function get_field_arguments(){ $args = parent::get_field_arguments(); $args['class'] = 'token-input'; $url = $this->get_endpoint(); if( !empty($this->args) ){ $url = add_query_arg($this->args, $url); } $args['data-endpoint'] = $url; $args['p...
[ "protected", "function", "get_field_arguments", "(", ")", "{", "$", "args", "=", "parent", "::", "get_field_arguments", "(", ")", ";", "$", "args", "[", "'class'", "]", "=", "'token-input'", ";", "$", "url", "=", "$", "this", "->", "get_endpoint", "(", "...
Field arguments @return array
[ "Field", "arguments" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Field/TokenInput.php#L35-L45
hametuha/wpametu
src/WPametu/UI/Field/TokenInput.php
TokenInput.build_input
protected function build_input($data, array $fields = [] ){ $prepopulates = $this->get_prepopulates($data); $ids = []; foreach( $prepopulates as $obj ){ $ids[] = $obj['id']; } $prepopulates = json_encode($prepopulates); $input = parent::build_input('', $fields...
php
protected function build_input($data, array $fields = [] ){ $prepopulates = $this->get_prepopulates($data); $ids = []; foreach( $prepopulates as $obj ){ $ids[] = $obj['id']; } $prepopulates = json_encode($prepopulates); $input = parent::build_input('', $fields...
[ "protected", "function", "build_input", "(", "$", "data", ",", "array", "$", "fields", "=", "[", "]", ")", "{", "$", "prepopulates", "=", "$", "this", "->", "get_prepopulates", "(", "$", "data", ")", ";", "$", "ids", "=", "[", "]", ";", "foreach", ...
Add prepopulates @param mixed $data @param array $fields @return string|void
[ "Add", "prepopulates" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Field/TokenInput.php#L54-L69
antaresproject/notifications
src/Repository/Repository.php
Repository.findByLocale
public function findByLocale($id, $locale) { return $this->model->with(['type', 'contents' => function($query) { $query->with('lang'); }])->where('id', $id)->first(); }
php
public function findByLocale($id, $locale) { return $this->model->with(['type', 'contents' => function($query) { $query->with('lang'); }])->where('id', $id)->first(); }
[ "public", "function", "findByLocale", "(", "$", "id", ",", "$", "locale", ")", "{", "return", "$", "this", "->", "model", "->", "with", "(", "[", "'type'", ",", "'contents'", "=>", "function", "(", "$", "query", ")", "{", "$", "query", "->", "with", ...
find model by locale @param mixed $id @param String $locale @return Model
[ "find", "model", "by", "locale" ]
train
https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Repository/Repository.php#L64-L69
antaresproject/notifications
src/Repository/Repository.php
Repository.updateNotification
public function updateNotification($id, array $data) { DB:: beginTransaction(); try { $model = $this->model->find($id); $model->active = array_get($data, 'active', 0); $model->save(); $titles = array_get($data, 'title', []); ...
php
public function updateNotification($id, array $data) { DB:: beginTransaction(); try { $model = $this->model->find($id); $model->active = array_get($data, 'active', 0); $model->save(); $titles = array_get($data, 'title', []); ...
[ "public", "function", "updateNotification", "(", "$", "id", ",", "array", "$", "data", ")", "{", "DB", "::", "beginTransaction", "(", ")", ";", "try", "{", "$", "model", "=", "$", "this", "->", "model", "->", "find", "(", "$", "id", ")", ";", "$", ...
Updates notification @param mixes $id @param array $data
[ "Updates", "notification" ]
train
https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Repository/Repository.php#L88-L111
antaresproject/notifications
src/Repository/Repository.php
Repository.store
public function store(array $data) { DB::transaction(function() use($data) { $model = $this->storeNotificationInstance($data); foreach ($data['title'] as $langId => $content) { $model->contents()->save($model->contents()->getModel()->newInstance([ ...
php
public function store(array $data) { DB::transaction(function() use($data) { $model = $this->storeNotificationInstance($data); foreach ($data['title'] as $langId => $content) { $model->contents()->save($model->contents()->getModel()->newInstance([ ...
[ "public", "function", "store", "(", "array", "$", "data", ")", "{", "DB", "::", "transaction", "(", "function", "(", ")", "use", "(", "$", "data", ")", "{", "$", "model", "=", "$", "this", "->", "storeNotificationInstance", "(", "$", "data", ")", ";"...
stores new notification @param array $data
[ "stores", "new", "notification" ]
train
https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Repository/Repository.php#L118-L132
antaresproject/notifications
src/Repository/Repository.php
Repository.storeNotificationInstance
protected function storeNotificationInstance(array $data) { is_null($typeId = array_get($data, 'type_id')) ? $typeId = app(NotificationTypes::class)->where('name', array_get($data, 'type'))->first()->id : null; $model = $this->model->getModel()->newInstance([ 'category_id' => array_get...
php
protected function storeNotificationInstance(array $data) { is_null($typeId = array_get($data, 'type_id')) ? $typeId = app(NotificationTypes::class)->where('name', array_get($data, 'type'))->first()->id : null; $model = $this->model->getModel()->newInstance([ 'category_id' => array_get...
[ "protected", "function", "storeNotificationInstance", "(", "array", "$", "data", ")", "{", "is_null", "(", "$", "typeId", "=", "array_get", "(", "$", "data", ",", "'type_id'", ")", ")", "?", "$", "typeId", "=", "app", "(", "NotificationTypes", "::", "class...
Stores notification instance details @param array $data @return Model
[ "Stores", "notification", "instance", "details" ]
train
https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Repository/Repository.php#L140-L153
antaresproject/notifications
src/Repository/Repository.php
Repository.sync
public function sync(array $data, array $areas = []) { DB::beginTransaction(); try { $templates = array_get($data, 'templates', []); $model = $this->storeNotificationInstance($data); $langs = array_get($data, 'languages', []); foreach ($langs a...
php
public function sync(array $data, array $areas = []) { DB::beginTransaction(); try { $templates = array_get($data, 'templates', []); $model = $this->storeNotificationInstance($data); $langs = array_get($data, 'languages', []); foreach ($langs a...
[ "public", "function", "sync", "(", "array", "$", "data", ",", "array", "$", "areas", "=", "[", "]", ")", "{", "DB", "::", "beginTransaction", "(", ")", ";", "try", "{", "$", "templates", "=", "array_get", "(", "$", "data", ",", "'templates'", ",", ...
Stores system notifications @param array $data @param array $areas @throws Exception
[ "Stores", "system", "notifications" ]
train
https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Repository/Repository.php#L162-L178
antaresproject/notifications
src/Repository/Repository.php
Repository.processSingle
protected function processSingle(array $data, $lang, $model) { is_null($view = array_get($data, 'templates.' . $lang->code)) ? $view = array_get($data, 'templates.' . $lang->code) : null; $content = ''; if (is_null($view)) { $content = app($data['classname'])->render(); ...
php
protected function processSingle(array $data, $lang, $model) { is_null($view = array_get($data, 'templates.' . $lang->code)) ? $view = array_get($data, 'templates.' . $lang->code) : null; $content = ''; if (is_null($view)) { $content = app($data['classname'])->render(); ...
[ "protected", "function", "processSingle", "(", "array", "$", "data", ",", "$", "lang", ",", "$", "model", ")", "{", "is_null", "(", "$", "view", "=", "array_get", "(", "$", "data", ",", "'templates.'", ".", "$", "lang", "->", "code", ")", ")", "?", ...
Process signle notification @param array $data @param \Antares\Translations\Models\Languages $lang @param Notifications $model @return boolean @throws Exception
[ "Process", "signle", "notification" ]
train
https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Repository/Repository.php#L189-L210
antaresproject/notifications
src/Repository/Repository.php
Repository.getNotificationContents
public function getNotificationContents($type = null) { return NotificationContents::select(['title', 'id']) ->whereHas('lang', function($query) { $query->where('code', locale()); }) ->whereHas('notification'...
php
public function getNotificationContents($type = null) { return NotificationContents::select(['title', 'id']) ->whereHas('lang', function($query) { $query->where('code', locale()); }) ->whereHas('notification'...
[ "public", "function", "getNotificationContents", "(", "$", "type", "=", "null", ")", "{", "return", "NotificationContents", "::", "select", "(", "[", "'title'", ",", "'id'", "]", ")", "->", "whereHas", "(", "'lang'", ",", "function", "(", "$", "query", ")"...
Gets notification contents @param String $type @return \Antares\Support\Collection
[ "Gets", "notification", "contents" ]
train
https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Repository/Repository.php#L228-L247
oroinc/OroLayoutComponent
Layout.php
Layout.render
public function render() { $renderer = $this->rendererRegistry->getRenderer($this->rendererName); foreach ($this->themes as $theme) { $renderer->setBlockTheme($theme[0], $theme[1]); } $renderer->setFormTheme($this->formThemes); return $renderer->renderBlock($this...
php
public function render() { $renderer = $this->rendererRegistry->getRenderer($this->rendererName); foreach ($this->themes as $theme) { $renderer->setBlockTheme($theme[0], $theme[1]); } $renderer->setFormTheme($this->formThemes); return $renderer->renderBlock($this...
[ "public", "function", "render", "(", ")", "{", "$", "renderer", "=", "$", "this", "->", "rendererRegistry", "->", "getRenderer", "(", "$", "this", "->", "rendererName", ")", ";", "foreach", "(", "$", "this", "->", "themes", "as", "$", "theme", ")", "{"...
Renders the layout @return string
[ "Renders", "the", "layout" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Layout.php#L45-L54
oroinc/OroLayoutComponent
Layout.php
Layout.setBlockTheme
public function setBlockTheme($themes, $blockId = null) { $view = $blockId ? $this->view[$blockId] : $this->view; $this->themes[] = [$view, $themes]; return $this; }
php
public function setBlockTheme($themes, $blockId = null) { $view = $blockId ? $this->view[$blockId] : $this->view; $this->themes[] = [$view, $themes]; return $this; }
[ "public", "function", "setBlockTheme", "(", "$", "themes", ",", "$", "blockId", "=", "null", ")", "{", "$", "view", "=", "$", "blockId", "?", "$", "this", "->", "view", "[", "$", "blockId", "]", ":", "$", "this", "->", "view", ";", "$", "this", "...
Sets the theme(s) to be used for rendering a block and its children @param string|string[] $themes The theme(s). For example 'MyBundle:Layout:my_theme.html.twig' @param string|null $blockId The id of a block to assign the theme(s) to @return self
[ "Sets", "the", "theme", "(", "s", ")", "to", "be", "used", "for", "rendering", "a", "block", "and", "its", "children" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Layout.php#L78-L87
oroinc/OroLayoutComponent
Layout.php
Layout.setFormTheme
public function setFormTheme($themes) { $themes = is_array($themes) ? $themes : [$themes]; $this->formThemes = array_merge($this->formThemes, $themes); return $this; }
php
public function setFormTheme($themes) { $themes = is_array($themes) ? $themes : [$themes]; $this->formThemes = array_merge($this->formThemes, $themes); return $this; }
[ "public", "function", "setFormTheme", "(", "$", "themes", ")", "{", "$", "themes", "=", "is_array", "(", "$", "themes", ")", "?", "$", "themes", ":", "[", "$", "themes", "]", ";", "$", "this", "->", "formThemes", "=", "array_merge", "(", "$", "this",...
Sets the theme(s) to be used for rendering forms @param string|string[] $themes The theme(s). For example 'MyBundle:Layout:my_theme.html.twig' @return self
[ "Sets", "the", "theme", "(", "s", ")", "to", "be", "used", "for", "rendering", "forms" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/Layout.php#L96-L102
shabbyrobe/amiss
src/MapperTrait.php
MapperTrait.mapObjectsToRows
public function mapObjectsToRows($objects, $meta=null, $context=null) { if (!$objects) { return []; } if (!$meta instanceof Meta) { $meta = $this->getMeta($meta ?: get_class(current($objects))); } $out = []; foreach ($objects as $key => $object) { $o...
php
public function mapObjectsToRows($objects, $meta=null, $context=null) { if (!$objects) { return []; } if (!$meta instanceof Meta) { $meta = $this->getMeta($meta ?: get_class(current($objects))); } $out = []; foreach ($objects as $key => $object) { $o...
[ "public", "function", "mapObjectsToRows", "(", "$", "objects", ",", "$", "meta", "=", "null", ",", "$", "context", "=", "null", ")", "{", "if", "(", "!", "$", "objects", ")", "{", "return", "[", "]", ";", "}", "if", "(", "!", "$", "meta", "instan...
Get row values from a list of objects This will almost always have the exact same body. This is provided for convenience, commented out below the definition. @param $meta Amiss\Meta or string used to call getMeta()
[ "Get", "row", "values", "from", "a", "list", "of", "objects" ]
train
https://github.com/shabbyrobe/amiss/blob/ba261f0d1f985ed36e9fd2903ac0df86c5b9498d/src/MapperTrait.php#L86-L99
shabbyrobe/amiss
src/MapperTrait.php
MapperTrait.createObject
public function createObject($meta, $mapped, $args=null) { if (!$meta instanceof Meta) { $meta = $this->getMeta($meta); } $object = null; $args = $args ? array_values($args) : []; $argc = $args ? count($args) : 0; if ($meta->constructorArgs) { ...
php
public function createObject($meta, $mapped, $args=null) { if (!$meta instanceof Meta) { $meta = $this->getMeta($meta); } $object = null; $args = $args ? array_values($args) : []; $argc = $args ? count($args) : 0; if ($meta->constructorArgs) { ...
[ "public", "function", "createObject", "(", "$", "meta", ",", "$", "mapped", ",", "$", "args", "=", "null", ")", "{", "if", "(", "!", "$", "meta", "instanceof", "Meta", ")", "{", "$", "meta", "=", "$", "this", "->", "getMeta", "(", "$", "meta", ")...
The row is made available to this function, but this is so it can be used to construct the object, not to populate it. Feel free to ignore it, it will be passed to populateObject as well. @param $meta \Amiss\Meta The metadata to use to create the object @param array $mapped Input values after mapping to property...
[ "The", "row", "is", "made", "available", "to", "this", "function", "but", "this", "is", "so", "it", "can", "be", "used", "to", "construct", "the", "object", "not", "to", "populate", "it", ".", "Feel", "free", "to", "ignore", "it", "it", "will", "be", ...
train
https://github.com/shabbyrobe/amiss/blob/ba261f0d1f985ed36e9fd2903ac0df86c5b9498d/src/MapperTrait.php#L111-L175
shabbyrobe/amiss
src/MapperTrait.php
MapperTrait.populateObject
public function populateObject($object, \stdClass $mapped, $meta=null) { if (!$meta instanceof Meta) { $meta = $this->getMeta($meta ?: get_class($object)); if (!$meta) { throw new \InvalidArgumentException(); } } $properties = $meta->getPr...
php
public function populateObject($object, \stdClass $mapped, $meta=null) { if (!$meta instanceof Meta) { $meta = $this->getMeta($meta ?: get_class($object)); if (!$meta) { throw new \InvalidArgumentException(); } } $properties = $meta->getPr...
[ "public", "function", "populateObject", "(", "$", "object", ",", "\\", "stdClass", "$", "mapped", ",", "$", "meta", "=", "null", ")", "{", "if", "(", "!", "$", "meta", "instanceof", "Meta", ")", "{", "$", "meta", "=", "$", "this", "->", "getMeta", ...
Populate an object with row values @param $meta Amiss\Meta|string @param object $object @param array $mapped Input after mapping to property names and type handling @return void
[ "Populate", "an", "object", "with", "row", "values" ]
train
https://github.com/shabbyrobe/amiss/blob/ba261f0d1f985ed36e9fd2903ac0df86c5b9498d/src/MapperTrait.php#L185-L210
tttptd/laravel-responder
src/Http/ErrorResponseBuilder.php
ErrorResponseBuilder.addData
public function addData(array $data):ErrorResponseBuilder { $this->data = array_merge($this->data, $data); return $this; }
php
public function addData(array $data):ErrorResponseBuilder { $this->data = array_merge($this->data, $data); return $this; }
[ "public", "function", "addData", "(", "array", "$", "data", ")", ":", "ErrorResponseBuilder", "{", "$", "this", "->", "data", "=", "array_merge", "(", "$", "this", "->", "data", ",", "$", "data", ")", ";", "return", "$", "this", ";", "}" ]
Add additonal data appended to the error object. @param array $data @return self
[ "Add", "additonal", "data", "appended", "to", "the", "error", "object", "." ]
train
https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/ErrorResponseBuilder.php#L78-L83
tttptd/laravel-responder
src/Http/ErrorResponseBuilder.php
ErrorResponseBuilder.setError
public function setError($errorCode = null, $message = null):ErrorResponseBuilder { $this->errorCode = $errorCode; if (is_array($message)) { $this->parameters = $message; } else { $this->message = $message; } return $this; }
php
public function setError($errorCode = null, $message = null):ErrorResponseBuilder { $this->errorCode = $errorCode; if (is_array($message)) { $this->parameters = $message; } else { $this->message = $message; } return $this; }
[ "public", "function", "setError", "(", "$", "errorCode", "=", "null", ",", "$", "message", "=", "null", ")", ":", "ErrorResponseBuilder", "{", "$", "this", "->", "errorCode", "=", "$", "errorCode", ";", "if", "(", "is_array", "(", "$", "message", ")", ...
Set the error code and optionally an error message. @param mixed|null $errorCode @param string|array|null $message @return self
[ "Set", "the", "error", "code", "and", "optionally", "an", "error", "message", "." ]
train
https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/ErrorResponseBuilder.php#L92-L103
tttptd/laravel-responder
src/Http/ErrorResponseBuilder.php
ErrorResponseBuilder.setStatus
public function setStatus(int $statusCode):ResponseBuilder { if ($statusCode < 400 || $statusCode >= 600) { throw new InvalidArgumentException("{$statusCode} is not a valid error HTTP status code."); } return parent::setStatus($statusCode); }
php
public function setStatus(int $statusCode):ResponseBuilder { if ($statusCode < 400 || $statusCode >= 600) { throw new InvalidArgumentException("{$statusCode} is not a valid error HTTP status code."); } return parent::setStatus($statusCode); }
[ "public", "function", "setStatus", "(", "int", "$", "statusCode", ")", ":", "ResponseBuilder", "{", "if", "(", "$", "statusCode", "<", "400", "||", "$", "statusCode", ">=", "600", ")", "{", "throw", "new", "InvalidArgumentException", "(", "\"{$statusCode} is n...
Set the HTTP status code for the response. @param int $statusCode @return self @throws \InvalidArgumentException
[ "Set", "the", "HTTP", "status", "code", "for", "the", "response", "." ]
train
https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/ErrorResponseBuilder.php#L112-L118
tttptd/laravel-responder
src/Http/ErrorResponseBuilder.php
ErrorResponseBuilder.buildErrorData
protected function buildErrorData() { if (is_null($this->errorCode)) { return null; } $data = [ 'code' => $this->errorCode, 'message' => $this->message ?: $this->resolveMessage() ]; return array_merge($data, $this->data); }
php
protected function buildErrorData() { if (is_null($this->errorCode)) { return null; } $data = [ 'code' => $this->errorCode, 'message' => $this->message ?: $this->resolveMessage() ]; return array_merge($data, $this->data); }
[ "protected", "function", "buildErrorData", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "errorCode", ")", ")", "{", "return", "null", ";", "}", "$", "data", "=", "[", "'code'", "=>", "$", "this", "->", "errorCode", ",", "'message'", "...
Build the error object of the serialized response data. @return array|null
[ "Build", "the", "error", "object", "of", "the", "serialized", "response", "data", "." ]
train
https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/ErrorResponseBuilder.php#L147-L159
tttptd/laravel-responder
src/Http/ErrorResponseBuilder.php
ErrorResponseBuilder.resolveMessage
protected function resolveMessage() { if (! $this->translator->has($code = "errors.$this->errorCode")) { return null; } return $this->translator->trans($code, $this->parameters); }
php
protected function resolveMessage() { if (! $this->translator->has($code = "errors.$this->errorCode")) { return null; } return $this->translator->trans($code, $this->parameters); }
[ "protected", "function", "resolveMessage", "(", ")", "{", "if", "(", "!", "$", "this", "->", "translator", "->", "has", "(", "$", "code", "=", "\"errors.$this->errorCode\"", ")", ")", "{", "return", "null", ";", "}", "return", "$", "this", "->", "transla...
Resolve an error message from the translator. @return string|null
[ "Resolve", "an", "error", "message", "from", "the", "translator", "." ]
train
https://github.com/tttptd/laravel-responder/blob/0e4a32701f0de755c1f1af458045829e1bd6caf6/src/Http/ErrorResponseBuilder.php#L166-L173
mikebarlow/html-helper
src/Services/CometPHP/Data.php
Data.getValue
public function getValue($name) { if (! is_string($name)) { return null; } try { $Comet = \CometPHP\Comet::getInstance(); } catch (\CometPHP\Exceptions\CometNotBooted $e) { return null; } $bits = explode('.', $name); $post...
php
public function getValue($name) { if (! is_string($name)) { return null; } try { $Comet = \CometPHP\Comet::getInstance(); } catch (\CometPHP\Exceptions\CometNotBooted $e) { return null; } $bits = explode('.', $name); $post...
[ "public", "function", "getValue", "(", "$", "name", ")", "{", "if", "(", "!", "is_string", "(", "$", "name", ")", ")", "{", "return", "null", ";", "}", "try", "{", "$", "Comet", "=", "\\", "CometPHP", "\\", "Comet", "::", "getInstance", "(", ")", ...
get the post data to prefill the inputs @param string dot notation format of the input name we're looking for @return mixed|null Return value from post data or null if not found
[ "get", "the", "post", "data", "to", "prefill", "the", "inputs" ]
train
https://github.com/mikebarlow/html-helper/blob/d9d9dc3e92ba3ecd75f3a2e5a5bc2d23f38b5f65/src/Services/CometPHP/Data.php#L13-L37