repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
danielgp/common-lib
source/DomComponentsByDanielGP.php
DomComponentsByDanielGP.setTableHeader
private function setTableHeader($aElements, $bHeadersBreaked) { $aTableHeader = $aElements; if ($bHeadersBreaked) { $aTableHeader = $this->setArrayToArrayKbr($aElements); } $sReturn = []; foreach (array_keys($aTableHeader) as $value) { $sReturn[] = $th...
php
private function setTableHeader($aElements, $bHeadersBreaked) { $aTableHeader = $aElements; if ($bHeadersBreaked) { $aTableHeader = $this->setArrayToArrayKbr($aElements); } $sReturn = []; foreach (array_keys($aTableHeader) as $value) { $sReturn[] = $th...
[ "private", "function", "setTableHeader", "(", "$", "aElements", ",", "$", "bHeadersBreaked", ")", "{", "$", "aTableHeader", "=", "$", "aElements", ";", "if", "(", "$", "bHeadersBreaked", ")", "{", "$", "aTableHeader", "=", "$", "this", "->", "setArrayToArray...
Generates a table header @param array $aElements @param boolean $bHeadersBreaked @return string
[ "Generates", "a", "table", "header" ]
627b99b4408414c7cd21a6c8016f6468dc9216b2
https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomComponentsByDanielGP.php#L527-L538
train
RockPhp/Datet
src/Rock/Datet/DateUtil.php
Rock_Datet_DateUtil.setNovaData
public function setNovaData(Rock_Datet_DateObj $dateObj) { $this->format = $dateObj->getFormat(); $this->ts = $dateObj->getTimeStamp(); }
php
public function setNovaData(Rock_Datet_DateObj $dateObj) { $this->format = $dateObj->getFormat(); $this->ts = $dateObj->getTimeStamp(); }
[ "public", "function", "setNovaData", "(", "Rock_Datet_DateObj", "$", "dateObj", ")", "{", "$", "this", "->", "format", "=", "$", "dateObj", "->", "getFormat", "(", ")", ";", "$", "this", "->", "ts", "=", "$", "dateObj", "->", "getTimeStamp", "(", ")", ...
Substituir data de referencia por uma nova. @param Rock_Datet_DateObj $dateObj
[ "Substituir", "data", "de", "referencia", "por", "uma", "nova", "." ]
10eb9320efbe0a5c5acb2ffb262b514a36476bf0
https://github.com/RockPhp/Datet/blob/10eb9320efbe0a5c5acb2ffb262b514a36476bf0/src/Rock/Datet/DateUtil.php#L42-L46
train
RockPhp/Datet
src/Rock/Datet/DateUtil.php
Rock_Datet_DateUtil.somaDia
private function somaDia($qtdDias) { $somaDia = $qtdDias; if ($qtdDias > 0) { $somaDia = "+$qtdDias"; } $ts = strtotime("$somaDia day", $this->ts); return $ts; }
php
private function somaDia($qtdDias) { $somaDia = $qtdDias; if ($qtdDias > 0) { $somaDia = "+$qtdDias"; } $ts = strtotime("$somaDia day", $this->ts); return $ts; }
[ "private", "function", "somaDia", "(", "$", "qtdDias", ")", "{", "$", "somaDia", "=", "$", "qtdDias", ";", "if", "(", "$", "qtdDias", ">", "0", ")", "{", "$", "somaDia", "=", "\"+$qtdDias\"", ";", "}", "$", "ts", "=", "strtotime", "(", "\"$somaDia da...
Soma dias. @param integer $qtdDias @return integer Timestamp
[ "Soma", "dias", "." ]
10eb9320efbe0a5c5acb2ffb262b514a36476bf0
https://github.com/RockPhp/Datet/blob/10eb9320efbe0a5c5acb2ffb262b514a36476bf0/src/Rock/Datet/DateUtil.php#L54-L63
train
RockPhp/Datet
src/Rock/Datet/DateUtil.php
Rock_Datet_DateUtil.ultimoDiaMes
private function ultimoDiaMes() { $ts = $this->ts; $mesAtual = strftime('%m', $ts); $mesTmp = $mesAtual; $i = 0; while ($mesAtual == $mesTmp) { $ts = $this->somaDia(++ $i); $mesTmp = strftime('%m', $ts); } return $this->somaDia(-- $i);...
php
private function ultimoDiaMes() { $ts = $this->ts; $mesAtual = strftime('%m', $ts); $mesTmp = $mesAtual; $i = 0; while ($mesAtual == $mesTmp) { $ts = $this->somaDia(++ $i); $mesTmp = strftime('%m', $ts); } return $this->somaDia(-- $i);...
[ "private", "function", "ultimoDiaMes", "(", ")", "{", "$", "ts", "=", "$", "this", "->", "ts", ";", "$", "mesAtual", "=", "strftime", "(", "'%m'", ",", "$", "ts", ")", ";", "$", "mesTmp", "=", "$", "mesAtual", ";", "$", "i", "=", "0", ";", "whi...
Calcula ultimo dia do mes. @return integer Timestamp
[ "Calcula", "ultimo", "dia", "do", "mes", "." ]
10eb9320efbe0a5c5acb2ffb262b514a36476bf0
https://github.com/RockPhp/Datet/blob/10eb9320efbe0a5c5acb2ffb262b514a36476bf0/src/Rock/Datet/DateUtil.php#L70-L82
train
WellCommerce/DistributionBundle
Manager/PackageManager.php
PackageManager.syncPackages
public function syncPackages($type) { $criteria = ['type' => $type]; $em = $this->getDoctrineHelper()->getEntityManager(); $searchResults = $this->getHelper()->getPackages($criteria); foreach ($searchResults as $result) { $package = $this->getHelper()->ge...
php
public function syncPackages($type) { $criteria = ['type' => $type]; $em = $this->getDoctrineHelper()->getEntityManager(); $searchResults = $this->getHelper()->getPackages($criteria); foreach ($searchResults as $result) { $package = $this->getHelper()->ge...
[ "public", "function", "syncPackages", "(", "$", "type", ")", "{", "$", "criteria", "=", "[", "'type'", "=>", "$", "type", "]", ";", "$", "em", "=", "$", "this", "->", "getDoctrineHelper", "(", ")", "->", "getEntityManager", "(", ")", ";", "$", "searc...
Searches for all packages of particular type and adds them to Smuggler
[ "Searches", "for", "all", "packages", "of", "particular", "type", "and", "adds", "them", "to", "Smuggler" ]
82b1b4c2c5a59536aaae22506b23ccd5d141cbb0
https://github.com/WellCommerce/DistributionBundle/blob/82b1b4c2c5a59536aaae22506b23ccd5d141cbb0/Manager/PackageManager.php#L34-L46
train
WellCommerce/DistributionBundle
Manager/PackageManager.php
PackageManager.getConsoleCommandArguments
public function getConsoleCommandArguments(Request $request) { $port = (int)$request->attributes->get('port'); $package = $request->attributes->get('id'); $operation = $request->attributes->get('operation'); return [ 'app/console', 'wellcommerc...
php
public function getConsoleCommandArguments(Request $request) { $port = (int)$request->attributes->get('port'); $package = $request->attributes->get('id'); $operation = $request->attributes->get('operation'); return [ 'app/console', 'wellcommerc...
[ "public", "function", "getConsoleCommandArguments", "(", "Request", "$", "request", ")", "{", "$", "port", "=", "(", "int", ")", "$", "request", "->", "attributes", "->", "get", "(", "'port'", ")", ";", "$", "package", "=", "$", "request", "->", "attribu...
Returns console command arguments @param Request $request @return array
[ "Returns", "console", "command", "arguments" ]
82b1b4c2c5a59536aaae22506b23ccd5d141cbb0
https://github.com/WellCommerce/DistributionBundle/blob/82b1b4c2c5a59536aaae22506b23ccd5d141cbb0/Manager/PackageManager.php#L88-L100
train
WellCommerce/DistributionBundle
Manager/PackageManager.php
PackageManager.changePackageStatus
public function changePackageStatus(Request $request) { /** * @var $package \WellCommerce\Bundle\DistributionBundle\Entity\Package */ $id = $request->attributes->get('id'); $em = $this->getDoctrineHelper()->getEntityManager(); $repository = $this->ge...
php
public function changePackageStatus(Request $request) { /** * @var $package \WellCommerce\Bundle\DistributionBundle\Entity\Package */ $id = $request->attributes->get('id'); $em = $this->getDoctrineHelper()->getEntityManager(); $repository = $this->ge...
[ "public", "function", "changePackageStatus", "(", "Request", "$", "request", ")", "{", "/**\n * @var $package \\WellCommerce\\Bundle\\DistributionBundle\\Entity\\Package\n */", "$", "id", "=", "$", "request", "->", "attributes", "->", "get", "(", "'id'", ")"...
Changes package info according to operation and data fetched from PackagistAPI @param Request $request @throws EntityNotFoundException
[ "Changes", "package", "info", "according", "to", "operation", "and", "data", "fetched", "from", "PackagistAPI" ]
82b1b4c2c5a59536aaae22506b23ccd5d141cbb0
https://github.com/WellCommerce/DistributionBundle/blob/82b1b4c2c5a59536aaae22506b23ccd5d141cbb0/Manager/PackageManager.php#L110-L127
train
dms-org/common.structure
src/DateTime/TimezonedDateTime.php
TimezonedDateTime.fromString
public static function fromString(string $dateTimeString, string $timeZoneId) : TimezonedDateTime { return new self(new \DateTimeImmutable($dateTimeString, new \DateTimeZone($timeZoneId))); }
php
public static function fromString(string $dateTimeString, string $timeZoneId) : TimezonedDateTime { return new self(new \DateTimeImmutable($dateTimeString, new \DateTimeZone($timeZoneId))); }
[ "public", "static", "function", "fromString", "(", "string", "$", "dateTimeString", ",", "string", "$", "timeZoneId", ")", ":", "TimezonedDateTime", "{", "return", "new", "self", "(", "new", "\\", "DateTimeImmutable", "(", "$", "dateTimeString", ",", "new", "\...
Creates a DateTime object from the supplied date string @param string $dateTimeString @param string $timeZoneId @return TimezonedDateTime
[ "Creates", "a", "DateTime", "object", "from", "the", "supplied", "date", "string" ]
23f122182f60df5ec847047a81a39c8aab019ff1
https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/DateTime/TimezonedDateTime.php#L35-L38
train
dms-org/common.structure
src/DateTime/TimezonedDateTime.php
TimezonedDateTime.convertTimezone
public function convertTimezone(string $timezoneId) : TimezonedDateTime { return new TimezonedDateTime( (new \DateTimeImmutable('now', new \DateTimeZone($timezoneId))) ->setTimestamp($this->dateTime->getTimestamp()) ); }
php
public function convertTimezone(string $timezoneId) : TimezonedDateTime { return new TimezonedDateTime( (new \DateTimeImmutable('now', new \DateTimeZone($timezoneId))) ->setTimestamp($this->dateTime->getTimestamp()) ); }
[ "public", "function", "convertTimezone", "(", "string", "$", "timezoneId", ")", ":", "TimezonedDateTime", "{", "return", "new", "TimezonedDateTime", "(", "(", "new", "\\", "DateTimeImmutable", "(", "'now'", ",", "new", "\\", "DateTimeZone", "(", "$", "timezoneId...
Returns the current date time according to the supplied timezone @param string $timezoneId @return TimezonedDateTime
[ "Returns", "the", "current", "date", "time", "according", "to", "the", "supplied", "timezone" ]
23f122182f60df5ec847047a81a39c8aab019ff1
https://github.com/dms-org/common.structure/blob/23f122182f60df5ec847047a81a39c8aab019ff1/src/DateTime/TimezonedDateTime.php#L179-L185
train
rzajac/phptools
src/Date/DateCalc.php
DateCalc.secondsSinceMidnightStr
public static function secondsSinceMidnightStr($time) { $time_a = explode(':', $time); switch (count($time_a)) { case 0: case 1: return null; case 2: // Add seconds $time_a[] = 0; break; ...
php
public static function secondsSinceMidnightStr($time) { $time_a = explode(':', $time); switch (count($time_a)) { case 0: case 1: return null; case 2: // Add seconds $time_a[] = 0; break; ...
[ "public", "static", "function", "secondsSinceMidnightStr", "(", "$", "time", ")", "{", "$", "time_a", "=", "explode", "(", "':'", ",", "$", "time", ")", ";", "switch", "(", "count", "(", "$", "time_a", ")", ")", "{", "case", "0", ":", "case", "1", ...
Return number of seconds since midnight. @param string $time The time in format: HH:MM:SS or HH:MM @return int|null Returns null on error
[ "Return", "number", "of", "seconds", "since", "midnight", "." ]
3cbece7645942d244603c14ba897d8a676ee3088
https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Date/DateCalc.php#L74-L96
train
rzajac/phptools
src/Date/DateCalc.php
DateCalc.formatStrTime
public static function formatStrTime($time, $withSeconds = true) { // Pad left with 0 in case we get numbers like 123, 12, 122015 $time = str_pad($time.'', 6, '0', STR_PAD_LEFT); $_time = array(); $_time[] = substr($time, 0, 2); $_time[] = substr($time, 2, 2); if (...
php
public static function formatStrTime($time, $withSeconds = true) { // Pad left with 0 in case we get numbers like 123, 12, 122015 $time = str_pad($time.'', 6, '0', STR_PAD_LEFT); $_time = array(); $_time[] = substr($time, 0, 2); $_time[] = substr($time, 2, 2); if (...
[ "public", "static", "function", "formatStrTime", "(", "$", "time", ",", "$", "withSeconds", "=", "true", ")", "{", "// Pad left with 0 in case we get numbers like 123, 12, 122015", "$", "time", "=", "str_pad", "(", "$", "time", ".", "''", ",", "6", ",", "'0'", ...
Takes time in hhmmss format and returns formatted string. @param int|string $time The time in hhmmss or hhmm format @param bool $withSeconds Set to true to add seconds if not provided @return string The formatted string hh:mm:ss or hh:mm
[ "Takes", "time", "in", "hhmmss", "format", "and", "returns", "formatted", "string", "." ]
3cbece7645942d244603c14ba897d8a676ee3088
https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Date/DateCalc.php#L106-L122
train
shgysk8zer0/core_api
traits/logger_interpolation.php
Logger_Interpolation.interpolate
final public function interpolate($message, array $context = array()) { return strtr( $message, array_combine( array_map( function($key) { return "{{$key}}"; }, array_keys($context) ), array_values($context) ) ); }
php
final public function interpolate($message, array $context = array()) { return strtr( $message, array_combine( array_map( function($key) { return "{{$key}}"; }, array_keys($context) ), array_values($context) ) ); }
[ "final", "public", "function", "interpolate", "(", "$", "message", ",", "array", "$", "context", "=", "array", "(", ")", ")", "{", "return", "strtr", "(", "$", "message", ",", "array_combine", "(", "array_map", "(", "function", "(", "$", "key", ")", "{...
This is the default method for interpolating in PSR-3 loggers @param string $message The template given @param array $context An array of values to assign to templatte @return string
[ "This", "is", "the", "default", "method", "for", "interpolating", "in", "PSR", "-", "3", "loggers" ]
9e9b8baf761af874b95256ad2462e55fbb2b2e58
https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/logger_interpolation.php#L36-L51
train
Erebot/Module_Wordlists
src/Wordlists/Base.php
Base.isWord
public static function isWord($word) { if (!is_string($word)) { return false; } return (bool) preg_match(self::WORD_FILTER, $word); }
php
public static function isWord($word) { if (!is_string($word)) { return false; } return (bool) preg_match(self::WORD_FILTER, $word); }
[ "public", "static", "function", "isWord", "(", "$", "word", ")", "{", "if", "(", "!", "is_string", "(", "$", "word", ")", ")", "{", "return", "false", ";", "}", "return", "(", "bool", ")", "preg_match", "(", "self", "::", "WORD_FILTER", ",", "$", "...
Filters non-words out. Only texts that passed this filtering step are considered as propositions for the game. \param string $word A possible "word" to test. \retval bool TRUE if the given $word really is a word, FALSE otherwise. \note This method uses a rather broad definition of what is a word. In particular, it ...
[ "Filters", "non", "-", "words", "out", "." ]
121d1cc72619ec0be2ddf0f3d6a66bac0a5bd1b7
https://github.com/Erebot/Module_Wordlists/blob/121d1cc72619ec0be2ddf0f3d6a66bac0a5bd1b7/src/Wordlists/Base.php#L98-L104
train
PhoxPHP/Console
src/ErrorHandler.php
ErrorHandler.handleError
public function handleError($errNumber, $errString, $errFile ='', $errLine = 0) { $interfaceSettings = $this->cmd->getConfigOpt('interface'); $textColor = $interfaceSettings['error']['text_color']; $textBgColor = $interfaceSettings['error']['text_background']; $this->env->sendOutput('Error: ' . $errString, $t...
php
public function handleError($errNumber, $errString, $errFile ='', $errLine = 0) { $interfaceSettings = $this->cmd->getConfigOpt('interface'); $textColor = $interfaceSettings['error']['text_color']; $textBgColor = $interfaceSettings['error']['text_background']; $this->env->sendOutput('Error: ' . $errString, $t...
[ "public", "function", "handleError", "(", "$", "errNumber", ",", "$", "errString", ",", "$", "errFile", "=", "''", ",", "$", "errLine", "=", "0", ")", "{", "$", "interfaceSettings", "=", "$", "this", "->", "cmd", "->", "getConfigOpt", "(", "'interface'",...
Handles generated errors. @param $errNumber <Integer> @param $errString <String> @param $errFile <String> @param $errLine <Integer> @access public @return <void>
[ "Handles", "generated", "errors", "." ]
fee1238cfdb3592964bb5d5a2336e70b8ffd20e9
https://github.com/PhoxPHP/Console/blob/fee1238cfdb3592964bb5d5a2336e70b8ffd20e9/src/ErrorHandler.php#L66-L74
train
theopera/framework
src/Component/Http/Response.php
Response.redirect
public static function redirect($url, array $parameters = [], int $statusCode = Response::STATUS_MOVED_PERMANENTLY) : Response { if (!empty($parameters)) { $url = $url . '?' . http_build_query($parameters); } $headers = new Headers(); $headers->add(new Header('Location',...
php
public static function redirect($url, array $parameters = [], int $statusCode = Response::STATUS_MOVED_PERMANENTLY) : Response { if (!empty($parameters)) { $url = $url . '?' . http_build_query($parameters); } $headers = new Headers(); $headers->add(new Header('Location',...
[ "public", "static", "function", "redirect", "(", "$", "url", ",", "array", "$", "parameters", "=", "[", "]", ",", "int", "$", "statusCode", "=", "Response", "::", "STATUS_MOVED_PERMANENTLY", ")", ":", "Response", "{", "if", "(", "!", "empty", "(", "$", ...
Redirect to a url @param string $url @param string[] $parameters @param int $statusCode @return Response
[ "Redirect", "to", "a", "url" ]
fa6165d3891a310faa580c81dee49a63c150c711
https://github.com/theopera/framework/blob/fa6165d3891a310faa580c81dee49a63c150c711/src/Component/Http/Response.php#L186-L196
train
theopera/framework
src/Component/Http/Response.php
Response.createFromString
public static function createFromString(string $string) : Response { $lines = explode("\r\n", $string); list($httpVersion, $statusCode, $statusText) = explode(' ', array_shift($lines), 3); $headers = new Headers(); foreach ($lines as $index => $line) { unset($lines[$in...
php
public static function createFromString(string $string) : Response { $lines = explode("\r\n", $string); list($httpVersion, $statusCode, $statusText) = explode(' ', array_shift($lines), 3); $headers = new Headers(); foreach ($lines as $index => $line) { unset($lines[$in...
[ "public", "static", "function", "createFromString", "(", "string", "$", "string", ")", ":", "Response", "{", "$", "lines", "=", "explode", "(", "\"\\r\\n\"", ",", "$", "string", ")", ";", "list", "(", "$", "httpVersion", ",", "$", "statusCode", ",", "$",...
Create a Response object from a string @param string $string @return Response
[ "Create", "a", "Response", "object", "from", "a", "string" ]
fa6165d3891a310faa580c81dee49a63c150c711
https://github.com/theopera/framework/blob/fa6165d3891a310faa580c81dee49a63c150c711/src/Component/Http/Response.php#L204-L224
train
theopera/framework
src/Component/Http/Response.php
Response.getStatusLine
public function getStatusLine() : string { return sprintf('HTTP/%s %s %s', self::HTTP_VERSION, $this->statusCode, self::getStatusText($this->statusCode)); }
php
public function getStatusLine() : string { return sprintf('HTTP/%s %s %s', self::HTTP_VERSION, $this->statusCode, self::getStatusText($this->statusCode)); }
[ "public", "function", "getStatusLine", "(", ")", ":", "string", "{", "return", "sprintf", "(", "'HTTP/%s %s %s'", ",", "self", "::", "HTTP_VERSION", ",", "$", "this", "->", "statusCode", ",", "self", "::", "getStatusText", "(", "$", "this", "->", "statusCode...
Get the complete status line @return string
[ "Get", "the", "complete", "status", "line" ]
fa6165d3891a310faa580c81dee49a63c150c711
https://github.com/theopera/framework/blob/fa6165d3891a310faa580c81dee49a63c150c711/src/Component/Http/Response.php#L251-L254
train
theopera/framework
src/Component/Http/Response.php
Response.send
public function send() { if (headers_sent()) { throw new HttpException(Response::STATUS_INTERNAL_SERVER_ERROR, 'Headers already send'); } header($this->getStatusLine()); foreach ($this->headers as $header) { header($header); } echo $this->b...
php
public function send() { if (headers_sent()) { throw new HttpException(Response::STATUS_INTERNAL_SERVER_ERROR, 'Headers already send'); } header($this->getStatusLine()); foreach ($this->headers as $header) { header($header); } echo $this->b...
[ "public", "function", "send", "(", ")", "{", "if", "(", "headers_sent", "(", ")", ")", "{", "throw", "new", "HttpException", "(", "Response", "::", "STATUS_INTERNAL_SERVER_ERROR", ",", "'Headers already send'", ")", ";", "}", "header", "(", "$", "this", "->"...
Sends the response to the web server @return void
[ "Sends", "the", "response", "to", "the", "web", "server" ]
fa6165d3891a310faa580c81dee49a63c150c711
https://github.com/theopera/framework/blob/fa6165d3891a310faa580c81dee49a63c150c711/src/Component/Http/Response.php#L297-L311
train
RocketPropelledTortoise/Core
src/Taxonomy/Taxonomy.php
Taxonomy.isTranslatable
public function isTranslatable($vid) { if (!is_numeric($vid)) { $vid = $this->vocabulary($vid); } return $this->vocabularyById[$vid]->isTranslatable(); }
php
public function isTranslatable($vid) { if (!is_numeric($vid)) { $vid = $this->vocabulary($vid); } return $this->vocabularyById[$vid]->isTranslatable(); }
[ "public", "function", "isTranslatable", "(", "$", "vid", ")", "{", "if", "(", "!", "is_numeric", "(", "$", "vid", ")", ")", "{", "$", "vid", "=", "$", "this", "->", "vocabulary", "(", "$", "vid", ")", ";", "}", "return", "$", "this", "->", "vocab...
Is this vocabulary translatable ? @param int|string $vid @return bool
[ "Is", "this", "vocabulary", "translatable", "?" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Taxonomy.php#L82-L89
train
RocketPropelledTortoise/Core
src/Taxonomy/Taxonomy.php
Taxonomy.getLanguage
public function getLanguage($vocabulary_id, $language_id = null) { if (!$this->isTranslatable($vocabulary_id)) { return 1; } if ($language_id === null) { return I18N::getCurrentId(); } return $language_id; }
php
public function getLanguage($vocabulary_id, $language_id = null) { if (!$this->isTranslatable($vocabulary_id)) { return 1; } if ($language_id === null) { return I18N::getCurrentId(); } return $language_id; }
[ "public", "function", "getLanguage", "(", "$", "vocabulary_id", ",", "$", "language_id", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "isTranslatable", "(", "$", "vocabulary_id", ")", ")", "{", "return", "1", ";", "}", "if", "(", "$", "l...
Get the internal language for the vocabulary This will return the language_id if the vocabulary is translated or 1 if it's not @param int|string $vocabulary_id @param int $language_id @return int|null
[ "Get", "the", "internal", "language", "for", "the", "vocabulary" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Taxonomy.php#L100-L111
train
RocketPropelledTortoise/Core
src/Taxonomy/Taxonomy.php
Taxonomy.vocabulary
public function vocabulary($key) { if (is_numeric($key)) { return $this->vocabularyById[$key]->machine_name; } return $this->vocabularyByName[$key]->id; }
php
public function vocabulary($key) { if (is_numeric($key)) { return $this->vocabularyById[$key]->machine_name; } return $this->vocabularyByName[$key]->id; }
[ "public", "function", "vocabulary", "(", "$", "key", ")", "{", "if", "(", "is_numeric", "(", "$", "key", ")", ")", "{", "return", "$", "this", "->", "vocabularyById", "[", "$", "key", "]", "->", "machine_name", ";", "}", "return", "$", "this", "->", ...
Get a vocabulary by name or ID Taxonomy::vocabulary(1); returns 'tags' Taxonomy::vocabulary('tags'); returns 1 @param int|string $key @return mixed
[ "Get", "a", "vocabulary", "by", "name", "or", "ID" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Taxonomy.php#L125-L132
train
RocketPropelledTortoise/Core
src/Taxonomy/Taxonomy.php
Taxonomy.uncacheTerm
public function uncacheTerm($term_id) { if (array_key_exists($term_id, $this->terms)) { unset($this->terms[$term_id]); } return $this->termRepository->uncacheTerm($term_id); }
php
public function uncacheTerm($term_id) { if (array_key_exists($term_id, $this->terms)) { unset($this->terms[$term_id]); } return $this->termRepository->uncacheTerm($term_id); }
[ "public", "function", "uncacheTerm", "(", "$", "term_id", ")", "{", "if", "(", "array_key_exists", "(", "$", "term_id", ",", "$", "this", "->", "terms", ")", ")", "{", "unset", "(", "$", "this", "->", "terms", "[", "$", "term_id", "]", ")", ";", "}...
Remove a term from the cache @param int $term_id @return bool
[ "Remove", "a", "term", "from", "the", "cache" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Taxonomy.php#L169-L176
train
RocketPropelledTortoise/Core
src/Taxonomy/Taxonomy.php
Taxonomy.addParent
public function addParent($term_id, $parent_id) { $this->testCanAddParents($term_id, 1); $this->termHierarchyRepository->addParent($term_id, $parent_id); }
php
public function addParent($term_id, $parent_id) { $this->testCanAddParents($term_id, 1); $this->termHierarchyRepository->addParent($term_id, $parent_id); }
[ "public", "function", "addParent", "(", "$", "term_id", ",", "$", "parent_id", ")", "{", "$", "this", "->", "testCanAddParents", "(", "$", "term_id", ",", "1", ")", ";", "$", "this", "->", "termHierarchyRepository", "->", "addParent", "(", "$", "term_id", ...
Add one parent to a term @param int $term_id @param int $parent_id
[ "Add", "one", "parent", "to", "a", "term" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Taxonomy.php#L226-L231
train
RocketPropelledTortoise/Core
src/Taxonomy/Taxonomy.php
Taxonomy.addParents
public function addParents($term_id, array $parent_ids) { $this->testCanAddParents($term_id, count($parent_ids)); foreach ($parent_ids as $id) { $this->termHierarchyRepository->addParent($term_id, $id); } }
php
public function addParents($term_id, array $parent_ids) { $this->testCanAddParents($term_id, count($parent_ids)); foreach ($parent_ids as $id) { $this->termHierarchyRepository->addParent($term_id, $id); } }
[ "public", "function", "addParents", "(", "$", "term_id", ",", "array", "$", "parent_ids", ")", "{", "$", "this", "->", "testCanAddParents", "(", "$", "term_id", ",", "count", "(", "$", "parent_ids", ")", ")", ";", "foreach", "(", "$", "parent_ids", "as",...
Add a list of parents to a term @param int $term_id @param array<integer> $parent_ids
[ "Add", "a", "list", "of", "parents", "to", "a", "term" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Taxonomy.php#L239-L246
train
RocketPropelledTortoise/Core
src/Taxonomy/Taxonomy.php
Taxonomy.getTermsForVocabulary
public function getTermsForVocabulary($vocabulary_id) { return $this->cache->remember( 'Rocket::Taxonomy::Terms::' . $vocabulary_id, 60, function () use ($vocabulary_id) { $terms = TermContainer::where('vocabulary_id', $vocabulary_id)->get(['id']); ...
php
public function getTermsForVocabulary($vocabulary_id) { return $this->cache->remember( 'Rocket::Taxonomy::Terms::' . $vocabulary_id, 60, function () use ($vocabulary_id) { $terms = TermContainer::where('vocabulary_id', $vocabulary_id)->get(['id']); ...
[ "public", "function", "getTermsForVocabulary", "(", "$", "vocabulary_id", ")", "{", "return", "$", "this", "->", "cache", "->", "remember", "(", "'Rocket::Taxonomy::Terms::'", ".", "$", "vocabulary_id", ",", "60", ",", "function", "(", ")", "use", "(", "$", ...
Get all the terms of a vocabulary @param int $vocabulary_id @return array
[ "Get", "all", "the", "terms", "of", "a", "vocabulary" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Taxonomy.php#L291-L309
train
RocketPropelledTortoise/Core
src/Taxonomy/Taxonomy.php
Taxonomy.searchTerm
public function searchTerm($term, $vocabulary_id, $language_id = null, $exclude = []) { $language_id = $this->getLanguage($vocabulary_id, $language_id); $term = trim($term); if ($term == '') { return; } $query = TermData::select('taxonomy_terms.id') ...
php
public function searchTerm($term, $vocabulary_id, $language_id = null, $exclude = []) { $language_id = $this->getLanguage($vocabulary_id, $language_id); $term = trim($term); if ($term == '') { return; } $query = TermData::select('taxonomy_terms.id') ...
[ "public", "function", "searchTerm", "(", "$", "term", ",", "$", "vocabulary_id", ",", "$", "language_id", "=", "null", ",", "$", "exclude", "=", "[", "]", ")", "{", "$", "language_id", "=", "$", "this", "->", "getLanguage", "(", "$", "vocabulary_id", "...
Search a specific term, if it doesn't exist, returns false @param string $term @param int $vocabulary_id @param int $language_id @param array $exclude @return int|null
[ "Search", "a", "specific", "term", "if", "it", "doesn", "t", "exist", "returns", "false" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Taxonomy.php#L320-L340
train
RocketPropelledTortoise/Core
src/Taxonomy/Taxonomy.php
Taxonomy.getTermId
public function getTermId($title, $vocabulary_id, $language_id = null, $type = 0) { $title = trim($title); if ($title == '') { return false; } if (!is_numeric($vocabulary_id)) { $vocabulary_id = $this->vocabulary($vocabulary_id); } $language_...
php
public function getTermId($title, $vocabulary_id, $language_id = null, $type = 0) { $title = trim($title); if ($title == '') { return false; } if (!is_numeric($vocabulary_id)) { $vocabulary_id = $this->vocabulary($vocabulary_id); } $language_...
[ "public", "function", "getTermId", "(", "$", "title", ",", "$", "vocabulary_id", ",", "$", "language_id", "=", "null", ",", "$", "type", "=", "0", ")", "{", "$", "title", "=", "trim", "(", "$", "title", ")", ";", "if", "(", "$", "title", "==", "'...
Returns the id of a term, if it doesn't exist, creates it. @param string $title @param int $vocabulary_id @param int $language_id @param int $type @return bool|int
[ "Returns", "the", "id", "of", "a", "term", "if", "it", "doesn", "t", "exist", "creates", "it", "." ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Taxonomy.php#L351-L385
train
RocketPropelledTortoise/Core
src/Taxonomy/Taxonomy.php
Taxonomy.getTermIds
public function getTermIds($taxonomies) { $tags = []; foreach ($taxonomies as $voc => $terms) { $vocabulary_id = $this->vocabulary($voc); $exploded = is_array($terms) ? $terms : explode(',', $terms); foreach ($exploded as $term) { $result = $this-...
php
public function getTermIds($taxonomies) { $tags = []; foreach ($taxonomies as $voc => $terms) { $vocabulary_id = $this->vocabulary($voc); $exploded = is_array($terms) ? $terms : explode(',', $terms); foreach ($exploded as $term) { $result = $this-...
[ "public", "function", "getTermIds", "(", "$", "taxonomies", ")", "{", "$", "tags", "=", "[", "]", ";", "foreach", "(", "$", "taxonomies", "as", "$", "voc", "=>", "$", "terms", ")", "{", "$", "vocabulary_id", "=", "$", "this", "->", "vocabulary", "(",...
Adds one or more tags and returns an array of id's @param array $taxonomies @return array
[ "Adds", "one", "or", "more", "tags", "and", "returns", "an", "array", "of", "id", "s" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Taxonomy.php#L393-L409
train
bytic/http
src/Request.php
Request.getHttp
public function getHttp() { if (!$this->http) { $this->http = new Http(); $this->http->setRequest($this); } return $this->http; }
php
public function getHttp() { if (!$this->http) { $this->http = new Http(); $this->http->setRequest($this); } return $this->http; }
[ "public", "function", "getHttp", "(", ")", "{", "if", "(", "!", "$", "this", "->", "http", ")", "{", "$", "this", "->", "http", "=", "new", "Http", "(", ")", ";", "$", "this", "->", "http", "->", "setRequest", "(", "$", "this", ")", ";", "}", ...
Returns Http object @return Http
[ "Returns", "Http", "object" ]
0d22507a8bcf05575d3d1d6c6a87c2026778c47c
https://github.com/bytic/http/blob/0d22507a8bcf05575d3d1d6c6a87c2026778c47c/src/Request.php#L93-L101
train
nails/module-blog
blog/models/blog_category_model.php
NAILS_Blog_category_model.getCountCommon
protected function getCountCommon($data = array()) { parent::getCountCommon($data); // -------------------------------------------------------------------------- $oDb = Factory::service('Database'); $oDb->select($this->tableAlias . '.*'); if (!empty($data['include_count'])...
php
protected function getCountCommon($data = array()) { parent::getCountCommon($data); // -------------------------------------------------------------------------- $oDb = Factory::service('Database'); $oDb->select($this->tableAlias . '.*'); if (!empty($data['include_count'])...
[ "protected", "function", "getCountCommon", "(", "$", "data", "=", "array", "(", ")", ")", "{", "parent", "::", "getCountCommon", "(", "$", "data", ")", ";", "// --------------------------------------------------------------------------", "$", "oDb", "=", "Factory", ...
Set some common data @param array $data Data passed from the calling method @return void
[ "Set", "some", "common", "data" ]
7b369c5209f4343fff7c7e2a22c237d5a95c8c24
https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/blog/models/blog_category_model.php#L38-L64
train
nails/module-blog
blog/models/blog_category_model.php
NAILS_Blog_category_model.create
public function create($aData, $bReturnObject = false) { $aCategoryData = array(); // -------------------------------------------------------------------------- // Some basic sanity testing if (empty($aData['label'])) { $this->setError('"label" is a required field.');...
php
public function create($aData, $bReturnObject = false) { $aCategoryData = array(); // -------------------------------------------------------------------------- // Some basic sanity testing if (empty($aData['label'])) { $this->setError('"label" is a required field.');...
[ "public", "function", "create", "(", "$", "aData", ",", "$", "bReturnObject", "=", "false", ")", "{", "$", "aCategoryData", "=", "array", "(", ")", ";", "// --------------------------------------------------------------------------", "// Some basic sanity testing", "if",...
Creates a new category @param array $aData The data to create the category with @param boolean $bReturnObject Whether to return the full category object (or just the ID) @return mixed
[ "Creates", "a", "new", "category" ]
7b369c5209f4343fff7c7e2a22c237d5a95c8c24
https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/blog/models/blog_category_model.php#L74-L126
train
nails/module-blog
blog/models/blog_category_model.php
NAILS_Blog_category_model.update
public function update($iId, $aData) { $aCategoryData = array(); // -------------------------------------------------------------------------- // Some basic sanity testing if (empty($aData['label'])) { $this->setError('"label" is a required field.'); retur...
php
public function update($iId, $aData) { $aCategoryData = array(); // -------------------------------------------------------------------------- // Some basic sanity testing if (empty($aData['label'])) { $this->setError('"label" is a required field.'); retur...
[ "public", "function", "update", "(", "$", "iId", ",", "$", "aData", ")", "{", "$", "aCategoryData", "=", "array", "(", ")", ";", "// --------------------------------------------------------------------------", "// Some basic sanity testing", "if", "(", "empty", "(", ...
Updates an existing category @param integer $iId The category's ID @param array $aData The data to update the category with @return boolean
[ "Updates", "an", "existing", "category" ]
7b369c5209f4343fff7c7e2a22c237d5a95c8c24
https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/blog/models/blog_category_model.php#L136-L178
train
cogentParadigm/behat-starbug-extension
src/Context/RawStarbugContext.php
RawStarbugContext.replaceTokens
public function replaceTokens($text) { $tokens = $this->macro->search($text); if (empty($tokens)) { return $text; } static $last = []; $replacements = []; foreach ($tokens as $type => $typeTokens) { foreach ($typeTokens as $name => $token) { if ($type == "any") { $...
php
public function replaceTokens($text) { $tokens = $this->macro->search($text); if (empty($tokens)) { return $text; } static $last = []; $replacements = []; foreach ($tokens as $type => $typeTokens) { foreach ($typeTokens as $name => $token) { if ($type == "any") { $...
[ "public", "function", "replaceTokens", "(", "$", "text", ")", "{", "$", "tokens", "=", "$", "this", "->", "macro", "->", "search", "(", "$", "text", ")", ";", "if", "(", "empty", "(", "$", "tokens", ")", ")", "{", "return", "$", "text", ";", "}",...
Replace fake data tokens. @Transform /^(.*)$/
[ "Replace", "fake", "data", "tokens", "." ]
76da5d943773857ad2388a7cccb6632176b452a9
https://github.com/cogentParadigm/behat-starbug-extension/blob/76da5d943773857ad2388a7cccb6632176b452a9/src/Context/RawStarbugContext.php#L39-L62
train
cogentParadigm/behat-starbug-extension
src/Context/RawStarbugContext.php
RawStarbugContext.replaceTableTokens
public function replaceTableTokens(TableNode $input) { $table = $input->getTable(); foreach ($table as $row => $values) { foreach ($values as $idx => $value) { $table[$row][$idx] = $this->replaceTokens($value); } } return new TableNode($table); }
php
public function replaceTableTokens(TableNode $input) { $table = $input->getTable(); foreach ($table as $row => $values) { foreach ($values as $idx => $value) { $table[$row][$idx] = $this->replaceTokens($value); } } return new TableNode($table); }
[ "public", "function", "replaceTableTokens", "(", "TableNode", "$", "input", ")", "{", "$", "table", "=", "$", "input", "->", "getTable", "(", ")", ";", "foreach", "(", "$", "table", "as", "$", "row", "=>", "$", "values", ")", "{", "foreach", "(", "$"...
Replace fake data tokens in tables. @Transform table:*
[ "Replace", "fake", "data", "tokens", "in", "tables", "." ]
76da5d943773857ad2388a7cccb6632176b452a9
https://github.com/cogentParadigm/behat-starbug-extension/blob/76da5d943773857ad2388a7cccb6632176b452a9/src/Context/RawStarbugContext.php#L68-L76
train
cogentParadigm/behat-starbug-extension
src/Context/RawStarbugContext.php
RawStarbugContext.gatherContexts
public function gatherContexts(BeforeScenarioScope $scope) { $environment = $scope->getEnvironment(); $this->mink = $environment->getContext('Starbug\Behat\Context\MinkContext'); }
php
public function gatherContexts(BeforeScenarioScope $scope) { $environment = $scope->getEnvironment(); $this->mink = $environment->getContext('Starbug\Behat\Context\MinkContext'); }
[ "public", "function", "gatherContexts", "(", "BeforeScenarioScope", "$", "scope", ")", "{", "$", "environment", "=", "$", "scope", "->", "getEnvironment", "(", ")", ";", "$", "this", "->", "mink", "=", "$", "environment", "->", "getContext", "(", "'Starbug\\...
Access other contexts. @BeforeScenario
[ "Access", "other", "contexts", "." ]
76da5d943773857ad2388a7cccb6632176b452a9
https://github.com/cogentParadigm/behat-starbug-extension/blob/76da5d943773857ad2388a7cccb6632176b452a9/src/Context/RawStarbugContext.php#L82-L85
train
refact-be/distext-php
src/Wavy/Distext/Distext.php
Distext.send
public function send($destination, $text) { /** @var Response $response */ $response = $this->browser->post('http://distext.wavy.be/api/sms', array( 'X-Auth-Token' => $this->apiKey, ), json_encode([ 'destination' => $destination, 'text' => $text, ]...
php
public function send($destination, $text) { /** @var Response $response */ $response = $this->browser->post('http://distext.wavy.be/api/sms', array( 'X-Auth-Token' => $this->apiKey, ), json_encode([ 'destination' => $destination, 'text' => $text, ]...
[ "public", "function", "send", "(", "$", "destination", ",", "$", "text", ")", "{", "/** @var Response $response */", "$", "response", "=", "$", "this", "->", "browser", "->", "post", "(", "'http://distext.wavy.be/api/sms'", ",", "array", "(", "'X-Auth-Token'", "...
Send a text message @param string $destination @param string $text @throws \Exception
[ "Send", "a", "text", "message" ]
2d16604ac066983b4a5e01df0c15bba80dd99b32
https://github.com/refact-be/distext-php/blob/2d16604ac066983b4a5e01df0c15bba80dd99b32/src/Wavy/Distext/Distext.php#L32-L46
train
Vectrex/vxPHP
src/Session/SessionDataBag.php
SessionDataBag.remove
public function remove($key) { if(!array_key_exists($key, $this->data)) { return NULL; } $oldValue = $this->data[$key]; unset($this->data[$key]); return $oldValue; }
php
public function remove($key) { if(!array_key_exists($key, $this->data)) { return NULL; } $oldValue = $this->data[$key]; unset($this->data[$key]); return $oldValue; }
[ "public", "function", "remove", "(", "$", "key", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "data", ")", ")", "{", "return", "NULL", ";", "}", "$", "oldValue", "=", "$", "this", "->", "data", "[", "$", ...
unset key value; returns previously held data @param string $key @return mixed
[ "unset", "key", "value", ";", "returns", "previously", "held", "data" ]
295c21b00e7ef6085efcdf5b64fabb28d499b5a6
https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Session/SessionDataBag.php#L120-L131
train
Vectrex/vxPHP
src/Session/SessionDataBag.php
SessionDataBag.replace
public function replace(array $data) { $this->data = array(); foreach ($data as $k => $v) { $this->data[$k] = $v; } }
php
public function replace(array $data) { $this->data = array(); foreach ($data as $k => $v) { $this->data[$k] = $v; } }
[ "public", "function", "replace", "(", "array", "$", "data", ")", "{", "$", "this", "->", "data", "=", "array", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "this", "->", "data", "[", "$", "k", "]"...
replace current data array @param array $data
[ "replace", "current", "data", "array" ]
295c21b00e7ef6085efcdf5b64fabb28d499b5a6
https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Session/SessionDataBag.php#L138-L146
train
modulusphp/http
Middleware/TransformsRequest.php
TransformsRequest.cleanData
private function cleanData(array $data) : array { foreach($data as $key => $value) { $data[$key] = $this->replace($key, $value); } return $data; }
php
private function cleanData(array $data) : array { foreach($data as $key => $value) { $data[$key] = $this->replace($key, $value); } return $data; }
[ "private", "function", "cleanData", "(", "array", "$", "data", ")", ":", "array", "{", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "data", "[", "$", "key", "]", "=", "$", "this", "->", "replace", "(", "$", ...
Loop through the values and pass them to the replace method @param array $data @return array
[ "Loop", "through", "the", "values", "and", "pass", "them", "to", "the", "replace", "method" ]
fc5c0f2b582a04de1685578d3fb790686a0a240c
https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Middleware/TransformsRequest.php#L37-L44
train
modulusphp/http
Middleware/TransformsRequest.php
TransformsRequest.replace
private function replace($key, $value) { if (is_array($value)) return $this->cleanData($value); return $this->transform($key, $value); }
php
private function replace($key, $value) { if (is_array($value)) return $this->cleanData($value); return $this->transform($key, $value); }
[ "private", "function", "replace", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "return", "$", "this", "->", "cleanData", "(", "$", "value", ")", ";", "return", "$", "this", "->", "transform", "("...
Pass arrays back to the cleanData method and pass everything else to transform @param mixed $key @param mixed $value @return void
[ "Pass", "arrays", "back", "to", "the", "cleanData", "method", "and", "pass", "everything", "else", "to", "transform" ]
fc5c0f2b582a04de1685578d3fb790686a0a240c
https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Middleware/TransformsRequest.php#L53-L58
train
lasallecms/lasallecms-l5-lasallecmsemail-pkg
src/Processing/AdminEmailProcessing.php
AdminEmailProcessing.washCreateForm
public function washCreateForm() { // An array to hold the fields we'll neeed to INSERT the record $data = []; // Wash the input fields $data['to_email_address'] = trim($this->request->input('to_email_address')); $data['to_name'] = $this->genericWashText($this->request...
php
public function washCreateForm() { // An array to hold the fields we'll neeed to INSERT the record $data = []; // Wash the input fields $data['to_email_address'] = trim($this->request->input('to_email_address')); $data['to_name'] = $this->genericWashText($this->request...
[ "public", "function", "washCreateForm", "(", ")", "{", "// An array to hold the fields we'll neeed to INSERT the record", "$", "data", "=", "[", "]", ";", "// Wash the input fields", "$", "data", "[", "'to_email_address'", "]", "=", "trim", "(", "$", "this", "->", "...
Wash the create form's input fields @return array
[ "Wash", "the", "create", "form", "s", "input", "fields" ]
95db5a59ab322105b9d3681cf9ab1f829c9fdb9f
https://github.com/lasallecms/lasallecms-l5-lasallecmsemail-pkg/blob/95db5a59ab322105b9d3681cf9ab1f829c9fdb9f/src/Processing/AdminEmailProcessing.php#L110-L122
train
lasallecms/lasallecms-l5-lasallecmsemail-pkg
src/Processing/AdminEmailProcessing.php
AdminEmailProcessing.prepEmailData
public function prepEmailData($id) { $email = $this->email_message->find($id); // Build the email data // $data is an array $data = []; $data['from_name'] = $email->from_name; $data['from_email_address'] = $email->from_email_address; $data['to_name'...
php
public function prepEmailData($id) { $email = $this->email_message->find($id); // Build the email data // $data is an array $data = []; $data['from_name'] = $email->from_name; $data['from_email_address'] = $email->from_email_address; $data['to_name'...
[ "public", "function", "prepEmailData", "(", "$", "id", ")", "{", "$", "email", "=", "$", "this", "->", "email_message", "->", "find", "(", "$", "id", ")", ";", "// Build the email data", "// $data is an array", "$", "data", "=", "[", "]", ";", "$", "data...
Prepare the email @param int $id The "email_messages" table's ID field @return array
[ "Prepare", "the", "email" ]
95db5a59ab322105b9d3681cf9ab1f829c9fdb9f
https://github.com/lasallecms/lasallecms-l5-lasallecmsemail-pkg/blob/95db5a59ab322105b9d3681cf9ab1f829c9fdb9f/src/Processing/AdminEmailProcessing.php#L253-L270
train
phpffcms/ffcms-core
src/Helper/ModelFilters.php
ModelFilters.isFile
public static function isFile($object, $value): bool { // allow empty fields, "required" option filter that if ($object === null) { return true; } $all = false; // if string is given if (!Any::isArray($value)) { if ($value === '*') { ...
php
public static function isFile($object, $value): bool { // allow empty fields, "required" option filter that if ($object === null) { return true; } $all = false; // if string is given if (!Any::isArray($value)) { if ($value === '*') { ...
[ "public", "static", "function", "isFile", "(", "$", "object", ",", "$", "value", ")", ":", "bool", "{", "// allow empty fields, \"required\" option filter that", "if", "(", "$", "object", "===", "null", ")", "{", "return", "true", ";", "}", "$", "all", "=", ...
Check if field is file or null @param object $object @param $value @return bool
[ "Check", "if", "field", "is", "file", "or", "null" ]
44a309553ef9f115ccfcfd71f2ac6e381c612082
https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/ModelFilters.php#L303-L332
train
phpffcms/ffcms-core
src/Helper/ModelFilters.php
ModelFilters.sizeFile
public static function sizeFile($object, $value): bool { // allow empty field, validate on filter 'required' if ($object === null) { return true; } if (!Any::isArray($value)) { $value = [0, $value]; } // input file is not object? if (...
php
public static function sizeFile($object, $value): bool { // allow empty field, validate on filter 'required' if ($object === null) { return true; } if (!Any::isArray($value)) { $value = [0, $value]; } // input file is not object? if (...
[ "public", "static", "function", "sizeFile", "(", "$", "object", ",", "$", "value", ")", ":", "bool", "{", "// allow empty field, validate on filter 'required'", "if", "(", "$", "object", "===", "null", ")", "{", "return", "true", ";", "}", "if", "(", "!", ...
Check file size. If is null - will return true @param object $object @param $value @return bool
[ "Check", "file", "size", ".", "If", "is", "null", "-", "will", "return", "true" ]
44a309553ef9f115ccfcfd71f2ac6e381c612082
https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/ModelFilters.php#L340-L363
train
quantaphp/container-factories
src/FactoryMap.php
FactoryMap.extended
private function extended(callable $factory, callable ...$extensions): callable { return array_reduce($extensions, function ($factory, $extension) { return new Extension($factory, $extension); }, $factory); }
php
private function extended(callable $factory, callable ...$extensions): callable { return array_reduce($extensions, function ($factory, $extension) { return new Extension($factory, $extension); }, $factory); }
[ "private", "function", "extended", "(", "callable", "$", "factory", ",", "callable", "...", "$", "extensions", ")", ":", "callable", "{", "return", "array_reduce", "(", "$", "extensions", ",", "function", "(", "$", "factory", ",", "$", "extension", ")", "{...
Return an extension from the given callables. @param callable $factory @param callable ...$extensions @return callable
[ "Return", "an", "extension", "from", "the", "given", "callables", "." ]
5e753d66a18d0ce4418cbf33fe6d6b74948f303d
https://github.com/quantaphp/container-factories/blob/5e753d66a18d0ce4418cbf33fe6d6b74948f303d/src/FactoryMap.php#L69-L74
train
ptlis/grep-db
src/Replace/Replace.php
Replace.replaceDatabase
public function replaceDatabase( Connection $connection, string $databaseName, string $searchTerm, string $replaceTerm, int $batchSize = 100 ): \Generator { $databaseMetadata = (new MetadataFactory())->getDatabaseMetadata($connection, $databaseName); foreach ...
php
public function replaceDatabase( Connection $connection, string $databaseName, string $searchTerm, string $replaceTerm, int $batchSize = 100 ): \Generator { $databaseMetadata = (new MetadataFactory())->getDatabaseMetadata($connection, $databaseName); foreach ...
[ "public", "function", "replaceDatabase", "(", "Connection", "$", "connection", ",", "string", "$", "databaseName", ",", "string", "$", "searchTerm", ",", "string", "$", "replaceTerm", ",", "int", "$", "batchSize", "=", "100", ")", ":", "\\", "Generator", "{"...
Performs a search on all tables in the the provided database, batching queries to the specified batch size. @return \Generator|RowReplaceResult[]
[ "Performs", "a", "search", "on", "all", "tables", "in", "the", "the", "provided", "database", "batching", "queries", "to", "the", "specified", "batch", "size", "." ]
7abff68982d426690d0515ccd7adc7a2e3d72a3f
https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Replace/Replace.php#L51-L74
train
ptlis/grep-db
src/Replace/Replace.php
Replace.replaceTable
public function replaceTable( Connection $connection, string $databaseName, string $tableName, string $searchTerm, string $replaceTerm, int $batchSize = 100 ): \Generator { $connection->query('START TRANSACTION'); $rowCount = 0; $rowSearchRes...
php
public function replaceTable( Connection $connection, string $databaseName, string $tableName, string $searchTerm, string $replaceTerm, int $batchSize = 100 ): \Generator { $connection->query('START TRANSACTION'); $rowCount = 0; $rowSearchRes...
[ "public", "function", "replaceTable", "(", "Connection", "$", "connection", ",", "string", "$", "databaseName", ",", "string", "$", "tableName", ",", "string", "$", "searchTerm", ",", "string", "$", "replaceTerm", ",", "int", "$", "batchSize", "=", "100", ")...
Performs a search on the provided table, batching queries to the specified batch size. @return \Generator|RowReplaceResult[]
[ "Performs", "a", "search", "on", "the", "provided", "table", "batching", "queries", "to", "the", "specified", "batch", "size", "." ]
7abff68982d426690d0515ccd7adc7a2e3d72a3f
https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Replace/Replace.php#L81-L153
train
ptlis/grep-db
src/Replace/Replace.php
Replace.replace
private function replace( ColumnMetadata $columnMetadata, string $searchTerm, string $replaceTerm, string $subject ): FieldReplaceResult { $fieldReplaced = null; foreach ($this->replacementStrategyList as $replacementStrategy) { if ($replacementStrategy->c...
php
private function replace( ColumnMetadata $columnMetadata, string $searchTerm, string $replaceTerm, string $subject ): FieldReplaceResult { $fieldReplaced = null; foreach ($this->replacementStrategyList as $replacementStrategy) { if ($replacementStrategy->c...
[ "private", "function", "replace", "(", "ColumnMetadata", "$", "columnMetadata", ",", "string", "$", "searchTerm", ",", "string", "$", "replaceTerm", ",", "string", "$", "subject", ")", ":", "FieldReplaceResult", "{", "$", "fieldReplaced", "=", "null", ";", "fo...
Perform the string replacement on the field. @throws \RuntimeException If the replacement fails.
[ "Perform", "the", "string", "replacement", "on", "the", "field", "." ]
7abff68982d426690d0515ccd7adc7a2e3d72a3f
https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Replace/Replace.php#L186-L210
train
AmericanCouncils/Slimfra
src/Application.php
Application.register
public function register(ServiceProviderInterface $provider, array $values = array()) { $this->registeredProviders[get_class($provider)] = true; parent::register($provider, $values); }
php
public function register(ServiceProviderInterface $provider, array $values = array()) { $this->registeredProviders[get_class($provider)] = true; parent::register($provider, $values); }
[ "public", "function", "register", "(", "ServiceProviderInterface", "$", "provider", ",", "array", "$", "values", "=", "array", "(", ")", ")", "{", "$", "this", "->", "registeredProviders", "[", "get_class", "(", "$", "provider", ")", "]", "=", "true", ";",...
Keep track of registered providers. {@inheritdoc}
[ "Keep", "track", "of", "registered", "providers", "." ]
17f2b8dc71bc0d7aa6da2ac89bee2b1806a3aeb6
https://github.com/AmericanCouncils/Slimfra/blob/17f2b8dc71bc0d7aa6da2ac89bee2b1806a3aeb6/src/Application.php#L53-L58
train
AmericanCouncils/Slimfra
src/Application.php
Application.handleError
public function handleError($errno, $errstr, $errfile, $errline) { if (!$this['debug']) { return; } throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); }
php
public function handleError($errno, $errstr, $errfile, $errline) { if (!$this['debug']) { return; } throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); }
[ "public", "function", "handleError", "(", "$", "errno", ",", "$", "errstr", ",", "$", "errfile", ",", "$", "errline", ")", "{", "if", "(", "!", "$", "this", "[", "'debug'", "]", ")", "{", "return", ";", "}", "throw", "new", "\\", "ErrorException", ...
A generic error handler, will convert errors into exceptions in debug mode. @param int $errno @param string $errstr @param string $errfile @param int $errline @throws ErrorException
[ "A", "generic", "error", "handler", "will", "convert", "errors", "into", "exceptions", "in", "debug", "mode", "." ]
17f2b8dc71bc0d7aa6da2ac89bee2b1806a3aeb6
https://github.com/AmericanCouncils/Slimfra/blob/17f2b8dc71bc0d7aa6da2ac89bee2b1806a3aeb6/src/Application.php#L103-L110
train
gplcart/ga_report
controllers/Report.php
Report.listReport
public function listReport() { $this->setTitleListReport(); $this->setBreadcrumbListReport(); $this->clearCacheReport(); $this->setData('stores', $this->store->getList()); $this->setData('panels', $this->getPanelsReport()); $default = $this->module->getSettings('ga_...
php
public function listReport() { $this->setTitleListReport(); $this->setBreadcrumbListReport(); $this->clearCacheReport(); $this->setData('stores', $this->store->getList()); $this->setData('panels', $this->getPanelsReport()); $default = $this->module->getSettings('ga_...
[ "public", "function", "listReport", "(", ")", "{", "$", "this", "->", "setTitleListReport", "(", ")", ";", "$", "this", "->", "setBreadcrumbListReport", "(", ")", ";", "$", "this", "->", "clearCacheReport", "(", ")", ";", "$", "this", "->", "setData", "(...
Route callback Displays the report page
[ "Route", "callback", "Displays", "the", "report", "page" ]
856a480e394bb3feaeea4785ccccad56abaac499
https://github.com/gplcart/ga_report/blob/856a480e394bb3feaeea4785ccccad56abaac499/controllers/Report.php#L41-L54
train
gplcart/ga_report
controllers/Report.php
Report.getPanelsReport
protected function getPanelsReport() { $settings = $this->module->getSettings('ga_report'); $store_id = $this->getQuery('ga.update.store_id'); if (!empty($store_id)) { $settings['store_id'] = $store_id; } $panels = array(); foreach ($this->report_model-...
php
protected function getPanelsReport() { $settings = $this->module->getSettings('ga_report'); $store_id = $this->getQuery('ga.update.store_id'); if (!empty($store_id)) { $settings['store_id'] = $store_id; } $panels = array(); foreach ($this->report_model-...
[ "protected", "function", "getPanelsReport", "(", ")", "{", "$", "settings", "=", "$", "this", "->", "module", "->", "getSettings", "(", "'ga_report'", ")", ";", "$", "store_id", "=", "$", "this", "->", "getQuery", "(", "'ga.update.store_id'", ")", ";", "if...
Returns an array of report panels @return array
[ "Returns", "an", "array", "of", "report", "panels" ]
856a480e394bb3feaeea4785ccccad56abaac499
https://github.com/gplcart/ga_report/blob/856a480e394bb3feaeea4785ccccad56abaac499/controllers/Report.php#L93-L122
train
Vectrex/vxPHP
src/Routing/DefaultRouteAuthenticator.php
DefaultRouteAuthenticator.handleViolation
public function handleViolation(Route $route) { if(in_array($route, $this->violatingRoutes)) { throw new ApplicationException('Circular redirects detected; aborting.'); } // to avoid circular references all redirects are logged $this->violatingRoutes[] = $route; ...
php
public function handleViolation(Route $route) { if(in_array($route, $this->violatingRoutes)) { throw new ApplicationException('Circular redirects detected; aborting.'); } // to avoid circular references all redirects are logged $this->violatingRoutes[] = $route; ...
[ "public", "function", "handleViolation", "(", "Route", "$", "route", ")", "{", "if", "(", "in_array", "(", "$", "route", ",", "$", "this", "->", "violatingRoutes", ")", ")", "{", "throw", "new", "ApplicationException", "(", "'Circular redirects detected; abortin...
handle authentication violation by trying to find a redirecting route @param Route $route @return mixed|Route @throws \vxPHP\Application\Exception\ApplicationException
[ "handle", "authentication", "violation", "by", "trying", "to", "find", "a", "redirecting", "route" ]
295c21b00e7ef6085efcdf5b64fabb28d499b5a6
https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Routing/DefaultRouteAuthenticator.php#L97-L118
train
agentmedia/phine-core
src/Core/Logic/Tree/ListProvider.php
ListProvider.ToArray
function ToArray() { $result = array(); $item = $this->TopMost(); while ($item) { $result[] = $item; $item = $this->NextOf($item); } return $result; }
php
function ToArray() { $result = array(); $item = $this->TopMost(); while ($item) { $result[] = $item; $item = $this->NextOf($item); } return $result; }
[ "function", "ToArray", "(", ")", "{", "$", "result", "=", "array", "(", ")", ";", "$", "item", "=", "$", "this", "->", "TopMost", "(", ")", ";", "while", "(", "$", "item", ")", "{", "$", "result", "[", "]", "=", "$", "item", ";", "$", "item",...
Gets the sorted item list @return mixed[] Returns the items in their given order
[ "Gets", "the", "sorted", "item", "list" ]
38c1be8d03ebffae950d00a96da3c612aff67832
https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Tree/ListProvider.php#L29-L39
train
agentmedia/phine-core
src/Core/Logic/Tree/ListProvider.php
ListProvider.Last
function Last() { $items = $this->ToArray(); $cnt = count($items); return $cnt > 0 ? $items[$cnt -1] : null; }
php
function Last() { $items = $this->ToArray(); $cnt = count($items); return $cnt > 0 ? $items[$cnt -1] : null; }
[ "function", "Last", "(", ")", "{", "$", "items", "=", "$", "this", "->", "ToArray", "(", ")", ";", "$", "cnt", "=", "count", "(", "$", "items", ")", ";", "return", "$", "cnt", ">", "0", "?", "$", "items", "[", "$", "cnt", "-", "1", "]", ":"...
Gets the last item @return mixed Retuens the last list item
[ "Gets", "the", "last", "item" ]
38c1be8d03ebffae950d00a96da3c612aff67832
https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Tree/ListProvider.php#L45-L49
train
codeblanche/Web
src/Web/Route/Rules/UriRule.php
UriRule.complexity
public function complexity() { $dynamicPartsCount = substr_count($this->pattern, ':') + substr_count($this->pattern, '?'); return (substr_count($this->pattern, '/') - $dynamicPartsCount) * 100 + $dynamicPartsCount; }
php
public function complexity() { $dynamicPartsCount = substr_count($this->pattern, ':') + substr_count($this->pattern, '?'); return (substr_count($this->pattern, '/') - $dynamicPartsCount) * 100 + $dynamicPartsCount; }
[ "public", "function", "complexity", "(", ")", "{", "$", "dynamicPartsCount", "=", "substr_count", "(", "$", "this", "->", "pattern", ",", "':'", ")", "+", "substr_count", "(", "$", "this", "->", "pattern", ",", "'?'", ")", ";", "return", "(", "substr_cou...
Count the number of pattern segments for this rule.
[ "Count", "the", "number", "of", "pattern", "segments", "for", "this", "rule", "." ]
3e9ebf1943d3ea468f619ba99f7cc10714cb16e9
https://github.com/codeblanche/Web/blob/3e9ebf1943d3ea468f619ba99f7cc10714cb16e9/src/Web/Route/Rules/UriRule.php#L12-L17
train
nice-php/benchmark
src/ResultPruner/StandardDeviationPruner.php
StandardDeviationPruner.prune
public function prune(array $results) { $mean = array_sum($results) / count($results); $deviation = $this->deviations * $this->standardDeviation($results); $lower = $mean - $deviation; $upper = $mean + $deviation; return array_values(array_filter($results, function ($val) us...
php
public function prune(array $results) { $mean = array_sum($results) / count($results); $deviation = $this->deviations * $this->standardDeviation($results); $lower = $mean - $deviation; $upper = $mean + $deviation; return array_values(array_filter($results, function ($val) us...
[ "public", "function", "prune", "(", "array", "$", "results", ")", "{", "$", "mean", "=", "array_sum", "(", "$", "results", ")", "/", "count", "(", "$", "results", ")", ";", "$", "deviation", "=", "$", "this", "->", "deviations", "*", "$", "this", "...
Prune the results @param array $results @return array The pruned results
[ "Prune", "the", "results" ]
2084c77dbb88cd76006abbfe85b2b704f6bbd1cf
https://github.com/nice-php/benchmark/blob/2084c77dbb88cd76006abbfe85b2b704f6bbd1cf/src/ResultPruner/StandardDeviationPruner.php#L38-L48
train
nice-php/benchmark
src/ResultPruner/StandardDeviationPruner.php
StandardDeviationPruner.standardDeviation
private function standardDeviation(array $results) { $mean = array_sum($results) / count($results); $initial = 0; $f = function ($carry, $val) use ($mean) { return $carry + pow($val - $mean, 2); }; $sum = array_reduce($results, $f, $initial); $n = count($r...
php
private function standardDeviation(array $results) { $mean = array_sum($results) / count($results); $initial = 0; $f = function ($carry, $val) use ($mean) { return $carry + pow($val - $mean, 2); }; $sum = array_reduce($results, $f, $initial); $n = count($r...
[ "private", "function", "standardDeviation", "(", "array", "$", "results", ")", "{", "$", "mean", "=", "array_sum", "(", "$", "results", ")", "/", "count", "(", "$", "results", ")", ";", "$", "initial", "=", "0", ";", "$", "f", "=", "function", "(", ...
Returns one standard deviation for the given results @param array $results @return float
[ "Returns", "one", "standard", "deviation", "for", "the", "given", "results" ]
2084c77dbb88cd76006abbfe85b2b704f6bbd1cf
https://github.com/nice-php/benchmark/blob/2084c77dbb88cd76006abbfe85b2b704f6bbd1cf/src/ResultPruner/StandardDeviationPruner.php#L57-L68
train
nails/module-blog
admin/controllers/Tag.php
Tag.index
public function index() { // Page data $this->data['page']->title = 'Blog &rsaquo; Tags'; // -------------------------------------------------------------------------- $data = array(); $data['include_count'] = true; $data['where'] = array()...
php
public function index() { // Page data $this->data['page']->title = 'Blog &rsaquo; Tags'; // -------------------------------------------------------------------------- $data = array(); $data['include_count'] = true; $data['where'] = array()...
[ "public", "function", "index", "(", ")", "{", "// Page data", "$", "this", "->", "data", "[", "'page'", "]", "->", "title", "=", "'Blog &rsaquo; Tags'", ";", "// --------------------------------------------------------------------------", "$", "data", "=", "array", "...
Browse blog tags @return void
[ "Browse", "blog", "tags" ]
7b369c5209f4343fff7c7e2a22c237d5a95c8c24
https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/admin/controllers/Tag.php#L154-L171
train
nails/module-blog
admin/controllers/Tag.php
Tag.create
public function create() { if (!userHasPermission('admin:blog:tag:' . $this->blog->id . ':create')) { unauthorised(); } // -------------------------------------------------------------------------- if ($this->input->post()) { $oFormValidation = Factory::se...
php
public function create() { if (!userHasPermission('admin:blog:tag:' . $this->blog->id . ':create')) { unauthorised(); } // -------------------------------------------------------------------------- if ($this->input->post()) { $oFormValidation = Factory::se...
[ "public", "function", "create", "(", ")", "{", "if", "(", "!", "userHasPermission", "(", "'admin:blog:tag:'", ".", "$", "this", "->", "blog", "->", "id", ".", "':create'", ")", ")", "{", "unauthorised", "(", ")", ";", "}", "// -------------------------------...
Create a new blog tag @return void
[ "Create", "a", "new", "blog", "tag" ]
7b369c5209f4343fff7c7e2a22c237d5a95c8c24
https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/admin/controllers/Tag.php#L179-L244
train
nails/module-blog
admin/controllers/Tag.php
Tag.edit
public function edit() { if (!userHasPermission('admin:blog:tag:' . $this->blog->id . ':edit')) { unauthorised(); } // -------------------------------------------------------------------------- $this->data['tag'] = $this->blog_tag_model->getById($this->uri->segment(6))...
php
public function edit() { if (!userHasPermission('admin:blog:tag:' . $this->blog->id . ':edit')) { unauthorised(); } // -------------------------------------------------------------------------- $this->data['tag'] = $this->blog_tag_model->getById($this->uri->segment(6))...
[ "public", "function", "edit", "(", ")", "{", "if", "(", "!", "userHasPermission", "(", "'admin:blog:tag:'", ".", "$", "this", "->", "blog", "->", "id", ".", "':edit'", ")", ")", "{", "unauthorised", "(", ")", ";", "}", "// -----------------------------------...
Edit a blog tag @return void
[ "Edit", "a", "blog", "tag" ]
7b369c5209f4343fff7c7e2a22c237d5a95c8c24
https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/admin/controllers/Tag.php#L252-L323
train
ekyna/Resource
Configuration/ConfigurationRegistry.php
ConfigurationRegistry.addConfiguration
public function addConfiguration(ConfigurationInterface $configuration) { // Clear the parent map. $this->parentMap = null; $id = $configuration->getResourceId(); if (array_key_exists($id, $this->configurations)) { throw new \RuntimeException(sprintf("Configuration for ...
php
public function addConfiguration(ConfigurationInterface $configuration) { // Clear the parent map. $this->parentMap = null; $id = $configuration->getResourceId(); if (array_key_exists($id, $this->configurations)) { throw new \RuntimeException(sprintf("Configuration for ...
[ "public", "function", "addConfiguration", "(", "ConfigurationInterface", "$", "configuration", ")", "{", "// Clear the parent map.", "$", "this", "->", "parentMap", "=", "null", ";", "$", "id", "=", "$", "configuration", "->", "getResourceId", "(", ")", ";", "if...
Adds the resource configuration. @param ConfigurationInterface $configuration @throws \RuntimeException
[ "Adds", "the", "resource", "configuration", "." ]
96ee3d28e02bd9513705408e3bb7f88a76e52f56
https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Configuration/ConfigurationRegistry.php#L48-L60
train
ekyna/Resource
Configuration/ConfigurationRegistry.php
ConfigurationRegistry.get
public function get($id) { if (!$this->has($id)) { throw new \InvalidArgumentException(sprintf('Configuration "%s" not found.', $id)); } return $this->configurations[$id]; }
php
public function get($id) { if (!$this->has($id)) { throw new \InvalidArgumentException(sprintf('Configuration "%s" not found.', $id)); } return $this->configurations[$id]; }
[ "public", "function", "get", "(", "$", "id", ")", "{", "if", "(", "!", "$", "this", "->", "has", "(", "$", "id", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "'Configuration \"%s\" not found.'", ",", "$", "id", ...
Returns the configuration for the given identifier. @param string $id @throws \InvalidArgumentException @return ConfigurationInterface
[ "Returns", "the", "configuration", "for", "the", "given", "identifier", "." ]
96ee3d28e02bd9513705408e3bb7f88a76e52f56
https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Configuration/ConfigurationRegistry.php#L161-L168
train
ekyna/Resource
Configuration/ConfigurationRegistry.php
ConfigurationRegistry.getAncestors
public function getAncestors(ConfigurationInterface $configuration, $included = false) { $ancestors = []; if ($included) { $ancestors[$configuration->getResourceName()] = $configuration; } while (null !== $configuration->getParentId()) { $configuration = $th...
php
public function getAncestors(ConfigurationInterface $configuration, $included = false) { $ancestors = []; if ($included) { $ancestors[$configuration->getResourceName()] = $configuration; } while (null !== $configuration->getParentId()) { $configuration = $th...
[ "public", "function", "getAncestors", "(", "ConfigurationInterface", "$", "configuration", ",", "$", "included", "=", "false", ")", "{", "$", "ancestors", "=", "[", "]", ";", "if", "(", "$", "included", ")", "{", "$", "ancestors", "[", "$", "configuration"...
Returns all the ancestors configuration. @param ConfigurationInterface $configuration @param bool $included @return ConfigurationInterface[]
[ "Returns", "all", "the", "ancestors", "configuration", "." ]
96ee3d28e02bd9513705408e3bb7f88a76e52f56
https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Configuration/ConfigurationRegistry.php#L178-L192
train
ekyna/Resource
Configuration/ConfigurationRegistry.php
ConfigurationRegistry.getChildren
public function getChildren(ConfigurationInterface $configuration) { $children = []; foreach ($this->configurations as $child) { if ($child->getParentId() === $configuration->getResourceId()) { $children[$child->getResourceName()] = $child; } } ...
php
public function getChildren(ConfigurationInterface $configuration) { $children = []; foreach ($this->configurations as $child) { if ($child->getParentId() === $configuration->getResourceId()) { $children[$child->getResourceName()] = $child; } } ...
[ "public", "function", "getChildren", "(", "ConfigurationInterface", "$", "configuration", ")", "{", "$", "children", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "configurations", "as", "$", "child", ")", "{", "if", "(", "$", "child", "->", "ge...
Returns all the children configuration. @param ConfigurationInterface $configuration @return ConfigurationInterface[]
[ "Returns", "all", "the", "children", "configuration", "." ]
96ee3d28e02bd9513705408e3bb7f88a76e52f56
https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Configuration/ConfigurationRegistry.php#L201-L212
train
ekyna/Resource
Configuration/ConfigurationRegistry.php
ConfigurationRegistry.getObjectIdentity
public function getObjectIdentity($object) { foreach ($this->configurations as $config) { if ($config->isRelevant($object)) { return $config->getObjectIdentity(); } } return null; }
php
public function getObjectIdentity($object) { foreach ($this->configurations as $config) { if ($config->isRelevant($object)) { return $config->getObjectIdentity(); } } return null; }
[ "public", "function", "getObjectIdentity", "(", "$", "object", ")", "{", "foreach", "(", "$", "this", "->", "configurations", "as", "$", "config", ")", "{", "if", "(", "$", "config", "->", "isRelevant", "(", "$", "object", ")", ")", "{", "return", "$",...
Returns the object identity. @param object $object @return \Symfony\Component\Security\Acl\Domain\ObjectIdentity|null
[ "Returns", "the", "object", "identity", "." ]
96ee3d28e02bd9513705408e3bb7f88a76e52f56
https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Configuration/ConfigurationRegistry.php#L231-L240
train
ekyna/Resource
Configuration/ConfigurationRegistry.php
ConfigurationRegistry.getParentMap
public function getParentMap() { if (null !== $this->parentMap) { return $this->parentMap; } return $this->parentMap = $this->buildParentMap(); }
php
public function getParentMap() { if (null !== $this->parentMap) { return $this->parentMap; } return $this->parentMap = $this->buildParentMap(); }
[ "public", "function", "getParentMap", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "parentMap", ")", "{", "return", "$", "this", "->", "parentMap", ";", "}", "return", "$", "this", "->", "parentMap", "=", "$", "this", "->", "buildParentM...
Returns the hierarchy map. @return array
[ "Returns", "the", "hierarchy", "map", "." ]
96ee3d28e02bd9513705408e3bb7f88a76e52f56
https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Configuration/ConfigurationRegistry.php#L247-L254
train
ekyna/Resource
Configuration/ConfigurationRegistry.php
ConfigurationRegistry.getEventPriorityMap
public function getEventPriorityMap() { if (null !== $this->eventPriorityMap) { return $this->eventPriorityMap; } return $this->eventPriorityMap = $this->buildEventPriorityMap(); }
php
public function getEventPriorityMap() { if (null !== $this->eventPriorityMap) { return $this->eventPriorityMap; } return $this->eventPriorityMap = $this->buildEventPriorityMap(); }
[ "public", "function", "getEventPriorityMap", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "eventPriorityMap", ")", "{", "return", "$", "this", "->", "eventPriorityMap", ";", "}", "return", "$", "this", "->", "eventPriorityMap", "=", "$", "th...
Returns the event priority map. @return array
[ "Returns", "the", "event", "priority", "map", "." ]
96ee3d28e02bd9513705408e3bb7f88a76e52f56
https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Configuration/ConfigurationRegistry.php#L261-L268
train
ekyna/Resource
Configuration/ConfigurationRegistry.php
ConfigurationRegistry.buildParentMap
private function buildParentMap() { $map = []; foreach ($this->configurations as $configuration) { if (null !== $parentId = $configuration->getParentId()) { $map[$configuration->getResourceId()] = $parentId; } } ksort($map); return $...
php
private function buildParentMap() { $map = []; foreach ($this->configurations as $configuration) { if (null !== $parentId = $configuration->getParentId()) { $map[$configuration->getResourceId()] = $parentId; } } ksort($map); return $...
[ "private", "function", "buildParentMap", "(", ")", "{", "$", "map", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "configurations", "as", "$", "configuration", ")", "{", "if", "(", "null", "!==", "$", "parentId", "=", "$", "configuration", "->...
Builds the parent map. @return array
[ "Builds", "the", "parent", "map", "." ]
96ee3d28e02bd9513705408e3bb7f88a76e52f56
https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Configuration/ConfigurationRegistry.php#L275-L288
train
ekyna/Resource
Configuration/ConfigurationRegistry.php
ConfigurationRegistry.buildEventPriorityMap
private function buildEventPriorityMap() { $map = []; foreach ($this->configurations as $configuration) { if (0 != $priority = $configuration->getEventPriority()) { $map[$configuration->getResourceId()] = $priority; } } ksort($map); ...
php
private function buildEventPriorityMap() { $map = []; foreach ($this->configurations as $configuration) { if (0 != $priority = $configuration->getEventPriority()) { $map[$configuration->getResourceId()] = $priority; } } ksort($map); ...
[ "private", "function", "buildEventPriorityMap", "(", ")", "{", "$", "map", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "configurations", "as", "$", "configuration", ")", "{", "if", "(", "0", "!=", "$", "priority", "=", "$", "configuration", ...
Builds the event priority map. @return array
[ "Builds", "the", "event", "priority", "map", "." ]
96ee3d28e02bd9513705408e3bb7f88a76e52f56
https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Configuration/ConfigurationRegistry.php#L295-L308
train
ezra-obiwale/dSCore
src/Form/Element.php
Element.getValue
protected function getValue() { if (($this->data == '0' || !empty($this->data)) && !is_object($this->data)) { $value = ($this->parent && is_array($this->data)) ? $this->data[0] : $this->data; } else if ($this->options->default == '0' || !empty($this->options->default)) { $value =...
php
protected function getValue() { if (($this->data == '0' || !empty($this->data)) && !is_object($this->data)) { $value = ($this->parent && is_array($this->data)) ? $this->data[0] : $this->data; } else if ($this->options->default == '0' || !empty($this->options->default)) { $value =...
[ "protected", "function", "getValue", "(", ")", "{", "if", "(", "(", "$", "this", "->", "data", "==", "'0'", "||", "!", "empty", "(", "$", "this", "->", "data", ")", ")", "&&", "!", "is_object", "(", "$", "this", "->", "data", ")", ")", "{", "$"...
Fetches the current value of the element @return mixed
[ "Fetches", "the", "current", "value", "of", "the", "element" ]
dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d
https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Element.php#L132-L145
train
ezra-obiwale/dSCore
src/Form/Element.php
Element.render
public function render() { if ($this->parent) { if (!static::$count[$this->parent]) static::$count[$this->parent] = 0; static::$count[$this->parent] ++; $this->attributes->id += static::$count[$this->parent]; } ob_start(); ?> <...
php
public function render() { if ($this->parent) { if (!static::$count[$this->parent]) static::$count[$this->parent] = 0; static::$count[$this->parent] ++; $this->attributes->id += static::$count[$this->parent]; } ob_start(); ?> <...
[ "public", "function", "render", "(", ")", "{", "if", "(", "$", "this", "->", "parent", ")", "{", "if", "(", "!", "static", "::", "$", "count", "[", "$", "this", "->", "parent", "]", ")", "static", "::", "$", "count", "[", "$", "this", "->", "pa...
Render the element for output @return string
[ "Render", "the", "element", "for", "output" ]
dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d
https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Element.php#L177-L195
train
ekyna/PaymentBundle
Twig/PaymentExtension.php
PaymentExtension.getPaymentStateLabel
public function getPaymentStateLabel($stateOrPayment) { $state = $stateOrPayment instanceof PaymentInterface ? $stateOrPayment->getState() : $stateOrPayment; return $this->translator->trans(PaymentStates::getLabel($state)); }
php
public function getPaymentStateLabel($stateOrPayment) { $state = $stateOrPayment instanceof PaymentInterface ? $stateOrPayment->getState() : $stateOrPayment; return $this->translator->trans(PaymentStates::getLabel($state)); }
[ "public", "function", "getPaymentStateLabel", "(", "$", "stateOrPayment", ")", "{", "$", "state", "=", "$", "stateOrPayment", "instanceof", "PaymentInterface", "?", "$", "stateOrPayment", "->", "getState", "(", ")", ":", "$", "stateOrPayment", ";", "return", "$"...
Returns the payment state label. @param string|PaymentInterface $stateOrPayment @return string
[ "Returns", "the", "payment", "state", "label", "." ]
1b4f4103b28e3a4f8dbfac2cbd872d728238f4d1
https://github.com/ekyna/PaymentBundle/blob/1b4f4103b28e3a4f8dbfac2cbd872d728238f4d1/Twig/PaymentExtension.php#L82-L87
train
ekyna/PaymentBundle
Twig/PaymentExtension.php
PaymentExtension.getPaymentStateBadge
public function getPaymentStateBadge($stateOrPayment) { $state = $stateOrPayment instanceof PaymentInterface ? $stateOrPayment->getState() : $stateOrPayment; return sprintf( '<span class="label label-%s">%s</span>', PaymentStates::getTheme($state), $this->getPaym...
php
public function getPaymentStateBadge($stateOrPayment) { $state = $stateOrPayment instanceof PaymentInterface ? $stateOrPayment->getState() : $stateOrPayment; return sprintf( '<span class="label label-%s">%s</span>', PaymentStates::getTheme($state), $this->getPaym...
[ "public", "function", "getPaymentStateBadge", "(", "$", "stateOrPayment", ")", "{", "$", "state", "=", "$", "stateOrPayment", "instanceof", "PaymentInterface", "?", "$", "stateOrPayment", "->", "getState", "(", ")", ":", "$", "stateOrPayment", ";", "return", "sp...
Returns the payment state badge. @param string|PaymentInterface $stateOrPayment @return string
[ "Returns", "the", "payment", "state", "badge", "." ]
1b4f4103b28e3a4f8dbfac2cbd872d728238f4d1
https://github.com/ekyna/PaymentBundle/blob/1b4f4103b28e3a4f8dbfac2cbd872d728238f4d1/Twig/PaymentExtension.php#L95-L104
train
ekyna/PaymentBundle
Twig/PaymentExtension.php
PaymentExtension.renderMethodConfig
public function renderMethodConfig(MethodInterface $method) { $output = '<dl class="dl-horizontal">'; foreach ($method->getConfig() as $key => $value) { if (is_array($value)) { continue; } $output .= sprintf('<dt>%s</dt><dd>%s</dd>', $key, $value...
php
public function renderMethodConfig(MethodInterface $method) { $output = '<dl class="dl-horizontal">'; foreach ($method->getConfig() as $key => $value) { if (is_array($value)) { continue; } $output .= sprintf('<dt>%s</dt><dd>%s</dd>', $key, $value...
[ "public", "function", "renderMethodConfig", "(", "MethodInterface", "$", "method", ")", "{", "$", "output", "=", "'<dl class=\"dl-horizontal\">'", ";", "foreach", "(", "$", "method", "->", "getConfig", "(", ")", "as", "$", "key", "=>", "$", "value", ")", "{"...
Renders the method config. @param MethodInterface $method @return string
[ "Renders", "the", "method", "config", "." ]
1b4f4103b28e3a4f8dbfac2cbd872d728238f4d1
https://github.com/ekyna/PaymentBundle/blob/1b4f4103b28e3a4f8dbfac2cbd872d728238f4d1/Twig/PaymentExtension.php#L145-L160
train
jenskooij/cloudcontrol
src/storage/storage/DocumentStorage.php
DocumentStorage.addDocumentFolder
public function addDocumentFolder($postValues) { $documentFolderObject = DocumentFolderFactory::createDocumentFolderFromPostValues($postValues); if ($postValues['path'] === '/') { $documentFolderObject->path = $postValues['path'] . $documentFolderObject->slug; } else { ...
php
public function addDocumentFolder($postValues) { $documentFolderObject = DocumentFolderFactory::createDocumentFolderFromPostValues($postValues); if ($postValues['path'] === '/') { $documentFolderObject->path = $postValues['path'] . $documentFolderObject->slug; } else { ...
[ "public", "function", "addDocumentFolder", "(", "$", "postValues", ")", "{", "$", "documentFolderObject", "=", "DocumentFolderFactory", "::", "createDocumentFolderFromPostValues", "(", "$", "postValues", ")", ";", "if", "(", "$", "postValues", "[", "'path'", "]", ...
Add new document in given path @param array $postValues @throws \Exception
[ "Add", "new", "document", "in", "given", "path" ]
76e5d9ac8f9c50d06d39a995d13cc03742536548
https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/DocumentStorage.php#L154-L164
train
jenskooij/cloudcontrol
src/storage/storage/DocumentStorage.php
DocumentStorage.deleteDocumentFolderBySlug
public function deleteDocumentFolderBySlug($slug) { $path = '/' . $slug; $this->repository->getContentRepository()->deleteDocumentByPath($this->repository, $path); $this->repository->getContentRepository()->cleanPublishedDeletedDocuments(); }
php
public function deleteDocumentFolderBySlug($slug) { $path = '/' . $slug; $this->repository->getContentRepository()->deleteDocumentByPath($this->repository, $path); $this->repository->getContentRepository()->cleanPublishedDeletedDocuments(); }
[ "public", "function", "deleteDocumentFolderBySlug", "(", "$", "slug", ")", "{", "$", "path", "=", "'/'", ".", "$", "slug", ";", "$", "this", "->", "repository", "->", "getContentRepository", "(", ")", "->", "deleteDocumentByPath", "(", "$", "this", "->", "...
Delete a folder by its compound slug @param $slug @throws \Exception
[ "Delete", "a", "folder", "by", "its", "compound", "slug" ]
76e5d9ac8f9c50d06d39a995d13cc03742536548
https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/DocumentStorage.php#L173-L178
train
jenskooij/cloudcontrol
src/storage/storage/DocumentStorage.php
DocumentStorage.getDocumentFolderBySlug
public function getDocumentFolderBySlug($slug) { if ($slug === '/') { $path = $slug; } else { $path = '/' . $slug; } return $this->repository->getContentRepository()->getDocumentByPath($this->repository, $path, 'unpublished'); }
php
public function getDocumentFolderBySlug($slug) { if ($slug === '/') { $path = $slug; } else { $path = '/' . $slug; } return $this->repository->getContentRepository()->getDocumentByPath($this->repository, $path, 'unpublished'); }
[ "public", "function", "getDocumentFolderBySlug", "(", "$", "slug", ")", "{", "if", "(", "$", "slug", "===", "'/'", ")", "{", "$", "path", "=", "$", "slug", ";", "}", "else", "{", "$", "path", "=", "'/'", ".", "$", "slug", ";", "}", "return", "$",...
Retrieve a folder by its compound slug @param $slug @return mixed @throws \Exception
[ "Retrieve", "a", "folder", "by", "its", "compound", "slug" ]
76e5d9ac8f9c50d06d39a995d13cc03742536548
https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/DocumentStorage.php#L208-L217
train
froq/froq-acl
src/User.php
User.canRead
public function canRead(string $uri): bool { // /book => all if (in_array(Acl::RULE_ALL, (array) $this->getPermissionsOf($this->getUriRoot($uri)))) { return true; } // /book/detail => all or read $permission = array_filter((array) $this->getPermissionsOf($uri), f...
php
public function canRead(string $uri): bool { // /book => all if (in_array(Acl::RULE_ALL, (array) $this->getPermissionsOf($this->getUriRoot($uri)))) { return true; } // /book/detail => all or read $permission = array_filter((array) $this->getPermissionsOf($uri), f...
[ "public", "function", "canRead", "(", "string", "$", "uri", ")", ":", "bool", "{", "// /book => all", "if", "(", "in_array", "(", "Acl", "::", "RULE_ALL", ",", "(", "array", ")", "$", "this", "->", "getPermissionsOf", "(", "$", "this", "->", "getUriRoot"...
Can read. @param string $uri @return bool
[ "Can", "read", "." ]
ab1897dea20b16dfd8f0a6349224e94d160a0540
https://github.com/froq/froq-acl/blob/ab1897dea20b16dfd8f0a6349224e94d160a0540/src/User.php#L222-L235
train
froq/froq-acl
src/User.php
User.canWrite
public function canWrite(string $uri): bool { // /book => all if (in_array(Acl::RULE_ALL, (array) $this->getPermissionsOf($this->getUriRoot($uri)))) { return true; } // /book/detail => all or write $permission = array_filter((array) $this->getPermissionsOf($uri),...
php
public function canWrite(string $uri): bool { // /book => all if (in_array(Acl::RULE_ALL, (array) $this->getPermissionsOf($this->getUriRoot($uri)))) { return true; } // /book/detail => all or write $permission = array_filter((array) $this->getPermissionsOf($uri),...
[ "public", "function", "canWrite", "(", "string", "$", "uri", ")", ":", "bool", "{", "// /book => all", "if", "(", "in_array", "(", "Acl", "::", "RULE_ALL", ",", "(", "array", ")", "$", "this", "->", "getPermissionsOf", "(", "$", "this", "->", "getUriRoot...
Can write. @param string $uri @return bool
[ "Can", "write", "." ]
ab1897dea20b16dfd8f0a6349224e94d160a0540
https://github.com/froq/froq-acl/blob/ab1897dea20b16dfd8f0a6349224e94d160a0540/src/User.php#L242-L255
train
froq/froq-acl
src/User.php
User.redirectIf
public function redirectIf(string $dir, string $to = '/', bool $exit = true): void { if ($this->acl != null) { $app = $this->acl->getService()->getApp(); if ($dir == 'in' && $this->isLoggedIn()) { $app->response()->redirect($to); } elseif ($dir == 'out' &&...
php
public function redirectIf(string $dir, string $to = '/', bool $exit = true): void { if ($this->acl != null) { $app = $this->acl->getService()->getApp(); if ($dir == 'in' && $this->isLoggedIn()) { $app->response()->redirect($to); } elseif ($dir == 'out' &&...
[ "public", "function", "redirectIf", "(", "string", "$", "dir", ",", "string", "$", "to", "=", "'/'", ",", "bool", "$", "exit", "=", "true", ")", ":", "void", "{", "if", "(", "$", "this", "->", "acl", "!=", "null", ")", "{", "$", "app", "=", "$"...
Redirect if. @param string $dir In/out direction. @param string $to @param bool $exit @return void
[ "Redirect", "if", "." ]
ab1897dea20b16dfd8f0a6349224e94d160a0540
https://github.com/froq/froq-acl/blob/ab1897dea20b16dfd8f0a6349224e94d160a0540/src/User.php#L264-L284
train
gilbertsoft/typo3-gscacheconfig
Classes/Service/InstallService.php
InstallService.getCleanAdditionalConfiguration
protected function getCleanAdditionalConfiguration($extensionKey) { $newLines = []; // Load content and search for the include if (($content = GeneralUtility::getUrl($this->getConfigurationManager()->getAdditionalConfigurationFileLocation())) !== false) { $currentLines =...
php
protected function getCleanAdditionalConfiguration($extensionKey) { $newLines = []; // Load content and search for the include if (($content = GeneralUtility::getUrl($this->getConfigurationManager()->getAdditionalConfigurationFileLocation())) !== false) { $currentLines =...
[ "protected", "function", "getCleanAdditionalConfiguration", "(", "$", "extensionKey", ")", "{", "$", "newLines", "=", "[", "]", ";", "// Load content and search for the include", "if", "(", "(", "$", "content", "=", "GeneralUtility", "::", "getUrl", "(", "$", "thi...
Returns the lines from AdditionalConfiguration.php file without own additions @param string $extensionKey Extension key
[ "Returns", "the", "lines", "from", "AdditionalConfiguration", ".", "php", "file", "without", "own", "additions" ]
dc6c3131b9e3d714b6c79c802c09ef1d165296d1
https://github.com/gilbertsoft/typo3-gscacheconfig/blob/dc6c3131b9e3d714b6c79c802c09ef1d165296d1/Classes/Service/InstallService.php#L63-L106
train
miknatr/grace-dbal
lib/Grace/SQLBuilder/InsertBuilder.php
InsertBuilder.values
public function values(array $values) { $this->fieldValues = array(); $this->fieldsSql = '?i'; $this->fieldValues[] = array_keys($values); $this->valuesSql = array(); foreach ($values as $v) { if (is_object($v) and $v instanceof SqlValueInterface) { ...
php
public function values(array $values) { $this->fieldValues = array(); $this->fieldsSql = '?i'; $this->fieldValues[] = array_keys($values); $this->valuesSql = array(); foreach ($values as $v) { if (is_object($v) and $v instanceof SqlValueInterface) { ...
[ "public", "function", "values", "(", "array", "$", "values", ")", "{", "$", "this", "->", "fieldValues", "=", "array", "(", ")", ";", "$", "this", "->", "fieldsSql", "=", "'?i'", ";", "$", "this", "->", "fieldValues", "[", "]", "=", "array_keys", "("...
Prepares values for inserting into db @param array $values @return $this
[ "Prepares", "values", "for", "inserting", "into", "db" ]
b05e03040568631dc6c77477c0eaed6e60db4ba2
https://github.com/miknatr/grace-dbal/blob/b05e03040568631dc6c77477c0eaed6e60db4ba2/lib/Grace/SQLBuilder/InsertBuilder.php#L29-L51
train
Subscribo/klarna-invoice-sdk-wrapped
src/pclasses/sqlstorage.class.php
SQLStorage.getConnection
protected function getConnection($uri) { if ($this->pdo) { return; //Already have a connection } $this->splitURI($uri); try { $this->pdo = new PDO($this->dsn, $this->user, $this->passwd); $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_E...
php
protected function getConnection($uri) { if ($this->pdo) { return; //Already have a connection } $this->splitURI($uri); try { $this->pdo = new PDO($this->dsn, $this->user, $this->passwd); $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_E...
[ "protected", "function", "getConnection", "(", "$", "uri", ")", "{", "if", "(", "$", "this", "->", "pdo", ")", "{", "return", ";", "//Already have a connection", "}", "$", "this", "->", "splitURI", "(", "$", "uri", ")", ";", "try", "{", "$", "this", ...
Connects to the DB. @param string|array $uri pclass uri @throws Klarna_DatabaseException If connection could not be established. @deprecated Use the connect method instead. @return void
[ "Connects", "to", "the", "DB", "." ]
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/pclasses/sqlstorage.class.php#L240-L254
train
Subscribo/klarna-invoice-sdk-wrapped
src/pclasses/sqlstorage.class.php
SQLStorage.create
public function create() { try { $this->pdo->exec("CREATE DATABASE `{$this->dbName}`"); } catch (PDOException $e) { //SQLite does not support this... } $sql = <<<SQL CREATE TABLE IF NOT EXISTS `{$this->dbName}`.`{$this->dbTable}` ( ...
php
public function create() { try { $this->pdo->exec("CREATE DATABASE `{$this->dbName}`"); } catch (PDOException $e) { //SQLite does not support this... } $sql = <<<SQL CREATE TABLE IF NOT EXISTS `{$this->dbName}`.`{$this->dbTable}` ( ...
[ "public", "function", "create", "(", ")", "{", "try", "{", "$", "this", "->", "pdo", "->", "exec", "(", "\"CREATE DATABASE `{$this->dbName}`\"", ")", ";", "}", "catch", "(", "PDOException", "$", "e", ")", "{", "//SQLite does not support this...", "}", "$", "...
Attempt to create the database and tables needed to store pclasses. @throws Klarna_DatabaseException If the table could not be created. @return void
[ "Attempt", "to", "create", "the", "database", "and", "tables", "needed", "to", "store", "pclasses", "." ]
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/pclasses/sqlstorage.class.php#L291-L321
train
Subscribo/klarna-invoice-sdk-wrapped
src/pclasses/sqlstorage.class.php
SQLStorage.loadPClasses
protected function loadPClasses() { try { $sth = $this->pdo->prepare( "SELECT * FROM `{$this->dbName}`.`{$this->dbTable}`", array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY) ); $sth->execute(); while ($row = $sth->fetch(PDO::FETCH...
php
protected function loadPClasses() { try { $sth = $this->pdo->prepare( "SELECT * FROM `{$this->dbName}`.`{$this->dbTable}`", array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY) ); $sth->execute(); while ($row = $sth->fetch(PDO::FETCH...
[ "protected", "function", "loadPClasses", "(", ")", "{", "try", "{", "$", "sth", "=", "$", "this", "->", "pdo", "->", "prepare", "(", "\"SELECT * FROM `{$this->dbName}`.`{$this->dbTable}`\"", ",", "array", "(", "PDO", "::", "ATTR_CURSOR", "=>", "PDO", "::", "CU...
Loads the PClasses. @return void @throws KlarnaException
[ "Loads", "the", "PClasses", "." ]
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/pclasses/sqlstorage.class.php#L343-L363
train
Subscribo/klarna-invoice-sdk-wrapped
src/pclasses/sqlstorage.class.php
SQLStorage.clear
public function clear($uri) { try { $this->connect($uri); unset($this->pclasses); $this->clearTable(); } catch(Exception $e) { throw new Klarna_DatabaseException( $e->getMessage(), $e->getCode() ); } }
php
public function clear($uri) { try { $this->connect($uri); unset($this->pclasses); $this->clearTable(); } catch(Exception $e) { throw new Klarna_DatabaseException( $e->getMessage(), $e->getCode() ); } }
[ "public", "function", "clear", "(", "$", "uri", ")", "{", "try", "{", "$", "this", "->", "connect", "(", "$", "uri", ")", ";", "unset", "(", "$", "this", "->", "pclasses", ")", ";", "$", "this", "->", "clearTable", "(", ")", ";", "}", "catch", ...
Drops the database table, to clear the PClasses. @param string|array $uri pclass uri @return void @throws KlarnaException
[ "Drops", "the", "database", "table", "to", "clear", "the", "PClasses", "." ]
4a45ddd9ec444f5a6d02628ad65e635a3e12611c
https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/pclasses/sqlstorage.class.php#L461-L472
train
net-tools/core
src/Formatters/Formatter.php
Formatter.closeRow
public function closeRow($last = false) { $this->_strategy->output($this->endRow() . ($last ? '' : $this->rowSeparator())); }
php
public function closeRow($last = false) { $this->_strategy->output($this->endRow() . ($last ? '' : $this->rowSeparator())); }
[ "public", "function", "closeRow", "(", "$", "last", "=", "false", ")", "{", "$", "this", "->", "_strategy", "->", "output", "(", "$", "this", "->", "endRow", "(", ")", ".", "(", "$", "last", "?", "''", ":", "$", "this", "->", "rowSeparator", "(", ...
End the row @param bool $last Indicates whether this is the last row or not
[ "End", "the", "row" ]
51446641cee22c0cf53d2b409c76cc8bd1a187e7
https://github.com/net-tools/core/blob/51446641cee22c0cf53d2b409c76cc8bd1a187e7/src/Formatters/Formatter.php#L88-L91
train
net-tools/core
src/Formatters/Formatter.php
Formatter.column
public function column($v, $last = false) { $this->_strategy->output($this->beginColumn() . $v . $this->endColumn() . ($last ? '' : $this->columnSeparator())); }
php
public function column($v, $last = false) { $this->_strategy->output($this->beginColumn() . $v . $this->endColumn() . ($last ? '' : $this->columnSeparator())); }
[ "public", "function", "column", "(", "$", "v", ",", "$", "last", "=", "false", ")", "{", "$", "this", "->", "_strategy", "->", "output", "(", "$", "this", "->", "beginColumn", "(", ")", ".", "$", "v", ".", "$", "this", "->", "endColumn", "(", ")"...
Write a column value for the current row @param string $v Value to output @param bool $last Indicates whether this is the last column of the row or not
[ "Write", "a", "column", "value", "for", "the", "current", "row" ]
51446641cee22c0cf53d2b409c76cc8bd1a187e7
https://github.com/net-tools/core/blob/51446641cee22c0cf53d2b409c76cc8bd1a187e7/src/Formatters/Formatter.php#L100-L103
train
net-tools/core
src/Formatters/Formatter.php
Formatter.row
public function row($r, $last = false) { $this->_strategy->output($this->beginRow()); $values = array_values($r); $valuesl = count($values); for ( $i = 0 ; $i < $valuesl ; $i++ ) $this->column($values[$i], $i+1 == $valuesl); $this->_strategy->output($this->endRow() . ($last ? '' : $this->rowSepar...
php
public function row($r, $last = false) { $this->_strategy->output($this->beginRow()); $values = array_values($r); $valuesl = count($values); for ( $i = 0 ; $i < $valuesl ; $i++ ) $this->column($values[$i], $i+1 == $valuesl); $this->_strategy->output($this->endRow() . ($last ? '' : $this->rowSepar...
[ "public", "function", "row", "(", "$", "r", ",", "$", "last", "=", "false", ")", "{", "$", "this", "->", "_strategy", "->", "output", "(", "$", "this", "->", "beginRow", "(", ")", ")", ";", "$", "values", "=", "array_values", "(", "$", "r", ")", ...
Write a row @param string[] $r Array of columns values to output @param bool $last Indicates whether this is the last row or not
[ "Write", "a", "row" ]
51446641cee22c0cf53d2b409c76cc8bd1a187e7
https://github.com/net-tools/core/blob/51446641cee22c0cf53d2b409c76cc8bd1a187e7/src/Formatters/Formatter.php#L113-L124
train
OxfordInfoLabs/kinikit-core
src/Object/DynamicSerialisableObject.php
DynamicSerialisableObject.__getSerialisablePropertyValue
public function __getSerialisablePropertyValue($propertyName) { try { return parent::__getSerialisablePropertyValue($propertyName); } catch (PropertyNotReadableException $e) { if ($this->__strictMode) { throw $e; } else { return nul...
php
public function __getSerialisablePropertyValue($propertyName) { try { return parent::__getSerialisablePropertyValue($propertyName); } catch (PropertyNotReadableException $e) { if ($this->__strictMode) { throw $e; } else { return nul...
[ "public", "function", "__getSerialisablePropertyValue", "(", "$", "propertyName", ")", "{", "try", "{", "return", "parent", "::", "__getSerialisablePropertyValue", "(", "$", "propertyName", ")", ";", "}", "catch", "(", "PropertyNotReadableException", "$", "e", ")", ...
Override the parent get property value method to be a little more tolerant than the parent @param string $propertyName
[ "Override", "the", "parent", "get", "property", "value", "method", "to", "be", "a", "little", "more", "tolerant", "than", "the", "parent" ]
edc1b2e6ffabd595c4c7d322279b3dd1e59ef359
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Object/DynamicSerialisableObject.php#L131-L142
train
OxfordInfoLabs/kinikit-core
src/Object/DynamicSerialisableObject.php
DynamicSerialisableObject.__getSerialisablePropertyMap
public function __getSerialisablePropertyMap() { $serialisableProperties = parent::__getSerialisablePropertyMap(); $dynamicProperties = $this->__dynamicPropertyMap; $map = array(); foreach ($dynamicProperties as $key => $value) { $map[$key] = $value; } f...
php
public function __getSerialisablePropertyMap() { $serialisableProperties = parent::__getSerialisablePropertyMap(); $dynamicProperties = $this->__dynamicPropertyMap; $map = array(); foreach ($dynamicProperties as $key => $value) { $map[$key] = $value; } f...
[ "public", "function", "__getSerialisablePropertyMap", "(", ")", "{", "$", "serialisableProperties", "=", "parent", "::", "__getSerialisablePropertyMap", "(", ")", ";", "$", "dynamicProperties", "=", "$", "this", "->", "__dynamicPropertyMap", ";", "$", "map", "=", ...
Get the array of serialisable properties @return array
[ "Get", "the", "array", "of", "serialisable", "properties" ]
edc1b2e6ffabd595c4c7d322279b3dd1e59ef359
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Object/DynamicSerialisableObject.php#L149-L166
train
OxfordInfoLabs/kinikit-core
src/Object/DynamicSerialisableObject.php
DynamicSerialisableObject.__setSerialisablePropertyMap
public function __setSerialisablePropertyMap($propertyMap, $ignoreNoneWritableProperties = false) { // Always ignore any unknown properties in parent as we need to capture these for dynamic purposes $dynamicProperties = parent::__setSerialisablePropertyMap($propertyMap, true); // If none ...
php
public function __setSerialisablePropertyMap($propertyMap, $ignoreNoneWritableProperties = false) { // Always ignore any unknown properties in parent as we need to capture these for dynamic purposes $dynamicProperties = parent::__setSerialisablePropertyMap($propertyMap, true); // If none ...
[ "public", "function", "__setSerialisablePropertyMap", "(", "$", "propertyMap", ",", "$", "ignoreNoneWritableProperties", "=", "false", ")", "{", "// Always ignore any unknown properties in parent as we need to capture these for dynamic purposes", "$", "dynamicProperties", "=", "par...
Set an array of serialisable properties @param array $propertyMap @param boolean $ignoreNoneWritableProperties @return array
[ "Set", "an", "array", "of", "serialisable", "properties" ]
edc1b2e6ffabd595c4c7d322279b3dd1e59ef359
https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Object/DynamicSerialisableObject.php#L176-L199
train
beMang/phpgone
core/Middlewares/NotFoundMiddleware.php
NotFoundMiddleware.process
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $errorPageConfig = Config::getInstance()->get('errorPage'); $controllerClass = '\\app\\Controllers\\' . $errorPageConfig[0]; $route = new Route('404', $errorPageConfig[0], $errorPa...
php
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $errorPageConfig = Config::getInstance()->get('errorPage'); $controllerClass = '\\app\\Controllers\\' . $errorPageConfig[0]; $route = new Route('404', $errorPageConfig[0], $errorPa...
[ "public", "function", "process", "(", "ServerRequestInterface", "$", "request", ",", "RequestHandlerInterface", "$", "handler", ")", ":", "ResponseInterface", "{", "$", "errorPageConfig", "=", "Config", "::", "getInstance", "(", ")", "->", "get", "(", "'errorPage'...
Process method for NotFoundMiddleware @param ServerRequestInterface $request @param RequestHandlerInterface $handler @return ResponseInterface Réponse 404
[ "Process", "method", "for", "NotFoundMiddleware" ]
6da468283880b7f5b28dc3735f8f13c97382710b
https://github.com/beMang/phpgone/blob/6da468283880b7f5b28dc3735f8f13c97382710b/core/Middlewares/NotFoundMiddleware.php#L36-L51
train
Wedeto/IO
src/FileType.php
FileType.getFromFile
public static function getFromFile($path) { if (!($path instanceof File)) $path = new File($path); $ext = $path->getExtension(); $path = $path->getFullPath(); $type = new FileType($ext ?? "", ""); if (empty($type->getMimeType()) && file_exists($path)) ...
php
public static function getFromFile($path) { if (!($path instanceof File)) $path = new File($path); $ext = $path->getExtension(); $path = $path->getFullPath(); $type = new FileType($ext ?? "", ""); if (empty($type->getMimeType()) && file_exists($path)) ...
[ "public", "static", "function", "getFromFile", "(", "$", "path", ")", "{", "if", "(", "!", "(", "$", "path", "instanceof", "File", ")", ")", "$", "path", "=", "new", "File", "(", "$", "path", ")", ";", "$", "ext", "=", "$", "path", "->", "getExte...
Return the mime type based on a file name @param string $path The path to the file @return FileType The File Type for this file
[ "Return", "the", "mime", "type", "based", "on", "a", "file", "name" ]
4cfeaedd1bd9bda3097d18cb12233a4afecb2e85
https://github.com/Wedeto/IO/blob/4cfeaedd1bd9bda3097d18cb12233a4afecb2e85/src/FileType.php#L114-L127
train
Wedeto/IO
src/FileType.php
FileType.isPlainText
public function isPlainText() { $sc_pos = strpos($this->mime_type, ';'); if ($sc_pos !== false) $mime_type = substr($this->mime_type, 0, $sc_pos); else $mime_type = $this->mime_type; // Some application/* types are plain text switch ($mime_typ...
php
public function isPlainText() { $sc_pos = strpos($this->mime_type, ';'); if ($sc_pos !== false) $mime_type = substr($this->mime_type, 0, $sc_pos); else $mime_type = $this->mime_type; // Some application/* types are plain text switch ($mime_typ...
[ "public", "function", "isPlainText", "(", ")", "{", "$", "sc_pos", "=", "strpos", "(", "$", "this", "->", "mime_type", ",", "';'", ")", ";", "if", "(", "$", "sc_pos", "!==", "false", ")", "$", "mime_type", "=", "substr", "(", "$", "this", "->", "mi...
Check if a mime type is plain text @param string $mime The Mime type @return bool True if the mime type is plaintext, false if it isn't
[ "Check", "if", "a", "mime", "type", "is", "plain", "text" ]
4cfeaedd1bd9bda3097d18cb12233a4afecb2e85
https://github.com/Wedeto/IO/blob/4cfeaedd1bd9bda3097d18cb12233a4afecb2e85/src/FileType.php#L188-L207
train
Wedeto/Util
src/DocComment.php
DocComment.parse
protected function parse() { $lines = explode("\n", $this->comment); $current_annotation = null; $value = null; foreach ($lines as $line) { $line = trim(ltrim($line, "/* \t")); if (preg_match("/^@(\w+)( (.*))?$/", $line, $matches) === 1) ...
php
protected function parse() { $lines = explode("\n", $this->comment); $current_annotation = null; $value = null; foreach ($lines as $line) { $line = trim(ltrim($line, "/* \t")); if (preg_match("/^@(\w+)( (.*))?$/", $line, $matches) === 1) ...
[ "protected", "function", "parse", "(", ")", "{", "$", "lines", "=", "explode", "(", "\"\\n\"", ",", "$", "this", "->", "comment", ")", ";", "$", "current_annotation", "=", "null", ";", "$", "value", "=", "null", ";", "foreach", "(", "$", "lines", "as...
Helper method that parses the doc comment
[ "Helper", "method", "that", "parses", "the", "doc", "comment" ]
0e080251bbaa8e7d91ae8d02eb79c029c976744a
https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DocComment.php#L50-L80
train
Wedeto/Util
src/DocComment.php
DocComment.getAnnotation
public function getAnnotation(string $name, bool $single = true) { $val = $this->annotations[$name] ?? []; return $single ? (count($val) ? reset($val) : null) : $val; }
php
public function getAnnotation(string $name, bool $single = true) { $val = $this->annotations[$name] ?? []; return $single ? (count($val) ? reset($val) : null) : $val; }
[ "public", "function", "getAnnotation", "(", "string", "$", "name", ",", "bool", "$", "single", "=", "true", ")", "{", "$", "val", "=", "$", "this", "->", "annotations", "[", "$", "name", "]", "??", "[", "]", ";", "return", "$", "single", "?", "(", ...
Get an annotated value for the DocComment @param string $name The name of the annotation @param bool $single Return either the first or all values @return string|array The string when single = true, otherwise all annotations. When single is true, and no annotation was found, null is returned.
[ "Get", "an", "annotated", "value", "for", "the", "DocComment" ]
0e080251bbaa8e7d91ae8d02eb79c029c976744a
https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DocComment.php#L90-L94
train
Wedeto/Util
src/DocComment.php
DocComment.getAnnotationTokens
public function getAnnotationTokens(string $name) { $val = $this->getAnnotation($name, true); $val = trim(preg_replace("/\s{1,}/", " ", $val)); return !empty($val) ? explode(" ", $val) : []; }
php
public function getAnnotationTokens(string $name) { $val = $this->getAnnotation($name, true); $val = trim(preg_replace("/\s{1,}/", " ", $val)); return !empty($val) ? explode(" ", $val) : []; }
[ "public", "function", "getAnnotationTokens", "(", "string", "$", "name", ")", "{", "$", "val", "=", "$", "this", "->", "getAnnotation", "(", "$", "name", ",", "true", ")", ";", "$", "val", "=", "trim", "(", "preg_replace", "(", "\"/\\s{1,}/\"", ",", "\...
Get the tokenized annotation - split by whitespace @param string $name The annotation to get the first word from @return array The tokens in the annotation
[ "Get", "the", "tokenized", "annotation", "-", "split", "by", "whitespace" ]
0e080251bbaa8e7d91ae8d02eb79c029c976744a
https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/DocComment.php#L112-L118
train
RocketPropelledTortoise/Core
src/Taxonomy/Repositories/TermRepository.php
TermRepository.cacheTerm
protected function cacheTerm($term_id) { $term = TermContainer::with('translations')->find($term_id); if (!$term || !count($term->translations)) { return false; } $translations = []; foreach ($term->translations as $t) { $translations[$t->language_id...
php
protected function cacheTerm($term_id) { $term = TermContainer::with('translations')->find($term_id); if (!$term || !count($term->translations)) { return false; } $translations = []; foreach ($term->translations as $t) { $translations[$t->language_id...
[ "protected", "function", "cacheTerm", "(", "$", "term_id", ")", "{", "$", "term", "=", "TermContainer", "::", "with", "(", "'translations'", ")", "->", "find", "(", "$", "term_id", ")", ";", "if", "(", "!", "$", "term", "||", "!", "count", "(", "$", ...
Puts the term in the cache and returns it for usage @param int $term_id @return array
[ "Puts", "the", "term", "in", "the", "cache", "and", "returns", "it", "for", "usage" ]
78b65663fc463e21e494257140ddbed0a9ccb3c3
https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Taxonomy/Repositories/TermRepository.php#L76-L120
train