id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
24,500
Duffleman/json-client
src/JSONClient.php
JSONClient.setupVariables
private function setupVariables($body, $query, $headers) { if (is_null($headers)) { $headers = []; } if (is_null($query)) { $query = []; } if (is_null($body)) { $body = []; } return [$body, $query, $headers]; }
php
private function setupVariables($body, $query, $headers) { if (is_null($headers)) { $headers = []; } if (is_null($query)) { $query = []; } if (is_null($body)) { $body = []; } return [$body, $query, $headers]; }
[ "private", "function", "setupVariables", "(", "$", "body", ",", "$", "query", ",", "$", "headers", ")", "{", "if", "(", "is_null", "(", "$", "headers", ")", ")", "{", "$", "headers", "=", "[", "]", ";", "}", "if", "(", "is_null", "(", "$", "query", ")", ")", "{", "$", "query", "=", "[", "]", ";", "}", "if", "(", "is_null", "(", "$", "body", ")", ")", "{", "$", "body", "=", "[", "]", ";", "}", "return", "[", "$", "body", ",", "$", "query", ",", "$", "headers", "]", ";", "}" ]
Setup empty arrays if null given. @param $body @param $query @param $headers @return array
[ "Setup", "empty", "arrays", "if", "null", "given", "." ]
83432875a000e79243424a1e8676acb9969d0c18
https://github.com/Duffleman/json-client/blob/83432875a000e79243424a1e8676acb9969d0c18/src/JSONClient.php#L280-L293
24,501
heidelpay/PhpDoc
src/phpDocumentor/Bootstrap.php
Bootstrap.initialize
public function initialize() { $vendorPath = $this->findVendorPath(); $autoloader = $this->createAutoloader($vendorPath); return new Application($autoloader, array('composer.vendor_path' => $vendorPath)); }
php
public function initialize() { $vendorPath = $this->findVendorPath(); $autoloader = $this->createAutoloader($vendorPath); return new Application($autoloader, array('composer.vendor_path' => $vendorPath)); }
[ "public", "function", "initialize", "(", ")", "{", "$", "vendorPath", "=", "$", "this", "->", "findVendorPath", "(", ")", ";", "$", "autoloader", "=", "$", "this", "->", "createAutoloader", "(", "$", "vendorPath", ")", ";", "return", "new", "Application", "(", "$", "autoloader", ",", "array", "(", "'composer.vendor_path'", "=>", "$", "vendorPath", ")", ")", ";", "}" ]
Convenience method that does the complete initialization for phpDocumentor. @return Application
[ "Convenience", "method", "that", "does", "the", "complete", "initialization", "for", "phpDocumentor", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Bootstrap.php#L56-L63
24,502
heidelpay/PhpDoc
src/phpDocumentor/Bootstrap.php
Bootstrap.registerProfiler
public function registerProfiler() { // check whether xhprof is loaded $profile = (bool) (getenv('PHPDOC_PROFILE') === 'on'); $xhguiPath = getenv('XHGUI_PATH'); if ($profile && $xhguiPath && extension_loaded('xhprof')) { echo 'PROFILING ENABLED' . PHP_EOL; include($xhguiPath . '/external/header.php'); } return $this; }
php
public function registerProfiler() { // check whether xhprof is loaded $profile = (bool) (getenv('PHPDOC_PROFILE') === 'on'); $xhguiPath = getenv('XHGUI_PATH'); if ($profile && $xhguiPath && extension_loaded('xhprof')) { echo 'PROFILING ENABLED' . PHP_EOL; include($xhguiPath . '/external/header.php'); } return $this; }
[ "public", "function", "registerProfiler", "(", ")", "{", "// check whether xhprof is loaded", "$", "profile", "=", "(", "bool", ")", "(", "getenv", "(", "'PHPDOC_PROFILE'", ")", "===", "'on'", ")", ";", "$", "xhguiPath", "=", "getenv", "(", "'XHGUI_PATH'", ")", ";", "if", "(", "$", "profile", "&&", "$", "xhguiPath", "&&", "extension_loaded", "(", "'xhprof'", ")", ")", "{", "echo", "'PROFILING ENABLED'", ".", "PHP_EOL", ";", "include", "(", "$", "xhguiPath", ".", "'/external/header.php'", ")", ";", "}", "return", "$", "this", ";", "}" ]
Sets up XHProf so that we can profile phpDocumentor using XHGUI. @return self
[ "Sets", "up", "XHProf", "so", "that", "we", "can", "profile", "phpDocumentor", "using", "XHGUI", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Bootstrap.php#L70-L81
24,503
heidelpay/PhpDoc
src/phpDocumentor/Bootstrap.php
Bootstrap.createAutoloader
public function createAutoloader($vendorDir = null) { if (! $vendorDir) { $vendorDir = __DIR__ . '/../../vendor'; } $autoloader_location = $vendorDir . '/autoload.php'; if (! file_exists($autoloader_location) || ! is_readable($autoloader_location)) { throw new \RuntimeException( 'phpDocumentor expected to find an autoloader at "' . $autoloader_location . '" but it was not there. ' . 'Usually this is because the "composer install" command has not been ran yet. If this is not the ' . 'case, please open an issue at http://github.com/phpDocumentor/phpDocumentor2 detailing what ' . 'installation method you used, which path is mentioned in this error message and any other relevant ' . 'information.' ); } return require $autoloader_location; }
php
public function createAutoloader($vendorDir = null) { if (! $vendorDir) { $vendorDir = __DIR__ . '/../../vendor'; } $autoloader_location = $vendorDir . '/autoload.php'; if (! file_exists($autoloader_location) || ! is_readable($autoloader_location)) { throw new \RuntimeException( 'phpDocumentor expected to find an autoloader at "' . $autoloader_location . '" but it was not there. ' . 'Usually this is because the "composer install" command has not been ran yet. If this is not the ' . 'case, please open an issue at http://github.com/phpDocumentor/phpDocumentor2 detailing what ' . 'installation method you used, which path is mentioned in this error message and any other relevant ' . 'information.' ); } return require $autoloader_location; }
[ "public", "function", "createAutoloader", "(", "$", "vendorDir", "=", "null", ")", "{", "if", "(", "!", "$", "vendorDir", ")", "{", "$", "vendorDir", "=", "__DIR__", ".", "'/../../vendor'", ";", "}", "$", "autoloader_location", "=", "$", "vendorDir", ".", "'/autoload.php'", ";", "if", "(", "!", "file_exists", "(", "$", "autoloader_location", ")", "||", "!", "is_readable", "(", "$", "autoloader_location", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'phpDocumentor expected to find an autoloader at \"'", ".", "$", "autoloader_location", ".", "'\" but it was not there. '", ".", "'Usually this is because the \"composer install\" command has not been ran yet. If this is not the '", ".", "'case, please open an issue at http://github.com/phpDocumentor/phpDocumentor2 detailing what '", ".", "'installation method you used, which path is mentioned in this error message and any other relevant '", ".", "'information.'", ")", ";", "}", "return", "require", "$", "autoloader_location", ";", "}" ]
Initializes and returns the autoloader. @param string|null $vendorDir A path (either absolute or relative to the current working directory) leading to the vendor folder where composer installed the dependencies. @throws \RuntimeException if no autoloader could be found. @return ClassLoader
[ "Initializes", "and", "returns", "the", "autoloader", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Bootstrap.php#L93-L111
24,504
songshenzong/log
src/LaravelDebugbar.php
LaravelDebugbar.collectConsole
public function collectConsole() { if (!$this->isEnabled()) { return; } $this->meta = [ 'time' => microtime(true), 'method' => 'CLI', 'uri' => isset($_SERVER['argv']) ? implode(' ', $_SERVER['argv']) : null, 'ip' => isset($_SERVER['SSH_CLIENT']) ? $_SERVER['SSH_CLIENT'] : null, ]; foreach ($this->collectors as $name => $collector) { $this->data[$name] = $collector->collect(); } // Remove all invalid (non UTF-8) characters array_walk_recursive( $this->data, function (&$item) { if (is_string($item) && !mb_check_encoding($item, 'UTF-8')) { $item = mb_convert_encoding($item, 'UTF-8', 'UTF-8'); } } ); $this->persistData(); return $this->data; }
php
public function collectConsole() { if (!$this->isEnabled()) { return; } $this->meta = [ 'time' => microtime(true), 'method' => 'CLI', 'uri' => isset($_SERVER['argv']) ? implode(' ', $_SERVER['argv']) : null, 'ip' => isset($_SERVER['SSH_CLIENT']) ? $_SERVER['SSH_CLIENT'] : null, ]; foreach ($this->collectors as $name => $collector) { $this->data[$name] = $collector->collect(); } // Remove all invalid (non UTF-8) characters array_walk_recursive( $this->data, function (&$item) { if (is_string($item) && !mb_check_encoding($item, 'UTF-8')) { $item = mb_convert_encoding($item, 'UTF-8', 'UTF-8'); } } ); $this->persistData(); return $this->data; }
[ "public", "function", "collectConsole", "(", ")", "{", "if", "(", "!", "$", "this", "->", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "$", "this", "->", "meta", "=", "[", "'time'", "=>", "microtime", "(", "true", ")", ",", "'method'", "=>", "'CLI'", ",", "'uri'", "=>", "isset", "(", "$", "_SERVER", "[", "'argv'", "]", ")", "?", "implode", "(", "' '", ",", "$", "_SERVER", "[", "'argv'", "]", ")", ":", "null", ",", "'ip'", "=>", "isset", "(", "$", "_SERVER", "[", "'SSH_CLIENT'", "]", ")", "?", "$", "_SERVER", "[", "'SSH_CLIENT'", "]", ":", "null", ",", "]", ";", "foreach", "(", "$", "this", "->", "collectors", "as", "$", "name", "=>", "$", "collector", ")", "{", "$", "this", "->", "data", "[", "$", "name", "]", "=", "$", "collector", "->", "collect", "(", ")", ";", "}", "// Remove all invalid (non UTF-8) characters", "array_walk_recursive", "(", "$", "this", "->", "data", ",", "function", "(", "&", "$", "item", ")", "{", "if", "(", "is_string", "(", "$", "item", ")", "&&", "!", "mb_check_encoding", "(", "$", "item", ",", "'UTF-8'", ")", ")", "{", "$", "item", "=", "mb_convert_encoding", "(", "$", "item", ",", "'UTF-8'", ",", "'UTF-8'", ")", ";", "}", "}", ")", ";", "$", "this", "->", "persistData", "(", ")", ";", "return", "$", "this", "->", "data", ";", "}" ]
Collect data in a CLI request @return array
[ "Collect", "data", "in", "a", "CLI", "request" ]
b1e01f7994da47737866eabf82367490eab17c46
https://github.com/songshenzong/log/blob/b1e01f7994da47737866eabf82367490eab17c46/src/LaravelDebugbar.php#L797-L830
24,505
songshenzong/log
src/LaravelDebugbar.php
LaravelDebugbar.json
public function json($status_code, $message, $data = null) { return response()->json([ 'status_code' => $status_code, 'message' => $message, 'data' => $data, 'request' => \request()->all(), ]); }
php
public function json($status_code, $message, $data = null) { return response()->json([ 'status_code' => $status_code, 'message' => $message, 'data' => $data, 'request' => \request()->all(), ]); }
[ "public", "function", "json", "(", "$", "status_code", ",", "$", "message", ",", "$", "data", "=", "null", ")", "{", "return", "response", "(", ")", "->", "json", "(", "[", "'status_code'", "=>", "$", "status_code", ",", "'message'", "=>", "$", "message", ",", "'data'", "=>", "$", "data", ",", "'request'", "=>", "\\", "request", "(", ")", "->", "all", "(", ")", ",", "]", ")", ";", "}" ]
Basic Json method. @param $status_code @param $message @param null $data @return mixed
[ "Basic", "Json", "method", "." ]
b1e01f7994da47737866eabf82367490eab17c46
https://github.com/songshenzong/log/blob/b1e01f7994da47737866eabf82367490eab17c46/src/LaravelDebugbar.php#L969-L977
24,506
novaway/open-graph
src/Metadata/Driver/YamlDriver.php
YamlDriver.parseNamespaces
protected function parseNamespaces(ClassMetadata $metadata, $config) { if (!isset($config['namespaces'])) { return; } if (!is_array($config)) { throw new \RuntimeException(sprintf('Invalid YAML configuration for "%s" : "namespaces" property need to be an array.', $metadata->name)); } foreach ($config['namespaces'] as $prefix => $uri) { $metadata->addGraphNamespace(new NamespaceNode([ 'prefix' => $prefix, 'uri' => $uri, ])); } }
php
protected function parseNamespaces(ClassMetadata $metadata, $config) { if (!isset($config['namespaces'])) { return; } if (!is_array($config)) { throw new \RuntimeException(sprintf('Invalid YAML configuration for "%s" : "namespaces" property need to be an array.', $metadata->name)); } foreach ($config['namespaces'] as $prefix => $uri) { $metadata->addGraphNamespace(new NamespaceNode([ 'prefix' => $prefix, 'uri' => $uri, ])); } }
[ "protected", "function", "parseNamespaces", "(", "ClassMetadata", "$", "metadata", ",", "$", "config", ")", "{", "if", "(", "!", "isset", "(", "$", "config", "[", "'namespaces'", "]", ")", ")", "{", "return", ";", "}", "if", "(", "!", "is_array", "(", "$", "config", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'Invalid YAML configuration for \"%s\" : \"namespaces\" property need to be an array.'", ",", "$", "metadata", "->", "name", ")", ")", ";", "}", "foreach", "(", "$", "config", "[", "'namespaces'", "]", "as", "$", "prefix", "=>", "$", "uri", ")", "{", "$", "metadata", "->", "addGraphNamespace", "(", "new", "NamespaceNode", "(", "[", "'prefix'", "=>", "$", "prefix", ",", "'uri'", "=>", "$", "uri", ",", "]", ")", ")", ";", "}", "}" ]
Parse namespaces configuration @param ClassMetadata $metadata @param mixed $config
[ "Parse", "namespaces", "configuration" ]
19817bee4b91cf26ca3fe44883ad58b32328e464
https://github.com/novaway/open-graph/blob/19817bee4b91cf26ca3fe44883ad58b32328e464/src/Metadata/Driver/YamlDriver.php#L51-L67
24,507
novaway/open-graph
src/Metadata/Driver/YamlDriver.php
YamlDriver.parseNodes
protected function parseNodes(\ReflectionClass $class, ClassMetadata $metadata, $config) { if (!isset($config['nodes'])) { return; } if (!is_array($config)) { throw new \RuntimeException(sprintf('Invalid YAML configuration for "%s" : "properties" property need to be an array.', $metadata->name)); } foreach ($config['nodes'] as $property => $nodeProperties) { foreach ($nodeProperties as $nodeProperty) { if (!isset($nodeProperty['namespace']) || !isset($nodeProperty['tag'])) { throw new \RuntimeException(sprintf('Invalid YAML configuration for "%s" : "namespace" and "tag" are required.', $metadata->name)); } $node = new Node([ 'namespace' => $nodeProperty['namespace'], 'tag' => $nodeProperty['tag'], ]); if ($class->hasProperty($property)) { $metadata->addGraphMetadata($node, new PropertyMetadata($class->name, $property)); } if ($class->hasMethod($property)) { $metadata->addGraphMetadata($node, new MethodMetadata($class->name, $property)); } } } }
php
protected function parseNodes(\ReflectionClass $class, ClassMetadata $metadata, $config) { if (!isset($config['nodes'])) { return; } if (!is_array($config)) { throw new \RuntimeException(sprintf('Invalid YAML configuration for "%s" : "properties" property need to be an array.', $metadata->name)); } foreach ($config['nodes'] as $property => $nodeProperties) { foreach ($nodeProperties as $nodeProperty) { if (!isset($nodeProperty['namespace']) || !isset($nodeProperty['tag'])) { throw new \RuntimeException(sprintf('Invalid YAML configuration for "%s" : "namespace" and "tag" are required.', $metadata->name)); } $node = new Node([ 'namespace' => $nodeProperty['namespace'], 'tag' => $nodeProperty['tag'], ]); if ($class->hasProperty($property)) { $metadata->addGraphMetadata($node, new PropertyMetadata($class->name, $property)); } if ($class->hasMethod($property)) { $metadata->addGraphMetadata($node, new MethodMetadata($class->name, $property)); } } } }
[ "protected", "function", "parseNodes", "(", "\\", "ReflectionClass", "$", "class", ",", "ClassMetadata", "$", "metadata", ",", "$", "config", ")", "{", "if", "(", "!", "isset", "(", "$", "config", "[", "'nodes'", "]", ")", ")", "{", "return", ";", "}", "if", "(", "!", "is_array", "(", "$", "config", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'Invalid YAML configuration for \"%s\" : \"properties\" property need to be an array.'", ",", "$", "metadata", "->", "name", ")", ")", ";", "}", "foreach", "(", "$", "config", "[", "'nodes'", "]", "as", "$", "property", "=>", "$", "nodeProperties", ")", "{", "foreach", "(", "$", "nodeProperties", "as", "$", "nodeProperty", ")", "{", "if", "(", "!", "isset", "(", "$", "nodeProperty", "[", "'namespace'", "]", ")", "||", "!", "isset", "(", "$", "nodeProperty", "[", "'tag'", "]", ")", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'Invalid YAML configuration for \"%s\" : \"namespace\" and \"tag\" are required.'", ",", "$", "metadata", "->", "name", ")", ")", ";", "}", "$", "node", "=", "new", "Node", "(", "[", "'namespace'", "=>", "$", "nodeProperty", "[", "'namespace'", "]", ",", "'tag'", "=>", "$", "nodeProperty", "[", "'tag'", "]", ",", "]", ")", ";", "if", "(", "$", "class", "->", "hasProperty", "(", "$", "property", ")", ")", "{", "$", "metadata", "->", "addGraphMetadata", "(", "$", "node", ",", "new", "PropertyMetadata", "(", "$", "class", "->", "name", ",", "$", "property", ")", ")", ";", "}", "if", "(", "$", "class", "->", "hasMethod", "(", "$", "property", ")", ")", "{", "$", "metadata", "->", "addGraphMetadata", "(", "$", "node", ",", "new", "MethodMetadata", "(", "$", "class", "->", "name", ",", "$", "property", ")", ")", ";", "}", "}", "}", "}" ]
Parse OpenGraph node properties @param \ReflectionClass $class @param ClassMetadata $metadata @param mixed $config
[ "Parse", "OpenGraph", "node", "properties" ]
19817bee4b91cf26ca3fe44883ad58b32328e464
https://github.com/novaway/open-graph/blob/19817bee4b91cf26ca3fe44883ad58b32328e464/src/Metadata/Driver/YamlDriver.php#L76-L106
24,508
42mate/towel
src/Towel/Towel.php
Towel.getApps
static public function getApps() { static $applications = array(); if (!empty($applications)) { return $applications; } $appsDir = APP_ROOT_DIR . '/Application'; $content = scandir($appsDir); foreach ($content as $item) { if (is_dir($appsDir . '/' . $item) && $item != '.' && $item != '..') { $application = array(); $application['name'] = $item; $application['path'] = $appsDir . '/' . $item; $applications[$item] = $application; } } $application = array(); $application['name'] = basename(APP_FW_DIR); $application['path'] = APP_FW_DIR; $applications['Towel'] = $application; return $applications; }
php
static public function getApps() { static $applications = array(); if (!empty($applications)) { return $applications; } $appsDir = APP_ROOT_DIR . '/Application'; $content = scandir($appsDir); foreach ($content as $item) { if (is_dir($appsDir . '/' . $item) && $item != '.' && $item != '..') { $application = array(); $application['name'] = $item; $application['path'] = $appsDir . '/' . $item; $applications[$item] = $application; } } $application = array(); $application['name'] = basename(APP_FW_DIR); $application['path'] = APP_FW_DIR; $applications['Towel'] = $application; return $applications; }
[ "static", "public", "function", "getApps", "(", ")", "{", "static", "$", "applications", "=", "array", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "applications", ")", ")", "{", "return", "$", "applications", ";", "}", "$", "appsDir", "=", "APP_ROOT_DIR", ".", "'/Application'", ";", "$", "content", "=", "scandir", "(", "$", "appsDir", ")", ";", "foreach", "(", "$", "content", "as", "$", "item", ")", "{", "if", "(", "is_dir", "(", "$", "appsDir", ".", "'/'", ".", "$", "item", ")", "&&", "$", "item", "!=", "'.'", "&&", "$", "item", "!=", "'..'", ")", "{", "$", "application", "=", "array", "(", ")", ";", "$", "application", "[", "'name'", "]", "=", "$", "item", ";", "$", "application", "[", "'path'", "]", "=", "$", "appsDir", ".", "'/'", ".", "$", "item", ";", "$", "applications", "[", "$", "item", "]", "=", "$", "application", ";", "}", "}", "$", "application", "=", "array", "(", ")", ";", "$", "application", "[", "'name'", "]", "=", "basename", "(", "APP_FW_DIR", ")", ";", "$", "application", "[", "'path'", "]", "=", "APP_FW_DIR", ";", "$", "applications", "[", "'Towel'", "]", "=", "$", "application", ";", "return", "$", "applications", ";", "}" ]
Gets Available applications return Array : Applications names.
[ "Gets", "Available", "applications" ]
5316c3075fc844e8a5cbae113712b26556227dff
https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Towel.php#L12-L37
24,509
ronaldborla/chikka
src/Borla/Chikka/Models/Config.php
Config.setShortcodeAttribute
protected function setShortcodeAttribute($value) { // Extract numerics only $shortcode = Utilities::extractNumerics($value); // If shortcode doesn't begin with 29290 if (substr($shortcode, 0, 5) != '29290') { // Throw error throw new InvalidConfig('Shortcode must start with `29290`. `' . $shortcode . '` is given'); } // Set shortcode return $shortcode; }
php
protected function setShortcodeAttribute($value) { // Extract numerics only $shortcode = Utilities::extractNumerics($value); // If shortcode doesn't begin with 29290 if (substr($shortcode, 0, 5) != '29290') { // Throw error throw new InvalidConfig('Shortcode must start with `29290`. `' . $shortcode . '` is given'); } // Set shortcode return $shortcode; }
[ "protected", "function", "setShortcodeAttribute", "(", "$", "value", ")", "{", "// Extract numerics only", "$", "shortcode", "=", "Utilities", "::", "extractNumerics", "(", "$", "value", ")", ";", "// If shortcode doesn't begin with 29290", "if", "(", "substr", "(", "$", "shortcode", ",", "0", ",", "5", ")", "!=", "'29290'", ")", "{", "// Throw error", "throw", "new", "InvalidConfig", "(", "'Shortcode must start with `29290`. `'", ".", "$", "shortcode", ".", "'` is given'", ")", ";", "}", "// Set shortcode", "return", "$", "shortcode", ";", "}" ]
When setting shortcode
[ "When", "setting", "shortcode" ]
446987706f81d5a0efbc8bd6b7d3b259d0527719
https://github.com/ronaldborla/chikka/blob/446987706f81d5a0efbc8bd6b7d3b259d0527719/src/Borla/Chikka/Models/Config.php#L40-L50
24,510
Root-XS/SudoBible
src/SudoBiblePassage.php
SudoBiblePassage.nextVerse
public function nextVerse() { if ($this->isEmpty()) throw new Exception(__METHOD__ . ': Can\'t find next - current passage is invalid.'); $oLastVerse = $this->getLastVerse(); return $this->oBible->nextVerse( $oLastVerse->book_id, $oLastVerse->chapter, $oLastVerse->verse ); }
php
public function nextVerse() { if ($this->isEmpty()) throw new Exception(__METHOD__ . ': Can\'t find next - current passage is invalid.'); $oLastVerse = $this->getLastVerse(); return $this->oBible->nextVerse( $oLastVerse->book_id, $oLastVerse->chapter, $oLastVerse->verse ); }
[ "public", "function", "nextVerse", "(", ")", "{", "if", "(", "$", "this", "->", "isEmpty", "(", ")", ")", "throw", "new", "Exception", "(", "__METHOD__", ".", "': Can\\'t find next - current passage is invalid.'", ")", ";", "$", "oLastVerse", "=", "$", "this", "->", "getLastVerse", "(", ")", ";", "return", "$", "this", "->", "oBible", "->", "nextVerse", "(", "$", "oLastVerse", "->", "book_id", ",", "$", "oLastVerse", "->", "chapter", ",", "$", "oLastVerse", "->", "verse", ")", ";", "}" ]
Return the next Bible verse after the current passage. @return SudoBiblePassage
[ "Return", "the", "next", "Bible", "verse", "after", "the", "current", "passage", "." ]
562462e92e1b2c019bdd48ed83414502ca0bdb0c
https://github.com/Root-XS/SudoBible/blob/562462e92e1b2c019bdd48ed83414502ca0bdb0c/src/SudoBiblePassage.php#L214-L225
24,511
gruzilla/hydra
src/Hydra/Workers/MappedSerialWorker.php
MappedSerialWorker.run
public function run(JobInterface $job) { parent::run($job); if (!($job instanceof MappedJob)) { return $this; } $job->setResult( $this->mapper->map( $job->getEntityRepository(), $job->getMappedClass(), $job->getResult() ) ); // allow chaining return $this; }
php
public function run(JobInterface $job) { parent::run($job); if (!($job instanceof MappedJob)) { return $this; } $job->setResult( $this->mapper->map( $job->getEntityRepository(), $job->getMappedClass(), $job->getResult() ) ); // allow chaining return $this; }
[ "public", "function", "run", "(", "JobInterface", "$", "job", ")", "{", "parent", "::", "run", "(", "$", "job", ")", ";", "if", "(", "!", "(", "$", "job", "instanceof", "MappedJob", ")", ")", "{", "return", "$", "this", ";", "}", "$", "job", "->", "setResult", "(", "$", "this", "->", "mapper", "->", "map", "(", "$", "job", "->", "getEntityRepository", "(", ")", ",", "$", "job", "->", "getMappedClass", "(", ")", ",", "$", "job", "->", "getResult", "(", ")", ")", ")", ";", "// allow chaining", "return", "$", "this", ";", "}" ]
runs the parent job and then maps the result @param JobInterface $job the job to execute @return self
[ "runs", "the", "parent", "job", "and", "then", "maps", "the", "result" ]
47f381cc48e1a26bfe2e211d8dcb54c787ea0478
https://github.com/gruzilla/hydra/blob/47f381cc48e1a26bfe2e211d8dcb54c787ea0478/src/Hydra/Workers/MappedSerialWorker.php#L28-L47
24,512
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Scrybe/Converter/RestructuredText/ToHtml.php
ToHtml.discover
protected function discover() { /** @var File $file */ foreach ($this->fileset as $file) { $rst = new Document($this, $file); $rst->options->xhtmlVisitor = 'phpDocumentor\Plugin\Scrybe\Converter\RestructuredText\Visitors\Discover'; if ($this->getLogger()) { $this->getLogger()->info('Scanning file "' . $file->getRealPath() . '"'); } try { $rst->getAsXhtml(); } catch (\Exception $e) { continue; } } }
php
protected function discover() { /** @var File $file */ foreach ($this->fileset as $file) { $rst = new Document($this, $file); $rst->options->xhtmlVisitor = 'phpDocumentor\Plugin\Scrybe\Converter\RestructuredText\Visitors\Discover'; if ($this->getLogger()) { $this->getLogger()->info('Scanning file "' . $file->getRealPath() . '"'); } try { $rst->getAsXhtml(); } catch (\Exception $e) { continue; } } }
[ "protected", "function", "discover", "(", ")", "{", "/** @var File $file */", "foreach", "(", "$", "this", "->", "fileset", "as", "$", "file", ")", "{", "$", "rst", "=", "new", "Document", "(", "$", "this", ",", "$", "file", ")", ";", "$", "rst", "->", "options", "->", "xhtmlVisitor", "=", "'phpDocumentor\\Plugin\\Scrybe\\Converter\\RestructuredText\\Visitors\\Discover'", ";", "if", "(", "$", "this", "->", "getLogger", "(", ")", ")", "{", "$", "this", "->", "getLogger", "(", ")", "->", "info", "(", "'Scanning file \"'", ".", "$", "file", "->", "getRealPath", "(", ")", ".", "'\"'", ")", ";", "}", "try", "{", "$", "rst", "->", "getAsXhtml", "(", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "continue", ";", "}", "}", "}" ]
Discovers the data that is spanning all files. This method tries to find any data that needs to be collected before the actual creation and substitution phase begins. Examples of data that needs to be collected during an initial phase is a table of contents, list of document titles for references, assets and more. @see manual://internals#build_cycle for more information regarding the build process. @return void
[ "Discovers", "the", "data", "that", "is", "spanning", "all", "files", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Scrybe/Converter/RestructuredText/ToHtml.php#L42-L59
24,513
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Scrybe/Converter/RestructuredText/ToHtml.php
ToHtml.create
protected function create(TemplateInterface $template) { $result = array(); /** @var File $file */ foreach ($this->fileset as $file) { $rst = new Document($this, $file); $destination = $this->getDestinationFilenameRelativeToProjectRoot($file); $this->setDestinationRoot($destination); if ($this->getLogger()) { $this->getLogger()->info('Parsing file "' . $file->getRealPath() . '"'); } try { $xhtml_document = $rst->getAsXhtml(); $converted_contents = $template->decorate($xhtml_document->save(), $this->options); $rst->logStats(null, $this->getLogger()); } catch (\Exception $e) { $rst->logStats($e, $this->getLogger()); continue; } $result[$destination] = $converted_contents; } return $result; }
php
protected function create(TemplateInterface $template) { $result = array(); /** @var File $file */ foreach ($this->fileset as $file) { $rst = new Document($this, $file); $destination = $this->getDestinationFilenameRelativeToProjectRoot($file); $this->setDestinationRoot($destination); if ($this->getLogger()) { $this->getLogger()->info('Parsing file "' . $file->getRealPath() . '"'); } try { $xhtml_document = $rst->getAsXhtml(); $converted_contents = $template->decorate($xhtml_document->save(), $this->options); $rst->logStats(null, $this->getLogger()); } catch (\Exception $e) { $rst->logStats($e, $this->getLogger()); continue; } $result[$destination] = $converted_contents; } return $result; }
[ "protected", "function", "create", "(", "TemplateInterface", "$", "template", ")", "{", "$", "result", "=", "array", "(", ")", ";", "/** @var File $file */", "foreach", "(", "$", "this", "->", "fileset", "as", "$", "file", ")", "{", "$", "rst", "=", "new", "Document", "(", "$", "this", ",", "$", "file", ")", ";", "$", "destination", "=", "$", "this", "->", "getDestinationFilenameRelativeToProjectRoot", "(", "$", "file", ")", ";", "$", "this", "->", "setDestinationRoot", "(", "$", "destination", ")", ";", "if", "(", "$", "this", "->", "getLogger", "(", ")", ")", "{", "$", "this", "->", "getLogger", "(", ")", "->", "info", "(", "'Parsing file \"'", ".", "$", "file", "->", "getRealPath", "(", ")", ".", "'\"'", ")", ";", "}", "try", "{", "$", "xhtml_document", "=", "$", "rst", "->", "getAsXhtml", "(", ")", ";", "$", "converted_contents", "=", "$", "template", "->", "decorate", "(", "$", "xhtml_document", "->", "save", "(", ")", ",", "$", "this", "->", "options", ")", ";", "$", "rst", "->", "logStats", "(", "null", ",", "$", "this", "->", "getLogger", "(", ")", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "$", "rst", "->", "logStats", "(", "$", "e", ",", "$", "this", "->", "getLogger", "(", ")", ")", ";", "continue", ";", "}", "$", "result", "[", "$", "destination", "]", "=", "$", "converted_contents", ";", "}", "return", "$", "result", ";", "}" ]
Converts the input files into one or more output files in the intended format. This method reads the files, converts them into the correct format and returns the contents of the conversion. The template is provided using the $template parameter and is used to decorate the individual files. It can be obtained using the `\phpDocumentor\Plugin\Scrybe\Template\Factory` class. @param TemplateInterface $template @see manual://internals#build_cycle for more information regarding the build process. @return string[]|null The contents of the resulting file(s) or null if the files are written directly to file.
[ "Converts", "the", "input", "files", "into", "one", "or", "more", "output", "files", "in", "the", "intended", "format", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Scrybe/Converter/RestructuredText/ToHtml.php#L75-L102
24,514
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Scrybe/Converter/RestructuredText/ToHtml.php
ToHtml.setDestinationRoot
protected function setDestinationRoot($destination) { $this->options['root'] = dirname($destination) != '.' ? implode('/', array_fill(0, count(explode('/', dirname($destination))), '..')) . '/' : './'; }
php
protected function setDestinationRoot($destination) { $this->options['root'] = dirname($destination) != '.' ? implode('/', array_fill(0, count(explode('/', dirname($destination))), '..')) . '/' : './'; }
[ "protected", "function", "setDestinationRoot", "(", "$", "destination", ")", "{", "$", "this", "->", "options", "[", "'root'", "]", "=", "dirname", "(", "$", "destination", ")", "!=", "'.'", "?", "implode", "(", "'/'", ",", "array_fill", "(", "0", ",", "count", "(", "explode", "(", "'/'", ",", "dirname", "(", "$", "destination", ")", ")", ")", ",", "'..'", ")", ")", ".", "'/'", ":", "'./'", ";", "}" ]
Sets the relative path to the root of the generated contents. Basically this method takes the depth of the given destination and replaces it with `..` unless the destination directory name is `.`. @param string $destination The destination path relative to the target folder. @see $options for where the 'root' variable is set. @return void
[ "Sets", "the", "relative", "path", "to", "the", "root", "of", "the", "generated", "contents", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Scrybe/Converter/RestructuredText/ToHtml.php#L116-L121
24,515
interactivesolutions/honeycomb-core
src/models/traits/Encryptable.php
Encryptable.setAttribute
public function setAttribute(string $key, string $value) { if ($this->valid($key, $value)) { $value = encrypt($value); } return parent::setAttribute($key, $value); }
php
public function setAttribute(string $key, string $value) { if ($this->valid($key, $value)) { $value = encrypt($value); } return parent::setAttribute($key, $value); }
[ "public", "function", "setAttribute", "(", "string", "$", "key", ",", "string", "$", "value", ")", "{", "if", "(", "$", "this", "->", "valid", "(", "$", "key", ",", "$", "value", ")", ")", "{", "$", "value", "=", "encrypt", "(", "$", "value", ")", ";", "}", "return", "parent", "::", "setAttribute", "(", "$", "key", ",", "$", "value", ")", ";", "}" ]
Encrypt field value before inserting into database @param string $key @param string $value @return mixed
[ "Encrypt", "field", "value", "before", "inserting", "into", "database" ]
06b8d88bb285e73a1a286e60411ca5f41863f39f
https://github.com/interactivesolutions/honeycomb-core/blob/06b8d88bb285e73a1a286e60411ca5f41863f39f/src/models/traits/Encryptable.php#L21-L28
24,516
interactivesolutions/honeycomb-core
src/models/traits/Encryptable.php
Encryptable.getAttribute
public function getAttribute(string $key) { $value = parent::getAttribute($key); if ($this->valid($key, $value)) { return decrypt($value); } return $value; }
php
public function getAttribute(string $key) { $value = parent::getAttribute($key); if ($this->valid($key, $value)) { return decrypt($value); } return $value; }
[ "public", "function", "getAttribute", "(", "string", "$", "key", ")", "{", "$", "value", "=", "parent", "::", "getAttribute", "(", "$", "key", ")", ";", "if", "(", "$", "this", "->", "valid", "(", "$", "key", ",", "$", "value", ")", ")", "{", "return", "decrypt", "(", "$", "value", ")", ";", "}", "return", "$", "value", ";", "}" ]
Get decrypted field values after getting from database @param string $key @return mixed
[ "Get", "decrypted", "field", "values", "after", "getting", "from", "database" ]
06b8d88bb285e73a1a286e60411ca5f41863f39f
https://github.com/interactivesolutions/honeycomb-core/blob/06b8d88bb285e73a1a286e60411ca5f41863f39f/src/models/traits/Encryptable.php#L36-L45
24,517
interactivesolutions/honeycomb-core
src/models/traits/Encryptable.php
Encryptable.attributesToArray
public function attributesToArray() { $attributes = parent::attributesToArray(); foreach ($attributes as $key => $value) { if ($this->valid($key, $value)) { $attributes[$key] = decrypt($value); } } return $attributes; }
php
public function attributesToArray() { $attributes = parent::attributesToArray(); foreach ($attributes as $key => $value) { if ($this->valid($key, $value)) { $attributes[$key] = decrypt($value); } } return $attributes; }
[ "public", "function", "attributesToArray", "(", ")", "{", "$", "attributes", "=", "parent", "::", "attributesToArray", "(", ")", ";", "foreach", "(", "$", "attributes", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "$", "this", "->", "valid", "(", "$", "key", ",", "$", "value", ")", ")", "{", "$", "attributes", "[", "$", "key", "]", "=", "decrypt", "(", "$", "value", ")", ";", "}", "}", "return", "$", "attributes", ";", "}" ]
Decrypt given attributes @return mixed
[ "Decrypt", "given", "attributes" ]
06b8d88bb285e73a1a286e60411ca5f41863f39f
https://github.com/interactivesolutions/honeycomb-core/blob/06b8d88bb285e73a1a286e60411ca5f41863f39f/src/models/traits/Encryptable.php#L52-L63
24,518
interactivesolutions/honeycomb-core
src/models/traits/Encryptable.php
Encryptable.valid
protected function valid(string $key, string $value) { return in_array($key, $this->encryptable) && !is_null($value) && !empty($value); }
php
protected function valid(string $key, string $value) { return in_array($key, $this->encryptable) && !is_null($value) && !empty($value); }
[ "protected", "function", "valid", "(", "string", "$", "key", ",", "string", "$", "value", ")", "{", "return", "in_array", "(", "$", "key", ",", "$", "this", "->", "encryptable", ")", "&&", "!", "is_null", "(", "$", "value", ")", "&&", "!", "empty", "(", "$", "value", ")", ";", "}" ]
Check if key and value is valid and able to crypt or decrypt @param string $key @param string $value @return bool
[ "Check", "if", "key", "and", "value", "is", "valid", "and", "able", "to", "crypt", "or", "decrypt" ]
06b8d88bb285e73a1a286e60411ca5f41863f39f
https://github.com/interactivesolutions/honeycomb-core/blob/06b8d88bb285e73a1a286e60411ca5f41863f39f/src/models/traits/Encryptable.php#L72-L75
24,519
hametuha/wpametu
src/WPametu/Utility/CronBase.php
CronBase.register_cron
public function register_cron() { if ( ! wp_next_scheduled( $this->event ) ) { wp_schedule_event( $this->start_at(), $this->schedule, $this->event, $this->args() ); } add_action( $this->event, [ $this, 'process' ] ); }
php
public function register_cron() { if ( ! wp_next_scheduled( $this->event ) ) { wp_schedule_event( $this->start_at(), $this->schedule, $this->event, $this->args() ); } add_action( $this->event, [ $this, 'process' ] ); }
[ "public", "function", "register_cron", "(", ")", "{", "if", "(", "!", "wp_next_scheduled", "(", "$", "this", "->", "event", ")", ")", "{", "wp_schedule_event", "(", "$", "this", "->", "start_at", "(", ")", ",", "$", "this", "->", "schedule", ",", "$", "this", "->", "event", ",", "$", "this", "->", "args", "(", ")", ")", ";", "}", "add_action", "(", "$", "this", "->", "event", ",", "[", "$", "this", ",", "'process'", "]", ")", ";", "}" ]
Register cron event
[ "Register", "cron", "event" ]
0939373800815a8396291143d2a57967340da5aa
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/Utility/CronBase.php#L63-L68
24,520
stk2k/net-driver
src/Util/CharsetUtil.php
CharsetUtil.getPhpEncoding
private static function getPhpEncoding( $html_charset ) { $php_encoding = null; switch( strtolower($html_charset) ){ case 'sjis': case 'sjis-win': case 'shift_jis': case 'shift-jis': case 'ms_kanji': case 'csshiftjis': case 'x-sjis': $php_encoding = 'sjis-win'; break; case 'euc-jp': case 'cseucpkdfmtjapanese': $php_encoding = 'EUC-JP'; break; case 'jis': $php_encoding = 'jis'; break; case 'iso-2022-jp': case 'csiso2022jp': $php_encoding = 'ISO-2022-JP'; break; case 'iso-2022-jp-2': case 'csiso2022jp2': $php_encoding = 'ISO-2022-JP-2'; break; case 'utf-8': case 'csutf8': $php_encoding = 'UTF-8'; break; case 'utf-16': case 'csutf16': $php_encoding = 'UTF-16'; break; default: if ( strpos($html_charset,'sjis') ){ $php_encoding = 'SJIS'; } break; } return $php_encoding; }
php
private static function getPhpEncoding( $html_charset ) { $php_encoding = null; switch( strtolower($html_charset) ){ case 'sjis': case 'sjis-win': case 'shift_jis': case 'shift-jis': case 'ms_kanji': case 'csshiftjis': case 'x-sjis': $php_encoding = 'sjis-win'; break; case 'euc-jp': case 'cseucpkdfmtjapanese': $php_encoding = 'EUC-JP'; break; case 'jis': $php_encoding = 'jis'; break; case 'iso-2022-jp': case 'csiso2022jp': $php_encoding = 'ISO-2022-JP'; break; case 'iso-2022-jp-2': case 'csiso2022jp2': $php_encoding = 'ISO-2022-JP-2'; break; case 'utf-8': case 'csutf8': $php_encoding = 'UTF-8'; break; case 'utf-16': case 'csutf16': $php_encoding = 'UTF-16'; break; default: if ( strpos($html_charset,'sjis') ){ $php_encoding = 'SJIS'; } break; } return $php_encoding; }
[ "private", "static", "function", "getPhpEncoding", "(", "$", "html_charset", ")", "{", "$", "php_encoding", "=", "null", ";", "switch", "(", "strtolower", "(", "$", "html_charset", ")", ")", "{", "case", "'sjis'", ":", "case", "'sjis-win'", ":", "case", "'shift_jis'", ":", "case", "'shift-jis'", ":", "case", "'ms_kanji'", ":", "case", "'csshiftjis'", ":", "case", "'x-sjis'", ":", "$", "php_encoding", "=", "'sjis-win'", ";", "break", ";", "case", "'euc-jp'", ":", "case", "'cseucpkdfmtjapanese'", ":", "$", "php_encoding", "=", "'EUC-JP'", ";", "break", ";", "case", "'jis'", ":", "$", "php_encoding", "=", "'jis'", ";", "break", ";", "case", "'iso-2022-jp'", ":", "case", "'csiso2022jp'", ":", "$", "php_encoding", "=", "'ISO-2022-JP'", ";", "break", ";", "case", "'iso-2022-jp-2'", ":", "case", "'csiso2022jp2'", ":", "$", "php_encoding", "=", "'ISO-2022-JP-2'", ";", "break", ";", "case", "'utf-8'", ":", "case", "'csutf8'", ":", "$", "php_encoding", "=", "'UTF-8'", ";", "break", ";", "case", "'utf-16'", ":", "case", "'csutf16'", ":", "$", "php_encoding", "=", "'UTF-16'", ";", "break", ";", "default", ":", "if", "(", "strpos", "(", "$", "html_charset", ",", "'sjis'", ")", ")", "{", "$", "php_encoding", "=", "'SJIS'", ";", "}", "break", ";", "}", "return", "$", "php_encoding", ";", "}" ]
Get PHP character encoding @param $html_charset @return string
[ "Get", "PHP", "character", "encoding" ]
75e0bc1a95ba430dd9ed9e69f6a0a5dd8f2e7b1c
https://github.com/stk2k/net-driver/blob/75e0bc1a95ba430dd9ed9e69f6a0a5dd8f2e7b1c/src/Util/CharsetUtil.php#L87-L132
24,521
jasny/controller
src/Controller/CheckRequest.php
CheckRequest.getLocalReferer
public function getLocalReferer() { $request = $this->getRequest(); $referer = $request->getHeaderLine('HTTP_REFERER'); $host = $request->getHeaderLine('HTTP_HOST'); return $referer && parse_url($referer, PHP_URL_HOST) === $host ? $referer : ''; }
php
public function getLocalReferer() { $request = $this->getRequest(); $referer = $request->getHeaderLine('HTTP_REFERER'); $host = $request->getHeaderLine('HTTP_HOST'); return $referer && parse_url($referer, PHP_URL_HOST) === $host ? $referer : ''; }
[ "public", "function", "getLocalReferer", "(", ")", "{", "$", "request", "=", "$", "this", "->", "getRequest", "(", ")", ";", "$", "referer", "=", "$", "request", "->", "getHeaderLine", "(", "'HTTP_REFERER'", ")", ";", "$", "host", "=", "$", "request", "->", "getHeaderLine", "(", "'HTTP_HOST'", ")", ";", "return", "$", "referer", "&&", "parse_url", "(", "$", "referer", ",", "PHP_URL_HOST", ")", "===", "$", "host", "?", "$", "referer", ":", "''", ";", "}" ]
Returns the HTTP referer if it is on the current host @return string
[ "Returns", "the", "HTTP", "referer", "if", "it", "is", "on", "the", "current", "host" ]
28edf64343f1d8218c166c0c570128e1ee6153d8
https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/CheckRequest.php#L78-L85
24,522
yawik/composer-plugin
src/Plugin.php
Plugin.getApplication
public function getApplication() { if (!is_object($this->application)) { $this->application = Application::init(); } return $this->application; }
php
public function getApplication() { if (!is_object($this->application)) { $this->application = Application::init(); } return $this->application; }
[ "public", "function", "getApplication", "(", ")", "{", "if", "(", "!", "is_object", "(", "$", "this", "->", "application", ")", ")", "{", "$", "this", "->", "application", "=", "Application", "::", "init", "(", ")", ";", "}", "return", "$", "this", "->", "application", ";", "}" ]
Get Yawik Application to use @return Application|\Zend\Mvc\Application
[ "Get", "Yawik", "Application", "to", "use" ]
d3a45d2ab342fc0eb21e1126e8637fb7752464e4
https://github.com/yawik/composer-plugin/blob/d3a45d2ab342fc0eb21e1126e8637fb7752464e4/src/Plugin.php#L127-L133
24,523
heidelpay/PhpDoc
src/phpDocumentor/Descriptor/ProjectAnalyzer.php
ProjectAnalyzer.analyze
public function analyze(ProjectDescriptor $projectDescriptor) { $this->unresolvedParentClassesCount = 0; $elementCounter = array(); foreach ($this->findAllElements($projectDescriptor) as $element) { $elementCounter = $this->addElementToCounter($elementCounter, $element); $this->incrementUnresolvedParentCounter($element); } $this->descriptorCountByType = $elementCounter; $this->fileCount = count($projectDescriptor->getFiles()); $this->topLevelNamespaceCount = count($projectDescriptor->getNamespace()->getChildren()); }
php
public function analyze(ProjectDescriptor $projectDescriptor) { $this->unresolvedParentClassesCount = 0; $elementCounter = array(); foreach ($this->findAllElements($projectDescriptor) as $element) { $elementCounter = $this->addElementToCounter($elementCounter, $element); $this->incrementUnresolvedParentCounter($element); } $this->descriptorCountByType = $elementCounter; $this->fileCount = count($projectDescriptor->getFiles()); $this->topLevelNamespaceCount = count($projectDescriptor->getNamespace()->getChildren()); }
[ "public", "function", "analyze", "(", "ProjectDescriptor", "$", "projectDescriptor", ")", "{", "$", "this", "->", "unresolvedParentClassesCount", "=", "0", ";", "$", "elementCounter", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "findAllElements", "(", "$", "projectDescriptor", ")", "as", "$", "element", ")", "{", "$", "elementCounter", "=", "$", "this", "->", "addElementToCounter", "(", "$", "elementCounter", ",", "$", "element", ")", ";", "$", "this", "->", "incrementUnresolvedParentCounter", "(", "$", "element", ")", ";", "}", "$", "this", "->", "descriptorCountByType", "=", "$", "elementCounter", ";", "$", "this", "->", "fileCount", "=", "count", "(", "$", "projectDescriptor", "->", "getFiles", "(", ")", ")", ";", "$", "this", "->", "topLevelNamespaceCount", "=", "count", "(", "$", "projectDescriptor", "->", "getNamespace", "(", ")", "->", "getChildren", "(", ")", ")", ";", "}" ]
Analyzes the given project descriptor and populates this object's properties. @param ProjectDescriptor $projectDescriptor @return void
[ "Analyzes", "the", "given", "project", "descriptor", "and", "populates", "this", "object", "s", "properties", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Descriptor/ProjectAnalyzer.php#L45-L58
24,524
heidelpay/PhpDoc
src/phpDocumentor/Descriptor/ProjectAnalyzer.php
ProjectAnalyzer.addElementToCounter
protected function addElementToCounter($classCounters, $element) { if (!isset($classCounters[get_class($element)])) { $classCounters[get_class($element)] = 0; } $classCounters[get_class($element)]++; return $classCounters; }
php
protected function addElementToCounter($classCounters, $element) { if (!isset($classCounters[get_class($element)])) { $classCounters[get_class($element)] = 0; } $classCounters[get_class($element)]++; return $classCounters; }
[ "protected", "function", "addElementToCounter", "(", "$", "classCounters", ",", "$", "element", ")", "{", "if", "(", "!", "isset", "(", "$", "classCounters", "[", "get_class", "(", "$", "element", ")", "]", ")", ")", "{", "$", "classCounters", "[", "get_class", "(", "$", "element", ")", "]", "=", "0", ";", "}", "$", "classCounters", "[", "get_class", "(", "$", "element", ")", "]", "++", ";", "return", "$", "classCounters", ";", "}" ]
Increments the counter for element's class in the class counters. @param array $classCounters @param DescriptorAbstract $element @return array
[ "Increments", "the", "counter", "for", "element", "s", "class", "in", "the", "class", "counters", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Descriptor/ProjectAnalyzer.php#L94-L102
24,525
sergmoro1/yii2-lookup
src/models/Lookup.php
Lookup.item
public static function item($property, $code, $byId = false) { $property_id = self::getPropertyId($property, $byId); if(!isset(self::$_items[$property_id])) self::loadItems($property_id); return isset(self::$_items[$property_id][$code]) ? self::$_items[$property_id][$code] : false; }
php
public static function item($property, $code, $byId = false) { $property_id = self::getPropertyId($property, $byId); if(!isset(self::$_items[$property_id])) self::loadItems($property_id); return isset(self::$_items[$property_id][$code]) ? self::$_items[$property_id][$code] : false; }
[ "public", "static", "function", "item", "(", "$", "property", ",", "$", "code", ",", "$", "byId", "=", "false", ")", "{", "$", "property_id", "=", "self", "::", "getPropertyId", "(", "$", "property", ",", "$", "byId", ")", ";", "if", "(", "!", "isset", "(", "self", "::", "$", "_items", "[", "$", "property_id", "]", ")", ")", "self", "::", "loadItems", "(", "$", "property_id", ")", ";", "return", "isset", "(", "self", "::", "$", "_items", "[", "$", "property_id", "]", "[", "$", "code", "]", ")", "?", "self", "::", "$", "_items", "[", "$", "property_id", "]", "[", "$", "code", "]", ":", "false", ";", "}" ]
Returns the item name for the specified property and code. @param string | integer property name or ID @param integer the item code (corresponding to the 'code' column value) @param boolean slug or integer ID @return string the item name for the specified the code. False is returned if the item type or code does not exist.
[ "Returns", "the", "item", "name", "for", "the", "specified", "property", "and", "code", "." ]
deff08a2612b3c54d313a6c60a74fcaae1193b21
https://github.com/sergmoro1/yii2-lookup/blob/deff08a2612b3c54d313a6c60a74fcaae1193b21/src/models/Lookup.php#L58-L64
24,526
sergmoro1/yii2-lookup
src/models/Lookup.php
Lookup.loadItems
private static function loadItems($property_id) { self::$_items[$property_id] = []; $models = static::find() ->where('property_id=:property_id', [':property_id' => $property_id]) ->orderBy('position') ->all(); foreach($models as $model) self::$_items[$property_id][$model->code] = $model->name; }
php
private static function loadItems($property_id) { self::$_items[$property_id] = []; $models = static::find() ->where('property_id=:property_id', [':property_id' => $property_id]) ->orderBy('position') ->all(); foreach($models as $model) self::$_items[$property_id][$model->code] = $model->name; }
[ "private", "static", "function", "loadItems", "(", "$", "property_id", ")", "{", "self", "::", "$", "_items", "[", "$", "property_id", "]", "=", "[", "]", ";", "$", "models", "=", "static", "::", "find", "(", ")", "->", "where", "(", "'property_id=:property_id'", ",", "[", "':property_id'", "=>", "$", "property_id", "]", ")", "->", "orderBy", "(", "'position'", ")", "->", "all", "(", ")", ";", "foreach", "(", "$", "models", "as", "$", "model", ")", "self", "::", "$", "_items", "[", "$", "property_id", "]", "[", "$", "model", "->", "code", "]", "=", "$", "model", "->", "name", ";", "}" ]
Loads the lookup items for the specified property ID. @param string the item type
[ "Loads", "the", "lookup", "items", "for", "the", "specified", "property", "ID", "." ]
deff08a2612b3c54d313a6c60a74fcaae1193b21
https://github.com/sergmoro1/yii2-lookup/blob/deff08a2612b3c54d313a6c60a74fcaae1193b21/src/models/Lookup.php#L74-L83
24,527
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.initCustomerCustomerGroups
public function initCustomerCustomerGroups($overrideExisting = true) { if (null !== $this->collCustomerCustomerGroups && !$overrideExisting) { return; } $this->collCustomerCustomerGroups = new ObjectCollection(); $this->collCustomerCustomerGroups->setModel('\CustomerGroup\Model\CustomerCustomerGroup'); }
php
public function initCustomerCustomerGroups($overrideExisting = true) { if (null !== $this->collCustomerCustomerGroups && !$overrideExisting) { return; } $this->collCustomerCustomerGroups = new ObjectCollection(); $this->collCustomerCustomerGroups->setModel('\CustomerGroup\Model\CustomerCustomerGroup'); }
[ "public", "function", "initCustomerCustomerGroups", "(", "$", "overrideExisting", "=", "true", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "collCustomerCustomerGroups", "&&", "!", "$", "overrideExisting", ")", "{", "return", ";", "}", "$", "this", "->", "collCustomerCustomerGroups", "=", "new", "ObjectCollection", "(", ")", ";", "$", "this", "->", "collCustomerCustomerGroups", "->", "setModel", "(", "'\\CustomerGroup\\Model\\CustomerCustomerGroup'", ")", ";", "}" ]
Initializes the collCustomerCustomerGroups collection. By default this just sets the collCustomerCustomerGroups collection to an empty array (like clearcollCustomerCustomerGroups()); however, you may wish to override this method in your stub class to provide setting appropriate to your application -- for example, setting the initial array to the values stored in database. @param boolean $overrideExisting If set to true, the method call initializes the collection even if it is not empty @return void
[ "Initializes", "the", "collCustomerCustomerGroups", "collection", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L1468-L1475
24,528
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.getCustomerCustomerGroups
public function getCustomerCustomerGroups($criteria = null, ConnectionInterface $con = null) { $partial = $this->collCustomerCustomerGroupsPartial && !$this->isNew(); if (null === $this->collCustomerCustomerGroups || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collCustomerCustomerGroups) { // return empty collection $this->initCustomerCustomerGroups(); } else { $collCustomerCustomerGroups = ChildCustomerCustomerGroupQuery::create(null, $criteria) ->filterByCustomerGroup($this) ->find($con); if (null !== $criteria) { if (false !== $this->collCustomerCustomerGroupsPartial && count($collCustomerCustomerGroups)) { $this->initCustomerCustomerGroups(false); foreach ($collCustomerCustomerGroups as $obj) { if (false == $this->collCustomerCustomerGroups->contains($obj)) { $this->collCustomerCustomerGroups->append($obj); } } $this->collCustomerCustomerGroupsPartial = true; } reset($collCustomerCustomerGroups); return $collCustomerCustomerGroups; } if ($partial && $this->collCustomerCustomerGroups) { foreach ($this->collCustomerCustomerGroups as $obj) { if ($obj->isNew()) { $collCustomerCustomerGroups[] = $obj; } } } $this->collCustomerCustomerGroups = $collCustomerCustomerGroups; $this->collCustomerCustomerGroupsPartial = false; } } return $this->collCustomerCustomerGroups; }
php
public function getCustomerCustomerGroups($criteria = null, ConnectionInterface $con = null) { $partial = $this->collCustomerCustomerGroupsPartial && !$this->isNew(); if (null === $this->collCustomerCustomerGroups || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collCustomerCustomerGroups) { // return empty collection $this->initCustomerCustomerGroups(); } else { $collCustomerCustomerGroups = ChildCustomerCustomerGroupQuery::create(null, $criteria) ->filterByCustomerGroup($this) ->find($con); if (null !== $criteria) { if (false !== $this->collCustomerCustomerGroupsPartial && count($collCustomerCustomerGroups)) { $this->initCustomerCustomerGroups(false); foreach ($collCustomerCustomerGroups as $obj) { if (false == $this->collCustomerCustomerGroups->contains($obj)) { $this->collCustomerCustomerGroups->append($obj); } } $this->collCustomerCustomerGroupsPartial = true; } reset($collCustomerCustomerGroups); return $collCustomerCustomerGroups; } if ($partial && $this->collCustomerCustomerGroups) { foreach ($this->collCustomerCustomerGroups as $obj) { if ($obj->isNew()) { $collCustomerCustomerGroups[] = $obj; } } } $this->collCustomerCustomerGroups = $collCustomerCustomerGroups; $this->collCustomerCustomerGroupsPartial = false; } } return $this->collCustomerCustomerGroups; }
[ "public", "function", "getCustomerCustomerGroups", "(", "$", "criteria", "=", "null", ",", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "$", "partial", "=", "$", "this", "->", "collCustomerCustomerGroupsPartial", "&&", "!", "$", "this", "->", "isNew", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "collCustomerCustomerGroups", "||", "null", "!==", "$", "criteria", "||", "$", "partial", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", "&&", "null", "===", "$", "this", "->", "collCustomerCustomerGroups", ")", "{", "// return empty collection", "$", "this", "->", "initCustomerCustomerGroups", "(", ")", ";", "}", "else", "{", "$", "collCustomerCustomerGroups", "=", "ChildCustomerCustomerGroupQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", "->", "filterByCustomerGroup", "(", "$", "this", ")", "->", "find", "(", "$", "con", ")", ";", "if", "(", "null", "!==", "$", "criteria", ")", "{", "if", "(", "false", "!==", "$", "this", "->", "collCustomerCustomerGroupsPartial", "&&", "count", "(", "$", "collCustomerCustomerGroups", ")", ")", "{", "$", "this", "->", "initCustomerCustomerGroups", "(", "false", ")", ";", "foreach", "(", "$", "collCustomerCustomerGroups", "as", "$", "obj", ")", "{", "if", "(", "false", "==", "$", "this", "->", "collCustomerCustomerGroups", "->", "contains", "(", "$", "obj", ")", ")", "{", "$", "this", "->", "collCustomerCustomerGroups", "->", "append", "(", "$", "obj", ")", ";", "}", "}", "$", "this", "->", "collCustomerCustomerGroupsPartial", "=", "true", ";", "}", "reset", "(", "$", "collCustomerCustomerGroups", ")", ";", "return", "$", "collCustomerCustomerGroups", ";", "}", "if", "(", "$", "partial", "&&", "$", "this", "->", "collCustomerCustomerGroups", ")", "{", "foreach", "(", "$", "this", "->", "collCustomerCustomerGroups", "as", "$", "obj", ")", "{", "if", "(", "$", "obj", "->", "isNew", "(", ")", ")", "{", "$", "collCustomerCustomerGroups", "[", "]", "=", "$", "obj", ";", "}", "}", "}", "$", "this", "->", "collCustomerCustomerGroups", "=", "$", "collCustomerCustomerGroups", ";", "$", "this", "->", "collCustomerCustomerGroupsPartial", "=", "false", ";", "}", "}", "return", "$", "this", "->", "collCustomerCustomerGroups", ";", "}" ]
Gets an array of ChildCustomerCustomerGroup objects which contain a foreign key that references this object. If the $criteria is not null, it is used to always fetch the results from the database. Otherwise the results are fetched from the database the first time, then cached. Next time the same method is called without $criteria, the cached collection is returned. If this ChildCustomerGroup is new, it will return an empty collection or the current collection; the criteria is ignored on a new object. @param Criteria $criteria optional Criteria object to narrow the query @param ConnectionInterface $con optional connection object @return Collection|ChildCustomerCustomerGroup[] List of ChildCustomerCustomerGroup objects @throws PropelException
[ "Gets", "an", "array", "of", "ChildCustomerCustomerGroup", "objects", "which", "contain", "a", "foreign", "key", "that", "references", "this", "object", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L1491-L1535
24,529
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.countCustomerCustomerGroups
public function countCustomerCustomerGroups(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { $partial = $this->collCustomerCustomerGroupsPartial && !$this->isNew(); if (null === $this->collCustomerCustomerGroups || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collCustomerCustomerGroups) { return 0; } if ($partial && !$criteria) { return count($this->getCustomerCustomerGroups()); } $query = ChildCustomerCustomerGroupQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByCustomerGroup($this) ->count($con); } return count($this->collCustomerCustomerGroups); }
php
public function countCustomerCustomerGroups(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { $partial = $this->collCustomerCustomerGroupsPartial && !$this->isNew(); if (null === $this->collCustomerCustomerGroups || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collCustomerCustomerGroups) { return 0; } if ($partial && !$criteria) { return count($this->getCustomerCustomerGroups()); } $query = ChildCustomerCustomerGroupQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByCustomerGroup($this) ->count($con); } return count($this->collCustomerCustomerGroups); }
[ "public", "function", "countCustomerCustomerGroups", "(", "Criteria", "$", "criteria", "=", "null", ",", "$", "distinct", "=", "false", ",", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "$", "partial", "=", "$", "this", "->", "collCustomerCustomerGroupsPartial", "&&", "!", "$", "this", "->", "isNew", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "collCustomerCustomerGroups", "||", "null", "!==", "$", "criteria", "||", "$", "partial", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", "&&", "null", "===", "$", "this", "->", "collCustomerCustomerGroups", ")", "{", "return", "0", ";", "}", "if", "(", "$", "partial", "&&", "!", "$", "criteria", ")", "{", "return", "count", "(", "$", "this", "->", "getCustomerCustomerGroups", "(", ")", ")", ";", "}", "$", "query", "=", "ChildCustomerCustomerGroupQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", ";", "if", "(", "$", "distinct", ")", "{", "$", "query", "->", "distinct", "(", ")", ";", "}", "return", "$", "query", "->", "filterByCustomerGroup", "(", "$", "this", ")", "->", "count", "(", "$", "con", ")", ";", "}", "return", "count", "(", "$", "this", "->", "collCustomerCustomerGroups", ")", ";", "}" ]
Returns the number of related CustomerCustomerGroup objects. @param Criteria $criteria @param boolean $distinct @param ConnectionInterface $con @return int Count of related CustomerCustomerGroup objects. @throws PropelException
[ "Returns", "the", "number", "of", "related", "CustomerCustomerGroup", "objects", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L1581-L1604
24,530
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.addCustomerCustomerGroup
public function addCustomerCustomerGroup(ChildCustomerCustomerGroup $l) { if ($this->collCustomerCustomerGroups === null) { $this->initCustomerCustomerGroups(); $this->collCustomerCustomerGroupsPartial = true; } if (!in_array($l, $this->collCustomerCustomerGroups->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddCustomerCustomerGroup($l); } return $this; }
php
public function addCustomerCustomerGroup(ChildCustomerCustomerGroup $l) { if ($this->collCustomerCustomerGroups === null) { $this->initCustomerCustomerGroups(); $this->collCustomerCustomerGroupsPartial = true; } if (!in_array($l, $this->collCustomerCustomerGroups->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddCustomerCustomerGroup($l); } return $this; }
[ "public", "function", "addCustomerCustomerGroup", "(", "ChildCustomerCustomerGroup", "$", "l", ")", "{", "if", "(", "$", "this", "->", "collCustomerCustomerGroups", "===", "null", ")", "{", "$", "this", "->", "initCustomerCustomerGroups", "(", ")", ";", "$", "this", "->", "collCustomerCustomerGroupsPartial", "=", "true", ";", "}", "if", "(", "!", "in_array", "(", "$", "l", ",", "$", "this", "->", "collCustomerCustomerGroups", "->", "getArrayCopy", "(", ")", ",", "true", ")", ")", "{", "// only add it if the **same** object is not already associated", "$", "this", "->", "doAddCustomerCustomerGroup", "(", "$", "l", ")", ";", "}", "return", "$", "this", ";", "}" ]
Method called to associate a ChildCustomerCustomerGroup object to this object through the ChildCustomerCustomerGroup foreign key attribute. @param ChildCustomerCustomerGroup $l ChildCustomerCustomerGroup @return \CustomerGroup\Model\CustomerGroup The current object (for fluent API support)
[ "Method", "called", "to", "associate", "a", "ChildCustomerCustomerGroup", "object", "to", "this", "object", "through", "the", "ChildCustomerCustomerGroup", "foreign", "key", "attribute", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L1613-L1625
24,531
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.getCustomerCustomerGroupsJoinCustomer
public function getCustomerCustomerGroupsJoinCustomer($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildCustomerCustomerGroupQuery::create(null, $criteria); $query->joinWith('Customer', $joinBehavior); return $this->getCustomerCustomerGroups($query, $con); }
php
public function getCustomerCustomerGroupsJoinCustomer($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildCustomerCustomerGroupQuery::create(null, $criteria); $query->joinWith('Customer', $joinBehavior); return $this->getCustomerCustomerGroups($query, $con); }
[ "public", "function", "getCustomerCustomerGroupsJoinCustomer", "(", "$", "criteria", "=", "null", ",", "$", "con", "=", "null", ",", "$", "joinBehavior", "=", "Criteria", "::", "LEFT_JOIN", ")", "{", "$", "query", "=", "ChildCustomerCustomerGroupQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", ";", "$", "query", "->", "joinWith", "(", "'Customer'", ",", "$", "joinBehavior", ")", ";", "return", "$", "this", "->", "getCustomerCustomerGroups", "(", "$", "query", ",", "$", "con", ")", ";", "}" ]
If this collection has already been initialized with an identical criteria, it returns the collection. Otherwise if this CustomerGroup is new, it will return an empty collection; or if this CustomerGroup has previously been saved, it will retrieve related CustomerCustomerGroups from storage. This method is protected by default in order to keep the public api reasonable. You can provide public methods for those you actually need in CustomerGroup. @param Criteria $criteria optional Criteria object to narrow the query @param ConnectionInterface $con optional connection object @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) @return Collection|ChildCustomerCustomerGroup[] List of ChildCustomerCustomerGroup objects
[ "If", "this", "collection", "has", "already", "been", "initialized", "with", "an", "identical", "criteria", "it", "returns", "the", "collection", ".", "Otherwise", "if", "this", "CustomerGroup", "is", "new", "it", "will", "return", "an", "empty", "collection", ";", "or", "if", "this", "CustomerGroup", "has", "previously", "been", "saved", "it", "will", "retrieve", "related", "CustomerCustomerGroups", "from", "storage", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L1672-L1678
24,532
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.initCustomerGroupI18ns
public function initCustomerGroupI18ns($overrideExisting = true) { if (null !== $this->collCustomerGroupI18ns && !$overrideExisting) { return; } $this->collCustomerGroupI18ns = new ObjectCollection(); $this->collCustomerGroupI18ns->setModel('\CustomerGroup\Model\CustomerGroupI18n'); }
php
public function initCustomerGroupI18ns($overrideExisting = true) { if (null !== $this->collCustomerGroupI18ns && !$overrideExisting) { return; } $this->collCustomerGroupI18ns = new ObjectCollection(); $this->collCustomerGroupI18ns->setModel('\CustomerGroup\Model\CustomerGroupI18n'); }
[ "public", "function", "initCustomerGroupI18ns", "(", "$", "overrideExisting", "=", "true", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "collCustomerGroupI18ns", "&&", "!", "$", "overrideExisting", ")", "{", "return", ";", "}", "$", "this", "->", "collCustomerGroupI18ns", "=", "new", "ObjectCollection", "(", ")", ";", "$", "this", "->", "collCustomerGroupI18ns", "->", "setModel", "(", "'\\CustomerGroup\\Model\\CustomerGroupI18n'", ")", ";", "}" ]
Initializes the collCustomerGroupI18ns collection. By default this just sets the collCustomerGroupI18ns collection to an empty array (like clearcollCustomerGroupI18ns()); however, you may wish to override this method in your stub class to provide setting appropriate to your application -- for example, setting the initial array to the values stored in database. @param boolean $overrideExisting If set to true, the method call initializes the collection even if it is not empty @return void
[ "Initializes", "the", "collCustomerGroupI18ns", "collection", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L1714-L1721
24,533
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.getCustomerGroupI18ns
public function getCustomerGroupI18ns($criteria = null, ConnectionInterface $con = null) { $partial = $this->collCustomerGroupI18nsPartial && !$this->isNew(); if (null === $this->collCustomerGroupI18ns || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collCustomerGroupI18ns) { // return empty collection $this->initCustomerGroupI18ns(); } else { $collCustomerGroupI18ns = ChildCustomerGroupI18nQuery::create(null, $criteria) ->filterByCustomerGroup($this) ->find($con); if (null !== $criteria) { if (false !== $this->collCustomerGroupI18nsPartial && count($collCustomerGroupI18ns)) { $this->initCustomerGroupI18ns(false); foreach ($collCustomerGroupI18ns as $obj) { if (false == $this->collCustomerGroupI18ns->contains($obj)) { $this->collCustomerGroupI18ns->append($obj); } } $this->collCustomerGroupI18nsPartial = true; } reset($collCustomerGroupI18ns); return $collCustomerGroupI18ns; } if ($partial && $this->collCustomerGroupI18ns) { foreach ($this->collCustomerGroupI18ns as $obj) { if ($obj->isNew()) { $collCustomerGroupI18ns[] = $obj; } } } $this->collCustomerGroupI18ns = $collCustomerGroupI18ns; $this->collCustomerGroupI18nsPartial = false; } } return $this->collCustomerGroupI18ns; }
php
public function getCustomerGroupI18ns($criteria = null, ConnectionInterface $con = null) { $partial = $this->collCustomerGroupI18nsPartial && !$this->isNew(); if (null === $this->collCustomerGroupI18ns || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collCustomerGroupI18ns) { // return empty collection $this->initCustomerGroupI18ns(); } else { $collCustomerGroupI18ns = ChildCustomerGroupI18nQuery::create(null, $criteria) ->filterByCustomerGroup($this) ->find($con); if (null !== $criteria) { if (false !== $this->collCustomerGroupI18nsPartial && count($collCustomerGroupI18ns)) { $this->initCustomerGroupI18ns(false); foreach ($collCustomerGroupI18ns as $obj) { if (false == $this->collCustomerGroupI18ns->contains($obj)) { $this->collCustomerGroupI18ns->append($obj); } } $this->collCustomerGroupI18nsPartial = true; } reset($collCustomerGroupI18ns); return $collCustomerGroupI18ns; } if ($partial && $this->collCustomerGroupI18ns) { foreach ($this->collCustomerGroupI18ns as $obj) { if ($obj->isNew()) { $collCustomerGroupI18ns[] = $obj; } } } $this->collCustomerGroupI18ns = $collCustomerGroupI18ns; $this->collCustomerGroupI18nsPartial = false; } } return $this->collCustomerGroupI18ns; }
[ "public", "function", "getCustomerGroupI18ns", "(", "$", "criteria", "=", "null", ",", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "$", "partial", "=", "$", "this", "->", "collCustomerGroupI18nsPartial", "&&", "!", "$", "this", "->", "isNew", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "collCustomerGroupI18ns", "||", "null", "!==", "$", "criteria", "||", "$", "partial", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", "&&", "null", "===", "$", "this", "->", "collCustomerGroupI18ns", ")", "{", "// return empty collection", "$", "this", "->", "initCustomerGroupI18ns", "(", ")", ";", "}", "else", "{", "$", "collCustomerGroupI18ns", "=", "ChildCustomerGroupI18nQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", "->", "filterByCustomerGroup", "(", "$", "this", ")", "->", "find", "(", "$", "con", ")", ";", "if", "(", "null", "!==", "$", "criteria", ")", "{", "if", "(", "false", "!==", "$", "this", "->", "collCustomerGroupI18nsPartial", "&&", "count", "(", "$", "collCustomerGroupI18ns", ")", ")", "{", "$", "this", "->", "initCustomerGroupI18ns", "(", "false", ")", ";", "foreach", "(", "$", "collCustomerGroupI18ns", "as", "$", "obj", ")", "{", "if", "(", "false", "==", "$", "this", "->", "collCustomerGroupI18ns", "->", "contains", "(", "$", "obj", ")", ")", "{", "$", "this", "->", "collCustomerGroupI18ns", "->", "append", "(", "$", "obj", ")", ";", "}", "}", "$", "this", "->", "collCustomerGroupI18nsPartial", "=", "true", ";", "}", "reset", "(", "$", "collCustomerGroupI18ns", ")", ";", "return", "$", "collCustomerGroupI18ns", ";", "}", "if", "(", "$", "partial", "&&", "$", "this", "->", "collCustomerGroupI18ns", ")", "{", "foreach", "(", "$", "this", "->", "collCustomerGroupI18ns", "as", "$", "obj", ")", "{", "if", "(", "$", "obj", "->", "isNew", "(", ")", ")", "{", "$", "collCustomerGroupI18ns", "[", "]", "=", "$", "obj", ";", "}", "}", "}", "$", "this", "->", "collCustomerGroupI18ns", "=", "$", "collCustomerGroupI18ns", ";", "$", "this", "->", "collCustomerGroupI18nsPartial", "=", "false", ";", "}", "}", "return", "$", "this", "->", "collCustomerGroupI18ns", ";", "}" ]
Gets an array of ChildCustomerGroupI18n objects which contain a foreign key that references this object. If the $criteria is not null, it is used to always fetch the results from the database. Otherwise the results are fetched from the database the first time, then cached. Next time the same method is called without $criteria, the cached collection is returned. If this ChildCustomerGroup is new, it will return an empty collection or the current collection; the criteria is ignored on a new object. @param Criteria $criteria optional Criteria object to narrow the query @param ConnectionInterface $con optional connection object @return Collection|ChildCustomerGroupI18n[] List of ChildCustomerGroupI18n objects @throws PropelException
[ "Gets", "an", "array", "of", "ChildCustomerGroupI18n", "objects", "which", "contain", "a", "foreign", "key", "that", "references", "this", "object", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L1737-L1781
24,534
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.countCustomerGroupI18ns
public function countCustomerGroupI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { $partial = $this->collCustomerGroupI18nsPartial && !$this->isNew(); if (null === $this->collCustomerGroupI18ns || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collCustomerGroupI18ns) { return 0; } if ($partial && !$criteria) { return count($this->getCustomerGroupI18ns()); } $query = ChildCustomerGroupI18nQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByCustomerGroup($this) ->count($con); } return count($this->collCustomerGroupI18ns); }
php
public function countCustomerGroupI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { $partial = $this->collCustomerGroupI18nsPartial && !$this->isNew(); if (null === $this->collCustomerGroupI18ns || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collCustomerGroupI18ns) { return 0; } if ($partial && !$criteria) { return count($this->getCustomerGroupI18ns()); } $query = ChildCustomerGroupI18nQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByCustomerGroup($this) ->count($con); } return count($this->collCustomerGroupI18ns); }
[ "public", "function", "countCustomerGroupI18ns", "(", "Criteria", "$", "criteria", "=", "null", ",", "$", "distinct", "=", "false", ",", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "$", "partial", "=", "$", "this", "->", "collCustomerGroupI18nsPartial", "&&", "!", "$", "this", "->", "isNew", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "collCustomerGroupI18ns", "||", "null", "!==", "$", "criteria", "||", "$", "partial", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", "&&", "null", "===", "$", "this", "->", "collCustomerGroupI18ns", ")", "{", "return", "0", ";", "}", "if", "(", "$", "partial", "&&", "!", "$", "criteria", ")", "{", "return", "count", "(", "$", "this", "->", "getCustomerGroupI18ns", "(", ")", ")", ";", "}", "$", "query", "=", "ChildCustomerGroupI18nQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", ";", "if", "(", "$", "distinct", ")", "{", "$", "query", "->", "distinct", "(", ")", ";", "}", "return", "$", "query", "->", "filterByCustomerGroup", "(", "$", "this", ")", "->", "count", "(", "$", "con", ")", ";", "}", "return", "count", "(", "$", "this", "->", "collCustomerGroupI18ns", ")", ";", "}" ]
Returns the number of related CustomerGroupI18n objects. @param Criteria $criteria @param boolean $distinct @param ConnectionInterface $con @return int Count of related CustomerGroupI18n objects. @throws PropelException
[ "Returns", "the", "number", "of", "related", "CustomerGroupI18n", "objects", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L1827-L1850
24,535
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.addCustomerGroupI18n
public function addCustomerGroupI18n(ChildCustomerGroupI18n $l) { if ($l && $locale = $l->getLocale()) { $this->setLocale($locale); $this->currentTranslations[$locale] = $l; } if ($this->collCustomerGroupI18ns === null) { $this->initCustomerGroupI18ns(); $this->collCustomerGroupI18nsPartial = true; } if (!in_array($l, $this->collCustomerGroupI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddCustomerGroupI18n($l); } return $this; }
php
public function addCustomerGroupI18n(ChildCustomerGroupI18n $l) { if ($l && $locale = $l->getLocale()) { $this->setLocale($locale); $this->currentTranslations[$locale] = $l; } if ($this->collCustomerGroupI18ns === null) { $this->initCustomerGroupI18ns(); $this->collCustomerGroupI18nsPartial = true; } if (!in_array($l, $this->collCustomerGroupI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddCustomerGroupI18n($l); } return $this; }
[ "public", "function", "addCustomerGroupI18n", "(", "ChildCustomerGroupI18n", "$", "l", ")", "{", "if", "(", "$", "l", "&&", "$", "locale", "=", "$", "l", "->", "getLocale", "(", ")", ")", "{", "$", "this", "->", "setLocale", "(", "$", "locale", ")", ";", "$", "this", "->", "currentTranslations", "[", "$", "locale", "]", "=", "$", "l", ";", "}", "if", "(", "$", "this", "->", "collCustomerGroupI18ns", "===", "null", ")", "{", "$", "this", "->", "initCustomerGroupI18ns", "(", ")", ";", "$", "this", "->", "collCustomerGroupI18nsPartial", "=", "true", ";", "}", "if", "(", "!", "in_array", "(", "$", "l", ",", "$", "this", "->", "collCustomerGroupI18ns", "->", "getArrayCopy", "(", ")", ",", "true", ")", ")", "{", "// only add it if the **same** object is not already associated", "$", "this", "->", "doAddCustomerGroupI18n", "(", "$", "l", ")", ";", "}", "return", "$", "this", ";", "}" ]
Method called to associate a ChildCustomerGroupI18n object to this object through the ChildCustomerGroupI18n foreign key attribute. @param ChildCustomerGroupI18n $l ChildCustomerGroupI18n @return \CustomerGroup\Model\CustomerGroup The current object (for fluent API support)
[ "Method", "called", "to", "associate", "a", "ChildCustomerGroupI18n", "object", "to", "this", "object", "through", "the", "ChildCustomerGroupI18n", "foreign", "key", "attribute", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L1859-L1875
24,536
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.getCustomers
public function getCustomers($criteria = null, ConnectionInterface $con = null) { if (null === $this->collCustomers || null !== $criteria) { if ($this->isNew() && null === $this->collCustomers) { // return empty collection $this->initCustomers(); } else { $collCustomers = CustomerQuery::create(null, $criteria) ->filterByCustomerGroup($this) ->find($con); if (null !== $criteria) { return $collCustomers; } $this->collCustomers = $collCustomers; } } return $this->collCustomers; }
php
public function getCustomers($criteria = null, ConnectionInterface $con = null) { if (null === $this->collCustomers || null !== $criteria) { if ($this->isNew() && null === $this->collCustomers) { // return empty collection $this->initCustomers(); } else { $collCustomers = CustomerQuery::create(null, $criteria) ->filterByCustomerGroup($this) ->find($con); if (null !== $criteria) { return $collCustomers; } $this->collCustomers = $collCustomers; } } return $this->collCustomers; }
[ "public", "function", "getCustomers", "(", "$", "criteria", "=", "null", ",", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "null", "===", "$", "this", "->", "collCustomers", "||", "null", "!==", "$", "criteria", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", "&&", "null", "===", "$", "this", "->", "collCustomers", ")", "{", "// return empty collection", "$", "this", "->", "initCustomers", "(", ")", ";", "}", "else", "{", "$", "collCustomers", "=", "CustomerQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", "->", "filterByCustomerGroup", "(", "$", "this", ")", "->", "find", "(", "$", "con", ")", ";", "if", "(", "null", "!==", "$", "criteria", ")", "{", "return", "$", "collCustomers", ";", "}", "$", "this", "->", "collCustomers", "=", "$", "collCustomers", ";", "}", "}", "return", "$", "this", "->", "collCustomers", ";", "}" ]
Gets a collection of ChildCustomer objects related by a many-to-many relationship to the current object by way of the customer_customer_group cross-reference table. If the $criteria is not null, it is used to always fetch the results from the database. Otherwise the results are fetched from the database the first time, then cached. Next time the same method is called without $criteria, the cached collection is returned. If this ChildCustomerGroup is new, it will return an empty collection or the current collection; the criteria is ignored on a new object. @param Criteria $criteria Optional query object to filter the query @param ConnectionInterface $con Optional connection object @return ObjectCollection|ChildCustomer[] List of ChildCustomer objects
[ "Gets", "a", "collection", "of", "ChildCustomer", "objects", "related", "by", "a", "many", "-", "to", "-", "many", "relationship", "to", "the", "current", "object", "by", "way", "of", "the", "customer_customer_group", "cross", "-", "reference", "table", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L1950-L1968
24,537
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.countCustomers
public function countCustomers($criteria = null, $distinct = false, ConnectionInterface $con = null) { if (null === $this->collCustomers || null !== $criteria) { if ($this->isNew() && null === $this->collCustomers) { return 0; } else { $query = CustomerQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByCustomerGroup($this) ->count($con); } } else { return count($this->collCustomers); } }
php
public function countCustomers($criteria = null, $distinct = false, ConnectionInterface $con = null) { if (null === $this->collCustomers || null !== $criteria) { if ($this->isNew() && null === $this->collCustomers) { return 0; } else { $query = CustomerQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByCustomerGroup($this) ->count($con); } } else { return count($this->collCustomers); } }
[ "public", "function", "countCustomers", "(", "$", "criteria", "=", "null", ",", "$", "distinct", "=", "false", ",", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "null", "===", "$", "this", "->", "collCustomers", "||", "null", "!==", "$", "criteria", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", "&&", "null", "===", "$", "this", "->", "collCustomers", ")", "{", "return", "0", ";", "}", "else", "{", "$", "query", "=", "CustomerQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", ";", "if", "(", "$", "distinct", ")", "{", "$", "query", "->", "distinct", "(", ")", ";", "}", "return", "$", "query", "->", "filterByCustomerGroup", "(", "$", "this", ")", "->", "count", "(", "$", "con", ")", ";", "}", "}", "else", "{", "return", "count", "(", "$", "this", "->", "collCustomers", ")", ";", "}", "}" ]
Gets the number of ChildCustomer objects related by a many-to-many relationship to the current object by way of the customer_customer_group cross-reference table. @param Criteria $criteria Optional query object to filter the query @param boolean $distinct Set to true to force count distinct @param ConnectionInterface $con Optional connection object @return int the number of related ChildCustomer objects
[ "Gets", "the", "number", "of", "ChildCustomer", "objects", "related", "by", "a", "many", "-", "to", "-", "many", "relationship", "to", "the", "current", "object", "by", "way", "of", "the", "customer_customer_group", "cross", "-", "reference", "table", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L2008-L2026
24,538
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.addCustomer
public function addCustomer(ChildCustomer $customer) { if ($this->collCustomers === null) { $this->initCustomers(); } if (!$this->collCustomers->contains($customer)) { // only add it if the **same** object is not already associated $this->doAddCustomer($customer); $this->collCustomers[] = $customer; } return $this; }
php
public function addCustomer(ChildCustomer $customer) { if ($this->collCustomers === null) { $this->initCustomers(); } if (!$this->collCustomers->contains($customer)) { // only add it if the **same** object is not already associated $this->doAddCustomer($customer); $this->collCustomers[] = $customer; } return $this; }
[ "public", "function", "addCustomer", "(", "ChildCustomer", "$", "customer", ")", "{", "if", "(", "$", "this", "->", "collCustomers", "===", "null", ")", "{", "$", "this", "->", "initCustomers", "(", ")", ";", "}", "if", "(", "!", "$", "this", "->", "collCustomers", "->", "contains", "(", "$", "customer", ")", ")", "{", "// only add it if the **same** object is not already associated", "$", "this", "->", "doAddCustomer", "(", "$", "customer", ")", ";", "$", "this", "->", "collCustomers", "[", "]", "=", "$", "customer", ";", "}", "return", "$", "this", ";", "}" ]
Associate a ChildCustomer object to this object through the customer_customer_group cross reference table. @param ChildCustomer $customer The ChildCustomerCustomerGroup object to relate @return ChildCustomerGroup The current object (for fluent API support)
[ "Associate", "a", "ChildCustomer", "object", "to", "this", "object", "through", "the", "customer_customer_group", "cross", "reference", "table", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L2035-L2047
24,539
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.isLast
public function isLast(ConnectionInterface $con = null) { return $this->getPosition() == ChildCustomerGroupQuery::create()->getMaxRankArray($con); }
php
public function isLast(ConnectionInterface $con = null) { return $this->getPosition() == ChildCustomerGroupQuery::create()->getMaxRankArray($con); }
[ "public", "function", "isLast", "(", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "return", "$", "this", "->", "getPosition", "(", ")", "==", "ChildCustomerGroupQuery", "::", "create", "(", ")", "->", "getMaxRankArray", "(", "$", "con", ")", ";", "}" ]
Check if the object is last in the list, i.e. if its rank is the highest rank @param ConnectionInterface $con optional connection @return boolean
[ "Check", "if", "the", "object", "is", "last", "in", "the", "list", "i", ".", "e", ".", "if", "its", "rank", "is", "the", "highest", "rank" ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L2356-L2359
24,540
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.getNext
public function getNext(ConnectionInterface $con = null) { $query = ChildCustomerGroupQuery::create(); $query->filterByRank($this->getPosition() + 1); return $query->findOne($con); }
php
public function getNext(ConnectionInterface $con = null) { $query = ChildCustomerGroupQuery::create(); $query->filterByRank($this->getPosition() + 1); return $query->findOne($con); }
[ "public", "function", "getNext", "(", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "$", "query", "=", "ChildCustomerGroupQuery", "::", "create", "(", ")", ";", "$", "query", "->", "filterByRank", "(", "$", "this", "->", "getPosition", "(", ")", "+", "1", ")", ";", "return", "$", "query", "->", "findOne", "(", "$", "con", ")", ";", "}" ]
Get the next item in the list, i.e. the one for which rank is immediately higher @param ConnectionInterface $con optional connection @return ChildCustomerGroup
[ "Get", "the", "next", "item", "in", "the", "list", "i", ".", "e", ".", "the", "one", "for", "which", "rank", "is", "immediately", "higher" ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L2368-L2377
24,541
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.insertAtRank
public function insertAtRank($rank, ConnectionInterface $con = null) { $maxRank = ChildCustomerGroupQuery::create()->getMaxRankArray($con); if ($rank < 1 || $rank > $maxRank + 1) { throw new PropelException('Invalid rank ' . $rank); } // move the object in the list, at the given rank $this->setPosition($rank); if ($rank != $maxRank + 1) { // Keep the list modification query for the save() transaction $this->sortableQueries []= array( 'callable' => array('\CustomerGroup\Model\CustomerGroupQuery', 'sortableShiftRank'), 'arguments' => array(1, $rank, null, ) ); } return $this; }
php
public function insertAtRank($rank, ConnectionInterface $con = null) { $maxRank = ChildCustomerGroupQuery::create()->getMaxRankArray($con); if ($rank < 1 || $rank > $maxRank + 1) { throw new PropelException('Invalid rank ' . $rank); } // move the object in the list, at the given rank $this->setPosition($rank); if ($rank != $maxRank + 1) { // Keep the list modification query for the save() transaction $this->sortableQueries []= array( 'callable' => array('\CustomerGroup\Model\CustomerGroupQuery', 'sortableShiftRank'), 'arguments' => array(1, $rank, null, ) ); } return $this; }
[ "public", "function", "insertAtRank", "(", "$", "rank", ",", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "$", "maxRank", "=", "ChildCustomerGroupQuery", "::", "create", "(", ")", "->", "getMaxRankArray", "(", "$", "con", ")", ";", "if", "(", "$", "rank", "<", "1", "||", "$", "rank", ">", "$", "maxRank", "+", "1", ")", "{", "throw", "new", "PropelException", "(", "'Invalid rank '", ".", "$", "rank", ")", ";", "}", "// move the object in the list, at the given rank", "$", "this", "->", "setPosition", "(", "$", "rank", ")", ";", "if", "(", "$", "rank", "!=", "$", "maxRank", "+", "1", ")", "{", "// Keep the list modification query for the save() transaction", "$", "this", "->", "sortableQueries", "[", "]", "=", "array", "(", "'callable'", "=>", "array", "(", "'\\CustomerGroup\\Model\\CustomerGroupQuery'", ",", "'sortableShiftRank'", ")", ",", "'arguments'", "=>", "array", "(", "1", ",", "$", "rank", ",", "null", ",", ")", ")", ";", "}", "return", "$", "this", ";", "}" ]
Insert at specified rank The modifications are not persisted until the object is saved. @param integer $rank rank value @param ConnectionInterface $con optional connection @return ChildCustomerGroup the current object @throws PropelException
[ "Insert", "at", "specified", "rank", "The", "modifications", "are", "not", "persisted", "until", "the", "object", "is", "saved", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L2408-L2425
24,542
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.insertAtBottom
public function insertAtBottom(ConnectionInterface $con = null) { $this->setPosition(ChildCustomerGroupQuery::create()->getMaxRankArray($con) + 1); return $this; }
php
public function insertAtBottom(ConnectionInterface $con = null) { $this->setPosition(ChildCustomerGroupQuery::create()->getMaxRankArray($con) + 1); return $this; }
[ "public", "function", "insertAtBottom", "(", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "$", "this", "->", "setPosition", "(", "ChildCustomerGroupQuery", "::", "create", "(", ")", "->", "getMaxRankArray", "(", "$", "con", ")", "+", "1", ")", ";", "return", "$", "this", ";", "}" ]
Insert in the last rank The modifications are not persisted until the object is saved. @param ConnectionInterface $con optional connection @return ChildCustomerGroup the current object @throws PropelException
[ "Insert", "in", "the", "last", "rank", "The", "modifications", "are", "not", "persisted", "until", "the", "object", "is", "saved", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L2437-L2442
24,543
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.moveToRank
public function moveToRank($newRank, ConnectionInterface $con = null) { if ($this->isNew()) { throw new PropelException('New objects cannot be moved. Please use insertAtRank() instead'); } if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CustomerGroupTableMap::DATABASE_NAME); } if ($newRank < 1 || $newRank > ChildCustomerGroupQuery::create()->getMaxRankArray($con)) { throw new PropelException('Invalid rank ' . $newRank); } $oldRank = $this->getPosition(); if ($oldRank == $newRank) { return $this; } $con->beginTransaction(); try { // shift the objects between the old and the new rank $delta = ($oldRank < $newRank) ? -1 : 1; ChildCustomerGroupQuery::sortableShiftRank($delta, min($oldRank, $newRank), max($oldRank, $newRank), $con); // move the object to its new rank $this->setPosition($newRank); $this->save($con); $con->commit(); return $this; } catch (Exception $e) { $con->rollback(); throw $e; } }
php
public function moveToRank($newRank, ConnectionInterface $con = null) { if ($this->isNew()) { throw new PropelException('New objects cannot be moved. Please use insertAtRank() instead'); } if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CustomerGroupTableMap::DATABASE_NAME); } if ($newRank < 1 || $newRank > ChildCustomerGroupQuery::create()->getMaxRankArray($con)) { throw new PropelException('Invalid rank ' . $newRank); } $oldRank = $this->getPosition(); if ($oldRank == $newRank) { return $this; } $con->beginTransaction(); try { // shift the objects between the old and the new rank $delta = ($oldRank < $newRank) ? -1 : 1; ChildCustomerGroupQuery::sortableShiftRank($delta, min($oldRank, $newRank), max($oldRank, $newRank), $con); // move the object to its new rank $this->setPosition($newRank); $this->save($con); $con->commit(); return $this; } catch (Exception $e) { $con->rollback(); throw $e; } }
[ "public", "function", "moveToRank", "(", "$", "newRank", ",", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", ")", "{", "throw", "new", "PropelException", "(", "'New objects cannot be moved. Please use insertAtRank() instead'", ")", ";", "}", "if", "(", "null", "===", "$", "con", ")", "{", "$", "con", "=", "Propel", "::", "getServiceContainer", "(", ")", "->", "getWriteConnection", "(", "CustomerGroupTableMap", "::", "DATABASE_NAME", ")", ";", "}", "if", "(", "$", "newRank", "<", "1", "||", "$", "newRank", ">", "ChildCustomerGroupQuery", "::", "create", "(", ")", "->", "getMaxRankArray", "(", "$", "con", ")", ")", "{", "throw", "new", "PropelException", "(", "'Invalid rank '", ".", "$", "newRank", ")", ";", "}", "$", "oldRank", "=", "$", "this", "->", "getPosition", "(", ")", ";", "if", "(", "$", "oldRank", "==", "$", "newRank", ")", "{", "return", "$", "this", ";", "}", "$", "con", "->", "beginTransaction", "(", ")", ";", "try", "{", "// shift the objects between the old and the new rank", "$", "delta", "=", "(", "$", "oldRank", "<", "$", "newRank", ")", "?", "-", "1", ":", "1", ";", "ChildCustomerGroupQuery", "::", "sortableShiftRank", "(", "$", "delta", ",", "min", "(", "$", "oldRank", ",", "$", "newRank", ")", ",", "max", "(", "$", "oldRank", ",", "$", "newRank", ")", ",", "$", "con", ")", ";", "// move the object to its new rank", "$", "this", "->", "setPosition", "(", "$", "newRank", ")", ";", "$", "this", "->", "save", "(", "$", "con", ")", ";", "$", "con", "->", "commit", "(", ")", ";", "return", "$", "this", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "$", "con", "->", "rollback", "(", ")", ";", "throw", "$", "e", ";", "}", "}" ]
Move the object to a new rank, and shifts the rank Of the objects inbetween the old and new rank accordingly @param integer $newRank rank value @param ConnectionInterface $con optional connection @return ChildCustomerGroup the current object @throws PropelException
[ "Move", "the", "object", "to", "a", "new", "rank", "and", "shifts", "the", "rank", "Of", "the", "objects", "inbetween", "the", "old", "and", "new", "rank", "accordingly" ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L2466-L2500
24,544
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.swapWith
public function swapWith($object, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CustomerGroupTableMap::DATABASE_NAME); } $con->beginTransaction(); try { $oldRank = $this->getPosition(); $newRank = $object->getPosition(); $this->setPosition($newRank); $object->setPosition($oldRank); $this->save($con); $object->save($con); $con->commit(); return $this; } catch (Exception $e) { $con->rollback(); throw $e; } }
php
public function swapWith($object, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CustomerGroupTableMap::DATABASE_NAME); } $con->beginTransaction(); try { $oldRank = $this->getPosition(); $newRank = $object->getPosition(); $this->setPosition($newRank); $object->setPosition($oldRank); $this->save($con); $object->save($con); $con->commit(); return $this; } catch (Exception $e) { $con->rollback(); throw $e; } }
[ "public", "function", "swapWith", "(", "$", "object", ",", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "null", "===", "$", "con", ")", "{", "$", "con", "=", "Propel", "::", "getServiceContainer", "(", ")", "->", "getWriteConnection", "(", "CustomerGroupTableMap", "::", "DATABASE_NAME", ")", ";", "}", "$", "con", "->", "beginTransaction", "(", ")", ";", "try", "{", "$", "oldRank", "=", "$", "this", "->", "getPosition", "(", ")", ";", "$", "newRank", "=", "$", "object", "->", "getPosition", "(", ")", ";", "$", "this", "->", "setPosition", "(", "$", "newRank", ")", ";", "$", "object", "->", "setPosition", "(", "$", "oldRank", ")", ";", "$", "this", "->", "save", "(", "$", "con", ")", ";", "$", "object", "->", "save", "(", "$", "con", ")", ";", "$", "con", "->", "commit", "(", ")", ";", "return", "$", "this", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "$", "con", "->", "rollback", "(", ")", ";", "throw", "$", "e", ";", "}", "}" ]
Exchange the rank of the object with the one passed as argument, and saves both objects @param ChildCustomerGroup $object @param ConnectionInterface $con optional connection @return ChildCustomerGroup the current object @throws Exception if the database cannot execute the two updates
[ "Exchange", "the", "rank", "of", "the", "object", "with", "the", "one", "passed", "as", "argument", "and", "saves", "both", "objects" ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L2512-L2534
24,545
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.moveUp
public function moveUp(ConnectionInterface $con = null) { if ($this->isFirst()) { return $this; } if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CustomerGroupTableMap::DATABASE_NAME); } $con->beginTransaction(); try { $prev = $this->getPrevious($con); $this->swapWith($prev, $con); $con->commit(); return $this; } catch (Exception $e) { $con->rollback(); throw $e; } }
php
public function moveUp(ConnectionInterface $con = null) { if ($this->isFirst()) { return $this; } if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CustomerGroupTableMap::DATABASE_NAME); } $con->beginTransaction(); try { $prev = $this->getPrevious($con); $this->swapWith($prev, $con); $con->commit(); return $this; } catch (Exception $e) { $con->rollback(); throw $e; } }
[ "public", "function", "moveUp", "(", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "$", "this", "->", "isFirst", "(", ")", ")", "{", "return", "$", "this", ";", "}", "if", "(", "null", "===", "$", "con", ")", "{", "$", "con", "=", "Propel", "::", "getServiceContainer", "(", ")", "->", "getWriteConnection", "(", "CustomerGroupTableMap", "::", "DATABASE_NAME", ")", ";", "}", "$", "con", "->", "beginTransaction", "(", ")", ";", "try", "{", "$", "prev", "=", "$", "this", "->", "getPrevious", "(", "$", "con", ")", ";", "$", "this", "->", "swapWith", "(", "$", "prev", ",", "$", "con", ")", ";", "$", "con", "->", "commit", "(", ")", ";", "return", "$", "this", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "$", "con", "->", "rollback", "(", ")", ";", "throw", "$", "e", ";", "}", "}" ]
Move the object higher in the list, i.e. exchanges its rank with the one of the previous object @param ConnectionInterface $con optional connection @return ChildCustomerGroup the current object
[ "Move", "the", "object", "higher", "in", "the", "list", "i", ".", "e", ".", "exchanges", "its", "rank", "with", "the", "one", "of", "the", "previous", "object" ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L2543-L2562
24,546
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.moveDown
public function moveDown(ConnectionInterface $con = null) { if ($this->isLast($con)) { return $this; } if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CustomerGroupTableMap::DATABASE_NAME); } $con->beginTransaction(); try { $next = $this->getNext($con); $this->swapWith($next, $con); $con->commit(); return $this; } catch (Exception $e) { $con->rollback(); throw $e; } }
php
public function moveDown(ConnectionInterface $con = null) { if ($this->isLast($con)) { return $this; } if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CustomerGroupTableMap::DATABASE_NAME); } $con->beginTransaction(); try { $next = $this->getNext($con); $this->swapWith($next, $con); $con->commit(); return $this; } catch (Exception $e) { $con->rollback(); throw $e; } }
[ "public", "function", "moveDown", "(", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "$", "this", "->", "isLast", "(", "$", "con", ")", ")", "{", "return", "$", "this", ";", "}", "if", "(", "null", "===", "$", "con", ")", "{", "$", "con", "=", "Propel", "::", "getServiceContainer", "(", ")", "->", "getWriteConnection", "(", "CustomerGroupTableMap", "::", "DATABASE_NAME", ")", ";", "}", "$", "con", "->", "beginTransaction", "(", ")", ";", "try", "{", "$", "next", "=", "$", "this", "->", "getNext", "(", "$", "con", ")", ";", "$", "this", "->", "swapWith", "(", "$", "next", ",", "$", "con", ")", ";", "$", "con", "->", "commit", "(", ")", ";", "return", "$", "this", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "$", "con", "->", "rollback", "(", ")", ";", "throw", "$", "e", ";", "}", "}" ]
Move the object higher in the list, i.e. exchanges its rank with the one of the next object @param ConnectionInterface $con optional connection @return ChildCustomerGroup the current object
[ "Move", "the", "object", "higher", "in", "the", "list", "i", ".", "e", ".", "exchanges", "its", "rank", "with", "the", "one", "of", "the", "next", "object" ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L2571-L2590
24,547
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.moveToTop
public function moveToTop(ConnectionInterface $con = null) { if ($this->isFirst()) { return $this; } return $this->moveToRank(1, $con); }
php
public function moveToTop(ConnectionInterface $con = null) { if ($this->isFirst()) { return $this; } return $this->moveToRank(1, $con); }
[ "public", "function", "moveToTop", "(", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "$", "this", "->", "isFirst", "(", ")", ")", "{", "return", "$", "this", ";", "}", "return", "$", "this", "->", "moveToRank", "(", "1", ",", "$", "con", ")", ";", "}" ]
Move the object to the top of the list @param ConnectionInterface $con optional connection @return ChildCustomerGroup the current object
[ "Move", "the", "object", "to", "the", "top", "of", "the", "list" ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L2599-L2606
24,548
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.moveToBottom
public function moveToBottom(ConnectionInterface $con = null) { if ($this->isLast($con)) { return false; } if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CustomerGroupTableMap::DATABASE_NAME); } $con->beginTransaction(); try { $bottom = ChildCustomerGroupQuery::create()->getMaxRankArray($con); $res = $this->moveToRank($bottom, $con); $con->commit(); return $res; } catch (Exception $e) { $con->rollback(); throw $e; } }
php
public function moveToBottom(ConnectionInterface $con = null) { if ($this->isLast($con)) { return false; } if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(CustomerGroupTableMap::DATABASE_NAME); } $con->beginTransaction(); try { $bottom = ChildCustomerGroupQuery::create()->getMaxRankArray($con); $res = $this->moveToRank($bottom, $con); $con->commit(); return $res; } catch (Exception $e) { $con->rollback(); throw $e; } }
[ "public", "function", "moveToBottom", "(", "ConnectionInterface", "$", "con", "=", "null", ")", "{", "if", "(", "$", "this", "->", "isLast", "(", "$", "con", ")", ")", "{", "return", "false", ";", "}", "if", "(", "null", "===", "$", "con", ")", "{", "$", "con", "=", "Propel", "::", "getServiceContainer", "(", ")", "->", "getWriteConnection", "(", "CustomerGroupTableMap", "::", "DATABASE_NAME", ")", ";", "}", "$", "con", "->", "beginTransaction", "(", ")", ";", "try", "{", "$", "bottom", "=", "ChildCustomerGroupQuery", "::", "create", "(", ")", "->", "getMaxRankArray", "(", "$", "con", ")", ";", "$", "res", "=", "$", "this", "->", "moveToRank", "(", "$", "bottom", ",", "$", "con", ")", ";", "$", "con", "->", "commit", "(", ")", ";", "return", "$", "res", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "$", "con", "->", "rollback", "(", ")", ";", "throw", "$", "e", ";", "}", "}" ]
Move the object to the bottom of the list @param ConnectionInterface $con optional connection @return integer the old object's rank
[ "Move", "the", "object", "to", "the", "bottom", "of", "the", "list" ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L2615-L2634
24,549
thelia-modules/CustomerGroup
Model/Base/CustomerGroup.php
CustomerGroup.removeFromList
public function removeFromList() { // Keep the list modification query for the save() transaction $this->sortableQueries[] = array( 'callable' => array('\CustomerGroup\Model\CustomerGroupQuery', 'sortableShiftRank'), 'arguments' => array(-1, $this->getPosition() + 1, null) ); // remove the object from the list $this->setPosition(null); return $this; }
php
public function removeFromList() { // Keep the list modification query for the save() transaction $this->sortableQueries[] = array( 'callable' => array('\CustomerGroup\Model\CustomerGroupQuery', 'sortableShiftRank'), 'arguments' => array(-1, $this->getPosition() + 1, null) ); // remove the object from the list $this->setPosition(null); return $this; }
[ "public", "function", "removeFromList", "(", ")", "{", "// Keep the list modification query for the save() transaction", "$", "this", "->", "sortableQueries", "[", "]", "=", "array", "(", "'callable'", "=>", "array", "(", "'\\CustomerGroup\\Model\\CustomerGroupQuery'", ",", "'sortableShiftRank'", ")", ",", "'arguments'", "=>", "array", "(", "-", "1", ",", "$", "this", "->", "getPosition", "(", ")", "+", "1", ",", "null", ")", ")", ";", "// remove the object from the list", "$", "this", "->", "setPosition", "(", "null", ")", ";", "return", "$", "this", ";", "}" ]
Removes the current object from the list. The modifications are not persisted until the object is saved. @return ChildCustomerGroup the current object
[ "Removes", "the", "current", "object", "from", "the", "list", ".", "The", "modifications", "are", "not", "persisted", "until", "the", "object", "is", "saved", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/Base/CustomerGroup.php#L2642-L2654
24,550
heidelpay/PhpDoc
src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php
MethodAssembler.addArgument
protected function addArgument($argument, $descriptor) { $params = $descriptor->getTags()->get('param', array()); if (!$this->argumentAssembler->getBuilder()) { $this->argumentAssembler->setBuilder($this->builder); } $argumentDescriptor = $this->argumentAssembler->create($argument, $params); $descriptor->addArgument($argumentDescriptor->getName(), $argumentDescriptor); }
php
protected function addArgument($argument, $descriptor) { $params = $descriptor->getTags()->get('param', array()); if (!$this->argumentAssembler->getBuilder()) { $this->argumentAssembler->setBuilder($this->builder); } $argumentDescriptor = $this->argumentAssembler->create($argument, $params); $descriptor->addArgument($argumentDescriptor->getName(), $argumentDescriptor); }
[ "protected", "function", "addArgument", "(", "$", "argument", ",", "$", "descriptor", ")", "{", "$", "params", "=", "$", "descriptor", "->", "getTags", "(", ")", "->", "get", "(", "'param'", ",", "array", "(", ")", ")", ";", "if", "(", "!", "$", "this", "->", "argumentAssembler", "->", "getBuilder", "(", ")", ")", "{", "$", "this", "->", "argumentAssembler", "->", "setBuilder", "(", "$", "this", "->", "builder", ")", ";", "}", "$", "argumentDescriptor", "=", "$", "this", "->", "argumentAssembler", "->", "create", "(", "$", "argument", ",", "$", "params", ")", ";", "$", "descriptor", "->", "addArgument", "(", "$", "argumentDescriptor", "->", "getName", "(", ")", ",", "$", "argumentDescriptor", ")", ";", "}" ]
Adds a single reflected Argument to the Method Descriptor. @param ArgumentReflector $argument @param MethodDescriptor $descriptor @return void
[ "Adds", "a", "single", "reflected", "Argument", "to", "the", "Method", "Descriptor", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php#L100-L110
24,551
Erdiko/core
src/Template.php
Template.initiate
public function initiate($template = null, $data = null, $templateRootFolder = ERDIKO_APP) { $template = ($template === null) ? $this->getDefaultTemplate() : $template; $this->setTemplate($template); $this->setData($data); $this->setTemplateRootFolder($templateRootFolder); }
php
public function initiate($template = null, $data = null, $templateRootFolder = ERDIKO_APP) { $template = ($template === null) ? $this->getDefaultTemplate() : $template; $this->setTemplate($template); $this->setData($data); $this->setTemplateRootFolder($templateRootFolder); }
[ "public", "function", "initiate", "(", "$", "template", "=", "null", ",", "$", "data", "=", "null", ",", "$", "templateRootFolder", "=", "ERDIKO_APP", ")", "{", "$", "template", "=", "(", "$", "template", "===", "null", ")", "?", "$", "this", "->", "getDefaultTemplate", "(", ")", ":", "$", "template", ";", "$", "this", "->", "setTemplate", "(", "$", "template", ")", ";", "$", "this", "->", "setData", "(", "$", "data", ")", ";", "$", "this", "->", "setTemplateRootFolder", "(", "$", "templateRootFolder", ")", ";", "}" ]
Constructor like initiation @param string $template , Theme Object (Contaier) @param mixed $data
[ "Constructor", "like", "initiation" ]
c7947ee973b0ad2fd05a6d1d8ce45696618c8fa6
https://github.com/Erdiko/core/blob/c7947ee973b0ad2fd05a6d1d8ce45696618c8fa6/src/Template.php#L33-L39
24,552
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Scrybe/Converter/BaseConverter.php
BaseConverter.addTemplateAssets
protected function addTemplateAssets($template) { /** @var SplFileInfo $file_info */ foreach ($template->getAssets() as $filename => $file_info) { $this->assets->set($filename, $file_info->getRelativePathname()); } }
php
protected function addTemplateAssets($template) { /** @var SplFileInfo $file_info */ foreach ($template->getAssets() as $filename => $file_info) { $this->assets->set($filename, $file_info->getRelativePathname()); } }
[ "protected", "function", "addTemplateAssets", "(", "$", "template", ")", "{", "/** @var SplFileInfo $file_info */", "foreach", "(", "$", "template", "->", "getAssets", "(", ")", "as", "$", "filename", "=>", "$", "file_info", ")", "{", "$", "this", "->", "assets", "->", "set", "(", "$", "filename", ",", "$", "file_info", "->", "getRelativePathname", "(", ")", ")", ";", "}", "}" ]
Adds the assets of the template to the Assets manager. @param TemplateInterface $template @return void
[ "Adds", "the", "assets", "of", "the", "template", "to", "the", "Assets", "manager", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Scrybe/Converter/BaseConverter.php#L221-L227
24,553
jnaxo/country-codes
src/Country.php
Country.getInlcudeResources
public function getInlcudeResources($resource) { switch ($resource) { case 'administrative_areas': return $this->administrativeAreas()->getQuery(); case 'cities': return $this->cities()->getQuery()->select("ctrystore_cities.*"); } return false; }
php
public function getInlcudeResources($resource) { switch ($resource) { case 'administrative_areas': return $this->administrativeAreas()->getQuery(); case 'cities': return $this->cities()->getQuery()->select("ctrystore_cities.*"); } return false; }
[ "public", "function", "getInlcudeResources", "(", "$", "resource", ")", "{", "switch", "(", "$", "resource", ")", "{", "case", "'administrative_areas'", ":", "return", "$", "this", "->", "administrativeAreas", "(", ")", "->", "getQuery", "(", ")", ";", "case", "'cities'", ":", "return", "$", "this", "->", "cities", "(", ")", "->", "getQuery", "(", ")", "->", "select", "(", "\"ctrystore_cities.*\"", ")", ";", "}", "return", "false", ";", "}" ]
Check if resource is related with the model. Then return resource query. @param string $resource @return boolean
[ "Check", "if", "resource", "is", "related", "with", "the", "model", ".", "Then", "return", "resource", "query", "." ]
ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9
https://github.com/jnaxo/country-codes/blob/ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9/src/Country.php#L61-L70
24,554
eghojansu/moe
src/tools/Audit.php
Audit.email
function email($str,$mx=TRUE) { $hosts=array(); return is_string(filter_var($str,FILTER_VALIDATE_EMAIL)) && (!$mx || getmxrr(substr($str,strrpos($str,'@')+1),$hosts)); }
php
function email($str,$mx=TRUE) { $hosts=array(); return is_string(filter_var($str,FILTER_VALIDATE_EMAIL)) && (!$mx || getmxrr(substr($str,strrpos($str,'@')+1),$hosts)); }
[ "function", "email", "(", "$", "str", ",", "$", "mx", "=", "TRUE", ")", "{", "$", "hosts", "=", "array", "(", ")", ";", "return", "is_string", "(", "filter_var", "(", "$", "str", ",", "FILTER_VALIDATE_EMAIL", ")", ")", "&&", "(", "!", "$", "mx", "||", "getmxrr", "(", "substr", "(", "$", "str", ",", "strrpos", "(", "$", "str", ",", "'@'", ")", "+", "1", ")", ",", "$", "hosts", ")", ")", ";", "}" ]
Return TRUE if string is a valid e-mail address; Check DNS MX records if specified @return bool @param $str string @param $mx boolean
[ "Return", "TRUE", "if", "string", "is", "a", "valid", "e", "-", "mail", "address", ";", "Check", "DNS", "MX", "records", "if", "specified" ]
f58ec75a3116d1a572782256e2b38bb9aab95e3c
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/Audit.php#L34-L38
24,555
bariew/yii2-i18n-cms-module
models/SourceMessage.php
SourceMessage.categoryList
public static function categoryList() { $data = self::find()->orderBy('category')->groupBy(['category'])->select(['category'])->column(); return array_combine($data, $data); }
php
public static function categoryList() { $data = self::find()->orderBy('category')->groupBy(['category'])->select(['category'])->column(); return array_combine($data, $data); }
[ "public", "static", "function", "categoryList", "(", ")", "{", "$", "data", "=", "self", "::", "find", "(", ")", "->", "orderBy", "(", "'category'", ")", "->", "groupBy", "(", "[", "'category'", "]", ")", "->", "select", "(", "[", "'category'", "]", ")", "->", "column", "(", ")", ";", "return", "array_combine", "(", "$", "data", ",", "$", "data", ")", ";", "}" ]
Gets all used categories list. @return array source category list
[ "Gets", "all", "used", "categories", "list", "." ]
18d2394565cdd8b5070a287a739c9007705ef18a
https://github.com/bariew/yii2-i18n-cms-module/blob/18d2394565cdd8b5070a287a739c9007705ef18a/models/SourceMessage.php#L91-L95
24,556
lukasz-adamski/teamspeak3-framework
src/TeamSpeak3/Node.php
Node.filterList
protected function filterList(array $nodes = array(), array $rules = array()) { if(!empty($rules)) { foreach($nodes as $node) { if(!$node instanceof Node) continue; $props = $node->getInfo(FALSE); $props = array_intersect_key($props, $rules); foreach($props as $key => $val) { if($val instanceof Str) { $match = $val->contains($rules[$key], TRUE); } else { $match = $val == $rules[$key]; } if($match === FALSE) { unset($nodes[$node->getId()]); } } } } return $nodes; }
php
protected function filterList(array $nodes = array(), array $rules = array()) { if(!empty($rules)) { foreach($nodes as $node) { if(!$node instanceof Node) continue; $props = $node->getInfo(FALSE); $props = array_intersect_key($props, $rules); foreach($props as $key => $val) { if($val instanceof Str) { $match = $val->contains($rules[$key], TRUE); } else { $match = $val == $rules[$key]; } if($match === FALSE) { unset($nodes[$node->getId()]); } } } } return $nodes; }
[ "protected", "function", "filterList", "(", "array", "$", "nodes", "=", "array", "(", ")", ",", "array", "$", "rules", "=", "array", "(", ")", ")", "{", "if", "(", "!", "empty", "(", "$", "rules", ")", ")", "{", "foreach", "(", "$", "nodes", "as", "$", "node", ")", "{", "if", "(", "!", "$", "node", "instanceof", "Node", ")", "continue", ";", "$", "props", "=", "$", "node", "->", "getInfo", "(", "FALSE", ")", ";", "$", "props", "=", "array_intersect_key", "(", "$", "props", ",", "$", "rules", ")", ";", "foreach", "(", "$", "props", "as", "$", "key", "=>", "$", "val", ")", "{", "if", "(", "$", "val", "instanceof", "Str", ")", "{", "$", "match", "=", "$", "val", "->", "contains", "(", "$", "rules", "[", "$", "key", "]", ",", "TRUE", ")", ";", "}", "else", "{", "$", "match", "=", "$", "val", "==", "$", "rules", "[", "$", "key", "]", ";", "}", "if", "(", "$", "match", "===", "FALSE", ")", "{", "unset", "(", "$", "nodes", "[", "$", "node", "->", "getId", "(", ")", "]", ")", ";", "}", "}", "}", "}", "return", "$", "nodes", ";", "}" ]
Filters given node list array using specified filter rules. @param array $nodes @param array $rules @return array
[ "Filters", "given", "node", "list", "array", "using", "specified", "filter", "rules", "." ]
39a56eca608da6b56b6aa386a7b5b31dc576c41a
https://github.com/lukasz-adamski/teamspeak3-framework/blob/39a56eca608da6b56b6aa386a7b5b31dc576c41a/src/TeamSpeak3/Node.php#L234-L265
24,557
thelia-modules/CustomerGroup
Model/CustomerQuery.php
CustomerQuery.addCustomerGroupsFilter
public static function addCustomerGroupsFilter(ModelCriteria $query, array $customerGroups) { if (!is_array($customerGroups) || empty($customerGroups)) { return $query; } $query // join to customer_customer_group ->addJoin( CustomerTableMap::ID, CustomerCustomerGroupTableMap::CUSTOMER_ID, Criteria::LEFT_JOIN ) // then join to customer_group ->addJoin( CustomerCustomerGroupTableMap::CUSTOMER_GROUP_ID, CustomerGroupTableMap::ID, Criteria::LEFT_JOIN ); // build the condition for each group $groupConditionsNames = []; foreach ($customerGroups as $customerGroup) { $conditionName = 'condition_customer_group_' . $customerGroup; $query->condition( $conditionName, CustomerGroupTableMap::CODE . Criteria::EQUAL . "?", $customerGroup, \PDO::PARAM_STR ); $groupConditionsNames[] = $conditionName; } // add the group conditions if (!empty($groupConditionsNames)) { $query->where($groupConditionsNames, Criteria::LOGICAL_OR); } return $query; }
php
public static function addCustomerGroupsFilter(ModelCriteria $query, array $customerGroups) { if (!is_array($customerGroups) || empty($customerGroups)) { return $query; } $query // join to customer_customer_group ->addJoin( CustomerTableMap::ID, CustomerCustomerGroupTableMap::CUSTOMER_ID, Criteria::LEFT_JOIN ) // then join to customer_group ->addJoin( CustomerCustomerGroupTableMap::CUSTOMER_GROUP_ID, CustomerGroupTableMap::ID, Criteria::LEFT_JOIN ); // build the condition for each group $groupConditionsNames = []; foreach ($customerGroups as $customerGroup) { $conditionName = 'condition_customer_group_' . $customerGroup; $query->condition( $conditionName, CustomerGroupTableMap::CODE . Criteria::EQUAL . "?", $customerGroup, \PDO::PARAM_STR ); $groupConditionsNames[] = $conditionName; } // add the group conditions if (!empty($groupConditionsNames)) { $query->where($groupConditionsNames, Criteria::LOGICAL_OR); } return $query; }
[ "public", "static", "function", "addCustomerGroupsFilter", "(", "ModelCriteria", "$", "query", ",", "array", "$", "customerGroups", ")", "{", "if", "(", "!", "is_array", "(", "$", "customerGroups", ")", "||", "empty", "(", "$", "customerGroups", ")", ")", "{", "return", "$", "query", ";", "}", "$", "query", "// join to customer_customer_group", "->", "addJoin", "(", "CustomerTableMap", "::", "ID", ",", "CustomerCustomerGroupTableMap", "::", "CUSTOMER_ID", ",", "Criteria", "::", "LEFT_JOIN", ")", "// then join to customer_group", "->", "addJoin", "(", "CustomerCustomerGroupTableMap", "::", "CUSTOMER_GROUP_ID", ",", "CustomerGroupTableMap", "::", "ID", ",", "Criteria", "::", "LEFT_JOIN", ")", ";", "// build the condition for each group", "$", "groupConditionsNames", "=", "[", "]", ";", "foreach", "(", "$", "customerGroups", "as", "$", "customerGroup", ")", "{", "$", "conditionName", "=", "'condition_customer_group_'", ".", "$", "customerGroup", ";", "$", "query", "->", "condition", "(", "$", "conditionName", ",", "CustomerGroupTableMap", "::", "CODE", ".", "Criteria", "::", "EQUAL", ".", "\"?\"", ",", "$", "customerGroup", ",", "\\", "PDO", "::", "PARAM_STR", ")", ";", "$", "groupConditionsNames", "[", "]", "=", "$", "conditionName", ";", "}", "// add the group conditions", "if", "(", "!", "empty", "(", "$", "groupConditionsNames", ")", ")", "{", "$", "query", "->", "where", "(", "$", "groupConditionsNames", ",", "Criteria", "::", "LOGICAL_OR", ")", ";", "}", "return", "$", "query", ";", "}" ]
Filter the query by customer groups. @param ModelCriteria $query The query to filter. @param array $customerGroups An array of customer groups codes. @return ModelCriteria The query.
[ "Filter", "the", "query", "by", "customer", "groups", "." ]
672cc64c686812f6a95cf0d702111f93d8c0e850
https://github.com/thelia-modules/CustomerGroup/blob/672cc64c686812f6a95cf0d702111f93d8c0e850/Model/CustomerQuery.php#L48-L89
24,558
mothership-ec/composer
src/Composer/Autoload/AutoloadGenerator.php
AutoloadGenerator.createLoader
public function createLoader(array $autoloads) { $loader = new ClassLoader(); if (isset($autoloads['psr-0'])) { foreach ($autoloads['psr-0'] as $namespace => $path) { $loader->add($namespace, $path); } } if (isset($autoloads['psr-4'])) { foreach ($autoloads['psr-4'] as $namespace => $path) { $loader->addPsr4($namespace, $path); } } return $loader; }
php
public function createLoader(array $autoloads) { $loader = new ClassLoader(); if (isset($autoloads['psr-0'])) { foreach ($autoloads['psr-0'] as $namespace => $path) { $loader->add($namespace, $path); } } if (isset($autoloads['psr-4'])) { foreach ($autoloads['psr-4'] as $namespace => $path) { $loader->addPsr4($namespace, $path); } } return $loader; }
[ "public", "function", "createLoader", "(", "array", "$", "autoloads", ")", "{", "$", "loader", "=", "new", "ClassLoader", "(", ")", ";", "if", "(", "isset", "(", "$", "autoloads", "[", "'psr-0'", "]", ")", ")", "{", "foreach", "(", "$", "autoloads", "[", "'psr-0'", "]", "as", "$", "namespace", "=>", "$", "path", ")", "{", "$", "loader", "->", "add", "(", "$", "namespace", ",", "$", "path", ")", ";", "}", "}", "if", "(", "isset", "(", "$", "autoloads", "[", "'psr-4'", "]", ")", ")", "{", "foreach", "(", "$", "autoloads", "[", "'psr-4'", "]", "as", "$", "namespace", "=>", "$", "path", ")", "{", "$", "loader", "->", "addPsr4", "(", "$", "namespace", ",", "$", "path", ")", ";", "}", "}", "return", "$", "loader", ";", "}" ]
Registers an autoloader based on an autoload map returned by parseAutoloads @param array $autoloads see parseAutoloads return value @return ClassLoader
[ "Registers", "an", "autoloader", "based", "on", "an", "autoload", "map", "returned", "by", "parseAutoloads" ]
fa6ad031a939d8d33b211e428fdbdd28cfce238c
https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Autoload/AutoloadGenerator.php#L328-L345
24,559
soda-framework/eloquent-closure
src/Franzose/ClosureTable/Generators/Migration.php
Migration.getPath
protected function getPath($name, $path) { $timestamp = Carbon::now(); if (in_array($timestamp, $this->usedTimestamps)) { $timestamp->addSecond(); } $this->usedTimestamps[] = $timestamp; return $path . '/' . $timestamp->format('Y_m_d_His') . '_' . $this->getName($name) . '.php'; }
php
protected function getPath($name, $path) { $timestamp = Carbon::now(); if (in_array($timestamp, $this->usedTimestamps)) { $timestamp->addSecond(); } $this->usedTimestamps[] = $timestamp; return $path . '/' . $timestamp->format('Y_m_d_His') . '_' . $this->getName($name) . '.php'; }
[ "protected", "function", "getPath", "(", "$", "name", ",", "$", "path", ")", "{", "$", "timestamp", "=", "Carbon", "::", "now", "(", ")", ";", "if", "(", "in_array", "(", "$", "timestamp", ",", "$", "this", "->", "usedTimestamps", ")", ")", "{", "$", "timestamp", "->", "addSecond", "(", ")", ";", "}", "$", "this", "->", "usedTimestamps", "[", "]", "=", "$", "timestamp", ";", "return", "$", "path", ".", "'/'", ".", "$", "timestamp", "->", "format", "(", "'Y_m_d_His'", ")", ".", "'_'", ".", "$", "this", "->", "getName", "(", "$", "name", ")", ".", "'.php'", ";", "}" ]
Constructs path to migration file in Laravel style. @param $name @param $path @return string
[ "Constructs", "path", "to", "migration", "file", "in", "Laravel", "style", "." ]
0747773b476c3e15f599b97977261c51503d2f00
https://github.com/soda-framework/eloquent-closure/blob/0747773b476c3e15f599b97977261c51503d2f00/src/Franzose/ClosureTable/Generators/Migration.php#L83-L93
24,560
heidelpay/PhpDoc
src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php
ProjectDescriptorBuilder.validate
public function validate($descriptor) { $violations = $this->validator->validate($descriptor); $errors = new Collection(); /** @var ConstraintViolation $violation */ foreach ($violations as $violation) { $errors->add( new Error( $this->mapCodeToSeverity($violation->getCode()), $violation->getMessageTemplate(), $descriptor->getLine(), $violation->getMessageParameters() + array($descriptor->getFullyQualifiedStructuralElementName()) ) ); } return $errors; }
php
public function validate($descriptor) { $violations = $this->validator->validate($descriptor); $errors = new Collection(); /** @var ConstraintViolation $violation */ foreach ($violations as $violation) { $errors->add( new Error( $this->mapCodeToSeverity($violation->getCode()), $violation->getMessageTemplate(), $descriptor->getLine(), $violation->getMessageParameters() + array($descriptor->getFullyQualifiedStructuralElementName()) ) ); } return $errors; }
[ "public", "function", "validate", "(", "$", "descriptor", ")", "{", "$", "violations", "=", "$", "this", "->", "validator", "->", "validate", "(", "$", "descriptor", ")", ";", "$", "errors", "=", "new", "Collection", "(", ")", ";", "/** @var ConstraintViolation $violation */", "foreach", "(", "$", "violations", "as", "$", "violation", ")", "{", "$", "errors", "->", "add", "(", "new", "Error", "(", "$", "this", "->", "mapCodeToSeverity", "(", "$", "violation", "->", "getCode", "(", ")", ")", ",", "$", "violation", "->", "getMessageTemplate", "(", ")", ",", "$", "descriptor", "->", "getLine", "(", ")", ",", "$", "violation", "->", "getMessageParameters", "(", ")", "+", "array", "(", "$", "descriptor", "->", "getFullyQualifiedStructuralElementName", "(", ")", ")", ")", ")", ";", "}", "return", "$", "errors", ";", "}" ]
Validates the contents of the Descriptor and outputs warnings and error if something is amiss. @param DescriptorAbstract $descriptor @return Collection
[ "Validates", "the", "contents", "of", "the", "Descriptor", "and", "outputs", "warnings", "and", "error", "if", "something", "is", "amiss", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php#L185-L203
24,561
heidelpay/PhpDoc
src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php
ProjectDescriptorBuilder.mapCodeToSeverity
protected function mapCodeToSeverity($code) { if (is_int($code) && $this->translator->translate('VAL:ERRLVL-'.$code)) { $severity = $this->translator->translate('VAL:ERRLVL-'.$code); } else { $severity = LogLevel::ERROR; } return $severity; }
php
protected function mapCodeToSeverity($code) { if (is_int($code) && $this->translator->translate('VAL:ERRLVL-'.$code)) { $severity = $this->translator->translate('VAL:ERRLVL-'.$code); } else { $severity = LogLevel::ERROR; } return $severity; }
[ "protected", "function", "mapCodeToSeverity", "(", "$", "code", ")", "{", "if", "(", "is_int", "(", "$", "code", ")", "&&", "$", "this", "->", "translator", "->", "translate", "(", "'VAL:ERRLVL-'", ".", "$", "code", ")", ")", "{", "$", "severity", "=", "$", "this", "->", "translator", "->", "translate", "(", "'VAL:ERRLVL-'", ".", "$", "code", ")", ";", "}", "else", "{", "$", "severity", "=", "LogLevel", "::", "ERROR", ";", "}", "return", "$", "severity", ";", "}" ]
Map error code to severity. @param int $code @return string
[ "Map", "error", "code", "to", "severity", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php#L261-L270
24,562
ekuiter/feature-php
FeaturePhp/Model/ConfigurationRenderer.php
ConfigurationRenderer._render
public function _render($textOnly) { $str = ""; if ($textOnly) $str .= "\nModel Analysis\n==============\n"; else $str .= "<h2>Model Analysis</h2>"; $str .= $this->analyzeModel($this->configuration->getModel(), $textOnly); if ($textOnly) $str .= "\nConfiguration Analysis\n======================\n"; else $str .= "</td><td valign='top'><h2>Configuration Analysis</h2>"; $str .= $this->analyzeConfiguration($this->configuration, $textOnly); return $str; }
php
public function _render($textOnly) { $str = ""; if ($textOnly) $str .= "\nModel Analysis\n==============\n"; else $str .= "<h2>Model Analysis</h2>"; $str .= $this->analyzeModel($this->configuration->getModel(), $textOnly); if ($textOnly) $str .= "\nConfiguration Analysis\n======================\n"; else $str .= "</td><td valign='top'><h2>Configuration Analysis</h2>"; $str .= $this->analyzeConfiguration($this->configuration, $textOnly); return $str; }
[ "public", "function", "_render", "(", "$", "textOnly", ")", "{", "$", "str", "=", "\"\"", ";", "if", "(", "$", "textOnly", ")", "$", "str", ".=", "\"\\nModel Analysis\\n==============\\n\"", ";", "else", "$", "str", ".=", "\"<h2>Model Analysis</h2>\"", ";", "$", "str", ".=", "$", "this", "->", "analyzeModel", "(", "$", "this", "->", "configuration", "->", "getModel", "(", ")", ",", "$", "textOnly", ")", ";", "if", "(", "$", "textOnly", ")", "$", "str", ".=", "\"\\nConfiguration Analysis\\n======================\\n\"", ";", "else", "$", "str", ".=", "\"</td><td valign='top'><h2>Configuration Analysis</h2>\"", ";", "$", "str", ".=", "$", "this", "->", "analyzeConfiguration", "(", "$", "this", "->", "configuration", ",", "$", "textOnly", ")", ";", "return", "$", "str", ";", "}" ]
Returns the model and configuration analysis. @param bool $textOnly whether to render text or HTML @return string
[ "Returns", "the", "model", "and", "configuration", "analysis", "." ]
daf4a59098802fedcfd1f1a1d07847fcf2fea7bf
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Model/ConfigurationRenderer.php#L43-L56
24,563
ekuiter/feature-php
FeaturePhp/Model/ConfigurationRenderer.php
ConfigurationRenderer.analyzeModel
private function analyzeModel($model, $textOnly) { $featureNum = count($model->getFeatures()); $rootFeatureName = $model->getRootFeature()->getName(); $constraintNum = count($model->getConstraintSolver()->getConstraints()); $ruleNum = count($model->getXmlModel()->getRules()); $str = ""; $maxLen = fphp\Helper\_String::getMaxLength($model->getFeatures(), "getName"); if ($textOnly) $str .= "The given feature model with the root feature " . "$this->accentColor$rootFeatureName$this->defaultColor has the following $featureNum features:\n\n"; else { $str .= "<div>"; $str .= "<p>The given feature model with the root feature <span class='feature'>$rootFeatureName</span> " . "has the following $featureNum features:</p>"; $str .= "<ul>"; } foreach ($model->getFeatures() as $feature) { $description = $feature->getDescription(); if ($this->productLine) $class = $this->productLine->getArtifact($feature)->isGenerated() ? "" : "unimplemented"; else $class = ""; if ($textOnly) { $color = $class === "unimplemented" ? "" : $this->accentColor; $str .= sprintf("%s%-{$maxLen}s$this->defaultColor %s\n", $color, $feature->getName(), fphp\Helper\_String::truncate($description)); } else $str .= "<li><span class='feature $class'>" . $feature->getName() . ($description ? "</span><br /><span style='font-size: 0.8em'>" . str_replace("\n", "<br />", $description) . "</span>" : "") . "</li>"; } if ($textOnly) $str .= "\nThere are $constraintNum feature constraints ($ruleNum of them cross-tree constraints).\n"; else { $str .= "</ul>"; $str .= "<p>There are $constraintNum feature constraints ($ruleNum of them cross-tree constraints).</p>"; $str .= "</div>"; } return $str; }
php
private function analyzeModel($model, $textOnly) { $featureNum = count($model->getFeatures()); $rootFeatureName = $model->getRootFeature()->getName(); $constraintNum = count($model->getConstraintSolver()->getConstraints()); $ruleNum = count($model->getXmlModel()->getRules()); $str = ""; $maxLen = fphp\Helper\_String::getMaxLength($model->getFeatures(), "getName"); if ($textOnly) $str .= "The given feature model with the root feature " . "$this->accentColor$rootFeatureName$this->defaultColor has the following $featureNum features:\n\n"; else { $str .= "<div>"; $str .= "<p>The given feature model with the root feature <span class='feature'>$rootFeatureName</span> " . "has the following $featureNum features:</p>"; $str .= "<ul>"; } foreach ($model->getFeatures() as $feature) { $description = $feature->getDescription(); if ($this->productLine) $class = $this->productLine->getArtifact($feature)->isGenerated() ? "" : "unimplemented"; else $class = ""; if ($textOnly) { $color = $class === "unimplemented" ? "" : $this->accentColor; $str .= sprintf("%s%-{$maxLen}s$this->defaultColor %s\n", $color, $feature->getName(), fphp\Helper\_String::truncate($description)); } else $str .= "<li><span class='feature $class'>" . $feature->getName() . ($description ? "</span><br /><span style='font-size: 0.8em'>" . str_replace("\n", "<br />", $description) . "</span>" : "") . "</li>"; } if ($textOnly) $str .= "\nThere are $constraintNum feature constraints ($ruleNum of them cross-tree constraints).\n"; else { $str .= "</ul>"; $str .= "<p>There are $constraintNum feature constraints ($ruleNum of them cross-tree constraints).</p>"; $str .= "</div>"; } return $str; }
[ "private", "function", "analyzeModel", "(", "$", "model", ",", "$", "textOnly", ")", "{", "$", "featureNum", "=", "count", "(", "$", "model", "->", "getFeatures", "(", ")", ")", ";", "$", "rootFeatureName", "=", "$", "model", "->", "getRootFeature", "(", ")", "->", "getName", "(", ")", ";", "$", "constraintNum", "=", "count", "(", "$", "model", "->", "getConstraintSolver", "(", ")", "->", "getConstraints", "(", ")", ")", ";", "$", "ruleNum", "=", "count", "(", "$", "model", "->", "getXmlModel", "(", ")", "->", "getRules", "(", ")", ")", ";", "$", "str", "=", "\"\"", ";", "$", "maxLen", "=", "fphp", "\\", "Helper", "\\", "_String", "::", "getMaxLength", "(", "$", "model", "->", "getFeatures", "(", ")", ",", "\"getName\"", ")", ";", "if", "(", "$", "textOnly", ")", "$", "str", ".=", "\"The given feature model with the root feature \"", ".", "\"$this->accentColor$rootFeatureName$this->defaultColor has the following $featureNum features:\\n\\n\"", ";", "else", "{", "$", "str", ".=", "\"<div>\"", ";", "$", "str", ".=", "\"<p>The given feature model with the root feature <span class='feature'>$rootFeatureName</span> \"", ".", "\"has the following $featureNum features:</p>\"", ";", "$", "str", ".=", "\"<ul>\"", ";", "}", "foreach", "(", "$", "model", "->", "getFeatures", "(", ")", "as", "$", "feature", ")", "{", "$", "description", "=", "$", "feature", "->", "getDescription", "(", ")", ";", "if", "(", "$", "this", "->", "productLine", ")", "$", "class", "=", "$", "this", "->", "productLine", "->", "getArtifact", "(", "$", "feature", ")", "->", "isGenerated", "(", ")", "?", "\"\"", ":", "\"unimplemented\"", ";", "else", "$", "class", "=", "\"\"", ";", "if", "(", "$", "textOnly", ")", "{", "$", "color", "=", "$", "class", "===", "\"unimplemented\"", "?", "\"\"", ":", "$", "this", "->", "accentColor", ";", "$", "str", ".=", "sprintf", "(", "\"%s%-{$maxLen}s$this->defaultColor %s\\n\"", ",", "$", "color", ",", "$", "feature", "->", "getName", "(", ")", ",", "fphp", "\\", "Helper", "\\", "_String", "::", "truncate", "(", "$", "description", ")", ")", ";", "}", "else", "$", "str", ".=", "\"<li><span class='feature $class'>\"", ".", "$", "feature", "->", "getName", "(", ")", ".", "(", "$", "description", "?", "\"</span><br /><span style='font-size: 0.8em'>\"", ".", "str_replace", "(", "\"\\n\"", ",", "\"<br />\"", ",", "$", "description", ")", ".", "\"</span>\"", ":", "\"\"", ")", ".", "\"</li>\"", ";", "}", "if", "(", "$", "textOnly", ")", "$", "str", ".=", "\"\\nThere are $constraintNum feature constraints ($ruleNum of them cross-tree constraints).\\n\"", ";", "else", "{", "$", "str", ".=", "\"</ul>\"", ";", "$", "str", ".=", "\"<p>There are $constraintNum feature constraints ($ruleNum of them cross-tree constraints).</p>\"", ";", "$", "str", ".=", "\"</div>\"", ";", "}", "return", "$", "str", ";", "}" ]
Returns a model analysis. @param Model $model @param bool $textOnly whether to render text or HTML @return string
[ "Returns", "a", "model", "analysis", "." ]
daf4a59098802fedcfd1f1a1d07847fcf2fea7bf
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Model/ConfigurationRenderer.php#L64-L110
24,564
ekuiter/feature-php
FeaturePhp/Model/ConfigurationRenderer.php
ConfigurationRenderer.analyzeConfiguration
private function analyzeConfiguration($configuration, $textOnly) { $validity = $configuration->isValid() ? "valid" : "invalid"; $str = ""; $selectedColor = "\033[1;32m"; $deselectedColor = "\033[1;31m"; if ($textOnly) $str .= "The given configuration has the following feature selection:\n\n"; else { $str .= "<div style='font-family: monospace'>"; $str .= "<p>The given configuration has the following feature selection:</p>"; $str .= "<ul>"; } foreach ($configuration->getModel()->getFeatures() as $feature) { $isSelected = Feature::has($configuration->getSelectedFeatures(), $feature); $mark = $isSelected ? "x" : "&nbsp;"; $class = $isSelected ? "selected" : "deselected"; if ($textOnly) $str .= "[" . ($isSelected ? "x" : " ") . "] " . ($isSelected ? $selectedColor : $deselectedColor) . $feature->getName() . "$this->defaultColor\n"; else $str .= "<li>[$mark] <span class='feature $class'>" . $feature->getName() . "</span></li>"; } if ($textOnly) $str .= "\nThis configuration is $validity.\n"; else { $str .= "</ul>"; $str .= "<p>This configuration is $validity.</p>"; $str .= "</div>"; } return $str; }
php
private function analyzeConfiguration($configuration, $textOnly) { $validity = $configuration->isValid() ? "valid" : "invalid"; $str = ""; $selectedColor = "\033[1;32m"; $deselectedColor = "\033[1;31m"; if ($textOnly) $str .= "The given configuration has the following feature selection:\n\n"; else { $str .= "<div style='font-family: monospace'>"; $str .= "<p>The given configuration has the following feature selection:</p>"; $str .= "<ul>"; } foreach ($configuration->getModel()->getFeatures() as $feature) { $isSelected = Feature::has($configuration->getSelectedFeatures(), $feature); $mark = $isSelected ? "x" : "&nbsp;"; $class = $isSelected ? "selected" : "deselected"; if ($textOnly) $str .= "[" . ($isSelected ? "x" : " ") . "] " . ($isSelected ? $selectedColor : $deselectedColor) . $feature->getName() . "$this->defaultColor\n"; else $str .= "<li>[$mark] <span class='feature $class'>" . $feature->getName() . "</span></li>"; } if ($textOnly) $str .= "\nThis configuration is $validity.\n"; else { $str .= "</ul>"; $str .= "<p>This configuration is $validity.</p>"; $str .= "</div>"; } return $str; }
[ "private", "function", "analyzeConfiguration", "(", "$", "configuration", ",", "$", "textOnly", ")", "{", "$", "validity", "=", "$", "configuration", "->", "isValid", "(", ")", "?", "\"valid\"", ":", "\"invalid\"", ";", "$", "str", "=", "\"\"", ";", "$", "selectedColor", "=", "\"\\033[1;32m\"", ";", "$", "deselectedColor", "=", "\"\\033[1;31m\"", ";", "if", "(", "$", "textOnly", ")", "$", "str", ".=", "\"The given configuration has the following feature selection:\\n\\n\"", ";", "else", "{", "$", "str", ".=", "\"<div style='font-family: monospace'>\"", ";", "$", "str", ".=", "\"<p>The given configuration has the following feature selection:</p>\"", ";", "$", "str", ".=", "\"<ul>\"", ";", "}", "foreach", "(", "$", "configuration", "->", "getModel", "(", ")", "->", "getFeatures", "(", ")", "as", "$", "feature", ")", "{", "$", "isSelected", "=", "Feature", "::", "has", "(", "$", "configuration", "->", "getSelectedFeatures", "(", ")", ",", "$", "feature", ")", ";", "$", "mark", "=", "$", "isSelected", "?", "\"x\"", ":", "\"&nbsp;\"", ";", "$", "class", "=", "$", "isSelected", "?", "\"selected\"", ":", "\"deselected\"", ";", "if", "(", "$", "textOnly", ")", "$", "str", ".=", "\"[\"", ".", "(", "$", "isSelected", "?", "\"x\"", ":", "\" \"", ")", ".", "\"] \"", ".", "(", "$", "isSelected", "?", "$", "selectedColor", ":", "$", "deselectedColor", ")", ".", "$", "feature", "->", "getName", "(", ")", ".", "\"$this->defaultColor\\n\"", ";", "else", "$", "str", ".=", "\"<li>[$mark] <span class='feature $class'>\"", ".", "$", "feature", "->", "getName", "(", ")", ".", "\"</span></li>\"", ";", "}", "if", "(", "$", "textOnly", ")", "$", "str", ".=", "\"\\nThis configuration is $validity.\\n\"", ";", "else", "{", "$", "str", ".=", "\"</ul>\"", ";", "$", "str", ".=", "\"<p>This configuration is $validity.</p>\"", ";", "$", "str", ".=", "\"</div>\"", ";", "}", "return", "$", "str", ";", "}" ]
Returns a configuration analysis. @param Configuration $configuration @param bool $textOnly whether to render text or HTML @return string
[ "Returns", "a", "configuration", "analysis", "." ]
daf4a59098802fedcfd1f1a1d07847fcf2fea7bf
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/Model/ConfigurationRenderer.php#L118-L153
24,565
petrica/php-statsd-system
Config/Definition/ConfigDefinition.php
ConfigDefinition.getConfigTreeBuilder
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('gauges'); $rootNode ->useAttributeAsKey('path') ->prototype('array') ->children() ->scalarNode('class') ->isRequired() ->cannotBeEmpty() ->end() ->variableNode('arguments')->end() ->end(); return $treeBuilder; }
php
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('gauges'); $rootNode ->useAttributeAsKey('path') ->prototype('array') ->children() ->scalarNode('class') ->isRequired() ->cannotBeEmpty() ->end() ->variableNode('arguments')->end() ->end(); return $treeBuilder; }
[ "public", "function", "getConfigTreeBuilder", "(", ")", "{", "$", "treeBuilder", "=", "new", "TreeBuilder", "(", ")", ";", "$", "rootNode", "=", "$", "treeBuilder", "->", "root", "(", "'gauges'", ")", ";", "$", "rootNode", "->", "useAttributeAsKey", "(", "'path'", ")", "->", "prototype", "(", "'array'", ")", "->", "children", "(", ")", "->", "scalarNode", "(", "'class'", ")", "->", "isRequired", "(", ")", "->", "cannotBeEmpty", "(", ")", "->", "end", "(", ")", "->", "variableNode", "(", "'arguments'", ")", "->", "end", "(", ")", "->", "end", "(", ")", ";", "return", "$", "treeBuilder", ";", "}" ]
Provides configuration mapping @return TreeBuilder
[ "Provides", "configuration", "mapping" ]
c476be3514a631a605737888bb8f6eb096789c9d
https://github.com/petrica/php-statsd-system/blob/c476be3514a631a605737888bb8f6eb096789c9d/Config/Definition/ConfigDefinition.php#L24-L40
24,566
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Linker/Linker.php
Linker.execute
public function execute(ProjectDescriptor $project) { $this->setObjectAliasesList($project->getIndexes()->elements->getAll()); $this->substitute($project); }
php
public function execute(ProjectDescriptor $project) { $this->setObjectAliasesList($project->getIndexes()->elements->getAll()); $this->substitute($project); }
[ "public", "function", "execute", "(", "ProjectDescriptor", "$", "project", ")", "{", "$", "this", "->", "setObjectAliasesList", "(", "$", "project", "->", "getIndexes", "(", ")", "->", "elements", "->", "getAll", "(", ")", ")", ";", "$", "this", "->", "substitute", "(", "$", "project", ")", ";", "}" ]
Executes the linker. @param ProjectDescriptor $project Representation of the Object Graph that can be manipulated. @return void
[ "Executes", "the", "linker", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Linker/Linker.php#L82-L86
24,567
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Linker/Linker.php
Linker.substitute
public function substitute($item, $container = null) { $result = null; if (is_string($item)) { $result = $this->findAlias($item, $container); } elseif (is_array($item) || ($item instanceof \Traversable && ! $item instanceof ProjectInterface)) { $isModified = false; foreach ($item as $key => $element) { $isModified = true; $element = $this->substitute($element, $container); if ($element !== null) { $item[$key] = $element; } } if ($isModified) { $result = $item; } } elseif (is_object($item) && $item instanceof UnknownTypeDescriptor) { $alias = $this->findAlias($item->getName()); $result = $alias ?: $item; } elseif (is_object($item)) { $hash = spl_object_hash($item); if (isset($this->processedObjects[$hash])) { // if analyzed; just return return null; } $newContainer = ($this->isDescriptorContainer($item)) ? $item : $container; $this->processedObjects[$hash] = true; $objectClassName = get_class($item); $fieldNames = isset($this->substitutions[$objectClassName]) ? $this->substitutions[$objectClassName] : array(); foreach ($fieldNames as $fieldName) { $fieldValue = $this->findFieldValue($item, $fieldName); $response = $this->substitute($fieldValue, $newContainer); // if the returned response is not an object it must be grafted on the calling object if ($response !== null) { $setter = 'set'.ucfirst($fieldName); $item->$setter($response); } } } return $result; }
php
public function substitute($item, $container = null) { $result = null; if (is_string($item)) { $result = $this->findAlias($item, $container); } elseif (is_array($item) || ($item instanceof \Traversable && ! $item instanceof ProjectInterface)) { $isModified = false; foreach ($item as $key => $element) { $isModified = true; $element = $this->substitute($element, $container); if ($element !== null) { $item[$key] = $element; } } if ($isModified) { $result = $item; } } elseif (is_object($item) && $item instanceof UnknownTypeDescriptor) { $alias = $this->findAlias($item->getName()); $result = $alias ?: $item; } elseif (is_object($item)) { $hash = spl_object_hash($item); if (isset($this->processedObjects[$hash])) { // if analyzed; just return return null; } $newContainer = ($this->isDescriptorContainer($item)) ? $item : $container; $this->processedObjects[$hash] = true; $objectClassName = get_class($item); $fieldNames = isset($this->substitutions[$objectClassName]) ? $this->substitutions[$objectClassName] : array(); foreach ($fieldNames as $fieldName) { $fieldValue = $this->findFieldValue($item, $fieldName); $response = $this->substitute($fieldValue, $newContainer); // if the returned response is not an object it must be grafted on the calling object if ($response !== null) { $setter = 'set'.ucfirst($fieldName); $item->$setter($response); } } } return $result; }
[ "public", "function", "substitute", "(", "$", "item", ",", "$", "container", "=", "null", ")", "{", "$", "result", "=", "null", ";", "if", "(", "is_string", "(", "$", "item", ")", ")", "{", "$", "result", "=", "$", "this", "->", "findAlias", "(", "$", "item", ",", "$", "container", ")", ";", "}", "elseif", "(", "is_array", "(", "$", "item", ")", "||", "(", "$", "item", "instanceof", "\\", "Traversable", "&&", "!", "$", "item", "instanceof", "ProjectInterface", ")", ")", "{", "$", "isModified", "=", "false", ";", "foreach", "(", "$", "item", "as", "$", "key", "=>", "$", "element", ")", "{", "$", "isModified", "=", "true", ";", "$", "element", "=", "$", "this", "->", "substitute", "(", "$", "element", ",", "$", "container", ")", ";", "if", "(", "$", "element", "!==", "null", ")", "{", "$", "item", "[", "$", "key", "]", "=", "$", "element", ";", "}", "}", "if", "(", "$", "isModified", ")", "{", "$", "result", "=", "$", "item", ";", "}", "}", "elseif", "(", "is_object", "(", "$", "item", ")", "&&", "$", "item", "instanceof", "UnknownTypeDescriptor", ")", "{", "$", "alias", "=", "$", "this", "->", "findAlias", "(", "$", "item", "->", "getName", "(", ")", ")", ";", "$", "result", "=", "$", "alias", "?", ":", "$", "item", ";", "}", "elseif", "(", "is_object", "(", "$", "item", ")", ")", "{", "$", "hash", "=", "spl_object_hash", "(", "$", "item", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "processedObjects", "[", "$", "hash", "]", ")", ")", "{", "// if analyzed; just return", "return", "null", ";", "}", "$", "newContainer", "=", "(", "$", "this", "->", "isDescriptorContainer", "(", "$", "item", ")", ")", "?", "$", "item", ":", "$", "container", ";", "$", "this", "->", "processedObjects", "[", "$", "hash", "]", "=", "true", ";", "$", "objectClassName", "=", "get_class", "(", "$", "item", ")", ";", "$", "fieldNames", "=", "isset", "(", "$", "this", "->", "substitutions", "[", "$", "objectClassName", "]", ")", "?", "$", "this", "->", "substitutions", "[", "$", "objectClassName", "]", ":", "array", "(", ")", ";", "foreach", "(", "$", "fieldNames", "as", "$", "fieldName", ")", "{", "$", "fieldValue", "=", "$", "this", "->", "findFieldValue", "(", "$", "item", ",", "$", "fieldName", ")", ";", "$", "response", "=", "$", "this", "->", "substitute", "(", "$", "fieldValue", ",", "$", "newContainer", ")", ";", "// if the returned response is not an object it must be grafted on the calling object", "if", "(", "$", "response", "!==", "null", ")", "{", "$", "setter", "=", "'set'", ".", "ucfirst", "(", "$", "fieldName", ")", ";", "$", "item", "->", "$", "setter", "(", "$", "response", ")", ";", "}", "}", "}", "return", "$", "result", ";", "}" ]
Substitutes the given item or its children's FQCN with an object alias. This method may do either of the following depending on the item's type String If the given item is a string then this method will attempt to find an appropriate Class, Interface or TraitDescriptor object and return that. See {@see findAlias()} for more information on the normalization of these strings. Array or Traversable Iterate through each item, pass each key's contents to a new call to substitute and replace the key's contents if the contents is not an object (objects automatically update and saves performance). Object Determines all eligible substitutions using the substitutions property, construct a getter and retrieve the field's contents. Pass these contents to a new call of substitute and use a setter to replace the field's contents if anything other than null is returned. This method will return null if no substitution was possible and all of the above should not update the parent item when null is passed. @param string|object|\Traversable|array $item @param DescriptorAbstract|null $container A descriptor that acts as container for all elements underneath or null if there is no current container. @return null|string|DescriptorAbstract
[ "Substitutes", "the", "given", "item", "or", "its", "children", "s", "FQCN", "with", "an", "object", "alias", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Linker/Linker.php#L138-L189
24,568
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Linker/Linker.php
Linker.isDescriptorContainer
protected function isDescriptorContainer($item) { return $item instanceof FileDescriptor || $item instanceof NamespaceDescriptor || $item instanceof ClassDescriptor || $item instanceof TraitDescriptor || $item instanceof InterfaceDescriptor; }
php
protected function isDescriptorContainer($item) { return $item instanceof FileDescriptor || $item instanceof NamespaceDescriptor || $item instanceof ClassDescriptor || $item instanceof TraitDescriptor || $item instanceof InterfaceDescriptor; }
[ "protected", "function", "isDescriptorContainer", "(", "$", "item", ")", "{", "return", "$", "item", "instanceof", "FileDescriptor", "||", "$", "item", "instanceof", "NamespaceDescriptor", "||", "$", "item", "instanceof", "ClassDescriptor", "||", "$", "item", "instanceof", "TraitDescriptor", "||", "$", "item", "instanceof", "InterfaceDescriptor", ";", "}" ]
Returns true if the given Descriptor is a container type. @param DescriptorAbstract|mixed $item @return bool
[ "Returns", "true", "if", "the", "given", "Descriptor", "is", "a", "container", "type", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Linker/Linker.php#L265-L272
24,569
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Linker/Linker.php
Linker.replacePseudoTypes
protected function replacePseudoTypes($fqsen, $container) { $pseudoTypes = array('self', '$this'); foreach ($pseudoTypes as $pseudoType) { if ((strpos($fqsen, $pseudoType . '::') === 0 || $fqsen === $pseudoType) && $container) { $fqsen = $container->getFullyQualifiedStructuralElementName() . substr($fqsen, strlen($pseudoType)); } } return $fqsen; }
php
protected function replacePseudoTypes($fqsen, $container) { $pseudoTypes = array('self', '$this'); foreach ($pseudoTypes as $pseudoType) { if ((strpos($fqsen, $pseudoType . '::') === 0 || $fqsen === $pseudoType) && $container) { $fqsen = $container->getFullyQualifiedStructuralElementName() . substr($fqsen, strlen($pseudoType)); } } return $fqsen; }
[ "protected", "function", "replacePseudoTypes", "(", "$", "fqsen", ",", "$", "container", ")", "{", "$", "pseudoTypes", "=", "array", "(", "'self'", ",", "'$this'", ")", ";", "foreach", "(", "$", "pseudoTypes", "as", "$", "pseudoType", ")", "{", "if", "(", "(", "strpos", "(", "$", "fqsen", ",", "$", "pseudoType", ".", "'::'", ")", "===", "0", "||", "$", "fqsen", "===", "$", "pseudoType", ")", "&&", "$", "container", ")", "{", "$", "fqsen", "=", "$", "container", "->", "getFullyQualifiedStructuralElementName", "(", ")", ".", "substr", "(", "$", "fqsen", ",", "strlen", "(", "$", "pseudoType", ")", ")", ";", "}", "}", "return", "$", "fqsen", ";", "}" ]
Replaces pseudo-types, such as `self`, into a normalized version based on the last container that was encountered. @param string $fqsen @param DescriptorAbstract|null $container @return string
[ "Replaces", "pseudo", "-", "types", "such", "as", "self", "into", "a", "normalized", "version", "based", "on", "the", "last", "container", "that", "was", "encountered", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Linker/Linker.php#L283-L294
24,570
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Linker/Linker.php
Linker.fetchElementByFqsen
protected function fetchElementByFqsen($fqsen) { return isset($this->elementList[$fqsen]) ? $this->elementList[$fqsen] : null; }
php
protected function fetchElementByFqsen($fqsen) { return isset($this->elementList[$fqsen]) ? $this->elementList[$fqsen] : null; }
[ "protected", "function", "fetchElementByFqsen", "(", "$", "fqsen", ")", "{", "return", "isset", "(", "$", "this", "->", "elementList", "[", "$", "fqsen", "]", ")", "?", "$", "this", "->", "elementList", "[", "$", "fqsen", "]", ":", "null", ";", "}" ]
Attempts to find an element with the given Fqsen in the list of elements for this project and returns null if it cannot find it. @param string $fqsen @return DescriptorAbstract|null
[ "Attempts", "to", "find", "an", "element", "with", "the", "given", "Fqsen", "in", "the", "list", "of", "elements", "for", "this", "project", "and", "returns", "null", "if", "it", "cannot", "find", "it", "." ]
5ac9e842cbd4cbb70900533b240c131f3515ee02
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Linker/Linker.php#L356-L359
24,571
hametuha/wpametu
src/WPametu/UI/Widget.php
Widget.widget
public function widget($args, $instance){ $content = $this->widget_content($instance); if( $content ){ echo $args['before_widget']; if( isset($instance['title']) && !empty($instance['title']) ){ echo $args['before_title']; echo $instance['title']; echo $args['after_title']; } echo $content; echo $args['after_widget']; } }
php
public function widget($args, $instance){ $content = $this->widget_content($instance); if( $content ){ echo $args['before_widget']; if( isset($instance['title']) && !empty($instance['title']) ){ echo $args['before_title']; echo $instance['title']; echo $args['after_title']; } echo $content; echo $args['after_widget']; } }
[ "public", "function", "widget", "(", "$", "args", ",", "$", "instance", ")", "{", "$", "content", "=", "$", "this", "->", "widget_content", "(", "$", "instance", ")", ";", "if", "(", "$", "content", ")", "{", "echo", "$", "args", "[", "'before_widget'", "]", ";", "if", "(", "isset", "(", "$", "instance", "[", "'title'", "]", ")", "&&", "!", "empty", "(", "$", "instance", "[", "'title'", "]", ")", ")", "{", "echo", "$", "args", "[", "'before_title'", "]", ";", "echo", "$", "instance", "[", "'title'", "]", ";", "echo", "$", "args", "[", "'after_title'", "]", ";", "}", "echo", "$", "content", ";", "echo", "$", "args", "[", "'after_widget'", "]", ";", "}", "}" ]
Show widget content @param array $args @param array $instance
[ "Show", "widget", "content" ]
0939373800815a8396291143d2a57967340da5aa
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Widget.php#L82-L94
24,572
hametuha/wpametu
src/WPametu/UI/Widget.php
Widget.fill
protected function fill($placeholder, $instance){ switch( $placeholder ){ case 'title': return get_the_title(); break; case 'url': return get_permalink(); break; case 'excerpt': return get_the_excerpt(); break; case 'date': return get_the_date(); break; case 'modified': return get_the_modified_date(); break; case 'author': return get_the_author(); break; default: return false; break; } }
php
protected function fill($placeholder, $instance){ switch( $placeholder ){ case 'title': return get_the_title(); break; case 'url': return get_permalink(); break; case 'excerpt': return get_the_excerpt(); break; case 'date': return get_the_date(); break; case 'modified': return get_the_modified_date(); break; case 'author': return get_the_author(); break; default: return false; break; } }
[ "protected", "function", "fill", "(", "$", "placeholder", ",", "$", "instance", ")", "{", "switch", "(", "$", "placeholder", ")", "{", "case", "'title'", ":", "return", "get_the_title", "(", ")", ";", "break", ";", "case", "'url'", ":", "return", "get_permalink", "(", ")", ";", "break", ";", "case", "'excerpt'", ":", "return", "get_the_excerpt", "(", ")", ";", "break", ";", "case", "'date'", ":", "return", "get_the_date", "(", ")", ";", "break", ";", "case", "'modified'", ":", "return", "get_the_modified_date", "(", ")", ";", "break", ";", "case", "'author'", ":", "return", "get_the_author", "(", ")", ";", "break", ";", "default", ":", "return", "false", ";", "break", ";", "}", "}" ]
Get placeholder's content @param string $placeholder @param array $instance Widget's setting @return bool|string
[ "Get", "placeholder", "s", "content" ]
0939373800815a8396291143d2a57967340da5aa
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Widget.php#L146-L170
24,573
miguelibero/meinhof
src/Meinhof/Action/SetupSiteAction.php
SetupSiteAction.take
public function take() { $params = array_merge(array( 'author' => null, 'categories' => null ), $this->input->getOptions()); $params = $this->fixAuthorSetupParameters($params); $params = $this->fixCategoriesSetupParameters($params); $this->writeOutputLine("writing site configuration...", 2); $this->store->write($params); $this->writeOutputLine("done", 2); }
php
public function take() { $params = array_merge(array( 'author' => null, 'categories' => null ), $this->input->getOptions()); $params = $this->fixAuthorSetupParameters($params); $params = $this->fixCategoriesSetupParameters($params); $this->writeOutputLine("writing site configuration...", 2); $this->store->write($params); $this->writeOutputLine("done", 2); }
[ "public", "function", "take", "(", ")", "{", "$", "params", "=", "array_merge", "(", "array", "(", "'author'", "=>", "null", ",", "'categories'", "=>", "null", ")", ",", "$", "this", "->", "input", "->", "getOptions", "(", ")", ")", ";", "$", "params", "=", "$", "this", "->", "fixAuthorSetupParameters", "(", "$", "params", ")", ";", "$", "params", "=", "$", "this", "->", "fixCategoriesSetupParameters", "(", "$", "params", ")", ";", "$", "this", "->", "writeOutputLine", "(", "\"writing site configuration...\"", ",", "2", ")", ";", "$", "this", "->", "store", "->", "write", "(", "$", "params", ")", ";", "$", "this", "->", "writeOutputLine", "(", "\"done\"", ",", "2", ")", ";", "}" ]
Creates the site structure.
[ "Creates", "the", "site", "structure", "." ]
3a090f08485dc0da3e27463cf349dba374201072
https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Action/SetupSiteAction.php#L44-L59
24,574
miguelibero/meinhof
src/Meinhof/Action/SetupSiteAction.php
SetupSiteAction.fixAuthorSetupParameters
protected function fixAuthorSetupParameters(array $params) { if (!isset($params['author'])) { $params['author'] = null; } if (preg_match('/(.*) <(.+)>/', $params['author'], $m)) { $params['author'] = $m[1]; $params['author-email'] = $m[2]; } else { $params['author-email'] = null; } return $params; }
php
protected function fixAuthorSetupParameters(array $params) { if (!isset($params['author'])) { $params['author'] = null; } if (preg_match('/(.*) <(.+)>/', $params['author'], $m)) { $params['author'] = $m[1]; $params['author-email'] = $m[2]; } else { $params['author-email'] = null; } return $params; }
[ "protected", "function", "fixAuthorSetupParameters", "(", "array", "$", "params", ")", "{", "if", "(", "!", "isset", "(", "$", "params", "[", "'author'", "]", ")", ")", "{", "$", "params", "[", "'author'", "]", "=", "null", ";", "}", "if", "(", "preg_match", "(", "'/(.*) <(.+)>/'", ",", "$", "params", "[", "'author'", "]", ",", "$", "m", ")", ")", "{", "$", "params", "[", "'author'", "]", "=", "$", "m", "[", "1", "]", ";", "$", "params", "[", "'author-email'", "]", "=", "$", "m", "[", "2", "]", ";", "}", "else", "{", "$", "params", "[", "'author-email'", "]", "=", "null", ";", "}", "return", "$", "params", ";", "}" ]
Fixes the author setup parameter. In the setup you can specify an author as `Author Name <author@email.com>`. This function separates this into two different keys, `author` and `author_email`. @param array $params setup parameter array @return array fixed setup parameter array
[ "Fixes", "the", "author", "setup", "parameter", "." ]
3a090f08485dc0da3e27463cf349dba374201072
https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Action/SetupSiteAction.php#L71-L84
24,575
libreworks/caridea-validate
src/Builder.php
Builder.field
public function field(string $field, ...$rules): self { $this->validators[$field] = $this->parser->parse($rules); return $this; }
php
public function field(string $field, ...$rules): self { $this->validators[$field] = $this->parser->parse($rules); return $this; }
[ "public", "function", "field", "(", "string", "$", "field", ",", "...", "$", "rules", ")", ":", "self", "{", "$", "this", "->", "validators", "[", "$", "field", "]", "=", "$", "this", "->", "parser", "->", "parse", "(", "$", "rules", ")", ";", "return", "$", "this", ";", "}" ]
Adds one or more rules to this builder. @param string $field The field to validate @param string|object|array $rules Either a string name, an associative array, or an object with name → arguments @return $this provides a fluent interface
[ "Adds", "one", "or", "more", "rules", "to", "this", "builder", "." ]
625835694d34591bfb1e3b2ce60c2cc28a28d006
https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Builder.php#L58-L62
24,576
libreworks/caridea-validate
src/Builder.php
Builder.build
public function build($ruleset = null): Validator { $validators = array_merge([], $this->validators); if (is_object($ruleset) || (is_array($ruleset) && Parser::isAssociative($ruleset))) { foreach ($ruleset as $field => $rules) { $validators[$field] = $this->parser->parse($rules); } } return new Validator($validators); }
php
public function build($ruleset = null): Validator { $validators = array_merge([], $this->validators); if (is_object($ruleset) || (is_array($ruleset) && Parser::isAssociative($ruleset))) { foreach ($ruleset as $field => $rules) { $validators[$field] = $this->parser->parse($rules); } } return new Validator($validators); }
[ "public", "function", "build", "(", "$", "ruleset", "=", "null", ")", ":", "Validator", "{", "$", "validators", "=", "array_merge", "(", "[", "]", ",", "$", "this", "->", "validators", ")", ";", "if", "(", "is_object", "(", "$", "ruleset", ")", "||", "(", "is_array", "(", "$", "ruleset", ")", "&&", "Parser", "::", "isAssociative", "(", "$", "ruleset", ")", ")", ")", "{", "foreach", "(", "$", "ruleset", "as", "$", "field", "=>", "$", "rules", ")", "{", "$", "validators", "[", "$", "field", "]", "=", "$", "this", "->", "parser", "->", "parse", "(", "$", "rules", ")", ";", "}", "}", "return", "new", "Validator", "(", "$", "validators", ")", ";", "}" ]
Builds a validator for the provided ruleset. ```javascript // rules.json { name: 'required', email: ['required', 'email'], drinks: { one_of: [['coffee', 'tea']] }, phone: {max_length: 10} } ``` ```php $ruleset = json_decode(file_get_contents('rules.json')); $builder = new \Caridea\Validate\Builder(); $validator = $builder->build($ruleset); ``` @param object|array $ruleset Object or associative array (as returned from `json_decode`) with ruleset, or `null` to use defined rules. @return \Caridea\Validate\Validator the built validator
[ "Builds", "a", "validator", "for", "the", "provided", "ruleset", "." ]
625835694d34591bfb1e3b2ce60c2cc28a28d006
https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Builder.php#L86-L95
24,577
gplcart/cli
controllers/commands/Shipping.php
Shipping.cmdGetShipping
public function cmdGetShipping() { $result = $this->getListShipping(); $this->outputFormat($result); $this->outputFormatTableShipping($result); $this->output(); }
php
public function cmdGetShipping() { $result = $this->getListShipping(); $this->outputFormat($result); $this->outputFormatTableShipping($result); $this->output(); }
[ "public", "function", "cmdGetShipping", "(", ")", "{", "$", "result", "=", "$", "this", "->", "getListShipping", "(", ")", ";", "$", "this", "->", "outputFormat", "(", "$", "result", ")", ";", "$", "this", "->", "outputFormatTableShipping", "(", "$", "result", ")", ";", "$", "this", "->", "output", "(", ")", ";", "}" ]
Callback for "shipping-get" command
[ "Callback", "for", "shipping", "-", "get", "command" ]
e57dba53e291a225b4bff0c0d9b23d685dd1c125
https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Shipping.php#L40-L46
24,578
gplcart/cli
controllers/commands/Shipping.php
Shipping.getListShipping
protected function getListShipping() { $id = $this->getParam(0); if (!isset($id)) { $list = $this->shipping->getList(); $this->limitArray($list); return $list; } $method = $this->shipping->get($id); if (empty($method)) { $this->errorAndExit($this->text('Unexpected result')); } return array($method); }
php
protected function getListShipping() { $id = $this->getParam(0); if (!isset($id)) { $list = $this->shipping->getList(); $this->limitArray($list); return $list; } $method = $this->shipping->get($id); if (empty($method)) { $this->errorAndExit($this->text('Unexpected result')); } return array($method); }
[ "protected", "function", "getListShipping", "(", ")", "{", "$", "id", "=", "$", "this", "->", "getParam", "(", "0", ")", ";", "if", "(", "!", "isset", "(", "$", "id", ")", ")", "{", "$", "list", "=", "$", "this", "->", "shipping", "->", "getList", "(", ")", ";", "$", "this", "->", "limitArray", "(", "$", "list", ")", ";", "return", "$", "list", ";", "}", "$", "method", "=", "$", "this", "->", "shipping", "->", "get", "(", "$", "id", ")", ";", "if", "(", "empty", "(", "$", "method", ")", ")", "{", "$", "this", "->", "errorAndExit", "(", "$", "this", "->", "text", "(", "'Unexpected result'", ")", ")", ";", "}", "return", "array", "(", "$", "method", ")", ";", "}" ]
Returns an array of shipping methods @return array
[ "Returns", "an", "array", "of", "shipping", "methods" ]
e57dba53e291a225b4bff0c0d9b23d685dd1c125
https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Shipping.php#L52-L69
24,579
perryflynn/PerrysLambda
src/PerrysLambda/Converter/ListConverter.php
ListConverter.setArraySource
public function setArraySource(array $data=null) { if($data===null) { $this->iterator = null; } else { $this->iterator = new \ArrayIterator($data); } }
php
public function setArraySource(array $data=null) { if($data===null) { $this->iterator = null; } else { $this->iterator = new \ArrayIterator($data); } }
[ "public", "function", "setArraySource", "(", "array", "$", "data", "=", "null", ")", "{", "if", "(", "$", "data", "===", "null", ")", "{", "$", "this", "->", "iterator", "=", "null", ";", "}", "else", "{", "$", "this", "->", "iterator", "=", "new", "\\", "ArrayIterator", "(", "$", "data", ")", ";", "}", "}" ]
Array as import source @param array $data
[ "Array", "as", "import", "source" ]
9f1734ae4689d73278b887f9354dfd31428e96de
https://github.com/perryflynn/PerrysLambda/blob/9f1734ae4689d73278b887f9354dfd31428e96de/src/PerrysLambda/Converter/ListConverter.php#L110-L120
24,580
perryflynn/PerrysLambda
src/PerrysLambda/Converter/ListConverter.php
ListConverter.setIteratorSource
public function setIteratorSource(\Iterator $iterator=null, $start=0, $end=-1) { $this->iteratorstartindex = (int)$start; $this->iteratorendindex = (int)$end; $this->iterator = $iterator; }
php
public function setIteratorSource(\Iterator $iterator=null, $start=0, $end=-1) { $this->iteratorstartindex = (int)$start; $this->iteratorendindex = (int)$end; $this->iterator = $iterator; }
[ "public", "function", "setIteratorSource", "(", "\\", "Iterator", "$", "iterator", "=", "null", ",", "$", "start", "=", "0", ",", "$", "end", "=", "-", "1", ")", "{", "$", "this", "->", "iteratorstartindex", "=", "(", "int", ")", "$", "start", ";", "$", "this", "->", "iteratorendindex", "=", "(", "int", ")", "$", "end", ";", "$", "this", "->", "iterator", "=", "$", "iterator", ";", "}" ]
Iterator as import source @param \Iterator $iterator @param int $start @param int $end
[ "Iterator", "as", "import", "source" ]
9f1734ae4689d73278b887f9354dfd31428e96de
https://github.com/perryflynn/PerrysLambda/blob/9f1734ae4689d73278b887f9354dfd31428e96de/src/PerrysLambda/Converter/ListConverter.php#L136-L141
24,581
perryflynn/PerrysLambda
src/PerrysLambda/Converter/ListConverter.php
ListConverter.importInto
public function importInto(ArrayBase $collection) { if($this->iterator instanceof \Iterator) { $i = 0; foreach($this->iterator as $key => $row) { if($this->iteratorendindex>=0 && $i>$this->iteratorendindex) { break; } elseif($i>=$this->iteratorstartindex) { $tempkey = $key; $tempvalue = $row; /* if($this->isItemConverterExist()) { $this->getItemConverter()->deserializeAll($tempvalue, $tempkey); } */ if($tempvalue!==null && $tempkey!==null) { $collection->set($tempkey, $tempvalue);//, true); } } $i++; } } }
php
public function importInto(ArrayBase $collection) { if($this->iterator instanceof \Iterator) { $i = 0; foreach($this->iterator as $key => $row) { if($this->iteratorendindex>=0 && $i>$this->iteratorendindex) { break; } elseif($i>=$this->iteratorstartindex) { $tempkey = $key; $tempvalue = $row; /* if($this->isItemConverterExist()) { $this->getItemConverter()->deserializeAll($tempvalue, $tempkey); } */ if($tempvalue!==null && $tempkey!==null) { $collection->set($tempkey, $tempvalue);//, true); } } $i++; } } }
[ "public", "function", "importInto", "(", "ArrayBase", "$", "collection", ")", "{", "if", "(", "$", "this", "->", "iterator", "instanceof", "\\", "Iterator", ")", "{", "$", "i", "=", "0", ";", "foreach", "(", "$", "this", "->", "iterator", "as", "$", "key", "=>", "$", "row", ")", "{", "if", "(", "$", "this", "->", "iteratorendindex", ">=", "0", "&&", "$", "i", ">", "$", "this", "->", "iteratorendindex", ")", "{", "break", ";", "}", "elseif", "(", "$", "i", ">=", "$", "this", "->", "iteratorstartindex", ")", "{", "$", "tempkey", "=", "$", "key", ";", "$", "tempvalue", "=", "$", "row", ";", "/*\n if($this->isItemConverterExist())\n {\n $this->getItemConverter()->deserializeAll($tempvalue, $tempkey);\n }\n */", "if", "(", "$", "tempvalue", "!==", "null", "&&", "$", "tempkey", "!==", "null", ")", "{", "$", "collection", "->", "set", "(", "$", "tempkey", ",", "$", "tempvalue", ")", ";", "//, true);", "}", "}", "$", "i", "++", ";", "}", "}", "}" ]
Import into ArrayBase @param ArrayBase $collection
[ "Import", "into", "ArrayBase" ]
9f1734ae4689d73278b887f9354dfd31428e96de
https://github.com/perryflynn/PerrysLambda/blob/9f1734ae4689d73278b887f9354dfd31428e96de/src/PerrysLambda/Converter/ListConverter.php#L147-L178
24,582
perryflynn/PerrysLambda
src/PerrysLambda/Converter/ListConverter.php
ListConverter.newInstance
public function newInstance() { $class = get_called_class(); $instance = new $class(); $instance->setSerializer($this->getSerializer()); $instance->setItemConverter($this->getItemConverter()->newInstance()); return $instance; }
php
public function newInstance() { $class = get_called_class(); $instance = new $class(); $instance->setSerializer($this->getSerializer()); $instance->setItemConverter($this->getItemConverter()->newInstance()); return $instance; }
[ "public", "function", "newInstance", "(", ")", "{", "$", "class", "=", "get_called_class", "(", ")", ";", "$", "instance", "=", "new", "$", "class", "(", ")", ";", "$", "instance", "->", "setSerializer", "(", "$", "this", "->", "getSerializer", "(", ")", ")", ";", "$", "instance", "->", "setItemConverter", "(", "$", "this", "->", "getItemConverter", "(", ")", "->", "newInstance", "(", ")", ")", ";", "return", "$", "instance", ";", "}" ]
Creates a new instance of this class @return \PerrysLambda\Converter\ListConverter
[ "Creates", "a", "new", "instance", "of", "this", "class" ]
9f1734ae4689d73278b887f9354dfd31428e96de
https://github.com/perryflynn/PerrysLambda/blob/9f1734ae4689d73278b887f9354dfd31428e96de/src/PerrysLambda/Converter/ListConverter.php#L184-L191
24,583
Linkvalue-Interne/MajoraFrameworkExtraBundle
src/Majora/Framework/Loader/LoaderTrait.php
LoaderTrait.setUp
public function setUp( $entityClass, array $entityProperties, $collectionClass, RepositoryInterface $entityRepository = null ) { @trigger_error(__METHOD__.'() is deprecated and will be removed in 2.0. Please use configureMetadata() instead.', E_USER_DEPRECATED); if ($entityRepository) { @trigger_error('Repository injection throught '.__METHOD__.'() is deprecated and will be removed in 2.0. Please inject it by constructor.', E_USER_DEPRECATED); $this->entityRepository = $entityRepository; } return $this->configureMetadata($entityClass, $entityProperties, $collectionClass); }
php
public function setUp( $entityClass, array $entityProperties, $collectionClass, RepositoryInterface $entityRepository = null ) { @trigger_error(__METHOD__.'() is deprecated and will be removed in 2.0. Please use configureMetadata() instead.', E_USER_DEPRECATED); if ($entityRepository) { @trigger_error('Repository injection throught '.__METHOD__.'() is deprecated and will be removed in 2.0. Please inject it by constructor.', E_USER_DEPRECATED); $this->entityRepository = $entityRepository; } return $this->configureMetadata($entityClass, $entityProperties, $collectionClass); }
[ "public", "function", "setUp", "(", "$", "entityClass", ",", "array", "$", "entityProperties", ",", "$", "collectionClass", ",", "RepositoryInterface", "$", "entityRepository", "=", "null", ")", "{", "@", "trigger_error", "(", "__METHOD__", ".", "'() is deprecated and will be removed in 2.0. Please use configureMetadata() instead.'", ",", "E_USER_DEPRECATED", ")", ";", "if", "(", "$", "entityRepository", ")", "{", "@", "trigger_error", "(", "'Repository injection throught '", ".", "__METHOD__", ".", "'() is deprecated and will be removed in 2.0. Please inject it by constructor.'", ",", "E_USER_DEPRECATED", ")", ";", "$", "this", "->", "entityRepository", "=", "$", "entityRepository", ";", "}", "return", "$", "this", "->", "configureMetadata", "(", "$", "entityClass", ",", "$", "entityProperties", ",", "$", "collectionClass", ")", ";", "}" ]
setUp method. @param string $entityClass @param array $entityProperties @param string $collectionClass @param RepositoryInterface $entityRepository
[ "setUp", "method", "." ]
6f368380cfc39d27fafb0844e9a53b4d86d7c034
https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Loader/LoaderTrait.php#L53-L68
24,584
mwyatt/core
src/Cache.php
Cache.create
public function create($fileName, $data) { $path = $this->getPathBase($fileName); if (file_exists($path)) { return; } $data = serialize($data); return file_put_contents($path, $data); }
php
public function create($fileName, $data) { $path = $this->getPathBase($fileName); if (file_exists($path)) { return; } $data = serialize($data); return file_put_contents($path, $data); }
[ "public", "function", "create", "(", "$", "fileName", ",", "$", "data", ")", "{", "$", "path", "=", "$", "this", "->", "getPathBase", "(", "$", "fileName", ")", ";", "if", "(", "file_exists", "(", "$", "path", ")", ")", "{", "return", ";", "}", "$", "data", "=", "serialize", "(", "$", "data", ")", ";", "return", "file_put_contents", "(", "$", "path", ",", "$", "data", ")", ";", "}" ]
serialises and creates cache file if required if the file already exists, skip this @param string $key example-file-name @param array $data @return bool
[ "serialises", "and", "creates", "cache", "file", "if", "required", "if", "the", "file", "already", "exists", "skip", "this" ]
8ea9d67cc84fe6aff17a469c703d5492dbcd93ed
https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/Cache.php#L76-L87
24,585
mwyatt/core
src/Cache.php
Cache.read
public function read($fileName) { $path = $this->getPathBase($fileName); if (!file_exists($path)) { return; } $data = file_get_contents($path); return $this->data = unserialize($data); }
php
public function read($fileName) { $path = $this->getPathBase($fileName); if (!file_exists($path)) { return; } $data = file_get_contents($path); return $this->data = unserialize($data); }
[ "public", "function", "read", "(", "$", "fileName", ")", "{", "$", "path", "=", "$", "this", "->", "getPathBase", "(", "$", "fileName", ")", ";", "if", "(", "!", "file_exists", "(", "$", "path", ")", ")", "{", "return", ";", "}", "$", "data", "=", "file_get_contents", "(", "$", "path", ")", ";", "return", "$", "this", "->", "data", "=", "unserialize", "(", "$", "data", ")", ";", "}" ]
reads in the cached file, if it exists unserialises and stores in data property @param string $key example-file-name @return bool
[ "reads", "in", "the", "cached", "file", "if", "it", "exists", "unserialises", "and", "stores", "in", "data", "property" ]
8ea9d67cc84fe6aff17a469c703d5492dbcd93ed
https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/Cache.php#L96-L106
24,586
mwyatt/core
src/Cache.php
Cache.delete
public function delete($fileName) { $path = $this->getPathBase($fileName); if (!file_exists($path)) { return; } return unlink($path); }
php
public function delete($fileName) { $path = $this->getPathBase($fileName); if (!file_exists($path)) { return; } return unlink($path); }
[ "public", "function", "delete", "(", "$", "fileName", ")", "{", "$", "path", "=", "$", "this", "->", "getPathBase", "(", "$", "fileName", ")", ";", "if", "(", "!", "file_exists", "(", "$", "path", ")", ")", "{", "return", ";", "}", "return", "unlink", "(", "$", "path", ")", ";", "}" ]
removes the file from the cache @param string $key @return bool
[ "removes", "the", "file", "from", "the", "cache" ]
8ea9d67cc84fe6aff17a469c703d5492dbcd93ed
https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/Cache.php#L114-L123
24,587
kaiohken1982/NeobazaarDocumentModule
src/Document/Controller/ClassifiedController.php
ClassifiedController.checkOptions
public function checkOptions(MvcEvent $e) { $matches = $e->getRouteMatch(); $response = $e->getResponse(); $request = $e->getRequest(); $method = $request->getMethod(); // test if we matched an individual resource, and then test // if we allow the particular request method if ($matches->getParam('id', false)) { if (!in_array($method, $this->allowedResourceMethods)) { $response->setStatusCode(405); return $response; } return; } // We matched a collection; test if we allow the particular request // method if (!in_array($method, $this->allowedCollectionMethods)) { $response->setStatusCode(405); return $response; } }
php
public function checkOptions(MvcEvent $e) { $matches = $e->getRouteMatch(); $response = $e->getResponse(); $request = $e->getRequest(); $method = $request->getMethod(); // test if we matched an individual resource, and then test // if we allow the particular request method if ($matches->getParam('id', false)) { if (!in_array($method, $this->allowedResourceMethods)) { $response->setStatusCode(405); return $response; } return; } // We matched a collection; test if we allow the particular request // method if (!in_array($method, $this->allowedCollectionMethods)) { $response->setStatusCode(405); return $response; } }
[ "public", "function", "checkOptions", "(", "MvcEvent", "$", "e", ")", "{", "$", "matches", "=", "$", "e", "->", "getRouteMatch", "(", ")", ";", "$", "response", "=", "$", "e", "->", "getResponse", "(", ")", ";", "$", "request", "=", "$", "e", "->", "getRequest", "(", ")", ";", "$", "method", "=", "$", "request", "->", "getMethod", "(", ")", ";", "// test if we matched an individual resource, and then test", "// if we allow the particular request method", "if", "(", "$", "matches", "->", "getParam", "(", "'id'", ",", "false", ")", ")", "{", "if", "(", "!", "in_array", "(", "$", "method", ",", "$", "this", "->", "allowedResourceMethods", ")", ")", "{", "$", "response", "->", "setStatusCode", "(", "405", ")", ";", "return", "$", "response", ";", "}", "return", ";", "}", "// We matched a collection; test if we allow the particular request ", "// method", "if", "(", "!", "in_array", "(", "$", "method", ",", "$", "this", "->", "allowedCollectionMethods", ")", ")", "{", "$", "response", "->", "setStatusCode", "(", "405", ")", ";", "return", "$", "response", ";", "}", "}" ]
Checks that is an allowed method @param Zend\Mvc\MvcEvent $e @return void|Zend\Http\Response
[ "Checks", "that", "is", "an", "allowed", "method" ]
edb0223878fe02e791d2a0266c5a7c0f2029e3fe
https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Controller/ClassifiedController.php#L104-L127
24,588
kaiohken1982/NeobazaarDocumentModule
src/Document/Controller/ClassifiedController.php
ClassifiedController.injectLinkHeader
public function injectLinkHeader(MvcEvent $e) { $response = $e->getResponse(); $headers = $response->getHeaders(); // $headers->addHeaderLine('Link', sprintf( // '<%s>; rel="describedby"', // $this->url()->fromRoute('static-classified-service') // )); $headers->addHeaderLine('Access-Control-Allow-Origin', '*'); $headers->addHeaderLine('Access-Control-Allow-Methods', 'POST PUT DELETE GET'); }
php
public function injectLinkHeader(MvcEvent $e) { $response = $e->getResponse(); $headers = $response->getHeaders(); // $headers->addHeaderLine('Link', sprintf( // '<%s>; rel="describedby"', // $this->url()->fromRoute('static-classified-service') // )); $headers->addHeaderLine('Access-Control-Allow-Origin', '*'); $headers->addHeaderLine('Access-Control-Allow-Methods', 'POST PUT DELETE GET'); }
[ "public", "function", "injectLinkHeader", "(", "MvcEvent", "$", "e", ")", "{", "$", "response", "=", "$", "e", "->", "getResponse", "(", ")", ";", "$", "headers", "=", "$", "response", "->", "getHeaders", "(", ")", ";", "// \t$headers->addHeaderLine('Link', sprintf(", "// \t\t\t'<%s>; rel=\"describedby\"',", "// \t\t\t$this->url()->fromRoute('static-classified-service')", "// \t));", "$", "headers", "->", "addHeaderLine", "(", "'Access-Control-Allow-Origin'", ",", "'*'", ")", ";", "$", "headers", "->", "addHeaderLine", "(", "'Access-Control-Allow-Methods'", ",", "'POST PUT DELETE GET'", ")", ";", "}" ]
Inject documentation link header to the response @param Zend\Mvc\MvcEvent $e @return void
[ "Inject", "documentation", "link", "header", "to", "the", "response" ]
edb0223878fe02e791d2a0266c5a7c0f2029e3fe
https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Controller/ClassifiedController.php#L135-L146
24,589
AnonymPHP/Anonym-Database
Traits/Builder.php
Builder.buildQuery
private function buildQuery($pattern, $args) { if (count($args['parameters']) > 0) { $string = $pattern[0]; } else { $string = $pattern[1]; } if (preg_match_all("/:(\w+)/", $string, $match)) { $match = $match[0]; $values = array_values($args); return str_replace($match, $values, $string); } }
php
private function buildQuery($pattern, $args) { if (count($args['parameters']) > 0) { $string = $pattern[0]; } else { $string = $pattern[1]; } if (preg_match_all("/:(\w+)/", $string, $match)) { $match = $match[0]; $values = array_values($args); return str_replace($match, $values, $string); } }
[ "private", "function", "buildQuery", "(", "$", "pattern", ",", "$", "args", ")", "{", "if", "(", "count", "(", "$", "args", "[", "'parameters'", "]", ")", ">", "0", ")", "{", "$", "string", "=", "$", "pattern", "[", "0", "]", ";", "}", "else", "{", "$", "string", "=", "$", "pattern", "[", "1", "]", ";", "}", "if", "(", "preg_match_all", "(", "\"/:(\\w+)/\"", ",", "$", "string", ",", "$", "match", ")", ")", "{", "$", "match", "=", "$", "match", "[", "0", "]", ";", "$", "values", "=", "array_values", "(", "$", "args", ")", ";", "return", "str_replace", "(", "$", "match", ",", "$", "values", ",", "$", "string", ")", ";", "}", "}" ]
create the a sql query @param array $pattern @param array $args @return mixed
[ "create", "the", "a", "sql", "query" ]
4d034219e0e3eb2833fa53204e9f52a74a9a7e4b
https://github.com/AnonymPHP/Anonym-Database/blob/4d034219e0e3eb2833fa53204e9f52a74a9a7e4b/Traits/Builder.php#L19-L36
24,590
Blipfoto/php-sdk
src/Blipfoto/Api/Client.php
Client.endpoint
public function endpoint() { $endpoint = $this->getset('endpoint', func_get_args()); return $this->validateEndpoint($endpoint ?: self::URI_API); }
php
public function endpoint() { $endpoint = $this->getset('endpoint', func_get_args()); return $this->validateEndpoint($endpoint ?: self::URI_API); }
[ "public", "function", "endpoint", "(", ")", "{", "$", "endpoint", "=", "$", "this", "->", "getset", "(", "'endpoint'", ",", "func_get_args", "(", ")", ")", ";", "return", "$", "this", "->", "validateEndpoint", "(", "$", "endpoint", "?", ":", "self", "::", "URI_API", ")", ";", "}" ]
Get and optionally set the endpoint. @param string $endpoint (optional) @return string
[ "Get", "and", "optionally", "set", "the", "endpoint", "." ]
04f770ac7427e79d15f97b993c787651079cdeb4
https://github.com/Blipfoto/php-sdk/blob/04f770ac7427e79d15f97b993c787651079cdeb4/src/Blipfoto/Api/Client.php#L104-L107
24,591
Blipfoto/php-sdk
src/Blipfoto/Api/Client.php
Client.authorizationEndpoint
public function authorizationEndpoint() { $endpoint = $this->getset('authorization_endpoint', func_get_args()); return $this->validateEndpoint($endpoint ?: self::URI_AUTHORIZE); }
php
public function authorizationEndpoint() { $endpoint = $this->getset('authorization_endpoint', func_get_args()); return $this->validateEndpoint($endpoint ?: self::URI_AUTHORIZE); }
[ "public", "function", "authorizationEndpoint", "(", ")", "{", "$", "endpoint", "=", "$", "this", "->", "getset", "(", "'authorization_endpoint'", ",", "func_get_args", "(", ")", ")", ";", "return", "$", "this", "->", "validateEndpoint", "(", "$", "endpoint", "?", ":", "self", "::", "URI_AUTHORIZE", ")", ";", "}" ]
Get and optionally set the authorization endpoint. @param string $authorization_endpoint (optional) @return string
[ "Get", "and", "optionally", "set", "the", "authorization", "endpoint", "." ]
04f770ac7427e79d15f97b993c787651079cdeb4
https://github.com/Blipfoto/php-sdk/blob/04f770ac7427e79d15f97b993c787651079cdeb4/src/Blipfoto/Api/Client.php#L115-L118
24,592
Blipfoto/php-sdk
src/Blipfoto/Api/Client.php
Client.run
protected function run($method, $args) { $request = $this->request(); $request->method($method); $request->resource(array_shift($args)); if (count($args)) { $request->params(array_shift($args)); } if (count($args)) { $request->files(array_shift($args)); } return $request->send(); }
php
protected function run($method, $args) { $request = $this->request(); $request->method($method); $request->resource(array_shift($args)); if (count($args)) { $request->params(array_shift($args)); } if (count($args)) { $request->files(array_shift($args)); } return $request->send(); }
[ "protected", "function", "run", "(", "$", "method", ",", "$", "args", ")", "{", "$", "request", "=", "$", "this", "->", "request", "(", ")", ";", "$", "request", "->", "method", "(", "$", "method", ")", ";", "$", "request", "->", "resource", "(", "array_shift", "(", "$", "args", ")", ")", ";", "if", "(", "count", "(", "$", "args", ")", ")", "{", "$", "request", "->", "params", "(", "array_shift", "(", "$", "args", ")", ")", ";", "}", "if", "(", "count", "(", "$", "args", ")", ")", "{", "$", "request", "->", "files", "(", "array_shift", "(", "$", "args", ")", ")", ";", "}", "return", "$", "request", "->", "send", "(", ")", ";", "}" ]
Convenience method for sending a request and returning a response. @return Response @throws OAuthException|ApiResponseException
[ "Convenience", "method", "for", "sending", "a", "request", "and", "returning", "a", "response", "." ]
04f770ac7427e79d15f97b993c787651079cdeb4
https://github.com/Blipfoto/php-sdk/blob/04f770ac7427e79d15f97b993c787651079cdeb4/src/Blipfoto/Api/Client.php#L173-L184
24,593
lanfisis/deflection
src/Deflection/Element/Classes.php
Classes.isAbstract
public function isAbstract($status = null) { $this->is_abstract = $status !== null ? $status : $this->is_abstract; return $this->is_abstract ; }
php
public function isAbstract($status = null) { $this->is_abstract = $status !== null ? $status : $this->is_abstract; return $this->is_abstract ; }
[ "public", "function", "isAbstract", "(", "$", "status", "=", "null", ")", "{", "$", "this", "->", "is_abstract", "=", "$", "status", "!==", "null", "?", "$", "status", ":", "$", "this", "->", "is_abstract", ";", "return", "$", "this", "->", "is_abstract", ";", "}" ]
Is an abstract class @return \Deflection\Element\Classes
[ "Is", "an", "abstract", "class" ]
31deaf7f085d6456d8a323e7ac3cc9914fbe49a9
https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Element/Classes.php#L70-L74
24,594
lanfisis/deflection
src/Deflection/Element/Classes.php
Classes.addParam
public function addParam(\Deflection\Element\Param $param) { $element = $param->getElement(); $this->params = array_merge($this->params, array(''), $element); return $this; }
php
public function addParam(\Deflection\Element\Param $param) { $element = $param->getElement(); $this->params = array_merge($this->params, array(''), $element); return $this; }
[ "public", "function", "addParam", "(", "\\", "Deflection", "\\", "Element", "\\", "Param", "$", "param", ")", "{", "$", "element", "=", "$", "param", "->", "getElement", "(", ")", ";", "$", "this", "->", "params", "=", "array_merge", "(", "$", "this", "->", "params", ",", "array", "(", "''", ")", ",", "$", "element", ")", ";", "return", "$", "this", ";", "}" ]
Add function to structure @param \Deflection\Element\Param $param Param @return \Deflection\Element\Classes
[ "Add", "function", "to", "structure" ]
31deaf7f085d6456d8a323e7ac3cc9914fbe49a9
https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Element/Classes.php#L188-L193
24,595
lanfisis/deflection
src/Deflection/Element/Classes.php
Classes.addFunction
public function addFunction(\Deflection\Element\Functions $function) { $element = $function->getElement(); $this->functions = array_merge($this->functions, array(''), $element); return $this; }
php
public function addFunction(\Deflection\Element\Functions $function) { $element = $function->getElement(); $this->functions = array_merge($this->functions, array(''), $element); return $this; }
[ "public", "function", "addFunction", "(", "\\", "Deflection", "\\", "Element", "\\", "Functions", "$", "function", ")", "{", "$", "element", "=", "$", "function", "->", "getElement", "(", ")", ";", "$", "this", "->", "functions", "=", "array_merge", "(", "$", "this", "->", "functions", ",", "array", "(", "''", ")", ",", "$", "element", ")", ";", "return", "$", "this", ";", "}" ]
Add param to structure @param \Deflection\Element\Functions $function Function @return \Deflection\Element\Classes
[ "Add", "param", "to", "structure" ]
31deaf7f085d6456d8a323e7ac3cc9914fbe49a9
https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Element/Classes.php#L212-L217
24,596
Kris-Kuiper/sFire-Framework
src/Permissions/ACL.php
ACL.isAllowed
public function isAllowed($role, $resource) { if(false === is_string($role)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($role)), E_USER_ERROR); } if(false === is_string($resource)) { return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($resource)), E_USER_ERROR); } if(true === isset($this -> permissions[$role][$resource])) { return $this -> permissions[$role][$resource]; } return false; }
php
public function isAllowed($role, $resource) { if(false === is_string($role)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($role)), E_USER_ERROR); } if(false === is_string($resource)) { return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($resource)), E_USER_ERROR); } if(true === isset($this -> permissions[$role][$resource])) { return $this -> permissions[$role][$resource]; } return false; }
[ "public", "function", "isAllowed", "(", "$", "role", ",", "$", "resource", ")", "{", "if", "(", "false", "===", "is_string", "(", "$", "role", ")", ")", "{", "return", "trigger_error", "(", "sprintf", "(", "'Argument 1 passed to %s() must be of the type string, \"%s\" given'", ",", "__METHOD__", ",", "gettype", "(", "$", "role", ")", ")", ",", "E_USER_ERROR", ")", ";", "}", "if", "(", "false", "===", "is_string", "(", "$", "resource", ")", ")", "{", "return", "trigger_error", "(", "sprintf", "(", "'Argument 2 passed to %s() must be of the type string, \"%s\" given'", ",", "__METHOD__", ",", "gettype", "(", "$", "resource", ")", ")", ",", "E_USER_ERROR", ")", ";", "}", "if", "(", "true", "===", "isset", "(", "$", "this", "->", "permissions", "[", "$", "role", "]", "[", "$", "resource", "]", ")", ")", "{", "return", "$", "this", "->", "permissions", "[", "$", "role", "]", "[", "$", "resource", "]", ";", "}", "return", "false", ";", "}" ]
Returns if a role is allowed access to the resource @param string $role @param string $resource @return boolean
[ "Returns", "if", "a", "role", "is", "allowed", "access", "to", "the", "resource" ]
deefe1d9d2b40e7326381e8dcd4f01f9aa61885c
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Permissions/ACL.php#L29-L44
24,597
Kris-Kuiper/sFire-Framework
src/Permissions/ACL.php
ACL.inherit
public function inherit($roles, $inherits) { if(true === is_string($roles)) { $roles = [$roles]; } if(true === is_string($inherits)) { $inherits = [$inherits]; } if(false === is_array($roles)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or array, "%s" given', __METHOD__, gettype($roles)), E_USER_ERROR); } if(false === is_array($inherits)) { return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string or array, "%s" given', __METHOD__, gettype($inherits)), E_USER_ERROR); } foreach($inherits as $inherit) { if(true === isset($this -> permissions[$inherit])) { foreach($this -> permissions[$inherit] as $resource => $allowed) { foreach($roles as $role) { $this -> fill($role, $resource, $allowed); } } } } return $this; }
php
public function inherit($roles, $inherits) { if(true === is_string($roles)) { $roles = [$roles]; } if(true === is_string($inherits)) { $inherits = [$inherits]; } if(false === is_array($roles)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or array, "%s" given', __METHOD__, gettype($roles)), E_USER_ERROR); } if(false === is_array($inherits)) { return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string or array, "%s" given', __METHOD__, gettype($inherits)), E_USER_ERROR); } foreach($inherits as $inherit) { if(true === isset($this -> permissions[$inherit])) { foreach($this -> permissions[$inherit] as $resource => $allowed) { foreach($roles as $role) { $this -> fill($role, $resource, $allowed); } } } } return $this; }
[ "public", "function", "inherit", "(", "$", "roles", ",", "$", "inherits", ")", "{", "if", "(", "true", "===", "is_string", "(", "$", "roles", ")", ")", "{", "$", "roles", "=", "[", "$", "roles", "]", ";", "}", "if", "(", "true", "===", "is_string", "(", "$", "inherits", ")", ")", "{", "$", "inherits", "=", "[", "$", "inherits", "]", ";", "}", "if", "(", "false", "===", "is_array", "(", "$", "roles", ")", ")", "{", "return", "trigger_error", "(", "sprintf", "(", "'Argument 1 passed to %s() must be of the type string or array, \"%s\" given'", ",", "__METHOD__", ",", "gettype", "(", "$", "roles", ")", ")", ",", "E_USER_ERROR", ")", ";", "}", "if", "(", "false", "===", "is_array", "(", "$", "inherits", ")", ")", "{", "return", "trigger_error", "(", "sprintf", "(", "'Argument 2 passed to %s() must be of the type string or array, \"%s\" given'", ",", "__METHOD__", ",", "gettype", "(", "$", "inherits", ")", ")", ",", "E_USER_ERROR", ")", ";", "}", "foreach", "(", "$", "inherits", "as", "$", "inherit", ")", "{", "if", "(", "true", "===", "isset", "(", "$", "this", "->", "permissions", "[", "$", "inherit", "]", ")", ")", "{", "foreach", "(", "$", "this", "->", "permissions", "[", "$", "inherit", "]", "as", "$", "resource", "=>", "$", "allowed", ")", "{", "foreach", "(", "$", "roles", "as", "$", "role", ")", "{", "$", "this", "->", "fill", "(", "$", "role", ",", "$", "resource", ",", "$", "allowed", ")", ";", "}", "}", "}", "}", "return", "$", "this", ";", "}" ]
Let a single or multiple roles inherit the resources of other single or multiple roles @param string|array $roles @param string|array $inherits @return sFire\Permissions\ACL
[ "Let", "a", "single", "or", "multiple", "roles", "inherit", "the", "resources", "of", "other", "single", "or", "multiple", "roles" ]
deefe1d9d2b40e7326381e8dcd4f01f9aa61885c
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Permissions/ACL.php#L86-L119
24,598
Kris-Kuiper/sFire-Framework
src/Permissions/ACL.php
ACL.getRoles
public function getRoles() { $roles = []; foreach($this -> permissions as $role => $permissions) { $roles[$role] = $this -> getRole($role); } return $roles; }
php
public function getRoles() { $roles = []; foreach($this -> permissions as $role => $permissions) { $roles[$role] = $this -> getRole($role); } return $roles; }
[ "public", "function", "getRoles", "(", ")", "{", "$", "roles", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "permissions", "as", "$", "role", "=>", "$", "permissions", ")", "{", "$", "roles", "[", "$", "role", "]", "=", "$", "this", "->", "getRole", "(", "$", "role", ")", ";", "}", "return", "$", "roles", ";", "}" ]
Returns all the roles as an array @return array
[ "Returns", "all", "the", "roles", "as", "an", "array" ]
deefe1d9d2b40e7326381e8dcd4f01f9aa61885c
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Permissions/ACL.php#L126-L135
24,599
Kris-Kuiper/sFire-Framework
src/Permissions/ACL.php
ACL.getRole
public function getRole($role) { if(false === is_string($role)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($role)), E_USER_ERROR); } foreach($this -> permissions as $type => $resources) { if($role === $type) { $p = new Resources(); $p -> setResources($resources); return $p; } } return null; }
php
public function getRole($role) { if(false === is_string($role)) { return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($role)), E_USER_ERROR); } foreach($this -> permissions as $type => $resources) { if($role === $type) { $p = new Resources(); $p -> setResources($resources); return $p; } } return null; }
[ "public", "function", "getRole", "(", "$", "role", ")", "{", "if", "(", "false", "===", "is_string", "(", "$", "role", ")", ")", "{", "return", "trigger_error", "(", "sprintf", "(", "'Argument 1 passed to %s() must be of the type string, \"%s\" given'", ",", "__METHOD__", ",", "gettype", "(", "$", "role", ")", ")", ",", "E_USER_ERROR", ")", ";", "}", "foreach", "(", "$", "this", "->", "permissions", "as", "$", "type", "=>", "$", "resources", ")", "{", "if", "(", "$", "role", "===", "$", "type", ")", "{", "$", "p", "=", "new", "Resources", "(", ")", ";", "$", "p", "->", "setResources", "(", "$", "resources", ")", ";", "return", "$", "p", ";", "}", "}", "return", "null", ";", "}" ]
Returns the roles in array @return array
[ "Returns", "the", "roles", "in", "array" ]
deefe1d9d2b40e7326381e8dcd4f01f9aa61885c
https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Permissions/ACL.php#L142-L160