id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
17,700
digitalkaoz/versioneye-php
src/Api/Products.php
Products.show
public function show($language, $product) { return $this->request(sprintf('products/%s/%s', $language, $this->transform($product))); }
php
public function show($language, $product) { return $this->request(sprintf('products/%s/%s', $language, $this->transform($product))); }
[ "public", "function", "show", "(", "$", "language", ",", "$", "product", ")", "{", "return", "$", "this", "->", "request", "(", "sprintf", "(", "'products/%s/%s'", ",", "$", "language", ",", "$", "this", "->", "transform", "(", "$", "product", ")", ")", ")", ";", "}" ]
detailed information for specific package. @param string $language @param string $product @return array
[ "detailed", "information", "for", "specific", "package", "." ]
7b8eb9cdc83e01138dda0e709c07e3beb6aad136
https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Products.php#L42-L45
17,701
digitalkaoz/versioneye-php
src/Api/Products.php
Products.followStatus
public function followStatus($language, $product) { return $this->request(sprintf('products/%s/%s/follow', $language, $this->transform($product))); }
php
public function followStatus($language, $product) { return $this->request(sprintf('products/%s/%s/follow', $language, $this->transform($product))); }
[ "public", "function", "followStatus", "(", "$", "language", ",", "$", "product", ")", "{", "return", "$", "this", "->", "request", "(", "sprintf", "(", "'products/%s/%s/follow'", ",", "$", "language", ",", "$", "this", "->", "transform", "(", "$", "product", ")", ")", ")", ";", "}" ]
check your following status. @param string $language @param string $product @return array
[ "check", "your", "following", "status", "." ]
7b8eb9cdc83e01138dda0e709c07e3beb6aad136
https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Products.php#L55-L58
17,702
digitalkaoz/versioneye-php
src/Api/Products.php
Products.follow
public function follow($language, $product) { return $this->request(sprintf('products/%s/%s/follow', $language, $this->transform($product)), 'POST'); }
php
public function follow($language, $product) { return $this->request(sprintf('products/%s/%s/follow', $language, $this->transform($product)), 'POST'); }
[ "public", "function", "follow", "(", "$", "language", ",", "$", "product", ")", "{", "return", "$", "this", "->", "request", "(", "sprintf", "(", "'products/%s/%s/follow'", ",", "$", "language", ",", "$", "this", "->", "transform", "(", "$", "product", ")", ")", ",", "'POST'", ")", ";", "}" ]
follow your favorite software package. @param string $language @param string $product @return array
[ "follow", "your", "favorite", "software", "package", "." ]
7b8eb9cdc83e01138dda0e709c07e3beb6aad136
https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Products.php#L68-L71
17,703
digitalkaoz/versioneye-php
src/Api/Products.php
Products.unfollow
public function unfollow($language, $product) { return $this->request(sprintf('products/%s/%s/follow', $language, $this->transform($product)), 'DELETE'); }
php
public function unfollow($language, $product) { return $this->request(sprintf('products/%s/%s/follow', $language, $this->transform($product)), 'DELETE'); }
[ "public", "function", "unfollow", "(", "$", "language", ",", "$", "product", ")", "{", "return", "$", "this", "->", "request", "(", "sprintf", "(", "'products/%s/%s/follow'", ",", "$", "language", ",", "$", "this", "->", "transform", "(", "$", "product", ")", ")", ",", "'DELETE'", ")", ";", "}" ]
unfollow given software package. @param string $language @param string $product @return array
[ "unfollow", "given", "software", "package", "." ]
7b8eb9cdc83e01138dda0e709c07e3beb6aad136
https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Products.php#L81-L84
17,704
digitalkaoz/versioneye-php
src/Api/Products.php
Products.references
public function references($language, $product) { return $this->request(sprintf('products/%s/%s/references?page=%d', $language, $this->transform($product), 1)); }
php
public function references($language, $product) { return $this->request(sprintf('products/%s/%s/references?page=%d', $language, $this->transform($product), 1)); }
[ "public", "function", "references", "(", "$", "language", ",", "$", "product", ")", "{", "return", "$", "this", "->", "request", "(", "sprintf", "(", "'products/%s/%s/references?page=%d'", ",", "$", "language", ",", "$", "this", "->", "transform", "(", "$", "product", ")", ",", "1", ")", ")", ";", "}" ]
shows all references for the given package. @param string $language @param string $product @return array
[ "shows", "all", "references", "for", "the", "given", "package", "." ]
7b8eb9cdc83e01138dda0e709c07e3beb6aad136
https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Products.php#L94-L97
17,705
digitalkaoz/versioneye-php
src/Api/Products.php
Products.versions
public function versions($language, $product) { return $this->request(sprintf('products/%s/%s/versions', $language, $this->transform($product))); }
php
public function versions($language, $product) { return $this->request(sprintf('products/%s/%s/versions', $language, $this->transform($product))); }
[ "public", "function", "versions", "(", "$", "language", ",", "$", "product", ")", "{", "return", "$", "this", "->", "request", "(", "sprintf", "(", "'products/%s/%s/versions'", ",", "$", "language", ",", "$", "this", "->", "transform", "(", "$", "product", ")", ")", ")", ";", "}" ]
shows all version for the given package. @param string $language @param string $product @return array
[ "shows", "all", "version", "for", "the", "given", "package", "." ]
7b8eb9cdc83e01138dda0e709c07e3beb6aad136
https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Products.php#L107-L110
17,706
UnionOfRAD/li3_behaviors
data/model/Behaviors.php
Behaviors.bindBehavior
public static function bindBehavior($name, array $config = []) { list($model, $class) = static::_classesForBehavior($name); static::_initializeBehaviors(); if (is_object($name)) { $name->config($config); } else { if (!class_exists($class)) { $message = "Behavior class `{$class}` does not exist. "; $message .= "Its name might be misspelled. Behavior was requested by "; $message .= "model `{$model}`."; throw new Exception($message); } $name = new $class($config + compact('model')); } static::$_behaviors[$model][$class] = $name; }
php
public static function bindBehavior($name, array $config = []) { list($model, $class) = static::_classesForBehavior($name); static::_initializeBehaviors(); if (is_object($name)) { $name->config($config); } else { if (!class_exists($class)) { $message = "Behavior class `{$class}` does not exist. "; $message .= "Its name might be misspelled. Behavior was requested by "; $message .= "model `{$model}`."; throw new Exception($message); } $name = new $class($config + compact('model')); } static::$_behaviors[$model][$class] = $name; }
[ "public", "static", "function", "bindBehavior", "(", "$", "name", ",", "array", "$", "config", "=", "[", "]", ")", "{", "list", "(", "$", "model", ",", "$", "class", ")", "=", "static", "::", "_classesForBehavior", "(", "$", "name", ")", ";", "static", "::", "_initializeBehaviors", "(", ")", ";", "if", "(", "is_object", "(", "$", "name", ")", ")", "{", "$", "name", "->", "config", "(", "$", "config", ")", ";", "}", "else", "{", "if", "(", "!", "class_exists", "(", "$", "class", ")", ")", "{", "$", "message", "=", "\"Behavior class `{$class}` does not exist. \"", ";", "$", "message", ".=", "\"Its name might be misspelled. Behavior was requested by \"", ";", "$", "message", ".=", "\"model `{$model}`.\"", ";", "throw", "new", "Exception", "(", "$", "message", ")", ";", "}", "$", "name", "=", "new", "$", "class", "(", "$", "config", "+", "compact", "(", "'model'", ")", ")", ";", "}", "static", "::", "$", "_behaviors", "[", "$", "model", "]", "[", "$", "class", "]", "=", "$", "name", ";", "}" ]
Binds a new instance of a behavior to the model using given config or entirely replacing an existing behavior instance with new config. @param string|object $name The name of the behavior or an instance of it. @param array $config Configuration for the behavior instance.
[ "Binds", "a", "new", "instance", "of", "a", "behavior", "to", "the", "model", "using", "given", "config", "or", "entirely", "replacing", "an", "existing", "behavior", "instance", "with", "new", "config", "." ]
b7051a300f91323f8776088b20e84c79790015ea
https://github.com/UnionOfRAD/li3_behaviors/blob/b7051a300f91323f8776088b20e84c79790015ea/data/model/Behaviors.php#L196-L212
17,707
UnionOfRAD/li3_behaviors
data/model/Behaviors.php
Behaviors.unbindBehavior
public static function unbindBehavior($name) { list($model, $class) = static::_classesForBehavior($name); static::_initializeBehaviors(); if (!isset(static::$_behaviors[$model][$class])) { throw new RuntimeException("Behavior `{$class}` not bound to model `{$model}`."); } unset(static::$_behaviors[$model][$class]); }
php
public static function unbindBehavior($name) { list($model, $class) = static::_classesForBehavior($name); static::_initializeBehaviors(); if (!isset(static::$_behaviors[$model][$class])) { throw new RuntimeException("Behavior `{$class}` not bound to model `{$model}`."); } unset(static::$_behaviors[$model][$class]); }
[ "public", "static", "function", "unbindBehavior", "(", "$", "name", ")", "{", "list", "(", "$", "model", ",", "$", "class", ")", "=", "static", "::", "_classesForBehavior", "(", "$", "name", ")", ";", "static", "::", "_initializeBehaviors", "(", ")", ";", "if", "(", "!", "isset", "(", "static", "::", "$", "_behaviors", "[", "$", "model", "]", "[", "$", "class", "]", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Behavior `{$class}` not bound to model `{$model}`.\"", ")", ";", "}", "unset", "(", "static", "::", "$", "_behaviors", "[", "$", "model", "]", "[", "$", "class", "]", ")", ";", "}" ]
Unbinds an instance of a behavior from the model. Will throw an exception if behavior is not bound. @param string $name The name of the behavior.
[ "Unbinds", "an", "instance", "of", "a", "behavior", "from", "the", "model", ".", "Will", "throw", "an", "exception", "if", "behavior", "is", "not", "bound", "." ]
b7051a300f91323f8776088b20e84c79790015ea
https://github.com/UnionOfRAD/li3_behaviors/blob/b7051a300f91323f8776088b20e84c79790015ea/data/model/Behaviors.php#L220-L228
17,708
UnionOfRAD/li3_behaviors
data/model/Behaviors.php
Behaviors.hasBehavior
public static function hasBehavior($name) { static::_initializeBehaviors(); try { list($model, $class) = static::_classesForBehavior($name); } catch (Exception $e) { return false; } return isset(static::$_behaviors[$model][$class]); }
php
public static function hasBehavior($name) { static::_initializeBehaviors(); try { list($model, $class) = static::_classesForBehavior($name); } catch (Exception $e) { return false; } return isset(static::$_behaviors[$model][$class]); }
[ "public", "static", "function", "hasBehavior", "(", "$", "name", ")", "{", "static", "::", "_initializeBehaviors", "(", ")", ";", "try", "{", "list", "(", "$", "model", ",", "$", "class", ")", "=", "static", "::", "_classesForBehavior", "(", "$", "name", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "return", "false", ";", "}", "return", "isset", "(", "static", "::", "$", "_behaviors", "[", "$", "model", "]", "[", "$", "class", "]", ")", ";", "}" ]
Allows to check if a certain behavior is bound to the model. @param string $name The name of the behavior. @return boolean
[ "Allows", "to", "check", "if", "a", "certain", "behavior", "is", "bound", "to", "the", "model", "." ]
b7051a300f91323f8776088b20e84c79790015ea
https://github.com/UnionOfRAD/li3_behaviors/blob/b7051a300f91323f8776088b20e84c79790015ea/data/model/Behaviors.php#L236-L245
17,709
UnionOfRAD/li3_behaviors
data/model/Behaviors.php
Behaviors._classesForBehavior
protected static function _classesForBehavior($name) { $model = get_called_class(); if (is_object($name)) { $class = get_class($name); } elseif (!$class = Libraries::locate('behavior', $name)) { throw new RuntimeException("No behavior named `{$name}` found."); } return [$model, $class]; }
php
protected static function _classesForBehavior($name) { $model = get_called_class(); if (is_object($name)) { $class = get_class($name); } elseif (!$class = Libraries::locate('behavior', $name)) { throw new RuntimeException("No behavior named `{$name}` found."); } return [$model, $class]; }
[ "protected", "static", "function", "_classesForBehavior", "(", "$", "name", ")", "{", "$", "model", "=", "get_called_class", "(", ")", ";", "if", "(", "is_object", "(", "$", "name", ")", ")", "{", "$", "class", "=", "get_class", "(", "$", "name", ")", ";", "}", "elseif", "(", "!", "$", "class", "=", "Libraries", "::", "locate", "(", "'behavior'", ",", "$", "name", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"No behavior named `{$name}` found.\"", ")", ";", "}", "return", "[", "$", "model", ",", "$", "class", "]", ";", "}" ]
Helper method to retrieve current model class and behavior class for name. @param string|object $name The name of the behavior or an instance of it. @return array An array usable with `list()` with the model and behavior classes.
[ "Helper", "method", "to", "retrieve", "current", "model", "class", "and", "behavior", "class", "for", "name", "." ]
b7051a300f91323f8776088b20e84c79790015ea
https://github.com/UnionOfRAD/li3_behaviors/blob/b7051a300f91323f8776088b20e84c79790015ea/data/model/Behaviors.php#L253-L262
17,710
kuria/event
src/EventSubscriber.php
EventSubscriber.listen
protected function listen(string $event, string $methodName, int $priority = 0): EventListener { return new EventListener($event, [$this, $methodName], $priority); }
php
protected function listen(string $event, string $methodName, int $priority = 0): EventListener { return new EventListener($event, [$this, $methodName], $priority); }
[ "protected", "function", "listen", "(", "string", "$", "event", ",", "string", "$", "methodName", ",", "int", "$", "priority", "=", "0", ")", ":", "EventListener", "{", "return", "new", "EventListener", "(", "$", "event", ",", "[", "$", "this", ",", "$", "methodName", "]", ",", "$", "priority", ")", ";", "}" ]
Create an event listener and map it to a method of this class
[ "Create", "an", "event", "listener", "and", "map", "it", "to", "a", "method", "of", "this", "class" ]
9ee95e751270831d5aca04f3a34a2e03b786ff41
https://github.com/kuria/event/blob/9ee95e751270831d5aca04f3a34a2e03b786ff41/src/EventSubscriber.php#L47-L50
17,711
webforge-labs/psc-cms
lib/Psc/Doctrine/TypeExporter.php
TypeExporter.getPscType
public function getPscType($dcTypeConstant) { if ($dcTypeConstant === NULL) throw new TypeConversionException('dcTypeConstant kann nicht NULL sein'); $flip = array_flip($this->casts); if (!array_key_exists($dcTypeConstant, $flip)) { throw TypeConversionException::typeTarget('Doctrine-Type: '.$dcTypeConstant, 'Psc-Type'); } return Type::create($flip[$dcTypeConstant]); }
php
public function getPscType($dcTypeConstant) { if ($dcTypeConstant === NULL) throw new TypeConversionException('dcTypeConstant kann nicht NULL sein'); $flip = array_flip($this->casts); if (!array_key_exists($dcTypeConstant, $flip)) { throw TypeConversionException::typeTarget('Doctrine-Type: '.$dcTypeConstant, 'Psc-Type'); } return Type::create($flip[$dcTypeConstant]); }
[ "public", "function", "getPscType", "(", "$", "dcTypeConstant", ")", "{", "if", "(", "$", "dcTypeConstant", "===", "NULL", ")", "throw", "new", "TypeConversionException", "(", "'dcTypeConstant kann nicht NULL sein'", ")", ";", "$", "flip", "=", "array_flip", "(", "$", "this", "->", "casts", ")", ";", "if", "(", "!", "array_key_exists", "(", "$", "dcTypeConstant", ",", "$", "flip", ")", ")", "{", "throw", "TypeConversionException", "::", "typeTarget", "(", "'Doctrine-Type: '", ".", "$", "dcTypeConstant", ",", "'Psc-Type'", ")", ";", "}", "return", "Type", "::", "create", "(", "$", "flip", "[", "$", "dcTypeConstant", "]", ")", ";", "}" ]
Wandelt einen Doctrine Type in einen Psc Type um @return Webforge\Types\Type
[ "Wandelt", "einen", "Doctrine", "Type", "in", "einen", "Psc", "Type", "um" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/TypeExporter.php#L67-L77
17,712
danrevah/shortify-punit
src/Matcher/ArgumentMatcher.php
ArgumentMatcher.checkMatchingArguments
protected static function checkMatchingArguments($returnValues, $arguments) { // if doesn't have exactly the arguments check for Hamcrest-PHP functions to validate foreach ($returnValues as $currentMethodArguments => $currentMethod) { // if not its not an Hamcrest Function if (strpos($currentMethodArguments, 'Hamcrest\\') === false) { continue; } $hamcrest = unserialize($currentMethodArguments); try { // Loop both hamcrest and arguments foreach ($arguments as $index => $arg) { if ( ! array_key_exists($index, $hamcrest)) { throw new AssertionError('not enough hamcrest indexes'); } // @throws Assertion error on failure if ($hamcrest[$index] instanceof Matcher) { assertThat($arg, $hamcrest[$index]); } else if ($arg != $hamcrest[$index]) { throw new AssertionError(); } } } catch(AssertionError $e) { continue; } // if didn't cached assert error then its matching an hamcrest return $currentMethodArguments; } return NULL; }
php
protected static function checkMatchingArguments($returnValues, $arguments) { // if doesn't have exactly the arguments check for Hamcrest-PHP functions to validate foreach ($returnValues as $currentMethodArguments => $currentMethod) { // if not its not an Hamcrest Function if (strpos($currentMethodArguments, 'Hamcrest\\') === false) { continue; } $hamcrest = unserialize($currentMethodArguments); try { // Loop both hamcrest and arguments foreach ($arguments as $index => $arg) { if ( ! array_key_exists($index, $hamcrest)) { throw new AssertionError('not enough hamcrest indexes'); } // @throws Assertion error on failure if ($hamcrest[$index] instanceof Matcher) { assertThat($arg, $hamcrest[$index]); } else if ($arg != $hamcrest[$index]) { throw new AssertionError(); } } } catch(AssertionError $e) { continue; } // if didn't cached assert error then its matching an hamcrest return $currentMethodArguments; } return NULL; }
[ "protected", "static", "function", "checkMatchingArguments", "(", "$", "returnValues", ",", "$", "arguments", ")", "{", "// if doesn't have exactly the arguments check for Hamcrest-PHP functions to validate", "foreach", "(", "$", "returnValues", "as", "$", "currentMethodArguments", "=>", "$", "currentMethod", ")", "{", "// if not its not an Hamcrest Function", "if", "(", "strpos", "(", "$", "currentMethodArguments", ",", "'Hamcrest\\\\'", ")", "===", "false", ")", "{", "continue", ";", "}", "$", "hamcrest", "=", "unserialize", "(", "$", "currentMethodArguments", ")", ";", "try", "{", "// Loop both hamcrest and arguments", "foreach", "(", "$", "arguments", "as", "$", "index", "=>", "$", "arg", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "index", ",", "$", "hamcrest", ")", ")", "{", "throw", "new", "AssertionError", "(", "'not enough hamcrest indexes'", ")", ";", "}", "// @throws Assertion error on failure", "if", "(", "$", "hamcrest", "[", "$", "index", "]", "instanceof", "Matcher", ")", "{", "assertThat", "(", "$", "arg", ",", "$", "hamcrest", "[", "$", "index", "]", ")", ";", "}", "else", "if", "(", "$", "arg", "!=", "$", "hamcrest", "[", "$", "index", "]", ")", "{", "throw", "new", "AssertionError", "(", ")", ";", "}", "}", "}", "catch", "(", "AssertionError", "$", "e", ")", "{", "continue", ";", "}", "// if didn't cached assert error then its matching an hamcrest", "return", "$", "currentMethodArguments", ";", "}", "return", "NULL", ";", "}" ]
Checking if there is a matching Hamcrest Function in case of founding returns the Hamcrest object otherwise returns NULL @param $returnValues - Current return values hierarchy with the current method name @param $arguments - Arguments to match @return NULL or Hamcrest
[ "Checking", "if", "there", "is", "a", "matching", "Hamcrest", "Function", "in", "case", "of", "founding", "returns", "the", "Hamcrest", "object", "otherwise", "returns", "NULL" ]
cedd08f31de8e7409a07d2630701ef4e924cc5f0
https://github.com/danrevah/shortify-punit/blob/cedd08f31de8e7409a07d2630701ef4e924cc5f0/src/Matcher/ArgumentMatcher.php#L21-L61
17,713
CakeCMS/Core
src/View/Helper/UrlHelper.php
UrlHelper.assetPath
public function assetPath($source, $type = null) { $ext = FS::ext($source); $type = (empty($type)) ? $ext : $type; $path = FS::clean(WWW_ROOT . '/' . $source, '/'); if (FS::isFile($path)) { return $path; } $path = FS::clean(WWW_ROOT . '/' . $type . '/' . $source, '/'); if (FS::isFile($path)) { return $path; } $path = $this->_findPluginAsset($source, $type); return $path; }
php
public function assetPath($source, $type = null) { $ext = FS::ext($source); $type = (empty($type)) ? $ext : $type; $path = FS::clean(WWW_ROOT . '/' . $source, '/'); if (FS::isFile($path)) { return $path; } $path = FS::clean(WWW_ROOT . '/' . $type . '/' . $source, '/'); if (FS::isFile($path)) { return $path; } $path = $this->_findPluginAsset($source, $type); return $path; }
[ "public", "function", "assetPath", "(", "$", "source", ",", "$", "type", "=", "null", ")", "{", "$", "ext", "=", "FS", "::", "ext", "(", "$", "source", ")", ";", "$", "type", "=", "(", "empty", "(", "$", "type", ")", ")", "?", "$", "ext", ":", "$", "type", ";", "$", "path", "=", "FS", "::", "clean", "(", "WWW_ROOT", ".", "'/'", ".", "$", "source", ",", "'/'", ")", ";", "if", "(", "FS", "::", "isFile", "(", "$", "path", ")", ")", "{", "return", "$", "path", ";", "}", "$", "path", "=", "FS", "::", "clean", "(", "WWW_ROOT", ".", "'/'", ".", "$", "type", ".", "'/'", ".", "$", "source", ",", "'/'", ")", ";", "if", "(", "FS", "::", "isFile", "(", "$", "path", ")", ")", "{", "return", "$", "path", ";", "}", "$", "path", "=", "$", "this", "->", "_findPluginAsset", "(", "$", "source", ",", "$", "type", ")", ";", "return", "$", "path", ";", "}" ]
Get absolute asset path. @param string $source Plugin.path/to/file.css @param null|string $type Assets folder - default is file ext @return bool|string
[ "Get", "absolute", "asset", "path", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/UrlHelper.php#L38-L56
17,714
CakeCMS/Core
src/View/Helper/UrlHelper.php
UrlHelper._findPluginAsset
protected function _findPluginAsset($source, $type = null) { list($plugin, $path) = pluginSplit($source); $plugin = (string) $plugin; if (Plugin::loaded($plugin)) { $plgPath = implode('/', [Plugin::path($plugin), Configure::read('App.webroot'), $type, $path]); $plgPath = FS::clean($plgPath, '/'); if (FS::isFile($plgPath)) { return $plgPath; } } return false; }
php
protected function _findPluginAsset($source, $type = null) { list($plugin, $path) = pluginSplit($source); $plugin = (string) $plugin; if (Plugin::loaded($plugin)) { $plgPath = implode('/', [Plugin::path($plugin), Configure::read('App.webroot'), $type, $path]); $plgPath = FS::clean($plgPath, '/'); if (FS::isFile($plgPath)) { return $plgPath; } } return false; }
[ "protected", "function", "_findPluginAsset", "(", "$", "source", ",", "$", "type", "=", "null", ")", "{", "list", "(", "$", "plugin", ",", "$", "path", ")", "=", "pluginSplit", "(", "$", "source", ")", ";", "$", "plugin", "=", "(", "string", ")", "$", "plugin", ";", "if", "(", "Plugin", "::", "loaded", "(", "$", "plugin", ")", ")", "{", "$", "plgPath", "=", "implode", "(", "'/'", ",", "[", "Plugin", "::", "path", "(", "$", "plugin", ")", ",", "Configure", "::", "read", "(", "'App.webroot'", ")", ",", "$", "type", ",", "$", "path", "]", ")", ";", "$", "plgPath", "=", "FS", "::", "clean", "(", "$", "plgPath", ",", "'/'", ")", ";", "if", "(", "FS", "::", "isFile", "(", "$", "plgPath", ")", ")", "{", "return", "$", "plgPath", ";", "}", "}", "return", "false", ";", "}" ]
Find plugin assets by source. @param string $source @param null|string $type @return bool|string
[ "Find", "plugin", "assets", "by", "source", "." ]
f9cba7aa0043a10e5c35bd45fbad158688a09a96
https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/UrlHelper.php#L65-L78
17,715
aedart/laravel-helpers
src/Traits/Queue/QueueFactoryTrait.php
QueueFactoryTrait.getQueueFactory
public function getQueueFactory(): ?Factory { if (!$this->hasQueueFactory()) { $this->setQueueFactory($this->getDefaultQueueFactory()); } return $this->queueFactory; }
php
public function getQueueFactory(): ?Factory { if (!$this->hasQueueFactory()) { $this->setQueueFactory($this->getDefaultQueueFactory()); } return $this->queueFactory; }
[ "public", "function", "getQueueFactory", "(", ")", ":", "?", "Factory", "{", "if", "(", "!", "$", "this", "->", "hasQueueFactory", "(", ")", ")", "{", "$", "this", "->", "setQueueFactory", "(", "$", "this", "->", "getDefaultQueueFactory", "(", ")", ")", ";", "}", "return", "$", "this", "->", "queueFactory", ";", "}" ]
Get queue factory If no queue factory has been set, this method will set and return a default queue factory, if any such value is available @see getDefaultQueueFactory() @return Factory|null queue factory or null if none queue factory has been set
[ "Get", "queue", "factory" ]
8b81a2d6658f3f8cb62b6be2c34773aaa2df219a
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Queue/QueueFactoryTrait.php#L53-L59
17,716
ClanCats/Core
src/classes/CCIn.php
CCIn.instance
public static function instance( $set = null ) { if ( is_null( $set ) ) { return static::$_instance; } if ( !$set instanceof CCIn_Instance ) { throw new \InvalidArgumentException('CCIn::set() - only CCIn_Instance object can be passed.'); } static::$_instance = $set; }
php
public static function instance( $set = null ) { if ( is_null( $set ) ) { return static::$_instance; } if ( !$set instanceof CCIn_Instance ) { throw new \InvalidArgumentException('CCIn::set() - only CCIn_Instance object can be passed.'); } static::$_instance = $set; }
[ "public", "static", "function", "instance", "(", "$", "set", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "set", ")", ")", "{", "return", "static", "::", "$", "_instance", ";", "}", "if", "(", "!", "$", "set", "instanceof", "CCIn_Instance", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'CCIn::set() - only CCIn_Instance object can be passed.'", ")", ";", "}", "static", "::", "$", "_instance", "=", "$", "set", ";", "}" ]
get the current input instance @param CCIn_Instance $set if set the current instance gets updated @return CCIn_Instance
[ "get", "the", "current", "input", "instance" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCIn.php#L29-L42
17,717
ClanCats/Core
src/classes/CCIn.php
CCIn.create
public static function create( $get, $post, $cookie, $files, $server ) { return new CCIn_Instance( $get, $post, $cookie, $files, $server ); }
php
public static function create( $get, $post, $cookie, $files, $server ) { return new CCIn_Instance( $get, $post, $cookie, $files, $server ); }
[ "public", "static", "function", "create", "(", "$", "get", ",", "$", "post", ",", "$", "cookie", ",", "$", "files", ",", "$", "server", ")", "{", "return", "new", "CCIn_Instance", "(", "$", "get", ",", "$", "post", ",", "$", "cookie", ",", "$", "files", ",", "$", "server", ")", ";", "}" ]
create new instance assign the main vars GET, POST, COOKIE, FILES, SERVER here @param array $get @param array $post @param array $cookie @param array $files @param array $server
[ "create", "new", "instance", "assign", "the", "main", "vars", "GET", "POST", "COOKIE", "FILES", "SERVER", "here" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCIn.php#L54-L57
17,718
qcubed/orm
src/Database/PostgreSql/Database.php
Database.getTables
public function getTables() { $objResult = $this->query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = current_schema() AND TABLE_TYPE = 'BASE TABLE' ORDER BY TABLE_NAME ASC"); $strToReturn = array(); while ($strRowArray = $objResult->fetchRow()) { array_push($strToReturn, $strRowArray[0]); } return $strToReturn; }
php
public function getTables() { $objResult = $this->query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = current_schema() AND TABLE_TYPE = 'BASE TABLE' ORDER BY TABLE_NAME ASC"); $strToReturn = array(); while ($strRowArray = $objResult->fetchRow()) { array_push($strToReturn, $strRowArray[0]); } return $strToReturn; }
[ "public", "function", "getTables", "(", ")", "{", "$", "objResult", "=", "$", "this", "->", "query", "(", "\"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = current_schema() AND TABLE_TYPE = 'BASE TABLE' ORDER BY TABLE_NAME ASC\"", ")", ";", "$", "strToReturn", "=", "array", "(", ")", ";", "while", "(", "$", "strRowArray", "=", "$", "objResult", "->", "fetchRow", "(", ")", ")", "{", "array_push", "(", "$", "strToReturn", ",", "$", "strRowArray", "[", "0", "]", ")", ";", "}", "return", "$", "strToReturn", ";", "}" ]
Returns the list of tables in the database as string @return array List of tables in the database as string
[ "Returns", "the", "list", "of", "tables", "in", "the", "database", "as", "string" ]
f320eba671f20874b1f3809c5293f8c02d5b1204
https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Database/PostgreSql/Database.php#L323-L331
17,719
ppetermann/king23
src/Controller/Controller.php
Controller.dispatch
public function dispatch($action, ServerRequestInterface $request) : ResponseInterface { $this->getLogger()->debug('dispatching to action: '.$action); if (!method_exists($this, $action) && !method_exists($this, '__call')) { throw new ActionDoesNotExistException(); } $response = $this->$action($request); return $response; }
php
public function dispatch($action, ServerRequestInterface $request) : ResponseInterface { $this->getLogger()->debug('dispatching to action: '.$action); if (!method_exists($this, $action) && !method_exists($this, '__call')) { throw new ActionDoesNotExistException(); } $response = $this->$action($request); return $response; }
[ "public", "function", "dispatch", "(", "$", "action", ",", "ServerRequestInterface", "$", "request", ")", ":", "ResponseInterface", "{", "$", "this", "->", "getLogger", "(", ")", "->", "debug", "(", "'dispatching to action: '", ".", "$", "action", ")", ";", "if", "(", "!", "method_exists", "(", "$", "this", ",", "$", "action", ")", "&&", "!", "method_exists", "(", "$", "this", ",", "'__call'", ")", ")", "{", "throw", "new", "ActionDoesNotExistException", "(", ")", ";", "}", "$", "response", "=", "$", "this", "->", "$", "action", "(", "$", "request", ")", ";", "return", "$", "response", ";", "}" ]
function to dispatch requests coming through the router @param $action @param ServerRequestInterface $request @return ResponseInterface @throws ActionDoesNotExistException
[ "function", "to", "dispatch", "requests", "coming", "through", "the", "router" ]
603896083ec89f5ac4d744abd3b1b4db3e914c95
https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Controller/Controller.php#L52-L61
17,720
aedart/laravel-helpers
src/Traits/Auth/AuthTrait.php
AuthTrait.getDefaultAuth
public function getDefaultAuth(): ?Guard { // By default, the Auth Facade does not return the // any actual authentication guard, but rather an // instance of \Illuminate\Auth\AuthManager. // Therefore, we make sure only to obtain its // "default guard", to make sure that its only the guard // instance that we obtain. $manager = Auth::getFacadeRoot(); if (isset($manager)) { return $manager->guard(); } return $manager; }
php
public function getDefaultAuth(): ?Guard { // By default, the Auth Facade does not return the // any actual authentication guard, but rather an // instance of \Illuminate\Auth\AuthManager. // Therefore, we make sure only to obtain its // "default guard", to make sure that its only the guard // instance that we obtain. $manager = Auth::getFacadeRoot(); if (isset($manager)) { return $manager->guard(); } return $manager; }
[ "public", "function", "getDefaultAuth", "(", ")", ":", "?", "Guard", "{", "// By default, the Auth Facade does not return the", "// any actual authentication guard, but rather an", "// instance of \\Illuminate\\Auth\\AuthManager.", "// Therefore, we make sure only to obtain its", "// \"default guard\", to make sure that its only the guard", "// instance that we obtain.", "$", "manager", "=", "Auth", "::", "getFacadeRoot", "(", ")", ";", "if", "(", "isset", "(", "$", "manager", ")", ")", "{", "return", "$", "manager", "->", "guard", "(", ")", ";", "}", "return", "$", "manager", ";", "}" ]
Get a default auth value, if any is available @return Guard|null A default auth value or Null if no default value is available
[ "Get", "a", "default", "auth", "value", "if", "any", "is", "available" ]
8b81a2d6658f3f8cb62b6be2c34773aaa2df219a
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Auth/AuthTrait.php#L76-L89
17,721
askupasoftware/amarkal
Template/Controller.php
Controller.get_script_path
protected function get_script_path() { if( null == $this->script_path ) { $class_name = substr( get_called_class() , strrpos( get_called_class(), '\\') + 1); $this->script_path = $this->get_dir() . '/' . $class_name . '.phtml'; } return $this->script_path; }
php
protected function get_script_path() { if( null == $this->script_path ) { $class_name = substr( get_called_class() , strrpos( get_called_class(), '\\') + 1); $this->script_path = $this->get_dir() . '/' . $class_name . '.phtml'; } return $this->script_path; }
[ "protected", "function", "get_script_path", "(", ")", "{", "if", "(", "null", "==", "$", "this", "->", "script_path", ")", "{", "$", "class_name", "=", "substr", "(", "get_called_class", "(", ")", ",", "strrpos", "(", "get_called_class", "(", ")", ",", "'\\\\'", ")", "+", "1", ")", ";", "$", "this", "->", "script_path", "=", "$", "this", "->", "get_dir", "(", ")", ".", "'/'", ".", "$", "class_name", ".", "'.phtml'", ";", "}", "return", "$", "this", "->", "script_path", ";", "}" ]
Get the full path to the template file. @return string The full path.
[ "Get", "the", "full", "path", "to", "the", "template", "file", "." ]
fe8283e2d6847ef697abec832da7ee741a85058c
https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Template/Controller.php#L87-L95
17,722
steeffeen/FancyManiaLinks
FML/Components/ValuePicker.php
ValuePicker.createEntry
protected function createEntry() { $entry = new Entry(); $entry->setVisible(false) ->setName($this->name); $this->setEntry($entry); return $entry; }
php
protected function createEntry() { $entry = new Entry(); $entry->setVisible(false) ->setName($this->name); $this->setEntry($entry); return $entry; }
[ "protected", "function", "createEntry", "(", ")", "{", "$", "entry", "=", "new", "Entry", "(", ")", ";", "$", "entry", "->", "setVisible", "(", "false", ")", "->", "setName", "(", "$", "this", "->", "name", ")", ";", "$", "this", "->", "setEntry", "(", "$", "entry", ")", ";", "return", "$", "entry", ";", "}" ]
Create the hidden Entry @return Entry
[ "Create", "the", "hidden", "Entry" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Components/ValuePicker.php#L202-L209
17,723
aedart/laravel-helpers
src/Traits/Session/SessionTrait.php
SessionTrait.getDefaultSession
public function getDefaultSession(): ?Session { // By default, the Session Facade does not return the // any actual session instance, but rather an // instance of \Illuminate\Session\SessionManager. // Therefore, we make sure only to obtain its // "driver", to make sure that its only the connection // instance that we obtain. $manager = SessionFacade::getFacadeRoot(); if (isset($manager)) { return $manager->driver(); } return $manager; }
php
public function getDefaultSession(): ?Session { // By default, the Session Facade does not return the // any actual session instance, but rather an // instance of \Illuminate\Session\SessionManager. // Therefore, we make sure only to obtain its // "driver", to make sure that its only the connection // instance that we obtain. $manager = SessionFacade::getFacadeRoot(); if (isset($manager)) { return $manager->driver(); } return $manager; }
[ "public", "function", "getDefaultSession", "(", ")", ":", "?", "Session", "{", "// By default, the Session Facade does not return the", "// any actual session instance, but rather an", "// instance of \\Illuminate\\Session\\SessionManager.", "// Therefore, we make sure only to obtain its", "// \"driver\", to make sure that its only the connection", "// instance that we obtain.", "$", "manager", "=", "SessionFacade", "::", "getFacadeRoot", "(", ")", ";", "if", "(", "isset", "(", "$", "manager", ")", ")", "{", "return", "$", "manager", "->", "driver", "(", ")", ";", "}", "return", "$", "manager", ";", "}" ]
Get a default session value, if any is available @return Session|null A default session value or Null if no default value is available
[ "Get", "a", "default", "session", "value", "if", "any", "is", "available" ]
8b81a2d6658f3f8cb62b6be2c34773aaa2df219a
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Session/SessionTrait.php#L76-L89
17,724
simple-php-mvc/simple-php-mvc
src/MVC/Provider/Provider.php
Provider.getOption
final public function getOption($name) { if (!isset($this->options[$name])) { throw new \LogicException(sprintf('The option "%s" don\'t exists.', $name)); } return $this->options[$name]; }
php
final public function getOption($name) { if (!isset($this->options[$name])) { throw new \LogicException(sprintf('The option "%s" don\'t exists.', $name)); } return $this->options[$name]; }
[ "final", "public", "function", "getOption", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "options", "[", "$", "name", "]", ")", ")", "{", "throw", "new", "\\", "LogicException", "(", "sprintf", "(", "'The option \"%s\" don\\'t exists.'", ",", "$", "name", ")", ")", ";", "}", "return", "$", "this", "->", "options", "[", "$", "name", "]", ";", "}" ]
Get option value from name @param string $name @return mixed @throws \LogicException
[ "Get", "option", "value", "from", "name" ]
e319eb09d29afad6993acb4a7e35f32a87dd0841
https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Provider/Provider.php#L61-L67
17,725
webforge-labs/psc-cms
lib/Psc/HTML/HTML.php
HTML.string2class
public static function string2class($stringValue) { // dirty hack: Psc\Code\Code::camelCase2dash benutzt dies hier: also aufpassen, bei großen Änderungen refactorn $stringValue = trim($stringValue); if ($stringValue === '') { return $stringValue; } if (Preg::match($stringValue, '/^[A-Z0-9]+$/')) { return mb_strtolower($stringValue); } $specials = preg_quote(implode("", array('.','@','\\',' ','[',']','(',')')), '/'); $stringValue = Preg::replace(// in $stringValue, // what sprintf('/%s|[%s]/', "(?<=\w)([A-Z]|[0-9])", $specials ), // with '-\\1' ); $stringValue = mb_strtolower($stringValue); return $stringValue; }
php
public static function string2class($stringValue) { // dirty hack: Psc\Code\Code::camelCase2dash benutzt dies hier: also aufpassen, bei großen Änderungen refactorn $stringValue = trim($stringValue); if ($stringValue === '') { return $stringValue; } if (Preg::match($stringValue, '/^[A-Z0-9]+$/')) { return mb_strtolower($stringValue); } $specials = preg_quote(implode("", array('.','@','\\',' ','[',']','(',')')), '/'); $stringValue = Preg::replace(// in $stringValue, // what sprintf('/%s|[%s]/', "(?<=\w)([A-Z]|[0-9])", $specials ), // with '-\\1' ); $stringValue = mb_strtolower($stringValue); return $stringValue; }
[ "public", "static", "function", "string2class", "(", "$", "stringValue", ")", "{", "// dirty hack: Psc\\Code\\Code::camelCase2dash benutzt dies hier: also aufpassen, bei großen Änderungen refactorn", "$", "stringValue", "=", "trim", "(", "$", "stringValue", ")", ";", "if", "(", "$", "stringValue", "===", "''", ")", "{", "return", "$", "stringValue", ";", "}", "if", "(", "Preg", "::", "match", "(", "$", "stringValue", ",", "'/^[A-Z0-9]+$/'", ")", ")", "{", "return", "mb_strtolower", "(", "$", "stringValue", ")", ";", "}", "$", "specials", "=", "preg_quote", "(", "implode", "(", "\"\"", ",", "array", "(", "'.'", ",", "'@'", ",", "'\\\\'", ",", "' '", ",", "'['", ",", "']'", ",", "'('", ",", "')'", ")", ")", ",", "'/'", ")", ";", "$", "stringValue", "=", "Preg", "::", "replace", "(", "// in", "$", "stringValue", ",", "// what", "sprintf", "(", "'/%s|[%s]/'", ",", "\"(?<=\\w)([A-Z]|[0-9])\"", ",", "$", "specials", ")", ",", "// with", "'-\\\\1'", ")", ";", "$", "stringValue", "=", "mb_strtolower", "(", "$", "stringValue", ")", ";", "return", "$", "stringValue", ";", "}" ]
Erstells aus einem CamelCase Namen oder einer Klasse oder einem String eine html-klasse
[ "Erstells", "aus", "einem", "CamelCase", "Namen", "oder", "einer", "Klasse", "oder", "einem", "String", "eine", "html", "-", "klasse" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/HTML/HTML.php#L37-L64
17,726
digitalkaoz/versioneye-php
src/Api/BaseApi.php
BaseApi.request
protected function request($url, $method = 'GET', array $params = []) { $url = $this->sanitizeQuery($url); $response = $this->client->request($method, $url, $params); if (is_array($response) && isset($response['paging'])) { $response = $this->injectPager($response, $method, $url, $params); } return $response; }
php
protected function request($url, $method = 'GET', array $params = []) { $url = $this->sanitizeQuery($url); $response = $this->client->request($method, $url, $params); if (is_array($response) && isset($response['paging'])) { $response = $this->injectPager($response, $method, $url, $params); } return $response; }
[ "protected", "function", "request", "(", "$", "url", ",", "$", "method", "=", "'GET'", ",", "array", "$", "params", "=", "[", "]", ")", "{", "$", "url", "=", "$", "this", "->", "sanitizeQuery", "(", "$", "url", ")", ";", "$", "response", "=", "$", "this", "->", "client", "->", "request", "(", "$", "method", ",", "$", "url", ",", "$", "params", ")", ";", "if", "(", "is_array", "(", "$", "response", ")", "&&", "isset", "(", "$", "response", "[", "'paging'", "]", ")", ")", "{", "$", "response", "=", "$", "this", "->", "injectPager", "(", "$", "response", ",", "$", "method", ",", "$", "url", ",", "$", "params", ")", ";", "}", "return", "$", "response", ";", "}" ]
performs the request. @param string $url @param string $method @param array $params @return array
[ "performs", "the", "request", "." ]
7b8eb9cdc83e01138dda0e709c07e3beb6aad136
https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/BaseApi.php#L37-L48
17,727
digitalkaoz/versioneye-php
src/Api/BaseApi.php
BaseApi.sanitizeQuery
private function sanitizeQuery($query) { $parts = parse_url($query); $path = $parts['path']; if (!isset($parts['query'])) { return $query; } $vars = explode('&', $parts['query']); $final = []; if (!empty($vars)) { foreach ($vars as $var) { $parts = explode('=', $var); $key = $parts[0]; $val = $parts[1]; if (!array_key_exists($key, $final) && !empty($val)) { $final[$key] = $val; } } } return $path . '?' . http_build_query($final); }
php
private function sanitizeQuery($query) { $parts = parse_url($query); $path = $parts['path']; if (!isset($parts['query'])) { return $query; } $vars = explode('&', $parts['query']); $final = []; if (!empty($vars)) { foreach ($vars as $var) { $parts = explode('=', $var); $key = $parts[0]; $val = $parts[1]; if (!array_key_exists($key, $final) && !empty($val)) { $final[$key] = $val; } } } return $path . '?' . http_build_query($final); }
[ "private", "function", "sanitizeQuery", "(", "$", "query", ")", "{", "$", "parts", "=", "parse_url", "(", "$", "query", ")", ";", "$", "path", "=", "$", "parts", "[", "'path'", "]", ";", "if", "(", "!", "isset", "(", "$", "parts", "[", "'query'", "]", ")", ")", "{", "return", "$", "query", ";", "}", "$", "vars", "=", "explode", "(", "'&'", ",", "$", "parts", "[", "'query'", "]", ")", ";", "$", "final", "=", "[", "]", ";", "if", "(", "!", "empty", "(", "$", "vars", ")", ")", "{", "foreach", "(", "$", "vars", "as", "$", "var", ")", "{", "$", "parts", "=", "explode", "(", "'='", ",", "$", "var", ")", ";", "$", "key", "=", "$", "parts", "[", "0", "]", ";", "$", "val", "=", "$", "parts", "[", "1", "]", ";", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "final", ")", "&&", "!", "empty", "(", "$", "val", ")", ")", "{", "$", "final", "[", "$", "key", "]", "=", "$", "val", ";", "}", "}", "}", "return", "$", "path", ".", "'?'", ".", "http_build_query", "(", "$", "final", ")", ";", "}" ]
removes empty query string parameters. @param string $query @return string
[ "removes", "empty", "query", "string", "parameters", "." ]
7b8eb9cdc83e01138dda0e709c07e3beb6aad136
https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/BaseApi.php#L69-L96
17,728
digitalkaoz/versioneye-php
src/Api/BaseApi.php
BaseApi.injectPager
private function injectPager(array $response, $method, $url, array $params = []) { while (next($response)) { if ('paging' === key($response)) { prev($response); break; } } $pageableKey = key($response); $response[$pageableKey] = new Pager($response, $pageableKey, $this->client, $method, $url, $params); reset($response); return $response; }
php
private function injectPager(array $response, $method, $url, array $params = []) { while (next($response)) { if ('paging' === key($response)) { prev($response); break; } } $pageableKey = key($response); $response[$pageableKey] = new Pager($response, $pageableKey, $this->client, $method, $url, $params); reset($response); return $response; }
[ "private", "function", "injectPager", "(", "array", "$", "response", ",", "$", "method", ",", "$", "url", ",", "array", "$", "params", "=", "[", "]", ")", "{", "while", "(", "next", "(", "$", "response", ")", ")", "{", "if", "(", "'paging'", "===", "key", "(", "$", "response", ")", ")", "{", "prev", "(", "$", "response", ")", ";", "break", ";", "}", "}", "$", "pageableKey", "=", "key", "(", "$", "response", ")", ";", "$", "response", "[", "$", "pageableKey", "]", "=", "new", "Pager", "(", "$", "response", ",", "$", "pageableKey", ",", "$", "this", "->", "client", ",", "$", "method", ",", "$", "url", ",", "$", "params", ")", ";", "reset", "(", "$", "response", ")", ";", "return", "$", "response", ";", "}" ]
converts the pageable data into a real pager. @param array $response @param string $method @param string $url @param array $params @return array
[ "converts", "the", "pageable", "data", "into", "a", "real", "pager", "." ]
7b8eb9cdc83e01138dda0e709c07e3beb6aad136
https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/BaseApi.php#L108-L124
17,729
terion-name/package-installer
src/Terion/PackageInstaller/ConfigUpdater.php
ConfigUpdater.addProvider
public function addProvider($provider) { if (!in_array($provider, $this->getServiceProviders())) { $quote = $this->getQuoteType('providers'); $separator = $this->getArrayItemsSeparator('providers'); $anchor = $this->getInsertPoint('providers'); $insert = $separator . $quote . $provider . $quote . ','; $this->write($insert, $anchor); } }
php
public function addProvider($provider) { if (!in_array($provider, $this->getServiceProviders())) { $quote = $this->getQuoteType('providers'); $separator = $this->getArrayItemsSeparator('providers'); $anchor = $this->getInsertPoint('providers'); $insert = $separator . $quote . $provider . $quote . ','; $this->write($insert, $anchor); } }
[ "public", "function", "addProvider", "(", "$", "provider", ")", "{", "if", "(", "!", "in_array", "(", "$", "provider", ",", "$", "this", "->", "getServiceProviders", "(", ")", ")", ")", "{", "$", "quote", "=", "$", "this", "->", "getQuoteType", "(", "'providers'", ")", ";", "$", "separator", "=", "$", "this", "->", "getArrayItemsSeparator", "(", "'providers'", ")", ";", "$", "anchor", "=", "$", "this", "->", "getInsertPoint", "(", "'providers'", ")", ";", "$", "insert", "=", "$", "separator", ".", "$", "quote", ".", "$", "provider", ".", "$", "quote", ".", "','", ";", "$", "this", "->", "write", "(", "$", "insert", ",", "$", "anchor", ")", ";", "}", "}" ]
Add specified provider. @param $provider
[ "Add", "specified", "provider", "." ]
a1f53085b0b5dbbcc308476f61188103051bd201
https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L110-L121
17,730
terion-name/package-installer
src/Terion/PackageInstaller/ConfigUpdater.php
ConfigUpdater.isCharInComment
protected function isCharInComment($haystack, $charPosition) { // check for line comment for ($c = $charPosition; $c > 0; --$c) { if ($haystack[$c] === PHP_EOL) { break; } elseif ($haystack[$c] === '#' or ($haystack[$c] === '/' and ($haystack[$c + 1] === '/' or $haystack[$c - 1] === '/')) ) { return true; } } // check for block comment $openingsCount = 0; $closingsCount = 0; for ($c = $charPosition; $c > 0; --$c) { if ($haystack[$c] === '*' and $haystack[$c - 1] === '/') { ++$openingsCount; } if ($haystack[$c] === '/' and $haystack[$c - 1] === '*') { ++$closingsCount; } } if ($openingsCount !== $closingsCount) { return true; } return false; }
php
protected function isCharInComment($haystack, $charPosition) { // check for line comment for ($c = $charPosition; $c > 0; --$c) { if ($haystack[$c] === PHP_EOL) { break; } elseif ($haystack[$c] === '#' or ($haystack[$c] === '/' and ($haystack[$c + 1] === '/' or $haystack[$c - 1] === '/')) ) { return true; } } // check for block comment $openingsCount = 0; $closingsCount = 0; for ($c = $charPosition; $c > 0; --$c) { if ($haystack[$c] === '*' and $haystack[$c - 1] === '/') { ++$openingsCount; } if ($haystack[$c] === '/' and $haystack[$c - 1] === '*') { ++$closingsCount; } } if ($openingsCount !== $closingsCount) { return true; } return false; }
[ "protected", "function", "isCharInComment", "(", "$", "haystack", ",", "$", "charPosition", ")", "{", "// check for line comment", "for", "(", "$", "c", "=", "$", "charPosition", ";", "$", "c", ">", "0", ";", "--", "$", "c", ")", "{", "if", "(", "$", "haystack", "[", "$", "c", "]", "===", "PHP_EOL", ")", "{", "break", ";", "}", "elseif", "(", "$", "haystack", "[", "$", "c", "]", "===", "'#'", "or", "(", "$", "haystack", "[", "$", "c", "]", "===", "'/'", "and", "(", "$", "haystack", "[", "$", "c", "+", "1", "]", "===", "'/'", "or", "$", "haystack", "[", "$", "c", "-", "1", "]", "===", "'/'", ")", ")", ")", "{", "return", "true", ";", "}", "}", "// check for block comment", "$", "openingsCount", "=", "0", ";", "$", "closingsCount", "=", "0", ";", "for", "(", "$", "c", "=", "$", "charPosition", ";", "$", "c", ">", "0", ";", "--", "$", "c", ")", "{", "if", "(", "$", "haystack", "[", "$", "c", "]", "===", "'*'", "and", "$", "haystack", "[", "$", "c", "-", "1", "]", "===", "'/'", ")", "{", "++", "$", "openingsCount", ";", "}", "if", "(", "$", "haystack", "[", "$", "c", "]", "===", "'/'", "and", "$", "haystack", "[", "$", "c", "-", "1", "]", "===", "'*'", ")", "{", "++", "$", "closingsCount", ";", "}", "}", "if", "(", "$", "openingsCount", "!==", "$", "closingsCount", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
Detect is character at specified position is inside of a comment @param $haystack @param $charPosition @return bool
[ "Detect", "is", "character", "at", "specified", "position", "is", "inside", "of", "a", "comment" ]
a1f53085b0b5dbbcc308476f61188103051bd201
https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L253-L280
17,731
terion-name/package-installer
src/Terion/PackageInstaller/ConfigUpdater.php
ConfigUpdater.backup
protected function backup() { $from = $this->configFile; $pathinfo = pathinfo($from); $to = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . $pathinfo['filename'] . '.bak.php'; $this->file->copy($from, $to); }
php
protected function backup() { $from = $this->configFile; $pathinfo = pathinfo($from); $to = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . $pathinfo['filename'] . '.bak.php'; $this->file->copy($from, $to); }
[ "protected", "function", "backup", "(", ")", "{", "$", "from", "=", "$", "this", "->", "configFile", ";", "$", "pathinfo", "=", "pathinfo", "(", "$", "from", ")", ";", "$", "to", "=", "$", "pathinfo", "[", "'dirname'", "]", ".", "DIRECTORY_SEPARATOR", ".", "$", "pathinfo", "[", "'filename'", "]", ".", "'.bak.php'", ";", "$", "this", "->", "file", "->", "copy", "(", "$", "from", ",", "$", "to", ")", ";", "}" ]
Backup config file
[ "Backup", "config", "file" ]
a1f53085b0b5dbbcc308476f61188103051bd201
https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L303-L309
17,732
terion-name/package-installer
src/Terion/PackageInstaller/ConfigUpdater.php
ConfigUpdater.addAlias
public function addAlias($alias, $facade) { if ($facadeCurrent = array_get($this->getAliases(), $alias)) { if ($facadeCurrent === $facade) { return; } $this->commentOut($alias, 'aliases'); } $quote = $this->getQuoteType('aliases'); $separator = $this->getArrayItemsSeparator('aliases'); $anchor = $this->getInsertPoint('aliases'); $insert = $separator . $quote . $alias . $quote . ' => ' . $quote . $facade . $quote . ','; $this->write($insert, $anchor); }
php
public function addAlias($alias, $facade) { if ($facadeCurrent = array_get($this->getAliases(), $alias)) { if ($facadeCurrent === $facade) { return; } $this->commentOut($alias, 'aliases'); } $quote = $this->getQuoteType('aliases'); $separator = $this->getArrayItemsSeparator('aliases'); $anchor = $this->getInsertPoint('aliases'); $insert = $separator . $quote . $alias . $quote . ' => ' . $quote . $facade . $quote . ','; $this->write($insert, $anchor); }
[ "public", "function", "addAlias", "(", "$", "alias", ",", "$", "facade", ")", "{", "if", "(", "$", "facadeCurrent", "=", "array_get", "(", "$", "this", "->", "getAliases", "(", ")", ",", "$", "alias", ")", ")", "{", "if", "(", "$", "facadeCurrent", "===", "$", "facade", ")", "{", "return", ";", "}", "$", "this", "->", "commentOut", "(", "$", "alias", ",", "'aliases'", ")", ";", "}", "$", "quote", "=", "$", "this", "->", "getQuoteType", "(", "'aliases'", ")", ";", "$", "separator", "=", "$", "this", "->", "getArrayItemsSeparator", "(", "'aliases'", ")", ";", "$", "anchor", "=", "$", "this", "->", "getInsertPoint", "(", "'aliases'", ")", ";", "$", "insert", "=", "$", "separator", ".", "$", "quote", ".", "$", "alias", ".", "$", "quote", ".", "' => '", ".", "$", "quote", ".", "$", "facade", ".", "$", "quote", ".", "','", ";", "$", "this", "->", "write", "(", "$", "insert", ",", "$", "anchor", ")", ";", "}" ]
Add specified facade. @param $alias @param $facade
[ "Add", "specified", "facade", "." ]
a1f53085b0b5dbbcc308476f61188103051bd201
https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L327-L343
17,733
nodes-php/database
src/Support/Traits/Date.php
Date.getDateHumanReadable
public function getDateHumanReadable($column, $format = 'd-m-Y H:i:s', $maxDays = 3) { // Retrieve value of column $date = $this->{$column}; // Make sure date is a Carbon object // otherwise just return untouched value if (! $date instanceof Carbon) { return $column; } // If date is older than $maxDays // we'll return the date and time $daysDifference = $date->diffInDays(); if ($daysDifference > $maxDays) { return $date->format($format); } return $date->diffForHumans(); }
php
public function getDateHumanReadable($column, $format = 'd-m-Y H:i:s', $maxDays = 3) { // Retrieve value of column $date = $this->{$column}; // Make sure date is a Carbon object // otherwise just return untouched value if (! $date instanceof Carbon) { return $column; } // If date is older than $maxDays // we'll return the date and time $daysDifference = $date->diffInDays(); if ($daysDifference > $maxDays) { return $date->format($format); } return $date->diffForHumans(); }
[ "public", "function", "getDateHumanReadable", "(", "$", "column", ",", "$", "format", "=", "'d-m-Y H:i:s'", ",", "$", "maxDays", "=", "3", ")", "{", "// Retrieve value of column", "$", "date", "=", "$", "this", "->", "{", "$", "column", "}", ";", "// Make sure date is a Carbon object", "// otherwise just return untouched value", "if", "(", "!", "$", "date", "instanceof", "Carbon", ")", "{", "return", "$", "column", ";", "}", "// If date is older than $maxDays", "// we'll return the date and time", "$", "daysDifference", "=", "$", "date", "->", "diffInDays", "(", ")", ";", "if", "(", "$", "daysDifference", ">", "$", "maxDays", ")", "{", "return", "$", "date", "->", "format", "(", "$", "format", ")", ";", "}", "return", "$", "date", "->", "diffForHumans", "(", ")", ";", "}" ]
Convert date to human-readable E.g. "2 hours ago". @author Morten Rugaard <[email protected]> @date 21-10-2015 @param string $column @param string $format @param int $maxDays @return string
[ "Convert", "date", "to", "human", "-", "readable", "E", ".", "g", ".", "2", "hours", "ago", "." ]
ec58a01a2b966f89efeac58ac9ac633919c04a52
https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Support/Traits/Date.php#L26-L45
17,734
webforge-labs/psc-cms
lib/Psc/CMS/Controller/ContentStreamController.php
ContentStreamController.prepareFor
public function prepareFor(ContentStreamAware $entity, $type, $locale, $revision = 'default', $save = TRUE) { try { $contentStream = $entity->getContentStream() ->locale($locale) ->type($type) ->revision($revision) ->one() ; } catch (NoContentStreamsFoundException $e) { $contentStream = $this->createEmptyEntity($revision) ->setLocale($locale) ->setRevision($revision) ->setType($type); $entity->addContentStream($contentStream); if ($save) { $this->repository->save($contentStream); $this->repository->persist($entity); } } return $contentStream; }
php
public function prepareFor(ContentStreamAware $entity, $type, $locale, $revision = 'default', $save = TRUE) { try { $contentStream = $entity->getContentStream() ->locale($locale) ->type($type) ->revision($revision) ->one() ; } catch (NoContentStreamsFoundException $e) { $contentStream = $this->createEmptyEntity($revision) ->setLocale($locale) ->setRevision($revision) ->setType($type); $entity->addContentStream($contentStream); if ($save) { $this->repository->save($contentStream); $this->repository->persist($entity); } } return $contentStream; }
[ "public", "function", "prepareFor", "(", "ContentStreamAware", "$", "entity", ",", "$", "type", ",", "$", "locale", ",", "$", "revision", "=", "'default'", ",", "$", "save", "=", "TRUE", ")", "{", "try", "{", "$", "contentStream", "=", "$", "entity", "->", "getContentStream", "(", ")", "->", "locale", "(", "$", "locale", ")", "->", "type", "(", "$", "type", ")", "->", "revision", "(", "$", "revision", ")", "->", "one", "(", ")", ";", "}", "catch", "(", "NoContentStreamsFoundException", "$", "e", ")", "{", "$", "contentStream", "=", "$", "this", "->", "createEmptyEntity", "(", "$", "revision", ")", "->", "setLocale", "(", "$", "locale", ")", "->", "setRevision", "(", "$", "revision", ")", "->", "setType", "(", "$", "type", ")", ";", "$", "entity", "->", "addContentStream", "(", "$", "contentStream", ")", ";", "if", "(", "$", "save", ")", "{", "$", "this", "->", "repository", "->", "save", "(", "$", "contentStream", ")", ";", "$", "this", "->", "repository", "->", "persist", "(", "$", "entity", ")", ";", "}", "}", "return", "$", "contentStream", ";", "}" ]
Adds or returns a new ContentStream for the entity @param bool $save per default the new contentStream (if created) is persisted and the em is flushed(!) @return ContentStream (created or fetched from db)
[ "Adds", "or", "returns", "a", "new", "ContentStream", "for", "the", "entity" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/ContentStreamController.php#L147-L173
17,735
webforge-labs/psc-cms
lib/Psc/Data/ArrayCollection.php
ArrayCollection.isSame
public function isSame(Collection $collection, $compareFunction) { // ungleiche Anzahl ist nie gleich => fastcheck if (count($this) !== count($collection)) return FALSE; // Anzahl ist gleich, d. h. es sollte keine Elemente geben, die an einem Index nicht dem anderen Array identisch sind $compareFunction = $this->compileCompareFunction($compareFunction); foreach ($this as $key => $element) { if (($otherElement = $collection->get($key)) === NULL) { return FALSE; } if ($compareFunction($element, $otherElement) !== 0) { return FALSE; } } return TRUE; }
php
public function isSame(Collection $collection, $compareFunction) { // ungleiche Anzahl ist nie gleich => fastcheck if (count($this) !== count($collection)) return FALSE; // Anzahl ist gleich, d. h. es sollte keine Elemente geben, die an einem Index nicht dem anderen Array identisch sind $compareFunction = $this->compileCompareFunction($compareFunction); foreach ($this as $key => $element) { if (($otherElement = $collection->get($key)) === NULL) { return FALSE; } if ($compareFunction($element, $otherElement) !== 0) { return FALSE; } } return TRUE; }
[ "public", "function", "isSame", "(", "Collection", "$", "collection", ",", "$", "compareFunction", ")", "{", "// ungleiche Anzahl ist nie gleich => fastcheck", "if", "(", "count", "(", "$", "this", ")", "!==", "count", "(", "$", "collection", ")", ")", "return", "FALSE", ";", "// Anzahl ist gleich, d. h. es sollte keine Elemente geben, die an einem Index nicht dem anderen Array identisch sind", "$", "compareFunction", "=", "$", "this", "->", "compileCompareFunction", "(", "$", "compareFunction", ")", ";", "foreach", "(", "$", "this", "as", "$", "key", "=>", "$", "element", ")", "{", "if", "(", "(", "$", "otherElement", "=", "$", "collection", "->", "get", "(", "$", "key", ")", ")", "===", "NULL", ")", "{", "return", "FALSE", ";", "}", "if", "(", "$", "compareFunction", "(", "$", "element", ",", "$", "otherElement", ")", "!==", "0", ")", "{", "return", "FALSE", ";", "}", "}", "return", "TRUE", ";", "}" ]
Vergleicht die Collections auf identische Inhalte Die Inhalte 2er Collections sind identisch, für alle Elemente an der Position $x der collections gilt: $compareFunction($this[$x], $collection[$x]) === 0 die angegebene $compareFunction kann unabhängig von einer Reihenfolge der Elemente sein. (nur Ausgabe === 0 ist wichtig) @return bool
[ "Vergleicht", "die", "Collections", "auf", "identische", "Inhalte" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/ArrayCollection.php#L153-L171
17,736
webforge-labs/psc-cms
lib/Psc/Data/ArrayCollection.php
ArrayCollection.isEqual
public function isEqual(Collection $collection, $compareFunction) { // ungleiche Anzahl ist nie gleich => fastcheck if (count($this) !== count($collection)) return FALSE; if (count($this->insertDiff($collection, $compareFunction)) > 0) return FALSE; if (count($this->deleteDiff($collection, $compareFunction)) > 0) return FALSE; return TRUE; }
php
public function isEqual(Collection $collection, $compareFunction) { // ungleiche Anzahl ist nie gleich => fastcheck if (count($this) !== count($collection)) return FALSE; if (count($this->insertDiff($collection, $compareFunction)) > 0) return FALSE; if (count($this->deleteDiff($collection, $compareFunction)) > 0) return FALSE; return TRUE; }
[ "public", "function", "isEqual", "(", "Collection", "$", "collection", ",", "$", "compareFunction", ")", "{", "// ungleiche Anzahl ist nie gleich => fastcheck", "if", "(", "count", "(", "$", "this", ")", "!==", "count", "(", "$", "collection", ")", ")", "return", "FALSE", ";", "if", "(", "count", "(", "$", "this", "->", "insertDiff", "(", "$", "collection", ",", "$", "compareFunction", ")", ")", ">", "0", ")", "return", "FALSE", ";", "if", "(", "count", "(", "$", "this", "->", "deleteDiff", "(", "$", "collection", ",", "$", "compareFunction", ")", ")", ">", "0", ")", "return", "FALSE", ";", "return", "TRUE", ";", "}" ]
Vergleicht die Inhalte zweier Collections die Schlüssel der Elemente sind nicht relevant (anders als bei isSame) @return bool
[ "Vergleicht", "die", "Inhalte", "zweier", "Collections" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/ArrayCollection.php#L179-L187
17,737
webforge-labs/psc-cms
lib/Psc/CMS/Controller/ExcelController.php
ExcelController.convert
public function convert(\stdClass $table, $excelFile = NULL, $removeEmpty = TRUE) { $excelFile = $excelFile ?: $this->v->validateUploadedFile('excelFile'); $reader = PHPExcel_IOFactory::createReaderForFile((string) $excelFile); $excel = $reader->load((string) $excelFile); $sheet = $excel->getSheet(0); $columns = isset($table->columns) ? (array) $table->columns : array(); $nullValue = ''; // sadly json macht aus NULL den string "null" in js $data = array(); $mCell = 0; foreach ($sheet->getRowIterator() as $wsRow) { $row = array(); $empty = TRUE; foreach ($wsRow->getCellIterator() as $cell) { // $cell->getDataType() gibts sogar auch $cellIndex = h::getColumnIndex($cell->getColumn()); $mCell = max($mCell, $cellIndex+1); $row[$cellIndex] = $value = $this->convertValue( $cell->getValue(), isset($columns[$cellIndex]) && isset($columns[$cellIndex]->type) ? $columns[$cellIndex]->type : NULL ); if ($value != '') { $empty = FALSE; } } if (!$removeEmpty || !$empty) { ksort($row); $data[] = array_replace(array_fill(0, $mCell, $nullValue), $row); } } return new ServiceResponse(Service::OK, $data, ServiceResponse::JSON_UPLOAD_RESPONSE); }
php
public function convert(\stdClass $table, $excelFile = NULL, $removeEmpty = TRUE) { $excelFile = $excelFile ?: $this->v->validateUploadedFile('excelFile'); $reader = PHPExcel_IOFactory::createReaderForFile((string) $excelFile); $excel = $reader->load((string) $excelFile); $sheet = $excel->getSheet(0); $columns = isset($table->columns) ? (array) $table->columns : array(); $nullValue = ''; // sadly json macht aus NULL den string "null" in js $data = array(); $mCell = 0; foreach ($sheet->getRowIterator() as $wsRow) { $row = array(); $empty = TRUE; foreach ($wsRow->getCellIterator() as $cell) { // $cell->getDataType() gibts sogar auch $cellIndex = h::getColumnIndex($cell->getColumn()); $mCell = max($mCell, $cellIndex+1); $row[$cellIndex] = $value = $this->convertValue( $cell->getValue(), isset($columns[$cellIndex]) && isset($columns[$cellIndex]->type) ? $columns[$cellIndex]->type : NULL ); if ($value != '') { $empty = FALSE; } } if (!$removeEmpty || !$empty) { ksort($row); $data[] = array_replace(array_fill(0, $mCell, $nullValue), $row); } } return new ServiceResponse(Service::OK, $data, ServiceResponse::JSON_UPLOAD_RESPONSE); }
[ "public", "function", "convert", "(", "\\", "stdClass", "$", "table", ",", "$", "excelFile", "=", "NULL", ",", "$", "removeEmpty", "=", "TRUE", ")", "{", "$", "excelFile", "=", "$", "excelFile", "?", ":", "$", "this", "->", "v", "->", "validateUploadedFile", "(", "'excelFile'", ")", ";", "$", "reader", "=", "PHPExcel_IOFactory", "::", "createReaderForFile", "(", "(", "string", ")", "$", "excelFile", ")", ";", "$", "excel", "=", "$", "reader", "->", "load", "(", "(", "string", ")", "$", "excelFile", ")", ";", "$", "sheet", "=", "$", "excel", "->", "getSheet", "(", "0", ")", ";", "$", "columns", "=", "isset", "(", "$", "table", "->", "columns", ")", "?", "(", "array", ")", "$", "table", "->", "columns", ":", "array", "(", ")", ";", "$", "nullValue", "=", "''", ";", "// sadly json macht aus NULL den string \"null\" in js", "$", "data", "=", "array", "(", ")", ";", "$", "mCell", "=", "0", ";", "foreach", "(", "$", "sheet", "->", "getRowIterator", "(", ")", "as", "$", "wsRow", ")", "{", "$", "row", "=", "array", "(", ")", ";", "$", "empty", "=", "TRUE", ";", "foreach", "(", "$", "wsRow", "->", "getCellIterator", "(", ")", "as", "$", "cell", ")", "{", "// $cell->getDataType() gibts sogar auch", "$", "cellIndex", "=", "h", "::", "getColumnIndex", "(", "$", "cell", "->", "getColumn", "(", ")", ")", ";", "$", "mCell", "=", "max", "(", "$", "mCell", ",", "$", "cellIndex", "+", "1", ")", ";", "$", "row", "[", "$", "cellIndex", "]", "=", "$", "value", "=", "$", "this", "->", "convertValue", "(", "$", "cell", "->", "getValue", "(", ")", ",", "isset", "(", "$", "columns", "[", "$", "cellIndex", "]", ")", "&&", "isset", "(", "$", "columns", "[", "$", "cellIndex", "]", "->", "type", ")", "?", "$", "columns", "[", "$", "cellIndex", "]", "->", "type", ":", "NULL", ")", ";", "if", "(", "$", "value", "!=", "''", ")", "{", "$", "empty", "=", "FALSE", ";", "}", "}", "if", "(", "!", "$", "removeEmpty", "||", "!", "$", "empty", ")", "{", "ksort", "(", "$", "row", ")", ";", "$", "data", "[", "]", "=", "array_replace", "(", "array_fill", "(", "0", ",", "$", "mCell", ",", "$", "nullValue", ")", ",", "$", "row", ")", ";", "}", "}", "return", "new", "ServiceResponse", "(", "Service", "::", "OK", ",", "$", "data", ",", "ServiceResponse", "::", "JSON_UPLOAD_RESPONSE", ")", ";", "}" ]
Konvertiert ein Excel in einen Array Erwartet excelFile als Uploaded File der zurückgegebene Array hat jedoch keine Zahlen Columns sondern auch einen 0 basierten index auch die Rows sind 0 basierend @controller-api @return array
[ "Konvertiert", "ein", "Excel", "in", "einen", "Array" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/ExcelController.php#L95-L132
17,738
picamator/CacheManager
src/Data/SearchCriteriaBuilder.php
SearchCriteriaBuilder.cleanData
private function cleanData() { foreach ($this->data as &$item) { $item = is_array($item) ? [] : null; } unset($item); // prevent unexpected behaviour }
php
private function cleanData() { foreach ($this->data as &$item) { $item = is_array($item) ? [] : null; } unset($item); // prevent unexpected behaviour }
[ "private", "function", "cleanData", "(", ")", "{", "foreach", "(", "$", "this", "->", "data", "as", "&", "$", "item", ")", "{", "$", "item", "=", "is_array", "(", "$", "item", ")", "?", "[", "]", ":", "null", ";", "}", "unset", "(", "$", "item", ")", ";", "// prevent unexpected behaviour", "}" ]
Clean data.
[ "Clean", "data", "." ]
5e5493910610b65ae31a362786d7963ba3e33806
https://github.com/picamator/CacheManager/blob/5e5493910610b65ae31a362786d7963ba3e33806/src/Data/SearchCriteriaBuilder.php#L116-L122
17,739
jacobemerick/pqp
src/PhpQuickProfiler.php
PhpQuickProfiler.gatherFileData
public function gatherFileData() { $files = get_included_files(); $data = array(); foreach ($files as $file) { array_push($data, array( 'name' => $file, 'size' => filesize($file) )); } return $data; }
php
public function gatherFileData() { $files = get_included_files(); $data = array(); foreach ($files as $file) { array_push($data, array( 'name' => $file, 'size' => filesize($file) )); } return $data; }
[ "public", "function", "gatherFileData", "(", ")", "{", "$", "files", "=", "get_included_files", "(", ")", ";", "$", "data", "=", "array", "(", ")", ";", "foreach", "(", "$", "files", "as", "$", "file", ")", "{", "array_push", "(", "$", "data", ",", "array", "(", "'name'", "=>", "$", "file", ",", "'size'", "=>", "filesize", "(", "$", "file", ")", ")", ")", ";", "}", "return", "$", "data", ";", "}" ]
Get data about files loaded for the application to current point @returns array
[ "Get", "data", "about", "files", "loaded", "for", "the", "application", "to", "current", "point" ]
08276f050425d1ab71e7ca3b897eb8c409ccbe70
https://github.com/jacobemerick/pqp/blob/08276f050425d1ab71e7ca3b897eb8c409ccbe70/src/PhpQuickProfiler.php#L64-L75
17,740
jacobemerick/pqp
src/PhpQuickProfiler.php
PhpQuickProfiler.gatherQueryData
public function gatherQueryData($dbConnection = null) { if (is_null($dbConnection)) { return array(); } if (empty($this->profiledQueries) && property_exists($dbConnection, 'queries')) { $this->setProfiledQueries($dbConnection->queries); } $data = array(); foreach ($this->profiledQueries as $query) { array_push($data, array( 'sql' => $query['sql'], 'explain' => $this->explainQuery($dbConnection, $query['sql'], $query['parameters']), 'time' => $query['time'] )); } return $data; }
php
public function gatherQueryData($dbConnection = null) { if (is_null($dbConnection)) { return array(); } if (empty($this->profiledQueries) && property_exists($dbConnection, 'queries')) { $this->setProfiledQueries($dbConnection->queries); } $data = array(); foreach ($this->profiledQueries as $query) { array_push($data, array( 'sql' => $query['sql'], 'explain' => $this->explainQuery($dbConnection, $query['sql'], $query['parameters']), 'time' => $query['time'] )); } return $data; }
[ "public", "function", "gatherQueryData", "(", "$", "dbConnection", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "dbConnection", ")", ")", "{", "return", "array", "(", ")", ";", "}", "if", "(", "empty", "(", "$", "this", "->", "profiledQueries", ")", "&&", "property_exists", "(", "$", "dbConnection", ",", "'queries'", ")", ")", "{", "$", "this", "->", "setProfiledQueries", "(", "$", "dbConnection", "->", "queries", ")", ";", "}", "$", "data", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "profiledQueries", "as", "$", "query", ")", "{", "array_push", "(", "$", "data", ",", "array", "(", "'sql'", "=>", "$", "query", "[", "'sql'", "]", ",", "'explain'", "=>", "$", "this", "->", "explainQuery", "(", "$", "dbConnection", ",", "$", "query", "[", "'sql'", "]", ",", "$", "query", "[", "'parameters'", "]", ")", ",", "'time'", "=>", "$", "query", "[", "'time'", "]", ")", ")", ";", "}", "return", "$", "data", ";", "}" ]
Get data about sql usage of the application @param object $dbConnection @returns array
[ "Get", "data", "about", "sql", "usage", "of", "the", "application" ]
08276f050425d1ab71e7ca3b897eb8c409ccbe70
https://github.com/jacobemerick/pqp/blob/08276f050425d1ab71e7ca3b897eb8c409ccbe70/src/PhpQuickProfiler.php#L106-L125
17,741
jacobemerick/pqp
src/PhpQuickProfiler.php
PhpQuickProfiler.explainQuery
protected function explainQuery($dbConnection, $query, $parameters = array()) { $driver = $dbConnection->getAttribute(\PDO::ATTR_DRIVER_NAME); $query = $this->getExplainQuery($query, $driver); $statement = $dbConnection->prepare($query); if ($statement === false) { throw new Exception('Invalid query passed to explainQuery method'); } $statement->execute($parameters); $result = $statement->fetch(\PDO::FETCH_ASSOC); if ($result === false) { throw new Exception('Query could not be explained with given parameters'); } return $result; }
php
protected function explainQuery($dbConnection, $query, $parameters = array()) { $driver = $dbConnection->getAttribute(\PDO::ATTR_DRIVER_NAME); $query = $this->getExplainQuery($query, $driver); $statement = $dbConnection->prepare($query); if ($statement === false) { throw new Exception('Invalid query passed to explainQuery method'); } $statement->execute($parameters); $result = $statement->fetch(\PDO::FETCH_ASSOC); if ($result === false) { throw new Exception('Query could not be explained with given parameters'); } return $result; }
[ "protected", "function", "explainQuery", "(", "$", "dbConnection", ",", "$", "query", ",", "$", "parameters", "=", "array", "(", ")", ")", "{", "$", "driver", "=", "$", "dbConnection", "->", "getAttribute", "(", "\\", "PDO", "::", "ATTR_DRIVER_NAME", ")", ";", "$", "query", "=", "$", "this", "->", "getExplainQuery", "(", "$", "query", ",", "$", "driver", ")", ";", "$", "statement", "=", "$", "dbConnection", "->", "prepare", "(", "$", "query", ")", ";", "if", "(", "$", "statement", "===", "false", ")", "{", "throw", "new", "Exception", "(", "'Invalid query passed to explainQuery method'", ")", ";", "}", "$", "statement", "->", "execute", "(", "$", "parameters", ")", ";", "$", "result", "=", "$", "statement", "->", "fetch", "(", "\\", "PDO", "::", "FETCH_ASSOC", ")", ";", "if", "(", "$", "result", "===", "false", ")", "{", "throw", "new", "Exception", "(", "'Query could not be explained with given parameters'", ")", ";", "}", "return", "$", "result", ";", "}" ]
Attempts to explain a query @param object $dbConnection @param string $query @param array $parameters @throws Exception @return array
[ "Attempts", "to", "explain", "a", "query" ]
08276f050425d1ab71e7ca3b897eb8c409ccbe70
https://github.com/jacobemerick/pqp/blob/08276f050425d1ab71e7ca3b897eb8c409ccbe70/src/PhpQuickProfiler.php#L136-L150
17,742
jacobemerick/pqp
src/PhpQuickProfiler.php
PhpQuickProfiler.gatherSpeedData
public function gatherSpeedData() { $elapsedTime = microtime(true) - $this->startTime; $elapsedTime = round($elapsedTime, 3); $allowedTime = ini_get('max_execution_time'); return array( 'elapsed' => $elapsedTime, 'allowed' => $allowedTime ); }
php
public function gatherSpeedData() { $elapsedTime = microtime(true) - $this->startTime; $elapsedTime = round($elapsedTime, 3); $allowedTime = ini_get('max_execution_time'); return array( 'elapsed' => $elapsedTime, 'allowed' => $allowedTime ); }
[ "public", "function", "gatherSpeedData", "(", ")", "{", "$", "elapsedTime", "=", "microtime", "(", "true", ")", "-", "$", "this", "->", "startTime", ";", "$", "elapsedTime", "=", "round", "(", "$", "elapsedTime", ",", "3", ")", ";", "$", "allowedTime", "=", "ini_get", "(", "'max_execution_time'", ")", ";", "return", "array", "(", "'elapsed'", "=>", "$", "elapsedTime", ",", "'allowed'", "=>", "$", "allowedTime", ")", ";", "}" ]
Get data about speed of the application @returns array
[ "Get", "data", "about", "speed", "of", "the", "application" ]
08276f050425d1ab71e7ca3b897eb8c409ccbe70
https://github.com/jacobemerick/pqp/blob/08276f050425d1ab71e7ca3b897eb8c409ccbe70/src/PhpQuickProfiler.php#L175-L184
17,743
jacobemerick/pqp
src/PhpQuickProfiler.php
PhpQuickProfiler.display
public function display($dbConnection = null) { if (!isset($this->display)) { throw new Exception('Display object has not been injected into Profiler'); } if (!isset($this->console)) { throw new Exception('Console object has not been injected into Profiler'); } $this->display->setStartTime($this->startTime); $this->display->setConsole($this->console); $this->display->setFileData($this->gatherFileData()); $this->display->setMemoryData($this->gatherMemoryData()); $this->display->setQueryData($this->gatherQueryData($dbConnection)); $this->display->setSpeedData($this->gatherSpeedData()); $this->display->__invoke(); }
php
public function display($dbConnection = null) { if (!isset($this->display)) { throw new Exception('Display object has not been injected into Profiler'); } if (!isset($this->console)) { throw new Exception('Console object has not been injected into Profiler'); } $this->display->setStartTime($this->startTime); $this->display->setConsole($this->console); $this->display->setFileData($this->gatherFileData()); $this->display->setMemoryData($this->gatherMemoryData()); $this->display->setQueryData($this->gatherQueryData($dbConnection)); $this->display->setSpeedData($this->gatherSpeedData()); $this->display->__invoke(); }
[ "public", "function", "display", "(", "$", "dbConnection", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "display", ")", ")", "{", "throw", "new", "Exception", "(", "'Display object has not been injected into Profiler'", ")", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "console", ")", ")", "{", "throw", "new", "Exception", "(", "'Console object has not been injected into Profiler'", ")", ";", "}", "$", "this", "->", "display", "->", "setStartTime", "(", "$", "this", "->", "startTime", ")", ";", "$", "this", "->", "display", "->", "setConsole", "(", "$", "this", "->", "console", ")", ";", "$", "this", "->", "display", "->", "setFileData", "(", "$", "this", "->", "gatherFileData", "(", ")", ")", ";", "$", "this", "->", "display", "->", "setMemoryData", "(", "$", "this", "->", "gatherMemoryData", "(", ")", ")", ";", "$", "this", "->", "display", "->", "setQueryData", "(", "$", "this", "->", "gatherQueryData", "(", "$", "dbConnection", ")", ")", ";", "$", "this", "->", "display", "->", "setSpeedData", "(", "$", "this", "->", "gatherSpeedData", "(", ")", ")", ";", "$", "this", "->", "display", "->", "__invoke", "(", ")", ";", "}" ]
Triggers end display of the profiling data @param object $dbConnection @throws Exception
[ "Triggers", "end", "display", "of", "the", "profiling", "data" ]
08276f050425d1ab71e7ca3b897eb8c409ccbe70
https://github.com/jacobemerick/pqp/blob/08276f050425d1ab71e7ca3b897eb8c409ccbe70/src/PhpQuickProfiler.php#L192-L209
17,744
nyeholt/silverstripe-external-content
thirdparty/Zend/Http/Response.php
Zend_Http_Response.getHeader
public function getHeader($header) { $header = ucwords(strtolower($header)); if (! is_string($header) || ! isset($this->headers[$header])) return null; return $this->headers[$header]; }
php
public function getHeader($header) { $header = ucwords(strtolower($header)); if (! is_string($header) || ! isset($this->headers[$header])) return null; return $this->headers[$header]; }
[ "public", "function", "getHeader", "(", "$", "header", ")", "{", "$", "header", "=", "ucwords", "(", "strtolower", "(", "$", "header", ")", ")", ";", "if", "(", "!", "is_string", "(", "$", "header", ")", "||", "!", "isset", "(", "$", "this", "->", "headers", "[", "$", "header", "]", ")", ")", "return", "null", ";", "return", "$", "this", "->", "headers", "[", "$", "header", "]", ";", "}" ]
Get a specific header as string, or null if it is not set @param string$header @return string|array|null
[ "Get", "a", "specific", "header", "as", "string", "or", "null", "if", "it", "is", "not", "set" ]
1c6da8c56ef717225ff904e1522aff94ed051601
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Http/Response.php#L350-L356
17,745
nyeholt/silverstripe-external-content
thirdparty/Zend/Http/Response.php
Zend_Http_Response.getHeadersAsString
public function getHeadersAsString($status_line = true, $br = "\n") { $str = ''; if ($status_line) { $str = "HTTP/{$this->version} {$this->code} {$this->message}{$br}"; } // Iterate over the headers and stringify them foreach ($this->headers as $name => $value) { if (is_string($value)) $str .= "{$name}: {$value}{$br}"; elseif (is_array($value)) { foreach ($value as $subval) { $str .= "{$name}: {$subval}{$br}"; } } } return $str; }
php
public function getHeadersAsString($status_line = true, $br = "\n") { $str = ''; if ($status_line) { $str = "HTTP/{$this->version} {$this->code} {$this->message}{$br}"; } // Iterate over the headers and stringify them foreach ($this->headers as $name => $value) { if (is_string($value)) $str .= "{$name}: {$value}{$br}"; elseif (is_array($value)) { foreach ($value as $subval) { $str .= "{$name}: {$subval}{$br}"; } } } return $str; }
[ "public", "function", "getHeadersAsString", "(", "$", "status_line", "=", "true", ",", "$", "br", "=", "\"\\n\"", ")", "{", "$", "str", "=", "''", ";", "if", "(", "$", "status_line", ")", "{", "$", "str", "=", "\"HTTP/{$this->version} {$this->code} {$this->message}{$br}\"", ";", "}", "// Iterate over the headers and stringify them", "foreach", "(", "$", "this", "->", "headers", "as", "$", "name", "=>", "$", "value", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", ")", "$", "str", ".=", "\"{$name}: {$value}{$br}\"", ";", "elseif", "(", "is_array", "(", "$", "value", ")", ")", "{", "foreach", "(", "$", "value", "as", "$", "subval", ")", "{", "$", "str", ".=", "\"{$name}: {$subval}{$br}\"", ";", "}", "}", "}", "return", "$", "str", ";", "}" ]
Get all headers as string @param boolean $status_line Whether to return the first status line (IE "HTTP 200 OK") @param string $br Line breaks (eg. "\n", "\r\n", "<br />") @return string
[ "Get", "all", "headers", "as", "string" ]
1c6da8c56ef717225ff904e1522aff94ed051601
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Http/Response.php#L365-L387
17,746
ClanCats/Core
src/classes/CCError/Inspector.php
CCError_Inspector.trace
public function trace( $add_self = false ) { if ( is_null( $this->trace ) ) { $this->trace = array(); if ( $add_self ) { $this->trace[] = new CCError_Trace( array( 'file' => $this->exception->getFile(), 'line' => $this->exception->getLine(), 'class' => $this->exception_name(), )); } foreach( $this->exception->getTrace() as $trace ) { $this->trace[] = new CCError_Trace( $trace ); } } return $this->trace; }
php
public function trace( $add_self = false ) { if ( is_null( $this->trace ) ) { $this->trace = array(); if ( $add_self ) { $this->trace[] = new CCError_Trace( array( 'file' => $this->exception->getFile(), 'line' => $this->exception->getLine(), 'class' => $this->exception_name(), )); } foreach( $this->exception->getTrace() as $trace ) { $this->trace[] = new CCError_Trace( $trace ); } } return $this->trace; }
[ "public", "function", "trace", "(", "$", "add_self", "=", "false", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "trace", ")", ")", "{", "$", "this", "->", "trace", "=", "array", "(", ")", ";", "if", "(", "$", "add_self", ")", "{", "$", "this", "->", "trace", "[", "]", "=", "new", "CCError_Trace", "(", "array", "(", "'file'", "=>", "$", "this", "->", "exception", "->", "getFile", "(", ")", ",", "'line'", "=>", "$", "this", "->", "exception", "->", "getLine", "(", ")", ",", "'class'", "=>", "$", "this", "->", "exception_name", "(", ")", ",", ")", ")", ";", "}", "foreach", "(", "$", "this", "->", "exception", "->", "getTrace", "(", ")", "as", "$", "trace", ")", "{", "$", "this", "->", "trace", "[", "]", "=", "new", "CCError_Trace", "(", "$", "trace", ")", ";", "}", "}", "return", "$", "this", "->", "trace", ";", "}" ]
get the inspector trace @param bool $add_self Adds the current exception also to trace.
[ "get", "the", "inspector", "trace" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCError/Inspector.php#L110-L132
17,747
ClanCats/Core
src/classes/CCError/Inspector.php
CCError_Inspector.tables
public function tables() { $tables = array(); foreach( static::$info_callbacks as $name => $callback ) { $tables[$name] = call_user_func( $callback ); } return array_merge( $tables , array( 'Server / request data' => $_SERVER, 'Get parameters' => $_GET, 'Post parameters' => $_POST, 'Cookies' => $_COOKIE, 'Files' => $_FILES, )); }
php
public function tables() { $tables = array(); foreach( static::$info_callbacks as $name => $callback ) { $tables[$name] = call_user_func( $callback ); } return array_merge( $tables , array( 'Server / request data' => $_SERVER, 'Get parameters' => $_GET, 'Post parameters' => $_POST, 'Cookies' => $_COOKIE, 'Files' => $_FILES, )); }
[ "public", "function", "tables", "(", ")", "{", "$", "tables", "=", "array", "(", ")", ";", "foreach", "(", "static", "::", "$", "info_callbacks", "as", "$", "name", "=>", "$", "callback", ")", "{", "$", "tables", "[", "$", "name", "]", "=", "call_user_func", "(", "$", "callback", ")", ";", "}", "return", "array_merge", "(", "$", "tables", ",", "array", "(", "'Server / request data'", "=>", "$", "_SERVER", ",", "'Get parameters'", "=>", "$", "_GET", ",", "'Post parameters'", "=>", "$", "_POST", ",", "'Cookies'", "=>", "$", "_COOKIE", ",", "'Files'", "=>", "$", "_FILES", ",", ")", ")", ";", "}" ]
returns all debug tables @return array
[ "returns", "all", "debug", "tables" ]
9f6ec72c1a439de4b253d0223f1029f7f85b6ef8
https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCError/Inspector.php#L139-L155
17,748
Ocramius/OcraDiCompiler
src/OcraDiCompiler/ServiceManager/Di/DiAbstractServiceFactory.php
DiAbstractServiceFactory.get
public function get($name, array $params = array()) { if (null === $this->serviceLocator) { throw new DomainException('No ServiceLocator defined, use `createServiceWithName` instead of `get`'); } if (self::USE_SL_BEFORE_DI === $this->useServiceLocator && $this->serviceLocator->has($name)) { return $this->serviceLocator->get($name); } try { return parent::get($name, $params); } catch (ClassNotFoundException $e) { if (self::USE_SL_AFTER_DI === $this->useServiceLocator && $this->serviceLocator->has($name)) { return $this->serviceLocator->get($name); } throw new Exception\ServiceNotFoundException( sprintf('Service %s was not found in this DI instance', $name), null, $e ); } }
php
public function get($name, array $params = array()) { if (null === $this->serviceLocator) { throw new DomainException('No ServiceLocator defined, use `createServiceWithName` instead of `get`'); } if (self::USE_SL_BEFORE_DI === $this->useServiceLocator && $this->serviceLocator->has($name)) { return $this->serviceLocator->get($name); } try { return parent::get($name, $params); } catch (ClassNotFoundException $e) { if (self::USE_SL_AFTER_DI === $this->useServiceLocator && $this->serviceLocator->has($name)) { return $this->serviceLocator->get($name); } throw new Exception\ServiceNotFoundException( sprintf('Service %s was not found in this DI instance', $name), null, $e ); } }
[ "public", "function", "get", "(", "$", "name", ",", "array", "$", "params", "=", "array", "(", ")", ")", "{", "if", "(", "null", "===", "$", "this", "->", "serviceLocator", ")", "{", "throw", "new", "DomainException", "(", "'No ServiceLocator defined, use `createServiceWithName` instead of `get`'", ")", ";", "}", "if", "(", "self", "::", "USE_SL_BEFORE_DI", "===", "$", "this", "->", "useServiceLocator", "&&", "$", "this", "->", "serviceLocator", "->", "has", "(", "$", "name", ")", ")", "{", "return", "$", "this", "->", "serviceLocator", "->", "get", "(", "$", "name", ")", ";", "}", "try", "{", "return", "parent", "::", "get", "(", "$", "name", ",", "$", "params", ")", ";", "}", "catch", "(", "ClassNotFoundException", "$", "e", ")", "{", "if", "(", "self", "::", "USE_SL_AFTER_DI", "===", "$", "this", "->", "useServiceLocator", "&&", "$", "this", "->", "serviceLocator", "->", "has", "(", "$", "name", ")", ")", "{", "return", "$", "this", "->", "serviceLocator", "->", "get", "(", "$", "name", ")", ";", "}", "throw", "new", "Exception", "\\", "ServiceNotFoundException", "(", "sprintf", "(", "'Service %s was not found in this DI instance'", ",", "$", "name", ")", ",", "null", ",", "$", "e", ")", ";", "}", "}" ]
Overrides Zend\Di to allow the given serviceLocator's services to be reused by Di itself {@inheritDoc}
[ "Overrides", "Zend", "\\", "Di", "to", "allow", "the", "given", "serviceLocator", "s", "services", "to", "be", "reused", "by", "Di", "itself" ]
667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a
https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/ServiceManager/Di/DiAbstractServiceFactory.php#L91-L114
17,749
kuria/event
src/ObservableTrait.php
ObservableTrait.off
function off(string $event, $callback): bool { return $this->getEventEmitter()->off($event, $callback); }
php
function off(string $event, $callback): bool { return $this->getEventEmitter()->off($event, $callback); }
[ "function", "off", "(", "string", "$", "event", ",", "$", "callback", ")", ":", "bool", "{", "return", "$", "this", "->", "getEventEmitter", "(", ")", "->", "off", "(", "$", "event", ",", "$", "callback", ")", ";", "}" ]
Unregister a callback
[ "Unregister", "a", "callback" ]
9ee95e751270831d5aca04f3a34a2e03b786ff41
https://github.com/kuria/event/blob/9ee95e751270831d5aca04f3a34a2e03b786ff41/src/ObservableTrait.php#L27-L30
17,750
anexia-it/anexia-laravel-encryption
src/DatabaseEncryptionQueryBuilder.php
DatabaseEncryptionQueryBuilder.addEncryptionSelect
public function addEncryptionSelect($column = []) { $columnName = (isset($column['alias']) && !empty($column['alias'])) ? $column['alias'] : $column['column']; $this->encryptionColumns[$columnName] = $column; return $this; }
php
public function addEncryptionSelect($column = []) { $columnName = (isset($column['alias']) && !empty($column['alias'])) ? $column['alias'] : $column['column']; $this->encryptionColumns[$columnName] = $column; return $this; }
[ "public", "function", "addEncryptionSelect", "(", "$", "column", "=", "[", "]", ")", "{", "$", "columnName", "=", "(", "isset", "(", "$", "column", "[", "'alias'", "]", ")", "&&", "!", "empty", "(", "$", "column", "[", "'alias'", "]", ")", ")", "?", "$", "column", "[", "'alias'", "]", ":", "$", "column", "[", "'column'", "]", ";", "$", "this", "->", "encryptionColumns", "[", "$", "columnName", "]", "=", "$", "column", ";", "return", "$", "this", ";", "}" ]
Add a new select encryption_column to the query. @param array $column; array with [originalColumnName => selectValue] @return $this
[ "Add", "a", "new", "select", "encryption_column", "to", "the", "query", "." ]
b7c72d99916ebca2d2cf2dbab1d4c0f84e383081
https://github.com/anexia-it/anexia-laravel-encryption/blob/b7c72d99916ebca2d2cf2dbab1d4c0f84e383081/src/DatabaseEncryptionQueryBuilder.php#L36-L42
17,751
atkrad/data-tables
src/Extension/ColReorder.php
ColReorder.setReorderCallback
public function setReorderCallback($reorderCallback) { $hash = sha1($reorderCallback); $this->properties['reorderCallback'] = $hash; $this->callbacks[$hash] = $reorderCallback; return $this; }
php
public function setReorderCallback($reorderCallback) { $hash = sha1($reorderCallback); $this->properties['reorderCallback'] = $hash; $this->callbacks[$hash] = $reorderCallback; return $this; }
[ "public", "function", "setReorderCallback", "(", "$", "reorderCallback", ")", "{", "$", "hash", "=", "sha1", "(", "$", "reorderCallback", ")", ";", "$", "this", "->", "properties", "[", "'reorderCallback'", "]", "=", "$", "hash", ";", "$", "this", "->", "callbacks", "[", "$", "hash", "]", "=", "$", "reorderCallback", ";", "return", "$", "this", ";", "}" ]
Callback function which can be used to perform actions when the columns have been reordered. Input parameters: void Return parameter: void @param string $reorderCallback Callback function which can be used to perform actions when the columns have been reordered. @return ColReorder @see http://datatables.net/extensions/colreorder/options
[ "Callback", "function", "which", "can", "be", "used", "to", "perform", "actions", "when", "the", "columns", "have", "been", "reordered", "." ]
5afcc337ab624ca626e29d9674459c5105982b16
https://github.com/atkrad/data-tables/blob/5afcc337ab624ca626e29d9674459c5105982b16/src/Extension/ColReorder.php#L107-L114
17,752
titon/db
src/Titon/Db/Behavior/SoftDeleteBehavior.php
SoftDeleteBehavior.purgeDeleted
public function purgeDeleted($timeFrame) { $config = $this->allConfig(); return $this->getRepository()->deleteMany(function(Query $query) use ($timeFrame, $config) { if ($timeFrame) { $query->where($config['deleteField'], '>=', Time::toUnix($timeFrame)); } else if ($config['useFlag']) { $query->where($config['flagField'], true); } else { $query->where($config['deleteField'], '!=', null); } }, [ 'before' => false, 'after' => false ]); }
php
public function purgeDeleted($timeFrame) { $config = $this->allConfig(); return $this->getRepository()->deleteMany(function(Query $query) use ($timeFrame, $config) { if ($timeFrame) { $query->where($config['deleteField'], '>=', Time::toUnix($timeFrame)); } else if ($config['useFlag']) { $query->where($config['flagField'], true); } else { $query->where($config['deleteField'], '!=', null); } }, [ 'before' => false, 'after' => false ]); }
[ "public", "function", "purgeDeleted", "(", "$", "timeFrame", ")", "{", "$", "config", "=", "$", "this", "->", "allConfig", "(", ")", ";", "return", "$", "this", "->", "getRepository", "(", ")", "->", "deleteMany", "(", "function", "(", "Query", "$", "query", ")", "use", "(", "$", "timeFrame", ",", "$", "config", ")", "{", "if", "(", "$", "timeFrame", ")", "{", "$", "query", "->", "where", "(", "$", "config", "[", "'deleteField'", "]", ",", "'>='", ",", "Time", "::", "toUnix", "(", "$", "timeFrame", ")", ")", ";", "}", "else", "if", "(", "$", "config", "[", "'useFlag'", "]", ")", "{", "$", "query", "->", "where", "(", "$", "config", "[", "'flagField'", "]", ",", "true", ")", ";", "}", "else", "{", "$", "query", "->", "where", "(", "$", "config", "[", "'deleteField'", "]", ",", "'!='", ",", "null", ")", ";", "}", "}", ",", "[", "'before'", "=>", "false", ",", "'after'", "=>", "false", "]", ")", ";", "}" ]
Purge all soft deleted records from the database. If a time frame is provided, delete all records within that time frame. If no time frame is provided, delete all records based on flag or timestamp being not null. @uses \Titon\Utility\Time @param int|string $timeFrame @return int
[ "Purge", "all", "soft", "deleted", "records", "from", "the", "database", ".", "If", "a", "time", "frame", "is", "provided", "delete", "all", "records", "within", "that", "time", "frame", ".", "If", "no", "time", "frame", "is", "provided", "delete", "all", "records", "based", "on", "flag", "or", "timestamp", "being", "not", "null", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/SoftDeleteBehavior.php#L102-L119
17,753
titon/db
src/Titon/Db/Behavior/SoftDeleteBehavior.php
SoftDeleteBehavior.softDelete
public function softDelete($id) { return $this->getRepository()->update($id, [ $this->getConfig('flagField') => true, $this->getConfig('deleteField') => time() ], [ 'before' => false, 'after' => false ]); }
php
public function softDelete($id) { return $this->getRepository()->update($id, [ $this->getConfig('flagField') => true, $this->getConfig('deleteField') => time() ], [ 'before' => false, 'after' => false ]); }
[ "public", "function", "softDelete", "(", "$", "id", ")", "{", "return", "$", "this", "->", "getRepository", "(", ")", "->", "update", "(", "$", "id", ",", "[", "$", "this", "->", "getConfig", "(", "'flagField'", ")", "=>", "true", ",", "$", "this", "->", "getConfig", "(", "'deleteField'", ")", "=>", "time", "(", ")", "]", ",", "[", "'before'", "=>", "false", ",", "'after'", "=>", "false", "]", ")", ";", "}" ]
Perform a soft delete by marking a record as deleted and updating a timestamp. Do not delete the actual record. @param int|int[] $id @return int
[ "Perform", "a", "soft", "delete", "by", "marking", "a", "record", "as", "deleted", "and", "updating", "a", "timestamp", ".", "Do", "not", "delete", "the", "actual", "record", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Behavior/SoftDeleteBehavior.php#L138-L146
17,754
webforge-labs/psc-cms
lib/Psc/CMS/Controller/AbstractEntityController.php
AbstractEntityController.saveEntity
public function saveEntity($identifier, FormData $requestData, $subResource = NULL) { $revision = $this->defaultRevision; $entity = $this->getEntity($identifier); if ($subResource !== NULL && array_key_exists($subResource, $this->customActions)) { return $this->callCustomAction($this->customActions[$subResource], array($entity, $requestData, $revision)); } return $this->updateEntityRevision($entity, $revision, $requestData, $subResource); }
php
public function saveEntity($identifier, FormData $requestData, $subResource = NULL) { $revision = $this->defaultRevision; $entity = $this->getEntity($identifier); if ($subResource !== NULL && array_key_exists($subResource, $this->customActions)) { return $this->callCustomAction($this->customActions[$subResource], array($entity, $requestData, $revision)); } return $this->updateEntityRevision($entity, $revision, $requestData, $subResource); }
[ "public", "function", "saveEntity", "(", "$", "identifier", ",", "FormData", "$", "requestData", ",", "$", "subResource", "=", "NULL", ")", "{", "$", "revision", "=", "$", "this", "->", "defaultRevision", ";", "$", "entity", "=", "$", "this", "->", "getEntity", "(", "$", "identifier", ")", ";", "if", "(", "$", "subResource", "!==", "NULL", "&&", "array_key_exists", "(", "$", "subResource", ",", "$", "this", "->", "customActions", ")", ")", "{", "return", "$", "this", "->", "callCustomAction", "(", "$", "this", "->", "customActions", "[", "$", "subResource", "]", ",", "array", "(", "$", "entity", ",", "$", "requestData", ",", "$", "revision", ")", ")", ";", "}", "return", "$", "this", "->", "updateEntityRevision", "(", "$", "entity", ",", "$", "revision", ",", "$", "requestData", ",", "$", "subResource", ")", ";", "}" ]
Saves the Entity default Revision @controller-api @return Entity
[ "Saves", "the", "Entity", "default", "Revision" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L280-L289
17,755
webforge-labs/psc-cms
lib/Psc/CMS/Controller/AbstractEntityController.php
AbstractEntityController.insertEntity
public function insertEntity(FormData $requestData, $subResource = NULL) { return $this->insertEntityRevision($this->defaultRevision, $requestData, $subResource); }
php
public function insertEntity(FormData $requestData, $subResource = NULL) { return $this->insertEntityRevision($this->defaultRevision, $requestData, $subResource); }
[ "public", "function", "insertEntity", "(", "FormData", "$", "requestData", ",", "$", "subResource", "=", "NULL", ")", "{", "return", "$", "this", "->", "insertEntityRevision", "(", "$", "this", "->", "defaultRevision", ",", "$", "requestData", ",", "$", "subResource", ")", ";", "}" ]
Inserts a new Entity in default Revision @controller-api @return Psc\CMS\Entity
[ "Inserts", "a", "new", "Entity", "in", "default", "Revision" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L381-L383
17,756
webforge-labs/psc-cms
lib/Psc/CMS/Controller/AbstractEntityController.php
AbstractEntityController.insertEntityRevision
public function insertEntityRevision($revision, FormData $requestData, $subResource = NULL) { $entity = $this->createEmptyEntity($revision); if ($subResource !== NULL && array_key_exists($subResource, $this->customActions)) { return $this->callCustomAction($this->customActions[$subResource], array($entity, $requestData, $revision)); } $this->updateEntityRevision($entity, $revision, $requestData); $this->setOpenTabMetadata($entity); return $entity; }
php
public function insertEntityRevision($revision, FormData $requestData, $subResource = NULL) { $entity = $this->createEmptyEntity($revision); if ($subResource !== NULL && array_key_exists($subResource, $this->customActions)) { return $this->callCustomAction($this->customActions[$subResource], array($entity, $requestData, $revision)); } $this->updateEntityRevision($entity, $revision, $requestData); $this->setOpenTabMetadata($entity); return $entity; }
[ "public", "function", "insertEntityRevision", "(", "$", "revision", ",", "FormData", "$", "requestData", ",", "$", "subResource", "=", "NULL", ")", "{", "$", "entity", "=", "$", "this", "->", "createEmptyEntity", "(", "$", "revision", ")", ";", "if", "(", "$", "subResource", "!==", "NULL", "&&", "array_key_exists", "(", "$", "subResource", ",", "$", "this", "->", "customActions", ")", ")", "{", "return", "$", "this", "->", "callCustomAction", "(", "$", "this", "->", "customActions", "[", "$", "subResource", "]", ",", "array", "(", "$", "entity", ",", "$", "requestData", ",", "$", "revision", ")", ")", ";", "}", "$", "this", "->", "updateEntityRevision", "(", "$", "entity", ",", "$", "revision", ",", "$", "requestData", ")", ";", "$", "this", "->", "setOpenTabMetadata", "(", "$", "entity", ")", ";", "return", "$", "entity", ";", "}" ]
Inserts a new Entity in specific Revision @controller-api
[ "Inserts", "a", "new", "Entity", "in", "specific", "Revision" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L390-L401
17,757
webforge-labs/psc-cms
lib/Psc/CMS/Controller/AbstractEntityController.php
AbstractEntityController.createEmptyEntity
public function createEmptyEntity($revision = NULL) { // @TODO check ob entity einen constructor hat, der parameter braucht? $c = $this->getEntityName(); try { $gClass = new GClass($c); // wir rufen hier nicht den constructor auf return $gClass->newInstance(array(), GClass::WITHOUT_CONSTRUCTOR); } catch (\ErrorException $e) { if (mb_strpos($e->getMessage(), 'Missing argument') !== FALSE) { throw new \Psc\Exception(sprintf("Kann kein leeres Entity '%s' mit leerem Constructor erstellen. createEmptyEntity() kann im Controller abgeleitet werden, um das Problem zu beheben",$c), 0, $e); } else { throw $e; } } }
php
public function createEmptyEntity($revision = NULL) { // @TODO check ob entity einen constructor hat, der parameter braucht? $c = $this->getEntityName(); try { $gClass = new GClass($c); // wir rufen hier nicht den constructor auf return $gClass->newInstance(array(), GClass::WITHOUT_CONSTRUCTOR); } catch (\ErrorException $e) { if (mb_strpos($e->getMessage(), 'Missing argument') !== FALSE) { throw new \Psc\Exception(sprintf("Kann kein leeres Entity '%s' mit leerem Constructor erstellen. createEmptyEntity() kann im Controller abgeleitet werden, um das Problem zu beheben",$c), 0, $e); } else { throw $e; } } }
[ "public", "function", "createEmptyEntity", "(", "$", "revision", "=", "NULL", ")", "{", "// @TODO check ob entity einen constructor hat, der parameter braucht?", "$", "c", "=", "$", "this", "->", "getEntityName", "(", ")", ";", "try", "{", "$", "gClass", "=", "new", "GClass", "(", "$", "c", ")", ";", "// wir rufen hier nicht den constructor auf", "return", "$", "gClass", "->", "newInstance", "(", "array", "(", ")", ",", "GClass", "::", "WITHOUT_CONSTRUCTOR", ")", ";", "}", "catch", "(", "\\", "ErrorException", "$", "e", ")", "{", "if", "(", "mb_strpos", "(", "$", "e", "->", "getMessage", "(", ")", ",", "'Missing argument'", ")", "!==", "FALSE", ")", "{", "throw", "new", "\\", "Psc", "\\", "Exception", "(", "sprintf", "(", "\"Kann kein leeres Entity '%s' mit leerem Constructor erstellen. createEmptyEntity() kann im Controller abgeleitet werden, um das Problem zu beheben\"", ",", "$", "c", ")", ",", "0", ",", "$", "e", ")", ";", "}", "else", "{", "throw", "$", "e", ";", "}", "}", "}" ]
Erstellt ein leeres Entity kann abgeleitet werden, falls der constructor von {$this->getEntityName()} Parameter braucht
[ "Erstellt", "ein", "leeres", "Entity" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L624-L642
17,758
webforge-labs/psc-cms
lib/Psc/CMS/Controller/AbstractEntityController.php
AbstractEntityController.trans
public function trans($key, Array $parameters = array(), $domain = NULL) { if (!isset($domain)) $domain = 'project'; return $this->translationContainer->getTranslator()->trans($key, $parameters, $domain); }
php
public function trans($key, Array $parameters = array(), $domain = NULL) { if (!isset($domain)) $domain = 'project'; return $this->translationContainer->getTranslator()->trans($key, $parameters, $domain); }
[ "public", "function", "trans", "(", "$", "key", ",", "Array", "$", "parameters", "=", "array", "(", ")", ",", "$", "domain", "=", "NULL", ")", "{", "if", "(", "!", "isset", "(", "$", "domain", ")", ")", "$", "domain", "=", "'project'", ";", "return", "$", "this", "->", "translationContainer", "->", "getTranslator", "(", ")", "->", "trans", "(", "$", "key", ",", "$", "parameters", ",", "$", "domain", ")", ";", "}" ]
public for usage in 5.3 in closures
[ "public", "for", "usage", "in", "5", ".", "3", "in", "closures" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L937-L941
17,759
webforge-labs/psc-cms
lib/Psc/CMS/Controller/AbstractEntityController.php
AbstractEntityController.initPropertyTranslations
protected function initPropertyTranslations($domain = NULL) { $entityMeta = $this->getEntityMeta(); $translator = $this->translationContainer->getTranslator(); $this->on('init.labeler', function ($labeler) use ($domain, $entityMeta, $translator) { foreach ($entityMeta->getSetMeta()->getKeys() as $propertyName) { $property = $entityMeta->getPropertyMeta($propertyName); $labeler->label( $property->getName(), $translator->trans( sprintf('entities.%s.%s', $entityMeta->getEntityName(), $property->getCanonicalName()), array(), $domain ?: 'project' ) ); } }); }
php
protected function initPropertyTranslations($domain = NULL) { $entityMeta = $this->getEntityMeta(); $translator = $this->translationContainer->getTranslator(); $this->on('init.labeler', function ($labeler) use ($domain, $entityMeta, $translator) { foreach ($entityMeta->getSetMeta()->getKeys() as $propertyName) { $property = $entityMeta->getPropertyMeta($propertyName); $labeler->label( $property->getName(), $translator->trans( sprintf('entities.%s.%s', $entityMeta->getEntityName(), $property->getCanonicalName()), array(), $domain ?: 'project' ) ); } }); }
[ "protected", "function", "initPropertyTranslations", "(", "$", "domain", "=", "NULL", ")", "{", "$", "entityMeta", "=", "$", "this", "->", "getEntityMeta", "(", ")", ";", "$", "translator", "=", "$", "this", "->", "translationContainer", "->", "getTranslator", "(", ")", ";", "$", "this", "->", "on", "(", "'init.labeler'", ",", "function", "(", "$", "labeler", ")", "use", "(", "$", "domain", ",", "$", "entityMeta", ",", "$", "translator", ")", "{", "foreach", "(", "$", "entityMeta", "->", "getSetMeta", "(", ")", "->", "getKeys", "(", ")", "as", "$", "propertyName", ")", "{", "$", "property", "=", "$", "entityMeta", "->", "getPropertyMeta", "(", "$", "propertyName", ")", ";", "$", "labeler", "->", "label", "(", "$", "property", "->", "getName", "(", ")", ",", "$", "translator", "->", "trans", "(", "sprintf", "(", "'entities.%s.%s'", ",", "$", "entityMeta", "->", "getEntityName", "(", ")", ",", "$", "property", "->", "getCanonicalName", "(", ")", ")", ",", "array", "(", ")", ",", "$", "domain", "?", ":", "'project'", ")", ")", ";", "}", "}", ")", ";", "}" ]
Loads translations keys for each property of the entity of the controller with labels domain: project (if not specified) key: entities.<entityName>.<propertyName> for example: entities.news-entry.published entities.news-entry.teaser if property is i18n property the i18n will be stripped
[ "Loads", "translations", "keys", "for", "each", "property", "of", "the", "entity", "of", "the", "controller", "with", "labels" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/AbstractEntityController.php#L956-L974
17,760
kherge-abandoned/lib-exception
src/lib/Phine/Exception/Exception.php
Exception.createUsingFormat
public static function createUsingFormat($format) { $previous = null; if (1 < func_num_args()) { $args = array_slice(func_get_args(), 1); // extract $previous exception if (end($args) instanceof \Exception) { $previous = array_pop($args); } if ($args) { $format = vsprintf($format, $args); } } return new static($format, 0, $previous); }
php
public static function createUsingFormat($format) { $previous = null; if (1 < func_num_args()) { $args = array_slice(func_get_args(), 1); // extract $previous exception if (end($args) instanceof \Exception) { $previous = array_pop($args); } if ($args) { $format = vsprintf($format, $args); } } return new static($format, 0, $previous); }
[ "public", "static", "function", "createUsingFormat", "(", "$", "format", ")", "{", "$", "previous", "=", "null", ";", "if", "(", "1", "<", "func_num_args", "(", ")", ")", "{", "$", "args", "=", "array_slice", "(", "func_get_args", "(", ")", ",", "1", ")", ";", "// extract $previous exception", "if", "(", "end", "(", "$", "args", ")", "instanceof", "\\", "Exception", ")", "{", "$", "previous", "=", "array_pop", "(", "$", "args", ")", ";", "}", "if", "(", "$", "args", ")", "{", "$", "format", "=", "vsprintf", "(", "$", "format", ",", "$", "args", ")", ";", "}", "}", "return", "new", "static", "(", "$", "format", ",", "0", ",", "$", "previous", ")", ";", "}" ]
Creates a new exception using a formatted message. A new exception is created after formatting the given arguments using `vsprintf()`. If the last argument is an instance of the `Exception` class, it will be used as the `$previous` exception in the new one that is created. @param string $format The message format. @param mixed $value,... A value to format. @param \Exception $previous A previous exception. @return Exception The new exception.
[ "Creates", "a", "new", "exception", "using", "a", "formatted", "message", "." ]
3f50754bcc416df91235766cc3d5d5ce6ed6d612
https://github.com/kherge-abandoned/lib-exception/blob/3f50754bcc416df91235766cc3d5d5ce6ed6d612/src/lib/Phine/Exception/Exception.php#L26-L44
17,761
webforge-labs/psc-cms
lib/Psc/MailChimp/API.php
API.listSubscribe
public function listSubscribe($listId, $email, Array $mergeVars = NULL, $emailType = 'text', $doubleOptin = true, $updateExisting = false, $replaceInterests = true, $sendWelcome = true) { $response = $this->dispatch(__FUNCTION__, array( 'id'=>$listId, 'email_address'=>$email, 'email_type'=>$emailType )); // boolean if ($response->getRaw() === 'true') { return TRUE; } else { throw Exception::unknown($response->getRaw()); } }
php
public function listSubscribe($listId, $email, Array $mergeVars = NULL, $emailType = 'text', $doubleOptin = true, $updateExisting = false, $replaceInterests = true, $sendWelcome = true) { $response = $this->dispatch(__FUNCTION__, array( 'id'=>$listId, 'email_address'=>$email, 'email_type'=>$emailType )); // boolean if ($response->getRaw() === 'true') { return TRUE; } else { throw Exception::unknown($response->getRaw()); } }
[ "public", "function", "listSubscribe", "(", "$", "listId", ",", "$", "email", ",", "Array", "$", "mergeVars", "=", "NULL", ",", "$", "emailType", "=", "'text'", ",", "$", "doubleOptin", "=", "true", ",", "$", "updateExisting", "=", "false", ",", "$", "replaceInterests", "=", "true", ",", "$", "sendWelcome", "=", "true", ")", "{", "$", "response", "=", "$", "this", "->", "dispatch", "(", "__FUNCTION__", ",", "array", "(", "'id'", "=>", "$", "listId", ",", "'email_address'", "=>", "$", "email", ",", "'email_type'", "=>", "$", "emailType", ")", ")", ";", "// boolean", "if", "(", "$", "response", "->", "getRaw", "(", ")", "===", "'true'", ")", "{", "return", "TRUE", ";", "}", "else", "{", "throw", "Exception", "::", "unknown", "(", "$", "response", "->", "getRaw", "(", ")", ")", ";", "}", "}" ]
Subscribe the provided email to a list. By default this sends a confirmation email - you will not see new members until the link contained in it is clicked! listSubscribe(string apikey, string id, string email_address, array merge_vars, string email_type, bool double_optin, bool update_existing, bool replace_interests, bool send_welcome) http://apidocs.mailchimp.com/api/1.3/listsubscribe.func.php @todo im Moment sind nur die ersten 2 parameter implementiert @param emailType text|html|mobile @return bool success
[ "Subscribe", "the", "provided", "email", "to", "a", "list", ".", "By", "default", "this", "sends", "a", "confirmation", "email", "-", "you", "will", "not", "see", "new", "members", "until", "the", "link", "contained", "in", "it", "is", "clicked!" ]
467bfa2547e6b4fa487d2d7f35fa6cc618dbc763
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/MailChimp/API.php#L59-L72
17,762
titon/db
src/Titon/Db/Query/ExprAware.php
ExprAware.expr
public static function expr($field, $operator = null, $value = null) { return new Expr($field, $operator, $value); }
php
public static function expr($field, $operator = null, $value = null) { return new Expr($field, $operator, $value); }
[ "public", "static", "function", "expr", "(", "$", "field", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ")", "{", "return", "new", "Expr", "(", "$", "field", ",", "$", "operator", ",", "$", "value", ")", ";", "}" ]
Instantiate a new database expression. @param string $field @param string $operator @param mixed $value @return \Titon\Db\Query\Expr
[ "Instantiate", "a", "new", "database", "expression", "." ]
fbc5159d1ce9d2139759c9367565986981485604
https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Query/ExprAware.php#L25-L27
17,763
rayrutjes/domain-foundation
src/UnitOfWork/AggregateRootContainer.php
AggregateRootContainer.saveAggregateRoots
public function saveAggregateRoots() { foreach ($this->aggregateRoots as $aggregateRootHash => $aggregateRoot) { $this->aggregateRootSaveCallbacks[$aggregateRootHash]->save($aggregateRoot); } }
php
public function saveAggregateRoots() { foreach ($this->aggregateRoots as $aggregateRootHash => $aggregateRoot) { $this->aggregateRootSaveCallbacks[$aggregateRootHash]->save($aggregateRoot); } }
[ "public", "function", "saveAggregateRoots", "(", ")", "{", "foreach", "(", "$", "this", "->", "aggregateRoots", "as", "$", "aggregateRootHash", "=>", "$", "aggregateRoot", ")", "{", "$", "this", "->", "aggregateRootSaveCallbacks", "[", "$", "aggregateRootHash", "]", "->", "save", "(", "$", "aggregateRoot", ")", ";", "}", "}" ]
Triggers all saving callbacks on all staged aggregates.
[ "Triggers", "all", "saving", "callbacks", "on", "all", "staged", "aggregates", "." ]
2bce7cd6a6612f718e70e3176589c1abf39d1a3e
https://github.com/rayrutjes/domain-foundation/blob/2bce7cd6a6612f718e70e3176589c1abf39d1a3e/src/UnitOfWork/AggregateRootContainer.php#L68-L73
17,764
opis/http
src/MimeType.php
MimeType.get
public static function get(string $file, bool $guess = true): string { if($guess === true) { $extension = pathinfo($file, PATHINFO_EXTENSION); if(isset(self::$defaultMime[$extension])) { return self::$defaultMime[$extension]; } } // Get mime using the file information functions $info = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_file($info, $file); finfo_close($info); if(false === $mime){ $mime = 'application/octet-stream'; } return $mime; }
php
public static function get(string $file, bool $guess = true): string { if($guess === true) { $extension = pathinfo($file, PATHINFO_EXTENSION); if(isset(self::$defaultMime[$extension])) { return self::$defaultMime[$extension]; } } // Get mime using the file information functions $info = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_file($info, $file); finfo_close($info); if(false === $mime){ $mime = 'application/octet-stream'; } return $mime; }
[ "public", "static", "function", "get", "(", "string", "$", "file", ",", "bool", "$", "guess", "=", "true", ")", ":", "string", "{", "if", "(", "$", "guess", "===", "true", ")", "{", "$", "extension", "=", "pathinfo", "(", "$", "file", ",", "PATHINFO_EXTENSION", ")", ";", "if", "(", "isset", "(", "self", "::", "$", "defaultMime", "[", "$", "extension", "]", ")", ")", "{", "return", "self", "::", "$", "defaultMime", "[", "$", "extension", "]", ";", "}", "}", "// Get mime using the file information functions", "$", "info", "=", "finfo_open", "(", "FILEINFO_MIME_TYPE", ")", ";", "$", "mime", "=", "finfo_file", "(", "$", "info", ",", "$", "file", ")", ";", "finfo_close", "(", "$", "info", ")", ";", "if", "(", "false", "===", "$", "mime", ")", "{", "$", "mime", "=", "'application/octet-stream'", ";", "}", "return", "$", "mime", ";", "}" ]
Returns the mime type of a file. @param string $file Full path to the file @param boolean $guess (optional) Set to false to disable mime type guessing @return string
[ "Returns", "the", "mime", "type", "of", "a", "file", "." ]
70b813ba97d65b53fad3fb58b800add8b10d7291
https://github.com/opis/http/blob/70b813ba97d65b53fad3fb58b800add8b10d7291/src/MimeType.php#L805-L824
17,765
aedart/laravel-helpers
src/Traits/Mail/MailQueueTrait.php
MailQueueTrait.getMailQueue
public function getMailQueue(): ?MailQueue { if (!$this->hasMailQueue()) { $this->setMailQueue($this->getDefaultMailQueue()); } return $this->mailQueue; }
php
public function getMailQueue(): ?MailQueue { if (!$this->hasMailQueue()) { $this->setMailQueue($this->getDefaultMailQueue()); } return $this->mailQueue; }
[ "public", "function", "getMailQueue", "(", ")", ":", "?", "MailQueue", "{", "if", "(", "!", "$", "this", "->", "hasMailQueue", "(", ")", ")", "{", "$", "this", "->", "setMailQueue", "(", "$", "this", "->", "getDefaultMailQueue", "(", ")", ")", ";", "}", "return", "$", "this", "->", "mailQueue", ";", "}" ]
Get mail queue If no mail queue has been set, this method will set and return a default mail queue, if any such value is available @see getDefaultMailQueue() @return MailQueue|null mail queue or null if none mail queue has been set
[ "Get", "mail", "queue" ]
8b81a2d6658f3f8cb62b6be2c34773aaa2df219a
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Mail/MailQueueTrait.php#L53-L59
17,766
dunkelfrosch/phpcoverfish
src/PHPCoverFish/Common/CoverFishColor.php
CoverFishColor.setColor
public static function setColor($color, $string) { if (!isset(self::$colorTable[$color])) { throw new \Exception('ansi color is not defined'); } return sprintf("\033[%sm%s\033[0m", self::$colorTable[$color], $string); }
php
public static function setColor($color, $string) { if (!isset(self::$colorTable[$color])) { throw new \Exception('ansi color is not defined'); } return sprintf("\033[%sm%s\033[0m", self::$colorTable[$color], $string); }
[ "public", "static", "function", "setColor", "(", "$", "color", ",", "$", "string", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "colorTable", "[", "$", "color", "]", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "'ansi color is not defined'", ")", ";", "}", "return", "sprintf", "(", "\"\\033[%sm%s\\033[0m\"", ",", "self", "::", "$", "colorTable", "[", "$", "color", "]", ",", "$", "string", ")", ";", "}" ]
Make string appear in color @param string $color @param string $string @return string @throws \Exception
[ "Make", "string", "appear", "in", "color" ]
779bd399ec8f4cadb3b7854200695c5eb3f5a8ad
https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Common/CoverFishColor.php#L63-L71
17,767
nguyenanhung/nusoap
src/nusoap_wsdlcache.php
nusoap_wsdlcache.get
function get($wsdl) { $filename = $this->createFilename($wsdl); if ($this->obtainMutex($filename, "r")) { // check for expired WSDL that must be removed from the cache if ($this->cache_lifetime > 0) { if (file_exists($filename) && (time() - filemtime($filename) > $this->cache_lifetime)) { unlink($filename); $this->debug("Expired $wsdl ($filename) from cache"); $this->releaseMutex($filename); return NULL; } } // see what there is to return if (!file_exists($filename)) { $this->debug("$wsdl ($filename) not in cache (1)"); $this->releaseMutex($filename); return NULL; } $fp = @fopen($filename, "r"); if ($fp) { $s = implode("", @file($filename)); fclose($fp); $this->debug("Got $wsdl ($filename) from cache"); } else { $s = NULL; $this->debug("$wsdl ($filename) not in cache (2)"); } $this->releaseMutex($filename); return (!is_null($s)) ? unserialize($s) : NULL; } else { $this->debug("Unable to obtain mutex for $filename in get"); } return NULL; }
php
function get($wsdl) { $filename = $this->createFilename($wsdl); if ($this->obtainMutex($filename, "r")) { // check for expired WSDL that must be removed from the cache if ($this->cache_lifetime > 0) { if (file_exists($filename) && (time() - filemtime($filename) > $this->cache_lifetime)) { unlink($filename); $this->debug("Expired $wsdl ($filename) from cache"); $this->releaseMutex($filename); return NULL; } } // see what there is to return if (!file_exists($filename)) { $this->debug("$wsdl ($filename) not in cache (1)"); $this->releaseMutex($filename); return NULL; } $fp = @fopen($filename, "r"); if ($fp) { $s = implode("", @file($filename)); fclose($fp); $this->debug("Got $wsdl ($filename) from cache"); } else { $s = NULL; $this->debug("$wsdl ($filename) not in cache (2)"); } $this->releaseMutex($filename); return (!is_null($s)) ? unserialize($s) : NULL; } else { $this->debug("Unable to obtain mutex for $filename in get"); } return NULL; }
[ "function", "get", "(", "$", "wsdl", ")", "{", "$", "filename", "=", "$", "this", "->", "createFilename", "(", "$", "wsdl", ")", ";", "if", "(", "$", "this", "->", "obtainMutex", "(", "$", "filename", ",", "\"r\"", ")", ")", "{", "// check for expired WSDL that must be removed from the cache\r", "if", "(", "$", "this", "->", "cache_lifetime", ">", "0", ")", "{", "if", "(", "file_exists", "(", "$", "filename", ")", "&&", "(", "time", "(", ")", "-", "filemtime", "(", "$", "filename", ")", ">", "$", "this", "->", "cache_lifetime", ")", ")", "{", "unlink", "(", "$", "filename", ")", ";", "$", "this", "->", "debug", "(", "\"Expired $wsdl ($filename) from cache\"", ")", ";", "$", "this", "->", "releaseMutex", "(", "$", "filename", ")", ";", "return", "NULL", ";", "}", "}", "// see what there is to return\r", "if", "(", "!", "file_exists", "(", "$", "filename", ")", ")", "{", "$", "this", "->", "debug", "(", "\"$wsdl ($filename) not in cache (1)\"", ")", ";", "$", "this", "->", "releaseMutex", "(", "$", "filename", ")", ";", "return", "NULL", ";", "}", "$", "fp", "=", "@", "fopen", "(", "$", "filename", ",", "\"r\"", ")", ";", "if", "(", "$", "fp", ")", "{", "$", "s", "=", "implode", "(", "\"\"", ",", "@", "file", "(", "$", "filename", ")", ")", ";", "fclose", "(", "$", "fp", ")", ";", "$", "this", "->", "debug", "(", "\"Got $wsdl ($filename) from cache\"", ")", ";", "}", "else", "{", "$", "s", "=", "NULL", ";", "$", "this", "->", "debug", "(", "\"$wsdl ($filename) not in cache (2)\"", ")", ";", "}", "$", "this", "->", "releaseMutex", "(", "$", "filename", ")", ";", "return", "(", "!", "is_null", "(", "$", "s", ")", ")", "?", "unserialize", "(", "$", "s", ")", ":", "NULL", ";", "}", "else", "{", "$", "this", "->", "debug", "(", "\"Unable to obtain mutex for $filename in get\"", ")", ";", "}", "return", "NULL", ";", "}" ]
gets a wsdl instance from the cache @param string $wsdl The URL of the wsdl instance @return object wsdl The cached wsdl instance, null if the instance is not in the cache @access public
[ "gets", "a", "wsdl", "instance", "from", "the", "cache" ]
a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556
https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src/nusoap_wsdlcache.php#L92-L130
17,768
nguyenanhung/nusoap
src/nusoap_wsdlcache.php
nusoap_wsdlcache.obtainMutex
function obtainMutex($filename, $mode) { if (isset($this->fplock[md5($filename)])) { $this->debug("Lock for $filename already exists"); return FALSE; } $this->fplock[md5($filename)] = fopen($filename . ".lock", "w"); if ($mode == "r") { return flock($this->fplock[md5($filename)], LOCK_SH); } else { return flock($this->fplock[md5($filename)], LOCK_EX); } }
php
function obtainMutex($filename, $mode) { if (isset($this->fplock[md5($filename)])) { $this->debug("Lock for $filename already exists"); return FALSE; } $this->fplock[md5($filename)] = fopen($filename . ".lock", "w"); if ($mode == "r") { return flock($this->fplock[md5($filename)], LOCK_SH); } else { return flock($this->fplock[md5($filename)], LOCK_EX); } }
[ "function", "obtainMutex", "(", "$", "filename", ",", "$", "mode", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "fplock", "[", "md5", "(", "$", "filename", ")", "]", ")", ")", "{", "$", "this", "->", "debug", "(", "\"Lock for $filename already exists\"", ")", ";", "return", "FALSE", ";", "}", "$", "this", "->", "fplock", "[", "md5", "(", "$", "filename", ")", "]", "=", "fopen", "(", "$", "filename", ".", "\".lock\"", ",", "\"w\"", ")", ";", "if", "(", "$", "mode", "==", "\"r\"", ")", "{", "return", "flock", "(", "$", "this", "->", "fplock", "[", "md5", "(", "$", "filename", ")", "]", ",", "LOCK_SH", ")", ";", "}", "else", "{", "return", "flock", "(", "$", "this", "->", "fplock", "[", "md5", "(", "$", "filename", ")", "]", ",", "LOCK_EX", ")", ";", "}", "}" ]
obtains the local mutex @param string $filename The Filename of the Cache to lock @param string $mode The open-mode ("r" or "w") or the file - affects lock-mode @return boolean Lock successfully obtained ?! @access private
[ "obtains", "the", "local", "mutex" ]
a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556
https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src/nusoap_wsdlcache.php#L141-L154
17,769
forxer/tao
src/Tao/Database/Model.php
Model.has
public function has($primaryKey, $column = null) { if (null === $column) { $column = $this->getPrimaryKey(); } return (boolean)$this->app['db']->fetchColumn( 'SELECT COUNT(:column) FROM ' . $this->getTable() . ' WHERE '.$this->getPrimaryKey().' = :pk', [ 'column' => $column, 'pk' => $primaryKey ] ); }
php
public function has($primaryKey, $column = null) { if (null === $column) { $column = $this->getPrimaryKey(); } return (boolean)$this->app['db']->fetchColumn( 'SELECT COUNT(:column) FROM ' . $this->getTable() . ' WHERE '.$this->getPrimaryKey().' = :pk', [ 'column' => $column, 'pk' => $primaryKey ] ); }
[ "public", "function", "has", "(", "$", "primaryKey", ",", "$", "column", "=", "null", ")", "{", "if", "(", "null", "===", "$", "column", ")", "{", "$", "column", "=", "$", "this", "->", "getPrimaryKey", "(", ")", ";", "}", "return", "(", "boolean", ")", "$", "this", "->", "app", "[", "'db'", "]", "->", "fetchColumn", "(", "'SELECT COUNT(:column) FROM '", ".", "$", "this", "->", "getTable", "(", ")", ".", "' WHERE '", ".", "$", "this", "->", "getPrimaryKey", "(", ")", ".", "' = :pk'", ",", "[", "'column'", "=>", "$", "column", ",", "'pk'", "=>", "$", "primaryKey", "]", ")", ";", "}" ]
Indicate if a given entry exists. @param mixed $primaryKey @param string $column @return boolean
[ "Indicate", "if", "a", "given", "entry", "exists", "." ]
b5e9109c244a29a72403ae6a58633ab96a67c660
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Database/Model.php#L49-L62
17,770
forxer/tao
src/Tao/Database/Model.php
Model.insert
public function insert(array $data) { $this->normalizeDataColumns($data); $this->setSearchIndexableData($data); return $this->app['db']->insert($this->getTable(), $data); }
php
public function insert(array $data) { $this->normalizeDataColumns($data); $this->setSearchIndexableData($data); return $this->app['db']->insert($this->getTable(), $data); }
[ "public", "function", "insert", "(", "array", "$", "data", ")", "{", "$", "this", "->", "normalizeDataColumns", "(", "$", "data", ")", ";", "$", "this", "->", "setSearchIndexableData", "(", "$", "data", ")", ";", "return", "$", "this", "->", "app", "[", "'db'", "]", "->", "insert", "(", "$", "this", "->", "getTable", "(", ")", ",", "$", "data", ")", ";", "}" ]
Insert an entry. @param array $data
[ "Insert", "an", "entry", "." ]
b5e9109c244a29a72403ae6a58633ab96a67c660
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Database/Model.php#L69-L76
17,771
forxer/tao
src/Tao/Database/Model.php
Model.update
public function update(array $data, $primaryKey) { $this->normalizeDataColumns($data); $this->setSearchIndexableData($data); return $this->app['db']->update($this->getTable(), $data, [ $this->getPrimaryKey() => $primaryKey]); }
php
public function update(array $data, $primaryKey) { $this->normalizeDataColumns($data); $this->setSearchIndexableData($data); return $this->app['db']->update($this->getTable(), $data, [ $this->getPrimaryKey() => $primaryKey]); }
[ "public", "function", "update", "(", "array", "$", "data", ",", "$", "primaryKey", ")", "{", "$", "this", "->", "normalizeDataColumns", "(", "$", "data", ")", ";", "$", "this", "->", "setSearchIndexableData", "(", "$", "data", ")", ";", "return", "$", "this", "->", "app", "[", "'db'", "]", "->", "update", "(", "$", "this", "->", "getTable", "(", ")", ",", "$", "data", ",", "[", "$", "this", "->", "getPrimaryKey", "(", ")", "=>", "$", "primaryKey", "]", ")", ";", "}" ]
Update an entry. @param array $data @param mixed $primaryKey
[ "Update", "an", "entry", "." ]
b5e9109c244a29a72403ae6a58633ab96a67c660
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Database/Model.php#L84-L91
17,772
forxer/tao
src/Tao/Database/Model.php
Model.delete
public function delete($primaryKey) { return $this->app['db']->delete($this->getTable(), [ $this->getPrimaryKey() => $primaryKey]); }
php
public function delete($primaryKey) { return $this->app['db']->delete($this->getTable(), [ $this->getPrimaryKey() => $primaryKey]); }
[ "public", "function", "delete", "(", "$", "primaryKey", ")", "{", "return", "$", "this", "->", "app", "[", "'db'", "]", "->", "delete", "(", "$", "this", "->", "getTable", "(", ")", ",", "[", "$", "this", "->", "getPrimaryKey", "(", ")", "=>", "$", "primaryKey", "]", ")", ";", "}" ]
Delete an entry. @param mixed $primaryKey
[ "Delete", "an", "entry", "." ]
b5e9109c244a29a72403ae6a58633ab96a67c660
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Database/Model.php#L98-L101
17,773
forxer/tao
src/Tao/Database/Model.php
Model.getColumns
public function getColumns($bWithoutForeignKey = true, $bAliased = true, $bPrefixed = false) { $aColumns = $this->columns; if ($bWithoutForeignKey) { $aColumns = $this->removeForeignKeyColumns($aColumns); } if ($bAliased) { $aColumns = $this->aliaseColumns($aColumns, $this->getAlias()); } if ($bPrefixed) { $aColumns = $this->prefixeColumns($aColumns, $this->getAlias()); } return $aColumns; }
php
public function getColumns($bWithoutForeignKey = true, $bAliased = true, $bPrefixed = false) { $aColumns = $this->columns; if ($bWithoutForeignKey) { $aColumns = $this->removeForeignKeyColumns($aColumns); } if ($bAliased) { $aColumns = $this->aliaseColumns($aColumns, $this->getAlias()); } if ($bPrefixed) { $aColumns = $this->prefixeColumns($aColumns, $this->getAlias()); } return $aColumns; }
[ "public", "function", "getColumns", "(", "$", "bWithoutForeignKey", "=", "true", ",", "$", "bAliased", "=", "true", ",", "$", "bPrefixed", "=", "false", ")", "{", "$", "aColumns", "=", "$", "this", "->", "columns", ";", "if", "(", "$", "bWithoutForeignKey", ")", "{", "$", "aColumns", "=", "$", "this", "->", "removeForeignKeyColumns", "(", "$", "aColumns", ")", ";", "}", "if", "(", "$", "bAliased", ")", "{", "$", "aColumns", "=", "$", "this", "->", "aliaseColumns", "(", "$", "aColumns", ",", "$", "this", "->", "getAlias", "(", ")", ")", ";", "}", "if", "(", "$", "bPrefixed", ")", "{", "$", "aColumns", "=", "$", "this", "->", "prefixeColumns", "(", "$", "aColumns", ",", "$", "this", "->", "getAlias", "(", ")", ")", ";", "}", "return", "$", "aColumns", ";", "}" ]
Get the columns names. @param boolean $bWithoutForeignKey Return with or without foreign keys. @param boolean $bAliased Return or not aliased columns names. @param boolean $bPrefixed Return or not prefixed columns names. @return array
[ "Get", "the", "columns", "names", "." ]
b5e9109c244a29a72403ae6a58633ab96a67c660
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Database/Model.php#L187-L204
17,774
forxer/tao
src/Tao/Database/Model.php
Model.getPrimaryKey
public function getPrimaryKey($bAliased = false) { return $bAliased ? $this->getAlias() . '.' . $this->primaryKey : $this->primaryKey; }
php
public function getPrimaryKey($bAliased = false) { return $bAliased ? $this->getAlias() . '.' . $this->primaryKey : $this->primaryKey; }
[ "public", "function", "getPrimaryKey", "(", "$", "bAliased", "=", "false", ")", "{", "return", "$", "bAliased", "?", "$", "this", "->", "getAlias", "(", ")", ".", "'.'", ".", "$", "this", "->", "primaryKey", ":", "$", "this", "->", "primaryKey", ";", "}" ]
Get the table primary key. @param boolean $bAliased Return or not aliased primary key. @return string
[ "Get", "the", "table", "primary", "key", "." ]
b5e9109c244a29a72403ae6a58633ab96a67c660
https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Database/Model.php#L222-L227
17,775
lelivrescolaire/SQSBundle
DependencyInjection/LLSSQSExtension.php
LLSSQSExtension.loadQueues
public function loadQueues(ContainerBuilder $container, array $config) { foreach ($config as $name => $attributes) { $container ->setDefinition( self::getQueueServiceKey($name), new Definition( $container->getParameter('llssqs.model.queue.class'), array( new Reference( LLSAWSExtension::getServiceServiceKey($attributes['service']) ), new Reference('llssqs.model.message.factory'), $attributes['name'] ) ) ); } return $this; }
php
public function loadQueues(ContainerBuilder $container, array $config) { foreach ($config as $name => $attributes) { $container ->setDefinition( self::getQueueServiceKey($name), new Definition( $container->getParameter('llssqs.model.queue.class'), array( new Reference( LLSAWSExtension::getServiceServiceKey($attributes['service']) ), new Reference('llssqs.model.message.factory'), $attributes['name'] ) ) ); } return $this; }
[ "public", "function", "loadQueues", "(", "ContainerBuilder", "$", "container", ",", "array", "$", "config", ")", "{", "foreach", "(", "$", "config", "as", "$", "name", "=>", "$", "attributes", ")", "{", "$", "container", "->", "setDefinition", "(", "self", "::", "getQueueServiceKey", "(", "$", "name", ")", ",", "new", "Definition", "(", "$", "container", "->", "getParameter", "(", "'llssqs.model.queue.class'", ")", ",", "array", "(", "new", "Reference", "(", "LLSAWSExtension", "::", "getServiceServiceKey", "(", "$", "attributes", "[", "'service'", "]", ")", ")", ",", "new", "Reference", "(", "'llssqs.model.message.factory'", ")", ",", "$", "attributes", "[", "'name'", "]", ")", ")", ")", ";", "}", "return", "$", "this", ";", "}" ]
Load queues from user configuration @param ContainerBuilder $container SF2 Container Builder @param array $config Configuration array @return {$this}
[ "Load", "queues", "from", "user", "configuration" ]
bba3fa6d63d0ae1bddbc7b2fe3c2e737f49d6559
https://github.com/lelivrescolaire/SQSBundle/blob/bba3fa6d63d0ae1bddbc7b2fe3c2e737f49d6559/DependencyInjection/LLSSQSExtension.php#L46-L66
17,776
aedart/config-loader
src/Traits/ConfigLoaderTrait.php
ConfigLoaderTrait.getConfigLoader
public function getConfigLoader(): ?ConfigLoader { if (!$this->hasConfigLoader()) { $this->setConfigLoader($this->getDefaultConfigLoader()); } return $this->configLoader; }
php
public function getConfigLoader(): ?ConfigLoader { if (!$this->hasConfigLoader()) { $this->setConfigLoader($this->getDefaultConfigLoader()); } return $this->configLoader; }
[ "public", "function", "getConfigLoader", "(", ")", ":", "?", "ConfigLoader", "{", "if", "(", "!", "$", "this", "->", "hasConfigLoader", "(", ")", ")", "{", "$", "this", "->", "setConfigLoader", "(", "$", "this", "->", "getDefaultConfigLoader", "(", ")", ")", ";", "}", "return", "$", "this", "->", "configLoader", ";", "}" ]
Get config loader If no config loader has been set, this method will set and return a default config loader, if any such value is available @see getDefaultConfigLoader() @return ConfigLoader|null config loader or null if none config loader has been set
[ "Get", "config", "loader" ]
9e1cf592bee46ba4930bb9c352aaf475d81266ea
https://github.com/aedart/config-loader/blob/9e1cf592bee46ba4930bb9c352aaf475d81266ea/src/Traits/ConfigLoaderTrait.php#L53-L59
17,777
steeffeen/FancyManiaLinks
FML/Script/Features/Tooltip.php
Tooltip.setHoverControl
public function setHoverControl(Control $hoverControl) { $hoverControl->checkId(); if ($hoverControl instanceof Scriptable) { $hoverControl->setScriptEvents(true); } $this->hoverControl = $hoverControl; return $this; }
php
public function setHoverControl(Control $hoverControl) { $hoverControl->checkId(); if ($hoverControl instanceof Scriptable) { $hoverControl->setScriptEvents(true); } $this->hoverControl = $hoverControl; return $this; }
[ "public", "function", "setHoverControl", "(", "Control", "$", "hoverControl", ")", "{", "$", "hoverControl", "->", "checkId", "(", ")", ";", "if", "(", "$", "hoverControl", "instanceof", "Scriptable", ")", "{", "$", "hoverControl", "->", "setScriptEvents", "(", "true", ")", ";", "}", "$", "this", "->", "hoverControl", "=", "$", "hoverControl", ";", "return", "$", "this", ";", "}" ]
Set the Hover Control @api @param Control $hoverControl Hover Control @return static
[ "Set", "the", "Hover", "Control" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/Tooltip.php#L94-L102
17,778
steeffeen/FancyManiaLinks
FML/Script/Features/Tooltip.php
Tooltip.setTooltipControl
public function setTooltipControl(Control $tooltipControl) { $tooltipControl->checkId(); $tooltipControl->setVisible(false); $this->tooltipControl = $tooltipControl; return $this; }
php
public function setTooltipControl(Control $tooltipControl) { $tooltipControl->checkId(); $tooltipControl->setVisible(false); $this->tooltipControl = $tooltipControl; return $this; }
[ "public", "function", "setTooltipControl", "(", "Control", "$", "tooltipControl", ")", "{", "$", "tooltipControl", "->", "checkId", "(", ")", ";", "$", "tooltipControl", "->", "setVisible", "(", "false", ")", ";", "$", "this", "->", "tooltipControl", "=", "$", "tooltipControl", ";", "return", "$", "this", ";", "}" ]
Set the Tooltip Control @api @param Control $tooltipControl Tooltip Control @return static
[ "Set", "the", "Tooltip", "Control" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/Tooltip.php#L122-L128
17,779
steeffeen/FancyManiaLinks
FML/ManiaCode/JoinServer.php
JoinServer.setLogin
public function setLogin($login) { $this->login = (string)$login; $this->ip = null; $this->port = null; return $this; }
php
public function setLogin($login) { $this->login = (string)$login; $this->ip = null; $this->port = null; return $this; }
[ "public", "function", "setLogin", "(", "$", "login", ")", "{", "$", "this", "->", "login", "=", "(", "string", ")", "$", "login", ";", "$", "this", "->", "ip", "=", "null", ";", "$", "this", "->", "port", "=", "null", ";", "return", "$", "this", ";", "}" ]
Set the server login @api @param string $login Server login @return static
[ "Set", "the", "server", "login" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/ManiaCode/JoinServer.php#L77-L83
17,780
steeffeen/FancyManiaLinks
FML/ManiaCode/JoinServer.php
JoinServer.setIp
public function setIp($ip, $port = null) { $this->login = null; $this->ip = (string)$ip; if ($port) { $this->setPort($port); } return $this; }
php
public function setIp($ip, $port = null) { $this->login = null; $this->ip = (string)$ip; if ($port) { $this->setPort($port); } return $this; }
[ "public", "function", "setIp", "(", "$", "ip", ",", "$", "port", "=", "null", ")", "{", "$", "this", "->", "login", "=", "null", ";", "$", "this", "->", "ip", "=", "(", "string", ")", "$", "ip", ";", "if", "(", "$", "port", ")", "{", "$", "this", "->", "setPort", "(", "$", "port", ")", ";", "}", "return", "$", "this", ";", "}" ]
Set the server ip and port @api @param string $ip Server ip @param int $port (optional) Server port @return static
[ "Set", "the", "server", "ip", "and", "port" ]
227b0759306f0a3c75873ba50276e4163a93bfa6
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/ManiaCode/JoinServer.php#L104-L112
17,781
hametuha/gapiwp
src/Hametuha/GapiWP/Service/Prototype.php
Prototype.show_message
protected function show_message($msg, $error = false){ add_action("admin_notices", function() use($msg, $error){ printf('<div class="%s"><p>%s</p></div>', $error ? 'error' : 'updated', esc_html($msg) ); }); }
php
protected function show_message($msg, $error = false){ add_action("admin_notices", function() use($msg, $error){ printf('<div class="%s"><p>%s</p></div>', $error ? 'error' : 'updated', esc_html($msg) ); }); }
[ "protected", "function", "show_message", "(", "$", "msg", ",", "$", "error", "=", "false", ")", "{", "add_action", "(", "\"admin_notices\"", ",", "function", "(", ")", "use", "(", "$", "msg", ",", "$", "error", ")", "{", "printf", "(", "'<div class=\"%s\"><p>%s</p></div>'", ",", "$", "error", "?", "'error'", ":", "'updated'", ",", "esc_html", "(", "$", "msg", ")", ")", ";", "}", ")", ";", "}" ]
Show message on admin screen @param string $msg @param bool $error
[ "Show", "message", "on", "admin", "screen" ]
7b9716d0ebd54c4ab79cca94a4c5aef099a54266
https://github.com/hametuha/gapiwp/blob/7b9716d0ebd54c4ab79cca94a4c5aef099a54266/src/Hametuha/GapiWP/Service/Prototype.php#L31-L35
17,782
boekkooi/tactician-amqp
src/Publisher/ExchangePublisher.php
ExchangePublisher.publishToExchange
protected function publishToExchange(Message $message, \AMQPExchange $exchange) { $isPublished = $exchange->publish( $message->getMessage(), $message->getRoutingKey(), $message->getFlags(), $message->getAttributes() ); if (!$isPublished) { throw FailedToPublishException::fromMessage($message); } return $isPublished; }
php
protected function publishToExchange(Message $message, \AMQPExchange $exchange) { $isPublished = $exchange->publish( $message->getMessage(), $message->getRoutingKey(), $message->getFlags(), $message->getAttributes() ); if (!$isPublished) { throw FailedToPublishException::fromMessage($message); } return $isPublished; }
[ "protected", "function", "publishToExchange", "(", "Message", "$", "message", ",", "\\", "AMQPExchange", "$", "exchange", ")", "{", "$", "isPublished", "=", "$", "exchange", "->", "publish", "(", "$", "message", "->", "getMessage", "(", ")", ",", "$", "message", "->", "getRoutingKey", "(", ")", ",", "$", "message", "->", "getFlags", "(", ")", ",", "$", "message", "->", "getAttributes", "(", ")", ")", ";", "if", "(", "!", "$", "isPublished", ")", "{", "throw", "FailedToPublishException", "::", "fromMessage", "(", "$", "message", ")", ";", "}", "return", "$", "isPublished", ";", "}" ]
Publish the message to AMQP exchange @param Message $message @param \AMQPExchange $exchange @return bool @throws \AMQPException
[ "Publish", "the", "message", "to", "AMQP", "exchange" ]
55cbb8b9e20aab7891e6a6090b248377c599360e
https://github.com/boekkooi/tactician-amqp/blob/55cbb8b9e20aab7891e6a6090b248377c599360e/src/Publisher/ExchangePublisher.php#L38-L52
17,783
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.setCountry
public function setCountry(Country $v = null) { if ($v === null) { $this->setCountryId(NULL); } else { $this->setCountryId($v->getId()); } $this->aCountry = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Country object, it will not be re-added. if ($v !== null) { $v->addCustomer($this); } return $this; }
php
public function setCountry(Country $v = null) { if ($v === null) { $this->setCountryId(NULL); } else { $this->setCountryId($v->getId()); } $this->aCountry = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Country object, it will not be re-added. if ($v !== null) { $v->addCustomer($this); } return $this; }
[ "public", "function", "setCountry", "(", "Country", "$", "v", "=", "null", ")", "{", "if", "(", "$", "v", "===", "null", ")", "{", "$", "this", "->", "setCountryId", "(", "NULL", ")", ";", "}", "else", "{", "$", "this", "->", "setCountryId", "(", "$", "v", "->", "getId", "(", ")", ")", ";", "}", "$", "this", "->", "aCountry", "=", "$", "v", ";", "// Add binding for other direction of this n:n relationship.", "// If this object has already been added to the Country object, it will not be re-added.", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "->", "addCustomer", "(", "$", "this", ")", ";", "}", "return", "$", "this", ";", "}" ]
Declares an association between this object and a Country object. @param Country $v @return Customer The current object (for fluent API support) @throws PropelException
[ "Declares", "an", "association", "between", "this", "object", "and", "a", "Country", "object", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1582-L1600
17,784
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.getCountry
public function getCountry(PropelPDO $con = null, $doQuery = true) { if ($this->aCountry === null && ($this->country_id !== null) && $doQuery) { $this->aCountry = CountryQuery::create()->findPk($this->country_id, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aCountry->addCustomers($this); */ } return $this->aCountry; }
php
public function getCountry(PropelPDO $con = null, $doQuery = true) { if ($this->aCountry === null && ($this->country_id !== null) && $doQuery) { $this->aCountry = CountryQuery::create()->findPk($this->country_id, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aCountry->addCustomers($this); */ } return $this->aCountry; }
[ "public", "function", "getCountry", "(", "PropelPDO", "$", "con", "=", "null", ",", "$", "doQuery", "=", "true", ")", "{", "if", "(", "$", "this", "->", "aCountry", "===", "null", "&&", "(", "$", "this", "->", "country_id", "!==", "null", ")", "&&", "$", "doQuery", ")", "{", "$", "this", "->", "aCountry", "=", "CountryQuery", "::", "create", "(", ")", "->", "findPk", "(", "$", "this", "->", "country_id", ",", "$", "con", ")", ";", "/* The following can be used additionally to\n guarantee the related object contains a reference\n to this object. This level of coupling may, however, be\n undesirable since it could result in an only partially populated collection\n in the referenced object.\n $this->aCountry->addCustomers($this);\n */", "}", "return", "$", "this", "->", "aCountry", ";", "}" ]
Get the associated Country object @param PropelPDO $con Optional Connection object. @param $doQuery Executes a query to get the object if required @return Country The associated Country object. @throws PropelException
[ "Get", "the", "associated", "Country", "object" ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1611-L1625
17,785
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.initRemoteApps
public function initRemoteApps($overrideExisting = true) { if (null !== $this->collRemoteApps && !$overrideExisting) { return; } $this->collRemoteApps = new PropelObjectCollection(); $this->collRemoteApps->setModel('RemoteApp'); }
php
public function initRemoteApps($overrideExisting = true) { if (null !== $this->collRemoteApps && !$overrideExisting) { return; } $this->collRemoteApps = new PropelObjectCollection(); $this->collRemoteApps->setModel('RemoteApp'); }
[ "public", "function", "initRemoteApps", "(", "$", "overrideExisting", "=", "true", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "collRemoteApps", "&&", "!", "$", "overrideExisting", ")", "{", "return", ";", "}", "$", "this", "->", "collRemoteApps", "=", "new", "PropelObjectCollection", "(", ")", ";", "$", "this", "->", "collRemoteApps", "->", "setModel", "(", "'RemoteApp'", ")", ";", "}" ]
Initializes the collRemoteApps collection. By default this just sets the collRemoteApps collection to an empty array (like clearcollRemoteApps()); however, you may wish to override this method in your stub class to provide setting appropriate to your application -- for example, setting the initial array to the values stored in database. @param boolean $overrideExisting If set to true, the method call initializes the collection even if it is not empty @return void
[ "Initializes", "the", "collRemoteApps", "collection", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1685-L1692
17,786
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.getRemoteApps
public function getRemoteApps($criteria = null, PropelPDO $con = null) { $partial = $this->collRemoteAppsPartial && !$this->isNew(); if (null === $this->collRemoteApps || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collRemoteApps) { // return empty collection $this->initRemoteApps(); } else { $collRemoteApps = RemoteAppQuery::create(null, $criteria) ->filterByCustomer($this) ->find($con); if (null !== $criteria) { if (false !== $this->collRemoteAppsPartial && count($collRemoteApps)) { $this->initRemoteApps(false); foreach ($collRemoteApps as $obj) { if (false == $this->collRemoteApps->contains($obj)) { $this->collRemoteApps->append($obj); } } $this->collRemoteAppsPartial = true; } $collRemoteApps->getInternalIterator()->rewind(); return $collRemoteApps; } if ($partial && $this->collRemoteApps) { foreach ($this->collRemoteApps as $obj) { if ($obj->isNew()) { $collRemoteApps[] = $obj; } } } $this->collRemoteApps = $collRemoteApps; $this->collRemoteAppsPartial = false; } } return $this->collRemoteApps; }
php
public function getRemoteApps($criteria = null, PropelPDO $con = null) { $partial = $this->collRemoteAppsPartial && !$this->isNew(); if (null === $this->collRemoteApps || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collRemoteApps) { // return empty collection $this->initRemoteApps(); } else { $collRemoteApps = RemoteAppQuery::create(null, $criteria) ->filterByCustomer($this) ->find($con); if (null !== $criteria) { if (false !== $this->collRemoteAppsPartial && count($collRemoteApps)) { $this->initRemoteApps(false); foreach ($collRemoteApps as $obj) { if (false == $this->collRemoteApps->contains($obj)) { $this->collRemoteApps->append($obj); } } $this->collRemoteAppsPartial = true; } $collRemoteApps->getInternalIterator()->rewind(); return $collRemoteApps; } if ($partial && $this->collRemoteApps) { foreach ($this->collRemoteApps as $obj) { if ($obj->isNew()) { $collRemoteApps[] = $obj; } } } $this->collRemoteApps = $collRemoteApps; $this->collRemoteAppsPartial = false; } } return $this->collRemoteApps; }
[ "public", "function", "getRemoteApps", "(", "$", "criteria", "=", "null", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "partial", "=", "$", "this", "->", "collRemoteAppsPartial", "&&", "!", "$", "this", "->", "isNew", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "collRemoteApps", "||", "null", "!==", "$", "criteria", "||", "$", "partial", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", "&&", "null", "===", "$", "this", "->", "collRemoteApps", ")", "{", "// return empty collection", "$", "this", "->", "initRemoteApps", "(", ")", ";", "}", "else", "{", "$", "collRemoteApps", "=", "RemoteAppQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", "->", "filterByCustomer", "(", "$", "this", ")", "->", "find", "(", "$", "con", ")", ";", "if", "(", "null", "!==", "$", "criteria", ")", "{", "if", "(", "false", "!==", "$", "this", "->", "collRemoteAppsPartial", "&&", "count", "(", "$", "collRemoteApps", ")", ")", "{", "$", "this", "->", "initRemoteApps", "(", "false", ")", ";", "foreach", "(", "$", "collRemoteApps", "as", "$", "obj", ")", "{", "if", "(", "false", "==", "$", "this", "->", "collRemoteApps", "->", "contains", "(", "$", "obj", ")", ")", "{", "$", "this", "->", "collRemoteApps", "->", "append", "(", "$", "obj", ")", ";", "}", "}", "$", "this", "->", "collRemoteAppsPartial", "=", "true", ";", "}", "$", "collRemoteApps", "->", "getInternalIterator", "(", ")", "->", "rewind", "(", ")", ";", "return", "$", "collRemoteApps", ";", "}", "if", "(", "$", "partial", "&&", "$", "this", "->", "collRemoteApps", ")", "{", "foreach", "(", "$", "this", "->", "collRemoteApps", "as", "$", "obj", ")", "{", "if", "(", "$", "obj", "->", "isNew", "(", ")", ")", "{", "$", "collRemoteApps", "[", "]", "=", "$", "obj", ";", "}", "}", "}", "$", "this", "->", "collRemoteApps", "=", "$", "collRemoteApps", ";", "$", "this", "->", "collRemoteAppsPartial", "=", "false", ";", "}", "}", "return", "$", "this", "->", "collRemoteApps", ";", "}" ]
Gets an array of RemoteApp objects which contain a foreign key that references this object. If the $criteria is not null, it is used to always fetch the results from the database. Otherwise the results are fetched from the database the first time, then cached. Next time the same method is called without $criteria, the cached collection is returned. If this Customer is new, it will return an empty collection or the current collection; the criteria is ignored on a new object. @param Criteria $criteria optional Criteria object to narrow the query @param PropelPDO $con optional connection object @return PropelObjectCollection|RemoteApp[] List of RemoteApp objects @throws PropelException
[ "Gets", "an", "array", "of", "RemoteApp", "objects", "which", "contain", "a", "foreign", "key", "that", "references", "this", "object", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1708-L1751
17,787
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.countRemoteApps
public function countRemoteApps(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { $partial = $this->collRemoteAppsPartial && !$this->isNew(); if (null === $this->collRemoteApps || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collRemoteApps) { return 0; } if ($partial && !$criteria) { return count($this->getRemoteApps()); } $query = RemoteAppQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByCustomer($this) ->count($con); } return count($this->collRemoteApps); }
php
public function countRemoteApps(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { $partial = $this->collRemoteAppsPartial && !$this->isNew(); if (null === $this->collRemoteApps || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collRemoteApps) { return 0; } if ($partial && !$criteria) { return count($this->getRemoteApps()); } $query = RemoteAppQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByCustomer($this) ->count($con); } return count($this->collRemoteApps); }
[ "public", "function", "countRemoteApps", "(", "Criteria", "$", "criteria", "=", "null", ",", "$", "distinct", "=", "false", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "partial", "=", "$", "this", "->", "collRemoteAppsPartial", "&&", "!", "$", "this", "->", "isNew", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "collRemoteApps", "||", "null", "!==", "$", "criteria", "||", "$", "partial", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", "&&", "null", "===", "$", "this", "->", "collRemoteApps", ")", "{", "return", "0", ";", "}", "if", "(", "$", "partial", "&&", "!", "$", "criteria", ")", "{", "return", "count", "(", "$", "this", "->", "getRemoteApps", "(", ")", ")", ";", "}", "$", "query", "=", "RemoteAppQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", ";", "if", "(", "$", "distinct", ")", "{", "$", "query", "->", "distinct", "(", ")", ";", "}", "return", "$", "query", "->", "filterByCustomer", "(", "$", "this", ")", "->", "count", "(", "$", "con", ")", ";", "}", "return", "count", "(", "$", "this", "->", "collRemoteApps", ")", ";", "}" ]
Returns the number of related RemoteApp objects. @param Criteria $criteria @param boolean $distinct @param PropelPDO $con @return int Count of related RemoteApp objects. @throws PropelException
[ "Returns", "the", "number", "of", "related", "RemoteApp", "objects", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1794-L1816
17,788
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.addRemoteApp
public function addRemoteApp(RemoteApp $l) { if ($this->collRemoteApps === null) { $this->initRemoteApps(); $this->collRemoteAppsPartial = true; } if (!in_array($l, $this->collRemoteApps->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddRemoteApp($l); if ($this->remoteAppsScheduledForDeletion and $this->remoteAppsScheduledForDeletion->contains($l)) { $this->remoteAppsScheduledForDeletion->remove($this->remoteAppsScheduledForDeletion->search($l)); } } return $this; }
php
public function addRemoteApp(RemoteApp $l) { if ($this->collRemoteApps === null) { $this->initRemoteApps(); $this->collRemoteAppsPartial = true; } if (!in_array($l, $this->collRemoteApps->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddRemoteApp($l); if ($this->remoteAppsScheduledForDeletion and $this->remoteAppsScheduledForDeletion->contains($l)) { $this->remoteAppsScheduledForDeletion->remove($this->remoteAppsScheduledForDeletion->search($l)); } } return $this; }
[ "public", "function", "addRemoteApp", "(", "RemoteApp", "$", "l", ")", "{", "if", "(", "$", "this", "->", "collRemoteApps", "===", "null", ")", "{", "$", "this", "->", "initRemoteApps", "(", ")", ";", "$", "this", "->", "collRemoteAppsPartial", "=", "true", ";", "}", "if", "(", "!", "in_array", "(", "$", "l", ",", "$", "this", "->", "collRemoteApps", "->", "getArrayCopy", "(", ")", ",", "true", ")", ")", "{", "// only add it if the **same** object is not already associated", "$", "this", "->", "doAddRemoteApp", "(", "$", "l", ")", ";", "if", "(", "$", "this", "->", "remoteAppsScheduledForDeletion", "and", "$", "this", "->", "remoteAppsScheduledForDeletion", "->", "contains", "(", "$", "l", ")", ")", "{", "$", "this", "->", "remoteAppsScheduledForDeletion", "->", "remove", "(", "$", "this", "->", "remoteAppsScheduledForDeletion", "->", "search", "(", "$", "l", ")", ")", ";", "}", "}", "return", "$", "this", ";", "}" ]
Method called to associate a RemoteApp object to this object through the RemoteApp foreign key attribute. @param RemoteApp $l RemoteApp @return Customer The current object (for fluent API support)
[ "Method", "called", "to", "associate", "a", "RemoteApp", "object", "to", "this", "object", "through", "the", "RemoteApp", "foreign", "key", "attribute", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1825-L1841
17,789
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.initUserCustomerRelations
public function initUserCustomerRelations($overrideExisting = true) { if (null !== $this->collUserCustomerRelations && !$overrideExisting) { return; } $this->collUserCustomerRelations = new PropelObjectCollection(); $this->collUserCustomerRelations->setModel('UserCustomerRelation'); }
php
public function initUserCustomerRelations($overrideExisting = true) { if (null !== $this->collUserCustomerRelations && !$overrideExisting) { return; } $this->collUserCustomerRelations = new PropelObjectCollection(); $this->collUserCustomerRelations->setModel('UserCustomerRelation'); }
[ "public", "function", "initUserCustomerRelations", "(", "$", "overrideExisting", "=", "true", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "collUserCustomerRelations", "&&", "!", "$", "overrideExisting", ")", "{", "return", ";", "}", "$", "this", "->", "collUserCustomerRelations", "=", "new", "PropelObjectCollection", "(", ")", ";", "$", "this", "->", "collUserCustomerRelations", "->", "setModel", "(", "'UserCustomerRelation'", ")", ";", "}" ]
Initializes the collUserCustomerRelations collection. By default this just sets the collUserCustomerRelations collection to an empty array (like clearcollUserCustomerRelations()); however, you may wish to override this method in your stub class to provide setting appropriate to your application -- for example, setting the initial array to the values stored in database. @param boolean $overrideExisting If set to true, the method call initializes the collection even if it is not empty @return void
[ "Initializes", "the", "collUserCustomerRelations", "collection", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L1910-L1917
17,790
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseCustomer.php
BaseCustomer.addUserCustomerRelation
public function addUserCustomerRelation(UserCustomerRelation $l) { if ($this->collUserCustomerRelations === null) { $this->initUserCustomerRelations(); $this->collUserCustomerRelationsPartial = true; } if (!in_array($l, $this->collUserCustomerRelations->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddUserCustomerRelation($l); if ($this->userCustomerRelationsScheduledForDeletion and $this->userCustomerRelationsScheduledForDeletion->contains($l)) { $this->userCustomerRelationsScheduledForDeletion->remove($this->userCustomerRelationsScheduledForDeletion->search($l)); } } return $this; }
php
public function addUserCustomerRelation(UserCustomerRelation $l) { if ($this->collUserCustomerRelations === null) { $this->initUserCustomerRelations(); $this->collUserCustomerRelationsPartial = true; } if (!in_array($l, $this->collUserCustomerRelations->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddUserCustomerRelation($l); if ($this->userCustomerRelationsScheduledForDeletion and $this->userCustomerRelationsScheduledForDeletion->contains($l)) { $this->userCustomerRelationsScheduledForDeletion->remove($this->userCustomerRelationsScheduledForDeletion->search($l)); } } return $this; }
[ "public", "function", "addUserCustomerRelation", "(", "UserCustomerRelation", "$", "l", ")", "{", "if", "(", "$", "this", "->", "collUserCustomerRelations", "===", "null", ")", "{", "$", "this", "->", "initUserCustomerRelations", "(", ")", ";", "$", "this", "->", "collUserCustomerRelationsPartial", "=", "true", ";", "}", "if", "(", "!", "in_array", "(", "$", "l", ",", "$", "this", "->", "collUserCustomerRelations", "->", "getArrayCopy", "(", ")", ",", "true", ")", ")", "{", "// only add it if the **same** object is not already associated", "$", "this", "->", "doAddUserCustomerRelation", "(", "$", "l", ")", ";", "if", "(", "$", "this", "->", "userCustomerRelationsScheduledForDeletion", "and", "$", "this", "->", "userCustomerRelationsScheduledForDeletion", "->", "contains", "(", "$", "l", ")", ")", "{", "$", "this", "->", "userCustomerRelationsScheduledForDeletion", "->", "remove", "(", "$", "this", "->", "userCustomerRelationsScheduledForDeletion", "->", "search", "(", "$", "l", ")", ")", ";", "}", "}", "return", "$", "this", ";", "}" ]
Method called to associate a UserCustomerRelation object to this object through the UserCustomerRelation foreign key attribute. @param UserCustomerRelation $l UserCustomerRelation @return Customer The current object (for fluent API support)
[ "Method", "called", "to", "associate", "a", "UserCustomerRelation", "object", "to", "this", "object", "through", "the", "UserCustomerRelation", "foreign", "key", "attribute", "." ]
2ba86d96f1f41f9424e2229c4e2b13017e973f89
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomer.php#L2050-L2066
17,791
comodojo/qotd
src/Qotd.php
Qotd.getQuote
public function getQuote() { if ( is_null($this->quotes) ) return $this->no_quotes_message; return $this->quotes[rand(1,sizeof($this->quotes)-1)]; }
php
public function getQuote() { if ( is_null($this->quotes) ) return $this->no_quotes_message; return $this->quotes[rand(1,sizeof($this->quotes)-1)]; }
[ "public", "function", "getQuote", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "quotes", ")", ")", "return", "$", "this", "->", "no_quotes_message", ";", "return", "$", "this", "->", "quotes", "[", "rand", "(", "1", ",", "sizeof", "(", "$", "this", "->", "quotes", ")", "-", "1", ")", "]", ";", "}" ]
Get single quote @return string
[ "Get", "single", "quote" ]
7ef890491e8d3d5d7ba05116f4277708f788ad60
https://github.com/comodojo/qotd/blob/7ef890491e8d3d5d7ba05116f4277708f788ad60/src/Qotd.php#L74-L80
17,792
comodojo/qotd
src/Qotd.php
Qotd.getQuotesAsStore
public function getQuotesAsStore() { if ( is_null($this->quotes) ) return array(array('id'=>0, 'quote'=>$this->no_quotes_message)); $return = array(); foreach($this->quotes as $id=>$quote) array_push($return, array('id'=>$id, 'quote'=>$quote)); return $return; }
php
public function getQuotesAsStore() { if ( is_null($this->quotes) ) return array(array('id'=>0, 'quote'=>$this->no_quotes_message)); $return = array(); foreach($this->quotes as $id=>$quote) array_push($return, array('id'=>$id, 'quote'=>$quote)); return $return; }
[ "public", "function", "getQuotesAsStore", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "quotes", ")", ")", "return", "array", "(", "array", "(", "'id'", "=>", "0", ",", "'quote'", "=>", "$", "this", "->", "no_quotes_message", ")", ")", ";", "$", "return", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "quotes", "as", "$", "id", "=>", "$", "quote", ")", "array_push", "(", "$", "return", ",", "array", "(", "'id'", "=>", "$", "id", ",", "'quote'", "=>", "$", "quote", ")", ")", ";", "return", "$", "return", ";", "}" ]
Get all quotes as a store @return array
[ "Get", "all", "quotes", "as", "a", "store" ]
7ef890491e8d3d5d7ba05116f4277708f788ad60
https://github.com/comodojo/qotd/blob/7ef890491e8d3d5d7ba05116f4277708f788ad60/src/Qotd.php#L87-L97
17,793
picamator/CacheManager
src/CacheManagerSubject.php
CacheManagerSubject.getObserverList
private function getObserverList(string $name) : \SplObjectStorage { if (empty($this->observerContainer[$name])) { $this->observerContainer[$name] = new \SplObjectStorage(); } return $this->observerContainer[$name]; }
php
private function getObserverList(string $name) : \SplObjectStorage { if (empty($this->observerContainer[$name])) { $this->observerContainer[$name] = new \SplObjectStorage(); } return $this->observerContainer[$name]; }
[ "private", "function", "getObserverList", "(", "string", "$", "name", ")", ":", "\\", "SplObjectStorage", "{", "if", "(", "empty", "(", "$", "this", "->", "observerContainer", "[", "$", "name", "]", ")", ")", "{", "$", "this", "->", "observerContainer", "[", "$", "name", "]", "=", "new", "\\", "SplObjectStorage", "(", ")", ";", "}", "return", "$", "this", "->", "observerContainer", "[", "$", "name", "]", ";", "}" ]
Retrieve observer list. @param string $name @return \SplObjectStorage
[ "Retrieve", "observer", "list", "." ]
5e5493910610b65ae31a362786d7963ba3e33806
https://github.com/picamator/CacheManager/blob/5e5493910610b65ae31a362786d7963ba3e33806/src/CacheManagerSubject.php#L194-L201
17,794
picamator/CacheManager
src/CacheManagerSubject.php
CacheManagerSubject.hasObserver
private function hasObserver(string $name) : bool { return !empty($this->observerContainer[$name]) && $this->observerContainer[$name]->count(); }
php
private function hasObserver(string $name) : bool { return !empty($this->observerContainer[$name]) && $this->observerContainer[$name]->count(); }
[ "private", "function", "hasObserver", "(", "string", "$", "name", ")", ":", "bool", "{", "return", "!", "empty", "(", "$", "this", "->", "observerContainer", "[", "$", "name", "]", ")", "&&", "$", "this", "->", "observerContainer", "[", "$", "name", "]", "->", "count", "(", ")", ";", "}" ]
Check whatever observer container has at least one observer. @param string $name @return bool _true_ observer container has at least one observer, _false_ otherwise
[ "Check", "whatever", "observer", "container", "has", "at", "least", "one", "observer", "." ]
5e5493910610b65ae31a362786d7963ba3e33806
https://github.com/picamator/CacheManager/blob/5e5493910610b65ae31a362786d7963ba3e33806/src/CacheManagerSubject.php#L210-L213
17,795
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.when
public function when($value, callable $callback): CollectionInterface { if ($value) { $this->generator = $callback($this)->generator; } return $this; }
php
public function when($value, callable $callback): CollectionInterface { if ($value) { $this->generator = $callback($this)->generator; } return $this; }
[ "public", "function", "when", "(", "$", "value", ",", "callable", "$", "callback", ")", ":", "CollectionInterface", "{", "if", "(", "$", "value", ")", "{", "$", "this", "->", "generator", "=", "$", "callback", "(", "$", "this", ")", "->", "generator", ";", "}", "return", "$", "this", ";", "}" ]
Apply the callback if the value is truthy. @param bool $value @param callable $callback @return mixed
[ "Apply", "the", "callback", "if", "the", "value", "is", "truthy", "." ]
21e761c9c0457d85b5ec62d11051de2a62c3ee34
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L291-L298
17,796
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.flatten
public function flatten($depth = INF): CollectionInterface { return $this->wrap(function (Iterator $data) use ($depth) { $lowerDepth = $depth === INF ? INF : $depth - 1; foreach ($data as $key => $datum) { if ($lowerDepth >= 0 && is_iterable($datum)) { $collection = $this::make($datum); foreach ($collection->flatten($lowerDepth)->getIterator() as $item) { yield $item; } } else { yield $datum; } } }); }
php
public function flatten($depth = INF): CollectionInterface { return $this->wrap(function (Iterator $data) use ($depth) { $lowerDepth = $depth === INF ? INF : $depth - 1; foreach ($data as $key => $datum) { if ($lowerDepth >= 0 && is_iterable($datum)) { $collection = $this::make($datum); foreach ($collection->flatten($lowerDepth)->getIterator() as $item) { yield $item; } } else { yield $datum; } } }); }
[ "public", "function", "flatten", "(", "$", "depth", "=", "INF", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "use", "(", "$", "depth", ")", "{", "$", "lowerDepth", "=", "$", "depth", "===", "INF", "?", "INF", ":", "$", "depth", "-", "1", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "datum", ")", "{", "if", "(", "$", "lowerDepth", ">=", "0", "&&", "is_iterable", "(", "$", "datum", ")", ")", "{", "$", "collection", "=", "$", "this", "::", "make", "(", "$", "datum", ")", ";", "foreach", "(", "$", "collection", "->", "flatten", "(", "$", "lowerDepth", ")", "->", "getIterator", "(", ")", "as", "$", "item", ")", "{", "yield", "$", "item", ";", "}", "}", "else", "{", "yield", "$", "datum", ";", "}", "}", "}", ")", ";", "}" ]
Get a flattened array of the items in the collection. @param int $depth @return CollectionInterface
[ "Get", "a", "flattened", "array", "of", "the", "items", "in", "the", "collection", "." ]
21e761c9c0457d85b5ec62d11051de2a62c3ee34
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L367-L383
17,797
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.flatMap
public function flatMap(callable $callback, $depth = INF): CollectionInterface { return $this->map($callback)->flatten($depth); }
php
public function flatMap(callable $callback, $depth = INF): CollectionInterface { return $this->map($callback)->flatten($depth); }
[ "public", "function", "flatMap", "(", "callable", "$", "callback", ",", "$", "depth", "=", "INF", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "map", "(", "$", "callback", ")", "->", "flatten", "(", "$", "depth", ")", ";", "}" ]
Map then flatten @param callable $callback @param $depth @return \Buttress\Collection\CollectionInterface
[ "Map", "then", "flatten" ]
21e761c9c0457d85b5ec62d11051de2a62c3ee34
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L391-L394
17,798
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.flip
public function flip(): CollectionInterface { return $this->wrap(function (Iterator $data) { foreach ($data as $key => $item) { yield $item => $key; } }); }
php
public function flip(): CollectionInterface { return $this->wrap(function (Iterator $data) { foreach ($data as $key => $item) { yield $item => $key; } }); }
[ "public", "function", "flip", "(", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "{", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "item", ")", "{", "yield", "$", "item", "=>", "$", "key", ";", "}", "}", ")", ";", "}" ]
Flip the items in the collection. @return CollectionInterface
[ "Flip", "the", "items", "in", "the", "collection", "." ]
21e761c9c0457d85b5ec62d11051de2a62c3ee34
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L401-L408
17,799
buttress/collecterator
src/GeneratorCollection.php
GeneratorCollection.keys
public function keys(): CollectionInterface { return $this->wrap(function (Iterator $data) { foreach ($data as $key => $value) { yield $key; } }); }
php
public function keys(): CollectionInterface { return $this->wrap(function (Iterator $data) { foreach ($data as $key => $value) { yield $key; } }); }
[ "public", "function", "keys", "(", ")", ":", "CollectionInterface", "{", "return", "$", "this", "->", "wrap", "(", "function", "(", "Iterator", "$", "data", ")", "{", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "yield", "$", "key", ";", "}", "}", ")", ";", "}" ]
Get the keys of the collection items. @return CollectionInterface
[ "Get", "the", "keys", "of", "the", "collection", "items", "." ]
21e761c9c0457d85b5ec62d11051de2a62c3ee34
https://github.com/buttress/collecterator/blob/21e761c9c0457d85b5ec62d11051de2a62c3ee34/src/GeneratorCollection.php#L540-L547