repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
terdia/legato-framework
src/Request.php
Request.getHeader
public function getHeader($key, $default = false) { return $this->headers->has($key) ? $this->headers->get($key) : $default; }
php
public function getHeader($key, $default = false) { return $this->headers->has($key) ? $this->headers->get($key) : $default; }
[ "public", "function", "getHeader", "(", "$", "key", ",", "$", "default", "=", "false", ")", "{", "return", "$", "this", "->", "headers", "->", "has", "(", "$", "key", ")", "?", "$", "this", "->", "headers", "->", "get", "(", "$", "key", ")", ":",...
Get specific header. @param $key @param bool $default @return bool|string|string[]
[ "Get", "specific", "header", "." ]
train
https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Request.php#L127-L130
terdia/legato-framework
src/Request.php
Request.old
public static function old($key = null) { if (is_null($key)) { return session()->getFlashMessage('request') ?: ''; } return session()->getFlashMessage($key) ?: ''; }
php
public static function old($key = null) { if (is_null($key)) { return session()->getFlashMessage('request') ?: ''; } return session()->getFlashMessage($key) ?: ''; }
[ "public", "static", "function", "old", "(", "$", "key", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "key", ")", ")", "{", "return", "session", "(", ")", "->", "getFlashMessage", "(", "'request'", ")", "?", ":", "''", ";", "}", "return", ...
Get old request value from session. @param $key @return string
[ "Get", "old", "request", "value", "from", "session", "." ]
train
https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Request.php#L200-L207
transfer-framework/transfer
src/Transfer/Procedure/Procedure.php
Procedure.createFromDefinition
public static function createFromDefinition(array $definition, Procedure $parent = null) { $procedure = new self( $definition['name'], $definition['sources'], $definition['workers'], $definition['targets'], $parent ); foreach ($def...
php
public static function createFromDefinition(array $definition, Procedure $parent = null) { $procedure = new self( $definition['name'], $definition['sources'], $definition['workers'], $definition['targets'], $parent ); foreach ($def...
[ "public", "static", "function", "createFromDefinition", "(", "array", "$", "definition", ",", "Procedure", "$", "parent", "=", "null", ")", "{", "$", "procedure", "=", "new", "self", "(", "$", "definition", "[", "'name'", "]", ",", "$", "definition", "[", ...
Creates a procedure from a definition. Procedure definition must be an array consisting of following elements: * name : string * sources : array of source adapters * workers : array of workers * targets : array of target adapters @param array $definition Procedure definition (how a procedure should be built) @par...
[ "Creates", "a", "procedure", "from", "a", "definition", "." ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Procedure/Procedure.php#L77-L92
transfer-framework/transfer
src/Transfer/Procedure/Procedure.php
Procedure.procedureExists
public function procedureExists($name, $context = null, $level = 0) { $context = $this->normalizeContext($context); if (!is_array($name)) { $name = array($name); } /** @var Procedure $procedure */ foreach ($context->getChildren() as $procedure) { if ...
php
public function procedureExists($name, $context = null, $level = 0) { $context = $this->normalizeContext($context); if (!is_array($name)) { $name = array($name); } /** @var Procedure $procedure */ foreach ($context->getChildren() as $procedure) { if ...
[ "public", "function", "procedureExists", "(", "$", "name", ",", "$", "context", "=", "null", ",", "$", "level", "=", "0", ")", "{", "$", "context", "=", "$", "this", "->", "normalizeContext", "(", "$", "context", ")", ";", "if", "(", "!", "is_array",...
Tests, if a (sub-)procedure exists. @param string|array $name Procedure name @param Procedure $context Current context @param int $level Current level @return bool True, if procedure exists
[ "Tests", "if", "a", "(", "sub", "-", ")", "procedure", "exists", "." ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Procedure/Procedure.php#L153-L171
transfer-framework/transfer
src/Transfer/Procedure/Procedure.php
Procedure.getParentSettings
private function getParentSettings($type, $context = null) { $context = $this->normalizeContext($context); $methods = array( 'source' => 'getSources', 'worker' => 'getWorkers', 'target' => 'getTargets', ); if (!array_key_exists($type, $methods) |...
php
private function getParentSettings($type, $context = null) { $context = $this->normalizeContext($context); $methods = array( 'source' => 'getSources', 'worker' => 'getWorkers', 'target' => 'getTargets', ); if (!array_key_exists($type, $methods) |...
[ "private", "function", "getParentSettings", "(", "$", "type", ",", "$", "context", "=", "null", ")", "{", "$", "context", "=", "$", "this", "->", "normalizeContext", "(", "$", "context", ")", ";", "$", "methods", "=", "array", "(", "'source'", "=>", "'...
Returns parent settings. @param string $type Setting type (source, worker or target) @param Procedure $context @return array Setting collection @internal
[ "Returns", "parent", "settings", "." ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Procedure/Procedure.php#L213-L233
transfer-framework/transfer
src/Transfer/Procedure/Procedure.php
Procedure.getParentComponentSettings
private function getParentComponentSettings($context, $method) { $settings = array(); foreach (call_user_func(array($context, $method)) as $setting) { $settings[] = $setting; } return $settings; }
php
private function getParentComponentSettings($context, $method) { $settings = array(); foreach (call_user_func(array($context, $method)) as $setting) { $settings[] = $setting; } return $settings; }
[ "private", "function", "getParentComponentSettings", "(", "$", "context", ",", "$", "method", ")", "{", "$", "settings", "=", "array", "(", ")", ";", "foreach", "(", "call_user_func", "(", "array", "(", "$", "context", ",", "$", "method", ")", ")", "as",...
@param Procedure $context @param string $method @return array @internal
[ "@param", "Procedure", "$context", "@param", "string", "$method" ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Procedure/Procedure.php#L243-L252
attm2x/m2x-php
src/DeviceCollection.php
DeviceCollection.path
protected function path() { if ($this->parent) { return $this->parent->path() . '/devices'; } $class = static::$resourceClass; $path = $class::$path; if ($this->catalog) { $path .= '/catalog'; } return $path; }
php
protected function path() { if ($this->parent) { return $this->parent->path() . '/devices'; } $class = static::$resourceClass; $path = $class::$path; if ($this->catalog) { $path .= '/catalog'; } return $path; }
[ "protected", "function", "path", "(", ")", "{", "if", "(", "$", "this", "->", "parent", ")", "{", "return", "$", "this", "->", "parent", "->", "path", "(", ")", ".", "'/devices'", ";", "}", "$", "class", "=", "static", "::", "$", "resourceClass", "...
Return the API path for the query @return void
[ "Return", "the", "API", "path", "for", "the", "query" ]
train
https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/DeviceCollection.php#L62-L73
reinvanoyen/aegis
lib/Aegis/Node.php
Node.getAttribute
public function getAttribute(int $index) : ?Node { return isset($this->attributes[$index]) ? $this->attributes[$index] : null; }
php
public function getAttribute(int $index) : ?Node { return isset($this->attributes[$index]) ? $this->attributes[$index] : null; }
[ "public", "function", "getAttribute", "(", "int", "$", "index", ")", ":", "?", "Node", "{", "return", "isset", "(", "$", "this", "->", "attributes", "[", "$", "index", "]", ")", "?", "$", "this", "->", "attributes", "[", "$", "index", "]", ":", "nu...
Gets an attribute node @param int $index @return Node|null
[ "Gets", "an", "attribute", "node" ]
train
https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Node.php#L59-L62
reinvanoyen/aegis
lib/Aegis/Node.php
Node.getChild
public function getChild(int $index) : Node { if (!isset($this->children[$index])) { throw new AegisError('Could not get child from node, because there\'s no child at index '.$i); } return $this->children[$index]; }
php
public function getChild(int $index) : Node { if (!isset($this->children[$index])) { throw new AegisError('Could not get child from node, because there\'s no child at index '.$i); } return $this->children[$index]; }
[ "public", "function", "getChild", "(", "int", "$", "index", ")", ":", "Node", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "children", "[", "$", "index", "]", ")", ")", "{", "throw", "new", "AegisError", "(", "'Could not get child from node, bec...
Gets the child at the given index @param int $index @return Node @throws AegisError
[ "Gets", "the", "child", "at", "the", "given", "index" ]
train
https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Node.php#L116-L123
reinvanoyen/aegis
lib/Aegis/Node.php
Node.removeChild
public function removeChild(int $index) { if (!isset($this->children[$index])) { throw new AegisError('Could remove child from node, because there\'s no child at index '.$index); } unset($this->children[$index]); }
php
public function removeChild(int $index) { if (!isset($this->children[$index])) { throw new AegisError('Could remove child from node, because there\'s no child at index '.$index); } unset($this->children[$index]); }
[ "public", "function", "removeChild", "(", "int", "$", "index", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "children", "[", "$", "index", "]", ")", ")", "{", "throw", "new", "AegisError", "(", "'Could remove child from node, because there\\'s ...
Removes the child node at the given index @param int $index @throws AegisError
[ "Removes", "the", "child", "node", "at", "the", "given", "index" ]
train
https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Node.php#L148-L155
ikwattro/guzzle-stereo
src/Record/Tape.php
Tape.processFiltersStack
public function processFiltersStack(ResponseInterface $response) { if (!$this->hasFilters()) { return true; } foreach ($this->filters as $filter) { if ($filter->isIncluded($response)) { return true; } } return false; }
php
public function processFiltersStack(ResponseInterface $response) { if (!$this->hasFilters()) { return true; } foreach ($this->filters as $filter) { if ($filter->isIncluded($response)) { return true; } } return false; }
[ "public", "function", "processFiltersStack", "(", "ResponseInterface", "$", "response", ")", "{", "if", "(", "!", "$", "this", "->", "hasFilters", "(", ")", ")", "{", "return", "true", ";", "}", "foreach", "(", "$", "this", "->", "filters", "as", "$", ...
@param \Psr\Http\Message\ResponseInterface $response @return bool
[ "@param", "\\", "Psr", "\\", "Http", "\\", "Message", "\\", "ResponseInterface", "$response" ]
train
https://github.com/ikwattro/guzzle-stereo/blob/a76f19b0a81048eca104f07bd490bf06a46b6e9d/src/Record/Tape.php#L105-L118
markwatkinson/luminous
src/Luminous.php
Luminous.highlight
public static function highlight($scanner, $source, $cacheOrSettings = null) { global $luminous_; try { $settings = null; if (is_bool($cacheOrSettings)) { $settings = array('cache' => $cacheOrSettings); } elseif (is_array($cacheOrSettings)) { ...
php
public static function highlight($scanner, $source, $cacheOrSettings = null) { global $luminous_; try { $settings = null; if (is_bool($cacheOrSettings)) { $settings = array('cache' => $cacheOrSettings); } elseif (is_array($cacheOrSettings)) { ...
[ "public", "static", "function", "highlight", "(", "$", "scanner", ",", "$", "source", ",", "$", "cacheOrSettings", "=", "null", ")", "{", "global", "$", "luminous_", ";", "try", "{", "$", "settings", "=", "null", ";", "if", "(", "is_bool", "(", "$", ...
@brief Highlights a string according to the current settings @param $scanner The scanner to use, this can either be a langauge code, or it can be an instance of LuminousScanner. @param $source The source string @param $cache Whether or not to use the cache @return the highlighted source code. To specify different out...
[ "@brief", "Highlights", "a", "string", "according", "to", "the", "current", "settings" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous.php#L33-L70
markwatkinson/luminous
src/Luminous.php
Luminous.highlightFile
public static function highlightFile($scanner, $file, $cacheOrSettings = null) { return self::highlight($scanner, file_get_contents($file), $cacheOrSettings); }
php
public static function highlightFile($scanner, $file, $cacheOrSettings = null) { return self::highlight($scanner, file_get_contents($file), $cacheOrSettings); }
[ "public", "static", "function", "highlightFile", "(", "$", "scanner", ",", "$", "file", ",", "$", "cacheOrSettings", "=", "null", ")", "{", "return", "self", "::", "highlight", "(", "$", "scanner", ",", "file_get_contents", "(", "$", "file", ")", ",", "$...
@brief Highlights a file according to the current setings. @param $scanner The scanner to use, this can either be a langauge code, or it can be an instance of LuminousScanner. @param $file the source string @param $cache Whether or not to use the cache @return the highlighted source code. To specify different output ...
[ "@brief", "Highlights", "a", "file", "according", "to", "the", "current", "setings", "." ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous.php#L83-L86
markwatkinson/luminous
src/Luminous.php
Luminous.cacheErrors
public static function cacheErrors() { global $luminous_; $c = $luminous_->cache; if ($c === null) { return false; } return $c->errors(); }
php
public static function cacheErrors() { global $luminous_; $c = $luminous_->cache; if ($c === null) { return false; } return $c->errors(); }
[ "public", "static", "function", "cacheErrors", "(", ")", "{", "global", "$", "luminous_", ";", "$", "c", "=", "$", "luminous_", "->", "cache", ";", "if", "(", "$", "c", "===", "null", ")", "{", "return", "false", ";", "}", "return", "$", "c", "->",...
@brief Returns a list of cache errors encountered during the most recent highlight @return An array of errors the cache encountered (which may be empty), or @c FALSE if the cache is not enabled
[ "@brief", "Returns", "a", "list", "of", "cache", "errors", "encountered", "during", "the", "most", "recent", "highlight" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous.php#L94-L102
markwatkinson/luminous
src/Luminous.php
Luminous.registerScanner
public static function registerScanner( $languageCode, $classname, $readableLanguage ) { global $luminous_; $luminous_->scanners->AddScanner( $languageCode, $classname, $readableLanguage ); }
php
public static function registerScanner( $languageCode, $classname, $readableLanguage ) { global $luminous_; $luminous_->scanners->AddScanner( $languageCode, $classname, $readableLanguage ); }
[ "public", "static", "function", "registerScanner", "(", "$", "languageCode", ",", "$", "classname", ",", "$", "readableLanguage", ")", "{", "global", "$", "luminous_", ";", "$", "luminous_", "->", "scanners", "->", "AddScanner", "(", "$", "languageCode", ",", ...
@brief Registers a scanner Registers a scanner with Luminous's scanner table. Utilising this function means that Luminous will handle instantiation and inclusion of the scanner's source file in a lazy-manner. @param $language_code A string or array of strings designating the aliases by which this scanner may be acces...
[ "@brief", "Registers", "a", "scanner" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous.php#L123-L134
markwatkinson/luminous
src/Luminous.php
Luminous.themes
public static function themes() { $themesUri = self::root() . '/style/'; $themes = array(); foreach (glob($themesUri . '/*.css') as $css) { $fn = trim(preg_replace("%.*/%", '', $css)); switch ($fn) { // these are special, exclude these ...
php
public static function themes() { $themesUri = self::root() . '/style/'; $themes = array(); foreach (glob($themesUri . '/*.css') as $css) { $fn = trim(preg_replace("%.*/%", '', $css)); switch ($fn) { // these are special, exclude these ...
[ "public", "static", "function", "themes", "(", ")", "{", "$", "themesUri", "=", "self", "::", "root", "(", ")", ".", "'/style/'", ";", "$", "themes", "=", "array", "(", ")", ";", "foreach", "(", "glob", "(", "$", "themesUri", ".", "'/*.css'", ")", ...
@brief Gets a list of installed themes @return the list of theme files present in style/. Each theme will simply be a filename, and will end in .css, and will not have any directory prefix.
[ "@brief", "Gets", "a", "list", "of", "installed", "themes" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous.php#L153-L170
markwatkinson/luminous
src/Luminous.php
Luminous.theme
public static function theme($theme) { if (!preg_match('/\.css$/i', $theme)) { $theme .= '.css'; } if (self::themeExists($theme)) { return file_get_contents(self::root() . "/style/" . $theme); } else { throw new Exception('No such theme file: ' . $...
php
public static function theme($theme) { if (!preg_match('/\.css$/i', $theme)) { $theme .= '.css'; } if (self::themeExists($theme)) { return file_get_contents(self::root() . "/style/" . $theme); } else { throw new Exception('No such theme file: ' . $...
[ "public", "static", "function", "theme", "(", "$", "theme", ")", "{", "if", "(", "!", "preg_match", "(", "'/\\.css$/i'", ",", "$", "theme", ")", ")", "{", "$", "theme", ".=", "'.css'", ";", "}", "if", "(", "self", "::", "themeExists", "(", "$", "th...
@brief Reads a CSS theme file Gets the CSS-string content of a theme file. Use this function for reading themes as it involves security checks against reading arbitrary files @param $theme The name of the theme to retrieve, which may or may not include the .css suffix. @return the content of a theme; this is the actua...
[ "@brief", "Reads", "a", "CSS", "theme", "file", "Gets", "the", "CSS", "-", "string", "content", "of", "a", "theme", "file", ".", "Use", "this", "function", "for", "reading", "themes", "as", "it", "involves", "security", "checks", "against", "reading", "arb...
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous.php#L193-L203
markwatkinson/luminous
src/Luminous.php
Luminous.set
public static function set($option, $value = null) { global $luminous_; $luminous_->settings->set($option, $value); }
php
public static function set($option, $value = null) { global $luminous_; $luminous_->settings->set($option, $value); }
[ "public", "static", "function", "set", "(", "$", "option", ",", "$", "value", "=", "null", ")", "{", "global", "$", "luminous_", ";", "$", "luminous_", "->", "settings", "->", "set", "(", "$", "option", ",", "$", "value", ")", ";", "}" ]
@brief Sets the given option to the given value @param $option The name of the setting (corresponds to an attribute name in LuminousOptions) @param $value The new value of the setting @throws Exception if the option is unrecognised (and in various other validation failures), @throws InvalidArgumentException if the argu...
[ "@brief", "Sets", "the", "given", "option", "to", "the", "given", "value", "@param", "$option", "The", "name", "of", "the", "setting", "(", "corresponds", "to", "an", "attribute", "name", "in", "LuminousOptions", ")", "@param", "$value", "The", "new", "value...
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous.php#L243-L247
markwatkinson/luminous
src/Luminous.php
Luminous.guessLanguage
public static function guessLanguage($src, $confidence = 0.05, $default = 'plain') { $guess = self::guessLanguageFull($src); if ($guess[0]['p'] >= $confidence) { return $guess[0]['codes'][0]; } else { return $default; } }
php
public static function guessLanguage($src, $confidence = 0.05, $default = 'plain') { $guess = self::guessLanguageFull($src); if ($guess[0]['p'] >= $confidence) { return $guess[0]['codes'][0]; } else { return $default; } }
[ "public", "static", "function", "guessLanguage", "(", "$", "src", ",", "$", "confidence", "=", "0.05", ",", "$", "default", "=", "'plain'", ")", "{", "$", "guess", "=", "self", "::", "guessLanguageFull", "(", "$", "src", ")", ";", "if", "(", "$", "gu...
@brief Attempts to guess the language of a piece of source code @param $src The source code whose language is to be guessed @param $confidence The desired confidence level: if this is 0.05 but the best guess has a confidence of 0.04, then $default is returned. Note that the confidence level returned by scanners is quit...
[ "@brief", "Attempts", "to", "guess", "the", "language", "of", "a", "piece", "of", "source", "code", "@param", "$src", "The", "source", "code", "whose", "language", "is", "to", "be", "guessed", "@param", "$confidence", "The", "desired", "confidence", "level", ...
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous.php#L304-L312
markwatkinson/luminous
src/Luminous.php
Luminous.guessLanguageFull
public static function guessLanguageFull($src) { global $luminous_; // first we're going to make an 'info' array for the source, which // precomputes some frequently useful things, like how many lines it // has, etc. It prevents scanners from redundantly figuring these things ...
php
public static function guessLanguageFull($src) { global $luminous_; // first we're going to make an 'info' array for the source, which // precomputes some frequently useful things, like how many lines it // has, etc. It prevents scanners from redundantly figuring these things ...
[ "public", "static", "function", "guessLanguageFull", "(", "$", "src", ")", "{", "global", "$", "luminous_", ";", "// first we're going to make an 'info' array for the source, which", "// precomputes some frequently useful things, like how many lines it", "// has, etc. It prevents scann...
@brief Attempts to guess the language of a piece of source code @param $src The source code whose language is to be guessed @return An array - the array is ordered by probability, with the most probable language coming first in the array. Each array element is an array which represents a language (scanner), and has the...
[ "@brief", "Attempts", "to", "guess", "the", "language", "of", "a", "piece", "of", "source", "code", "@param", "$src", "The", "source", "code", "whose", "language", "is", "to", "be", "guessed", "@return", "An", "array", "-", "the", "array", "is", "ordered",...
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous.php#L341-L383
markwatkinson/luminous
src/Luminous.php
Luminous.headHtml
public static function headHtml() { global $luminous_; $theme = self::setting('theme'); $relativeRoot = self::setting('relative-root'); $js = self::setting('include-javascript'); $jquery = self::setting('include-jquery'); if (!preg_match('/\.css$/i', $theme)) { ...
php
public static function headHtml() { global $luminous_; $theme = self::setting('theme'); $relativeRoot = self::setting('relative-root'); $js = self::setting('include-javascript'); $jquery = self::setting('include-jquery'); if (!preg_match('/\.css$/i', $theme)) { ...
[ "public", "static", "function", "headHtml", "(", ")", "{", "global", "$", "luminous_", ";", "$", "theme", "=", "self", "::", "setting", "(", "'theme'", ")", ";", "$", "relativeRoot", "=", "self", "::", "setting", "(", "'relative-root'", ")", ";", "$", ...
@brief Gets the markup you need to include in your web page @return a string representing everything that needs to be printed in the \<head\> section of a website. This is influenced by the following settings: relative-root, include-javascript, include-jquery theme
[ "@brief", "Gets", "the", "markup", "you", "need", "to", "include", "in", "your", "web", "page", "@return", "a", "string", "representing", "everything", "that", "needs", "to", "be", "printed", "in", "the", "\\", "<head", "\\", ">", "section", "of", "a", "...
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous.php#L396-L435
christophe-brachet/aspi-framework
src/Framework/Form/Element/Input/Checkbox.php
Checkbox.setValue
public function setValue($value) { if ($value == $this->getAttribute('value')) { $this->check(); } else { $this->uncheck(); } return $this; }
php
public function setValue($value) { if ($value == $this->getAttribute('value')) { $this->check(); } else { $this->uncheck(); } return $this; }
[ "public", "function", "setValue", "(", "$", "value", ")", "{", "if", "(", "$", "value", "==", "$", "this", "->", "getAttribute", "(", "'value'", ")", ")", "{", "$", "this", "->", "check", "(", ")", ";", "}", "else", "{", "$", "this", "->", "unche...
Set the value of the form input element object @param mixed $value @return Checkbox
[ "Set", "the", "value", "of", "the", "form", "input", "element", "object" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/Input/Checkbox.php#L39-L47
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.createFromConfig
public static function createFromConfig(array $config, $action = null, $method = 'post') { $form = new static(null, $action, $method); $form->addFieldsFromConfig($config); return $form; }
php
public static function createFromConfig(array $config, $action = null, $method = 'post') { $form = new static(null, $action, $method); $form->addFieldsFromConfig($config); return $form; }
[ "public", "static", "function", "createFromConfig", "(", "array", "$", "config", ",", "$", "action", "=", "null", ",", "$", "method", "=", "'post'", ")", "{", "$", "form", "=", "new", "static", "(", "null", ",", "$", "action", ",", "$", "method", ")"...
Method to create form object and fields from config @param array $config @param string $action @param string $method @return Form
[ "Method", "to", "create", "form", "object", "and", "fields", "from", "config" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L77-L83
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.isSubmitted
public function isSubmitted() { $postParams = $this->request->getParsedBody(); if(count($postParams)> 0) { $this->setFieldValues($postParams); } return (count($postParams)> 0); }
php
public function isSubmitted() { $postParams = $this->request->getParsedBody(); if(count($postParams)> 0) { $this->setFieldValues($postParams); } return (count($postParams)> 0); }
[ "public", "function", "isSubmitted", "(", ")", "{", "$", "postParams", "=", "$", "this", "->", "request", "->", "getParsedBody", "(", ")", ";", "if", "(", "count", "(", "$", "postParams", ")", ">", "0", ")", "{", "$", "this", "->", "setFieldValues", ...
Method to verify a form isSubmitted @return boolean
[ "Method", "to", "verify", "a", "form", "isSubmitted" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L88-L97
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.createFromFieldsetConfig
public static function createFromFieldsetConfig(array $config, $container = null, $action = null, $method = 'post') { $form = new static(null, $action, $method); $form->addFieldsetsFromConfig($config, $container); return $form; }
php
public static function createFromFieldsetConfig(array $config, $container = null, $action = null, $method = 'post') { $form = new static(null, $action, $method); $form->addFieldsetsFromConfig($config, $container); return $form; }
[ "public", "static", "function", "createFromFieldsetConfig", "(", "array", "$", "config", ",", "$", "container", "=", "null", ",", "$", "action", "=", "null", ",", "$", "method", "=", "'post'", ")", "{", "$", "form", "=", "new", "static", "(", "null", "...
Method to create form object and fields from config @param array $config @param string $container @param string $action @param string $method @return Form
[ "Method", "to", "create", "form", "object", "and", "fields", "from", "config" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L108-L113
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.createFieldset
public function createFieldset($legend = null, $container = null) { $fieldset = new Fieldset(); if (null !== $legend) { $fieldset->setLegend($legend); } if (null !== $container) { $fieldset->setContainer($container); } $this->addFieldset($field...
php
public function createFieldset($legend = null, $container = null) { $fieldset = new Fieldset(); if (null !== $legend) { $fieldset->setLegend($legend); } if (null !== $container) { $fieldset->setContainer($container); } $this->addFieldset($field...
[ "public", "function", "createFieldset", "(", "$", "legend", "=", "null", ",", "$", "container", "=", "null", ")", "{", "$", "fieldset", "=", "new", "Fieldset", "(", ")", ";", "if", "(", "null", "!==", "$", "legend", ")", "{", "$", "fieldset", "->", ...
Method to create a new fieldset object @param string $legend @param string $container @return Fieldset
[ "Method", "to", "create", "a", "new", "fieldset", "object" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L121-L138
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.setAttribute
public function setAttribute($a, $v) { parent::setAttribute($a, $v); if ($a == 'id') { foreach ($this->fieldsets as $i => $fieldset) { $id = $v . '-fieldset-' . ($i + 1); $fieldset->setAttribute('id', $id); } } else if ($a == 'class') {...
php
public function setAttribute($a, $v) { parent::setAttribute($a, $v); if ($a == 'id') { foreach ($this->fieldsets as $i => $fieldset) { $id = $v . '-fieldset-' . ($i + 1); $fieldset->setAttribute('id', $id); } } else if ($a == 'class') {...
[ "public", "function", "setAttribute", "(", "$", "a", ",", "$", "v", ")", "{", "parent", "::", "setAttribute", "(", "$", "a", ",", "$", "v", ")", ";", "if", "(", "$", "a", "==", "'id'", ")", "{", "foreach", "(", "$", "this", "->", "fieldsets", "...
Method to set an attribute @param string $a @param string $v @return Form
[ "Method", "to", "set", "an", "attribute" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L186-L201
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.setAttributes
public function setAttributes(array $a) { foreach ($a as $name => $value) { $this->setAttribute($name, $value); } return $this; }
php
public function setAttributes(array $a) { foreach ($a as $name => $value) { $this->setAttribute($name, $value); } return $this; }
[ "public", "function", "setAttributes", "(", "array", "$", "a", ")", "{", "foreach", "(", "$", "a", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "this", "->", "setAttribute", "(", "$", "name", ",", "$", "value", ")", ";", "}", "return", "...
Method to set attributes @param array $a @return Form
[ "Method", "to", "set", "attributes" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L208-L214
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.addFieldset
public function addFieldset(Fieldset $fieldset) { $this->fieldsets[] = $fieldset; $this->current = count($this->fieldsets) - 1; return $this; }
php
public function addFieldset(Fieldset $fieldset) { $this->fieldsets[] = $fieldset; $this->current = count($this->fieldsets) - 1; return $this; }
[ "public", "function", "addFieldset", "(", "Fieldset", "$", "fieldset", ")", "{", "$", "this", "->", "fieldsets", "[", "]", "=", "$", "fieldset", ";", "$", "this", "->", "current", "=", "count", "(", "$", "this", "->", "fieldsets", ")", "-", "1", ";",...
Method to add fieldset @param Fieldset $fieldset @return Form
[ "Method", "to", "add", "fieldset" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L221-L226
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.removeFieldset
public function removeFieldset($i) { if (isset($this->fieldsets[(int)$i])) { unset($this->fieldsets[(int)$i]); } $this->fieldsets = array_values($this->fieldsets); if (!isset($this->fieldsets[$this->current])) { $this->current = (count($this->fieldsets) > 0) ?...
php
public function removeFieldset($i) { if (isset($this->fieldsets[(int)$i])) { unset($this->fieldsets[(int)$i]); } $this->fieldsets = array_values($this->fieldsets); if (!isset($this->fieldsets[$this->current])) { $this->current = (count($this->fieldsets) > 0) ?...
[ "public", "function", "removeFieldset", "(", "$", "i", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "fieldsets", "[", "(", "int", ")", "$", "i", "]", ")", ")", "{", "unset", "(", "$", "this", "->", "fieldsets", "[", "(", "int", ")", "$...
Method to remove fieldset @param int $i @return Form
[ "Method", "to", "remove", "fieldset" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L233-L243
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.getFieldset
public function getFieldset() { return (isset($this->fieldsets[$this->current])) ? $this->fieldsets[$this->current] : null; }
php
public function getFieldset() { return (isset($this->fieldsets[$this->current])) ? $this->fieldsets[$this->current] : null; }
[ "public", "function", "getFieldset", "(", ")", "{", "return", "(", "isset", "(", "$", "this", "->", "fieldsets", "[", "$", "this", "->", "current", "]", ")", ")", "?", "$", "this", "->", "fieldsets", "[", "$", "this", "->", "current", "]", ":", "nu...
Method to get current fieldset @return Fieldset
[ "Method", "to", "get", "current", "fieldset" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L249-L252
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.addColumn
public function addColumn($fieldsets, $class = null) { if (!is_array($fieldsets)) { $fieldsets = [$fieldsets]; } foreach ($fieldsets as $i => $num) { $fieldsets[$i] = (int)$num - 1; } if (null === $class) { $class = 'pop-form-column-' . (co...
php
public function addColumn($fieldsets, $class = null) { if (!is_array($fieldsets)) { $fieldsets = [$fieldsets]; } foreach ($fieldsets as $i => $num) { $fieldsets[$i] = (int)$num - 1; } if (null === $class) { $class = 'pop-form-column-' . (co...
[ "public", "function", "addColumn", "(", "$", "fieldsets", ",", "$", "class", "=", "null", ")", "{", "if", "(", "!", "is_array", "(", "$", "fieldsets", ")", ")", "{", "$", "fieldsets", "=", "[", "$", "fieldsets", "]", ";", "}", "foreach", "(", "$", ...
Method to add form column @param mixed $fieldsets @param string $class @return Form
[ "Method", "to", "add", "form", "column" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L260-L273
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.setCurrent
public function setCurrent($i) { $this->current = (int)$i; if (!isset($this->fieldsets[$this->current])) { $this->fieldsets[$this->current] = $this->createFieldset(); } return $this; }
php
public function setCurrent($i) { $this->current = (int)$i; if (!isset($this->fieldsets[$this->current])) { $this->fieldsets[$this->current] = $this->createFieldset(); } return $this; }
[ "public", "function", "setCurrent", "(", "$", "i", ")", "{", "$", "this", "->", "current", "=", "(", "int", ")", "$", "i", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "fieldsets", "[", "$", "this", "->", "current", "]", ")", ")", "{",...
Method to get current fieldset index @param int $i @return Form
[ "Method", "to", "get", "current", "fieldset", "index" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L331-L338
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.getLegend
public function getLegend() { return (isset($this->fieldsets[$this->current])) ? $this->fieldsets[$this->current]->getLegend() : null; }
php
public function getLegend() { return (isset($this->fieldsets[$this->current])) ? $this->fieldsets[$this->current]->getLegend() : null; }
[ "public", "function", "getLegend", "(", ")", "{", "return", "(", "isset", "(", "$", "this", "->", "fieldsets", "[", "$", "this", "->", "current", "]", ")", ")", "?", "$", "this", "->", "fieldsets", "[", "$", "this", "->", "current", "]", "->", "get...
Method to get the legend of the current fieldset @return string
[ "Method", "to", "get", "the", "legend", "of", "the", "current", "fieldset" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L344-L348
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.setLegend
public function setLegend($legend) { if (isset($this->fieldsets[$this->current])) { $this->fieldsets[$this->current]->setLegend($legend); } return $this; }
php
public function setLegend($legend) { if (isset($this->fieldsets[$this->current])) { $this->fieldsets[$this->current]->setLegend($legend); } return $this; }
[ "public", "function", "setLegend", "(", "$", "legend", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "fieldsets", "[", "$", "this", "->", "current", "]", ")", ")", "{", "$", "this", "->", "fieldsets", "[", "$", "this", "->", "current", "]",...
Method to set the legend of the current fieldset @param string $legend @return Form
[ "Method", "to", "set", "the", "legend", "of", "the", "current", "fieldset" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L355-L361
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.addField
public function addField(Element\AbstractElement $field) { if (count($this->fieldsets) == 0) { $this->createFieldset(); } $this->fieldsets[$this->current]->addField($field); return $this; }
php
public function addField(Element\AbstractElement $field) { if (count($this->fieldsets) == 0) { $this->createFieldset(); } $this->fieldsets[$this->current]->addField($field); return $this; }
[ "public", "function", "addField", "(", "Element", "\\", "AbstractElement", "$", "field", ")", "{", "if", "(", "count", "(", "$", "this", "->", "fieldsets", ")", "==", "0", ")", "{", "$", "this", "->", "createFieldset", "(", ")", ";", "}", "$", "this"...
Method to add a form field @param Element\AbstractElement $field @return Form
[ "Method", "to", "add", "a", "form", "field" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L368-L375
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.addFieldFromConfig
public function addFieldFromConfig($name, $field) { $this->addField(Fields::create($name, $field)); return $this; }
php
public function addFieldFromConfig($name, $field) { $this->addField(Fields::create($name, $field)); return $this; }
[ "public", "function", "addFieldFromConfig", "(", "$", "name", ",", "$", "field", ")", "{", "$", "this", "->", "addField", "(", "Fields", "::", "create", "(", "$", "name", ",", "$", "field", ")", ")", ";", "return", "$", "this", ";", "}" ]
Method to add a form field from a config @param string $name @param array $field @return Form
[ "Method", "to", "add", "a", "form", "field", "from", "a", "config" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L396-L400
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.addFieldsFromConfig
public function addFieldsFromConfig(array $config) { $i = 1; foreach ($config as $name => $field) { if (is_numeric($name) && !isset($field[$name]['type'])) { $fields = []; foreach ($field as $n => $f) { $fields[$n] = Fields::create($n, ...
php
public function addFieldsFromConfig(array $config) { $i = 1; foreach ($config as $name => $field) { if (is_numeric($name) && !isset($field[$name]['type'])) { $fields = []; foreach ($field as $n => $f) { $fields[$n] = Fields::create($n, ...
[ "public", "function", "addFieldsFromConfig", "(", "array", "$", "config", ")", "{", "$", "i", "=", "1", ";", "foreach", "(", "$", "config", "as", "$", "name", "=>", "$", "field", ")", "{", "if", "(", "is_numeric", "(", "$", "name", ")", "&&", "!", ...
Method to add form fields from config @param array $config @return Form
[ "Method", "to", "add", "form", "fields", "from", "config" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L407-L426
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.addFieldsetsFromConfig
public function addFieldsetsFromConfig(array $fieldsets, $container = null) { foreach ($fieldsets as $legend => $config) { if (!is_numeric($legend)) { $this->createFieldset($legend, $container); } else { $this->createFieldset(null, $container); ...
php
public function addFieldsetsFromConfig(array $fieldsets, $container = null) { foreach ($fieldsets as $legend => $config) { if (!is_numeric($legend)) { $this->createFieldset($legend, $container); } else { $this->createFieldset(null, $container); ...
[ "public", "function", "addFieldsetsFromConfig", "(", "array", "$", "fieldsets", ",", "$", "container", "=", "null", ")", "{", "foreach", "(", "$", "fieldsets", "as", "$", "legend", "=>", "$", "config", ")", "{", "if", "(", "!", "is_numeric", "(", "$", ...
Method to add form fieldsets from config @param array $fieldsets @param string $container @return Form
[ "Method", "to", "add", "form", "fieldsets", "from", "config" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L434-L445
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.insertFieldBefore
public function insertFieldBefore($name, Element\AbstractElement $field) { foreach ($this->fieldsets as $fieldset) { if ($fieldset->hasField($name)) { $fieldset->insertFieldBefore($name, $field); break; } } return $this; }
php
public function insertFieldBefore($name, Element\AbstractElement $field) { foreach ($this->fieldsets as $fieldset) { if ($fieldset->hasField($name)) { $fieldset->insertFieldBefore($name, $field); break; } } return $this; }
[ "public", "function", "insertFieldBefore", "(", "$", "name", ",", "Element", "\\", "AbstractElement", "$", "field", ")", "{", "foreach", "(", "$", "this", "->", "fieldsets", "as", "$", "fieldset", ")", "{", "if", "(", "$", "fieldset", "->", "hasField", "...
Method to insert a field before another one @param string $name @param Element\AbstractElement $field @return Form
[ "Method", "to", "insert", "a", "field", "before", "another", "one" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L453-L462
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.count
public function count() { $count = 0; foreach ($this->fieldsets as $fieldset) { $count += $fieldset->count(); } return $count; }
php
public function count() { $count = 0; foreach ($this->fieldsets as $fieldset) { $count += $fieldset->count(); } return $count; }
[ "public", "function", "count", "(", ")", "{", "$", "count", "=", "0", ";", "foreach", "(", "$", "this", "->", "fieldsets", "as", "$", "fieldset", ")", "{", "$", "count", "+=", "$", "fieldset", "->", "count", "(", ")", ";", "}", "return", "$", "co...
Method to get the count of elements in the form @return int
[ "Method", "to", "get", "the", "count", "of", "elements", "in", "the", "form" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L485-L492
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.toArray
public function toArray() { $fieldValues = []; foreach ($this->fieldsets as $fieldset) { $fieldValues = array_merge($fieldValues, $fieldset->toArray()); } return $fieldValues; }
php
public function toArray() { $fieldValues = []; foreach ($this->fieldsets as $fieldset) { $fieldValues = array_merge($fieldValues, $fieldset->toArray()); } return $fieldValues; }
[ "public", "function", "toArray", "(", ")", "{", "$", "fieldValues", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "fieldsets", "as", "$", "fieldset", ")", "{", "$", "fieldValues", "=", "array_merge", "(", "$", "fieldValues", ",", "$", "fieldse...
Method to get the field values as an array @return array
[ "Method", "to", "get", "the", "field", "values", "as", "an", "array" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L498-L505
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.getField
public function getField($name) { $namedField = null; $fields = $this->getFields(); foreach ($fields as $field) { if ($field->getName() == $name) { $namedField = $field; break; } } return $namedField; }
php
public function getField($name) { $namedField = null; $fields = $this->getFields(); foreach ($fields as $field) { if ($field->getName() == $name) { $namedField = $field; break; } } return $namedField; }
[ "public", "function", "getField", "(", "$", "name", ")", "{", "$", "namedField", "=", "null", ";", "$", "fields", "=", "$", "this", "->", "getFields", "(", ")", ";", "foreach", "(", "$", "fields", "as", "$", "field", ")", "{", "if", "(", "$", "fi...
Method to get a field element object @param string $name @return Element\AbstractElement
[ "Method", "to", "get", "a", "field", "element", "object" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L512-L523
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.getFields
public function getFields() { $fields = []; foreach ($this->fieldsets as $fieldset) { $fields = array_merge($fields, $fieldset->getAllFields()); } return $fields; }
php
public function getFields() { $fields = []; foreach ($this->fieldsets as $fieldset) { $fields = array_merge($fields, $fieldset->getAllFields()); } return $fields; }
[ "public", "function", "getFields", "(", ")", "{", "$", "fields", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "fieldsets", "as", "$", "fieldset", ")", "{", "$", "fields", "=", "array_merge", "(", "$", "fields", ",", "$", "fieldset", "->", ...
Method to get field element objects @return array
[ "Method", "to", "get", "field", "element", "objects" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L529-L536
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.removeField
public function removeField($field) { foreach ($this->fieldsets as $fieldset) { if ($fieldset->hasField($field)) { unset($fieldset[$field]); } } return $this; }
php
public function removeField($field) { foreach ($this->fieldsets as $fieldset) { if ($fieldset->hasField($field)) { unset($fieldset[$field]); } } return $this; }
[ "public", "function", "removeField", "(", "$", "field", ")", "{", "foreach", "(", "$", "this", "->", "fieldsets", "as", "$", "fieldset", ")", "{", "if", "(", "$", "fieldset", "->", "hasField", "(", "$", "field", ")", ")", "{", "unset", "(", "$", "f...
Method to remove a form field @param string $field @return Form
[ "Method", "to", "remove", "a", "form", "field" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L543-L551
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.getFieldValue
public function getFieldValue($name) { $fieldValues = $this->toArray(); return (isset($fieldValues[$name])) ? $fieldValues[$name] : null; }
php
public function getFieldValue($name) { $fieldValues = $this->toArray(); return (isset($fieldValues[$name])) ? $fieldValues[$name] : null; }
[ "public", "function", "getFieldValue", "(", "$", "name", ")", "{", "$", "fieldValues", "=", "$", "this", "->", "toArray", "(", ")", ";", "return", "(", "isset", "(", "$", "fieldValues", "[", "$", "name", "]", ")", ")", "?", "$", "fieldValues", "[", ...
Method to get a field element value @param string $name @return mixed
[ "Method", "to", "get", "a", "field", "element", "value" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L558-L562
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.setFieldValue
public function setFieldValue($name, $value) { foreach ($this->fieldsets as $fieldset) { if (isset($fieldset[$name])) { $fieldset[$name] = $value; } } return $this; }
php
public function setFieldValue($name, $value) { foreach ($this->fieldsets as $fieldset) { if (isset($fieldset[$name])) { $fieldset[$name] = $value; } } return $this; }
[ "public", "function", "setFieldValue", "(", "$", "name", ",", "$", "value", ")", "{", "foreach", "(", "$", "this", "->", "fieldsets", "as", "$", "fieldset", ")", "{", "if", "(", "isset", "(", "$", "fieldset", "[", "$", "name", "]", ")", ")", "{", ...
Method to set a field element value @param string $name @param mixed $value @return Form
[ "Method", "to", "set", "a", "field", "element", "value" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L570-L578
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.setFieldValues
public function setFieldValues(array $values) { $fields = $this->toArray(); foreach ($fields as $name => $value) { if (isset($values[$name]) && (!($this->getField($name) instanceof Element\Button) && !($this->getField($name) instanceof Element\Input\Button) && ...
php
public function setFieldValues(array $values) { $fields = $this->toArray(); foreach ($fields as $name => $value) { if (isset($values[$name]) && (!($this->getField($name) instanceof Element\Button) && !($this->getField($name) instanceof Element\Input\Button) && ...
[ "public", "function", "setFieldValues", "(", "array", "$", "values", ")", "{", "$", "fields", "=", "$", "this", "->", "toArray", "(", ")", ";", "foreach", "(", "$", "fields", "as", "$", "name", "=>", "$", "value", ")", "{", "if", "(", "isset", "(",...
Method to set field element values @param array $values @return Form
[ "Method", "to", "set", "field", "element", "values" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L585-L603
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.addFilter
public function addFilter($call, $params = null, $excludeByType = null, $excludeByName = null) { if (null !== $params) { if (!is_array($params)) { $params = [$params]; } } else { $params = []; } if (null !== $excludeByType) { ...
php
public function addFilter($call, $params = null, $excludeByType = null, $excludeByName = null) { if (null !== $params) { if (!is_array($params)) { $params = [$params]; } } else { $params = []; } if (null !== $excludeByType) { ...
[ "public", "function", "addFilter", "(", "$", "call", ",", "$", "params", "=", "null", ",", "$", "excludeByType", "=", "null", ",", "$", "excludeByName", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "params", ")", "{", "if", "(", "!", "is_a...
Add filter @param mixed $call @param mixed $params @param mixed $excludeByType @param mixed $excludeByName @return Form
[ "Add", "filter" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L622-L652
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.filterValue
public function filterValue($value) { if ($value instanceof Element\AbstractElement) { $name = $value->getName(); $type = $value->getType(); $realValue = $value->getValue(); } else { $type = null; $name = null; ...
php
public function filterValue($value) { if ($value instanceof Element\AbstractElement) { $name = $value->getName(); $type = $value->getType(); $realValue = $value->getValue(); } else { $type = null; $name = null; ...
[ "public", "function", "filterValue", "(", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "Element", "\\", "AbstractElement", ")", "{", "$", "name", "=", "$", "value", "->", "getName", "(", ")", ";", "$", "type", "=", "$", "value", "->...
Filter value with the filters in the form object @param mixed $value @return mixed
[ "Filter", "value", "with", "the", "filters", "in", "the", "form", "object" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L669-L698
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.filterValues
public function filterValues(array $values = null) { if (null === $values) { $values = $this->getFields(); } foreach ($values as $key => $value) { $values[$key] = $this->filterValue($value); } return $values; }
php
public function filterValues(array $values = null) { if (null === $values) { $values = $this->getFields(); } foreach ($values as $key => $value) { $values[$key] = $this->filterValue($value); } return $values; }
[ "public", "function", "filterValues", "(", "array", "$", "values", "=", "null", ")", "{", "if", "(", "null", "===", "$", "values", ")", "{", "$", "values", "=", "$", "this", "->", "getFields", "(", ")", ";", "}", "foreach", "(", "$", "values", "as"...
Filter values with the filters in the form object @param array $values @return mixed
[ "Filter", "values", "with", "the", "filters", "in", "the", "form", "object" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L705-L714
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.isValid
public function isValid() { $result = true; $fields = $this->getFields(); // Check each element for validators, validate them and return the result. foreach ($fields as $field) { if ($field->validate() == false) { $result = false; } } ...
php
public function isValid() { $result = true; $fields = $this->getFields(); // Check each element for validators, validate them and return the result. foreach ($fields as $field) { if ($field->validate() == false) { $result = false; } } ...
[ "public", "function", "isValid", "(", ")", "{", "$", "result", "=", "true", ";", "$", "fields", "=", "$", "this", "->", "getFields", "(", ")", ";", "// Check each element for validators, validate them and return the result.", "foreach", "(", "$", "fields", "as", ...
Determine whether or not the form object is valid @return boolean
[ "Determine", "whether", "or", "not", "the", "form", "object", "is", "valid" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L720-L731
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.getErrors
public function getErrors($name) { $field = $this->getField($name); $errors = (null !== $field) ? $field->getErrors() : []; return $errors; }
php
public function getErrors($name) { $field = $this->getField($name); $errors = (null !== $field) ? $field->getErrors() : []; return $errors; }
[ "public", "function", "getErrors", "(", "$", "name", ")", "{", "$", "field", "=", "$", "this", "->", "getField", "(", "$", "name", ")", ";", "$", "errors", "=", "(", "null", "!==", "$", "field", ")", "?", "$", "field", "->", "getErrors", "(", ")"...
Get form element errors for a field. @param string $name @return array
[ "Get", "form", "element", "errors", "for", "a", "field", "." ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L738-L743
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.getAllErrors
public function getAllErrors() { $errors = []; $fields = $this->getFields(); foreach ($fields as $name => $field) { if ($field->hasErrors()) { $errors[str_replace('[]', '', $field->getName())] = $field->getErrors(); } } return $errors; ...
php
public function getAllErrors() { $errors = []; $fields = $this->getFields(); foreach ($fields as $name => $field) { if ($field->hasErrors()) { $errors[str_replace('[]', '', $field->getName())] = $field->getErrors(); } } return $errors; ...
[ "public", "function", "getAllErrors", "(", ")", "{", "$", "errors", "=", "[", "]", ";", "$", "fields", "=", "$", "this", "->", "getFields", "(", ")", ";", "foreach", "(", "$", "fields", "as", "$", "name", "=>", "$", "field", ")", "{", "if", "(", ...
Get all form element errors @return array
[ "Get", "all", "form", "element", "errors" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L749-L759
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.reset
public function reset() { $fields = $this->getFields(); foreach ($fields as $field) { $field->resetValue(); } return $this; }
php
public function reset() { $fields = $this->getFields(); foreach ($fields as $field) { $field->resetValue(); } return $this; }
[ "public", "function", "reset", "(", ")", "{", "$", "fields", "=", "$", "this", "->", "getFields", "(", ")", ";", "foreach", "(", "$", "fields", "as", "$", "field", ")", "{", "$", "field", "->", "resetValue", "(", ")", ";", "}", "return", "$", "th...
Method to reset and clear any form field values @return Form
[ "Method", "to", "reset", "and", "clear", "any", "form", "field", "values" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L765-L772
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.clearTokens
public function clearTokens() { // Start a session. if (session_id() == '') { session_start(); } if (isset($_SESSION['pop_csrf'])) { unset($_SESSION['pop_csrf']); } if (isset($_SESSION['pop_captcha'])) { unset($_SESSION['pop_captcha...
php
public function clearTokens() { // Start a session. if (session_id() == '') { session_start(); } if (isset($_SESSION['pop_csrf'])) { unset($_SESSION['pop_csrf']); } if (isset($_SESSION['pop_captcha'])) { unset($_SESSION['pop_captcha...
[ "public", "function", "clearTokens", "(", ")", "{", "// Start a session.", "if", "(", "session_id", "(", ")", "==", "''", ")", "{", "session_start", "(", ")", ";", "}", "if", "(", "isset", "(", "$", "_SESSION", "[", "'pop_csrf'", "]", ")", ")", "{", ...
Method to clear any security tokens @return Form
[ "Method", "to", "clear", "any", "security", "tokens" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L778-L791
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.prepare
public function prepare() { if (null === $this->getAttribute('id')) { $this->setAttribute('id', 'pop-form'); } if (null === $this->getAttribute('class')) { $this->setAttribute('class', 'pop-form'); } if (count($this->columns) > 0) { foreach...
php
public function prepare() { if (null === $this->getAttribute('id')) { $this->setAttribute('id', 'pop-form'); } if (null === $this->getAttribute('class')) { $this->setAttribute('class', 'pop-form'); } if (count($this->columns) > 0) { foreach...
[ "public", "function", "prepare", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "getAttribute", "(", "'id'", ")", ")", "{", "$", "this", "->", "setAttribute", "(", "'id'", ",", "'pop-form'", ")", ";", "}", "if", "(", "null", "===", "$"...
Prepare form object for rendering @return Form
[ "Prepare", "form", "object", "for", "rendering" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L797-L825
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.prepareForView
public function prepareForView() { $formData = []; foreach ($this->fieldsets as $fieldset) { $formData = array_merge($formData, $fieldset->prepareForView()); } return $formData; }
php
public function prepareForView() { $formData = []; foreach ($this->fieldsets as $fieldset) { $formData = array_merge($formData, $fieldset->prepareForView()); } return $formData; }
[ "public", "function", "prepareForView", "(", ")", "{", "$", "formData", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "fieldsets", "as", "$", "fieldset", ")", "{", "$", "formData", "=", "array_merge", "(", "$", "formData", ",", "$", "fieldset"...
Prepare form object for rendering with a view @return array
[ "Prepare", "form", "object", "for", "rendering", "with", "a", "view" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L831-L838
christophe-brachet/aspi-framework
src/Framework/Form/AspiForm.php
AspiForm.render
public function render($depth = 0, $indent = null, $inner = false) { if (!($this->hasChildren())) { $this->prepare(); } foreach ($this->fieldsets as $fieldset) { foreach ($fieldset->getAllFields() as $field) { if ($field instanceof Element\Input\File) ...
php
public function render($depth = 0, $indent = null, $inner = false) { if (!($this->hasChildren())) { $this->prepare(); } foreach ($this->fieldsets as $fieldset) { foreach ($fieldset->getAllFields() as $field) { if ($field instanceof Element\Input\File) ...
[ "public", "function", "render", "(", "$", "depth", "=", "0", ",", "$", "indent", "=", "null", ",", "$", "inner", "=", "false", ")", "{", "if", "(", "!", "(", "$", "this", "->", "hasChildren", "(", ")", ")", ")", "{", "$", "this", "->", "prepare...
Render the form object @param int $depth @param string $indent @param boolean $inner @return mixed
[ "Render", "the", "form", "object" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/AspiForm.php#L847-L861
yosmanyga/validation
src/Yosmanyga/Validation/Resource/Compiler/ArrayCompiler.php
ArrayCompiler.compile
public function compile($definition) { $validator = new ExceptionValidator($definition->createValidator()); $validator->validate($definition); // Try to compile map option // Just works if map is a validator try { $definition->map = $this->compiler->compile($defi...
php
public function compile($definition) { $validator = new ExceptionValidator($definition->createValidator()); $validator->validate($definition); // Try to compile map option // Just works if map is a validator try { $definition->map = $this->compiler->compile($defi...
[ "public", "function", "compile", "(", "$", "definition", ")", "{", "$", "validator", "=", "new", "ExceptionValidator", "(", "$", "definition", "->", "createValidator", "(", ")", ")", ";", "$", "validator", "->", "validate", "(", "$", "definition", ")", ";"...
@param \Yosmanyga\Validation\Resource\Definition\ArrayDefinition $definition @return \Yosmanyga\Validation\Validator\ArrayValidator
[ "@param", "\\", "Yosmanyga", "\\", "Validation", "\\", "Resource", "\\", "Definition", "\\", "ArrayDefinition", "$definition" ]
train
https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Resource/Compiler/ArrayCompiler.php#L48-L63
unimapper/unimapper
src/Entity/Filter.php
Filter.isGroup
public static function isGroup(array $value) { return $value === array_values($value) || (isset($value[self::_OR]) && count($value) === 1); }
php
public static function isGroup(array $value) { return $value === array_values($value) || (isset($value[self::_OR]) && count($value) === 1); }
[ "public", "static", "function", "isGroup", "(", "array", "$", "value", ")", "{", "return", "$", "value", "===", "array_values", "(", "$", "value", ")", "||", "(", "isset", "(", "$", "value", "[", "self", "::", "_OR", "]", ")", "&&", "count", "(", "...
Is it filter with groups? @param array $value @return bool
[ "Is", "it", "filter", "with", "groups?" ]
train
https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Filter.php#L63-L67
unimapper/unimapper
src/Entity/Filter.php
Filter.validate
public static function validate(Reflection $reflection, array $filter) { if (self::isGroup($filter)) { // Filter group foreach ($filter as $modifier => $item) { if (!is_array($item) || empty($item)) { throw new Exception\FilterException( ...
php
public static function validate(Reflection $reflection, array $filter) { if (self::isGroup($filter)) { // Filter group foreach ($filter as $modifier => $item) { if (!is_array($item) || empty($item)) { throw new Exception\FilterException( ...
[ "public", "static", "function", "validate", "(", "Reflection", "$", "reflection", ",", "array", "$", "filter", ")", "{", "if", "(", "self", "::", "isGroup", "(", "$", "filter", ")", ")", "{", "// Filter group", "foreach", "(", "$", "filter", "as", "$", ...
Merge two filters @param Reflection $reflection @param array $filter @return array @throws Exception\FilterException
[ "Merge", "two", "filters" ]
train
https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Filter.php#L79-L153
transfer-framework/transfer
src/Transfer/Adapter/Transaction/DataAggregate.php
DataAggregate.setData
public function setData($data) { $this->originalData = $data; if ($data instanceof \Iterator) { $this->iterator = $data; } elseif (is_array($data)) { $this->iterator = new \ArrayIterator($data); } else { $this->iterator = new \Arra...
php
public function setData($data) { $this->originalData = $data; if ($data instanceof \Iterator) { $this->iterator = $data; } elseif (is_array($data)) { $this->iterator = new \ArrayIterator($data); } else { $this->iterator = new \Arra...
[ "public", "function", "setData", "(", "$", "data", ")", "{", "$", "this", "->", "originalData", "=", "$", "data", ";", "if", "(", "$", "data", "instanceof", "\\", "Iterator", ")", "{", "$", "this", "->", "iterator", "=", "$", "data", ";", "}", "els...
Assigns data to the aggregate. @param mixed $data
[ "Assigns", "data", "to", "the", "aggregate", "." ]
train
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Adapter/Transaction/DataAggregate.php#L50-L63
dekalee/cdn77
src/Cdn77/Query/CreateResourceQuery.php
CreateResourceQuery.execute
public function execute($domain = null) { $response = $this->client->post( $this->url, [ 'form_params' => [ 'login' => $this->login, 'passwd' => $this->password, 'label' => $domain, 'type'...
php
public function execute($domain = null) { $response = $this->client->post( $this->url, [ 'form_params' => [ 'login' => $this->login, 'passwd' => $this->password, 'label' => $domain, 'type'...
[ "public", "function", "execute", "(", "$", "domain", "=", "null", ")", "{", "$", "response", "=", "$", "this", "->", "client", "->", "post", "(", "$", "this", "->", "url", ",", "[", "'form_params'", "=>", "[", "'login'", "=>", "$", "this", "->", "l...
@param string|null $domain @return mixed|null @throws QueryErrorException
[ "@param", "string|null", "$domain" ]
train
https://github.com/dekalee/cdn77/blob/71d1771e047cf2fbd273018f6f35d44b87c53b24/src/Cdn77/Query/CreateResourceQuery.php#L40-L64
PandaPlatform/framework
src/Panda/Storage/Adapters/Filesystem.php
Filesystem.put
public function put($path, $contents, $lock = false) { // Check if folder exists if (!$this->exists(dirname($path))) { mkdir(dirname($path), 0775, true); } return file_put_contents($path, $contents, $lock ? LOCK_EX : 0); }
php
public function put($path, $contents, $lock = false) { // Check if folder exists if (!$this->exists(dirname($path))) { mkdir(dirname($path), 0775, true); } return file_put_contents($path, $contents, $lock ? LOCK_EX : 0); }
[ "public", "function", "put", "(", "$", "path", ",", "$", "contents", ",", "$", "lock", "=", "false", ")", "{", "// Check if folder exists", "if", "(", "!", "$", "this", "->", "exists", "(", "dirname", "(", "$", "path", ")", ")", ")", "{", "mkdir", ...
Put contents to a given file. Create the file if doesn't exist. @param string $path The file's path to put contents to. @param string $contents The file's contents. @param bool $lock Acquire an exclusive lock on the file while proceeding to the writing. @return mixed The number of bytes that were written to...
[ "Put", "contents", "to", "a", "given", "file", ".", "Create", "the", "file", "if", "doesn", "t", "exist", "." ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Storage/Adapters/Filesystem.php#L51-L59
PandaPlatform/framework
src/Panda/Storage/Adapters/Filesystem.php
Filesystem.prepend
public function prepend($path, $contents) { if ($this->exists($path)) { return $this->put($path, $contents . $this->get($path)); } return $this->put($path, $contents); }
php
public function prepend($path, $contents) { if ($this->exists($path)) { return $this->put($path, $contents . $this->get($path)); } return $this->put($path, $contents); }
[ "public", "function", "prepend", "(", "$", "path", ",", "$", "contents", ")", "{", "if", "(", "$", "this", "->", "exists", "(", "$", "path", ")", ")", "{", "return", "$", "this", "->", "put", "(", "$", "path", ",", "$", "contents", ".", "$", "t...
Prepend to a file. @param string $path The file path. @param string $contents The contents to be prepended. @return mixed The number of bytes that were written to the file, or False on failure. @throws FileNotFoundException
[ "Prepend", "to", "a", "file", "." ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Storage/Adapters/Filesystem.php#L134-L141
crysalead/net
src/Http/Message.php
Message.version
public function version($version = null) { if (func_num_args() === 0) { return $this->_version; } $this->_version = $version; return $this; }
php
public function version($version = null) { if (func_num_args() === 0) { return $this->_version; } $this->_version = $version; return $this; }
[ "public", "function", "version", "(", "$", "version", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "return", "$", "this", "->", "_version", ";", "}", "$", "this", "->", "_version", "=", "$", "version", ";", "re...
Gets/sets the HTTP protocol version number. @return string The version number. @return string|self
[ "Gets", "/", "sets", "the", "HTTP", "protocol", "version", "number", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Message.php#L105-L112
crysalead/net
src/Http/Message.php
Message.format
public function format($format = null) { $media = $this->_classes['media']; if (!func_num_args()) { if ($this->_format === null) { $this->_format = $media::suitable($this); } return $this->_format; } if ($format === null) { ...
php
public function format($format = null) { $media = $this->_classes['media']; if (!func_num_args()) { if ($this->_format === null) { $this->_format = $media::suitable($this); } return $this->_format; } if ($format === null) { ...
[ "public", "function", "format", "(", "$", "format", "=", "null", ")", "{", "$", "media", "=", "$", "this", "->", "_classes", "[", "'media'", "]", ";", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "if", "(", "$", "this", "->", "_format", "...
Gets/sets the format of the request. @param string $format A format name. @return string|self
[ "Gets", "/", "sets", "the", "format", "of", "the", "request", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Message.php#L180-L201
crysalead/net
src/Http/Message.php
Message.chunkSize
public function chunkSize($chunkSize = null) { if (!func_num_args()) { return $this->_chunkSize; } $this->_chunkSize = (int) $chunkSize; return $this; }
php
public function chunkSize($chunkSize = null) { if (!func_num_args()) { return $this->_chunkSize; } $this->_chunkSize = (int) $chunkSize; return $this; }
[ "public", "function", "chunkSize", "(", "$", "chunkSize", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_chunkSize", ";", "}", "$", "this", "->", "_chunkSize", "=", "(", "int", ")", "$", "...
Get/set the chunk size. @param integer $chunkSize The chunk size. @return string|self
[ "Get", "/", "set", "the", "chunk", "size", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Message.php#L209-L216
crysalead/net
src/Http/Message.php
Message.body
public function body($value = null, $options = []) { if (!func_num_args()) { return $this->_stream->toString(); } $stream = $this->stream(); $stream->close(); $stream->add($value, $options); return $this; }
php
public function body($value = null, $options = []) { if (!func_num_args()) { return $this->_stream->toString(); } $stream = $this->stream(); $stream->close(); $stream->add($value, $options); return $this; }
[ "public", "function", "body", "(", "$", "value", "=", "null", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_stream", "->", "toString", "(", ")", ";", "}", "$", ...
Get/set the plain body message. @param string $value. @param array $options The stream options. @return string|self
[ "Get", "/", "set", "the", "plain", "body", "message", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Message.php#L225-L234
crysalead/net
src/Http/Message.php
Message.get
public function get($decodeOptions = []) { $media = $this->_classes['media']; $format = $this->format(); return $format ? $media::decode($format, $this->_stream->toString(), $decodeOptions, $this) : $this->_stream->toString(); }
php
public function get($decodeOptions = []) { $media = $this->_classes['media']; $format = $this->format(); return $format ? $media::decode($format, $this->_stream->toString(), $decodeOptions, $this) : $this->_stream->toString(); }
[ "public", "function", "get", "(", "$", "decodeOptions", "=", "[", "]", ")", "{", "$", "media", "=", "$", "this", "->", "_classes", "[", "'media'", "]", ";", "$", "format", "=", "$", "this", "->", "format", "(", ")", ";", "return", "$", "format", ...
Gets the body of this message. @param array $decodeOptions The decoding options. @return mixed The formatted body.
[ "Gets", "the", "body", "of", "this", "message", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Message.php#L252-L257
crysalead/net
src/Http/Message.php
Message.set
public function set($value = null, $options = [], $mediaOptions = []) { $media = $this->_classes['media']; $format = $this->format(); if (!$format && !is_string($value)) { throw new NetException("The data must be a string when no format/mime is defined."); } $st...
php
public function set($value = null, $options = [], $mediaOptions = []) { $media = $this->_classes['media']; $format = $this->format(); if (!$format && !is_string($value)) { throw new NetException("The data must be a string when no format/mime is defined."); } $st...
[ "public", "function", "set", "(", "$", "value", "=", "null", ",", "$", "options", "=", "[", "]", ",", "$", "mediaOptions", "=", "[", "]", ")", "{", "$", "media", "=", "$", "this", "->", "_classes", "[", "'media'", "]", ";", "$", "format", "=", ...
Gets/sets the body of this message. @param mixed $value The formatted body. @param array $options The stream options. @param array $mediaOptions The media options. @return mixed|self
[ "Gets", "/", "sets", "the", "body", "of", "this", "message", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Message.php#L267-L280
crysalead/net
src/Http/Message.php
Message.to
public function to($format, $options = []) { $media = $this->_classes['media']; if (!$media::get($format)) { throw new InvalidArgumentException("Unsupported format `{$format}`."); } return $media::decode($format, $this->body(), $options, $this); }
php
public function to($format, $options = []) { $media = $this->_classes['media']; if (!$media::get($format)) { throw new InvalidArgumentException("Unsupported format `{$format}`."); } return $media::decode($format, $this->body(), $options, $this); }
[ "public", "function", "to", "(", "$", "format", ",", "$", "options", "=", "[", "]", ")", "{", "$", "media", "=", "$", "this", "->", "_classes", "[", "'media'", "]", ";", "if", "(", "!", "$", "media", "::", "get", "(", "$", "format", ")", ")", ...
Exports a `Message` body to specific format. The supported values of `$format` depend on the `Media` class example: ```php $message->to('xml'); // exports the message body into XML ``` @param string $format By default the only supported value is `'array'`. However, additional format handlers can be registered usin...
[ "Exports", "a", "Message", "body", "to", "specific", "format", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Message.php#L319-L326
crysalead/net
src/Http/Message.php
Message.toMessage
public function toMessage() { $this->_setContentLength(); return $this->line() . "\r\n" . $this->headers()->toString() . "\r\n". "\r\n" . $this->toString(); }
php
public function toMessage() { $this->_setContentLength(); return $this->line() . "\r\n" . $this->headers()->toString() . "\r\n". "\r\n" . $this->toString(); }
[ "public", "function", "toMessage", "(", ")", "{", "$", "this", "->", "_setContentLength", "(", ")", ";", "return", "$", "this", "->", "line", "(", ")", ".", "\"\\r\\n\"", ".", "$", "this", "->", "headers", "(", ")", "->", "toString", "(", ")", ".", ...
Magic method to convert the instance into an HTTP message string. @return string
[ "Magic", "method", "to", "convert", "the", "instance", "into", "an", "HTTP", "message", "string", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Message.php#L333-L337
crysalead/net
src/Http/Message.php
Message.toString
public function toString() { $headers = $this->headers(); if ($headers['Transfer-Encoding']->value() === 'chunked') { return $this->toChunks(); } return $this->_stream->toString(); }
php
public function toString() { $headers = $this->headers(); if ($headers['Transfer-Encoding']->value() === 'chunked') { return $this->toChunks(); } return $this->_stream->toString(); }
[ "public", "function", "toString", "(", ")", "{", "$", "headers", "=", "$", "this", "->", "headers", "(", ")", ";", "if", "(", "$", "headers", "[", "'Transfer-Encoding'", "]", "->", "value", "(", ")", "===", "'chunked'", ")", "{", "return", "$", "this...
Magic method convert the instance body into a string. @return string
[ "Magic", "method", "convert", "the", "instance", "body", "into", "a", "string", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Message.php#L344-L351
crysalead/net
src/Http/Message.php
Message.toChunks
public function toChunks($size = null) { $body = ''; $size = $size > 0 ? $size : $this->chunkSize(); $stream = $this->stream(); while($chunk = $stream->read($size)) { $readed = strlen($chunk); if (!$readed) { break; } $b...
php
public function toChunks($size = null) { $body = ''; $size = $size > 0 ? $size : $this->chunkSize(); $stream = $this->stream(); while($chunk = $stream->read($size)) { $readed = strlen($chunk); if (!$readed) { break; } $b...
[ "public", "function", "toChunks", "(", "$", "size", "=", "null", ")", "{", "$", "body", "=", "''", ";", "$", "size", "=", "$", "size", ">", "0", "?", "$", "size", ":", "$", "this", "->", "chunkSize", "(", ")", ";", "$", "stream", "=", "$", "t...
Flush the content of a Message chunk by chunk. @param Closure $size The size of the chunks to process.
[ "Flush", "the", "content", "of", "a", "Message", "chunk", "by", "chunk", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Message.php#L368-L386
crysalead/net
src/Http/Message.php
Message._setContentLength
protected function _setContentLength() { $headers = $this->headers(); if ($headers['Transfer-Encoding']->value() === 'chunked') { return; } $length = $this->stream()->length(); if ($length === null) { throw new NetException("A Content-Length header is ...
php
protected function _setContentLength() { $headers = $this->headers(); if ($headers['Transfer-Encoding']->value() === 'chunked') { return; } $length = $this->stream()->length(); if ($length === null) { throw new NetException("A Content-Length header is ...
[ "protected", "function", "_setContentLength", "(", ")", "{", "$", "headers", "=", "$", "this", "->", "headers", "(", ")", ";", "if", "(", "$", "headers", "[", "'Transfer-Encoding'", "]", "->", "value", "(", ")", "===", "'chunked'", ")", "{", "return", ...
Auto adds a Content-Length header if necessary.
[ "Auto", "adds", "a", "Content", "-", "Length", "header", "if", "necessary", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Message.php#L391-L403
vardius/crud-bundle
Actions/Action/ListAction.php
ListAction.call
public function call(ActionEvent $event, string $format):Response { $controller = $event->getController(); $this->checkRole($controller); $dataProvider = $event->getDataProvider(); $params = $dataProvider->findAll(); $request = $event->getRequest(); $routeName = $r...
php
public function call(ActionEvent $event, string $format):Response { $controller = $event->getController(); $this->checkRole($controller); $dataProvider = $event->getDataProvider(); $params = $dataProvider->findAll(); $request = $event->getRequest(); $routeName = $r...
[ "public", "function", "call", "(", "ActionEvent", "$", "event", ",", "string", "$", "format", ")", ":", "Response", "{", "$", "controller", "=", "$", "event", "->", "getController", "(", ")", ";", "$", "this", "->", "checkRole", "(", "$", "controller", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Actions/Action/ListAction.php#L32-L57
keboola/juicer
Pagination/OffsetScroller.php
OffsetScroller.getParams
private function getParams(JobConfig $jobConfig) { $config = $jobConfig->getConfig(); $scrollParams = [ $this->limitParam => $this->getLimit($jobConfig), $this->offsetParam => $this->pointer ]; $config['params'] = array_replace($jobConfig->getParams(), $scrol...
php
private function getParams(JobConfig $jobConfig) { $config = $jobConfig->getConfig(); $scrollParams = [ $this->limitParam => $this->getLimit($jobConfig), $this->offsetParam => $this->pointer ]; $config['params'] = array_replace($jobConfig->getParams(), $scrol...
[ "private", "function", "getParams", "(", "JobConfig", "$", "jobConfig", ")", "{", "$", "config", "=", "$", "jobConfig", "->", "getConfig", "(", ")", ";", "$", "scrollParams", "=", "[", "$", "this", "->", "limitParam", "=>", "$", "this", "->", "getLimit",...
Returns a config with scroller params @param JobConfig $jobConfig @return array
[ "Returns", "a", "config", "with", "scroller", "params" ]
train
https://github.com/keboola/juicer/blob/780e7900ccd23082ed234cc2c51b279a4223e9f5/Pagination/OffsetScroller.php#L122-L132
bantenprov/tanara
app/Http/Controllers/Auth/LoginController.php
LoginController.attemptLogin
protected function attemptLogin(Request $request) { $token = $this->guard()->attempt($this->credentials($request)); if ($token) { $this->guard()->setToken($token); return true; } return false; }
php
protected function attemptLogin(Request $request) { $token = $this->guard()->attempt($this->credentials($request)); if ($token) { $this->guard()->setToken($token); return true; } return false; }
[ "protected", "function", "attemptLogin", "(", "Request", "$", "request", ")", "{", "$", "token", "=", "$", "this", "->", "guard", "(", ")", "->", "attempt", "(", "$", "this", "->", "credentials", "(", "$", "request", ")", ")", ";", "if", "(", "$", ...
Attempt to log the user into the application. @param \Illuminate\Http\Request $request @return bool
[ "Attempt", "to", "log", "the", "user", "into", "the", "application", "." ]
train
https://github.com/bantenprov/tanara/blob/e70b027cbbc59bb57a31fa3c7347e7eae87671c3/app/Http/Controllers/Auth/LoginController.php#L29-L40
bantenprov/tanara
app/Http/Controllers/Auth/LoginController.php
LoginController.sendLoginResponse
protected function sendLoginResponse(Request $request) { $this->clearLoginAttempts($request); $token = (string) $this->guard()->getToken(); $expiration = $this->guard()->getPayload()->get('exp'); return [ 'token' => $token, 'token_type' => 'bearer', ...
php
protected function sendLoginResponse(Request $request) { $this->clearLoginAttempts($request); $token = (string) $this->guard()->getToken(); $expiration = $this->guard()->getPayload()->get('exp'); return [ 'token' => $token, 'token_type' => 'bearer', ...
[ "protected", "function", "sendLoginResponse", "(", "Request", "$", "request", ")", "{", "$", "this", "->", "clearLoginAttempts", "(", "$", "request", ")", ";", "$", "token", "=", "(", "string", ")", "$", "this", "->", "guard", "(", ")", "->", "getToken",...
Send the response after the user was authenticated. @param \Illuminate\Http\Request $request @return \Illuminate\Http\Response
[ "Send", "the", "response", "after", "the", "user", "was", "authenticated", "." ]
train
https://github.com/bantenprov/tanara/blob/e70b027cbbc59bb57a31fa3c7347e7eae87671c3/app/Http/Controllers/Auth/LoginController.php#L48-L60
arckinteractive/events_api
classes/Events/API/Util.php
Util.getDayStart
public static function getDayStart($ts = 'now', $format = 'U', $tz = null) { if (!Util::isValidTimezone($tz)) { $tz = Util::getClientTimezone(); } $dt = new DateTime(null, new DateTimeZone($tz)); (is_int($ts)) ? $dt->setTimestamp($ts) : $dt->modify($ts); $dt->setTime(0, 0, 0); return $dt->format($form...
php
public static function getDayStart($ts = 'now', $format = 'U', $tz = null) { if (!Util::isValidTimezone($tz)) { $tz = Util::getClientTimezone(); } $dt = new DateTime(null, new DateTimeZone($tz)); (is_int($ts)) ? $dt->setTimestamp($ts) : $dt->modify($ts); $dt->setTime(0, 0, 0); return $dt->format($form...
[ "public", "static", "function", "getDayStart", "(", "$", "ts", "=", "'now'", ",", "$", "format", "=", "'U'", ",", "$", "tz", "=", "null", ")", "{", "if", "(", "!", "Util", "::", "isValidTimezone", "(", "$", "tz", ")", ")", "{", "$", "tz", "=", ...
Returns a timestamp for 0:00:00 of the date of the time @param mixed $ts Date/time value @param string $format Format of the return value @return string
[ "Returns", "a", "timestamp", "for", "0", ":", "00", ":", "00", "of", "the", "date", "of", "the", "time" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L73-L82
arckinteractive/events_api
classes/Events/API/Util.php
Util.getMonthStart
public static function getMonthStart($ts = 'now', $format = 'U', $tz = null) { if (!Util::isValidTimezone($tz)) { $tz = Util::getClientTimezone(); } $dt = new DateTime(null, new DateTimeZone($tz)); (is_int($ts)) ? $dt->setTimestamp($ts) : $dt->modify($ts); $month = (int) $dt->format('m'); // month $y...
php
public static function getMonthStart($ts = 'now', $format = 'U', $tz = null) { if (!Util::isValidTimezone($tz)) { $tz = Util::getClientTimezone(); } $dt = new DateTime(null, new DateTimeZone($tz)); (is_int($ts)) ? $dt->setTimestamp($ts) : $dt->modify($ts); $month = (int) $dt->format('m'); // month $y...
[ "public", "static", "function", "getMonthStart", "(", "$", "ts", "=", "'now'", ",", "$", "format", "=", "'U'", ",", "$", "tz", "=", "null", ")", "{", "if", "(", "!", "Util", "::", "isValidTimezone", "(", "$", "tz", ")", ")", "{", "$", "tz", "=", ...
Returns a timestamp for the first of the month at 0:00:00 @param mixed $ts Date/time value @param string $format Format of the return value @return string
[ "Returns", "a", "timestamp", "for", "the", "first", "of", "the", "month", "at", "0", ":", "00", ":", "00" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L109-L124
arckinteractive/events_api
classes/Events/API/Util.php
Util.getTime
public static function getTime($ts = 'now', $format = 'U', $tz = null) { if (!Util::isValidTimezone($tz)) { $tz = Util::getClientTimezone(); } $dt = new DateTime(null, new DateTimeZone($tz)); (is_int($ts)) ? $dt->setTimestamp($ts) : $dt->modify($ts); $time = $dt->format('H') * self::SECONDS_IN_AN_HOUR;...
php
public static function getTime($ts = 'now', $format = 'U', $tz = null) { if (!Util::isValidTimezone($tz)) { $tz = Util::getClientTimezone(); } $dt = new DateTime(null, new DateTimeZone($tz)); (is_int($ts)) ? $dt->setTimestamp($ts) : $dt->modify($ts); $time = $dt->format('H') * self::SECONDS_IN_AN_HOUR;...
[ "public", "static", "function", "getTime", "(", "$", "ts", "=", "'now'", ",", "$", "format", "=", "'U'", ",", "$", "tz", "=", "null", ")", "{", "if", "(", "!", "Util", "::", "isValidTimezone", "(", "$", "tz", ")", ")", "{", "$", "tz", "=", "Uti...
Extracts time of the day timestamp @param mixed $ts Date/time value @param string $format Format of the return value @return string
[ "Extracts", "time", "of", "the", "day", "timestamp" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L161-L174
arckinteractive/events_api
classes/Events/API/Util.php
Util.getAllEvents
public static function getAllEvents($starttime, $endtime) { $starttime = sanitize_int($starttime); $endtime = sanitize_int($endtime); $dbprefix = elgg_get_config('dbprefix'); $mds_name = elgg_get_metastring_id('start_timestamp'); $mdre_name = elgg_get_metastring_id('repeat_end_timestamp'); $options = arr...
php
public static function getAllEvents($starttime, $endtime) { $starttime = sanitize_int($starttime); $endtime = sanitize_int($endtime); $dbprefix = elgg_get_config('dbprefix'); $mds_name = elgg_get_metastring_id('start_timestamp'); $mdre_name = elgg_get_metastring_id('repeat_end_timestamp'); $options = arr...
[ "public", "static", "function", "getAllEvents", "(", "$", "starttime", ",", "$", "endtime", ")", "{", "$", "starttime", "=", "sanitize_int", "(", "$", "starttime", ")", ";", "$", "endtime", "=", "sanitize_int", "(", "$", "endtime", ")", ";", "$", "dbpref...
analog of Calendar::getAllEvents but doesn't limit to a specific calendar @param type $starttime @param type $endtime
[ "analog", "of", "Calendar", "::", "getAllEvents", "but", "doesn", "t", "limit", "to", "a", "specific", "calendar" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L195-L223
arckinteractive/events_api
classes/Events/API/Util.php
Util.getTimeOfDay
public static function getTimeOfDay($ts_time = 0, $ts_day = null, $format = 'U', $tz = null) { if (!Util::isValidTimezone($tz)) { $tz = Util::getClientTimezone(); } $time = Util::getTime($ts_time, 'U', $tz); $day_start = Util::getDayStart($ts_day, 'U', $tz); $dt = new DateTime(null, new DateTimeZone($t...
php
public static function getTimeOfDay($ts_time = 0, $ts_day = null, $format = 'U', $tz = null) { if (!Util::isValidTimezone($tz)) { $tz = Util::getClientTimezone(); } $time = Util::getTime($ts_time, 'U', $tz); $day_start = Util::getDayStart($ts_day, 'U', $tz); $dt = new DateTime(null, new DateTimeZone($t...
[ "public", "static", "function", "getTimeOfDay", "(", "$", "ts_time", "=", "0", ",", "$", "ts_day", "=", "null", ",", "$", "format", "=", "'U'", ",", "$", "tz", "=", "null", ")", "{", "if", "(", "!", "Util", "::", "isValidTimezone", "(", "$", "tz", ...
Calculates a timestamp by extracting time from $ts_time and adding it to the day start on $ts_day @param mixed $ts_time Date/time string containing time information @param mixed $ts_day Date/time string containing day information @return int
[ "Calculates", "a", "timestamp", "by", "extracting", "time", "from", "$ts_time", "and", "adding", "it", "to", "the", "day", "start", "on", "$ts_day" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L232-L243
arckinteractive/events_api
classes/Events/API/Util.php
Util.getWeekOfMonth
public static function getWeekOfMonth($ts = 'now', $tz = null) { if (!Util::isValidTimezone($tz)) { $tz = Util::getClientTimezone(); } $dt = new DateTime(null, new DateTimeZone($tz)); (is_int($ts)) ? $dt->setTimestamp($ts) : $dt->modify($ts); $week_num_ts = $dt->format('W'); $week_num_month_start = $d...
php
public static function getWeekOfMonth($ts = 'now', $tz = null) { if (!Util::isValidTimezone($tz)) { $tz = Util::getClientTimezone(); } $dt = new DateTime(null, new DateTimeZone($tz)); (is_int($ts)) ? $dt->setTimestamp($ts) : $dt->modify($ts); $week_num_ts = $dt->format('W'); $week_num_month_start = $d...
[ "public", "static", "function", "getWeekOfMonth", "(", "$", "ts", "=", "'now'", ",", "$", "tz", "=", "null", ")", "{", "if", "(", "!", "Util", "::", "isValidTimezone", "(", "$", "tz", ")", ")", "{", "$", "tz", "=", "Util", "::", "getClientTimezone", ...
Returns the week number if a month (e.g. 2nd week of the month) @param mixed $ts Date/time value @return int
[ "Returns", "the", "week", "number", "if", "a", "month", "(", "e", ".", "g", ".", "2nd", "week", "of", "the", "month", ")" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L268-L278
arckinteractive/events_api
classes/Events/API/Util.php
Util.isOnSameDayOfYear
public static function isOnSameDayOfYear($ts1 = 0, $ts2 = 0, $tz = null) { if (!Util::isValidTimezone($tz)) { $tz = Util::getClientTimezone(); } $dt1 = new DateTime(null, new DateTimeZone($tz)); $dt2 = new DateTime(null, new DateTimeZone($tz)); return $dt1->setTimestamp($ts1)->format('m-j') == $dt2->set...
php
public static function isOnSameDayOfYear($ts1 = 0, $ts2 = 0, $tz = null) { if (!Util::isValidTimezone($tz)) { $tz = Util::getClientTimezone(); } $dt1 = new DateTime(null, new DateTimeZone($tz)); $dt2 = new DateTime(null, new DateTimeZone($tz)); return $dt1->setTimestamp($ts1)->format('m-j') == $dt2->set...
[ "public", "static", "function", "isOnSameDayOfYear", "(", "$", "ts1", "=", "0", ",", "$", "ts2", "=", "0", ",", "$", "tz", "=", "null", ")", "{", "if", "(", "!", "Util", "::", "isValidTimezone", "(", "$", "tz", ")", ")", "{", "$", "tz", "=", "U...
Checks if two timestamps fall on the same date of the year (e.g. February 25th) @param int $ts1 First timestamp @param int $ts2 Second timestamp @return bool
[ "Checks", "if", "two", "timestamps", "fall", "on", "the", "same", "date", "of", "the", "year", "(", "e", ".", "g", ".", "February", "25th", ")" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L335-L343
arckinteractive/events_api
classes/Events/API/Util.php
Util.isOnSameWeekDayOfMonth
public static function isOnSameWeekDayOfMonth($ts1 = 0, $ts2 = 0, $tz = null) { if (!Util::isValidTimezone($tz)) { $tz = Util::getClientTimezone(); } if (!self::isOnSameDayOfWeek($ts1, $ts2, $tz)) { return false; } return self::getWeekDayNthInMonth($ts1, $tz) == self::getWeekDayNthInMonth($ts2, $tz);...
php
public static function isOnSameWeekDayOfMonth($ts1 = 0, $ts2 = 0, $tz = null) { if (!Util::isValidTimezone($tz)) { $tz = Util::getClientTimezone(); } if (!self::isOnSameDayOfWeek($ts1, $ts2, $tz)) { return false; } return self::getWeekDayNthInMonth($ts1, $tz) == self::getWeekDayNthInMonth($ts2, $tz);...
[ "public", "static", "function", "isOnSameWeekDayOfMonth", "(", "$", "ts1", "=", "0", ",", "$", "ts2", "=", "0", ",", "$", "tz", "=", "null", ")", "{", "if", "(", "!", "Util", "::", "isValidTimezone", "(", "$", "tz", ")", ")", "{", "$", "tz", "=",...
Checks if two timestamps fall on the same week day of the month (e.g. 3rd Monday) @param int $ts1 First timestamp @param int $ts2 Second timestamp @return bool
[ "Checks", "if", "two", "timestamps", "fall", "on", "the", "same", "week", "day", "of", "the", "month", "(", "e", ".", "g", ".", "3rd", "Monday", ")" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L352-L361
arckinteractive/events_api
classes/Events/API/Util.php
Util.getWeekdays
public static function getWeekdays() { return array( self::MONDAY, self::TUESDAY, self::WEDNESDAY, self::THURSDAY, self::FRIDAY, self::SATURDAY, self::SUNDAY, ); }
php
public static function getWeekdays() { return array( self::MONDAY, self::TUESDAY, self::WEDNESDAY, self::THURSDAY, self::FRIDAY, self::SATURDAY, self::SUNDAY, ); }
[ "public", "static", "function", "getWeekdays", "(", ")", "{", "return", "array", "(", "self", "::", "MONDAY", ",", "self", "::", "TUESDAY", ",", "self", "::", "WEDNESDAY", ",", "self", "::", "THURSDAY", ",", "self", "::", "FRIDAY", ",", "self", "::", "...
Returns an array of weekdays @return array
[ "Returns", "an", "array", "of", "weekdays" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L367-L377
arckinteractive/events_api
classes/Events/API/Util.php
Util.getRepeatFrequencies
function getRepeatFrequencies() { return array( Util::FREQUENCY_DAILY => elgg_echo('events_ui:repeat:daily'), Util::FREQUENCY_WEEKDAY => elgg_echo('events_ui:repeat:weekday'), Util::FREQUENCY_WEEKDAY_ODD => elgg_echo('events_ui:repeat:dailymwf'), Util::FREQUENCY_WEEKDAY_EVEN => elgg_echo('events_ui:repeat...
php
function getRepeatFrequencies() { return array( Util::FREQUENCY_DAILY => elgg_echo('events_ui:repeat:daily'), Util::FREQUENCY_WEEKDAY => elgg_echo('events_ui:repeat:weekday'), Util::FREQUENCY_WEEKDAY_ODD => elgg_echo('events_ui:repeat:dailymwf'), Util::FREQUENCY_WEEKDAY_EVEN => elgg_echo('events_ui:repeat...
[ "function", "getRepeatFrequencies", "(", ")", "{", "return", "array", "(", "Util", "::", "FREQUENCY_DAILY", "=>", "elgg_echo", "(", "'events_ui:repeat:daily'", ")", ",", "Util", "::", "FREQUENCY_WEEKDAY", "=>", "elgg_echo", "(", "'events_ui:repeat:weekday'", ")", ",...
Returns repeat frequencies @return array
[ "Returns", "repeat", "frequencies" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L383-L393
arckinteractive/events_api
classes/Events/API/Util.php
Util.getOffset
public static function getOffset($ts = 'now', $timezone = self::UTC, $target_timezone = self::UTC) { if (!self::isValidTimezone($timezone) || !self::isValidTimezone($target_timezone)) { return 0; } $dta = new DateTime(null, new DateTimeZone($timezone)); $dtb = new DateTime(null, new DateTimeZone($target_ti...
php
public static function getOffset($ts = 'now', $timezone = self::UTC, $target_timezone = self::UTC) { if (!self::isValidTimezone($timezone) || !self::isValidTimezone($target_timezone)) { return 0; } $dta = new DateTime(null, new DateTimeZone($timezone)); $dtb = new DateTime(null, new DateTimeZone($target_ti...
[ "public", "static", "function", "getOffset", "(", "$", "ts", "=", "'now'", ",", "$", "timezone", "=", "self", "::", "UTC", ",", "$", "target_timezone", "=", "self", "::", "UTC", ")", "{", "if", "(", "!", "self", "::", "isValidTimezone", "(", "$", "ti...
Calculates the offset between timezones at a given date/time @param mixed $ts Date/time value @param string $timezone Timezone of the date/time value $param string $target_timezone Target timezone @return int
[ "Calculates", "the", "offset", "between", "timezones", "at", "a", "given", "date", "/", "time" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L403-L421
arckinteractive/events_api
classes/Events/API/Util.php
Util.getTimezones
public static function getTimezones($filter = true, $format = false, $ts = 'now', $sort = self::TIMEZONE_SORT_ALPHA) { $tz_ids = DateTimeZone::listIdentifiers(); $defaults = array(); foreach ($tz_ids as $tz_id) { $defaults[$tz_id] = Util::getTimezoneLabel($tz_id, $format, $ts); } switch ($sort) { ca...
php
public static function getTimezones($filter = true, $format = false, $ts = 'now', $sort = self::TIMEZONE_SORT_ALPHA) { $tz_ids = DateTimeZone::listIdentifiers(); $defaults = array(); foreach ($tz_ids as $tz_id) { $defaults[$tz_id] = Util::getTimezoneLabel($tz_id, $format, $ts); } switch ($sort) { ca...
[ "public", "static", "function", "getTimezones", "(", "$", "filter", "=", "true", ",", "$", "format", "=", "false", ",", "$", "ts", "=", "'now'", ",", "$", "sort", "=", "self", "::", "TIMEZONE_SORT_ALPHA", ")", "{", "$", "tz_ids", "=", "DateTimeZone", "...
Returns a list of supported timezones Triggers 'timezones','events_api' hook if $filter is set to true @param boolean $filter If false, returns all supported PHP timezones @param mixed $format Timezone label date format; if false, uses elgg_echo($tz_id) @param mixed $ts Optional timestamp for label format @...
[ "Returns", "a", "list", "of", "supported", "timezones", "Triggers", "timezones", "events_api", "hook", "if", "$filter", "is", "set", "to", "true" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L433-L457
arckinteractive/events_api
classes/Events/API/Util.php
Util.getTimezonesByCountry
public static function getTimezonesByCountry() { $timezones = array(); $tz_ids = array_keys(self::getTimezones(true, false, 'now', self::TIMEZONE_SORT_OFFSET)); foreach ($tz_ids as $tz_id) { if ($tz_id == Util::UTC) { continue; } $info = Util::getTimezoneInfo($tz_id); $cc = $info->country_code; ...
php
public static function getTimezonesByCountry() { $timezones = array(); $tz_ids = array_keys(self::getTimezones(true, false, 'now', self::TIMEZONE_SORT_OFFSET)); foreach ($tz_ids as $tz_id) { if ($tz_id == Util::UTC) { continue; } $info = Util::getTimezoneInfo($tz_id); $cc = $info->country_code; ...
[ "public", "static", "function", "getTimezonesByCountry", "(", ")", "{", "$", "timezones", "=", "array", "(", ")", ";", "$", "tz_ids", "=", "array_keys", "(", "self", "::", "getTimezones", "(", "true", ",", "false", ",", "'now'", ",", "self", "::", "TIMEZ...
Returns an array of timezones by country @return array
[ "Returns", "an", "array", "of", "timezones", "by", "country" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L463-L480
arckinteractive/events_api
classes/Events/API/Util.php
Util.getTimezoneInfo
public static function getTimezoneInfo($tz_id) { $tz = new \DateTimeZone($tz_id); $location = $tz->getLocation(); $country_code = $location['country_code']; $dt = new DateTime(null, $tz); $region = explode('/', $tz_id); if (sizeof($region) > 1) { array_shift($region); } $region = str_replace('_', ...
php
public static function getTimezoneInfo($tz_id) { $tz = new \DateTimeZone($tz_id); $location = $tz->getLocation(); $country_code = $location['country_code']; $dt = new DateTime(null, $tz); $region = explode('/', $tz_id); if (sizeof($region) > 1) { array_shift($region); } $region = str_replace('_', ...
[ "public", "static", "function", "getTimezoneInfo", "(", "$", "tz_id", ")", "{", "$", "tz", "=", "new", "\\", "DateTimeZone", "(", "$", "tz_id", ")", ";", "$", "location", "=", "$", "tz", "->", "getLocation", "(", ")", ";", "$", "country_code", "=", "...
Expands timezone ID into a usable source of data about the timezone @param string $tz_id Timezone ID e.g. America\New_York @return stdClass
[ "Expands", "timezone", "ID", "into", "a", "usable", "source", "of", "data", "about", "the", "timezone" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L488-L517
arckinteractive/events_api
classes/Events/API/Util.php
Util.isValidTimezone
public static function isValidTimezone($timezone) { static $cache; if (!is_array($cache)) { $cache = array(); } if (isset($cache[$timezone])) { return $cache[$timezone]; } $cache[$timezone] = in_array($timezone, DateTimeZone::listIdentifiers()); return $cache[$timezone]; }
php
public static function isValidTimezone($timezone) { static $cache; if (!is_array($cache)) { $cache = array(); } if (isset($cache[$timezone])) { return $cache[$timezone]; } $cache[$timezone] = in_array($timezone, DateTimeZone::listIdentifiers()); return $cache[$timezone]; }
[ "public", "static", "function", "isValidTimezone", "(", "$", "timezone", ")", "{", "static", "$", "cache", ";", "if", "(", "!", "is_array", "(", "$", "cache", ")", ")", "{", "$", "cache", "=", "array", "(", ")", ";", "}", "if", "(", "isset", "(", ...
Checks if $timezone id is valid @param string $timezone @return bool
[ "Checks", "if", "$timezone", "id", "is", "valid" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L525-L537
arckinteractive/events_api
classes/Events/API/Util.php
Util.getTimezoneLabel
public static function getTimezoneLabel($tz_id, $format = false, $ts = 'now') { if (self::isValidTimezone($tz_id) && $format) { $dt = new DateTime(null, new DateTimeZone($tz_id)); (is_int($ts)) ? $dt->setTimestamp($ts) : $dt->modify($ts); return $dt->format($format); } return elgg_echo($tz_id); }
php
public static function getTimezoneLabel($tz_id, $format = false, $ts = 'now') { if (self::isValidTimezone($tz_id) && $format) { $dt = new DateTime(null, new DateTimeZone($tz_id)); (is_int($ts)) ? $dt->setTimestamp($ts) : $dt->modify($ts); return $dt->format($format); } return elgg_echo($tz_id); }
[ "public", "static", "function", "getTimezoneLabel", "(", "$", "tz_id", ",", "$", "format", "=", "false", ",", "$", "ts", "=", "'now'", ")", "{", "if", "(", "self", "::", "isValidTimezone", "(", "$", "tz_id", ")", "&&", "$", "format", ")", "{", "$", ...
Returns a label for a timezone @param string $tz_id PHP timezone id @param format $format Format @param mixed $ts Optional timestamp @return string
[ "Returns", "a", "label", "for", "a", "timezone" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L547-L555
arckinteractive/events_api
classes/Events/API/Util.php
Util.compareTimezonesByOffset
public static function compareTimezonesByOffset($a, $b) { $dta = new DateTime(null, new DateTimeZone($a)); $dtb = new DateTime(null, new DateTimeZone($b)); if ($dta->getOffset() == $dtb->getOffset()) { return (strcmp($a, $b) < 0) ? -1 : 1; } return ($dta->getOffset() < $dtb->getOffset()) ? -1 : 1; }
php
public static function compareTimezonesByOffset($a, $b) { $dta = new DateTime(null, new DateTimeZone($a)); $dtb = new DateTime(null, new DateTimeZone($b)); if ($dta->getOffset() == $dtb->getOffset()) { return (strcmp($a, $b) < 0) ? -1 : 1; } return ($dta->getOffset() < $dtb->getOffset()) ? -1 : 1; }
[ "public", "static", "function", "compareTimezonesByOffset", "(", "$", "a", ",", "$", "b", ")", "{", "$", "dta", "=", "new", "DateTime", "(", "null", ",", "new", "DateTimeZone", "(", "$", "a", ")", ")", ";", "$", "dtb", "=", "new", "DateTime", "(", ...
Sorting callback function for comparing timezones by offset @return int
[ "Sorting", "callback", "function", "for", "comparing", "timezones", "by", "offset" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L561-L570
arckinteractive/events_api
classes/Events/API/Util.php
Util.getClientTimezone
public static function getClientTimezone($user = null) { if (isset(self::$timezone)) { return self::$timezone; } $preferred = array(); $preferred[] = get_input('timezone'); if ($user == null) { $user = elgg_get_logged_in_user_entity(); } if ($user) { $preferred[] = $user->timezone; } ...
php
public static function getClientTimezone($user = null) { if (isset(self::$timezone)) { return self::$timezone; } $preferred = array(); $preferred[] = get_input('timezone'); if ($user == null) { $user = elgg_get_logged_in_user_entity(); } if ($user) { $preferred[] = $user->timezone; } ...
[ "public", "static", "function", "getClientTimezone", "(", "$", "user", "=", "null", ")", "{", "if", "(", "isset", "(", "self", "::", "$", "timezone", ")", ")", "{", "return", "self", "::", "$", "timezone", ";", "}", "$", "preferred", "=", "array", "(...
Returns display timezone Returns first set value from the following: 1. Request query element 2. Timezone set by the user in their settings 3. Timezone set as site default 4. PHP timezone @param ElggUser $user User @return string
[ "Returns", "display", "timezone" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L584-L616
arckinteractive/events_api
classes/Events/API/Util.php
Util.toISO8601
public static function toISO8601($ts = 'now', $timezone = Util::UTC, $target_timezone = Util::UTC) { $dt = new DateTime(null, new DateTimeZone($timezone)); (is_int($ts)) ? $dt->setTimestamp($ts) : $dt->modify($ts); $dt->setTimezone(new DateTimeZone($target_timezone)); return $dt->format('c'); }
php
public static function toISO8601($ts = 'now', $timezone = Util::UTC, $target_timezone = Util::UTC) { $dt = new DateTime(null, new DateTimeZone($timezone)); (is_int($ts)) ? $dt->setTimestamp($ts) : $dt->modify($ts); $dt->setTimezone(new DateTimeZone($target_timezone)); return $dt->format('c'); }
[ "public", "static", "function", "toISO8601", "(", "$", "ts", "=", "'now'", ",", "$", "timezone", "=", "Util", "::", "UTC", ",", "$", "target_timezone", "=", "Util", "::", "UTC", ")", "{", "$", "dt", "=", "new", "DateTime", "(", "null", ",", "new", ...
Returns a representation of $ts in ISO8601 format using $tz_id as a base timezone @param mixed $ts Date/time value @param string $timezone Base timezone of the date/time value @param string $target_timezone Target timezone of the formatted value @return string
[ "Returns", "a", "representation", "of", "$ts", "in", "ISO8601", "format", "using", "$tz_id", "as", "a", "base", "timezone" ]
train
https://github.com/arckinteractive/events_api/blob/56c0f0ae403af1672a913db5dc259db9cb712491/classes/Events/API/Util.php#L626-L631