repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
chippyash/Strong-Type
src/Chippyash/Type/Number/Rational/RationalTypeFactory.php
RationalTypeFactory.createFromNumericNumerator
private static function createFromNumericNumerator($numerator, $denominator) { if (is_null($denominator)) { return self::createCorrectRational($numerator, 1); } if (is_numeric($denominator)) { return self::createCorrectRational($numerator, $denominator); } ...
php
private static function createFromNumericNumerator($numerator, $denominator) { if (is_null($denominator)) { return self::createCorrectRational($numerator, 1); } if (is_numeric($denominator)) { return self::createCorrectRational($numerator, $denominator); } ...
[ "private", "static", "function", "createFromNumericNumerator", "(", "$", "numerator", ",", "$", "denominator", ")", "{", "if", "(", "is_null", "(", "$", "denominator", ")", ")", "{", "return", "self", "::", "createCorrectRational", "(", "$", "numerator", ",", ...
Create where numerator is known to be numeric @param mixed $numerator Conforms to is_numeric() @param mixed $denominator @return GMPRationalType|RationalType @throws InvalidTypeException
[ "Create", "where", "numerator", "is", "known", "to", "be", "numeric" ]
train
https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Rational/RationalTypeFactory.php#L219-L234
chippyash/Strong-Type
src/Chippyash/Type/Number/Rational/RationalTypeFactory.php
RationalTypeFactory.throwCreateException
private static function throwCreateException($numerator, $denominator) { $typeN = gettype($numerator); $typeD = gettype($denominator); throw new InvalidTypeException("{$typeN}:{$typeD} for Rational type construction"); }
php
private static function throwCreateException($numerator, $denominator) { $typeN = gettype($numerator); $typeD = gettype($denominator); throw new InvalidTypeException("{$typeN}:{$typeD} for Rational type construction"); }
[ "private", "static", "function", "throwCreateException", "(", "$", "numerator", ",", "$", "denominator", ")", "{", "$", "typeN", "=", "gettype", "(", "$", "numerator", ")", ";", "$", "typeD", "=", "gettype", "(", "$", "denominator", ")", ";", "throw", "n...
Throw a create exception @param $numerator @param $denominator @throws InvalidTypeException
[ "Throw", "a", "create", "exception" ]
train
https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Rational/RationalTypeFactory.php#L271-L276
PandaPlatform/framework
src/Panda/Support/Helpers/DateTimeHelper.php
DateTimeHelper.compareDateWithoutTime
public static function compareDateWithoutTime($date1, $date2) { $date1 = DateTime::createFromFormat('Y-m-d H:i:s', $date1->format('Y-m-d') . ' 00:00:00'); $date2 = DateTime::createFromFormat('Y-m-d H:i:s', $date2->format('Y-m-d') . ' 00:00:00'); if ($date1 == $date2) { return 0; ...
php
public static function compareDateWithoutTime($date1, $date2) { $date1 = DateTime::createFromFormat('Y-m-d H:i:s', $date1->format('Y-m-d') . ' 00:00:00'); $date2 = DateTime::createFromFormat('Y-m-d H:i:s', $date2->format('Y-m-d') . ' 00:00:00'); if ($date1 == $date2) { return 0; ...
[ "public", "static", "function", "compareDateWithoutTime", "(", "$", "date1", ",", "$", "date2", ")", "{", "$", "date1", "=", "DateTime", "::", "createFromFormat", "(", "'Y-m-d H:i:s'", ",", "$", "date1", "->", "format", "(", "'Y-m-d'", ")", ".", "' 00:00:00'...
@param DateTime $date1 @param DateTime $date2 @return int 0=equal -1 date1 is smaller and +1 date1 is greater
[ "@param", "DateTime", "$date1", "@param", "DateTime", "$date2" ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Support/Helpers/DateTimeHelper.php#L29-L41
PandaPlatform/framework
src/Panda/Support/Helpers/DateTimeHelper.php
DateTimeHelper.compareTimeWithoutDate
public static function compareTimeWithoutDate($date1, $date2) { $date1 = DateTime::createFromFormat('Y-m-d H:i:s', '2000-01-01 ' . $date1->format('H:i:s')); $date2 = DateTime::createFromFormat('Y-m-d H:i:s', '2000-01-01 ' . $date2->format('H:i:s')); if ($date1 == $date2) { return...
php
public static function compareTimeWithoutDate($date1, $date2) { $date1 = DateTime::createFromFormat('Y-m-d H:i:s', '2000-01-01 ' . $date1->format('H:i:s')); $date2 = DateTime::createFromFormat('Y-m-d H:i:s', '2000-01-01 ' . $date2->format('H:i:s')); if ($date1 == $date2) { return...
[ "public", "static", "function", "compareTimeWithoutDate", "(", "$", "date1", ",", "$", "date2", ")", "{", "$", "date1", "=", "DateTime", "::", "createFromFormat", "(", "'Y-m-d H:i:s'", ",", "'2000-01-01 '", ".", "$", "date1", "->", "format", "(", "'H:i:s'", ...
@param DateTime $date1 @param DateTime $date2 @return int 0=equal -1 date1 is smaller and +1 date1 is greater
[ "@param", "DateTime", "$date1", "@param", "DateTime", "$date2" ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Support/Helpers/DateTimeHelper.php#L49-L61
PandaPlatform/framework
src/Panda/Support/Helpers/DateTimeHelper.php
DateTimeHelper.compareDateWithHourMinuteSecond
public static function compareDateWithHourMinuteSecond($date, $hour, $minute, $second = 0) { $date1 = DateTime::createFromFormat('Y-m-d H:i:s', sprintf('2000-01-01 %02d:%02d:%02d', $hour, $minute, $second)); return self::compareTimeWithoutDate($date, $date1); }
php
public static function compareDateWithHourMinuteSecond($date, $hour, $minute, $second = 0) { $date1 = DateTime::createFromFormat('Y-m-d H:i:s', sprintf('2000-01-01 %02d:%02d:%02d', $hour, $minute, $second)); return self::compareTimeWithoutDate($date, $date1); }
[ "public", "static", "function", "compareDateWithHourMinuteSecond", "(", "$", "date", ",", "$", "hour", ",", "$", "minute", ",", "$", "second", "=", "0", ")", "{", "$", "date1", "=", "DateTime", "::", "createFromFormat", "(", "'Y-m-d H:i:s'", ",", "sprintf", ...
@param DateTime $date @param int $hour @param int $minute @param int $second @return int
[ "@param", "DateTime", "$date", "@param", "int", "$hour", "@param", "int", "$minute", "@param", "int", "$second" ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Support/Helpers/DateTimeHelper.php#L71-L76
PandaPlatform/framework
src/Panda/Support/Helpers/DateTimeHelper.php
DateTimeHelper.getWorkingDaysCount
public static function getWorkingDaysCount($beginDate, $endDate, $nonWorkingDays = []) { $workdays = 0; if (!is_null($beginDate) && !is_null($endDate)) { if ($beginDate > $endDate) { $temp = $beginDate; $beginDate = $endDate; $endDate = $te...
php
public static function getWorkingDaysCount($beginDate, $endDate, $nonWorkingDays = []) { $workdays = 0; if (!is_null($beginDate) && !is_null($endDate)) { if ($beginDate > $endDate) { $temp = $beginDate; $beginDate = $endDate; $endDate = $te...
[ "public", "static", "function", "getWorkingDaysCount", "(", "$", "beginDate", ",", "$", "endDate", ",", "$", "nonWorkingDays", "=", "[", "]", ")", "{", "$", "workdays", "=", "0", ";", "if", "(", "!", "is_null", "(", "$", "beginDate", ")", "&&", "!", ...
Count working days between the two given dates. The comparison includes both begin and end dates. @param DateTime $beginDate @param DateTime $endDate @param int[] $nonWorkingDays array containing the non working days (i.e. [6,7] for Saturday and Sunday) @return int Number of working days
[ "Count", "working", "days", "between", "the", "two", "given", "dates", ".", "The", "comparison", "includes", "both", "begin", "and", "end", "dates", "." ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Support/Helpers/DateTimeHelper.php#L88-L109
PandaPlatform/framework
src/Panda/Support/Helpers/DateTimeHelper.php
DateTimeHelper.getMinutesCount
public static function getMinutesCount($beginDate, $endDate) { // Get date diff $diff = $endDate->diff($beginDate); // Calculate all minutes $minutes = $diff->days * 24 * 60; $minutes += $diff->h * 60; $minutes += $diff->i; return $minutes; }
php
public static function getMinutesCount($beginDate, $endDate) { // Get date diff $diff = $endDate->diff($beginDate); // Calculate all minutes $minutes = $diff->days * 24 * 60; $minutes += $diff->h * 60; $minutes += $diff->i; return $minutes; }
[ "public", "static", "function", "getMinutesCount", "(", "$", "beginDate", ",", "$", "endDate", ")", "{", "// Get date diff", "$", "diff", "=", "$", "endDate", "->", "diff", "(", "$", "beginDate", ")", ";", "// Calculate all minutes", "$", "minutes", "=", "$"...
@param DateTime $beginDate @param DateTime $endDate @return int
[ "@param", "DateTime", "$beginDate", "@param", "DateTime", "$endDate" ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Support/Helpers/DateTimeHelper.php#L117-L128
PandaPlatform/framework
src/Panda/Support/Helpers/DateTimeHelper.php
DateTimeHelper.getSecondsCount
public static function getSecondsCount($beginDate, $endDate) { // Get minutes count $minutes = static::getMinutesCount($beginDate, $endDate); // Get seconds $diff = $endDate->diff($beginDate); $seconds = $diff->s; // Return all seconds return $seconds + $min...
php
public static function getSecondsCount($beginDate, $endDate) { // Get minutes count $minutes = static::getMinutesCount($beginDate, $endDate); // Get seconds $diff = $endDate->diff($beginDate); $seconds = $diff->s; // Return all seconds return $seconds + $min...
[ "public", "static", "function", "getSecondsCount", "(", "$", "beginDate", ",", "$", "endDate", ")", "{", "// Get minutes count", "$", "minutes", "=", "static", "::", "getMinutesCount", "(", "$", "beginDate", ",", "$", "endDate", ")", ";", "// Get seconds", "$"...
@param DateTime $beginDate @param DateTime $endDate @return int
[ "@param", "DateTime", "$beginDate", "@param", "DateTime", "$endDate" ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Support/Helpers/DateTimeHelper.php#L136-L147
PandaPlatform/framework
src/Panda/Support/Helpers/DateTimeHelper.php
DateTimeHelper.getAverageTimeForArrayOfDateTimes
public static function getAverageTimeForArrayOfDateTimes($array) { if (!is_array($array)) { return false; } $averageTime = null; $averageSecondsFromDateBeginSum = 0; $processedItemsCounter = 0; foreach ($array as $datetime) { if (!is_object(...
php
public static function getAverageTimeForArrayOfDateTimes($array) { if (!is_array($array)) { return false; } $averageTime = null; $averageSecondsFromDateBeginSum = 0; $processedItemsCounter = 0; foreach ($array as $datetime) { if (!is_object(...
[ "public", "static", "function", "getAverageTimeForArrayOfDateTimes", "(", "$", "array", ")", "{", "if", "(", "!", "is_array", "(", "$", "array", ")", ")", "{", "return", "false", ";", "}", "$", "averageTime", "=", "null", ";", "$", "averageSecondsFromDateBeg...
Method find the average time for given array of datetime objects it ignores any non DateTIme values in the given array @param DateTime[] $array @return string|bool
[ "Method", "find", "the", "average", "time", "for", "given", "array", "of", "datetime", "objects", "it", "ignores", "any", "non", "DateTIme", "values", "in", "the", "given", "array" ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Support/Helpers/DateTimeHelper.php#L157-L184
mybb/standards
MyBB2/Sniffs/Naming/TraitConventionSniff.php
MyBB2_Sniffs_Naming_TraitConventionSniff.process
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $className = $phpcsFile->findNext(T_STRING, $stackPtr); $name = trim($tokens[$className]['content']); $errorData = array(ucfirst($tokens[$stackPtr]['content'])); $endsWithInterface = substr($name, -...
php
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $className = $phpcsFile->findNext(T_STRING, $stackPtr); $name = trim($tokens[$className]['content']); $errorData = array(ucfirst($tokens[$stackPtr]['content'])); $endsWithInterface = substr($name, -...
[ "public", "function", "process", "(", "PHP_CodeSniffer_File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "className", "=", "$", "phpcsFile", "->", "findNext", "(", "T_STRIN...
Processes this test, when one of its tokens is encountered. @param PHP_CodeSniffer_File $phpcsFile The current file being processed. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/mybb/standards/blob/78beaef4c8940f251bc62fdb7998566fe3a20be0/MyBB2/Sniffs/Naming/TraitConventionSniff.php#L36-L55
myzero1/yii2-theme-layui
src/Module.php
Module.init
public function init() { parent::init(); // custom initialization code goes here // $this->defaultRoute ='index'; $this->layoutPath = \Yii::getAlias('@vendor/myzero1/yii2-theme-layui/src/views/layouts'); $this->assetManager->forceCopy = true; $moduleId = \Yii::$ap...
php
public function init() { parent::init(); // custom initialization code goes here // $this->defaultRoute ='index'; $this->layoutPath = \Yii::getAlias('@vendor/myzero1/yii2-theme-layui/src/views/layouts'); $this->assetManager->forceCopy = true; $moduleId = \Yii::$ap...
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "// custom initialization code goes here", "// $this->defaultRoute ='index';", "$", "this", "->", "layoutPath", "=", "\\", "Yii", "::", "getAlias", "(", "'@vendor/myzero1/yii2-theme-la...
{@inheritdoc}
[ "{" ]
train
https://github.com/myzero1/yii2-theme-layui/blob/47e4796b35b8354e50359a489499ee598edd68e1/src/Module.php#L20-L189
Webiny/AnalyticsDb
src/Webiny/AnalyticsDb/Query/AbstractQuery.php
AbstractQuery.limit
public function limit($limit, $skip = null) { $this->pipeline['$limit'] = $limit; if (!empty($skip)) { $this->pipeline['$skip'] = $skip; } return $this; }
php
public function limit($limit, $skip = null) { $this->pipeline['$limit'] = $limit; if (!empty($skip)) { $this->pipeline['$skip'] = $skip; } return $this; }
[ "public", "function", "limit", "(", "$", "limit", ",", "$", "skip", "=", "null", ")", "{", "$", "this", "->", "pipeline", "[", "'$limit'", "]", "=", "$", "limit", ";", "if", "(", "!", "empty", "(", "$", "skip", ")", ")", "{", "$", "this", "->",...
Set the result limit and offset. @param int $limit How many results to return. @param int|null $skip How many results to skip. @return $this
[ "Set", "the", "result", "limit", "and", "offset", "." ]
train
https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query/AbstractQuery.php#L91-L99
Webiny/AnalyticsDb
src/Webiny/AnalyticsDb/Query/AbstractQuery.php
AbstractQuery.getResult
public function getResult() { $result = $this->mongo->aggregate($this->getCollectionName(), $this->getPipeline()); return $result->toArray(); }
php
public function getResult() { $result = $this->mongo->aggregate($this->getCollectionName(), $this->getPipeline()); return $result->toArray(); }
[ "public", "function", "getResult", "(", ")", "{", "$", "result", "=", "$", "this", "->", "mongo", "->", "aggregate", "(", "$", "this", "->", "getCollectionName", "(", ")", ",", "$", "this", "->", "getPipeline", "(", ")", ")", ";", "return", "$", "res...
This method does your query lookup and returns the result in form of an array. In case if there are no records to return, false is returned. @return bool
[ "This", "method", "does", "your", "query", "lookup", "and", "returns", "the", "result", "in", "form", "of", "an", "array", ".", "In", "case", "if", "there", "are", "no", "records", "to", "return", "false", "is", "returned", "." ]
train
https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query/AbstractQuery.php#L117-L121
Webiny/AnalyticsDb
src/Webiny/AnalyticsDb/Query/AbstractQuery.php
AbstractQuery.sortByTimestamp
public function sortByTimestamp($direction) { if ($this->id != '$ts') { throw new AnalyticsDbException('In order to sort by timestamp, you need to first group by timestamp.'); } $direction = (int)$direction; $this->pipeline['$sort'] = ['_id' => $direction]; retu...
php
public function sortByTimestamp($direction) { if ($this->id != '$ts') { throw new AnalyticsDbException('In order to sort by timestamp, you need to first group by timestamp.'); } $direction = (int)$direction; $this->pipeline['$sort'] = ['_id' => $direction]; retu...
[ "public", "function", "sortByTimestamp", "(", "$", "direction", ")", "{", "if", "(", "$", "this", "->", "id", "!=", "'$ts'", ")", "{", "throw", "new", "AnalyticsDbException", "(", "'In order to sort by timestamp, you need to first group by timestamp.'", ")", ";", "}...
Sorts the result by timestamp. @param string $direction Mongo sort direction: 1 => ascending; -1 => descending @return $this @throws AnalyticsDbException
[ "Sorts", "the", "result", "by", "timestamp", "." ]
train
https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query/AbstractQuery.php#L131-L141
Webiny/AnalyticsDb
src/Webiny/AnalyticsDb/Query/AbstractQuery.php
AbstractQuery.sortByEntityName
public function sortByEntityName($direction) { if ($this->id != '$entity') { throw new AnalyticsDbException('In order to sort by entity name, you need to first group by entity name.'); } $direction = (int)$direction; $this->pipeline['$sort'] = ['_id' => $direction]; ...
php
public function sortByEntityName($direction) { if ($this->id != '$entity') { throw new AnalyticsDbException('In order to sort by entity name, you need to first group by entity name.'); } $direction = (int)$direction; $this->pipeline['$sort'] = ['_id' => $direction]; ...
[ "public", "function", "sortByEntityName", "(", "$", "direction", ")", "{", "if", "(", "$", "this", "->", "id", "!=", "'$entity'", ")", "{", "throw", "new", "AnalyticsDbException", "(", "'In order to sort by entity name, you need to first group by entity name.'", ")", ...
Sorts the result by entity name. @param string $direction Mongo sort direction: 1 => ascending; -1 => descending @return $this @throws AnalyticsDbException
[ "Sorts", "the", "result", "by", "entity", "name", "." ]
train
https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query/AbstractQuery.php#L166-L176
Webiny/AnalyticsDb
src/Webiny/AnalyticsDb/Query/AbstractQuery.php
AbstractQuery.sortByRef
public function sortByRef($direction) { if ($this->id != '$ref') { throw new AnalyticsDbException('In order to sort by ref, you need to first group by ref.'); } $direction = (int)$direction; $this->pipeline['$sort'] = ['_id' => $direction]; return $this; }
php
public function sortByRef($direction) { if ($this->id != '$ref') { throw new AnalyticsDbException('In order to sort by ref, you need to first group by ref.'); } $direction = (int)$direction; $this->pipeline['$sort'] = ['_id' => $direction]; return $this; }
[ "public", "function", "sortByRef", "(", "$", "direction", ")", "{", "if", "(", "$", "this", "->", "id", "!=", "'$ref'", ")", "{", "throw", "new", "AnalyticsDbException", "(", "'In order to sort by ref, you need to first group by ref.'", ")", ";", "}", "$", "dire...
Sorts the result by referrer value. @param string $direction Mongo sort direction: 1 => ascending; -1 => descending @return $this @throws AnalyticsDbException
[ "Sorts", "the", "result", "by", "referrer", "value", "." ]
train
https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query/AbstractQuery.php#L186-L196
Webiny/AnalyticsDb
src/Webiny/AnalyticsDb/Query/AbstractQuery.php
AbstractQuery.getPipeline
public function getPipeline() { $pipeline = []; foreach ($this->pipeline as $k => $v) { $pipeline[] = [$k => $v]; } return $pipeline; }
php
public function getPipeline() { $pipeline = []; foreach ($this->pipeline as $k => $v) { $pipeline[] = [$k => $v]; } return $pipeline; }
[ "public", "function", "getPipeline", "(", ")", "{", "$", "pipeline", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "pipeline", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "pipeline", "[", "]", "=", "[", "$", "k", "=>", "$", "v", "...
Returns the pipeline array. @return array
[ "Returns", "the", "pipeline", "array", "." ]
train
https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query/AbstractQuery.php#L262-L270
wpup/digster
src/engines/class-engine.php
Engine.config
public function config( $key, $value = null ) { if ( is_array( $key ) ) { foreach ( $key as $id => $val ) { $this->config( $id, $val ); } } else { if ( ! is_null( $value ) ) { return $this->bind( $key, $value ); } if ( $this->bound( $key ) ) { return $this->make( $key ); } else { ...
php
public function config( $key, $value = null ) { if ( is_array( $key ) ) { foreach ( $key as $id => $val ) { $this->config( $id, $val ); } } else { if ( ! is_null( $value ) ) { return $this->bind( $key, $value ); } if ( $this->bound( $key ) ) { return $this->make( $key ); } else { ...
[ "public", "function", "config", "(", "$", "key", ",", "$", "value", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "key", ")", ")", "{", "foreach", "(", "$", "key", "as", "$", "id", "=>", "$", "val", ")", "{", "$", "this", "->", "con...
Get or set configuration values. @param array|string $key @param mixed $value @return mixed
[ "Get", "or", "set", "configuration", "values", "." ]
train
https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/engines/class-engine.php#L24-L41
wpup/digster
src/engines/class-engine.php
Engine.get_engine_config
protected function get_engine_config() { $config = $this->prepare_engine_config(); $locations = $config['locations']; unset( $config['locations'] ); $locations = array_filter( (array) $locations, function ( $location ) { return file_exists( $location ); } ); return [$locations, $config]; }
php
protected function get_engine_config() { $config = $this->prepare_engine_config(); $locations = $config['locations']; unset( $config['locations'] ); $locations = array_filter( (array) $locations, function ( $location ) { return file_exists( $location ); } ); return [$locations, $config]; }
[ "protected", "function", "get_engine_config", "(", ")", "{", "$", "config", "=", "$", "this", "->", "prepare_engine_config", "(", ")", ";", "$", "locations", "=", "$", "config", "[", "'locations'", "]", ";", "unset", "(", "$", "config", "[", "'locations'",...
Get engine config. @return array
[ "Get", "engine", "config", "." ]
train
https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/engines/class-engine.php#L70-L81
wpup/digster
src/engines/class-engine.php
Engine.prepare_config
protected function prepare_config( $arr ) { $result = []; if ( ! is_array( $arr ) ) { return $result; } $arr = array_merge( $this->get_default_config(), $arr ); foreach ( $arr as $key => $value ) { $res = $this->config( $key ); $result[$key] = is_null( $res ) ? $value : $res; } retur...
php
protected function prepare_config( $arr ) { $result = []; if ( ! is_array( $arr ) ) { return $result; } $arr = array_merge( $this->get_default_config(), $arr ); foreach ( $arr as $key => $value ) { $res = $this->config( $key ); $result[$key] = is_null( $res ) ? $value : $res; } retur...
[ "protected", "function", "prepare_config", "(", "$", "arr", ")", "{", "$", "result", "=", "[", "]", ";", "if", "(", "!", "is_array", "(", "$", "arr", ")", ")", "{", "return", "$", "result", ";", "}", "$", "arr", "=", "array_merge", "(", "$", "thi...
Prepare the template engines real configuration. @param array $arr @return array
[ "Prepare", "the", "template", "engines", "real", "configuration", "." ]
train
https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/engines/class-engine.php#L90-L105
eddiejaoude/zf2-logger
src/Zf2Logger/Log/Logger.php
Logger.log
final public function log($priority, $message, $extra = array()) { $customExtra = array( 'Zf2Logger' => array( 'sessionId' => session_id(), 'host' => !empty($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'CLI', 'ip' => !empty($_SERVER...
php
final public function log($priority, $message, $extra = array()) { $customExtra = array( 'Zf2Logger' => array( 'sessionId' => session_id(), 'host' => !empty($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'CLI', 'ip' => !empty($_SERVER...
[ "final", "public", "function", "log", "(", "$", "priority", ",", "$", "message", ",", "$", "extra", "=", "array", "(", ")", ")", "{", "$", "customExtra", "=", "array", "(", "'Zf2Logger'", "=>", "array", "(", "'sessionId'", "=>", "session_id", "(", ")",...
@param int $priority @param mixed $message @param array $extra @return ZendLogger
[ "@param", "int", "$priority", "@param", "mixed", "$message", "@param", "array", "$extra" ]
train
https://github.com/eddiejaoude/zf2-logger/blob/8c7ae273e41e851fe2d525051206541cb1bf6b60/src/Zf2Logger/Log/Logger.php#L37-L48
markwatkinson/luminous
src/Luminous/Formatters/Formatter.php
Formatter.wrapLine
protected static function wrapLine(&$line, $wrapLength) { // The vast majority of lines will not need wrapping so it pays to // check this first. if ($wrapLength <= 0 || !isset($line[$wrapLength]) || strlen(strip_tags($line)) < $wrapLength) { $line .= "\n"; return 1; ...
php
protected static function wrapLine(&$line, $wrapLength) { // The vast majority of lines will not need wrapping so it pays to // check this first. if ($wrapLength <= 0 || !isset($line[$wrapLength]) || strlen(strip_tags($line)) < $wrapLength) { $line .= "\n"; return 1; ...
[ "protected", "static", "function", "wrapLine", "(", "&", "$", "line", ",", "$", "wrapLength", ")", "{", "// The vast majority of lines will not need wrapping so it pays to", "// check this first.", "if", "(", "$", "wrapLength", "<=", "0", "||", "!", "isset", "(", "$...
@internal Handles line wrapping. @param line the line which needs to be broken. This is a reference, which will be operated upon. After calling, $line will have appropriate line breaks to wrap to the given width, and will contain at least one line break at the end. @param wrap_length the width to wrap to. @return the ...
[ "@internal", "Handles", "line", "wrapping", ".", "@param", "line", "the", "line", "which", "needs", "to", "be", "broken", ".", "This", "is", "a", "reference", "which", "will", "be", "operated", "upon", ".", "After", "calling", "$line", "will", "have", "app...
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Formatters/Formatter.php#L110-L192
vi-kon/laravel-parser
src/ViKon/Parser/rule/AbstractBlockRule.php
AbstractBlockRule.embedInto
public function embedInto($ruleNameName, Lexer $lexer) { if (is_array($this->entryPattern)) { foreach ($this->entryPattern as $entryPattern) { $lexer->addEntryPattern($entryPattern, $ruleNameName, $this->name); } } else { $lexer->addEntryPattern($this-...
php
public function embedInto($ruleNameName, Lexer $lexer) { if (is_array($this->entryPattern)) { foreach ($this->entryPattern as $entryPattern) { $lexer->addEntryPattern($entryPattern, $ruleNameName, $this->name); } } else { $lexer->addEntryPattern($this-...
[ "public", "function", "embedInto", "(", "$", "ruleNameName", ",", "Lexer", "$", "lexer", ")", "{", "if", "(", "is_array", "(", "$", "this", "->", "entryPattern", ")", ")", "{", "foreach", "(", "$", "this", "->", "entryPattern", "as", "$", "entryPattern",...
Embed rule into parent rule @param string $ruleNameName parent rule name @param \ViKon\Parser\Lexer\Lexer $lexer lexer instance @return $this
[ "Embed", "rule", "into", "parent", "rule" ]
train
https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/rule/AbstractBlockRule.php#L47-L57
vi-kon/laravel-parser
src/ViKon/Parser/rule/AbstractBlockRule.php
AbstractBlockRule.finish
public function finish(Lexer $lexer) { if (is_array($this->exitPattern)) { foreach ($this->exitPattern as $exitPattern) { $lexer->addExitPattern($exitPattern, $this->name); } } else { $lexer->addExitPattern($this->exitPattern, $this->name); } ...
php
public function finish(Lexer $lexer) { if (is_array($this->exitPattern)) { foreach ($this->exitPattern as $exitPattern) { $lexer->addExitPattern($exitPattern, $this->name); } } else { $lexer->addExitPattern($this->exitPattern, $this->name); } ...
[ "public", "function", "finish", "(", "Lexer", "$", "lexer", ")", "{", "if", "(", "is_array", "(", "$", "this", "->", "exitPattern", ")", ")", "{", "foreach", "(", "$", "this", "->", "exitPattern", "as", "$", "exitPattern", ")", "{", "$", "lexer", "->...
Finish rule after connecting @param \ViKon\Parser\Lexer\Lexer $lexer lexer instance @return $this
[ "Finish", "rule", "after", "connecting" ]
train
https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/rule/AbstractBlockRule.php#L66-L76
vi-kon/laravel-parser
src/ViKon/Parser/rule/AbstractBlockRule.php
AbstractBlockRule.parseToken
public function parseToken($content, $position, $state, TokenList $tokenList) { switch ($state) { case Lexer::STATE_ENTER: $this->handleEntryState($content, $position, $tokenList); break; case Lexer::STATE_UNMATCHED: $this->handleUnmatched...
php
public function parseToken($content, $position, $state, TokenList $tokenList) { switch ($state) { case Lexer::STATE_ENTER: $this->handleEntryState($content, $position, $tokenList); break; case Lexer::STATE_UNMATCHED: $this->handleUnmatched...
[ "public", "function", "parseToken", "(", "$", "content", ",", "$", "position", ",", "$", "state", ",", "TokenList", "$", "tokenList", ")", "{", "switch", "(", "$", "state", ")", "{", "case", "Lexer", "::", "STATE_ENTER", ":", "$", "this", "->", "handle...
Parse token @param string $content matched token string @param int $position matched token position @param int $state matched state @param \ViKon\Parser\TokenList $tokenList token list @throws \ViKon\Parser\Rule\RuleException
[ "Parse", "token" ]
train
https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/rule/AbstractBlockRule.php#L88-L110
vi-kon/laravel-parser
src/ViKon/Parser/rule/AbstractBlockRule.php
AbstractBlockRule.handleEntryState
protected function handleEntryState($content, $position, TokenList $tokenList) { $tokenList->addToken($this->name . self::OPEN, $position); }
php
protected function handleEntryState($content, $position, TokenList $tokenList) { $tokenList->addToken($this->name . self::OPEN, $position); }
[ "protected", "function", "handleEntryState", "(", "$", "content", ",", "$", "position", ",", "TokenList", "$", "tokenList", ")", "{", "$", "tokenList", "->", "addToken", "(", "$", "this", "->", "name", ".", "self", "::", "OPEN", ",", "$", "position", ")"...
Handle lexers entry state @param string $content @param int $position @param \ViKon\Parser\TokenList $tokenList
[ "Handle", "lexers", "entry", "state" ]
train
https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/rule/AbstractBlockRule.php#L119-L121
vi-kon/laravel-parser
src/ViKon/Parser/rule/AbstractBlockRule.php
AbstractBlockRule.handleUnmatchedState
protected function handleUnmatchedState($content, $position, TokenList $tokenList) { if (empty($content)) { return; } $contentTokenList = $this->parseContent($content); $startRule = $this->set->getStartRule(); for ($i = 0; $i < count($contentTokenList); $i++) { ...
php
protected function handleUnmatchedState($content, $position, TokenList $tokenList) { if (empty($content)) { return; } $contentTokenList = $this->parseContent($content); $startRule = $this->set->getStartRule(); for ($i = 0; $i < count($contentTokenList); $i++) { ...
[ "protected", "function", "handleUnmatchedState", "(", "$", "content", ",", "$", "position", ",", "TokenList", "$", "tokenList", ")", "{", "if", "(", "empty", "(", "$", "content", ")", ")", "{", "return", ";", "}", "$", "contentTokenList", "=", "$", "this...
Handle lexers unmatched state @param string $content @param int $position @param \ViKon\Parser\TokenList $tokenList
[ "Handle", "lexers", "unmatched", "state" ]
train
https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/rule/AbstractBlockRule.php#L130-L150
vi-kon/laravel-parser
src/ViKon/Parser/rule/AbstractBlockRule.php
AbstractBlockRule.handleEndState
protected function handleEndState($content, $position, TokenList $tokenList) { if (!empty($content)) { $tokenList->addToken($this->name, $position) ->set('content', $content); } }
php
protected function handleEndState($content, $position, TokenList $tokenList) { if (!empty($content)) { $tokenList->addToken($this->name, $position) ->set('content', $content); } }
[ "protected", "function", "handleEndState", "(", "$", "content", ",", "$", "position", ",", "TokenList", "$", "tokenList", ")", "{", "if", "(", "!", "empty", "(", "$", "content", ")", ")", "{", "$", "tokenList", "->", "addToken", "(", "$", "this", "->",...
Handle lexers end state @param string $content @param int $position @param \ViKon\Parser\TokenList $tokenList
[ "Handle", "lexers", "end", "state" ]
train
https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/rule/AbstractBlockRule.php#L170-L175
eddiriarte/console-select
src/Providers/SelectServiceProvider.php
SelectServiceProvider.boot
public function boot() { /* * Returns a select builder. * * @param string $message * @param array $options * @param bool $allowMultiple * * @return array */ Command::macro( 'select', function (string $...
php
public function boot() { /* * Returns a select builder. * * @param string $message * @param array $options * @param bool $allowMultiple * * @return array */ Command::macro( 'select', function (string $...
[ "public", "function", "boot", "(", ")", "{", "/*\n * Returns a select builder.\n *\n * @param string $message\n * @param array $options\n * @param bool $allowMultiple\n *\n * @return array\n */", "Command", "::", "macro", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/eddiriarte/console-select/blob/76a6818c128571dfed8f0546a6ac5dd15e64f1ad/src/Providers/SelectServiceProvider.php#L21-L41
terdia/legato-framework
src/Security/Encryption.php
Encryption.valid
public static function valid($key, $cipher) { $keyLength = mb_strlen($key, '8bit'); if (static::SUPPORTED_CIPHER_32_LENGTH === $keyLength && $cipher === static::SUPPORTED_CIPHER_32) { return true; } if (static::SUPPORTED_CIPHER_16_LENGTH == $keyLength ...
php
public static function valid($key, $cipher) { $keyLength = mb_strlen($key, '8bit'); if (static::SUPPORTED_CIPHER_32_LENGTH === $keyLength && $cipher === static::SUPPORTED_CIPHER_32) { return true; } if (static::SUPPORTED_CIPHER_16_LENGTH == $keyLength ...
[ "public", "static", "function", "valid", "(", "$", "key", ",", "$", "cipher", ")", "{", "$", "keyLength", "=", "mb_strlen", "(", "$", "key", ",", "'8bit'", ")", ";", "if", "(", "static", "::", "SUPPORTED_CIPHER_32_LENGTH", "===", "$", "keyLength", "&&", ...
Check if the given key and cipher have valid length and name. @param $key @param $cipher @return bool
[ "Check", "if", "the", "given", "key", "and", "cipher", "have", "valid", "length", "and", "name", "." ]
train
https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Security/Encryption.php#L59-L74
terdia/legato-framework
src/Security/Encryption.php
Encryption.generateEncryptionKey
public static function generateEncryptionKey($cipher) { if ($cipher === static::SUPPORTED_CIPHER_32) { return random_bytes(static::SUPPORTED_CIPHER_32_LENGTH); } if ($cipher === static::SUPPORTED_CIPHER_16) { return random_bytes(static::SUPPORTED_CIPHER_16_LENGTH); ...
php
public static function generateEncryptionKey($cipher) { if ($cipher === static::SUPPORTED_CIPHER_32) { return random_bytes(static::SUPPORTED_CIPHER_32_LENGTH); } if ($cipher === static::SUPPORTED_CIPHER_16) { return random_bytes(static::SUPPORTED_CIPHER_16_LENGTH); ...
[ "public", "static", "function", "generateEncryptionKey", "(", "$", "cipher", ")", "{", "if", "(", "$", "cipher", "===", "static", "::", "SUPPORTED_CIPHER_32", ")", "{", "return", "random_bytes", "(", "static", "::", "SUPPORTED_CIPHER_32_LENGTH", ")", ";", "}", ...
Generate encryption key. @param $cipher @throws \Exception @return string
[ "Generate", "encryption", "key", "." ]
train
https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Security/Encryption.php#L85-L94
terdia/legato-framework
src/Security/Encryption.php
Encryption.encrypt
public function encrypt($value) { /** * Gets the cipher iv length. */ $iv = random_bytes(openssl_cipher_iv_length($this->cipher)); /** * Encrypts the given value. */ $value = \openssl_encrypt($value, $this->cipher, $this->key, 0, $iv); $h...
php
public function encrypt($value) { /** * Gets the cipher iv length. */ $iv = random_bytes(openssl_cipher_iv_length($this->cipher)); /** * Encrypts the given value. */ $value = \openssl_encrypt($value, $this->cipher, $this->key, 0, $iv); $h...
[ "public", "function", "encrypt", "(", "$", "value", ")", "{", "/**\n * Gets the cipher iv length.\n */", "$", "iv", "=", "random_bytes", "(", "openssl_cipher_iv_length", "(", "$", "this", "->", "cipher", ")", ")", ";", "/**\n * Encrypts the given...
Encrypt the value. @param $value @throws Exception @return string
[ "Encrypt", "the", "value", "." ]
train
https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Security/Encryption.php#L105-L130
terdia/legato-framework
src/Security/Encryption.php
Encryption.decrypt
public function decrypt($data) { $data = json_decode(base64_decode($data), true); $iv = base64_decode($data['iv']); if (!$this->isEncryptedDataValid($data)) { throw new Exception('The given encrypted data is invalid.'); } if (!$this->isMacValid($data, 16)) { ...
php
public function decrypt($data) { $data = json_decode(base64_decode($data), true); $iv = base64_decode($data['iv']); if (!$this->isEncryptedDataValid($data)) { throw new Exception('The given encrypted data is invalid.'); } if (!$this->isMacValid($data, 16)) { ...
[ "public", "function", "decrypt", "(", "$", "data", ")", "{", "$", "data", "=", "json_decode", "(", "base64_decode", "(", "$", "data", ")", ",", "true", ")", ";", "$", "iv", "=", "base64_decode", "(", "$", "data", "[", "'iv'", "]", ")", ";", "if", ...
Decrypt the given data and return plain text. @param $data @throws Exception @return string
[ "Decrypt", "the", "given", "data", "and", "return", "plain", "text", "." ]
train
https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Security/Encryption.php#L141-L168
terdia/legato-framework
src/Security/Encryption.php
Encryption.isMacValid
protected function isMacValid($data, $bytes) { $calculated = hash_hmac( 'sha384', $this->mac($data['iv'], $data['value']), $bytes, true ); return hash_equals( hash_hmac('sha384', $data['hash_mac'], $bytes, true), $calculated ); }
php
protected function isMacValid($data, $bytes) { $calculated = hash_hmac( 'sha384', $this->mac($data['iv'], $data['value']), $bytes, true ); return hash_equals( hash_hmac('sha384', $data['hash_mac'], $bytes, true), $calculated ); }
[ "protected", "function", "isMacValid", "(", "$", "data", ",", "$", "bytes", ")", "{", "$", "calculated", "=", "hash_hmac", "(", "'sha384'", ",", "$", "this", "->", "mac", "(", "$", "data", "[", "'iv'", "]", ",", "$", "data", "[", "'value'", "]", ")...
Determine if hash is valid. @param $data @param $bytes @return bool
[ "Determine", "if", "hash", "is", "valid", "." ]
train
https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Security/Encryption.php#L192-L201
liuguangw/mvc
src/services/AbstractFileAdapter.php
AbstractFileAdapter.getObjectName
protected function getObjectName(string $savePath): string { $pathPrefix = $this->getPathPrefix(); if ($pathPrefix != '') { return $pathPrefix . '/' . $savePath; } return $savePath; }
php
protected function getObjectName(string $savePath): string { $pathPrefix = $this->getPathPrefix(); if ($pathPrefix != '') { return $pathPrefix . '/' . $savePath; } return $savePath; }
[ "protected", "function", "getObjectName", "(", "string", "$", "savePath", ")", ":", "string", "{", "$", "pathPrefix", "=", "$", "this", "->", "getPathPrefix", "(", ")", ";", "if", "(", "$", "pathPrefix", "!=", "''", ")", "{", "return", "$", "pathPrefix",...
获取文件object名称 @param string $savePath 保存路径 @return string
[ "获取文件object名称" ]
train
https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/services/AbstractFileAdapter.php#L38-L45
chippyash/Strong-Type
src/Chippyash/Type/Number/Rational/GMPRationalType.php
GMPRationalType.get
public function get() { if ($this->isInteger()) { /** @noinspection PhpUndefinedMethodInspection */ return $this->value['num']->get(); } $num = intval(gmp_strval($this->value['num']->gmp())); $den = intval(gmp_strval($this->value['den']->gmp())); ret...
php
public function get() { if ($this->isInteger()) { /** @noinspection PhpUndefinedMethodInspection */ return $this->value['num']->get(); } $num = intval(gmp_strval($this->value['num']->gmp())); $den = intval(gmp_strval($this->value['den']->gmp())); ret...
[ "public", "function", "get", "(", ")", "{", "if", "(", "$", "this", "->", "isInteger", "(", ")", ")", "{", "/** @noinspection PhpUndefinedMethodInspection */", "return", "$", "this", "->", "value", "[", "'num'", "]", "->", "get", "(", ")", ";", "}", "$",...
Get the value of the object typed properly as a PHP Native type @return integer|float
[ "Get", "the", "value", "of", "the", "object", "typed", "properly", "as", "a", "PHP", "Native", "type" ]
train
https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Rational/GMPRationalType.php#L59-L70
chippyash/Strong-Type
src/Chippyash/Type/Number/Rational/GMPRationalType.php
GMPRationalType.asGMPComplex
public function asGMPComplex() { return new GMPComplexType( new GMPRationalType(clone $this->numerator(), clone $this->denominator()), new GMPRationalType(new GMPIntType(0), new GMPIntType(1)) ); }
php
public function asGMPComplex() { return new GMPComplexType( new GMPRationalType(clone $this->numerator(), clone $this->denominator()), new GMPRationalType(new GMPIntType(0), new GMPIntType(1)) ); }
[ "public", "function", "asGMPComplex", "(", ")", "{", "return", "new", "GMPComplexType", "(", "new", "GMPRationalType", "(", "clone", "$", "this", "->", "numerator", "(", ")", ",", "clone", "$", "this", "->", "denominator", "(", ")", ")", ",", "new", "GMP...
Return the number as a GMPComplex number i.e. n+0i @return \Chippyash\Type\Number\Complex\GMPComplexType
[ "Return", "the", "number", "as", "a", "GMPComplex", "number", "i", ".", "e", ".", "n", "+", "0i" ]
train
https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Rational/GMPRationalType.php#L98-L104
ptlis/conneg
src/Negotiator/Matcher/ExactMatcher.php
ExactMatcher.getMatchingIndex
private function getMatchingIndex(array $matchingList, PreferenceInterface $pref) { $index = -1; foreach ($matchingList as $key => $match) { if ($match->getVariant() === $pref->getVariant()) { $index = $key; } } return $index; }
php
private function getMatchingIndex(array $matchingList, PreferenceInterface $pref) { $index = -1; foreach ($matchingList as $key => $match) { if ($match->getVariant() === $pref->getVariant()) { $index = $key; } } return $index; }
[ "private", "function", "getMatchingIndex", "(", "array", "$", "matchingList", ",", "PreferenceInterface", "$", "pref", ")", "{", "$", "index", "=", "-", "1", ";", "foreach", "(", "$", "matchingList", "as", "$", "key", "=>", "$", "match", ")", "{", "if", ...
Returns the first index containing a matching variant, or -1 if not present. @param MatchedPreferenceInterface[] $matchingList @param PreferenceInterface $pref @return int
[ "Returns", "the", "first", "index", "containing", "a", "matching", "variant", "or", "-", "1", "if", "not", "present", "." ]
train
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Negotiator/Matcher/ExactMatcher.php#L75-L86
psecio/propauth
src/Resolve.php
Resolve.execute
public function execute($path) { $parts = (!is_array($path)) ? explode('.', $path) : $path; $source = $this->subject; foreach ($parts as $index => $part) { $source = $this->resolve($part, $source); } return $source; }
php
public function execute($path) { $parts = (!is_array($path)) ? explode('.', $path) : $path; $source = $this->subject; foreach ($parts as $index => $part) { $source = $this->resolve($part, $source); } return $source; }
[ "public", "function", "execute", "(", "$", "path", ")", "{", "$", "parts", "=", "(", "!", "is_array", "(", "$", "path", ")", ")", "?", "explode", "(", "'.'", ",", "$", "path", ")", ":", "$", "path", ";", "$", "source", "=", "$", "this", "->", ...
Execute the data search using the path provided @param string|array $path Path to locate the data @return void
[ "Execute", "the", "data", "search", "using", "the", "path", "provided" ]
train
https://github.com/psecio/propauth/blob/cb24fcc0a3fa459f2ef40a867c334951aabf7b83/src/Resolve.php#L31-L40
psecio/propauth
src/Resolve.php
Resolve.resolve
public function resolve($part, $source) { if (is_array($source)) { $source = $this->handleArray($part, $source); } elseif (is_object($source)) { $source = $this->handleObject($part, $source); } return $source; }
php
public function resolve($part, $source) { if (is_array($source)) { $source = $this->handleArray($part, $source); } elseif (is_object($source)) { $source = $this->handleObject($part, $source); } return $source; }
[ "public", "function", "resolve", "(", "$", "part", ",", "$", "source", ")", "{", "if", "(", "is_array", "(", "$", "source", ")", ")", "{", "$", "source", "=", "$", "this", "->", "handleArray", "(", "$", "part", ",", "$", "source", ")", ";", "}", ...
Using the path part given, locate the data on the current source @param string $part Path "part" @param mixed $source Partial data from the subject @return mixed Result of resolving the part path on the source data
[ "Using", "the", "path", "part", "given", "locate", "the", "data", "on", "the", "current", "source" ]
train
https://github.com/psecio/propauth/blob/cb24fcc0a3fa459f2ef40a867c334951aabf7b83/src/Resolve.php#L50-L59
psecio/propauth
src/Resolve.php
Resolve.handleArray
public function handleArray($path, $subject) { $set = []; foreach ($subject as $subj) { $result = $this->resolve($path, $subj); if (is_array($result)) { $set = array_merge($set, $result); } else { $set = $result; } ...
php
public function handleArray($path, $subject) { $set = []; foreach ($subject as $subj) { $result = $this->resolve($path, $subj); if (is_array($result)) { $set = array_merge($set, $result); } else { $set = $result; } ...
[ "public", "function", "handleArray", "(", "$", "path", ",", "$", "subject", ")", "{", "$", "set", "=", "[", "]", ";", "foreach", "(", "$", "subject", "as", "$", "subj", ")", "{", "$", "result", "=", "$", "this", "->", "resolve", "(", "$", "path",...
Handle the location of the value when the source is an array @param string $path Part of the path to locate @param mixed $subject Source to search @return mixed Result of the search on the array
[ "Handle", "the", "location", "of", "the", "value", "when", "the", "source", "is", "an", "array" ]
train
https://github.com/psecio/propauth/blob/cb24fcc0a3fa459f2ef40a867c334951aabf7b83/src/Resolve.php#L83-L95
psecio/propauth
src/Resolve.php
Resolve.getPropertyValue
public function getPropertyValue($type, $subject) { $method = 'get'.ucwords(strtolower($type)); $propertyValue = null; if (($type !== 'closure' && $type !== 'method') && (isset($subject->$type) && $subject->$type !== null)) { $propertyValue = $subject->$type; } elseif (m...
php
public function getPropertyValue($type, $subject) { $method = 'get'.ucwords(strtolower($type)); $propertyValue = null; if (($type !== 'closure' && $type !== 'method') && (isset($subject->$type) && $subject->$type !== null)) { $propertyValue = $subject->$type; } elseif (m...
[ "public", "function", "getPropertyValue", "(", "$", "type", ",", "$", "subject", ")", "{", "$", "method", "=", "'get'", ".", "ucwords", "(", "strtolower", "(", "$", "type", ")", ")", ";", "$", "propertyValue", "=", "null", ";", "if", "(", "(", "$", ...
Type a few options to get the property value for evaluation NOTE: This is a duplicate of what's in the Enforcer class, same method name @param string $type Type of check being performed @param object $subject Object to get the property value from @return mixed Either the found property value or null if not found
[ "Type", "a", "few", "options", "to", "get", "the", "property", "value", "for", "evaluation", "NOTE", ":", "This", "is", "a", "duplicate", "of", "what", "s", "in", "the", "Enforcer", "class", "same", "method", "name" ]
train
https://github.com/psecio/propauth/blob/cb24fcc0a3fa459f2ef40a867c334951aabf7b83/src/Resolve.php#L105-L119
PandaPlatform/framework
src/Panda/Localization/Processors/JsonProcessor.php
JsonProcessor.loadTranslations
public function loadTranslations($locale, $package = 'default') { $package = $package ?: 'default'; if (empty(static::$translations[$locale])) { // Get full file path $fileName = $locale . DIRECTORY_SEPARATOR . $package . '.json'; $filePath = $this->getBaseDirecto...
php
public function loadTranslations($locale, $package = 'default') { $package = $package ?: 'default'; if (empty(static::$translations[$locale])) { // Get full file path $fileName = $locale . DIRECTORY_SEPARATOR . $package . '.json'; $filePath = $this->getBaseDirecto...
[ "public", "function", "loadTranslations", "(", "$", "locale", ",", "$", "package", "=", "'default'", ")", "{", "$", "package", "=", "$", "package", "?", ":", "'default'", ";", "if", "(", "empty", "(", "static", "::", "$", "translations", "[", "$", "loc...
Load translations from file. @param string $locale @param string $package @throws FileNotFoundException
[ "Load", "translations", "from", "file", "." ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Localization/Processors/JsonProcessor.php#L30-L46
crysalead/net
src/Http/Cgi/Request.php
Request._defaults
public function _defaults($config) { $env = $config['env']; $env->set($env->data() + [ 'SERVER_PROTOCOL' => 'HTTP/1.1', 'CONTENT_TYPE' => 'text/html; charset=utf-8', 'HTTP_HOST' => 'localhost', 'SERVER_PORT' => 80, 'SCRIPT_NAM...
php
public function _defaults($config) { $env = $config['env']; $env->set($env->data() + [ 'SERVER_PROTOCOL' => 'HTTP/1.1', 'CONTENT_TYPE' => 'text/html; charset=utf-8', 'HTTP_HOST' => 'localhost', 'SERVER_PORT' => 80, 'SCRIPT_NAM...
[ "public", "function", "_defaults", "(", "$", "config", ")", "{", "$", "env", "=", "$", "config", "[", "'env'", "]", ";", "$", "env", "->", "set", "(", "$", "env", "->", "data", "(", ")", "+", "[", "'SERVER_PROTOCOL'", "=>", "'HTTP/1.1'", ",", "'CON...
Extracts all informations from environment variables and creates a consistent default config array. @param array $config Some config array. @param array The auto generated defaults
[ "Extracts", "all", "informations", "from", "environment", "variables", "and", "creates", "a", "consistent", "default", "config", "array", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cgi/Request.php#L168-L265
crysalead/net
src/Http/Cgi/Request.php
Request.attr
public function attr($key) { list($var, $key) = explode(':', $key); switch (true) { case in_array($var, array('params', 'data', 'query')): return isset($this->{$var}[$key]) ? $this->{$var}[$key] : null; case ($var === 'env'): $key = strtoupper...
php
public function attr($key) { list($var, $key) = explode(':', $key); switch (true) { case in_array($var, array('params', 'data', 'query')): return isset($this->{$var}[$key]) ? $this->{$var}[$key] : null; case ($var === 'env'): $key = strtoupper...
[ "public", "function", "attr", "(", "$", "key", ")", "{", "list", "(", "$", "var", ",", "$", "key", ")", "=", "explode", "(", "':'", ",", "$", "key", ")", ";", "switch", "(", "true", ")", "{", "case", "in_array", "(", "$", "var", ",", "array", ...
This method allows easy extraction of any request data using a prefixed key syntax. By passing keys in the form of `'prefix:key'`, it is possible to query different information of various different types, including GET and POST data, and server environment variables. The full list of prefixes is as follows: - `'data'`...
[ "This", "method", "allows", "easy", "extraction", "of", "any", "request", "data", "using", "a", "prefixed", "key", "syntax", ".", "By", "passing", "keys", "in", "the", "form", "of", "prefix", ":", "key", "it", "is", "possible", "to", "query", "different", ...
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cgi/Request.php#L304-L324
crysalead/net
src/Http/Cgi/Request.php
Request.is
public function is($flag) { if (!isset($this->_detectors[$flag])) { return $flag === $this->format(); } $detector = $this->_detectors[$flag]; if (is_callable($detector)) { return $detector($this); } if (!is_array($detector)) { thro...
php
public function is($flag) { if (!isset($this->_detectors[$flag])) { return $flag === $this->format(); } $detector = $this->_detectors[$flag]; if (is_callable($detector)) { return $detector($this); } if (!is_array($detector)) { thro...
[ "public", "function", "is", "(", "$", "flag", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_detectors", "[", "$", "flag", "]", ")", ")", "{", "return", "$", "flag", "===", "$", "this", "->", "format", "(", ")", ";", "}", "$", "...
Provides a simple syntax for making assertions about the properties of a request. The default detectors include the following: - `'mobile'`: Uses a regular expression to match common mobile browser user agents. - `'ajax'`: Checks to see if the `X-Requested-With` header is present, and matches the value `'XMLHttpReque...
[ "Provides", "a", "simple", "syntax", "for", "making", "assertions", "about", "the", "properties", "of", "a", "request", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cgi/Request.php#L352-L376
crysalead/net
src/Http/Cgi/Request.php
Request.basePath
public function basePath($basePath = null) { if (!func_num_args()) { return $this->_basePath; } $this->_basePathTmp = $basePath; if ($this->_ignorePath) { $basePath = preg_replace($this->_ignorePath, '', $basePath); } $this->_basePath = $basePa...
php
public function basePath($basePath = null) { if (!func_num_args()) { return $this->_basePath; } $this->_basePathTmp = $basePath; if ($this->_ignorePath) { $basePath = preg_replace($this->_ignorePath, '', $basePath); } $this->_basePath = $basePa...
[ "public", "function", "basePath", "(", "$", "basePath", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_basePath", ";", "}", "$", "this", "->", "_basePathTmp", "=", "$", "basePath", ";", "if"...
Gets/sets the base path of the current request. @param string $basePath The base path to set or none to get the setted one. @return string|self
[ "Gets", "/", "sets", "the", "base", "path", "of", "the", "current", "request", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cgi/Request.php#L412-L423
crysalead/net
src/Http/Cgi/Request.php
Request.ignorePath
public function ignorePath($ignorePath = null) { if (!func_num_args()) { return $this->_ignorePath; } $this->_ignorePath = $ignorePath; $this->basePath($this->_basePathTmp); return $this; }
php
public function ignorePath($ignorePath = null) { if (!func_num_args()) { return $this->_ignorePath; } $this->_ignorePath = $ignorePath; $this->basePath($this->_basePathTmp); return $this; }
[ "public", "function", "ignorePath", "(", "$", "ignorePath", "=", "null", ")", "{", "if", "(", "!", "func_num_args", "(", ")", ")", "{", "return", "$", "this", "->", "_ignorePath", ";", "}", "$", "this", "->", "_ignorePath", "=", "$", "ignorePath", ";",...
Gets/sets the ignore pattern for the base path. @param string|array $ignorePath The ignore pattern to set or none to get the setted one. @return string|self
[ "Gets", "/", "sets", "the", "ignore", "pattern", "for", "the", "base", "path", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cgi/Request.php#L431-L439
crysalead/net
src/Http/Cgi/Request.php
Request.locale
public function locale($locale = null) { if ($locale) { $this->_locale = $locale; } if ($this->_locale) { return $this->_locale; } if (isset($this->_params['locale'])) { return $this->_params['locale']; } }
php
public function locale($locale = null) { if ($locale) { $this->_locale = $locale; } if ($this->_locale) { return $this->_locale; } if (isset($this->_params['locale'])) { return $this->_params['locale']; } }
[ "public", "function", "locale", "(", "$", "locale", "=", "null", ")", "{", "if", "(", "$", "locale", ")", "{", "$", "this", "->", "_locale", "=", "$", "locale", ";", "}", "if", "(", "$", "this", "->", "_locale", ")", "{", "return", "$", "this", ...
Sets or returns the current locale string. @param string $locale An optional locale string like `'en'`, `'en_US'` or `'de_DE'`. If specified, will overwrite the existing locale. @return string|null Returns the currently set locale string.
[ "Sets", "or", "returns", "the", "current", "locale", "string", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cgi/Request.php#L448-L459
crysalead/net
src/Http/Cgi/Request.php
Request.form
public function form($form = null) { if (func_num_args() === 1) { $form = $form ?: []; $this->_form = $form; $this->set($form); return $this; } return $this->_form; }
php
public function form($form = null) { if (func_num_args() === 1) { $form = $form ?: []; $this->_form = $form; $this->set($form); return $this; } return $this->_form; }
[ "public", "function", "form", "(", "$", "form", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "1", ")", "{", "$", "form", "=", "$", "form", "?", ":", "[", "]", ";", "$", "this", "->", "_form", "=", "$", "form", ";", "$",...
Gets/sets the form data. @param array $form The data to set or none to get the setted one. @return array
[ "Gets", "/", "sets", "the", "form", "data", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cgi/Request.php#L467-L476
crysalead/net
src/Http/Cgi/Request.php
Request.export
public function export($options = []) { $this->_setContentLength(); return [ 'basePath' => $this->basePath(), 'locale' => $this->locale(), 'form' => $this->form(), 'params' => $this->params() ] + parent::export($options); }
php
public function export($options = []) { $this->_setContentLength(); return [ 'basePath' => $this->basePath(), 'locale' => $this->locale(), 'form' => $this->form(), 'params' => $this->params() ] + parent::export($options); }
[ "public", "function", "export", "(", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "_setContentLength", "(", ")", ";", "return", "[", "'basePath'", "=>", "$", "this", "->", "basePath", "(", ")", ",", "'locale'", "=>", "$", "this", "->",...
Exports a `Request` instance to an array. @param array $options Options. @return array The export array.
[ "Exports", "a", "Request", "instance", "to", "an", "array", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cgi/Request.php#L484-L493
crysalead/net
src/Http/Cgi/Request.php
Request.ingoing
public static function ingoing($config = []) { $config['env'] = isset($config['env']) ? $config['env'] : $_SERVER; if (!isset($config['env']['REQUEST_URI'])) { throw new NetException("Missing `'REQUEST_URI'` environment variable, unable to create the main request."); } ...
php
public static function ingoing($config = []) { $config['env'] = isset($config['env']) ? $config['env'] : $_SERVER; if (!isset($config['env']['REQUEST_URI'])) { throw new NetException("Missing `'REQUEST_URI'` environment variable, unable to create the main request."); } ...
[ "public", "static", "function", "ingoing", "(", "$", "config", "=", "[", "]", ")", "{", "$", "config", "[", "'env'", "]", "=", "isset", "(", "$", "config", "[", "'env'", "]", ")", "?", "$", "config", "[", "'env'", "]", ":", "$", "_SERVER", ";", ...
Creates a request extracted from CGI globals. @param array $config The config array. - `'env'` _array_: Environment variable (defaults: `$_SERVER`). @return self
[ "Creates", "a", "request", "extracted", "from", "CGI", "globals", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cgi/Request.php#L544-L561
liuguangw/mvc
src/http/Controller.php
Controller.view
protected function view(DataMap $params, ?string $viewName = null): ViewResult { if ($viewName == null) { $routeInfo = Application::$app->routeInfo; $viewName = $routeInfo->controllerName . '/' . $routeInfo->actionName; } return new ViewResult($viewName, $this->layout...
php
protected function view(DataMap $params, ?string $viewName = null): ViewResult { if ($viewName == null) { $routeInfo = Application::$app->routeInfo; $viewName = $routeInfo->controllerName . '/' . $routeInfo->actionName; } return new ViewResult($viewName, $this->layout...
[ "protected", "function", "view", "(", "DataMap", "$", "params", ",", "?", "string", "$", "viewName", "=", "null", ")", ":", "ViewResult", "{", "if", "(", "$", "viewName", "==", "null", ")", "{", "$", "routeInfo", "=", "Application", "::", "$", "app", ...
以视图响应 @param DataMap $params 模板变量 @param string $viewName 视图名称 @return ViewResult
[ "以视图响应" ]
train
https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/http/Controller.php#L51-L58
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.setDefaultManipulationInformation
private function setDefaultManipulationInformation() { $this->add_base_dn = $this->basedn_array[0]; $this->add_dn = $this->dn; $this->add_pw = $this->password; $this->modify_method = "self"; $this->modify_base_dn = $this->add_base_dn; $this->modify_dn = $this->add_dn; $this->modify_pw = $this->add_pw; }
php
private function setDefaultManipulationInformation() { $this->add_base_dn = $this->basedn_array[0]; $this->add_dn = $this->dn; $this->add_pw = $this->password; $this->modify_method = "self"; $this->modify_base_dn = $this->add_base_dn; $this->modify_dn = $this->add_dn; $this->modify_pw = $this->add_pw; }
[ "private", "function", "setDefaultManipulationInformation", "(", ")", "{", "$", "this", "->", "add_base_dn", "=", "$", "this", "->", "basedn_array", "[", "0", "]", ";", "$", "this", "->", "add_dn", "=", "$", "this", "->", "dn", ";", "$", "this", "->", ...
Sets the base DN and credentials for add and modify operations based on the search base DN and credentials. This is done to provide sensible defaults in case the specific setter methods are not invoked.
[ "Sets", "the", "base", "DN", "and", "credentials", "for", "add", "and", "modify", "operations", "based", "on", "the", "search", "base", "DN", "and", "credentials", ".", "This", "is", "done", "to", "provide", "sensible", "defaults", "in", "case", "the", "sp...
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L120-L129
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.connect
public function connect($username="", $password="") { // make sure the ldap extension has been loaded if(!extension_loaded('ldap')) { throw new LdapExtensionNotLoadedException(); } $params = array( 'hostname' => $this->host, 'base_dn' => $this->basedn, 'options' => [ ConnectionInte...
php
public function connect($username="", $password="") { // make sure the ldap extension has been loaded if(!extension_loaded('ldap')) { throw new LdapExtensionNotLoadedException(); } $params = array( 'hostname' => $this->host, 'base_dn' => $this->basedn, 'options' => [ ConnectionInte...
[ "public", "function", "connect", "(", "$", "username", "=", "\"\"", ",", "$", "password", "=", "\"\"", ")", "{", "// make sure the ldap extension has been loaded", "if", "(", "!", "extension_loaded", "(", "'ldap'", ")", ")", "{", "throw", "new", "LdapExtensionNo...
Connects and binds to the LDAP server. An optional username and password can be supplied to override the default credentials. Returns whether the connection and binding was successful. @param string $username The override username to use @param string $password The override password to use @throws LdapExtensionNotLoa...
[ "Connects", "and", "binds", "to", "the", "LDAP", "server", ".", "An", "optional", "username", "and", "password", "can", "be", "supplied", "to", "override", "the", "default", "credentials", ".", "Returns", "whether", "the", "connection", "and", "binding", "was"...
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L165-L267
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.connectByDN
public function connectByDN($dn, $password="") { // make sure the ldap extension has been loaded if(!extension_loaded('ldap')) { throw new LdapExtensionNotLoadedException(); } $params = array( 'hostname' => $this->host, 'base_dn' => $this->basedn, 'options' => [ ConnectionInterface...
php
public function connectByDN($dn, $password="") { // make sure the ldap extension has been loaded if(!extension_loaded('ldap')) { throw new LdapExtensionNotLoadedException(); } $params = array( 'hostname' => $this->host, 'base_dn' => $this->basedn, 'options' => [ ConnectionInterface...
[ "public", "function", "connectByDN", "(", "$", "dn", ",", "$", "password", "=", "\"\"", ")", "{", "// make sure the ldap extension has been loaded", "if", "(", "!", "extension_loaded", "(", "'ldap'", ")", ")", "{", "throw", "new", "LdapExtensionNotLoadedException", ...
Connects and binds to the LDAP server based on the provided DN and an optional password. Returns whether the connection and binding were successful. @param string $dn The bind DN to use @param string $password An optional password to use @throws LdapExtensionNotLoadedException If the LDAP extension has not been insta...
[ "Connects", "and", "binds", "to", "the", "LDAP", "server", "based", "on", "the", "provided", "DN", "and", "an", "optional", "password", ".", "Returns", "whether", "the", "connection", "and", "binding", "were", "successful", "." ]
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L282-L339
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.getAttributeFromResults
public function getAttributeFromResults($results, $attr_name) { foreach($results as $node) { if($attr_name == "dn") { return $node->getDn(); } foreach($node->getAttributes() as $attribute) { if (strtolower($attribute->getName()) == strtolower($attr_name))...
php
public function getAttributeFromResults($results, $attr_name) { foreach($results as $node) { if($attr_name == "dn") { return $node->getDn(); } foreach($node->getAttributes() as $attribute) { if (strtolower($attribute->getName()) == strtolower($attr_name))...
[ "public", "function", "getAttributeFromResults", "(", "$", "results", ",", "$", "attr_name", ")", "{", "foreach", "(", "$", "results", "as", "$", "node", ")", "{", "if", "(", "$", "attr_name", "==", "\"dn\"", ")", "{", "return", "$", "node", "->", "get...
Returns the value of the specified attribute from the result set. Returns null if the attribute could not be found. @param Result-instance $results The result-set to search through @param string $attr_name The attribute name to look for @return string|integer|boolean|null
[ "Returns", "the", "value", "of", "the", "specified", "attribute", "from", "the", "result", "set", ".", "Returns", "null", "if", "the", "attribute", "could", "not", "be", "found", "." ]
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L349-L362
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.searchByAuth
public function searchByAuth($value) { // figure out how many times the placeholder occurs, then fill an // array that number of times with the search value $numArgs = substr_count($this->search_auth_query, "%s"); $args = array_fill(0, $numArgs, $value); // format the string and then perform the search for e...
php
public function searchByAuth($value) { // figure out how many times the placeholder occurs, then fill an // array that number of times with the search value $numArgs = substr_count($this->search_auth_query, "%s"); $args = array_fill(0, $numArgs, $value); // format the string and then perform the search for e...
[ "public", "function", "searchByAuth", "(", "$", "value", ")", "{", "// figure out how many times the placeholder occurs, then fill an", "// array that number of times with the search value", "$", "numArgs", "=", "substr_count", "(", "$", "this", "->", "search_auth_query", ",", ...
Queries LDAP for the record with the specified value for attributes matching what could commonly be used for authentication. For the purposes of this method, uid, mail and mailLocalAddress are searched by default unless their values have been overridden. @param string $value The value to use for searching @return Resu...
[ "Queries", "LDAP", "for", "the", "record", "with", "the", "specified", "value", "for", "attributes", "matching", "what", "could", "commonly", "be", "used", "for", "authentication", ".", "For", "the", "purposes", "of", "this", "method", "uid", "mail", "and", ...
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L383-L419
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.searchByEmail
public function searchByEmail($email) { $results = $this->ldap->search($this->basedn, $this->search_mail . '=' . $email); return $results; }
php
public function searchByEmail($email) { $results = $this->ldap->search($this->basedn, $this->search_mail . '=' . $email); return $results; }
[ "public", "function", "searchByEmail", "(", "$", "email", ")", "{", "$", "results", "=", "$", "this", "->", "ldap", "->", "search", "(", "$", "this", "->", "basedn", ",", "$", "this", "->", "search_mail", ".", "'='", ".", "$", "email", ")", ";", "r...
Queries LDAP for the record with the specified email. @param string $email The email to use for searching @return Result-instance
[ "Queries", "LDAP", "for", "the", "record", "with", "the", "specified", "email", "." ]
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L427-L431
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.searchByEmailArray
public function searchByEmailArray($email) { $results = $this->ldap->search($this->basedn, $this->search_mail_array . '=' . $email); return $results; }
php
public function searchByEmailArray($email) { $results = $this->ldap->search($this->basedn, $this->search_mail_array . '=' . $email); return $results; }
[ "public", "function", "searchByEmailArray", "(", "$", "email", ")", "{", "$", "results", "=", "$", "this", "->", "ldap", "->", "search", "(", "$", "this", "->", "basedn", ",", "$", "this", "->", "search_mail_array", ".", "'='", ".", "$", "email", ")", ...
Queries LDAP for the record with the specified mailLocalAddress. @param string $email The mailLocalAddress to use for searching @return Result-instance
[ "Queries", "LDAP", "for", "the", "record", "with", "the", "specified", "mailLocalAddress", "." ]
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L439-L443
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.searchByQuery
public function searchByQuery($query) { $results = $this->ldap->search($this->basedn, $query); return $results; }
php
public function searchByQuery($query) { $results = $this->ldap->search($this->basedn, $query); return $results; }
[ "public", "function", "searchByQuery", "(", "$", "query", ")", "{", "$", "results", "=", "$", "this", "->", "ldap", "->", "search", "(", "$", "this", "->", "basedn", ",", "$", "query", ")", ";", "return", "$", "results", ";", "}" ]
Queries LDAP for the records using the specified query. @param string $query Any valid LDAP query to use for searching @return Result-instance
[ "Queries", "LDAP", "for", "the", "records", "using", "the", "specified", "query", "." ]
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L451-L454
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.searchByUid
public function searchByUid($uid) { $results = $this->ldap->search($this->basedn, $this->search_username . '=' . $uid); return $results; }
php
public function searchByUid($uid) { $results = $this->ldap->search($this->basedn, $this->search_username . '=' . $uid); return $results; }
[ "public", "function", "searchByUid", "(", "$", "uid", ")", "{", "$", "results", "=", "$", "this", "->", "ldap", "->", "search", "(", "$", "this", "->", "basedn", ",", "$", "this", "->", "search_username", ".", "'='", ".", "$", "uid", ")", ";", "ret...
Queries LDAP for the record with the specified uid. @param string $uid The uid to use for searching @return Result-instance
[ "Queries", "LDAP", "for", "the", "record", "with", "the", "specified", "uid", "." ]
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L462-L466
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.addObject
public function addObject($identifier, $attributes) { // bind using the add credentials $this->bind( $this->add_dn, $this->add_pw ); // generate a new node and set its DN within the add subtree $node = new Node(); // if the identifier contains a comma, it's likely a DN if(strpos($identifier, ',') ...
php
public function addObject($identifier, $attributes) { // bind using the add credentials $this->bind( $this->add_dn, $this->add_pw ); // generate a new node and set its DN within the add subtree $node = new Node(); // if the identifier contains a comma, it's likely a DN if(strpos($identifier, ',') ...
[ "public", "function", "addObject", "(", "$", "identifier", ",", "$", "attributes", ")", "{", "// bind using the add credentials", "$", "this", "->", "bind", "(", "$", "this", "->", "add_dn", ",", "$", "this", "->", "add_pw", ")", ";", "// generate a new node a...
Adds an object into the add subtree using the specified identifier and an associative array of attributes. Returns a boolean describing whether the operation was successful. Throws an exception if the bind fails. @param string $identifier The value to use as the "username" identifier @param array $attributes Associati...
[ "Adds", "an", "object", "into", "the", "add", "subtree", "using", "the", "specified", "identifier", "and", "an", "associative", "array", "of", "attributes", ".", "Returns", "a", "boolean", "describing", "whether", "the", "operation", "was", "successful", ".", ...
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L479-L520
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.modifyObject
public function modifyObject($identifier, $attributes) { // bind using the modify credentials if anything other than "self" // has been set as the method if($this->modify_method != "self") { $this->bind( $this->modify_dn, $this->modify_pw ); } // if the identifier contains a comma, it's likely ...
php
public function modifyObject($identifier, $attributes) { // bind using the modify credentials if anything other than "self" // has been set as the method if($this->modify_method != "self") { $this->bind( $this->modify_dn, $this->modify_pw ); } // if the identifier contains a comma, it's likely ...
[ "public", "function", "modifyObject", "(", "$", "identifier", ",", "$", "attributes", ")", "{", "// bind using the modify credentials if anything other than \"self\"", "// has been set as the method", "if", "(", "$", "this", "->", "modify_method", "!=", "\"self\"", ")", "...
Modifies an object in the modify subtree using the specified identifier and an associative array of attributes. Returns a boolean describing whether the operation was successful. Throws an exception if the bind fails. @param string $identifier The value to use as the "username" identifier @param array $attributes Asso...
[ "Modifies", "an", "object", "in", "the", "modify", "subtree", "using", "the", "specified", "identifier", "and", "an", "associative", "array", "of", "attributes", ".", "Returns", "a", "boolean", "describing", "whether", "the", "operation", "was", "successful", "....
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L534-L584
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.setAddBaseDN
public function setAddBaseDN($add_base_dn) { if(!empty($add_base_dn)) { $this->add_base_dn = $add_base_dn; } else { $this->add_base_dn = $this->basedn; } }
php
public function setAddBaseDN($add_base_dn) { if(!empty($add_base_dn)) { $this->add_base_dn = $add_base_dn; } else { $this->add_base_dn = $this->basedn; } }
[ "public", "function", "setAddBaseDN", "(", "$", "add_base_dn", ")", "{", "if", "(", "!", "empty", "(", "$", "add_base_dn", ")", ")", "{", "$", "this", "->", "add_base_dn", "=", "$", "add_base_dn", ";", "}", "else", "{", "$", "this", "->", "add_base_dn"...
Sets the base DN for add operations in a subtree. @param string $add_base_dn The base DN for add operations
[ "Sets", "the", "base", "DN", "for", "add", "operations", "in", "a", "subtree", "." ]
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L659-L667
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.setAddDN
public function setAddDN($add_dn) { if(!empty($add_dn)) { $this->add_dn = $add_dn; } else { $this->add_dn = $this->dn; } }
php
public function setAddDN($add_dn) { if(!empty($add_dn)) { $this->add_dn = $add_dn; } else { $this->add_dn = $this->dn; } }
[ "public", "function", "setAddDN", "(", "$", "add_dn", ")", "{", "if", "(", "!", "empty", "(", "$", "add_dn", ")", ")", "{", "$", "this", "->", "add_dn", "=", "$", "add_dn", ";", "}", "else", "{", "$", "this", "->", "add_dn", "=", "$", "this", "...
Sets the admin DN for add operations in a subtree. If the parameter is left empty, the search admin DN will be used instead. @param string $add_dn The admin DN for add operations
[ "Sets", "the", "admin", "DN", "for", "add", "operations", "in", "a", "subtree", ".", "If", "the", "parameter", "is", "left", "empty", "the", "search", "admin", "DN", "will", "be", "used", "instead", "." ]
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L675-L683
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.setAddPassword
public function setAddPassword($add_pw) { if(!empty($add_pw)) { $this->add_pw = $add_pw; } else { $this->add_pw = $this->password; } }
php
public function setAddPassword($add_pw) { if(!empty($add_pw)) { $this->add_pw = $add_pw; } else { $this->add_pw = $this->password; } }
[ "public", "function", "setAddPassword", "(", "$", "add_pw", ")", "{", "if", "(", "!", "empty", "(", "$", "add_pw", ")", ")", "{", "$", "this", "->", "add_pw", "=", "$", "add_pw", ";", "}", "else", "{", "$", "this", "->", "add_pw", "=", "$", "this...
Sets the admin password for add operations in a subtree. If the parameter is left empty, the search admin password will be used instead. @param string $add_pw The admin password for add operations
[ "Sets", "the", "admin", "password", "for", "add", "operations", "in", "a", "subtree", ".", "If", "the", "parameter", "is", "left", "empty", "the", "search", "admin", "password", "will", "be", "used", "instead", "." ]
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L691-L699
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.setModifyBaseDN
public function setModifyBaseDN($modify_base_dn) { if(!empty($modify_base_dn)) { $this->modify_base_dn = $modify_base_dn; } else { $this->modify_base_dn = $this->add_base_dn; } }
php
public function setModifyBaseDN($modify_base_dn) { if(!empty($modify_base_dn)) { $this->modify_base_dn = $modify_base_dn; } else { $this->modify_base_dn = $this->add_base_dn; } }
[ "public", "function", "setModifyBaseDN", "(", "$", "modify_base_dn", ")", "{", "if", "(", "!", "empty", "(", "$", "modify_base_dn", ")", ")", "{", "$", "this", "->", "modify_base_dn", "=", "$", "modify_base_dn", ";", "}", "else", "{", "$", "this", "->", ...
Sets the base DN for modify operations in a subtree. If the parameter is left empty, the add base DN will be used instead. @param string $modify_base_dn The base DN for modify operations
[ "Sets", "the", "base", "DN", "for", "modify", "operations", "in", "a", "subtree", ".", "If", "the", "parameter", "is", "left", "empty", "the", "add", "base", "DN", "will", "be", "used", "instead", "." ]
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L724-L732
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.setModifyDN
public function setModifyDN($modify_dn) { if(!empty($modify_dn)) { $this->modify_dn = $modify_dn; } else { $this->modify_dn = $this->add_dn; } }
php
public function setModifyDN($modify_dn) { if(!empty($modify_dn)) { $this->modify_dn = $modify_dn; } else { $this->modify_dn = $this->add_dn; } }
[ "public", "function", "setModifyDN", "(", "$", "modify_dn", ")", "{", "if", "(", "!", "empty", "(", "$", "modify_dn", ")", ")", "{", "$", "this", "->", "modify_dn", "=", "$", "modify_dn", ";", "}", "else", "{", "$", "this", "->", "modify_dn", "=", ...
Sets the admin DN for modify operations in a subtree. If the parameter is left empty, the add admin DN will be used instead. @param string $modify_dn The admin DN for modify operations
[ "Sets", "the", "admin", "DN", "for", "modify", "operations", "in", "a", "subtree", ".", "If", "the", "parameter", "is", "left", "empty", "the", "add", "admin", "DN", "will", "be", "used", "instead", "." ]
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L740-L748
csun-metalab/laravel-directory-authentication
src/Authentication/Handlers/HandlerLDAP.php
HandlerLDAP.setModifyPassword
public function setModifyPassword($modify_pw) { if(!empty($modify_pw)) { $this->modify_pw = $modify_pw; } else { $this->modify_pw = $this->add_pw; } }
php
public function setModifyPassword($modify_pw) { if(!empty($modify_pw)) { $this->modify_pw = $modify_pw; } else { $this->modify_pw = $this->add_pw; } }
[ "public", "function", "setModifyPassword", "(", "$", "modify_pw", ")", "{", "if", "(", "!", "empty", "(", "$", "modify_pw", ")", ")", "{", "$", "this", "->", "modify_pw", "=", "$", "modify_pw", ";", "}", "else", "{", "$", "this", "->", "modify_pw", "...
Sets the admin password for modify operations in a subtree. If the parameter is left empty, the add admin password will be used instead. @param string $modify_dn The admin password for modify operations
[ "Sets", "the", "admin", "password", "for", "modify", "operations", "in", "a", "subtree", ".", "If", "the", "parameter", "is", "left", "empty", "the", "add", "admin", "password", "will", "be", "used", "instead", "." ]
train
https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Handlers/HandlerLDAP.php#L756-L764
venta/framework
src/ServiceProvider/src/AbstractServiceProvider.php
AbstractServiceProvider.loadConfigFromFiles
protected function loadConfigFromFiles(string ...$configFiles) { foreach ($configFiles as $configFile) { $this->config->merge(require $configFile); } }
php
protected function loadConfigFromFiles(string ...$configFiles) { foreach ($configFiles as $configFile) { $this->config->merge(require $configFile); } }
[ "protected", "function", "loadConfigFromFiles", "(", "string", "...", "$", "configFiles", ")", "{", "foreach", "(", "$", "configFiles", "as", "$", "configFile", ")", "{", "$", "this", "->", "config", "->", "merge", "(", "require", "$", "configFile", ")", "...
Merges config params from service provider with the global configuration. @param string[] ...$configFiles
[ "Merges", "config", "params", "from", "service", "provider", "with", "the", "global", "configuration", "." ]
train
https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/ServiceProvider/src/AbstractServiceProvider.php#L82-L87
venta/framework
src/ServiceProvider/src/AbstractServiceProvider.php
AbstractServiceProvider.provideCommands
protected function provideCommands(string ...$commandClasses) { /** @var CommandCollection $commandCollector */ $commandCollector = $this->container->get(CommandCollection::class); foreach ($commandClasses as $commandClass) { $commandCollector->add($commandClass); } }
php
protected function provideCommands(string ...$commandClasses) { /** @var CommandCollection $commandCollector */ $commandCollector = $this->container->get(CommandCollection::class); foreach ($commandClasses as $commandClass) { $commandCollector->add($commandClass); } }
[ "protected", "function", "provideCommands", "(", "string", "...", "$", "commandClasses", ")", "{", "/** @var CommandCollection $commandCollector */", "$", "commandCollector", "=", "$", "this", "->", "container", "->", "get", "(", "CommandCollection", "::", "class", ")...
Registers commands exposed by service provider. @param string[] ...$commandClasses
[ "Registers", "commands", "exposed", "by", "service", "provider", "." ]
train
https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/ServiceProvider/src/AbstractServiceProvider.php#L94-L101
nyeholt/silverstripe-simplewiki
thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier.php
HTMLPurifier.purify
public function purify($html, $config = null) { // :TODO: make the config merge in, instead of replace $config = $config ? HTMLPurifier_Config::create($config) : $this->config; // implementation is partially environment dependant, partially // configuration dependant $lexer = H...
php
public function purify($html, $config = null) { // :TODO: make the config merge in, instead of replace $config = $config ? HTMLPurifier_Config::create($config) : $this->config; // implementation is partially environment dependant, partially // configuration dependant $lexer = H...
[ "public", "function", "purify", "(", "$", "html", ",", "$", "config", "=", "null", ")", "{", "// :TODO: make the config merge in, instead of replace", "$", "config", "=", "$", "config", "?", "HTMLPurifier_Config", "::", "create", "(", "$", "config", ")", ":", ...
Filters an HTML snippet/document to be XSS-free and standards-compliant. @param $html String of HTML to purify @param $config HTMLPurifier_Config object for this operation, if omitted, defaults to the config object specified during this object's construction. The parameter can also be any type that HTMLPurifier_Config...
[ "Filters", "an", "HTML", "snippet", "/", "document", "to", "be", "XSS", "-", "free", "and", "standards", "-", "compliant", "." ]
train
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier.php#L115-L191
incraigulous/contentful-sdk
src/ManagementClient.php
ManagementClient.get
function get($resource, $query = array(), $headers = array()) { $url = $this->build_url($resource, $query); $result = $this->client->get($url, [ 'headers' => array_merge([ 'Authorization' => $this->getBearer() ], $headers) ])->json(); return $resul...
php
function get($resource, $query = array(), $headers = array()) { $url = $this->build_url($resource, $query); $result = $this->client->get($url, [ 'headers' => array_merge([ 'Authorization' => $this->getBearer() ], $headers) ])->json(); return $resul...
[ "function", "get", "(", "$", "resource", ",", "$", "query", "=", "array", "(", ")", ",", "$", "headers", "=", "array", "(", ")", ")", "{", "$", "url", "=", "$", "this", "->", "build_url", "(", "$", "resource", ",", "$", "query", ")", ";", "$", ...
Make a get request. @param $resource @param array $query @param array $headers @return mixed
[ "Make", "a", "get", "request", "." ]
train
https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/ManagementClient.php#L25-L33
incraigulous/contentful-sdk
src/ManagementClient.php
ManagementClient.post
function post($resource, $payload = array(), $headers = array()) { $result = $this->client->post($this->build_url($resource), [ 'headers' => array_merge([ 'Content-Type' => $this->getContentType(), 'Authorization' => $this->getBearer(), 'Content-Le...
php
function post($resource, $payload = array(), $headers = array()) { $result = $this->client->post($this->build_url($resource), [ 'headers' => array_merge([ 'Content-Type' => $this->getContentType(), 'Authorization' => $this->getBearer(), 'Content-Le...
[ "function", "post", "(", "$", "resource", ",", "$", "payload", "=", "array", "(", ")", ",", "$", "headers", "=", "array", "(", ")", ")", "{", "$", "result", "=", "$", "this", "->", "client", "->", "post", "(", "$", "this", "->", "build_url", "(",...
Build and make a POST request. @param $resource @param array $payload @param array $headers @return GuzzleHttp\Message\FutureResponse|GuzzleHttp\Message\ResponseInterface|GuzzleHttp\Ring\Future\FutureInterface|mixed|null
[ "Build", "and", "make", "a", "POST", "request", "." ]
train
https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/ManagementClient.php#L42-L53
incraigulous/contentful-sdk
src/ManagementClient.php
ManagementClient.delete
function delete($resource, $headers = array()) { $result = $this->client->delete($this->build_url($resource), [ 'headers' => array_merge([ 'Authorization' => $this->getBearer() ], $headers) ]); return $result; }
php
function delete($resource, $headers = array()) { $result = $this->client->delete($this->build_url($resource), [ 'headers' => array_merge([ 'Authorization' => $this->getBearer() ], $headers) ]); return $result; }
[ "function", "delete", "(", "$", "resource", ",", "$", "headers", "=", "array", "(", ")", ")", "{", "$", "result", "=", "$", "this", "->", "client", "->", "delete", "(", "$", "this", "->", "build_url", "(", "$", "resource", ")", ",", "[", "'headers'...
Build and make a DELETE request. @param $resource @param array $headers @return GuzzleHttp\Message\FutureResponse|GuzzleHttp\Message\ResponseInterface|GuzzleHttp\Ring\Future\FutureInterface|mixed|null
[ "Build", "and", "make", "a", "DELETE", "request", "." ]
train
https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/ManagementClient.php#L82-L90
AymDev/Phunder
src/Controller/Controller.php
Controller.render
static protected function render(string $filename) { // Get Model data static::mandatoryData(); $filename = self::TEMPLATE_PATH . '/' . $filename; // Create & render template $template = new EKF($filename, self::$template_data); echo $template->render(); }
php
static protected function render(string $filename) { // Get Model data static::mandatoryData(); $filename = self::TEMPLATE_PATH . '/' . $filename; // Create & render template $template = new EKF($filename, self::$template_data); echo $template->render(); }
[ "static", "protected", "function", "render", "(", "string", "$", "filename", ")", "{", "// Get Model data", "static", "::", "mandatoryData", "(", ")", ";", "$", "filename", "=", "self", "::", "TEMPLATE_PATH", ".", "'/'", ".", "$", "filename", ";", "// Create...
Render a template Call this method to render an EKF template. @param string $filename EKF template path @return void
[ "Render", "a", "template" ]
train
https://github.com/AymDev/Phunder/blob/32dbe6c81100f1ac3fc2a0080e323d8ab31cab10/src/Controller/Controller.php#L63-L73
attm2x/m2x-php
src/HttpRequest.php
HttpRequest.request
public function request($method, $url, $params = array(), $vars = array()) { $this->request = curl_init(); $this->setRequestMethod($method); $this->setOptions($url, $method, $params, $vars); $data = curl_exec($this->request); if ($data === false) { throw new \Exception('Curl Error: ' . curl...
php
public function request($method, $url, $params = array(), $vars = array()) { $this->request = curl_init(); $this->setRequestMethod($method); $this->setOptions($url, $method, $params, $vars); $data = curl_exec($this->request); if ($data === false) { throw new \Exception('Curl Error: ' . curl...
[ "public", "function", "request", "(", "$", "method", ",", "$", "url", ",", "$", "params", "=", "array", "(", ")", ",", "$", "vars", "=", "array", "(", ")", ")", "{", "$", "this", "->", "request", "=", "curl_init", "(", ")", ";", "$", "this", "-...
Executes a request @param string $method @param string $url @param array $params @param array $vars @return HttpResponse
[ "Executes", "a", "request" ]
train
https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/HttpRequest.php#L86-L103
attm2x/m2x-php
src/HttpRequest.php
HttpRequest.setRequestMethod
protected function setRequestMethod($method) { switch (strtoupper($method)) { case 'HEAD': curl_setopt($this->request, CURLOPT_NOBODY, true); break; case 'GET': # Hack to allow a request body to be set via CURLOPT_POSTFIELDS # for GET requests. curl_setopt($this->...
php
protected function setRequestMethod($method) { switch (strtoupper($method)) { case 'HEAD': curl_setopt($this->request, CURLOPT_NOBODY, true); break; case 'GET': # Hack to allow a request body to be set via CURLOPT_POSTFIELDS # for GET requests. curl_setopt($this->...
[ "protected", "function", "setRequestMethod", "(", "$", "method", ")", "{", "switch", "(", "strtoupper", "(", "$", "method", ")", ")", "{", "case", "'HEAD'", ":", "curl_setopt", "(", "$", "this", "->", "request", ",", "CURLOPT_NOBODY", ",", "true", ")", "...
Set the associated CURL options for a request method @param string $method @return void
[ "Set", "the", "associated", "CURL", "options", "for", "a", "request", "method" ]
train
https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/HttpRequest.php#L111-L127
attm2x/m2x-php
src/HttpRequest.php
HttpRequest.setOptions
protected function setOptions($url, $method, $params, $vars) { if(!empty($params)) { $url = $url . "?" . http_build_query($params); } curl_setopt($this->request, CURLOPT_URL, $url); curl_setopt($this->request, CURLOPT_HEADER, true); curl_setopt($this->request, CURLOPT_RETURNTRANSFER, true); ...
php
protected function setOptions($url, $method, $params, $vars) { if(!empty($params)) { $url = $url . "?" . http_build_query($params); } curl_setopt($this->request, CURLOPT_URL, $url); curl_setopt($this->request, CURLOPT_HEADER, true); curl_setopt($this->request, CURLOPT_RETURNTRANSFER, true); ...
[ "protected", "function", "setOptions", "(", "$", "url", ",", "$", "method", ",", "$", "params", ",", "$", "vars", ")", "{", "if", "(", "!", "empty", "(", "$", "params", ")", ")", "{", "$", "url", "=", "$", "url", ".", "\"?\"", ".", "http_build_qu...
Set the CURL options @param string $url @param array $method @param array $params @param array $vars @return void
[ "Set", "the", "CURL", "options" ]
train
https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/HttpRequest.php#L138-L158
attm2x/m2x-php
src/HttpRequest.php
HttpRequest.setJSONPayload
protected function setJSONPayload($vars) { $this->headers['Content-Type'] = 'application/json'; $this->headers['Content-Length'] = 0; $this->headers['Expect'] = ''; if (!empty($vars)) { $data = json_encode($vars); $this->headers['Content-Length'] = strlen($data); curl_setopt($this->re...
php
protected function setJSONPayload($vars) { $this->headers['Content-Type'] = 'application/json'; $this->headers['Content-Length'] = 0; $this->headers['Expect'] = ''; if (!empty($vars)) { $data = json_encode($vars); $this->headers['Content-Length'] = strlen($data); curl_setopt($this->re...
[ "protected", "function", "setJSONPayload", "(", "$", "vars", ")", "{", "$", "this", "->", "headers", "[", "'Content-Type'", "]", "=", "'application/json'", ";", "$", "this", "->", "headers", "[", "'Content-Length'", "]", "=", "0", ";", "$", "this", "->", ...
Set the JSON payload @param array $vars
[ "Set", "the", "JSON", "payload" ]
train
https://github.com/attm2x/m2x-php/blob/4c2ff6d70af50538818855e648af24bf5cf16ead/src/HttpRequest.php#L165-L175
kriskbx/mikado
src/Formatters/MetaFormatter.php
MetaFormatter.format
public function format($data) { if (!$data->hasProperty('meta')) { return $data; } // Loop through the meta arrays/objects/whatever foreach ($data->getProperty('meta') as $meta) { $regex = false; // Check if the meta array is valid if...
php
public function format($data) { if (!$data->hasProperty('meta')) { return $data; } // Loop through the meta arrays/objects/whatever foreach ($data->getProperty('meta') as $meta) { $regex = false; // Check if the meta array is valid if...
[ "public", "function", "format", "(", "$", "data", ")", "{", "if", "(", "!", "$", "data", "->", "hasProperty", "(", "'meta'", ")", ")", "{", "return", "$", "data", ";", "}", "// Loop through the meta arrays/objects/whatever", "foreach", "(", "$", "data", "-...
Format the meta fields from the given data. @param FormatAble $data @return FormatAble
[ "Format", "the", "meta", "fields", "from", "the", "given", "data", "." ]
train
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Formatters/MetaFormatter.php#L41-L73
kriskbx/mikado
src/Formatters/MetaFormatter.php
MetaFormatter.metaKeyIsRegex
protected function metaKeyIsRegex($meta) { if (!isset($meta['meta_key'])) { return false; } return $this->pregMatchArray($meta['meta_key'], $this->regex); }
php
protected function metaKeyIsRegex($meta) { if (!isset($meta['meta_key'])) { return false; } return $this->pregMatchArray($meta['meta_key'], $this->regex); }
[ "protected", "function", "metaKeyIsRegex", "(", "$", "meta", ")", "{", "if", "(", "!", "isset", "(", "$", "meta", "[", "'meta_key'", "]", ")", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "pregMatchArray", "(", "$", "meta", "["...
Meta key is regex? @param array $meta @return array|bool
[ "Meta", "key", "is", "regex?" ]
train
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Formatters/MetaFormatter.php#L98-L105
kriskbx/mikado
src/Formatters/MetaFormatter.php
MetaFormatter.getUnserializedValue
protected function getUnserializedValue($meta) { $value = $meta['meta_value']; if ($unserializedValue = @unserialize($value)) { $value = $unserializedValue; } return $value; }
php
protected function getUnserializedValue($meta) { $value = $meta['meta_value']; if ($unserializedValue = @unserialize($value)) { $value = $unserializedValue; } return $value; }
[ "protected", "function", "getUnserializedValue", "(", "$", "meta", ")", "{", "$", "value", "=", "$", "meta", "[", "'meta_value'", "]", ";", "if", "(", "$", "unserializedValue", "=", "@", "unserialize", "(", "$", "value", ")", ")", "{", "$", "value", "=...
Get unserialized value. @param array $meta @return mixed
[ "Get", "unserialized", "value", "." ]
train
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Formatters/MetaFormatter.php#L114-L123
ikwattro/guzzle-stereo
src/Recorder.php
Recorder.getTape
public function getTape($name) { if (!array_key_exists($name, $this->tapes)) { throw new RecorderException(sprintf('There is no tape with name "%s" registered', $name)); } return $this->tapes[$name]; }
php
public function getTape($name) { if (!array_key_exists($name, $this->tapes)) { throw new RecorderException(sprintf('There is no tape with name "%s" registered', $name)); } return $this->tapes[$name]; }
[ "public", "function", "getTape", "(", "$", "name", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "name", ",", "$", "this", "->", "tapes", ")", ")", "{", "throw", "new", "RecorderException", "(", "sprintf", "(", "'There is no tape with name \"%s\" r...
@param string $name @return \Ikwattro\GuzzleStereo\Record\Tape @throw \Ikwattro\GuzzleStereo\Exception\RecordException When the tape can not be found
[ "@param", "string", "$name" ]
train
https://github.com/ikwattro/guzzle-stereo/blob/a76f19b0a81048eca104f07bd490bf06a46b6e9d/src/Recorder.php#L133-L140
ikwattro/guzzle-stereo
src/Recorder.php
Recorder.processConfig
private function processConfig() { $processor = new Processor(); $coreConfig = Yaml::parse(file_get_contents(__DIR__.'/Resources/core_filters.yml')); $configs = array($this->config, $coreConfig); $configuration = new StereoConfiguration(); $processedConfiguration = $processor...
php
private function processConfig() { $processor = new Processor(); $coreConfig = Yaml::parse(file_get_contents(__DIR__.'/Resources/core_filters.yml')); $configs = array($this->config, $coreConfig); $configuration = new StereoConfiguration(); $processedConfiguration = $processor...
[ "private", "function", "processConfig", "(", ")", "{", "$", "processor", "=", "new", "Processor", "(", ")", ";", "$", "coreConfig", "=", "Yaml", "::", "parse", "(", "file_get_contents", "(", "__DIR__", ".", "'/Resources/core_filters.yml'", ")", ")", ";", "$"...
Process configuration for registering tapes and filters.
[ "Process", "configuration", "for", "registering", "tapes", "and", "filters", "." ]
train
https://github.com/ikwattro/guzzle-stereo/blob/a76f19b0a81048eca104f07bd490bf06a46b6e9d/src/Recorder.php#L145-L172
ikwattro/guzzle-stereo
src/Recorder.php
Recorder.dump
public function dump() { foreach ($this->tapes as $tape) { if ($tape->hasResponses()) { $fileName = 'record_'.$tape->getName().'.json'; $content = $this->formatter->encodeResponsesCollection($tape->getResponses()); $this->writer->write($fileName, $...
php
public function dump() { foreach ($this->tapes as $tape) { if ($tape->hasResponses()) { $fileName = 'record_'.$tape->getName().'.json'; $content = $this->formatter->encodeResponsesCollection($tape->getResponses()); $this->writer->write($fileName, $...
[ "public", "function", "dump", "(", ")", "{", "foreach", "(", "$", "this", "->", "tapes", "as", "$", "tape", ")", "{", "if", "(", "$", "tape", "->", "hasResponses", "(", ")", ")", "{", "$", "fileName", "=", "'record_'", ".", "$", "tape", "->", "ge...
Dumps the tapes on disk.
[ "Dumps", "the", "tapes", "on", "disk", "." ]
train
https://github.com/ikwattro/guzzle-stereo/blob/a76f19b0a81048eca104f07bd490bf06a46b6e9d/src/Recorder.php#L185-L194
ikwattro/guzzle-stereo
src/Recorder.php
Recorder.getTapeContent
public function getTapeContent($name) { $tape = $this->getTape($name); if ($tape->hasResponses()) { $content = $this->formatter->encodeResponsesCollection($tape->getResponses()); return $content; } return; }
php
public function getTapeContent($name) { $tape = $this->getTape($name); if ($tape->hasResponses()) { $content = $this->formatter->encodeResponsesCollection($tape->getResponses()); return $content; } return; }
[ "public", "function", "getTapeContent", "(", "$", "name", ")", "{", "$", "tape", "=", "$", "this", "->", "getTape", "(", "$", "name", ")", ";", "if", "(", "$", "tape", "->", "hasResponses", "(", ")", ")", "{", "$", "content", "=", "$", "this", "-...
Returns the content of a specific tape without writing it to disk. @param string $name @return null|string
[ "Returns", "the", "content", "of", "a", "specific", "tape", "without", "writing", "it", "to", "disk", "." ]
train
https://github.com/ikwattro/guzzle-stereo/blob/a76f19b0a81048eca104f07bd490bf06a46b6e9d/src/Recorder.php#L203-L213
DevGroup-ru/yii2-data-structure-tools
src/widgets/PropertiesForm.php
PropertiesForm.buildTabsArray
protected function buildTabsArray($availableGroups, $attachedGroups) { $addGroupItems = []; $tabs = []; foreach ($availableGroups as $id => $name) { if (!in_array($id, $attachedGroups)) { $addGroupItems[$id] = $name; } $isAttached = in_arra...
php
protected function buildTabsArray($availableGroups, $attachedGroups) { $addGroupItems = []; $tabs = []; foreach ($availableGroups as $id => $name) { if (!in_array($id, $attachedGroups)) { $addGroupItems[$id] = $name; } $isAttached = in_arra...
[ "protected", "function", "buildTabsArray", "(", "$", "availableGroups", ",", "$", "attachedGroups", ")", "{", "$", "addGroupItems", "=", "[", "]", ";", "$", "tabs", "=", "[", "]", ";", "foreach", "(", "$", "availableGroups", "as", "$", "id", "=>", "$", ...
Build array for tabs. @param array $availableGroups @param array $attachedGroups @return array
[ "Build", "array", "for", "tabs", "." ]
train
https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/widgets/PropertiesForm.php#L60-L131
taskforcedev/laravel-support
src/Helpers/Composer.php
Composer.packageExists
public function packageExists($namespace, $package) { $folder = $this->vendorFolder . $namespace; $folderExists = file_exists($folder); if (!$folderExists) { return false; } $packageFolder = $folder . '/' . $package; $packageFolderExists = file_exists($p...
php
public function packageExists($namespace, $package) { $folder = $this->vendorFolder . $namespace; $folderExists = file_exists($folder); if (!$folderExists) { return false; } $packageFolder = $folder . '/' . $package; $packageFolderExists = file_exists($p...
[ "public", "function", "packageExists", "(", "$", "namespace", ",", "$", "package", ")", "{", "$", "folder", "=", "$", "this", "->", "vendorFolder", ".", "$", "namespace", ";", "$", "folderExists", "=", "file_exists", "(", "$", "folder", ")", ";", "if", ...
Determine if a composer package exists. @param string $namespace Package namespace. @param string $package Package name. @return bool
[ "Determine", "if", "a", "composer", "package", "exists", "." ]
train
https://github.com/taskforcedev/laravel-support/blob/fdfa90ca10ffd57bc6f7aca20d2f3db7dc259221/src/Helpers/Composer.php#L21-L34
wshafer/assetmanager-core
src/Resolver/CollectionResolver.php
CollectionResolver.resolve
public function resolve($name) { $collections = $this->getCollections(); if (!isset($collections[$name])) { return null; } if (!is_array($collections[$name])) { throw new Exception\RuntimeException( "Collection with name $name is not an an ar...
php
public function resolve($name) { $collections = $this->getCollections(); if (!isset($collections[$name])) { return null; } if (!is_array($collections[$name])) { throw new Exception\RuntimeException( "Collection with name $name is not an an ar...
[ "public", "function", "resolve", "(", "$", "name", ")", "{", "$", "collections", "=", "$", "this", "->", "getCollections", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "collections", "[", "$", "name", "]", ")", ")", "{", "return", "null", ";",...
{@inheritDoc}
[ "{" ]
train
https://github.com/wshafer/assetmanager-core/blob/b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d/src/Resolver/CollectionResolver.php#L69-L123
Runscope/guzzle-runscope
src/Runscope/Plugin/RunscopePlugin.php
RunscopePlugin.onBeforeSend
public function onBeforeSend(Event $event) { /** @var \Guzzle\Http\Message\Request $request */ $request = $event['request']; list($newUrl, $port) = $this->proxify( $request->getUrl(), $this->bucketKey, $this->gatewayHost ); $request->setU...
php
public function onBeforeSend(Event $event) { /** @var \Guzzle\Http\Message\Request $request */ $request = $event['request']; list($newUrl, $port) = $this->proxify( $request->getUrl(), $this->bucketKey, $this->gatewayHost ); $request->setU...
[ "public", "function", "onBeforeSend", "(", "Event", "$", "event", ")", "{", "/** @var \\Guzzle\\Http\\Message\\Request $request */", "$", "request", "=", "$", "event", "[", "'request'", "]", ";", "list", "(", "$", "newUrl", ",", "$", "port", ")", "=", "$", "...
Event triggered right before sending a request @param Event $event
[ "Event", "triggered", "right", "before", "sending", "a", "request" ]
train
https://github.com/Runscope/guzzle-runscope/blob/e369cb90e0dabfc835d32a1e0614e0e2954d510b/src/Runscope/Plugin/RunscopePlugin.php#L41-L61
Runscope/guzzle-runscope
src/Runscope/Plugin/RunscopePlugin.php
RunscopePlugin.http_build_url
private function http_build_url($url = null, $parts = array(), $flags = self::HTTP_URL_REPLACE, &$new_url = false) { $keys = array('user', 'pass', 'port', 'path', 'query', 'fragment'); if ($flags & self::HTTP_URL_STRIP_ALL) { // HTTP_URL_STRIP_ALL becomes all the HTTP_URL_STRIP_Xs ...
php
private function http_build_url($url = null, $parts = array(), $flags = self::HTTP_URL_REPLACE, &$new_url = false) { $keys = array('user', 'pass', 'port', 'path', 'query', 'fragment'); if ($flags & self::HTTP_URL_STRIP_ALL) { // HTTP_URL_STRIP_ALL becomes all the HTTP_URL_STRIP_Xs ...
[ "private", "function", "http_build_url", "(", "$", "url", "=", "null", ",", "$", "parts", "=", "array", "(", ")", ",", "$", "flags", "=", "self", "::", "HTTP_URL_REPLACE", ",", "&", "$", "new_url", "=", "false", ")", "{", "$", "keys", "=", "array", ...
Build an URL The parts of the second URL will be merged into the first according to the flags argument. @param $url string|array (Part(s) of) an URL in form of a string or associative array like parse_url() returns (optional) @param $parts array Same as the first argument @param $flags integer A bitmask of binary or'...
[ "Build", "an", "URL" ]
train
https://github.com/Runscope/guzzle-runscope/blob/e369cb90e0dabfc835d32a1e0614e0e2954d510b/src/Runscope/Plugin/RunscopePlugin.php#L133-L209
LightboxDigital/wp-dynamic-image-resizer
includes/class-dynamic-image-resizer-loader.php
Dynamic_Image_Resizer_Loader.add_action
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); }
php
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); }
[ "public", "function", "add_action", "(", "$", "hook", ",", "$", "component", ",", "$", "callback", ",", "$", "priority", "=", "10", ",", "$", "accepted_args", "=", "1", ")", "{", "$", "this", "->", "actions", "=", "$", "this", "->", "add", "(", "$"...
Add a new action to the collection to be registered with WordPress. @since 1.0.0 @param string $hook The name of the WordPress action that is being registered. @param object $component A reference to the instance of the object on which the action is defined. @param string $callback The name of the f...
[ "Add", "a", "new", "action", "to", "the", "collection", "to", "be", "registered", "with", "WordPress", "." ]
train
https://github.com/LightboxDigital/wp-dynamic-image-resizer/blob/cc1d67192c8463eba4c0920130abec933ed2296b/includes/class-dynamic-image-resizer-loader.php#L66-L68
LightboxDigital/wp-dynamic-image-resizer
includes/class-dynamic-image-resizer-loader.php
Dynamic_Image_Resizer_Loader.add_filter
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); }
php
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); }
[ "public", "function", "add_filter", "(", "$", "hook", ",", "$", "component", ",", "$", "callback", ",", "$", "priority", "=", "10", ",", "$", "accepted_args", "=", "1", ")", "{", "$", "this", "->", "filters", "=", "$", "this", "->", "add", "(", "$"...
Add a new filter to the collection to be registered with WordPress. @since 1.0.0 @param string $hook The name of the WordPress filter that is being registered. @param object $component A reference to the instance of the object on which the filter is defined. @param string $callback The name of the f...
[ "Add", "a", "new", "filter", "to", "the", "collection", "to", "be", "registered", "with", "WordPress", "." ]
train
https://github.com/LightboxDigital/wp-dynamic-image-resizer/blob/cc1d67192c8463eba4c0920130abec933ed2296b/includes/class-dynamic-image-resizer-loader.php#L81-L83
LightboxDigital/wp-dynamic-image-resizer
includes/class-dynamic-image-resizer-loader.php
Dynamic_Image_Resizer_Loader.run
public function run() { foreach ( $this->filters as $hook ) { add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); } foreach ( $this->actions as $hook ) { add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['pr...
php
public function run() { foreach ( $this->filters as $hook ) { add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); } foreach ( $this->actions as $hook ) { add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['pr...
[ "public", "function", "run", "(", ")", "{", "foreach", "(", "$", "this", "->", "filters", "as", "$", "hook", ")", "{", "add_filter", "(", "$", "hook", "[", "'hook'", "]", ",", "array", "(", "$", "hook", "[", "'component'", "]", ",", "$", "hook", ...
Register the filters and actions with WordPress. @since 1.0.0
[ "Register", "the", "filters", "and", "actions", "with", "WordPress", "." ]
train
https://github.com/LightboxDigital/wp-dynamic-image-resizer/blob/cc1d67192c8463eba4c0920130abec933ed2296b/includes/class-dynamic-image-resizer-loader.php#L119-L129
sifophp/sifo-common-instance
models/i18n/translator.php
I18nTranslatorModel.getTranslations
public function getTranslations( $language, $instance, $parent_instance = false ) { $sql = <<<TRANSLATIONS SELECT id, message, comment, SUBSTRING_INDEX(GROUP_CONCAT(destination_instance ORDER BY language_depth DESC, instance_depth DESC SEPARATOR '##-##'),'##-##',1) a...
php
public function getTranslations( $language, $instance, $parent_instance = false ) { $sql = <<<TRANSLATIONS SELECT id, message, comment, SUBSTRING_INDEX(GROUP_CONCAT(destination_instance ORDER BY language_depth DESC, instance_depth DESC SEPARATOR '##-##'),'##-##',1) a...
[ "public", "function", "getTranslations", "(", "$", "language", ",", "$", "instance", ",", "$", "parent_instance", "=", "false", ")", "{", "$", "sql", "=", " <<<TRANSLATIONS\n SELECT\n id,\n message,\n comment,\n SUBSTRING_INDEX(GROUP_CONCA...
Returns the translations list for a given langauge. @param string $language @return array
[ "Returns", "the", "translations", "list", "for", "a", "given", "langauge", "." ]
train
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/models/i18n/translator.php#L16-L88
sifophp/sifo-common-instance
models/i18n/translator.php
I18nTranslatorModel.getStats
public function getStats( $instance, $parent_instance ) { $parent_instance_sql = ''; $parent_instance_sub_sql = 'm.instance = ? OR t.instance = ?'; if ( $parent_instance ) { $parent_instance_sql = ' OR instance IS NULL '; $parent_instance_sub_sql = '( m.instance = ? OR m.instance IS NULL ) AND ( t.in...
php
public function getStats( $instance, $parent_instance ) { $parent_instance_sql = ''; $parent_instance_sub_sql = 'm.instance = ? OR t.instance = ?'; if ( $parent_instance ) { $parent_instance_sql = ' OR instance IS NULL '; $parent_instance_sub_sql = '( m.instance = ? OR m.instance IS NULL ) AND ( t.in...
[ "public", "function", "getStats", "(", "$", "instance", ",", "$", "parent_instance", ")", "{", "$", "parent_instance_sql", "=", "''", ";", "$", "parent_instance_sub_sql", "=", "'m.instance = ? OR t.instance = ?'", ";", "if", "(", "$", "parent_instance", ")", "{", ...
Get stats of translations. @return array
[ "Get", "stats", "of", "translations", "." ]
train
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/models/i18n/translator.php#L115-L150
sifophp/sifo-common-instance
models/i18n/translator.php
I18nTranslatorModel.addMessage
public function addMessage( $message, $instance = null ) { $sql = <<<SQL INSERT INTO i18n_messages SET message = ?, instance = ? SQL; return $this->Execute( $sql, array( 'tag' => 'Add message', $message, ...
php
public function addMessage( $message, $instance = null ) { $sql = <<<SQL INSERT INTO i18n_messages SET message = ?, instance = ? SQL; return $this->Execute( $sql, array( 'tag' => 'Add message', $message, ...
[ "public", "function", "addMessage", "(", "$", "message", ",", "$", "instance", "=", "null", ")", "{", "$", "sql", "=", " <<<SQL\nINSERT INTO\n\ti18n_messages\nSET\n\tmessage \t= ?,\n\tinstance\t= ?\nSQL", ";", "return", "$", "this", "->", "Execute", "(", "$", "sql",...
Add message in database. @param $message @return mixed
[ "Add", "message", "in", "database", "." ]
train
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/models/i18n/translator.php#L157-L172
markwatkinson/luminous
src/Luminous/Core/Utils.php
Utils.escapeToken
public static function escapeToken($token) { $esc = &$token[2]; if (!$esc) { $str = &$token[1]; $str = htmlspecialchars($str, ENT_NOQUOTES); $esc = true; } return $token; }
php
public static function escapeToken($token) { $esc = &$token[2]; if (!$esc) { $str = &$token[1]; $str = htmlspecialchars($str, ENT_NOQUOTES); $esc = true; } return $token; }
[ "public", "static", "function", "escapeToken", "(", "$", "token", ")", "{", "$", "esc", "=", "&", "$", "token", "[", "2", "]", ";", "if", "(", "!", "$", "esc", ")", "{", "$", "str", "=", "&", "$", "token", "[", "1", "]", ";", "$", "str", "=...
@brief Escapes a token so its string is suitable for use in XML Escapes a token. If the token is already escaped, nothing changes. If the token is not escaped, the escaped flag is set (index 2) and the token text (index 1) is escaped according to the internal escaping format @param $token the token to escape @return t...
[ "@brief", "Escapes", "a", "token", "so", "its", "string", "is", "suitable", "for", "use", "in", "XML" ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Utils.php#L64-L73