repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
netzmacht-archive/subcolumns_bootstrap_customizable
src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php
ColumnSet.getAllColumnsets
public function getAllColumnsets($dc) { $collection = ColumnsetModel::findBy('published=1 AND columns', $dc->activeRecord->sc_type, array('order' => 'title')); $set = array(); if($collection !== null) { while($collection->next()) { $set[$collection->id] = $collection->title; } } return $set; }
php
public function getAllColumnsets($dc) { $collection = ColumnsetModel::findBy('published=1 AND columns', $dc->activeRecord->sc_type, array('order' => 'title')); $set = array(); if($collection !== null) { while($collection->next()) { $set[$collection->id] = $collection->title; } } return $set; }
[ "public", "function", "getAllColumnsets", "(", "$", "dc", ")", "{", "$", "collection", "=", "ColumnsetModel", "::", "findBy", "(", "'published=1 AND columns'", ",", "$", "dc", "->", "activeRecord", "->", "sc_type", ",", "array", "(", "'order'", "=>", "'title'"...
get all columnsets which fits to the selected type @param $dc @return array
[ "get", "all", "columnsets", "which", "fits", "to", "the", "selected", "type" ]
train
https://github.com/netzmacht-archive/subcolumns_bootstrap_customizable/blob/c0f63755282451fad670ceaa49b984bfabf9e4ee/src/system/modules/subcolumns_bootstrap_customizable/classes/Netzmacht/ColumnSet/ColumnSet.php#L225-L238
fulgurio/LightCMSBundle
Entity/PageMeta.php
PageMeta.setPage
public function setPage(\Fulgurio\LightCMSBundle\Entity\Page $page = null) { $this->page = $page; return $this; }
php
public function setPage(\Fulgurio\LightCMSBundle\Entity\Page $page = null) { $this->page = $page; return $this; }
[ "public", "function", "setPage", "(", "\\", "Fulgurio", "\\", "LightCMSBundle", "\\", "Entity", "\\", "Page", "$", "page", "=", "null", ")", "{", "$", "this", "->", "page", "=", "$", "page", ";", "return", "$", "this", ";", "}" ]
Set page @param \Fulgurio\LightCMSBundle\Entity\Page $page @return PageMeta
[ "Set", "page" ]
train
https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Entity/PageMeta.php#L103-L108
MindyPHP/OrmBundle
DependencyInjection/OrmExtension.php
OrmExtension.load
public function load(array $configs, ContainerBuilder $container) { $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.yaml'); $configuration = $this->getConfiguration($configs, $container); $config = $this->processConf...
php
public function load(array $configs, ContainerBuilder $container) { $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.yaml'); $configuration = $this->getConfiguration($configs, $container); $config = $this->processConf...
[ "public", "function", "load", "(", "array", "$", "configs", ",", "ContainerBuilder", "$", "container", ")", "{", "$", "loader", "=", "new", "YamlFileLoader", "(", "$", "container", ",", "new", "FileLocator", "(", "__DIR__", ".", "'/../Resources/config'", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/MindyPHP/OrmBundle/blob/54dec3bbe78d45efafc4258cc47206846330c519/DependencyInjection/OrmExtension.php#L25-L38
WellCommerce/CartBundle
Visitor/CartShippingMethodVisitor.php
CartShippingMethodVisitor.visitCart
public function visitCart(CartInterface $cart) { $cartShippingMethodCost = $cart->getShippingMethodCost(); if (null === $cartShippingMethodCost) { $shippingMethodCostCollection = $this->getShippingMethodCostCollection($cart); if ($shippingMethodCostCollection->count()) { ...
php
public function visitCart(CartInterface $cart) { $cartShippingMethodCost = $cart->getShippingMethodCost(); if (null === $cartShippingMethodCost) { $shippingMethodCostCollection = $this->getShippingMethodCostCollection($cart); if ($shippingMethodCostCollection->count()) { ...
[ "public", "function", "visitCart", "(", "CartInterface", "$", "cart", ")", "{", "$", "cartShippingMethodCost", "=", "$", "cart", "->", "getShippingMethodCost", "(", ")", ";", "if", "(", "null", "===", "$", "cartShippingMethodCost", ")", "{", "$", "shippingMeth...
{@inheritdoc}
[ "{" ]
train
https://github.com/WellCommerce/CartBundle/blob/77c1e12b36bde008dca61260481b21135e339396/Visitor/CartShippingMethodVisitor.php#L43-L53
leprephp/di
src/ExtensionQueue.php
ExtensionQueue.getService
public function getService($service) { foreach ($this->queue as $extension) { $new = call_user_func($extension, $service, $this->container); if ($new) { $service = $new; } } return $service; }
php
public function getService($service) { foreach ($this->queue as $extension) { $new = call_user_func($extension, $service, $this->container); if ($new) { $service = $new; } } return $service; }
[ "public", "function", "getService", "(", "$", "service", ")", "{", "foreach", "(", "$", "this", "->", "queue", "as", "$", "extension", ")", "{", "$", "new", "=", "call_user_func", "(", "$", "extension", ",", "$", "service", ",", "$", "this", "->", "c...
Gets the extended version of the service. @param mixed $service @return mixed
[ "Gets", "the", "extended", "version", "of", "the", "service", "." ]
train
https://github.com/leprephp/di/blob/d7de90c0d44714abd70c4f5bd5341a1a87203a7e/src/ExtensionQueue.php#L60-L71
SandratraRM/mora-core
src/cli/Manager/Controller/ControllerEdit.php
ControllerEdit.refactorRoute
private static function refactorRoute($old, $new) { $confPath = CustomRoutesManager::$path; $conf = new ArrayConfigManager($confPath); $routes = $conf->getConfigsArray(); while($key = array_search($old,$routes)){ $routes[$key] = $new; } $conf->setConfigsAr...
php
private static function refactorRoute($old, $new) { $confPath = CustomRoutesManager::$path; $conf = new ArrayConfigManager($confPath); $routes = $conf->getConfigsArray(); while($key = array_search($old,$routes)){ $routes[$key] = $new; } $conf->setConfigsAr...
[ "private", "static", "function", "refactorRoute", "(", "$", "old", ",", "$", "new", ")", "{", "$", "confPath", "=", "CustomRoutesManager", "::", "$", "path", ";", "$", "conf", "=", "new", "ArrayConfigManager", "(", "$", "confPath", ")", ";", "$", "routes...
TODO Rename Refactors
[ "TODO", "Rename", "Refactors" ]
train
https://github.com/SandratraRM/mora-core/blob/9cd8e16e4b619798a51dc2ac66ddd8d22caf7baa/src/cli/Manager/Controller/ControllerEdit.php#L72-L82
eureka-framework/component-template
src/Template/Pattern/PatternEcho.php
PatternEcho.render
public function render() { //~ Search echo $pattern = '`{{@((i|f|s|e)[|])?(.+?)}}`is'; $replace = array(); $matches = array(); if ((bool) preg_match_all($pattern, $this->templateContent, $matches)) { foreach ($matches[0] as $index => $replaceString) { ...
php
public function render() { //~ Search echo $pattern = '`{{@((i|f|s|e)[|])?(.+?)}}`is'; $replace = array(); $matches = array(); if ((bool) preg_match_all($pattern, $this->templateContent, $matches)) { foreach ($matches[0] as $index => $replaceString) { ...
[ "public", "function", "render", "(", ")", "{", "//~ Search echo", "$", "pattern", "=", "'`{{@((i|f|s|e)[|])?(.+?)}}`is'", ";", "$", "replace", "=", "array", "(", ")", ";", "$", "matches", "=", "array", "(", ")", ";", "if", "(", "(", "bool", ")", "preg_ma...
Search & replace current defined pattern for template. Example of template: <code> # In Template: # # ({@i|$intVar}} # ({@f|$floatVar}} # ({@s|$stringVar}} # ({@e|$stringVar}} # ({@$stringVar}} # # In Compiled template: <=(int) $intVar?> <=(float) $intVar?> <=(string) $intVar?> <=htmle($intVar)?> <=$intVar?> </code> ...
[ "Search", "&", "replace", "current", "defined", "pattern", "for", "template", ".", "Example", "of", "template", ":" ]
train
https://github.com/eureka-framework/component-template/blob/42e9b3954b79892ba340ba7ca909f03ee99c36fe/src/Template/Pattern/PatternEcho.php#L42-L81
Nicklas766/Comment
src/Comment/HTMLForm/Admin/EditUserForm.php
EditUserForm.callbackSubmit
public function callbackSubmit() { // Get values from the submitted form $email = $this->form->value("email"); if (strpos($email, '%') !== false) { $this->form->addOutput("% is not allowed"); return false; } $user = $this->user; $u...
php
public function callbackSubmit() { // Get values from the submitted form $email = $this->form->value("email"); if (strpos($email, '%') !== false) { $this->form->addOutput("% is not allowed"); return false; } $user = $this->user; $u...
[ "public", "function", "callbackSubmit", "(", ")", "{", "// Get values from the submitted form", "$", "email", "=", "$", "this", "->", "form", "->", "value", "(", "\"email\"", ")", ";", "if", "(", "strpos", "(", "$", "email", ",", "'%'", ")", "!==", "false"...
Callback for submit-button which should return true if it could carry out its work and false if something failed. @return boolean true if okey, false if something went wrong.
[ "Callback", "for", "submit", "-", "button", "which", "should", "return", "true", "if", "it", "could", "carry", "out", "its", "work", "and", "false", "if", "something", "failed", "." ]
train
https://github.com/Nicklas766/Comment/blob/1483eaf1ebb120b8bd6c2a1552c084b3a288ff25/src/Comment/HTMLForm/Admin/EditUserForm.php#L65-L82
MichaelJ2324/PHP-REST-Client
src/Endpoint/Abstracts/AbstractCollectionEndpoint.php
AbstractCollectionEndpoint.update
public function update(array $collection){ foreach($collection as $key => $value){ $this->collection[$key] = $value; } return $this; }
php
public function update(array $collection){ foreach($collection as $key => $value){ $this->collection[$key] = $value; } return $this; }
[ "public", "function", "update", "(", "array", "$", "collection", ")", "{", "foreach", "(", "$", "collection", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "this", "->", "collection", "[", "$", "key", "]", "=", "$", "value", ";", "}", "retur...
Update and append to Collection array @param array $collection @return self
[ "Update", "and", "append", "to", "Collection", "array" ]
train
https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Endpoint/Abstracts/AbstractCollectionEndpoint.php#L112-L117
MichaelJ2324/PHP-REST-Client
src/Endpoint/Abstracts/AbstractCollectionEndpoint.php
AbstractCollectionEndpoint.at
public function at($index){ $return = NULL; $index = intval($index); $data = $this->asArray(); reset($data); if ($index < 0){ $index += $this->length(); } $c = 1; while ($c <= $index){ next($data); $c++; } ...
php
public function at($index){ $return = NULL; $index = intval($index); $data = $this->asArray(); reset($data); if ($index < 0){ $index += $this->length(); } $c = 1; while ($c <= $index){ next($data); $c++; } ...
[ "public", "function", "at", "(", "$", "index", ")", "{", "$", "return", "=", "NULL", ";", "$", "index", "=", "intval", "(", "$", "index", ")", ";", "$", "data", "=", "$", "this", "->", "asArray", "(", ")", ";", "reset", "(", "$", "data", ")", ...
Get a model based on numerical index @param int $index @return array|ModelInterface
[ "Get", "a", "model", "based", "on", "numerical", "index" ]
train
https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Endpoint/Abstracts/AbstractCollectionEndpoint.php#L149-L168
MichaelJ2324/PHP-REST-Client
src/Endpoint/Abstracts/AbstractCollectionEndpoint.php
AbstractCollectionEndpoint.updateCollection
protected function updateCollection(){ $responseBody = $this->Response->getBody(); if (is_array($responseBody)){ if (isset($this->model)){ $modelIdKey = $this->buildModel()->modelIdKey(); foreach($responseBody as $key => $model){ if (isset(...
php
protected function updateCollection(){ $responseBody = $this->Response->getBody(); if (is_array($responseBody)){ if (isset($this->model)){ $modelIdKey = $this->buildModel()->modelIdKey(); foreach($responseBody as $key => $model){ if (isset(...
[ "protected", "function", "updateCollection", "(", ")", "{", "$", "responseBody", "=", "$", "this", "->", "Response", "->", "getBody", "(", ")", ";", "if", "(", "is_array", "(", "$", "responseBody", ")", ")", "{", "if", "(", "isset", "(", "$", "this", ...
Configures the collection based on the Response Body
[ "Configures", "the", "collection", "based", "on", "the", "Response", "Body" ]
train
https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Endpoint/Abstracts/AbstractCollectionEndpoint.php#L229-L245
MichaelJ2324/PHP-REST-Client
src/Endpoint/Abstracts/AbstractCollectionEndpoint.php
AbstractCollectionEndpoint.buildModel
protected function buildModel(array $data = array()){ $Model = NULL; if (isset($this->model)){ $Model = new $this->model(); $Model->setBaseUrl($this->getBaseUrl()); if ($this->getAuth() !== NULL) { $Model->setAuth($this->getAuth()); } ...
php
protected function buildModel(array $data = array()){ $Model = NULL; if (isset($this->model)){ $Model = new $this->model(); $Model->setBaseUrl($this->getBaseUrl()); if ($this->getAuth() !== NULL) { $Model->setAuth($this->getAuth()); } ...
[ "protected", "function", "buildModel", "(", "array", "$", "data", "=", "array", "(", ")", ")", "{", "$", "Model", "=", "NULL", ";", "if", "(", "isset", "(", "$", "this", "->", "model", ")", ")", "{", "$", "Model", "=", "new", "$", "this", "->", ...
Build the ModelEndpoint @param array $data @return AbstractModelEndpoint
[ "Build", "the", "ModelEndpoint" ]
train
https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Endpoint/Abstracts/AbstractCollectionEndpoint.php#L252-L267
Gendoria/command-queue
src/Gendoria/CommandQueue/QueueManager/MultipleQueueManager.php
MultipleQueueManager.addSendDriver
public function addSendDriver( $pool, SendDriverInterface $sendDriver, $isDefault = false ) { $this->sendDrivers[$pool] = $sendDriver; if (!$this->defaultPool || $isDefault) { $this->defaultPool = $pool; $this->poolDetector->setDefault($pool); } }
php
public function addSendDriver( $pool, SendDriverInterface $sendDriver, $isDefault = false ) { $this->sendDrivers[$pool] = $sendDriver; if (!$this->defaultPool || $isDefault) { $this->defaultPool = $pool; $this->poolDetector->setDefault($pool); } }
[ "public", "function", "addSendDriver", "(", "$", "pool", ",", "SendDriverInterface", "$", "sendDriver", ",", "$", "isDefault", "=", "false", ")", "{", "$", "this", "->", "sendDrivers", "[", "$", "pool", "]", "=", "$", "sendDriver", ";", "if", "(", "!", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/Gendoria/command-queue/blob/4e1094570705942f2ce3b2c976b5b251c3c84b40/src/Gendoria/CommandQueue/QueueManager/MultipleQueueManager.php#L74-L83
Gendoria/command-queue
src/Gendoria/CommandQueue/QueueManager/MultipleQueueManager.php
MultipleQueueManager.sendCommand
public function sendCommand(CommandInterface $command) { $poolName = $this->detectPool($command); if (!$poolName || empty($this->sendDrivers[$poolName])) { $this->logger->critical("Send driver not set for given command class, or no default send driver set.", array($comman...
php
public function sendCommand(CommandInterface $command) { $poolName = $this->detectPool($command); if (!$poolName || empty($this->sendDrivers[$poolName])) { $this->logger->critical("Send driver not set for given command class, or no default send driver set.", array($comman...
[ "public", "function", "sendCommand", "(", "CommandInterface", "$", "command", ")", "{", "$", "poolName", "=", "$", "this", "->", "detectPool", "(", "$", "command", ")", ";", "if", "(", "!", "$", "poolName", "||", "empty", "(", "$", "this", "->", "sendD...
{@inheritdoc}
[ "{" ]
train
https://github.com/Gendoria/command-queue/blob/4e1094570705942f2ce3b2c976b5b251c3c84b40/src/Gendoria/CommandQueue/QueueManager/MultipleQueueManager.php#L88-L99
Gendoria/command-queue
src/Gendoria/CommandQueue/QueueManager/MultipleQueueManager.php
MultipleQueueManager.detectPool
private function detectPool(CommandInterface $command) { $commandClass = get_class($command); return $this->poolDetector->detect($commandClass); }
php
private function detectPool(CommandInterface $command) { $commandClass = get_class($command); return $this->poolDetector->detect($commandClass); }
[ "private", "function", "detectPool", "(", "CommandInterface", "$", "command", ")", "{", "$", "commandClass", "=", "get_class", "(", "$", "command", ")", ";", "return", "$", "this", "->", "poolDetector", "->", "detect", "(", "$", "commandClass", ")", ";", "...
Detect correct pool for given command. @param CommandInterface $command @return string
[ "Detect", "correct", "pool", "for", "given", "command", "." ]
train
https://github.com/Gendoria/command-queue/blob/4e1094570705942f2ce3b2c976b5b251c3c84b40/src/Gendoria/CommandQueue/QueueManager/MultipleQueueManager.php#L117-L121
PieterScheffers/upperscore
src/Path.php
Path.combine
public function combine() { $paths = array_values( arrayFlatten(func_get_args()) ); $newPaths = array(); $nrOfPaths = count($paths); for ($i=0; $i < $nrOfPaths; $i++) { $path = $paths[$i]; $path = str_replace("\\", "/", $path); if( $i > 0 ) { $path = ltrim($path, "/"); } if( $i < ($nrOfP...
php
public function combine() { $paths = array_values( arrayFlatten(func_get_args()) ); $newPaths = array(); $nrOfPaths = count($paths); for ($i=0; $i < $nrOfPaths; $i++) { $path = $paths[$i]; $path = str_replace("\\", "/", $path); if( $i > 0 ) { $path = ltrim($path, "/"); } if( $i < ($nrOfP...
[ "public", "function", "combine", "(", ")", "{", "$", "paths", "=", "array_values", "(", "arrayFlatten", "(", "func_get_args", "(", ")", ")", ")", ";", "$", "newPaths", "=", "array", "(", ")", ";", "$", "nrOfPaths", "=", "count", "(", "$", "paths", ")...
/* Takes one or more paths as arguments and puts them together, so there are no slash conflicts between path-parts @param string/array Variable number of arguments. Arguments must be a path string or an array of path strings @return string combined path
[ "/", "*", "Takes", "one", "or", "more", "paths", "as", "arguments", "and", "puts", "them", "together", "so", "there", "are", "no", "slash", "conflicts", "between", "path", "-", "parts" ]
train
https://github.com/PieterScheffers/upperscore/blob/c020ea7e0fe2fd4b8dcfbc3159611b87c8337b15/src/Path.php#L14-L36
PieterScheffers/upperscore
src/Path.php
Path.sanitize
public function sanitize($path, $replacement = "_") { if($path === '') return $path; // make sure replacement isn't a bad character $replacement = $this->sanitize($replacement); // https://msdn.microsoft.com/en-us/library/aa365247 $forbidden = array( "\0", // NULL "<", ">", ":", "\"", ...
php
public function sanitize($path, $replacement = "_") { if($path === '') return $path; // make sure replacement isn't a bad character $replacement = $this->sanitize($replacement); // https://msdn.microsoft.com/en-us/library/aa365247 $forbidden = array( "\0", // NULL "<", ">", ":", "\"", ...
[ "public", "function", "sanitize", "(", "$", "path", ",", "$", "replacement", "=", "\"_\"", ")", "{", "if", "(", "$", "path", "===", "''", ")", "return", "$", "path", ";", "// make sure replacement isn't a bad character", "$", "replacement", "=", "$", "this",...
/* Sanitizes a path, so it is a valid path in Windows & Linux It replaces all bad characters with a character of choice @param string $path string of a path @param string $replacement character to use for replacement of bad characters @return string sanitized path
[ "/", "*", "Sanitizes", "a", "path", "so", "it", "is", "a", "valid", "path", "in", "Windows", "&", "Linux", "It", "replaces", "all", "bad", "characters", "with", "a", "character", "of", "choice" ]
train
https://github.com/PieterScheffers/upperscore/blob/c020ea7e0fe2fd4b8dcfbc3159611b87c8337b15/src/Path.php#L46-L113
OxfordInfoLabs/kinikit-core
src/Util/ArrayUtils.php
ArrayUtils.prefixArrayKeys
public static function prefixArrayKeys($array, $prefix) { $prefixedArray = array(); foreach ($array as $key => $value) { $prefixedArray [$prefix . $key] = $value; } return $prefixedArray; }
php
public static function prefixArrayKeys($array, $prefix) { $prefixedArray = array(); foreach ($array as $key => $value) { $prefixedArray [$prefix . $key] = $value; } return $prefixedArray; }
[ "public", "static", "function", "prefixArrayKeys", "(", "$", "array", ",", "$", "prefix", ")", "{", "$", "prefixedArray", "=", "array", "(", ")", ";", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "prefixedArray", ...
Take an associative array as input and return a new array with all the original keys prefixed by the passed prefix. @param array $array @param string $prefix @return array
[ "Take", "an", "associative", "array", "as", "input", "and", "return", "a", "new", "array", "with", "all", "the", "original", "keys", "prefixed", "by", "the", "passed", "prefix", "." ]
train
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L35-L44
OxfordInfoLabs/kinikit-core
src/Util/ArrayUtils.php
ArrayUtils.getAllArrayItemsByKeyPrefix
public static function getAllArrayItemsByKeyPrefix($array, $prefix, $stripPrefix = false) { $returnValues = array(); foreach ($array as $key => $value) { $positionOfPrefix = strpos($key, $prefix); if (is_numeric($positionOfPrefix) && $positionOfPrefix == 0) { if (...
php
public static function getAllArrayItemsByKeyPrefix($array, $prefix, $stripPrefix = false) { $returnValues = array(); foreach ($array as $key => $value) { $positionOfPrefix = strpos($key, $prefix); if (is_numeric($positionOfPrefix) && $positionOfPrefix == 0) { if (...
[ "public", "static", "function", "getAllArrayItemsByKeyPrefix", "(", "$", "array", ",", "$", "prefix", ",", "$", "stripPrefix", "=", "false", ")", "{", "$", "returnValues", "=", "array", "(", ")", ";", "foreach", "(", "$", "array", "as", "$", "key", "=>",...
Find all parameters in the passed array with a key starting with the supplied prefix. Return them as an associative array by key. @param array $array @param string $prefix @return array
[ "Find", "all", "parameters", "in", "the", "passed", "array", "with", "a", "key", "starting", "with", "the", "supplied", "prefix", ".", "Return", "them", "as", "an", "associative", "array", "by", "key", "." ]
train
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L55-L66
OxfordInfoLabs/kinikit-core
src/Util/ArrayUtils.php
ArrayUtils.arrayDiff
public static function arrayDiff($array1, $array2) { return array_udiff($array1, $array2, function ($a, $b) { if (is_object($a)) { return strcmp(spl_object_hash($a), spl_object_hash($b)); } else if (is_array($a)) { return ArrayU...
php
public static function arrayDiff($array1, $array2) { return array_udiff($array1, $array2, function ($a, $b) { if (is_object($a)) { return strcmp(spl_object_hash($a), spl_object_hash($b)); } else if (is_array($a)) { return ArrayU...
[ "public", "static", "function", "arrayDiff", "(", "$", "array1", ",", "$", "array2", ")", "{", "return", "array_udiff", "(", "$", "array1", ",", "$", "array2", ",", "function", "(", "$", "a", ",", "$", "b", ")", "{", "if", "(", "is_object", "(", "$...
Diff function for arrays which works with arrays of objects as well as string comparables. @param $array1 @param $array2
[ "Diff", "function", "for", "arrays", "which", "works", "with", "arrays", "of", "objects", "as", "well", "as", "string", "comparables", "." ]
train
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L87-L99
OxfordInfoLabs/kinikit-core
src/Util/ArrayUtils.php
ArrayUtils.recursiveMerge
public static function recursiveMerge($array1, $array2) { if ($array1 instanceof AssociativeArray) { $array1 = $array1->toArray(); } if ($array2 instanceof AssociativeArray) { $array2 = $array2->toArray(); } if (ArrayUtils::isAssociative($array1) != Arr...
php
public static function recursiveMerge($array1, $array2) { if ($array1 instanceof AssociativeArray) { $array1 = $array1->toArray(); } if ($array2 instanceof AssociativeArray) { $array2 = $array2->toArray(); } if (ArrayUtils::isAssociative($array1) != Arr...
[ "public", "static", "function", "recursiveMerge", "(", "$", "array1", ",", "$", "array2", ")", "{", "if", "(", "$", "array1", "instanceof", "AssociativeArray", ")", "{", "$", "array1", "=", "$", "array1", "->", "toArray", "(", ")", ";", "}", "if", "(",...
Recursively merge array1 and array2. If keys exist in both arrays at any level, take the value from array1 in preference. @param $array1 @param $array2
[ "Recursively", "merge", "array1", "and", "array2", ".", "If", "keys", "exist", "in", "both", "arrays", "at", "any", "level", "take", "the", "value", "from", "array1", "in", "preference", "." ]
train
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L107-L148
OxfordInfoLabs/kinikit-core
src/Util/ArrayUtils.php
ArrayUtils.recursiveDiff
public static function recursiveDiff($array1, $array2, $caseInsensitive = true, $matchingKeysOnly = true) { if ($array1 instanceof AssociativeArray) { $array1 = $array1->toArray(); } if ($array2 instanceof AssociativeArray) { $array2 = $array2->toArray(); } ...
php
public static function recursiveDiff($array1, $array2, $caseInsensitive = true, $matchingKeysOnly = true) { if ($array1 instanceof AssociativeArray) { $array1 = $array1->toArray(); } if ($array2 instanceof AssociativeArray) { $array2 = $array2->toArray(); } ...
[ "public", "static", "function", "recursiveDiff", "(", "$", "array1", ",", "$", "array2", ",", "$", "caseInsensitive", "=", "true", ",", "$", "matchingKeysOnly", "=", "true", ")", "{", "if", "(", "$", "array1", "instanceof", "AssociativeArray", ")", "{", "$...
Return an array of different elements within the 2 arrays. If matching keys only is supplied, only elements which exist in both but which are different are included. The returned array contains an associative array for each differing value with a "value1" and "value2" element. @param $array1 @param $array2 @param b...
[ "Return", "an", "array", "of", "different", "elements", "within", "the", "2", "arrays", ".", "If", "matching", "keys", "only", "is", "supplied", "only", "elements", "which", "exist", "in", "both", "but", "which", "are", "different", "are", "included", "." ]
train
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L161-L194
OxfordInfoLabs/kinikit-core
src/Util/ArrayUtils.php
ArrayUtils.reduceToElementsWithKey
public static function reduceToElementsWithKey($array, $key) { if ($array instanceof AssociativeArray) { $array = $array->toArray(); } $targetArray = array(); foreach ($array as $itemKey => $value) { if ($itemKey == $key) { $targetArray[$key] =...
php
public static function reduceToElementsWithKey($array, $key) { if ($array instanceof AssociativeArray) { $array = $array->toArray(); } $targetArray = array(); foreach ($array as $itemKey => $value) { if ($itemKey == $key) { $targetArray[$key] =...
[ "public", "static", "function", "reduceToElementsWithKey", "(", "$", "array", ",", "$", "key", ")", "{", "if", "(", "$", "array", "instanceof", "AssociativeArray", ")", "{", "$", "array", "=", "$", "array", "->", "toArray", "(", ")", ";", "}", "$", "ta...
Reduce the array to only elements with the passed key at any depth. @param $array @param $key
[ "Reduce", "the", "array", "to", "only", "elements", "with", "the", "passed", "key", "at", "any", "depth", "." ]
train
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L203-L226
OxfordInfoLabs/kinikit-core
src/Util/ArrayUtils.php
ArrayUtils.findElementsByKey
public static function findElementsByKey($array, $key, &$targetArray = null, $prefix = "") { if ($array instanceof AssociativeArray) { $array = $array->toArray(); } if (!$targetArray) $targetArray = array(); foreach ($array as $itemKey => $value) { ...
php
public static function findElementsByKey($array, $key, &$targetArray = null, $prefix = "") { if ($array instanceof AssociativeArray) { $array = $array->toArray(); } if (!$targetArray) $targetArray = array(); foreach ($array as $itemKey => $value) { ...
[ "public", "static", "function", "findElementsByKey", "(", "$", "array", ",", "$", "key", ",", "&", "$", "targetArray", "=", "null", ",", "$", "prefix", "=", "\"\"", ")", "{", "if", "(", "$", "array", "instanceof", "AssociativeArray", ")", "{", "$", "ar...
Find elements by key. @param $array @param $key
[ "Find", "elements", "by", "key", "." ]
train
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L235-L262
OxfordInfoLabs/kinikit-core
src/Util/ArrayUtils.php
ArrayUtils.groupElementsByValueKeys
public static function groupElementsByValueKeys($array, $groupKeys) { if (!is_array($groupKeys)) { $groupKeys = array($groupKeys); } $newArray = new AssociativeArray(); foreach ($array as $element) { $applyObject = $newArray; foreach ($groupKeys as ...
php
public static function groupElementsByValueKeys($array, $groupKeys) { if (!is_array($groupKeys)) { $groupKeys = array($groupKeys); } $newArray = new AssociativeArray(); foreach ($array as $element) { $applyObject = $newArray; foreach ($groupKeys as ...
[ "public", "static", "function", "groupElementsByValueKeys", "(", "$", "array", ",", "$", "groupKeys", ")", "{", "if", "(", "!", "is_array", "(", "$", "groupKeys", ")", ")", "{", "$", "groupKeys", "=", "array", "(", "$", "groupKeys", ")", ";", "}", "$",...
Group an array of elements by one or more of it's keys. Essentially convert into an indexed array for each key type. @param $array @param $groupKeys
[ "Group", "an", "array", "of", "elements", "by", "one", "or", "more", "of", "it", "s", "keys", ".", "Essentially", "convert", "into", "an", "indexed", "array", "for", "each", "key", "type", "." ]
train
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/ArrayUtils.php#L271-L302
phossa/phossa-config
src/Phossa/Config/Reference/TreeTrait.php
TreeTrait.&
protected function &searchTree( /*# string */ $key, /*# array */ &$tree, /*# bool */ $create = false ) { $found = &$tree; $parts = explode($this->field_splitter, $key); while (null !== ($part = array_shift($parts))) { if (!isset($found[$part])) { ...
php
protected function &searchTree( /*# string */ $key, /*# array */ &$tree, /*# bool */ $create = false ) { $found = &$tree; $parts = explode($this->field_splitter, $key); while (null !== ($part = array_shift($parts))) { if (!isset($found[$part])) { ...
[ "protected", "function", "&", "searchTree", "(", "/*# string */", "$", "key", ",", "/*# array */", "&", "$", "tree", ",", "/*# bool */", "$", "create", "=", "false", ")", "{", "$", "found", "=", "&", "$", "tree", ";", "$", "parts", "=", "explode", "(",...
Return a node in an array structure @param string $key something like 'db.auth.host' @param array &$tree the array tree @param bool $create create the node if missing @return null|array|string the matching node @access protected
[ "Return", "a", "node", "in", "an", "array", "structure" ]
train
https://github.com/phossa/phossa-config/blob/fdb90831da06408bb674ab777754e67025604bed/src/Phossa/Config/Reference/TreeTrait.php#L57-L76
phossa/phossa-config
src/Phossa/Config/Reference/TreeTrait.php
TreeTrait.fixValue
protected function fixValue(array $value)/*# : array */ { $result = []; foreach ($value as $k => $v) { if (false !== strpos($k, $this->field_splitter)) { $res = &$this->searchTree($k, $result, true); $res = is_array($v) ? $this->fixValue($v) : $v; ...
php
protected function fixValue(array $value)/*# : array */ { $result = []; foreach ($value as $k => $v) { if (false !== strpos($k, $this->field_splitter)) { $res = &$this->searchTree($k, $result, true); $res = is_array($v) ? $this->fixValue($v) : $v; ...
[ "protected", "function", "fixValue", "(", "array", "$", "value", ")", "/*# : array */", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "value", "as", "$", "k", "=>", "$", "v", ")", "{", "if", "(", "false", "!==", "strpos", "(", "$", ...
convert [ 'database.dsn' => 'xxx' ] to ['database' => [ 'dsn' => 'xxx' ]] @param array $value @return array @access protected
[ "convert", "[", "database", ".", "dsn", "=", ">", "xxx", "]", "to", "[", "database", "=", ">", "[", "dsn", "=", ">", "xxx", "]]" ]
train
https://github.com/phossa/phossa-config/blob/fdb90831da06408bb674ab777754e67025604bed/src/Phossa/Config/Reference/TreeTrait.php#L85-L97
honey-comb/resources
src/Console/HCGenerateDefaultPreviewThumbnails.php
HCGenerateDefaultPreviewThumbnails.handle
public function handle(): void { $start = $this->argument('start'); $end = $this->argument('end'); $disk = $this->argument('disk'); $resources = $this->resourceService->getRepository()->makeQuery() ->select('id', 'path', 'mime_type') ->setEagerLoads([]) ...
php
public function handle(): void { $start = $this->argument('start'); $end = $this->argument('end'); $disk = $this->argument('disk'); $resources = $this->resourceService->getRepository()->makeQuery() ->select('id', 'path', 'mime_type') ->setEagerLoads([]) ...
[ "public", "function", "handle", "(", ")", ":", "void", "{", "$", "start", "=", "$", "this", "->", "argument", "(", "'start'", ")", ";", "$", "end", "=", "$", "this", "->", "argument", "(", "'end'", ")", ";", "$", "disk", "=", "$", "this", "->", ...
Execute the console command. @return mixed
[ "Execute", "the", "console", "command", "." ]
train
https://github.com/honey-comb/resources/blob/9b82eb2fd99be99edfdc4e76803d95caf981e14b/src/Console/HCGenerateDefaultPreviewThumbnails.php#L73-L96
matteosister/CypressConsoleDefaultsBundle
Console/CommandDefault.php
CommandDefault.match
public function match(Command $command) { if ($this->isEmpty()) { return false; } if ($this->isRegExp()) { return 1 === preg_match($this->getName(), $command->getName()); } return $command->getName() === $this->getName(); }
php
public function match(Command $command) { if ($this->isEmpty()) { return false; } if ($this->isRegExp()) { return 1 === preg_match($this->getName(), $command->getName()); } return $command->getName() === $this->getName(); }
[ "public", "function", "match", "(", "Command", "$", "command", ")", "{", "if", "(", "$", "this", "->", "isEmpty", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "isRegExp", "(", ")", ")", "{", "return", "1", "===",...
@param \Symfony\Component\Console\Command\Command $command @return bool
[ "@param", "\\", "Symfony", "\\", "Component", "\\", "Console", "\\", "Command", "\\", "Command", "$command" ]
train
https://github.com/matteosister/CypressConsoleDefaultsBundle/blob/8f90f36327482f3ed9fba68ecf006e5249c3db6a/Console/CommandDefault.php#L50-L59
Dhii/factory-base
src/AbstractBaseCallbackFactory.php
AbstractBaseCallbackFactory.make
public function make($config = null) { try { return $this->_invokeCallable($this->_getFactoryCallback($config), [$config]); } catch (InvocationExceptionInterface $invocationException) { throw $this->_createCouldNotMakeException( $this->__('Could not make subje...
php
public function make($config = null) { try { return $this->_invokeCallable($this->_getFactoryCallback($config), [$config]); } catch (InvocationExceptionInterface $invocationException) { throw $this->_createCouldNotMakeException( $this->__('Could not make subje...
[ "public", "function", "make", "(", "$", "config", "=", "null", ")", "{", "try", "{", "return", "$", "this", "->", "_invokeCallable", "(", "$", "this", "->", "_getFactoryCallback", "(", "$", "config", ")", ",", "[", "$", "config", "]", ")", ";", "}", ...
{@inheritdoc} @since [*next-version*]
[ "{", "@inheritdoc", "}" ]
train
https://github.com/Dhii/factory-base/blob/eb6694178068ec58e0f2de9243f0eb98844511de/src/AbstractBaseCallbackFactory.php#L193-L213
Fenzland/php-http-client
libs/Request.php
Request.url
public function url( string$url ):self { $url= parse_url($url); if( !is_array($url) ) throw new \Exception("Url '$url' is invalid."); foreach( $url as $key=>$value ) { $this->$key= $value; } return $this; }
php
public function url( string$url ):self { $url= parse_url($url); if( !is_array($url) ) throw new \Exception("Url '$url' is invalid."); foreach( $url as $key=>$value ) { $this->$key= $value; } return $this; }
[ "public", "function", "url", "(", "string", "$", "url", ")", ":", "self", "{", "$", "url", "=", "parse_url", "(", "$", "url", ")", ";", "if", "(", "!", "is_array", "(", "$", "url", ")", ")", "throw", "new", "\\", "Exception", "(", "\"Url '$url' is ...
Method url @access public @param string $url @return self
[ "Method", "url" ]
train
https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/Request.php#L173-L186
Fenzland/php-http-client
libs/Request.php
Request.header
public function header( string$key, string$value ):self { $this->headers[ucwords( strtolower($key), '-' )]= $value; return $this; }
php
public function header( string$key, string$value ):self { $this->headers[ucwords( strtolower($key), '-' )]= $value; return $this; }
[ "public", "function", "header", "(", "string", "$", "key", ",", "string", "$", "value", ")", ":", "self", "{", "$", "this", "->", "headers", "[", "ucwords", "(", "strtolower", "(", "$", "key", ")", ",", "'-'", ")", "]", "=", "$", "value", ";", "r...
Method header @access public @param string $key @param string $value @return self
[ "Method", "header" ]
train
https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/Request.php#L233-L238
Fenzland/php-http-client
libs/Request.php
Request.send
public function send( string$body=null ):Response { $this->justSend($body); return new Response( $this, $this->handle ); }
php
public function send( string$body=null ):Response { $this->justSend($body); return new Response( $this, $this->handle ); }
[ "public", "function", "send", "(", "string", "$", "body", "=", "null", ")", ":", "Response", "{", "$", "this", "->", "justSend", "(", "$", "body", ")", ";", "return", "new", "Response", "(", "$", "this", ",", "$", "this", "->", "handle", ")", ";", ...
Method send @access public @param string $body @return Response
[ "Method", "send" ]
train
https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/Request.php#L249-L254
Fenzland/php-http-client
libs/Request.php
Request.sendFormData
public function sendFormData( FormData$body ):Response { if(!( in_array( $this->method, [ 'POST', 'PUT', 'PATCH', ] ) )){ throw new \Exception('FormData must be send with method POST, PUT or PATCH'); } $body->setRequest( $this ); return $this->send("$body"); }
php
public function sendFormData( FormData$body ):Response { if(!( in_array( $this->method, [ 'POST', 'PUT', 'PATCH', ] ) )){ throw new \Exception('FormData must be send with method POST, PUT or PATCH'); } $body->setRequest( $this ); return $this->send("$body"); }
[ "public", "function", "sendFormData", "(", "FormData", "$", "body", ")", ":", "Response", "{", "if", "(", "!", "(", "in_array", "(", "$", "this", "->", "method", ",", "[", "'POST'", ",", "'PUT'", ",", "'PATCH'", ",", "]", ")", ")", ")", "{", "throw...
Method sendFile @access public @param FormData $body @return Response
[ "Method", "sendFile" ]
train
https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/Request.php#L265-L274
Fenzland/php-http-client
libs/Request.php
Request.justSend
protected function justSend( string$body=null ) { $this->body= $body; if( $length= strlen($body) ) { $this->header( 'Content-Length', $length ); } $this->header( 'Connection', 'close' ); $this->sendHeader(); $this->sendBody($body); }
php
protected function justSend( string$body=null ) { $this->body= $body; if( $length= strlen($body) ) { $this->header( 'Content-Length', $length ); } $this->header( 'Connection', 'close' ); $this->sendHeader(); $this->sendBody($body); }
[ "protected", "function", "justSend", "(", "string", "$", "body", "=", "null", ")", "{", "$", "this", "->", "body", "=", "$", "body", ";", "if", "(", "$", "length", "=", "strlen", "(", "$", "body", ")", ")", "{", "$", "this", "->", "header", "(", ...
Method justSend @access protected @param string $body @return void
[ "Method", "justSend" ]
train
https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/Request.php#L470-L484
Fenzland/php-http-client
libs/Request.php
Request.sendHeader
protected function sendHeader() { $this->openHandle(); $target= $this->path.($this->query? '?'.$this->query : '' ).($this->fragment? '#'.$this->fragment : '' ); $this->writeLine("{$this->method} {$target} HTTP/{$this->version}"); $this->writeLine("Host: {$this->host}"); foreach( $this->headers as $key=>$v...
php
protected function sendHeader() { $this->openHandle(); $target= $this->path.($this->query? '?'.$this->query : '' ).($this->fragment? '#'.$this->fragment : '' ); $this->writeLine("{$this->method} {$target} HTTP/{$this->version}"); $this->writeLine("Host: {$this->host}"); foreach( $this->headers as $key=>$v...
[ "protected", "function", "sendHeader", "(", ")", "{", "$", "this", "->", "openHandle", "(", ")", ";", "$", "target", "=", "$", "this", "->", "path", ".", "(", "$", "this", "->", "query", "?", "'?'", ".", "$", "this", "->", "query", ":", "''", ")"...
Method sendHeader @access protected @return void
[ "Method", "sendHeader" ]
train
https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/Request.php#L493-L506
Fenzland/php-http-client
libs/Request.php
Request.openHandle
private function openHandle() { if( !$this->host ) throw new \Exception('Host is not defined.'); $this->handle= ($this->scheme==='https'? fsockopen( 'ssl://'.$this->host, $this->port?:443 ) : fsockopen( $this->host, $this->port?:80 ) ); }
php
private function openHandle() { if( !$this->host ) throw new \Exception('Host is not defined.'); $this->handle= ($this->scheme==='https'? fsockopen( 'ssl://'.$this->host, $this->port?:443 ) : fsockopen( $this->host, $this->port?:80 ) ); }
[ "private", "function", "openHandle", "(", ")", "{", "if", "(", "!", "$", "this", "->", "host", ")", "throw", "new", "\\", "Exception", "(", "'Host is not defined.'", ")", ";", "$", "this", "->", "handle", "=", "(", "$", "this", "->", "scheme", "===", ...
Method openHandle @access private @return void
[ "Method", "openHandle" ]
train
https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/Request.php#L515-L525
Fenzland/php-http-client
libs/Request.php
Request.write
private function write( string$content ) { $this->raw.= $content; fwrite( $this->handle, $content ); }
php
private function write( string$content ) { $this->raw.= $content; fwrite( $this->handle, $content ); }
[ "private", "function", "write", "(", "string", "$", "content", ")", "{", "$", "this", "->", "raw", ".=", "$", "content", ";", "fwrite", "(", "$", "this", "->", "handle", ",", "$", "content", ")", ";", "}" ]
Method write @access private @param string $content @return void
[ "Method", "write" ]
train
https://github.com/Fenzland/php-http-client/blob/2f8df0f5f5f81e45453efad02f8926167a029630/libs/Request.php#L592-L597
MetaModels/phpunit-contao-database
src/Contao/Database/FakeResult.php
FakeResult.addRow
public function addRow($data, $rowId = null) { if (($rowId === null) && isset($data['id'])) { $rowId = $data['id']; } if ($rowId === null) { $rowId = count($this->rows); } $this->rows[$rowId] = $data; return $this; }
php
public function addRow($data, $rowId = null) { if (($rowId === null) && isset($data['id'])) { $rowId = $data['id']; } if ($rowId === null) { $rowId = count($this->rows); } $this->rows[$rowId] = $data; return $this; }
[ "public", "function", "addRow", "(", "$", "data", ",", "$", "rowId", "=", "null", ")", "{", "if", "(", "(", "$", "rowId", "===", "null", ")", "&&", "isset", "(", "$", "data", "[", "'id'", "]", ")", ")", "{", "$", "rowId", "=", "$", "data", "[...
Add a row. @param array $data The row data. @param null|int $rowId The id for the row. @return FakeResult
[ "Add", "a", "row", "." ]
train
https://github.com/MetaModels/phpunit-contao-database/blob/aeb2ee10dac532fa73e2deb6457b6a167a1c01c7/src/Contao/Database/FakeResult.php#L44-L57
MetaModels/phpunit-contao-database
src/Contao/Database/FakeResult.php
FakeResult.addRows
public function addRows($data) { foreach ($data as $key => $row) { $this->addRow($row, isset($row['id']) ? $row['id'] : $key); } return $this; }
php
public function addRows($data) { foreach ($data as $key => $row) { $this->addRow($row, isset($row['id']) ? $row['id'] : $key); } return $this; }
[ "public", "function", "addRows", "(", "$", "data", ")", "{", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "row", ")", "{", "$", "this", "->", "addRow", "(", "$", "row", ",", "isset", "(", "$", "row", "[", "'id'", "]", ")", "?", "...
Add rows. @param array $data The row data. @return FakeResult
[ "Add", "rows", "." ]
train
https://github.com/MetaModels/phpunit-contao-database/blob/aeb2ee10dac532fa73e2deb6457b6a167a1c01c7/src/Contao/Database/FakeResult.php#L66-L73
MetaModels/phpunit-contao-database
src/Contao/Database/FakeResult.php
FakeResult.getRow
public function getRow($index) { $keys = array_keys($this->rows); return isset($keys[$index]) ? $this->rows[$keys[$index]] : null; }
php
public function getRow($index) { $keys = array_keys($this->rows); return isset($keys[$index]) ? $this->rows[$keys[$index]] : null; }
[ "public", "function", "getRow", "(", "$", "index", ")", "{", "$", "keys", "=", "array_keys", "(", "$", "this", "->", "rows", ")", ";", "return", "isset", "(", "$", "keys", "[", "$", "index", "]", ")", "?", "$", "this", "->", "rows", "[", "$", "...
Retrieve the row with the given index. @param int $index The index. @return array
[ "Retrieve", "the", "row", "with", "the", "given", "index", "." ]
train
https://github.com/MetaModels/phpunit-contao-database/blob/aeb2ee10dac532fa73e2deb6457b6a167a1c01c7/src/Contao/Database/FakeResult.php#L84-L89
perryflynn/PerrysLambda
src/PerrysLambda/ArrayList.php
ArrayList.asType
public static function asType($type, array $data) { $converter = new TypeStringListConverter($type); $converter->setArraySource($data); return new static($converter); }
php
public static function asType($type, array $data) { $converter = new TypeStringListConverter($type); $converter->setArraySource($data); return new static($converter); }
[ "public", "static", "function", "asType", "(", "$", "type", ",", "array", "$", "data", ")", "{", "$", "converter", "=", "new", "TypeStringListConverter", "(", "$", "type", ")", ";", "$", "converter", "->", "setArraySource", "(", "$", "data", ")", ";", ...
Create arraylist of class @param string $type @param mixed[] $data @return \PerrysLambda\ArrayList
[ "Create", "arraylist", "of", "class" ]
train
https://github.com/perryflynn/PerrysLambda/blob/9f1734ae4689d73278b887f9354dfd31428e96de/src/PerrysLambda/ArrayList.php#L32-L37
perryflynn/PerrysLambda
src/PerrysLambda/ArrayList.php
ArrayList.serialize
public function serialize() { if($this->__converter instanceof IListConverter) { return $this->__converter->toArray($this); } else { return $this->toArray(); } }
php
public function serialize() { if($this->__converter instanceof IListConverter) { return $this->__converter->toArray($this); } else { return $this->toArray(); } }
[ "public", "function", "serialize", "(", ")", "{", "if", "(", "$", "this", "->", "__converter", "instanceof", "IListConverter", ")", "{", "return", "$", "this", "->", "__converter", "->", "toArray", "(", "$", "this", ")", ";", "}", "else", "{", "return", ...
Serialize via converter @return mixed[]
[ "Serialize", "via", "converter" ]
train
https://github.com/perryflynn/PerrysLambda/blob/9f1734ae4689d73278b887f9354dfd31428e96de/src/PerrysLambda/ArrayList.php#L63-L73
perryflynn/PerrysLambda
src/PerrysLambda/ArrayList.php
ArrayList.serializeGenerator
public function serializeGenerator() { if($this->__converter instanceof IListConverter) { foreach($this->__converter->toGenerator($this) as $index => $row) { yield $index => $row; } } else { foreach($t...
php
public function serializeGenerator() { if($this->__converter instanceof IListConverter) { foreach($this->__converter->toGenerator($this) as $index => $row) { yield $index => $row; } } else { foreach($t...
[ "public", "function", "serializeGenerator", "(", ")", "{", "if", "(", "$", "this", "->", "__converter", "instanceof", "IListConverter", ")", "{", "foreach", "(", "$", "this", "->", "__converter", "->", "toGenerator", "(", "$", "this", ")", "as", "$", "inde...
Serialize via converter as generator @return mixed[]
[ "Serialize", "via", "converter", "as", "generator" ]
train
https://github.com/perryflynn/PerrysLambda/blob/9f1734ae4689d73278b887f9354dfd31428e96de/src/PerrysLambda/ArrayList.php#L79-L95
locomotivemtl/charcoal-translator
src/Charcoal/Translator/TranslatorConfig.php
TranslatorConfig.setTranslations
public function setTranslations(array $translations) { $this->translations = []; foreach ($translations as $domain => $data) { if (!is_array($data)) { throw new InvalidArgumentException( 'Translator translations must be a 3-level array' ...
php
public function setTranslations(array $translations) { $this->translations = []; foreach ($translations as $domain => $data) { if (!is_array($data)) { throw new InvalidArgumentException( 'Translator translations must be a 3-level array' ...
[ "public", "function", "setTranslations", "(", "array", "$", "translations", ")", "{", "$", "this", "->", "translations", "=", "[", "]", ";", "foreach", "(", "$", "translations", "as", "$", "domain", "=>", "$", "data", ")", "{", "if", "(", "!", "is_arra...
Set mapping of additional translations. Expects: ```json { "<domain>": { "<locale>": { "<translation-key>": "translation" } } } ``` @param array $translations Mapping of domains/locales/messages. @throws InvalidArgumentException If the path is not a string. @return TranslatorConfig Chainable
[ "Set", "mapping", "of", "additional", "translations", "." ]
train
https://github.com/locomotivemtl/charcoal-translator/blob/0a64432baef223dcccbfecf057015440dfa76e49/src/Charcoal/Translator/TranslatorConfig.php#L144-L166
ZFrapid/zf2rapid-domain
src/ZF2rapidDomain/Entity/AbstractEntity.php
AbstractEntity.exchangeArray
public function exchangeArray(array $array) { foreach ($array as $key => $value) { $setMethod = 'set' . StaticFilter::execute( $key, 'WordUnderscoreToCamelCase' ); if (method_exists($this, $setMethod)) { $this->$setMethod($value); ...
php
public function exchangeArray(array $array) { foreach ($array as $key => $value) { $setMethod = 'set' . StaticFilter::execute( $key, 'WordUnderscoreToCamelCase' ); if (method_exists($this, $setMethod)) { $this->$setMethod($value); ...
[ "public", "function", "exchangeArray", "(", "array", "$", "array", ")", "{", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "setMethod", "=", "'set'", ".", "StaticFilter", "::", "execute", "(", "$", "key", ",", "'W...
Exchange properties with values from array @param array $array
[ "Exchange", "properties", "with", "values", "from", "array" ]
train
https://github.com/ZFrapid/zf2rapid-domain/blob/9455689cac06b42025c144878604d27c28b4bb04/src/ZF2rapidDomain/Entity/AbstractEntity.php#L32-L43
ZFrapid/zf2rapid-domain
src/ZF2rapidDomain/Entity/AbstractEntity.php
AbstractEntity.getArrayCopy
public function getArrayCopy() { $data = []; foreach (get_object_vars($this) as $key => $value) { $getMethod = 'get' . ucfirst($key); $arrayKey = StaticFilter::execute($key, 'WordCamelCaseToUnderscore'); $arrayKey = StaticFilter::execute($arrayKey, 'StringToLowe...
php
public function getArrayCopy() { $data = []; foreach (get_object_vars($this) as $key => $value) { $getMethod = 'get' . ucfirst($key); $arrayKey = StaticFilter::execute($key, 'WordCamelCaseToUnderscore'); $arrayKey = StaticFilter::execute($arrayKey, 'StringToLowe...
[ "public", "function", "getArrayCopy", "(", ")", "{", "$", "data", "=", "[", "]", ";", "foreach", "(", "get_object_vars", "(", "$", "this", ")", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "getMethod", "=", "'get'", ".", "ucfirst", "(", "$"...
Generate an array copy from property values
[ "Generate", "an", "array", "copy", "from", "property", "values" ]
train
https://github.com/ZFrapid/zf2rapid-domain/blob/9455689cac06b42025c144878604d27c28b4bb04/src/ZF2rapidDomain/Entity/AbstractEntity.php#L48-L65
Fenzland/http-api-gluer
src/Gluer/THoldsSerializers_.php
THoldsSerializers_.registerSerializer_
static public function registerSerializer_( string$mime, $serializer ):string { static::checkSerializerNotRegistered_( $mime ); static::checkSerializer_( $serializer ); static::$serializers_[$mime]= $serializer; return self::class; }
php
static public function registerSerializer_( string$mime, $serializer ):string { static::checkSerializerNotRegistered_( $mime ); static::checkSerializer_( $serializer ); static::$serializers_[$mime]= $serializer; return self::class; }
[ "static", "public", "function", "registerSerializer_", "(", "string", "$", "mime", ",", "$", "serializer", ")", ":", "string", "{", "static", "::", "checkSerializerNotRegistered_", "(", "$", "mime", ")", ";", "static", "::", "checkSerializer_", "(", "$", "seri...
Static method registerSerializer_ @static @access public @param string $mime @param class|S\ASerializer $serializer @return class
[ "Static", "method", "registerSerializer_" ]
train
https://github.com/Fenzland/http-api-gluer/blob/3488de28b7f54fb444ec47f84034473a7d86e17e/src/Gluer/THoldsSerializers_.php#L26-L35
Fenzland/http-api-gluer
src/Gluer/THoldsSerializers_.php
THoldsSerializers_.checkSerializer_
static protected function checkSerializer_( $serializer ):void { if(!( ( is_object( $serializer ) && $serializer instanceof S\ASerializer ) or ( is_string( $serializer ) && class_exists( $serializer ) && isset( class_parents( $serializer )[S\ASerializer::class] ) ) )){ ...
php
static protected function checkSerializer_( $serializer ):void { if(!( ( is_object( $serializer ) && $serializer instanceof S\ASerializer ) or ( is_string( $serializer ) && class_exists( $serializer ) && isset( class_parents( $serializer )[S\ASerializer::class] ) ) )){ ...
[ "static", "protected", "function", "checkSerializer_", "(", "$", "serializer", ")", ":", "void", "{", "if", "(", "!", "(", "(", "is_object", "(", "$", "serializer", ")", "&&", "$", "serializer", "instanceof", "S", "\\", "ASerializer", ")", "or", "(", "is...
Static method checkSerializer_ @static @access protected @param mixed $serializer @return void
[ "Static", "method", "checkSerializer_" ]
train
https://github.com/Fenzland/http-api-gluer/blob/3488de28b7f54fb444ec47f84034473a7d86e17e/src/Gluer/THoldsSerializers_.php#L93-L116
Fenzland/http-api-gluer
src/Gluer/THoldsSerializers_.php
THoldsSerializers_.achieveSerializer_
static protected function achieveSerializer_( string$mime ):S\ASerializer { static::checkSerializerSupported_( $mime ); $serializer= static::getSerializer_( $mime ); return static::instantiateSerializer_( $serializer ); }
php
static protected function achieveSerializer_( string$mime ):S\ASerializer { static::checkSerializerSupported_( $mime ); $serializer= static::getSerializer_( $mime ); return static::instantiateSerializer_( $serializer ); }
[ "static", "protected", "function", "achieveSerializer_", "(", "string", "$", "mime", ")", ":", "S", "\\", "ASerializer", "{", "static", "::", "checkSerializerSupported_", "(", "$", "mime", ")", ";", "$", "serializer", "=", "static", "::", "getSerializer_", "("...
Static method achieveSerializer_ @static @access protected @param string $mime @return S\ASerializer
[ "Static", "method", "achieveSerializer_" ]
train
https://github.com/Fenzland/http-api-gluer/blob/3488de28b7f54fb444ec47f84034473a7d86e17e/src/Gluer/THoldsSerializers_.php#L171-L178
varunsridharan/wp-post
src/Post.php
Post.set_post
protected function set_post( $post ) { $this->post = $post; $this->id = ( isset( $post->ID ) ) ? $post->ID : false; if ( ! empty( $this->taxonomies() ) ) { foreach ( $this->taxonomies() as $taxonomy ) { $this->{$taxonomy} = $this->get_terms( $taxonomy, array( 'fields' => 'all' ) ); } } }
php
protected function set_post( $post ) { $this->post = $post; $this->id = ( isset( $post->ID ) ) ? $post->ID : false; if ( ! empty( $this->taxonomies() ) ) { foreach ( $this->taxonomies() as $taxonomy ) { $this->{$taxonomy} = $this->get_terms( $taxonomy, array( 'fields' => 'all' ) ); } } }
[ "protected", "function", "set_post", "(", "$", "post", ")", "{", "$", "this", "->", "post", "=", "$", "post", ";", "$", "this", "->", "id", "=", "(", "isset", "(", "$", "post", "->", "ID", ")", ")", "?", "$", "post", "->", "ID", ":", "false", ...
Sets Post Data. @param $post
[ "Sets", "Post", "Data", "." ]
train
https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L70-L79
varunsridharan/wp-post
src/Post.php
Post.featured_image_id
public function featured_image_id() { if ( isset( $this->featured_image_id ) ) { return $this->featured_image_id; } $this->featured_image_id = \get_post_thumbnail_id( $this->post ); return $this->featured_image_id; }
php
public function featured_image_id() { if ( isset( $this->featured_image_id ) ) { return $this->featured_image_id; } $this->featured_image_id = \get_post_thumbnail_id( $this->post ); return $this->featured_image_id; }
[ "public", "function", "featured_image_id", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "featured_image_id", ")", ")", "{", "return", "$", "this", "->", "featured_image_id", ";", "}", "$", "this", "->", "featured_image_id", "=", "\\", "get_po...
Returns Featured Image ID. @return bool|int|mixed|string
[ "Returns", "Featured", "Image", "ID", "." ]
train
https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L137-L143
varunsridharan/wp-post
src/Post.php
Post.featured_image_url
public function featured_image_url( $size = 'thumbnail', $default = '' ) { $featured_image = \get_the_post_thumbnail_url( $this->id(), $size ); return ( false !== $featured_image ) ? $featured_image : $default; }
php
public function featured_image_url( $size = 'thumbnail', $default = '' ) { $featured_image = \get_the_post_thumbnail_url( $this->id(), $size ); return ( false !== $featured_image ) ? $featured_image : $default; }
[ "public", "function", "featured_image_url", "(", "$", "size", "=", "'thumbnail'", ",", "$", "default", "=", "''", ")", "{", "$", "featured_image", "=", "\\", "get_the_post_thumbnail_url", "(", "$", "this", "->", "id", "(", ")", ",", "$", "size", ")", ";"...
Returns Featured Image URL. @param string $size @param string $default @return false|string
[ "Returns", "Featured", "Image", "URL", "." ]
train
https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L153-L156
varunsridharan/wp-post
src/Post.php
Post.parent
public function parent( $only_id = true ) { if ( $only_id ) { return $this->post->post_parent; } $class = get_called_class(); return new $class( $this->post->post_parent ); }
php
public function parent( $only_id = true ) { if ( $only_id ) { return $this->post->post_parent; } $class = get_called_class(); return new $class( $this->post->post_parent ); }
[ "public", "function", "parent", "(", "$", "only_id", "=", "true", ")", "{", "if", "(", "$", "only_id", ")", "{", "return", "$", "this", "->", "post", "->", "post_parent", ";", "}", "$", "class", "=", "get_called_class", "(", ")", ";", "return", "new"...
Returns Post Parent. @param boolean $only_id @return int
[ "Returns", "Post", "Parent", "." ]
train
https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L224-L230
varunsridharan/wp-post
src/Post.php
Post.update_meta
public function update_meta( $meta_key = '', $values = '', $prev_values = '' ) { return \update_post_meta( $this->id(), $meta_key, $values, $prev_values ); }
php
public function update_meta( $meta_key = '', $values = '', $prev_values = '' ) { return \update_post_meta( $this->id(), $meta_key, $values, $prev_values ); }
[ "public", "function", "update_meta", "(", "$", "meta_key", "=", "''", ",", "$", "values", "=", "''", ",", "$", "prev_values", "=", "''", ")", "{", "return", "\\", "update_post_meta", "(", "$", "this", "->", "id", "(", ")", ",", "$", "meta_key", ",", ...
Updates Post Meta. @param string $meta_key @param string $values @param string $prev_values @return bool|int
[ "Updates", "Post", "Meta", "." ]
train
https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L313-L315
varunsridharan/wp-post
src/Post.php
Post.add_meta
public function add_meta( $meta_key = '', $values = '', $unique = false ) { return \add_post_meta( $this->id(), $meta_key, $values, $unique ); }
php
public function add_meta( $meta_key = '', $values = '', $unique = false ) { return \add_post_meta( $this->id(), $meta_key, $values, $unique ); }
[ "public", "function", "add_meta", "(", "$", "meta_key", "=", "''", ",", "$", "values", "=", "''", ",", "$", "unique", "=", "false", ")", "{", "return", "\\", "add_post_meta", "(", "$", "this", "->", "id", "(", ")", ",", "$", "meta_key", ",", "$", ...
Adds Post Meta. @param string $meta_key @param string $values @param boolean|bool $unique @return bool|int
[ "Adds", "Post", "Meta", "." ]
train
https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L326-L328
varunsridharan/wp-post
src/Post.php
Post.taxonomies
public function taxonomies() { if ( ! empty( $this->taxes ) ) { return $this->taxes; } $taxes = \get_post_taxonomies( $this->post ); $this->taxes = $taxes; return $this->taxes; }
php
public function taxonomies() { if ( ! empty( $this->taxes ) ) { return $this->taxes; } $taxes = \get_post_taxonomies( $this->post ); $this->taxes = $taxes; return $this->taxes; }
[ "public", "function", "taxonomies", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "taxes", ")", ")", "{", "return", "$", "this", "->", "taxes", ";", "}", "$", "taxes", "=", "\\", "get_post_taxonomies", "(", "$", "this", "->", "pos...
Returns All Post Taxonomies. @return array
[ "Returns", "All", "Post", "Taxonomies", "." ]
train
https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L351-L358
varunsridharan/wp-post
src/Post.php
Post.get_terms
public function get_terms( $taxonomy = '', $args = array() ) { if ( isset( $this->{$taxonomy} ) && empty( $args ) ) { return $this->{$taxonomy}; } else { $name = $taxonomy . '_' . md5( json_encode( $args ) ); if ( isset( $this->{$name} ) ) { return $this->{$name}; } $data = \wp_get_post_...
php
public function get_terms( $taxonomy = '', $args = array() ) { if ( isset( $this->{$taxonomy} ) && empty( $args ) ) { return $this->{$taxonomy}; } else { $name = $taxonomy . '_' . md5( json_encode( $args ) ); if ( isset( $this->{$name} ) ) { return $this->{$name}; } $data = \wp_get_post_...
[ "public", "function", "get_terms", "(", "$", "taxonomy", "=", "''", ",", "$", "args", "=", "array", "(", ")", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "{", "$", "taxonomy", "}", ")", "&&", "empty", "(", "$", "args", ")", ")", "{", ...
Returns All Terms From Post. @param string $taxonomy @param array $args @return array|\WP_Error
[ "Returns", "All", "Terms", "From", "Post", "." ]
train
https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L368-L380
varunsridharan/wp-post
src/Post.php
Post.set_terms
public function set_terms( $terms = array(), $taxonomy = '', $append = false ) { return \wp_set_post_terms( $this->id(), $terms, $taxonomy, $append ); }
php
public function set_terms( $terms = array(), $taxonomy = '', $append = false ) { return \wp_set_post_terms( $this->id(), $terms, $taxonomy, $append ); }
[ "public", "function", "set_terms", "(", "$", "terms", "=", "array", "(", ")", ",", "$", "taxonomy", "=", "''", ",", "$", "append", "=", "false", ")", "{", "return", "\\", "wp_set_post_terms", "(", "$", "this", "->", "id", "(", ")", ",", "$", "terms...
Sets Given Terms With Tax To The Current Post. @param array $terms @param string $taxonomy @param bool $append @return array|false|\WP_Error
[ "Sets", "Given", "Terms", "With", "Tax", "To", "The", "Current", "Post", "." ]
train
https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L391-L393
varunsridharan/wp-post
src/Post.php
Post.in
public function in( $key = '', $data = '', $default = false ) { if ( is_array( $data ) ) { return ( in_array( $key, $data ) ) ? $key : $default; } if ( isset( $this->{$data} ) ) { return ( in_array( $key, $this->{$data} ) ) ? $key : $default; } return $default; }
php
public function in( $key = '', $data = '', $default = false ) { if ( is_array( $data ) ) { return ( in_array( $key, $data ) ) ? $key : $default; } if ( isset( $this->{$data} ) ) { return ( in_array( $key, $this->{$data} ) ) ? $key : $default; } return $default; }
[ "public", "function", "in", "(", "$", "key", "=", "''", ",", "$", "data", "=", "''", ",", "$", "default", "=", "false", ")", "{", "if", "(", "is_array", "(", "$", "data", ")", ")", "{", "return", "(", "in_array", "(", "$", "key", ",", "$", "d...
Checks if given key is in array @uses \in_array() @uses \VS_WP_Post @example in('somekey','post_category','no') post_category will be taken from post data. @example in('somekey',array('somekey' => 'somekey'), will be used the given array. @param string $key @param string $data @param bool $default @return bool|st...
[ "Checks", "if", "given", "key", "is", "in", "array" ]
train
https://github.com/varunsridharan/wp-post/blob/064bdc55c945b08480c841c1b99502eb8df148e1/src/Post.php#L415-L423
nattreid/mailing
src/BaseMailer.php
BaseMailer.createMail
protected function createMail(string $template): Mail { $mail = $this->mailFactory->create($template, $this->basePath); $mail->setFrom($this->sender); return $mail; }
php
protected function createMail(string $template): Mail { $mail = $this->mailFactory->create($template, $this->basePath); $mail->setFrom($this->sender); return $mail; }
[ "protected", "function", "createMail", "(", "string", "$", "template", ")", ":", "Mail", "{", "$", "mail", "=", "$", "this", "->", "mailFactory", "->", "create", "(", "$", "template", ",", "$", "this", "->", "basePath", ")", ";", "$", "mail", "->", "...
Vytvori instanci mailu @param string $template @return Mail
[ "Vytvori", "instanci", "mailu" ]
train
https://github.com/nattreid/mailing/blob/d61750a47c38d7533294d74d6601ca99a25f1b7c/src/BaseMailer.php#L46-L51
nattreid/mailing
src/BaseMailer.php
BaseMailer.createMailFromString
protected function createMailFromString(string $latte): Mail { $mail = $this->createMail($latte); $mail->setStringLoader(); return $mail; }
php
protected function createMailFromString(string $latte): Mail { $mail = $this->createMail($latte); $mail->setStringLoader(); return $mail; }
[ "protected", "function", "createMailFromString", "(", "string", "$", "latte", ")", ":", "Mail", "{", "$", "mail", "=", "$", "this", "->", "createMail", "(", "$", "latte", ")", ";", "$", "mail", "->", "setStringLoader", "(", ")", ";", "return", "$", "ma...
Vytvori instanci mailu @param string $latte @return Mail
[ "Vytvori", "instanci", "mailu" ]
train
https://github.com/nattreid/mailing/blob/d61750a47c38d7533294d74d6601ca99a25f1b7c/src/BaseMailer.php#L58-L63
nattreid/mailing
src/BaseMailer.php
BaseMailer.link
protected function link(string $destination, array $args = []): string { return $this->linkGenerator->link($destination, $args); }
php
protected function link(string $destination, array $args = []): string { return $this->linkGenerator->link($destination, $args); }
[ "protected", "function", "link", "(", "string", "$", "destination", ",", "array", "$", "args", "=", "[", "]", ")", ":", "string", "{", "return", "$", "this", "->", "linkGenerator", "->", "link", "(", "$", "destination", ",", "$", "args", ")", ";", "}...
Generuje link @param string $destination destination in format "[[module:]presenter:]action" or "signal!" or "this" @param array $args @return string @throws InvalidLinkException
[ "Generuje", "link" ]
train
https://github.com/nattreid/mailing/blob/d61750a47c38d7533294d74d6601ca99a25f1b7c/src/BaseMailer.php#L72-L75
fuelphp-storage/security
src/Providers/FuelServiceProvider.php
FuelServiceProvider.register
public function register() { $this->container->add('security', function (array $config = []) { $configInstance = $this->container->get('configInstance'); $config = \Arr::merge($configInstance->load('security', true), $config); return new Security\Manager($config); }); $this->container->add('securit...
php
public function register() { $this->container->add('security', function (array $config = []) { $configInstance = $this->container->get('configInstance'); $config = \Arr::merge($configInstance->load('security', true), $config); return new Security\Manager($config); }); $this->container->add('securit...
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "container", "->", "add", "(", "'security'", ",", "function", "(", "array", "$", "config", "=", "[", "]", ")", "{", "$", "configInstance", "=", "$", "this", "->", "container", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/fuelphp-storage/security/blob/2cad42a8432bc9c9de46486623b71e105ff84b1b/src/Providers/FuelServiceProvider.php#L33-L53
linpax/microphp-framework
src/cli/CliApplication.php
CliApplication.doException
protected function doException(\Exception $e) { $command = new DefaultConsoleCommand(); $command->data = '"Error #' . $e->getCode() . ' - ' . $e->getMessage() . '"'; $command->execute(); $response = (new ResponseInjector)->build(); $response = $response->withHeader('status',...
php
protected function doException(\Exception $e) { $command = new DefaultConsoleCommand(); $command->data = '"Error #' . $e->getCode() . ' - ' . $e->getMessage() . '"'; $command->execute(); $response = (new ResponseInjector)->build(); $response = $response->withHeader('status',...
[ "protected", "function", "doException", "(", "\\", "Exception", "$", "e", ")", "{", "$", "command", "=", "new", "DefaultConsoleCommand", "(", ")", ";", "$", "command", "->", "data", "=", "'\"Error #'", ".", "$", "e", "->", "getCode", "(", ")", ".", "' ...
Run application with error @param \Exception $e @return ResponseInterface @throws \InvalidArgumentException|\RuntimeException|Exception
[ "Run", "application", "with", "error" ]
train
https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/cli/CliApplication.php#L30-L43
sil-project/StockBundle
src/Domain/Factory/StockUnitFactory.php
StockUnitFactory.createNew
public function createNew(StockItemInterface $item, UomQty $qty, Location $location, ?BatchInterface $batch = null): StockUnit { $code = $this->codeGenerator->generate($item, $qty, $location, $batch); return StockUnit::createDefault($code, $item, $qty, $location, $batch); }
php
public function createNew(StockItemInterface $item, UomQty $qty, Location $location, ?BatchInterface $batch = null): StockUnit { $code = $this->codeGenerator->generate($item, $qty, $location, $batch); return StockUnit::createDefault($code, $item, $qty, $location, $batch); }
[ "public", "function", "createNew", "(", "StockItemInterface", "$", "item", ",", "UomQty", "$", "qty", ",", "Location", "$", "location", ",", "?", "BatchInterface", "$", "batch", "=", "null", ")", ":", "StockUnit", "{", "$", "code", "=", "$", "this", "->"...
@param StockItemInterface $item @param UomQty $qty @param Location $location @param BatchInterface|null $batch @return StockUnit
[ "@param", "StockItemInterface", "$item", "@param", "UomQty", "$qty", "@param", "Location", "$location", "@param", "BatchInterface|null", "$batch" ]
train
https://github.com/sil-project/StockBundle/blob/c1af70e000d56cd53e8ad0dedaed9841bd2ea8a8/src/Domain/Factory/StockUnitFactory.php#L50-L56
sil-project/StockBundle
src/Domain/Factory/StockUnitFactory.php
StockUnitFactory.createFrom
public function createFrom(StockUnit $srcUnit, Location $location): StockUnit { $code = $this->codeGenerator->generate($srcUnit->getStockItem(), $srcUnit->getQty(), $location, $srcUnit->getBatch()); return StockUnit::createDefault($code, $srcUnit->getStockItem(), $srcUnit->g...
php
public function createFrom(StockUnit $srcUnit, Location $location): StockUnit { $code = $this->codeGenerator->generate($srcUnit->getStockItem(), $srcUnit->getQty(), $location, $srcUnit->getBatch()); return StockUnit::createDefault($code, $srcUnit->getStockItem(), $srcUnit->g...
[ "public", "function", "createFrom", "(", "StockUnit", "$", "srcUnit", ",", "Location", "$", "location", ")", ":", "StockUnit", "{", "$", "code", "=", "$", "this", "->", "codeGenerator", "->", "generate", "(", "$", "srcUnit", "->", "getStockItem", "(", ")",...
@param StockUnit $srcUnit @param Location $location @return StockUnit
[ "@param", "StockUnit", "$srcUnit", "@param", "Location", "$location" ]
train
https://github.com/sil-project/StockBundle/blob/c1af70e000d56cd53e8ad0dedaed9841bd2ea8a8/src/Domain/Factory/StockUnitFactory.php#L64-L71
Wedeto/Util
src/DI/DI.php
DI.startNewContext
public static function startNewContext(string $name, bool $inherit = true) { if ($inherit) { $current = static::getInjector(); $new_injector = new Injector($current); } else $new_injector = new Injector(); return static::$injectors[$name] ...
php
public static function startNewContext(string $name, bool $inherit = true) { if ($inherit) { $current = static::getInjector(); $new_injector = new Injector($current); } else $new_injector = new Injector(); return static::$injectors[$name] ...
[ "public", "static", "function", "startNewContext", "(", "string", "$", "name", ",", "bool", "$", "inherit", "=", "true", ")", "{", "if", "(", "$", "inherit", ")", "{", "$", "current", "=", "static", "::", "getInjector", "(", ")", ";", "$", "new_injecto...
Start a new injection context. Useful to be able to release all static context to a certain run of the software, for example in testing. @param string $name A name for the injection context @param bool $inherit True to inherit instances from the current injector, false to start with an empty set.
[ "Start", "a", "new", "injection", "context", ".", "Useful", "to", "be", "able", "to", "release", "all", "static", "context", "to", "a", "certain", "run", "of", "the", "software", "for", "example", "in", "testing", "." ]
train
https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DI/DI.php#L63-L74
Wedeto/Util
src/DI/DI.php
DI.destroyContext
public static function destroyContext(string $name) { end(static::$injectors); if ($name !== key(static::$injectors)) throw new DIException("Injection context $name is not at top of the stack"); $injector = array_pop(static::$injectors); }
php
public static function destroyContext(string $name) { end(static::$injectors); if ($name !== key(static::$injectors)) throw new DIException("Injection context $name is not at top of the stack"); $injector = array_pop(static::$injectors); }
[ "public", "static", "function", "destroyContext", "(", "string", "$", "name", ")", "{", "end", "(", "static", "::", "$", "injectors", ")", ";", "if", "(", "$", "name", "!==", "key", "(", "static", "::", "$", "injectors", ")", ")", "throw", "new", "DI...
Destroy a context - the injector at the top of the stack is released. @param string $name The name of the injection context @throws DIException When the injection context is not at the top of the stack
[ "Destroy", "a", "context", "-", "the", "injector", "at", "the", "top", "of", "the", "stack", "is", "released", "." ]
train
https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DI/DI.php#L83-L90
wasinger/adaptimage
src/ThumbnailGenerator.php
ThumbnailGenerator.thumbnail
public function thumbnail($really_do_it, ImageFileInfo $image) { return $this->resizer->resize($this->ird, $image, $really_do_it); }
php
public function thumbnail($really_do_it, ImageFileInfo $image) { return $this->resizer->resize($this->ird, $image, $really_do_it); }
[ "public", "function", "thumbnail", "(", "$", "really_do_it", ",", "ImageFileInfo", "$", "image", ")", "{", "return", "$", "this", "->", "resizer", "->", "resize", "(", "$", "this", "->", "ird", ",", "$", "image", ",", "$", "really_do_it", ")", ";", "}"...
Get a thumbnail for an image If the thumbnail is already generated and cached, return the cached thumbnail. If the thumbnail is not yet in the cache, the thumbnail will be generated and cached, but only if the first param $really_do_it is TRUE. If it is FALSE, an ImageFileInfo is returned that contains the resulting s...
[ "Get", "a", "thumbnail", "for", "an", "image" ]
train
https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ThumbnailGenerator.php#L65-L68
g4code/utility
src/Cleaner.php
Cleaner.get
public function get($variable, $default = '', $allowed = '', $escape = true) { // if this is an array or object, don't destroy it, just return if(isset($variable) && (is_array($variable) || is_object($variable))) { return $variable; } // now check if is set? $var...
php
public function get($variable, $default = '', $allowed = '', $escape = true) { // if this is an array or object, don't destroy it, just return if(isset($variable) && (is_array($variable) || is_object($variable))) { return $variable; } // now check if is set? $var...
[ "public", "function", "get", "(", "$", "variable", ",", "$", "default", "=", "''", ",", "$", "allowed", "=", "''", ",", "$", "escape", "=", "true", ")", "{", "// if this is an array or object, don't destroy it, just return", "if", "(", "isset", "(", "$", "va...
Takes variable and returns the same if is set otherwise returns $default @param mixed $variable - variable @param mixed $default - default value if variable not set @param mixed $allowed - array of allowed values @param bool $escape - escape quotes @return mixed
[ "Takes", "variable", "and", "returns", "the", "same", "if", "is", "set", "otherwise", "returns", "$default" ]
train
https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Cleaner.php#L33-L51
g4code/utility
src/Cleaner.php
Cleaner.getHtml
public function getHtml($variable, $default = '', $allowed = "", $escape = true) { return (string) rawurldecode($this->get($variable, $default, $allowed, $escape)); }
php
public function getHtml($variable, $default = '', $allowed = "", $escape = true) { return (string) rawurldecode($this->get($variable, $default, $allowed, $escape)); }
[ "public", "function", "getHtml", "(", "$", "variable", ",", "$", "default", "=", "''", ",", "$", "allowed", "=", "\"\"", ",", "$", "escape", "=", "true", ")", "{", "return", "(", "string", ")", "rawurldecode", "(", "$", "this", "->", "get", "(", "$...
Same as _get, but it rawurldecodes the string @param mixed $variable - variable @param mixed $default - default value if variable not set @param mixed $allowed - array of allowed values @param bool $escape - escape quotes @return string
[ "Same", "as", "_get", "but", "it", "rawurldecodes", "the", "string" ]
train
https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Cleaner.php#L62-L65
g4code/utility
src/Cleaner.php
Cleaner.getString
public function getString($variable, $default = '', $allowed = "", $escape = true) { return (string) strip_tags($this->getHtml($variable, $default, $allowed, $escape)); }
php
public function getString($variable, $default = '', $allowed = "", $escape = true) { return (string) strip_tags($this->getHtml($variable, $default, $allowed, $escape)); }
[ "public", "function", "getString", "(", "$", "variable", ",", "$", "default", "=", "''", ",", "$", "allowed", "=", "\"\"", ",", "$", "escape", "=", "true", ")", "{", "return", "(", "string", ")", "strip_tags", "(", "$", "this", "->", "getHtml", "(", ...
Same as _getHtml, but it also strips tags @param mixed $variable - variable @param mixed $default - default value if variable not set @param mixed $allowed - array of allowed values @param bool $escape - escape quotes @return string
[ "Same", "as", "_getHtml", "but", "it", "also", "strips", "tags" ]
train
https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Cleaner.php#L76-L79
g4code/utility
src/Cleaner.php
Cleaner.getBool
public function getBool($variable, $default = false) { return (bool) $this->get($variable, $default, array(false, true), false); }
php
public function getBool($variable, $default = false) { return (bool) $this->get($variable, $default, array(false, true), false); }
[ "public", "function", "getBool", "(", "$", "variable", ",", "$", "default", "=", "false", ")", "{", "return", "(", "bool", ")", "$", "this", "->", "get", "(", "$", "variable", ",", "$", "default", ",", "array", "(", "false", ",", "true", ")", ",", ...
Same as _get but casts return value to bollean @access public @param mixed $variable - variable @return bool
[ "Same", "as", "_get", "but", "casts", "return", "value", "to", "bollean" ]
train
https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Cleaner.php#L116-L119
g4code/utility
src/Cleaner.php
Cleaner.escape
public function escape($variable, $default = "", $allowed = "", $paranoid = true) { $variable = $paranoid ? $this->getString($variable, $default, $allowed, false) : $this->get($variable, $default, $allowed, false); if(!DI::has('db')) { throw new \Exception('DB ob...
php
public function escape($variable, $default = "", $allowed = "", $paranoid = true) { $variable = $paranoid ? $this->getString($variable, $default, $allowed, false) : $this->get($variable, $default, $allowed, false); if(!DI::has('db')) { throw new \Exception('DB ob...
[ "public", "function", "escape", "(", "$", "variable", ",", "$", "default", "=", "\"\"", ",", "$", "allowed", "=", "\"\"", ",", "$", "paranoid", "=", "true", ")", "{", "$", "variable", "=", "$", "paranoid", "?", "$", "this", "->", "getString", "(", ...
Takes variable and returns the same if is set otherwise returns $default escapes it to use with mysql @access public @param mixed $variable - variable @param mixed $default - default value if variable not set @param mixed $allowed - array of allowed values @param bool $paranoid - if paranoid, strip tags @return mixed
[ "Takes", "variable", "and", "returns", "the", "same", "if", "is", "set", "otherwise", "returns", "$default", "escapes", "it", "to", "use", "with", "mysql" ]
train
https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Cleaner.php#L132-L146
g4code/utility
src/Cleaner.php
Cleaner.escapeHTML
public function escapeHTML($variable, $default = "", $allowed = "", $paranoid = true) { $variable = $paranoid ? $this->htmlEncode(rawurldecode($this->get($variable, $default, $allowed, false)), ENT_NOQUOTES, 'UTF-8', false) : $this->get($variable, $default, $allowed, false); ...
php
public function escapeHTML($variable, $default = "", $allowed = "", $paranoid = true) { $variable = $paranoid ? $this->htmlEncode(rawurldecode($this->get($variable, $default, $allowed, false)), ENT_NOQUOTES, 'UTF-8', false) : $this->get($variable, $default, $allowed, false); ...
[ "public", "function", "escapeHTML", "(", "$", "variable", ",", "$", "default", "=", "\"\"", ",", "$", "allowed", "=", "\"\"", ",", "$", "paranoid", "=", "true", ")", "{", "$", "variable", "=", "$", "paranoid", "?", "$", "this", "->", "htmlEncode", "(...
Takes variable and returns the same if is set otherwise returns $default escapes it to use with mysql @access public @param mixed $variable - variable @param mixed $default - default value if variable not set @param mixed $allowed - array of allowed values @param bool $paranoid - if paranoid, strip tags @return mixed
[ "Takes", "variable", "and", "returns", "the", "same", "if", "is", "set", "otherwise", "returns", "$default", "escapes", "it", "to", "use", "with", "mysql" ]
train
https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Cleaner.php#L159-L173
g4code/utility
src/Cleaner.php
Cleaner.htmlEncode
public function htmlEncode($string, $quoteStyle = ENT_QUOTES, $charset = 'UTF-8', $doubleEncode = false) { return htmlspecialchars((string) $string, $quoteStyle, $charset, $doubleEncode); }
php
public function htmlEncode($string, $quoteStyle = ENT_QUOTES, $charset = 'UTF-8', $doubleEncode = false) { return htmlspecialchars((string) $string, $quoteStyle, $charset, $doubleEncode); }
[ "public", "function", "htmlEncode", "(", "$", "string", ",", "$", "quoteStyle", "=", "ENT_QUOTES", ",", "$", "charset", "=", "'UTF-8'", ",", "$", "doubleEncode", "=", "false", ")", "{", "return", "htmlspecialchars", "(", "(", "string", ")", "$", "string", ...
Replacement for htmlspecialchars @param string $string @param int $quoteStyle default ENT_QUOTES @param string $charset default UTF-8 @param bool $doubleEncode - when double_encode is turned off PHP will not encode existing html entities @return string
[ "Replacement", "for", "htmlspecialchars" ]
train
https://github.com/g4code/utility/blob/e0c9138aab61a53d88f32bb66201b075f3f44f1d/src/Cleaner.php#L184-L187
stubbles/stubbles-dbal
src/main/php/Database.php
Database.query
public function query(string $sql, array $values = []): int { return $this->dbConnection->prepare($sql) ->execute($values) ->count(); }
php
public function query(string $sql, array $values = []): int { return $this->dbConnection->prepare($sql) ->execute($values) ->count(); }
[ "public", "function", "query", "(", "string", "$", "sql", ",", "array", "$", "values", "=", "[", "]", ")", ":", "int", "{", "return", "$", "this", "->", "dbConnection", "->", "prepare", "(", "$", "sql", ")", "->", "execute", "(", "$", "values", ")"...
sends a query to the database and returns amount of affected records @param string $sql @param array $values @return int @since 3.1.0
[ "sends", "a", "query", "to", "the", "database", "and", "returns", "amount", "of", "affected", "records" ]
train
https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/Database.php#L57-L62
stubbles/stubbles-dbal
src/main/php/Database.php
Database.fetchOne
public function fetchOne(string $sql, array $values = [], int $columnNumber = 0): string { return $this->dbConnection->prepare($sql) ->execute($values) ->fetchOne($columnNumber); }
php
public function fetchOne(string $sql, array $values = [], int $columnNumber = 0): string { return $this->dbConnection->prepare($sql) ->execute($values) ->fetchOne($columnNumber); }
[ "public", "function", "fetchOne", "(", "string", "$", "sql", ",", "array", "$", "values", "=", "[", "]", ",", "int", "$", "columnNumber", "=", "0", ")", ":", "string", "{", "return", "$", "this", "->", "dbConnection", "->", "prepare", "(", "$", "sql"...
fetch single value from a result set @param string $sql sql query to fetch data with @param array $values map of values in case $sql contains a prepared statement @param int $columnNumber optional the column number to fetch, default is first column @return string @throws \stubbles\d...
[ "fetch", "single", "value", "from", "a", "result", "set" ]
train
https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/Database.php#L74-L79
stubbles/stubbles-dbal
src/main/php/Database.php
Database.fetchAll
public function fetchAll( string $sql, array $values = [], int $fetchMode = null, array $driverOptions = [] ): Sequence { return Sequence::of(new QueryResultIterator( $this->dbConnection->prepare($sql)->execute($values), $fetchM...
php
public function fetchAll( string $sql, array $values = [], int $fetchMode = null, array $driverOptions = [] ): Sequence { return Sequence::of(new QueryResultIterator( $this->dbConnection->prepare($sql)->execute($values), $fetchM...
[ "public", "function", "fetchAll", "(", "string", "$", "sql", ",", "array", "$", "values", "=", "[", "]", ",", "int", "$", "fetchMode", "=", "null", ",", "array", "$", "driverOptions", "=", "[", "]", ")", ":", "Sequence", "{", "return", "Sequence", ":...
return all result rows for given sql query Allows to fetch all results for a query at once. <code> $blockedUsers = $database->fetchAll('SELECT * FROM users WHERE status = "blocked"'); </code> Now $blockedUsers contains all rows from the query. @param string $sql sql query to fetch data with @param arr...
[ "return", "all", "result", "rows", "for", "given", "sql", "query" ]
train
https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/Database.php#L96-L107
stubbles/stubbles-dbal
src/main/php/Database.php
Database.fetchRow
public function fetchRow( string $sql, array $values = [], int $fetchMode = null, array $driverOptions = [] ): array { return $this->dbConnection->prepare($sql) ->execute($values) ->fetch($fetchMode, $driverOptions); }
php
public function fetchRow( string $sql, array $values = [], int $fetchMode = null, array $driverOptions = [] ): array { return $this->dbConnection->prepare($sql) ->execute($values) ->fetch($fetchMode, $driverOptions); }
[ "public", "function", "fetchRow", "(", "string", "$", "sql", ",", "array", "$", "values", "=", "[", "]", ",", "int", "$", "fetchMode", "=", "null", ",", "array", "$", "driverOptions", "=", "[", "]", ")", ":", "array", "{", "return", "$", "this", "-...
returns first result row for given sql query @param string $sql sql query to fetch data with @param array $values map of values in case $sql contains a prepared statement @param int $fetchMode optional the mode to use for fetching the data @param array $driverOptions optional...
[ "returns", "first", "result", "row", "for", "given", "sql", "query" ]
train
https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/Database.php#L119-L128
stubbles/stubbles-dbal
src/main/php/Database.php
Database.fetchColumn
public function fetchColumn( string $sql, array $values = [], int $columnIndex = 0 ): Sequence { return $this->fetchAll( $sql, $values, \PDO::FETCH_COLUMN, ['columnIndex' => $columnIndex] ); }
php
public function fetchColumn( string $sql, array $values = [], int $columnIndex = 0 ): Sequence { return $this->fetchAll( $sql, $values, \PDO::FETCH_COLUMN, ['columnIndex' => $columnIndex] ); }
[ "public", "function", "fetchColumn", "(", "string", "$", "sql", ",", "array", "$", "values", "=", "[", "]", ",", "int", "$", "columnIndex", "=", "0", ")", ":", "Sequence", "{", "return", "$", "this", "->", "fetchAll", "(", "$", "sql", ",", "$", "va...
return a list with all rows from given result Allows to map the result into a list of values from one single column: <code> $userNames = $database->fetchColumn('SELECT username FROM users WHERE status = "blocked"'); </code> @param string $sql sql query to fetch data with @param array $values map...
[ "return", "a", "list", "with", "all", "rows", "from", "given", "result" ]
train
https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/Database.php#L143-L154
Innmind/Math
src/Regression/LinearRegression.php
LinearRegression.compute
private function compute(Dataset $data): array { $dimension = $data->dimension()->rows(); $elements = $dimension->value(); $x = $data->abscissas()->toArray(); $y = $data->ordinates()->toArray(); $xSum = $data->abscissas()->sum(); $ySum = $data->ordinates()->sum(); ...
php
private function compute(Dataset $data): array { $dimension = $data->dimension()->rows(); $elements = $dimension->value(); $x = $data->abscissas()->toArray(); $y = $data->ordinates()->toArray(); $xSum = $data->abscissas()->sum(); $ySum = $data->ordinates()->sum(); ...
[ "private", "function", "compute", "(", "Dataset", "$", "data", ")", ":", "array", "{", "$", "dimension", "=", "$", "data", "->", "dimension", "(", ")", "->", "rows", "(", ")", ";", "$", "elements", "=", "$", "dimension", "->", "value", "(", ")", ";...
Determine the slope and intercept for the given dataset @see https://richardathome.wordpress.com/2006/01/25/a-php-linear-regression-function/ @param Dataset $data @return array
[ "Determine", "the", "slope", "and", "intercept", "for", "the", "given", "dataset" ]
train
https://github.com/Innmind/Math/blob/ac9ad4dd1852c145e90f5edc0f38a873b125a50b/src/Regression/LinearRegression.php#L80-L116
drdplusinfo/drdplus-skills
DrdPlus/Skills/Skills.php
Skills.getMalusToFightNumberWithWeaponlike
public function getMalusToFightNumberWithWeaponlike( WeaponlikeCode $weaponOrShieldForAttack, Tables $tables, $usesTwoWeapons ): int { if ($weaponOrShieldForAttack->isProjectile()) { return 0; } if ($weaponOrShieldForAttack->isMelee() || $weaponOrShiel...
php
public function getMalusToFightNumberWithWeaponlike( WeaponlikeCode $weaponOrShieldForAttack, Tables $tables, $usesTwoWeapons ): int { if ($weaponOrShieldForAttack->isProjectile()) { return 0; } if ($weaponOrShieldForAttack->isMelee() || $weaponOrShiel...
[ "public", "function", "getMalusToFightNumberWithWeaponlike", "(", "WeaponlikeCode", "$", "weaponOrShieldForAttack", ",", "Tables", "$", "tables", ",", "$", "usesTwoWeapons", ")", ":", "int", "{", "if", "(", "$", "weaponOrShieldForAttack", "->", "isProjectile", "(", ...
Note about SHIELD: shield is considered as a weapon and therefore zero skill is used for it (rare FightWithShield respectively). If you want fight number for shield as a PROTECTIVE item, use @see getMalusToFightNumberWithProtective instead. If yu are using two weapons, you will be punished for imperfect fight-with-two-...
[ "Note", "about", "SHIELD", ":", "shield", "is", "considered", "as", "a", "weapon", "and", "therefore", "zero", "skill", "is", "used", "for", "it", "(", "rare", "FightWithShield", "respectively", ")", ".", "If", "you", "want", "fight", "number", "for", "shi...
train
https://github.com/drdplusinfo/drdplus-skills/blob/9ae6ecdbaadf594d6572ec0c190fc13572c0a53f/DrdPlus/Skills/Skills.php#L571-L590
drdplusinfo/drdplus-skills
DrdPlus/Skills/Skills.php
Skills.getMalusToAttackNumberWithWeaponlike
public function getMalusToAttackNumberWithWeaponlike( WeaponlikeCode $weaponlikeCode, Tables $tables, $fightsWithTwoWeapons ): int { if ($weaponlikeCode->isProjectile()) { return 0; } if ($weaponlikeCode->isMelee() || $weaponlikeCode->isThrowingWeapon(...
php
public function getMalusToAttackNumberWithWeaponlike( WeaponlikeCode $weaponlikeCode, Tables $tables, $fightsWithTwoWeapons ): int { if ($weaponlikeCode->isProjectile()) { return 0; } if ($weaponlikeCode->isMelee() || $weaponlikeCode->isThrowingWeapon(...
[ "public", "function", "getMalusToAttackNumberWithWeaponlike", "(", "WeaponlikeCode", "$", "weaponlikeCode", ",", "Tables", "$", "tables", ",", "$", "fightsWithTwoWeapons", ")", ":", "int", "{", "if", "(", "$", "weaponlikeCode", "->", "isProjectile", "(", ")", ")",...
Note about SHIELD: shield is considered as a weapon and therefore zero skill is used for it (rare FightWithShield respectively). If you want to use shield as a PROTECTIVE item, there is no attack number malus from that. @param WeaponlikeCode $weaponlikeCode @param Tables $tables @param bool $fightsWithTwoWeapons @retu...
[ "Note", "about", "SHIELD", ":", "shield", "is", "considered", "as", "a", "weapon", "and", "therefore", "zero", "skill", "is", "used", "for", "it", "(", "rare", "FightWithShield", "respectively", ")", ".", "If", "you", "want", "to", "use", "shield", "as", ...
train
https://github.com/drdplusinfo/drdplus-skills/blob/9ae6ecdbaadf594d6572ec0c190fc13572c0a53f/DrdPlus/Skills/Skills.php#L619-L638
drdplusinfo/drdplus-skills
DrdPlus/Skills/Skills.php
Skills.getMalusToCoverWithWeapon
public function getMalusToCoverWithWeapon(WeaponCode $weaponCode, Tables $tables, $fightsWithTwoWeapons): int { if ($weaponCode->isProjectile()) { return 0; } if ($weaponCode->isMelee() || $weaponCode->isThrowingWeapon()) { return $this->getPhysicalSkills()->getMalusT...
php
public function getMalusToCoverWithWeapon(WeaponCode $weaponCode, Tables $tables, $fightsWithTwoWeapons): int { if ($weaponCode->isProjectile()) { return 0; } if ($weaponCode->isMelee() || $weaponCode->isThrowingWeapon()) { return $this->getPhysicalSkills()->getMalusT...
[ "public", "function", "getMalusToCoverWithWeapon", "(", "WeaponCode", "$", "weaponCode", ",", "Tables", "$", "tables", ",", "$", "fightsWithTwoWeapons", ")", ":", "int", "{", "if", "(", "$", "weaponCode", "->", "isProjectile", "(", ")", ")", "{", "return", "...
Usable both for weapons and shields, but SHIELD as "weaponlike" means for attacking - for shield standard usage as a protective armament @see getMalusToCoverWithShield @param WeaponCode $weaponCode @param Tables $tables @param bool $fightsWithTwoWeapons @return int @throws Exceptions\UnknownTypeOfWeapon
[ "Usable", "both", "for", "weapons", "and", "shields", "but", "SHIELD", "as", "weaponlike", "means", "for", "attacking", "-", "for", "shield", "standard", "usage", "as", "a", "protective", "armament", "@see", "getMalusToCoverWithShield" ]
train
https://github.com/drdplusinfo/drdplus-skills/blob/9ae6ecdbaadf594d6572ec0c190fc13572c0a53f/DrdPlus/Skills/Skills.php#L650-L665
drdplusinfo/drdplus-skills
DrdPlus/Skills/Skills.php
Skills.getMalusToBaseOfWoundsWithWeaponlike
public function getMalusToBaseOfWoundsWithWeaponlike( WeaponlikeCode $weaponlikeCode, Tables $tables, bool $fightsWithTwoWeapons ): int { if ($weaponlikeCode->isMelee() || $weaponlikeCode->isThrowingWeapon()) { return $this->getPhysicalSkills()->getMalusToBaseOfWounds...
php
public function getMalusToBaseOfWoundsWithWeaponlike( WeaponlikeCode $weaponlikeCode, Tables $tables, bool $fightsWithTwoWeapons ): int { if ($weaponlikeCode->isMelee() || $weaponlikeCode->isThrowingWeapon()) { return $this->getPhysicalSkills()->getMalusToBaseOfWounds...
[ "public", "function", "getMalusToBaseOfWoundsWithWeaponlike", "(", "WeaponlikeCode", "$", "weaponlikeCode", ",", "Tables", "$", "tables", ",", "bool", "$", "fightsWithTwoWeapons", ")", ":", "int", "{", "if", "(", "$", "weaponlikeCode", "->", "isMelee", "(", ")", ...
If you want to use shield as a PROTECTIVE item, there is no base of wounds malus from that. @param WeaponlikeCode $weaponlikeCode @param Tables $tables @param bool $fightsWithTwoWeapons @return int @throws Exceptions\UnknownTypeOfWeapon
[ "If", "you", "want", "to", "use", "shield", "as", "a", "PROTECTIVE", "item", "there", "is", "no", "base", "of", "wounds", "malus", "from", "that", "." ]
train
https://github.com/drdplusinfo/drdplus-skills/blob/9ae6ecdbaadf594d6572ec0c190fc13572c0a53f/DrdPlus/Skills/Skills.php#L685-L704
thomasez/BisonLabSakonninBundle
EventListener/SakonninFileListener.php
SakonninFileListener.preRemove
public function preRemove(EventArgs $args) { $entity = $args->getEntity(); if ($entity instanceof SakonninFile) { // VichUploader removes this property when it removes the file, // alas I need to store it somehow. $this->removes[] = $entity->getStoredAs(); } ...
php
public function preRemove(EventArgs $args) { $entity = $args->getEntity(); if ($entity instanceof SakonninFile) { // VichUploader removes this property when it removes the file, // alas I need to store it somehow. $this->removes[] = $entity->getStoredAs(); } ...
[ "public", "function", "preRemove", "(", "EventArgs", "$", "args", ")", "{", "$", "entity", "=", "$", "args", "->", "getEntity", "(", ")", ";", "if", "(", "$", "entity", "instanceof", "SakonninFile", ")", "{", "// VichUploader removes this property when it remove...
Ensures a proxy will be usable in the postRemove. @param EventArgs $event The event.
[ "Ensures", "a", "proxy", "will", "be", "usable", "in", "the", "postRemove", "." ]
train
https://github.com/thomasez/BisonLabSakonninBundle/blob/45ca7ce9874c4a2be7b503d7067b3d11d2b518cb/EventListener/SakonninFileListener.php#L45-L53
NukaCode/Front-End-Bootstrap
src/NukaCode/Bootstrap/Filesystem/Less/Variables.php
Variables.updateEntry
public function updateEntry($package) { $this->verifyCommand($package); $lines = file($this->less); // Set the new colors $lines[0] = '@bg: ' . $package['bg'] . ";\n"; $lines[1] = '@gray: ' . $package['gray'] . ";\n"; $lines[2] = '@brand-primary: ' . $package['primary'] . ...
php
public function updateEntry($package) { $this->verifyCommand($package); $lines = file($this->less); // Set the new colors $lines[0] = '@bg: ' . $package['bg'] . ";\n"; $lines[1] = '@gray: ' . $package['gray'] . ";\n"; $lines[2] = '@brand-primary: ' . $package['primary'] . ...
[ "public", "function", "updateEntry", "(", "$", "package", ")", "{", "$", "this", "->", "verifyCommand", "(", "$", "package", ")", ";", "$", "lines", "=", "file", "(", "$", "this", "->", "less", ")", ";", "// Set the new colors", "$", "lines", "[", "0",...
Update the colors.less file to persist the changes @param $package
[ "Update", "the", "colors", ".", "less", "file", "to", "persist", "the", "changes" ]
train
https://github.com/NukaCode/Front-End-Bootstrap/blob/46c30fba4c77afb74ec4a4d70c43c9cffd464d6e/src/NukaCode/Bootstrap/Filesystem/Less/Variables.php#L36-L54
NukaCode/Front-End-Bootstrap
src/NukaCode/Bootstrap/Filesystem/Less/Variables.php
Variables.getEntry
public function getEntry() { $lines = file($this->colors); foreach ($lines as $key => $line) { if (trim($line) == '') { unset($lines[$key]); } } //ppd($lines); $colorLocations = [ 'bg' => [ 'variable' => '@bg', 'title' => 'Background Color', 'line' => 0 ], 'gray'...
php
public function getEntry() { $lines = file($this->colors); foreach ($lines as $key => $line) { if (trim($line) == '') { unset($lines[$key]); } } //ppd($lines); $colorLocations = [ 'bg' => [ 'variable' => '@bg', 'title' => 'Background Color', 'line' => 0 ], 'gray'...
[ "public", "function", "getEntry", "(", ")", "{", "$", "lines", "=", "file", "(", "$", "this", "->", "colors", ")", ";", "foreach", "(", "$", "lines", "as", "$", "key", "=>", "$", "line", ")", "{", "if", "(", "trim", "(", "$", "line", ")", "==",...
Return the current color values for the site @return array
[ "Return", "the", "current", "color", "values", "for", "the", "site" ]
train
https://github.com/NukaCode/Front-End-Bootstrap/blob/46c30fba4c77afb74ec4a4d70c43c9cffd464d6e/src/NukaCode/Bootstrap/Filesystem/Less/Variables.php#L61-L132
hschletz/NADA
src/Link/Pdo.php
Pdo.query
public function query($statement, $params) { $statement = $this->_link->prepare($statement); if ($statement === false) { $this->_throw($this->_link); } if ($statement->execute($params) === false) { $this->_throw($statement); } // Don't use fe...
php
public function query($statement, $params) { $statement = $this->_link->prepare($statement); if ($statement === false) { $this->_throw($this->_link); } if ($statement->execute($params) === false) { $this->_throw($statement); } // Don't use fe...
[ "public", "function", "query", "(", "$", "statement", ",", "$", "params", ")", "{", "$", "statement", "=", "$", "this", "->", "_link", "->", "prepare", "(", "$", "statement", ")", ";", "if", "(", "$", "statement", "===", "false", ")", "{", "$", "th...
{@inheritdoc}
[ "{" ]
train
https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Link/Pdo.php#L56-L76
hschletz/NADA
src/Link/Pdo.php
Pdo.exec
public function exec($statement, $params) { $statement = $this->_link->prepare($statement); if ($statement === false) { $this->_throw($this->_link); } if ($statement->execute($params) === false) { $this->_throw($statement); } return $statemen...
php
public function exec($statement, $params) { $statement = $this->_link->prepare($statement); if ($statement === false) { $this->_throw($this->_link); } if ($statement->execute($params) === false) { $this->_throw($statement); } return $statemen...
[ "public", "function", "exec", "(", "$", "statement", ",", "$", "params", ")", "{", "$", "statement", "=", "$", "this", "->", "_link", "->", "prepare", "(", "$", "statement", ")", ";", "if", "(", "$", "statement", "===", "false", ")", "{", "$", "thi...
{@inheritdoc}
[ "{" ]
train
https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Link/Pdo.php#L79-L91
hschletz/NADA
src/Link/Pdo.php
Pdo.quoteValue
public function quoteValue($value, $datatype) { return $this->_link->quote((string)$value, \PDO::PARAM_STR); }
php
public function quoteValue($value, $datatype) { return $this->_link->quote((string)$value, \PDO::PARAM_STR); }
[ "public", "function", "quoteValue", "(", "$", "value", ",", "$", "datatype", ")", "{", "return", "$", "this", "->", "_link", "->", "quote", "(", "(", "string", ")", "$", "value", ",", "\\", "PDO", "::", "PARAM_STR", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Link/Pdo.php#L94-L97
hschletz/NADA
src/Link/Pdo.php
Pdo._throw
protected function _throw($object) { $error = $object->errorInfo(); throw new \RuntimeException( sprintf( 'PDO operation returned SQLSTATE %s: Error %s (%s)', $error[0], $error[1], $error[2] ) ); }
php
protected function _throw($object) { $error = $object->errorInfo(); throw new \RuntimeException( sprintf( 'PDO operation returned SQLSTATE %s: Error %s (%s)', $error[0], $error[1], $error[2] ) ); }
[ "protected", "function", "_throw", "(", "$", "object", ")", "{", "$", "error", "=", "$", "object", "->", "errorInfo", "(", ")", ";", "throw", "new", "\\", "RuntimeException", "(", "sprintf", "(", "'PDO operation returned SQLSTATE %s: Error %s (%s)'", ",", "$", ...
Throw exception with information from PDO's errorInfo() @param object $object PDO object that caused the error @throws \RuntimeException
[ "Throw", "exception", "with", "information", "from", "PDO", "s", "errorInfo", "()" ]
train
https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Link/Pdo.php#L104-L115
zhaoxianfang/tools
src/Symfony/Component/DependencyInjection/Compiler/Compiler.php
Compiler.getLoggingFormatter
public function getLoggingFormatter() { if (null === $this->loggingFormatter) { @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', __METHOD__), E_USER_DEPRECATED); $this->loggingFormat...
php
public function getLoggingFormatter() { if (null === $this->loggingFormatter) { @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', __METHOD__), E_USER_DEPRECATED); $this->loggingFormat...
[ "public", "function", "getLoggingFormatter", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "loggingFormatter", ")", "{", "@", "trigger_error", "(", "sprintf", "(", "'The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerB...
Returns the logging formatter which can be used by compilation passes. @return LoggingFormatter @deprecated since version 3.3, to be removed in 4.0. Use the ContainerBuilder::log() method instead.
[ "Returns", "the", "logging", "formatter", "which", "can", "be", "used", "by", "compilation", "passes", "." ]
train
https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php#L62-L71
miaoxing/wechat
src/Controller/Admin/WechatQrcode.php
WechatQrcode.showDetailAction
public function showDetailAction($req) { $startTime = $req['startTime'] ?: date('Y-m-d', time() - 7 * 86400); $endTime = $req['endTime'] ?: date('Y-m-d', time()); $daysLen = (int) ((strtotime($endTime) - strtotime($startTime)) / 86400); // 1. 获取统计和每天的数据 $qrcode = wei()->weCh...
php
public function showDetailAction($req) { $startTime = $req['startTime'] ?: date('Y-m-d', time() - 7 * 86400); $endTime = $req['endTime'] ?: date('Y-m-d', time()); $daysLen = (int) ((strtotime($endTime) - strtotime($startTime)) / 86400); // 1. 获取统计和每天的数据 $qrcode = wei()->weCh...
[ "public", "function", "showDetailAction", "(", "$", "req", ")", "{", "$", "startTime", "=", "$", "req", "[", "'startTime'", "]", "?", ":", "date", "(", "'Y-m-d'", ",", "time", "(", ")", "-", "7", "*", "86400", ")", ";", "$", "endTime", "=", "$", ...
二维码数据统计 @param $req @return array|\Wei\Response
[ "二维码数据统计" ]
train
https://github.com/miaoxing/wechat/blob/8620f7788cd0b6b9d20d436cede1f9f2fd24925f/src/Controller/Admin/WechatQrcode.php#L178-L306
kambalabs/KmbZendDbInfrastructure
src/KmbZendDbInfrastructure/Hydrator/GroupHydrator.php
GroupHydrator.extract
public function extract($object) { $data = [ 'revision_id' => $object->getRevision()->getId(), 'name' => $object->getName(), 'type' => $object->getType(), 'ordering' => $object->getOrdering(), 'include_pattern' => $object->getIncludePattern(), ...
php
public function extract($object) { $data = [ 'revision_id' => $object->getRevision()->getId(), 'name' => $object->getName(), 'type' => $object->getType(), 'ordering' => $object->getOrdering(), 'include_pattern' => $object->getIncludePattern(), ...
[ "public", "function", "extract", "(", "$", "object", ")", "{", "$", "data", "=", "[", "'revision_id'", "=>", "$", "object", "->", "getRevision", "(", ")", "->", "getId", "(", ")", ",", "'name'", "=>", "$", "object", "->", "getName", "(", ")", ",", ...
Extract values from an object @param GroupInterface $object @return array
[ "Extract", "values", "from", "an", "object" ]
train
https://github.com/kambalabs/KmbZendDbInfrastructure/blob/9bf4df4272d2064965202d0e689f944d56a4c6bb/src/KmbZendDbInfrastructure/Hydrator/GroupHydrator.php#L34-L48
kambalabs/KmbZendDbInfrastructure
src/KmbZendDbInfrastructure/Hydrator/GroupHydrator.php
GroupHydrator.hydrate
public function hydrate(array $data, $object) { $object->setId($this->getData('id', $data)); $object->setName($this->getData('name', $data)); $object->setType($this->getData('type', $data)); $object->setOrdering($this->getData('ordering', $data)); $object->setIncludePattern($...
php
public function hydrate(array $data, $object) { $object->setId($this->getData('id', $data)); $object->setName($this->getData('name', $data)); $object->setType($this->getData('type', $data)); $object->setOrdering($this->getData('ordering', $data)); $object->setIncludePattern($...
[ "public", "function", "hydrate", "(", "array", "$", "data", ",", "$", "object", ")", "{", "$", "object", "->", "setId", "(", "$", "this", "->", "getData", "(", "'id'", ",", "$", "data", ")", ")", ";", "$", "object", "->", "setName", "(", "$", "th...
Hydrate $object with the provided $data. @param array $data @param GroupInterface $object @return GroupInterface
[ "Hydrate", "$object", "with", "the", "provided", "$data", "." ]
train
https://github.com/kambalabs/KmbZendDbInfrastructure/blob/9bf4df4272d2064965202d0e689f944d56a4c6bb/src/KmbZendDbInfrastructure/Hydrator/GroupHydrator.php#L57-L66
bound1ess/essence
src/Essence/Matchers/ThrowMatcher.php
ThrowMatcher.run
public function run() { parent::run(); $arguments = array_slice(array_merge($this->arguments, [null, null]), 0, 3); list ($class, $message, $context) = $arguments; try { $callback = $this->value; if ( ! is_null($context)) { $callbac...
php
public function run() { parent::run(); $arguments = array_slice(array_merge($this->arguments, [null, null]), 0, 3); list ($class, $message, $context) = $arguments; try { $callback = $this->value; if ( ! is_null($context)) { $callbac...
[ "public", "function", "run", "(", ")", "{", "parent", "::", "run", "(", ")", ";", "$", "arguments", "=", "array_slice", "(", "array_merge", "(", "$", "this", "->", "arguments", ",", "[", "null", ",", "null", "]", ")", ",", "0", ",", "3", ")", ";"...
{@inheritdoc}
[ "{" ]
train
https://github.com/bound1ess/essence/blob/b773d3f17e192d7c7184ffd3640c668e7d74f69b/src/Essence/Matchers/ThrowMatcher.php#L17-L63
creios/creiwork-framework
src/Util/JsonValidator.php
JsonValidator.dataValidation
public function dataValidation($data, $schema, int $max_errors = 1, ISchemaLoader $loader = null): ValidationResult { return $this->validator->dataValidation($data, $schema, $max_errors, $loader); }
php
public function dataValidation($data, $schema, int $max_errors = 1, ISchemaLoader $loader = null): ValidationResult { return $this->validator->dataValidation($data, $schema, $max_errors, $loader); }
[ "public", "function", "dataValidation", "(", "$", "data", ",", "$", "schema", ",", "int", "$", "max_errors", "=", "1", ",", "ISchemaLoader", "$", "loader", "=", "null", ")", ":", "ValidationResult", "{", "return", "$", "this", "->", "validator", "->", "d...
Wrapper method for Opis\JsonSchema\ConfigValidator::dataValidation() @see Validator::dataValidation() @param string|object|array $data @param object|string $schema @param int $max_errors @param ISchemaLoader|null $loader @return \Opis\JsonSchema\ValidationResult
[ "Wrapper", "method", "for", "Opis", "\\", "JsonSchema", "\\", "ConfigValidator", "::", "dataValidation", "()" ]
train
https://github.com/creios/creiwork-framework/blob/5089578b44ef6af725ab0c8a2dfe691bfe07ffb6/src/Util/JsonValidator.php#L70-L76