id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
190,700 | icomefromthenet/ReverseRegex | src/ReverseRegex/Generator/Node.php | Node.contains | public function contains(Node $node)
{
foreach ($this->links as $linked_node) {
if ($linked_node == $node) {
return true;
}
}
return false;
} | php | public function contains(Node $node)
{
foreach ($this->links as $linked_node) {
if ($linked_node == $node) {
return true;
}
}
return false;
} | [
"public",
"function",
"contains",
"(",
"Node",
"$",
"node",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"links",
"as",
"$",
"linked_node",
")",
"{",
"if",
"(",
"$",
"linked_node",
"==",
"$",
"node",
")",
"{",
"return",
"true",
";",
"}",
"}",
"retu... | Search for node in its relations
@access public
@return boolean true if found
@param Node $node the node to search for | [
"Search",
"for",
"node",
"in",
"its",
"relations"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Generator/Node.php#L113-L122 |
190,701 | icomefromthenet/ReverseRegex | src/ReverseRegex/Parser.php | Parser.compress | public function compress()
{
$current = $this->lexer->lookahead['position'];
$this->lexer->reset();
$string = '';
while($this->lexer->moveNext() && $this->lexer->lookahead['position'] <= $current) {
$string .= $this->lexer->lookahead['value'];
}
... | php | public function compress()
{
$current = $this->lexer->lookahead['position'];
$this->lexer->reset();
$string = '';
while($this->lexer->moveNext() && $this->lexer->lookahead['position'] <= $current) {
$string .= $this->lexer->lookahead['value'];
}
... | [
"public",
"function",
"compress",
"(",
")",
"{",
"$",
"current",
"=",
"$",
"this",
"->",
"lexer",
"->",
"lookahead",
"[",
"'position'",
"]",
";",
"$",
"this",
"->",
"lexer",
"->",
"reset",
"(",
")",
";",
"$",
"string",
"=",
"''",
";",
"while",
"(",... | Compress the lexer into value string until current lookahead
@access public
@return string the compressed value string | [
"Compress",
"the",
"lexer",
"into",
"value",
"string",
"until",
"current",
"lookahead"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Parser.php#L202-L213 |
190,702 | icomefromthenet/ReverseRegex | src/ReverseRegex/Parser.php | Parser.createSubParser | static function createSubParser($name)
{
if(isset(self::$sub_parsers[$name]) === false) {
throw new ParserException('Unknown subparser at '.$name);
}
if(is_object(self::$sub_parsers[$name]) === false) {
self::$sub_parsers[$name] = new self::$sub_pars... | php | static function createSubParser($name)
{
if(isset(self::$sub_parsers[$name]) === false) {
throw new ParserException('Unknown subparser at '.$name);
}
if(is_object(self::$sub_parsers[$name]) === false) {
self::$sub_parsers[$name] = new self::$sub_pars... | [
"static",
"function",
"createSubParser",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"sub_parsers",
"[",
"$",
"name",
"]",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"ParserException",
"(",
"'Unknown subparser at '",
".",
... | Return an instance os subparser
@access public
@static
@return ReverseRegex\Parser\StrategyInterface
@param string $name the short name | [
"Return",
"an",
"instance",
"os",
"subparser"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Parser.php#L240-L252 |
190,703 | icomefromthenet/ReverseRegex | src/ReverseRegex/Parser/Short.php | Short.parse | public function parse(Scope $head, Scope $set, Lexer $lexer)
{
switch(true) {
case ($lexer->isNextToken(Lexer::T_DOT)) :
$this->convertDotToRange($head,$set,$lexer);
break;
case ($lexer->isNextToken(Lexer::T_SHORT_D)) :
case ($lexer->isNextToke... | php | public function parse(Scope $head, Scope $set, Lexer $lexer)
{
switch(true) {
case ($lexer->isNextToken(Lexer::T_DOT)) :
$this->convertDotToRange($head,$set,$lexer);
break;
case ($lexer->isNextToken(Lexer::T_SHORT_D)) :
case ($lexer->isNextToke... | [
"public",
"function",
"parse",
"(",
"Scope",
"$",
"head",
",",
"Scope",
"$",
"set",
",",
"Lexer",
"$",
"lexer",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"(",
"$",
"lexer",
"->",
"isNextToken",
"(",
"Lexer",
"::",
"T_DOT",
")",
")",
":",
... | Parse the current token for Short Codes `.` `\d` `\w`
@access public
@return ReverseRegex\Generator\Scope a new head
@param ReverseRegex\Generator\Scope $head
@param ReverseRegex\Generator\Scope $set
@param ReverseRegex\Lexer $lexer | [
"Parse",
"the",
"current",
"token",
"for",
"Short",
"Codes",
".",
"\\",
"d",
"\\",
"w"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Parser/Short.php#L28-L50 |
190,704 | icomefromthenet/ReverseRegex | src/ReverseRegex/Random/SimpleRandom.php | SimpleRandom.seed | public function seed($seed = null)
{
if($seed === null) {
$seed = 0;
}
return $this->seed = abs(intval($seed)) % 9999999 + 1;
} | php | public function seed($seed = null)
{
if($seed === null) {
$seed = 0;
}
return $this->seed = abs(intval($seed)) % 9999999 + 1;
} | [
"public",
"function",
"seed",
"(",
"$",
"seed",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"seed",
"===",
"null",
")",
"{",
"$",
"seed",
"=",
"0",
";",
"}",
"return",
"$",
"this",
"->",
"seed",
"=",
"abs",
"(",
"intval",
"(",
"$",
"seed",
")",
")... | Set the seed to use for generator
@param integer $seed the seed to use
@access public | [
"Set",
"the",
"seed",
"to",
"use",
"for",
"generator"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Random/SimpleRandom.php#L84-L91 |
190,705 | icomefromthenet/ReverseRegex | src/ReverseRegex/Random/SimpleRandom.php | SimpleRandom.generate | public function generate($min = 0, $max = null)
{
if($max === null) {
$max = 2796203;
}
if($max > 2796203) {
throw new ReverseRegexException('Max param has exceeded the maxium 2796203');
}
if ($this->seed == 0) {
$this->... | php | public function generate($min = 0, $max = null)
{
if($max === null) {
$max = 2796203;
}
if($max > 2796203) {
throw new ReverseRegexException('Max param has exceeded the maxium 2796203');
}
if ($this->seed == 0) {
$this->... | [
"public",
"function",
"generate",
"(",
"$",
"min",
"=",
"0",
",",
"$",
"max",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"max",
"===",
"null",
")",
"{",
"$",
"max",
"=",
"2796203",
";",
"}",
"if",
"(",
"$",
"max",
">",
"2796203",
")",
"{",
"throw... | Generate a random numer
@param integer $max
@param integer $max 2,796,203 largest possible max | [
"Generate",
"a",
"random",
"numer"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Random/SimpleRandom.php#L99-L117 |
190,706 | icomefromthenet/ReverseRegex | src/ReverseRegex/Random/MersenneRandom.php | MersenneRandom.mt | public function mt($index = null, $min = 0, $max = 1000)
{
static $op = array(0x0, 0x9908b0df); // Used for efficiency below to eliminate if statement
static $mt = array(); // 624 element array used to get random numbers
// Regenerate when reseeding or seeding initially
if($thi... | php | public function mt($index = null, $min = 0, $max = 1000)
{
static $op = array(0x0, 0x9908b0df); // Used for efficiency below to eliminate if statement
static $mt = array(); // 624 element array used to get random numbers
// Regenerate when reseeding or seeding initially
if($thi... | [
"public",
"function",
"mt",
"(",
"$",
"index",
"=",
"null",
",",
"$",
"min",
"=",
"0",
",",
"$",
"max",
"=",
"1000",
")",
"{",
"static",
"$",
"op",
"=",
"array",
"(",
"0x0",
",",
"0x9908b0df",
")",
";",
"// Used for efficiency below to eliminate if state... | Mersenne Twister Random Number Generator
Returns a random number. Depending on the application, you likely don't have to reseed every time as you can simply select a different index
from the last seed and get a different number.
Note: This has been tweaked for performance. It still generates the same numbers as the or... | [
"Mersenne",
"Twister",
"Random",
"Number",
"Generator",
"Returns",
"a",
"random",
"number",
".",
"Depending",
"on",
"the",
"application",
"you",
"likely",
"don",
"t",
"have",
"to",
"reseed",
"every",
"time",
"as",
"you",
"can",
"simply",
"select",
"a",
"diff... | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Random/MersenneRandom.php#L121-L161 |
190,707 | icomefromthenet/ReverseRegex | src/ReverseRegex/Generator/Scope.php | Scope.generate | public function generate(&$result,GeneratorInterface $generator)
{
if($this->count() === 0) {
throw new GeneratorException('No child scopes to call must be atleast 1');
}
$repeat_x = $this->calculateRepeatQuota($generator);
# rewind the current item
... | php | public function generate(&$result,GeneratorInterface $generator)
{
if($this->count() === 0) {
throw new GeneratorException('No child scopes to call must be atleast 1');
}
$repeat_x = $this->calculateRepeatQuota($generator);
# rewind the current item
... | [
"public",
"function",
"generate",
"(",
"&",
"$",
"result",
",",
"GeneratorInterface",
"$",
"generator",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"count",
"(",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"GeneratorException",
"(",
"'No child scopes to call must... | Generate a text string appending to result arguments
@access public
@param string $result
@param GeneratorInterface $generator | [
"Generate",
"a",
"text",
"string",
"appending",
"to",
"result",
"arguments"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Generator/Scope.php#L48-L77 |
190,708 | icomefromthenet/ReverseRegex | src/ReverseRegex/Generator/Scope.php | Scope.get | public function get($index)
{
if($index > $this->count() || $index <= 0) {
return null;
}
$this->rewind();
while(($index - 1) > 0) {
$this->next();
$index = $index - 1;
}
return $this->current();
} | php | public function get($index)
{
if($index > $this->count() || $index <= 0) {
return null;
}
$this->rewind();
while(($index - 1) > 0) {
$this->next();
$index = $index - 1;
}
return $this->current();
} | [
"public",
"function",
"get",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"$",
"index",
">",
"$",
"this",
"->",
"count",
"(",
")",
"||",
"$",
"index",
"<=",
"0",
")",
"{",
"return",
"null",
";",
"}",
"$",
"this",
"->",
"rewind",
"(",
")",
";",
"wh... | Fetch a node given an `one-based index`
@access public
@return Scope | null if none found | [
"Fetch",
"a",
"node",
"given",
"an",
"one",
"-",
"based",
"index"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Generator/Scope.php#L86-L100 |
190,709 | icomefromthenet/ReverseRegex | src/ReverseRegex/Generator/Scope.php | Scope.setMaxOccurances | public function setMaxOccurances($num)
{
if(is_integer($num) === false){
throw new GeneratorException('Number must be an integer');
}
$this[self::REPEAT_MAX_INDEX] = $num;
} | php | public function setMaxOccurances($num)
{
if(is_integer($num) === false){
throw new GeneratorException('Number must be an integer');
}
$this[self::REPEAT_MAX_INDEX] = $num;
} | [
"public",
"function",
"setMaxOccurances",
"(",
"$",
"num",
")",
"{",
"if",
"(",
"is_integer",
"(",
"$",
"num",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"GeneratorException",
"(",
"'Number must be an integer'",
")",
";",
"}",
"$",
"this",
"[",
"self",... | Sets the maximum re-occurances
@access public
@param integer $num | [
"Sets",
"the",
"maximum",
"re",
"-",
"occurances"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Generator/Scope.php#L123-L131 |
190,710 | icomefromthenet/ReverseRegex | src/ReverseRegex/Generator/Scope.php | Scope.setMinOccurances | public function setMinOccurances($num)
{
if(is_integer($num) === false){
throw new GeneratorException('Number must be an integer');
}
$this[self::REPEAT_MIN_INDEX] = $num;
} | php | public function setMinOccurances($num)
{
if(is_integer($num) === false){
throw new GeneratorException('Number must be an integer');
}
$this[self::REPEAT_MIN_INDEX] = $num;
} | [
"public",
"function",
"setMinOccurances",
"(",
"$",
"num",
")",
"{",
"if",
"(",
"is_integer",
"(",
"$",
"num",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"GeneratorException",
"(",
"'Number must be an integer'",
")",
";",
"}",
"$",
"this",
"[",
"self",... | Sets the Minimum number of re-occurances
@access public
@param integer $num | [
"Sets",
"the",
"Minimum",
"number",
"of",
"re",
"-",
"occurances"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Generator/Scope.php#L150-L157 |
190,711 | icomefromthenet/ReverseRegex | src/ReverseRegex/Generator/Scope.php | Scope.calculateRepeatQuota | public function calculateRepeatQuota(GeneratorInterface $generator)
{
$repeat_x = $this->getMinOccurances();
if($this->getOccuranceRange() > 0) {
$repeat_x = (integer) \round($generator->generate($this->getMinOccurances(),$this->getMaxOccurances()));
}
... | php | public function calculateRepeatQuota(GeneratorInterface $generator)
{
$repeat_x = $this->getMinOccurances();
if($this->getOccuranceRange() > 0) {
$repeat_x = (integer) \round($generator->generate($this->getMinOccurances(),$this->getMaxOccurances()));
}
... | [
"public",
"function",
"calculateRepeatQuota",
"(",
"GeneratorInterface",
"$",
"generator",
")",
"{",
"$",
"repeat_x",
"=",
"$",
"this",
"->",
"getMinOccurances",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getOccuranceRange",
"(",
")",
">",
"0",
")",
"{"... | Calculate a random numer of repeats given the current min-max range
@access public
@param GeneratorInterface $generator
@return Integer | [
"Calculate",
"a",
"random",
"numer",
"of",
"repeats",
"given",
"the",
"current",
"min",
"-",
"max",
"range"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Generator/Scope.php#L179-L188 |
190,712 | odan/twig-assets | src/Twig/TwigAssetsExtension.php | TwigAssetsExtension.assets | public function assets()
{
$params = func_get_args();
$assets = $params[0]['files'];
unset($params[0]['files']);
$options = $params[0];
return $this->engine->assets($assets, $options);
} | php | public function assets()
{
$params = func_get_args();
$assets = $params[0]['files'];
unset($params[0]['files']);
$options = $params[0];
return $this->engine->assets($assets, $options);
} | [
"public",
"function",
"assets",
"(",
")",
"{",
"$",
"params",
"=",
"func_get_args",
"(",
")",
";",
"$",
"assets",
"=",
"$",
"params",
"[",
"0",
"]",
"[",
"'files'",
"]",
";",
"unset",
"(",
"$",
"params",
"[",
"0",
"]",
"[",
"'files'",
"]",
")",
... | Assets function.
@return string | [
"Assets",
"function",
"."
] | a116a7bfc2fdc03d99efc0fb0168e796cbff8a22 | https://github.com/odan/twig-assets/blob/a116a7bfc2fdc03d99efc0fb0168e796cbff8a22/src/Twig/TwigAssetsExtension.php#L55-L63 |
190,713 | odan/twig-assets | src/Twig/TwigAssetsCache.php | TwigAssetsCache.removeDirectory | private function removeDirectory(string $path): bool
{
$iterator = new DirectoryIterator($path);
foreach ($iterator as $fileInfo) {
if ($fileInfo->isDot() || !$fileInfo->isDir()) {
continue;
}
$dirName = $fileInfo->getPathname();
$this-... | php | private function removeDirectory(string $path): bool
{
$iterator = new DirectoryIterator($path);
foreach ($iterator as $fileInfo) {
if ($fileInfo->isDot() || !$fileInfo->isDir()) {
continue;
}
$dirName = $fileInfo->getPathname();
$this-... | [
"private",
"function",
"removeDirectory",
"(",
"string",
"$",
"path",
")",
":",
"bool",
"{",
"$",
"iterator",
"=",
"new",
"DirectoryIterator",
"(",
"$",
"path",
")",
";",
"foreach",
"(",
"$",
"iterator",
"as",
"$",
"fileInfo",
")",
"{",
"if",
"(",
"$",... | Remove directory recursively.
This function is compatible with vfsStream.
@param string $path Path
@return bool true on success or false on failure | [
"Remove",
"directory",
"recursively",
".",
"This",
"function",
"is",
"compatible",
"with",
"vfsStream",
"."
] | a116a7bfc2fdc03d99efc0fb0168e796cbff8a22 | https://github.com/odan/twig-assets/blob/a116a7bfc2fdc03d99efc0fb0168e796cbff8a22/src/Twig/TwigAssetsCache.php#L61-L81 |
190,714 | icomefromthenet/ReverseRegex | src/ReverseRegex/Random/GeneratorFactory.php | GeneratorFactory.create | public function create($type,$seed = null)
{
$type = strtolower($type);
# check extension list
if(isset(self::$types[$type]) === true) {
# assign platform the full namespace
if(class_exists(self::$types[$type]) === false) {
throw new ... | php | public function create($type,$seed = null)
{
$type = strtolower($type);
# check extension list
if(isset(self::$types[$type]) === true) {
# assign platform the full namespace
if(class_exists(self::$types[$type]) === false) {
throw new ... | [
"public",
"function",
"create",
"(",
"$",
"type",
",",
"$",
"seed",
"=",
"null",
")",
"{",
"$",
"type",
"=",
"strtolower",
"(",
"$",
"type",
")",
";",
"# check extension list",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"types",
"[",
"$",
"type",
... | Resolve a Dcotrine DataType Class
@param string the random generator type name
@access public
@return ReverseRegex\RandomInterface
@throws PHPStats\Exception | [
"Resolve",
"a",
"Dcotrine",
"DataType",
"Class"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Random/GeneratorFactory.php#L49-L68 |
190,715 | icomefromthenet/ReverseRegex | src/ReverseRegex/ArrayCollection.php | ArrayCollection.sort | public function sort()
{
$values = $this->toArray();
ksort($values);
$this->clear();
foreach($values as $index => $value) {
$this->set($index,$value);
}
return $this;
} | php | public function sort()
{
$values = $this->toArray();
ksort($values);
$this->clear();
foreach($values as $index => $value) {
$this->set($index,$value);
}
return $this;
} | [
"public",
"function",
"sort",
"(",
")",
"{",
"$",
"values",
"=",
"$",
"this",
"->",
"toArray",
"(",
")",
";",
"ksort",
"(",
"$",
"values",
")",
";",
"$",
"this",
"->",
"clear",
"(",
")",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"index",
"... | Sort the values using a ksort
@access public
@return ArrayCollection | [
"Sort",
"the",
"values",
"using",
"a",
"ksort"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/ArrayCollection.php#L15-L27 |
190,716 | icomefromthenet/ReverseRegex | src/ReverseRegex/ArrayCollection.php | ArrayCollection.getAt | public function getAt($position)
{
if($position < $this->count() && $position < 0) {
return null;
}
$this->first();
while($position > 1) {
$this->next();
--$position;
}
return $this->current();
} | php | public function getAt($position)
{
if($position < $this->count() && $position < 0) {
return null;
}
$this->first();
while($position > 1) {
$this->next();
--$position;
}
return $this->current();
} | [
"public",
"function",
"getAt",
"(",
"$",
"position",
")",
"{",
"if",
"(",
"$",
"position",
"<",
"$",
"this",
"->",
"count",
"(",
")",
"&&",
"$",
"position",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"$",
"this",
"->",
"first",
"(",
")",
"... | Fetch a value using ones based position
@access public
@param integer $position
@return mixed | null if bad position | [
"Fetch",
"a",
"value",
"using",
"ones",
"based",
"position"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/ArrayCollection.php#L36-L50 |
190,717 | icomefromthenet/ReverseRegex | src/ReverseRegex/Parser/Quantifier.php | Quantifier.quantifyPlus | public function quantifyPlus(Scope $head, Scope $result, Lexer $lexer)
{
$min = 1;
$max = PHP_INT_MAX;
$head->setMaxOccurances($max);
$head->setMinOccurances($min);
return $head;
} | php | public function quantifyPlus(Scope $head, Scope $result, Lexer $lexer)
{
$min = 1;
$max = PHP_INT_MAX;
$head->setMaxOccurances($max);
$head->setMinOccurances($min);
return $head;
} | [
"public",
"function",
"quantifyPlus",
"(",
"Scope",
"$",
"head",
",",
"Scope",
"$",
"result",
",",
"Lexer",
"$",
"lexer",
")",
"{",
"$",
"min",
"=",
"1",
";",
"$",
"max",
"=",
"PHP_INT_MAX",
";",
"$",
"head",
"->",
"setMaxOccurances",
"(",
"$",
"max"... | Parse the current token for + quantifiers
@access public
@return ReverseRegex\Generator\Scope a new head
@param ReverseRegex\Generator\Scope $head
@param ReverseRegex\Generator\Scope $result
@param ReverseRegex\Lexer $lexer | [
"Parse",
"the",
"current",
"token",
"for",
"+",
"quantifiers"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Parser/Quantifier.php#L59-L68 |
190,718 | icomefromthenet/ReverseRegex | src/ReverseRegex/Parser/Quantifier.php | Quantifier.quantifyQuestion | public function quantifyQuestion(Scope $head, Scope $result, Lexer $lexer)
{
$min = 0;
$max = 1;
$head->setMaxOccurances($max);
$head->setMinOccurances($min);
return $head;
} | php | public function quantifyQuestion(Scope $head, Scope $result, Lexer $lexer)
{
$min = 0;
$max = 1;
$head->setMaxOccurances($max);
$head->setMinOccurances($min);
return $head;
} | [
"public",
"function",
"quantifyQuestion",
"(",
"Scope",
"$",
"head",
",",
"Scope",
"$",
"result",
",",
"Lexer",
"$",
"lexer",
")",
"{",
"$",
"min",
"=",
"0",
";",
"$",
"max",
"=",
"1",
";",
"$",
"head",
"->",
"setMaxOccurances",
"(",
"$",
"max",
")... | Parse the current token for ? quantifiers
@access public
@return ReverseRegex\Generator\Scope a new head
@param ReverseRegex\Generator\Scope $head
@param ReverseRegex\Generator\Scope $result
@param ReverseRegex\Lexer $lexer | [
"Parse",
"the",
"current",
"token",
"for",
"?",
"quantifiers"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Parser/Quantifier.php#L99-L108 |
190,719 | icomefromthenet/ReverseRegex | src/ReverseRegex/Random/SrandRandom.php | SrandRandom.seed | public function seed($seed = null)
{
$this->seed = $seed;
srand($this->seed);
return $this;
} | php | public function seed($seed = null)
{
$this->seed = $seed;
srand($this->seed);
return $this;
} | [
"public",
"function",
"seed",
"(",
"$",
"seed",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"seed",
"=",
"$",
"seed",
";",
"srand",
"(",
"$",
"this",
"->",
"seed",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the seed to use
@param $seed integer the seed to use
@access public | [
"Set",
"the",
"seed",
"to",
"use"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Random/SrandRandom.php#L112-L118 |
190,720 | icomefromthenet/ReverseRegex | src/ReverseRegex/Parser/Unicode.php | Unicode.evaluate | public function evaluate(Lexer $lexer)
{
switch(true) {
case ($lexer->isNextToken(Lexer::T_SHORT_P)) :
throw new ParserException('Property \p (Unicode Property) not supported use \x to specify unicode character or range');
break;
case ($lexer->isNextToken(... | php | public function evaluate(Lexer $lexer)
{
switch(true) {
case ($lexer->isNextToken(Lexer::T_SHORT_P)) :
throw new ParserException('Property \p (Unicode Property) not supported use \x to specify unicode character or range');
break;
case ($lexer->isNextToken(... | [
"public",
"function",
"evaluate",
"(",
"Lexer",
"$",
"lexer",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"(",
"$",
"lexer",
"->",
"isNextToken",
"(",
"Lexer",
"::",
"T_SHORT_P",
")",
")",
":",
"throw",
"new",
"ParserException",
"(",
"'Property \\... | Parse a reference | [
"Parse",
"a",
"reference"
] | 1e48eb88a0dd0220f5c234fda38ceb4d47e378ad | https://github.com/icomefromthenet/ReverseRegex/blob/1e48eb88a0dd0220f5c234fda38ceb4d47e378ad/src/ReverseRegex/Parser/Unicode.php#L38-L100 |
190,721 | fabwu/flarum-ext-sso | sample-website/Forum.php | Forum.login | public function login($username, $email)
{
$password = $this->createPassword($username);
$token = $this->getToken($username, $password);
if (empty($token)) {
$this->signup($username, $password, $email);
$token = $this->getToken($username, $password);
}
... | php | public function login($username, $email)
{
$password = $this->createPassword($username);
$token = $this->getToken($username, $password);
if (empty($token)) {
$this->signup($username, $password, $email);
$token = $this->getToken($username, $password);
}
... | [
"public",
"function",
"login",
"(",
"$",
"username",
",",
"$",
"email",
")",
"{",
"$",
"password",
"=",
"$",
"this",
"->",
"createPassword",
"(",
"$",
"username",
")",
";",
"$",
"token",
"=",
"$",
"this",
"->",
"getToken",
"(",
"$",
"username",
",",
... | Call this method after your user is successfully authenticated.
@param $username
@param $email | [
"Call",
"this",
"method",
"after",
"your",
"user",
"is",
"successfully",
"authenticated",
"."
] | 0bcbe5c0cfa847c4bbefea7fae6fde9d52734415 | https://github.com/fabwu/flarum-ext-sso/blob/0bcbe5c0cfa847c4bbefea7fae6fde9d52734415/sample-website/Forum.php#L20-L31 |
190,722 | gorriecoe/silverstripe-link | src/models/Link.php | Link.onBeforeWrite | public function onBeforeWrite()
{
parent::onBeforeWrite();
if (empty($this->Title)) {
$type = $this->Type;
switch ($type) {
case 'URL':
case 'Email':
case 'Phone':
$this->Title = $this->getField($type);
... | php | public function onBeforeWrite()
{
parent::onBeforeWrite();
if (empty($this->Title)) {
$type = $this->Type;
switch ($type) {
case 'URL':
case 'Email':
case 'Phone':
$this->Title = $this->getField($type);
... | [
"public",
"function",
"onBeforeWrite",
"(",
")",
"{",
"parent",
"::",
"onBeforeWrite",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"Title",
")",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"Type",
";",
"switch",
"(",
"$",
"type",
... | Event handler called before writing to the database.
If the title is empty, set a default based on the link. | [
"Event",
"handler",
"called",
"before",
"writing",
"to",
"the",
"database",
".",
"If",
"the",
"title",
"is",
"empty",
"set",
"a",
"default",
"based",
"on",
"the",
"link",
"."
] | a895f9b5124a26f2a4bf7a18784b62128c885777 | https://github.com/gorriecoe/silverstripe-link/blob/a895f9b5124a26f2a4bf7a18784b62128c885777/src/models/Link.php#L336-L359 |
190,723 | gorriecoe/silverstripe-link | src/models/Link.php | Link.gqlFields | public function gqlFields()
{
$fields = $this->config()->get('gql_fields');
$this->extend('updateGqlFields', $fields);
$fields = array_merge(['LinkURL'], $fields);
return $fields;
} | php | public function gqlFields()
{
$fields = $this->config()->get('gql_fields');
$this->extend('updateGqlFields', $fields);
$fields = array_merge(['LinkURL'], $fields);
return $fields;
} | [
"public",
"function",
"gqlFields",
"(",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'gql_fields'",
")",
";",
"$",
"this",
"->",
"extend",
"(",
"'updateGqlFields'",
",",
"$",
"fields",
")",
";",
"$",
"fields... | Provides a quick way to define additional methods to provideGraphQLScaffolding as Fields
@return Array | [
"Provides",
"a",
"quick",
"way",
"to",
"define",
"additional",
"methods",
"to",
"provideGraphQLScaffolding",
"as",
"Fields"
] | a895f9b5124a26f2a4bf7a18784b62128c885777 | https://github.com/gorriecoe/silverstripe-link/blob/a895f9b5124a26f2a4bf7a18784b62128c885777/src/models/Link.php#L396-L402 |
190,724 | gorriecoe/silverstripe-link | src/models/Link.php | Link.geti18nTypes | public function geti18nTypes()
{
$i18nTypes = [];
// Get translatable labels
foreach ($this->Types as $key => $label) {
$i18nTypes[$key] = _t(__CLASS__ . '.TYPE'.strtoupper($key), $label);
}
$this->extend('updatei18nTypes', $i18nTypes);
return $i18nTypes;
... | php | public function geti18nTypes()
{
$i18nTypes = [];
// Get translatable labels
foreach ($this->Types as $key => $label) {
$i18nTypes[$key] = _t(__CLASS__ . '.TYPE'.strtoupper($key), $label);
}
$this->extend('updatei18nTypes', $i18nTypes);
return $i18nTypes;
... | [
"public",
"function",
"geti18nTypes",
"(",
")",
"{",
"$",
"i18nTypes",
"=",
"[",
"]",
";",
"// Get translatable labels",
"foreach",
"(",
"$",
"this",
"->",
"Types",
"as",
"$",
"key",
"=>",
"$",
"label",
")",
"{",
"$",
"i18nTypes",
"[",
"$",
"key",
"]",... | Returns allowed link types with translations
@return array | [
"Returns",
"allowed",
"link",
"types",
"with",
"translations"
] | a895f9b5124a26f2a4bf7a18784b62128c885777 | https://github.com/gorriecoe/silverstripe-link/blob/a895f9b5124a26f2a4bf7a18784b62128c885777/src/models/Link.php#L483-L492 |
190,725 | gorriecoe/silverstripe-link | src/models/Link.php | Link.geti18nStyles | public function geti18nStyles()
{
$i18nStyles = [];
foreach ($this->styles as $key => $label) {
$i18nStyles[$key] = _t(__CLASS__ . '.STYLE' . strtoupper($key), $label);
}
$this->extend('updatei18nStyles', $i18nStyles);
return $i18nStyles;
} | php | public function geti18nStyles()
{
$i18nStyles = [];
foreach ($this->styles as $key => $label) {
$i18nStyles[$key] = _t(__CLASS__ . '.STYLE' . strtoupper($key), $label);
}
$this->extend('updatei18nStyles', $i18nStyles);
return $i18nStyles;
} | [
"public",
"function",
"geti18nStyles",
"(",
")",
"{",
"$",
"i18nStyles",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"styles",
"as",
"$",
"key",
"=>",
"$",
"label",
")",
"{",
"$",
"i18nStyles",
"[",
"$",
"key",
"]",
"=",
"_t",
"(",
"__... | Returns available styles with translations
@return array | [
"Returns",
"available",
"styles",
"with",
"translations"
] | a895f9b5124a26f2a4bf7a18784b62128c885777 | https://github.com/gorriecoe/silverstripe-link/blob/a895f9b5124a26f2a4bf7a18784b62128c885777/src/models/Link.php#L509-L517 |
190,726 | gorriecoe/silverstripe-link | src/models/Link.php | Link.getClass | public function getClass()
{
if ($this->style) {
$this->setClass($this->style);
}
$classes = $this->classes;
$this->extend('updateClasses', $classes);
if (Count($classes)) {
return implode(' ', $classes);
}
} | php | public function getClass()
{
if ($this->style) {
$this->setClass($this->style);
}
$classes = $this->classes;
$this->extend('updateClasses', $classes);
if (Count($classes)) {
return implode(' ', $classes);
}
} | [
"public",
"function",
"getClass",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"style",
")",
"{",
"$",
"this",
"->",
"setClass",
"(",
"$",
"this",
"->",
"style",
")",
";",
"}",
"$",
"classes",
"=",
"$",
"this",
"->",
"classes",
";",
"$",
"this",
... | Returns the css classes
@return string | [
"Returns",
"the",
"css",
"classes"
] | a895f9b5124a26f2a4bf7a18784b62128c885777 | https://github.com/gorriecoe/silverstripe-link/blob/a895f9b5124a26f2a4bf7a18784b62128c885777/src/models/Link.php#L571-L582 |
190,727 | gorriecoe/silverstripe-link | src/models/Link.php | Link.getCurrentPage | public function getCurrentPage()
{
$currentPage = Director::get_current_page();
if ($currentPage instanceof ContentController) {
$currentPage = $currentPage->data();
}
return $currentPage;
} | php | public function getCurrentPage()
{
$currentPage = Director::get_current_page();
if ($currentPage instanceof ContentController) {
$currentPage = $currentPage->data();
}
return $currentPage;
} | [
"public",
"function",
"getCurrentPage",
"(",
")",
"{",
"$",
"currentPage",
"=",
"Director",
"::",
"get_current_page",
"(",
")",
";",
"if",
"(",
"$",
"currentPage",
"instanceof",
"ContentController",
")",
"{",
"$",
"currentPage",
"=",
"$",
"currentPage",
"->",
... | Returns the current page scope
@return Controller | [
"Returns",
"the",
"current",
"page",
"scope"
] | a895f9b5124a26f2a4bf7a18784b62128c885777 | https://github.com/gorriecoe/silverstripe-link/blob/a895f9b5124a26f2a4bf7a18784b62128c885777/src/models/Link.php#L635-L642 |
190,728 | gorriecoe/silverstripe-link | src/models/Link.php | Link.LinkingMode | public function LinkingMode()
{
if ($this->isCurrent()) {
return $this->config()->get('linking_mode_current');
} elseif ($this->isSection()) {
return $this->config()->get('linking_mode_section');
} else {
return $this->config()->get('linking_mode_default')... | php | public function LinkingMode()
{
if ($this->isCurrent()) {
return $this->config()->get('linking_mode_current');
} elseif ($this->isSection()) {
return $this->config()->get('linking_mode_section');
} else {
return $this->config()->get('linking_mode_default')... | [
"public",
"function",
"LinkingMode",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isCurrent",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'linking_mode_current'",
")",
";",
"}",
"elseif",
"(",
"$",
"this",... | Return "link", "current" or "section" depending on if this page is the current page, or not on the current page
but in the current section.
@return string | [
"Return",
"link",
"current",
"or",
"section",
"depending",
"on",
"if",
"this",
"page",
"is",
"the",
"current",
"page",
"or",
"not",
"on",
"the",
"current",
"page",
"but",
"in",
"the",
"current",
"section",
"."
] | a895f9b5124a26f2a4bf7a18784b62128c885777 | https://github.com/gorriecoe/silverstripe-link/blob/a895f9b5124a26f2a4bf7a18784b62128c885777/src/models/Link.php#L721-L730 |
190,729 | gorriecoe/silverstripe-link | src/models/Link.php | Link.getTypeLabel | public function getTypeLabel()
{
$types = $this->config()->get('types');
return isset($types[$this->Type]) ? _t(__CLASS__ . '.TYPE' . strtoupper($this->Type), $types[$this->Type]) : null;
} | php | public function getTypeLabel()
{
$types = $this->config()->get('types');
return isset($types[$this->Type]) ? _t(__CLASS__ . '.TYPE' . strtoupper($this->Type), $types[$this->Type]) : null;
} | [
"public",
"function",
"getTypeLabel",
"(",
")",
"{",
"$",
"types",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'types'",
")",
";",
"return",
"isset",
"(",
"$",
"types",
"[",
"$",
"this",
"->",
"Type",
"]",
")",
"?",
"_t",
"(",
... | Returns the description label of this links type
@return string | [
"Returns",
"the",
"description",
"label",
"of",
"this",
"links",
"type"
] | a895f9b5124a26f2a4bf7a18784b62128c885777 | https://github.com/gorriecoe/silverstripe-link/blob/a895f9b5124a26f2a4bf7a18784b62128c885777/src/models/Link.php#L736-L740 |
190,730 | gorriecoe/silverstripe-link | src/models/Link.php | Link.forTemplate | public function forTemplate()
{
$link = '';
if ($this->LinkURL) {
$link = $this->renderWith($this->RenderTemplates);
}
$this->extend('updateTemplate', $link);
return $link;
} | php | public function forTemplate()
{
$link = '';
if ($this->LinkURL) {
$link = $this->renderWith($this->RenderTemplates);
}
$this->extend('updateTemplate', $link);
return $link;
} | [
"public",
"function",
"forTemplate",
"(",
")",
"{",
"$",
"link",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"LinkURL",
")",
"{",
"$",
"link",
"=",
"$",
"this",
"->",
"renderWith",
"(",
"$",
"this",
"->",
"RenderTemplates",
")",
";",
"}",
"$",
... | Renders an HTML anchor attribute for this link
@return \SilverStripe\ORM\FieldType\DBHTMLText | [
"Renders",
"an",
"HTML",
"anchor",
"attribute",
"for",
"this",
"link"
] | a895f9b5124a26f2a4bf7a18784b62128c885777 | https://github.com/gorriecoe/silverstripe-link/blob/a895f9b5124a26f2a4bf7a18784b62128c885777/src/models/Link.php#L757-L765 |
190,731 | Josantonius/PHP-Cookie | src/Cookie.php | Cookie.get | public static function get($key = '')
{
if (isset($_COOKIE[self::$prefix . $key])) {
return $_COOKIE[self::$prefix . $key];
}
return (isset($_COOKIE) && count($_COOKIE)) ? $_COOKIE : false;
} | php | public static function get($key = '')
{
if (isset($_COOKIE[self::$prefix . $key])) {
return $_COOKIE[self::$prefix . $key];
}
return (isset($_COOKIE) && count($_COOKIE)) ? $_COOKIE : false;
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"key",
"=",
"''",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_COOKIE",
"[",
"self",
"::",
"$",
"prefix",
".",
"$",
"key",
"]",
")",
")",
"{",
"return",
"$",
"_COOKIE",
"[",
"self",
"::",
"$",
"pref... | Get item from cookie.
@param string $key → item to look for in cookie
@return mixed|false → returns cookie value, cookies array or false | [
"Get",
"item",
"from",
"cookie",
"."
] | 8cf9e16fb7d10e083224eebbc609d9ed1d89b4f5 | https://github.com/Josantonius/PHP-Cookie/blob/8cf9e16fb7d10e083224eebbc609d9ed1d89b4f5/src/Cookie.php#L50-L57 |
190,732 | Josantonius/PHP-Cookie | src/Cookie.php | Cookie.pull | public static function pull($key)
{
if (isset($_COOKIE[self::$prefix . $key])) {
setcookie(self::$prefix . $key, '', time() - 3600, '/');
return $_COOKIE[self::$prefix . $key];
}
return false;
} | php | public static function pull($key)
{
if (isset($_COOKIE[self::$prefix . $key])) {
setcookie(self::$prefix . $key, '', time() - 3600, '/');
return $_COOKIE[self::$prefix . $key];
}
return false;
} | [
"public",
"static",
"function",
"pull",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_COOKIE",
"[",
"self",
"::",
"$",
"prefix",
".",
"$",
"key",
"]",
")",
")",
"{",
"setcookie",
"(",
"self",
"::",
"$",
"prefix",
".",
"$",
"key",
"... | Extract item from cookie then delete cookie and return the item.
@param string $key → item to extract
@return string|false → return item or false when key does not exists | [
"Extract",
"item",
"from",
"cookie",
"then",
"delete",
"cookie",
"and",
"return",
"the",
"item",
"."
] | 8cf9e16fb7d10e083224eebbc609d9ed1d89b4f5 | https://github.com/Josantonius/PHP-Cookie/blob/8cf9e16fb7d10e083224eebbc609d9ed1d89b4f5/src/Cookie.php#L66-L75 |
190,733 | Josantonius/PHP-Cookie | src/Cookie.php | Cookie.destroy | public static function destroy($key = '')
{
if (isset($_COOKIE[self::$prefix . $key])) {
setcookie(self::$prefix . $key, '', time() - 3600, '/');
return true;
}
if (count($_COOKIE) > 0) {
foreach ($_COOKIE as $key => $value) {
setcookie($... | php | public static function destroy($key = '')
{
if (isset($_COOKIE[self::$prefix . $key])) {
setcookie(self::$prefix . $key, '', time() - 3600, '/');
return true;
}
if (count($_COOKIE) > 0) {
foreach ($_COOKIE as $key => $value) {
setcookie($... | [
"public",
"static",
"function",
"destroy",
"(",
"$",
"key",
"=",
"''",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_COOKIE",
"[",
"self",
"::",
"$",
"prefix",
".",
"$",
"key",
"]",
")",
")",
"{",
"setcookie",
"(",
"self",
"::",
"$",
"prefix",
".",
... | Empties and destroys the cookies.
@param string $key → cookie name to destroy. Not set to delete all
@return boolean | [
"Empties",
"and",
"destroys",
"the",
"cookies",
"."
] | 8cf9e16fb7d10e083224eebbc609d9ed1d89b4f5 | https://github.com/Josantonius/PHP-Cookie/blob/8cf9e16fb7d10e083224eebbc609d9ed1d89b4f5/src/Cookie.php#L84-L101 |
190,734 | Josantonius/PHP-Cookie | src/Cookie.php | Cookie.setPrefix | public static function setPrefix($prefix)
{
if (!empty($prefix) && is_string($prefix)) {
self::$prefix = $prefix;
return true;
}
return false;
} | php | public static function setPrefix($prefix)
{
if (!empty($prefix) && is_string($prefix)) {
self::$prefix = $prefix;
return true;
}
return false;
} | [
"public",
"static",
"function",
"setPrefix",
"(",
"$",
"prefix",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"prefix",
")",
"&&",
"is_string",
"(",
"$",
"prefix",
")",
")",
"{",
"self",
"::",
"$",
"prefix",
"=",
"$",
"prefix",
";",
"return",
"true... | Set cookie prefix.
@since 1.1.6
@param string $prefix → cookie prefix
@return boolean | [
"Set",
"cookie",
"prefix",
"."
] | 8cf9e16fb7d10e083224eebbc609d9ed1d89b4f5 | https://github.com/Josantonius/PHP-Cookie/blob/8cf9e16fb7d10e083224eebbc609d9ed1d89b4f5/src/Cookie.php#L112-L120 |
190,735 | ultraleettech/currency-rates | src/Providers/YahooProvider.php | YahooProvider.historical | public function historical($date, $base = 'EUR', $targets = [])
{
// Yahoo Finance API no longer provides historical rates...
// Let's just trigger a warning and return latest rates instead.
$this->date($date);
return $this->latest($base, $targets);
} | php | public function historical($date, $base = 'EUR', $targets = [])
{
// Yahoo Finance API no longer provides historical rates...
// Let's just trigger a warning and return latest rates instead.
$this->date($date);
return $this->latest($base, $targets);
} | [
"public",
"function",
"historical",
"(",
"$",
"date",
",",
"$",
"base",
"=",
"'EUR'",
",",
"$",
"targets",
"=",
"[",
"]",
")",
"{",
"// Yahoo Finance API no longer provides historical rates...",
"// Let's just trigger a warning and return latest rates instead.",
"$",
"thi... | Unsupported by Yahoo Finance API.
@param \DateTime $date
@param string $base
@param array $targets
@return \Ultraleet\CurrencyRates\Contracts\Result | [
"Unsupported",
"by",
"Yahoo",
"Finance",
"API",
"."
] | 89405dd101f971f7bb667a048b10feb27ee2ed97 | https://github.com/ultraleettech/currency-rates/blob/89405dd101f971f7bb667a048b10feb27ee2ed97/src/Providers/YahooProvider.php#L141-L148 |
190,736 | ultraleettech/currency-rates | src/Providers/YahooProvider.php | YahooProvider.query | protected function query($yql)
{
$params = $this->urlParams;
$params['q'] = $yql;
$url = $this->url . '?' . http_build_query($params);
// query the API
try {
$response = $this->guzzle->request('GET', $url);
} catch (TransferException $e) {
thr... | php | protected function query($yql)
{
$params = $this->urlParams;
$params['q'] = $yql;
$url = $this->url . '?' . http_build_query($params);
// query the API
try {
$response = $this->guzzle->request('GET', $url);
} catch (TransferException $e) {
thr... | [
"protected",
"function",
"query",
"(",
"$",
"yql",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"urlParams",
";",
"$",
"params",
"[",
"'q'",
"]",
"=",
"$",
"yql",
";",
"$",
"url",
"=",
"$",
"this",
"->",
"url",
".",
"'?'",
".",
"http_build_qu... | Perform the API query and return results as an array.
@param string $yql YQL query to send.
@return array | [
"Perform",
"the",
"API",
"query",
"and",
"return",
"results",
"as",
"an",
"array",
"."
] | 89405dd101f971f7bb667a048b10feb27ee2ed97 | https://github.com/ultraleettech/currency-rates/blob/89405dd101f971f7bb667a048b10feb27ee2ed97/src/Providers/YahooProvider.php#L156-L177 |
190,737 | ultraleettech/currency-rates | src/Providers/YahooProvider.php | YahooProvider.targetsToString | protected static function targetsToString($targets, $prefix = '', $suffix = '')
{
$array = [];
foreach ($targets as $currency) {
$array[] = '"' . $prefix . $currency . $suffix . '"';
}
return implode(', ', $array);
} | php | protected static function targetsToString($targets, $prefix = '', $suffix = '')
{
$array = [];
foreach ($targets as $currency) {
$array[] = '"' . $prefix . $currency . $suffix . '"';
}
return implode(', ', $array);
} | [
"protected",
"static",
"function",
"targetsToString",
"(",
"$",
"targets",
",",
"$",
"prefix",
"=",
"''",
",",
"$",
"suffix",
"=",
"''",
")",
"{",
"$",
"array",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"targets",
"as",
"$",
"currency",
")",
"{",
"$... | Convert targets array to string for using in the YQL query.
@param array $targets
@param string $prefix Prefix to add to each currency (e.g. base currency)
@param string $suffix Suffix to add to each currency
@return string | [
"Convert",
"targets",
"array",
"to",
"string",
"for",
"using",
"in",
"the",
"YQL",
"query",
"."
] | 89405dd101f971f7bb667a048b10feb27ee2ed97 | https://github.com/ultraleettech/currency-rates/blob/89405dd101f971f7bb667a048b10feb27ee2ed97/src/Providers/YahooProvider.php#L187-L195 |
190,738 | ultraleettech/currency-rates | src/AbstractProvider.php | AbstractProvider.target | public function target($currencies)
{
if (!is_array($currencies)) {
$currencies = [$currencies];
}
$this->targets = $currencies;
return $this;
} | php | public function target($currencies)
{
if (!is_array($currencies)) {
$currencies = [$currencies];
}
$this->targets = $currencies;
return $this;
} | [
"public",
"function",
"target",
"(",
"$",
"currencies",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"currencies",
")",
")",
"{",
"$",
"currencies",
"=",
"[",
"$",
"currencies",
"]",
";",
"}",
"$",
"this",
"->",
"targets",
"=",
"$",
"currencies",
... | Set the target currencies.
@param array|string $currencies
@return self | [
"Set",
"the",
"target",
"currencies",
"."
] | 89405dd101f971f7bb667a048b10feb27ee2ed97 | https://github.com/ultraleettech/currency-rates/blob/89405dd101f971f7bb667a048b10feb27ee2ed97/src/AbstractProvider.php#L50-L59 |
190,739 | ultraleettech/currency-rates | src/AbstractProvider.php | AbstractProvider.get | public function get()
{
if ($this->date) {
$result = $this->historical($this->date, $this->base, $this->targets);
} else {
$result = $this->latest($this->base, $this->targets);
}
// Ensure the result object is valid.
if (!$result instanceof ResultCont... | php | public function get()
{
if ($this->date) {
$result = $this->historical($this->date, $this->base, $this->targets);
} else {
$result = $this->latest($this->base, $this->targets);
}
// Ensure the result object is valid.
if (!$result instanceof ResultCont... | [
"public",
"function",
"get",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"date",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"historical",
"(",
"$",
"this",
"->",
"date",
",",
"$",
"this",
"->",
"base",
",",
"$",
"this",
"->",
"targets",
... | Query the API.
@return \Ultraleet\CurrencyRates\Contracts\Result | [
"Query",
"the",
"API",
"."
] | 89405dd101f971f7bb667a048b10feb27ee2ed97 | https://github.com/ultraleettech/currency-rates/blob/89405dd101f971f7bb667a048b10feb27ee2ed97/src/AbstractProvider.php#L96-L122 |
190,740 | twoquethree/laravel-uikit | src/UIkitPreset.php | UIkitPreset.updateBootstrapping | protected static function updateBootstrapping()
{
copy(__DIR__.'/uikit-stubs/webpack.mix.js', base_path('webpack.mix.js'));
if (!self::expectsAssetsFolder()) {
file_put_contents(
base_path('webpack.mix.js'),
str_replace(
'assets/',
... | php | protected static function updateBootstrapping()
{
copy(__DIR__.'/uikit-stubs/webpack.mix.js', base_path('webpack.mix.js'));
if (!self::expectsAssetsFolder()) {
file_put_contents(
base_path('webpack.mix.js'),
str_replace(
'assets/',
... | [
"protected",
"static",
"function",
"updateBootstrapping",
"(",
")",
"{",
"copy",
"(",
"__DIR__",
".",
"'/uikit-stubs/webpack.mix.js'",
",",
"base_path",
"(",
"'webpack.mix.js'",
")",
")",
";",
"if",
"(",
"!",
"self",
"::",
"expectsAssetsFolder",
"(",
")",
")",
... | Update the bootstrapping files.
@return void | [
"Update",
"the",
"bootstrapping",
"files",
"."
] | 39fc08a2c31de269d7cfb9633dbd954b19ed7970 | https://github.com/twoquethree/laravel-uikit/blob/39fc08a2c31de269d7cfb9633dbd954b19ed7970/src/UIkitPreset.php#L66-L80 |
190,741 | sebastiansulinski/laravel-currency | src/Currency.php | Currency.decimal | public function decimal($values, string $currency = null, int $decimal_points = 2): string
{
[$className, $value] = $this->classAndValue($values, $currency);
return (new $className)->decimal($value, $decimal_points);
} | php | public function decimal($values, string $currency = null, int $decimal_points = 2): string
{
[$className, $value] = $this->classAndValue($values, $currency);
return (new $className)->decimal($value, $decimal_points);
} | [
"public",
"function",
"decimal",
"(",
"$",
"values",
",",
"string",
"$",
"currency",
"=",
"null",
",",
"int",
"$",
"decimal_points",
"=",
"2",
")",
":",
"string",
"{",
"[",
"$",
"className",
",",
"$",
"value",
"]",
"=",
"$",
"this",
"->",
"classAndVa... | Convert value to decimal.
@param string|array $values
@param string|null $currency
@param int $decimal_points
@return string | [
"Convert",
"value",
"to",
"decimal",
"."
] | a4e266565b83fe9404238cc2d6f0164f23c83e0d | https://github.com/sebastiansulinski/laravel-currency/blob/a4e266565b83fe9404238cc2d6f0164f23c83e0d/src/Currency.php#L33-L38 |
190,742 | sebastiansulinski/laravel-currency | src/Currency.php | Currency.integer | public function integer($values, string $currency = null): int
{
[$className, $value] = $this->classAndValue($values, $currency, false);
return (new $className)->integer($value);
} | php | public function integer($values, string $currency = null): int
{
[$className, $value] = $this->classAndValue($values, $currency, false);
return (new $className)->integer($value);
} | [
"public",
"function",
"integer",
"(",
"$",
"values",
",",
"string",
"$",
"currency",
"=",
"null",
")",
":",
"int",
"{",
"[",
"$",
"className",
",",
"$",
"value",
"]",
"=",
"$",
"this",
"->",
"classAndValue",
"(",
"$",
"values",
",",
"$",
"currency",
... | Convert value to integer.
@param string|array $values
@param string|null $currency
@return int | [
"Convert",
"value",
"to",
"integer",
"."
] | a4e266565b83fe9404238cc2d6f0164f23c83e0d | https://github.com/sebastiansulinski/laravel-currency/blob/a4e266565b83fe9404238cc2d6f0164f23c83e0d/src/Currency.php#L47-L52 |
190,743 | sebastiansulinski/laravel-currency | src/Currency.php | Currency.withPostfix | public function withPostfix($values, string $currency = null, int $decimal_points = null): string
{
[$className, $value] = $this->classAndValue($values, $currency);
return (new $className)->postfix($value, $decimal_points);
} | php | public function withPostfix($values, string $currency = null, int $decimal_points = null): string
{
[$className, $value] = $this->classAndValue($values, $currency);
return (new $className)->postfix($value, $decimal_points);
} | [
"public",
"function",
"withPostfix",
"(",
"$",
"values",
",",
"string",
"$",
"currency",
"=",
"null",
",",
"int",
"$",
"decimal_points",
"=",
"null",
")",
":",
"string",
"{",
"[",
"$",
"className",
",",
"$",
"value",
"]",
"=",
"$",
"this",
"->",
"cla... | Display value as decimal with currency label.
@param string|array $values
@param string|null $currency
@param int|null $decimal_points
@return string | [
"Display",
"value",
"as",
"decimal",
"with",
"currency",
"label",
"."
] | a4e266565b83fe9404238cc2d6f0164f23c83e0d | https://github.com/sebastiansulinski/laravel-currency/blob/a4e266565b83fe9404238cc2d6f0164f23c83e0d/src/Currency.php#L77-L82 |
190,744 | sebastiansulinski/laravel-currency | src/Currency.php | Currency.withPrefixAndPostfix | public function withPrefixAndPostfix($values, string $currency = null, int $decimal_points = null): string
{
[$className, $value] = $this->classAndValue($values, $currency);
return (new $className)->prefixPostfix($value, $decimal_points);
} | php | public function withPrefixAndPostfix($values, string $currency = null, int $decimal_points = null): string
{
[$className, $value] = $this->classAndValue($values, $currency);
return (new $className)->prefixPostfix($value, $decimal_points);
} | [
"public",
"function",
"withPrefixAndPostfix",
"(",
"$",
"values",
",",
"string",
"$",
"currency",
"=",
"null",
",",
"int",
"$",
"decimal_points",
"=",
"null",
")",
":",
"string",
"{",
"[",
"$",
"className",
",",
"$",
"value",
"]",
"=",
"$",
"this",
"->... | Display value as decimal with currency symbol and label.
@param string|array $values
@param string|null $currency
@param int|null $decimal_points
@return string | [
"Display",
"value",
"as",
"decimal",
"with",
"currency",
"symbol",
"and",
"label",
"."
] | a4e266565b83fe9404238cc2d6f0164f23c83e0d | https://github.com/sebastiansulinski/laravel-currency/blob/a4e266565b83fe9404238cc2d6f0164f23c83e0d/src/Currency.php#L92-L97 |
190,745 | sebastiansulinski/laravel-currency | src/Currency.php | Currency.classAndValue | private function classAndValue($values, string $currency = null, bool $asFloat = true): array
{
$className = $this->getClass($currency);
$value = is_array($values) ? $this->getValue($values, $currency) : $values;
if ($asFloat && $this->provider->config->value_as_integer) {
$val... | php | private function classAndValue($values, string $currency = null, bool $asFloat = true): array
{
$className = $this->getClass($currency);
$value = is_array($values) ? $this->getValue($values, $currency) : $values;
if ($asFloat && $this->provider->config->value_as_integer) {
$val... | [
"private",
"function",
"classAndValue",
"(",
"$",
"values",
",",
"string",
"$",
"currency",
"=",
"null",
",",
"bool",
"$",
"asFloat",
"=",
"true",
")",
":",
"array",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"getClass",
"(",
"$",
"currency",
")",
... | Get class and value.
@param string|array $values
@param string|null $currency
@param bool $asFloat
@return array | [
"Get",
"class",
"and",
"value",
"."
] | a4e266565b83fe9404238cc2d6f0164f23c83e0d | https://github.com/sebastiansulinski/laravel-currency/blob/a4e266565b83fe9404238cc2d6f0164f23c83e0d/src/Currency.php#L107-L118 |
190,746 | sebastiansulinski/laravel-currency | src/Currency.php | Currency.options | public function options(): array
{
$currencies = $this->provider->config->get('currencies');
$options = [];
foreach ($currencies as $key => $currency) {
$options[] = new Option($key, new $currency);
}
return $options;
} | php | public function options(): array
{
$currencies = $this->provider->config->get('currencies');
$options = [];
foreach ($currencies as $key => $currency) {
$options[] = new Option($key, new $currency);
}
return $options;
} | [
"public",
"function",
"options",
"(",
")",
":",
"array",
"{",
"$",
"currencies",
"=",
"$",
"this",
"->",
"provider",
"->",
"config",
"->",
"get",
"(",
"'currencies'",
")",
";",
"$",
"options",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"currencies",
"a... | Get a an array of available currencies.
@return array | [
"Get",
"a",
"an",
"array",
"of",
"available",
"currencies",
"."
] | a4e266565b83fe9404238cc2d6f0164f23c83e0d | https://github.com/sebastiansulinski/laravel-currency/blob/a4e266565b83fe9404238cc2d6f0164f23c83e0d/src/Currency.php#L154-L167 |
190,747 | sebastiansulinski/laravel-currency | src/Currencies/BaseCurrency.php | BaseCurrency.value | public function value(float $value, int $decimal_points = null): string
{
if (is_null($decimal_points)) {
return $value;
}
return $this->decimal($value, $decimal_points);
} | php | public function value(float $value, int $decimal_points = null): string
{
if (is_null($decimal_points)) {
return $value;
}
return $this->decimal($value, $decimal_points);
} | [
"public",
"function",
"value",
"(",
"float",
"$",
"value",
",",
"int",
"$",
"decimal_points",
"=",
"null",
")",
":",
"string",
"{",
"if",
"(",
"is_null",
"(",
"$",
"decimal_points",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"return",
"$",
"thi... | Get formatted value.
@param float $value
@param int|null $decimal_points
@return string | [
"Get",
"formatted",
"value",
"."
] | a4e266565b83fe9404238cc2d6f0164f23c83e0d | https://github.com/sebastiansulinski/laravel-currency/blob/a4e266565b83fe9404238cc2d6f0164f23c83e0d/src/Currencies/BaseCurrency.php#L47-L54 |
190,748 | Flobbos/laravel-crudable | src/Crudable/Crudable.php | Crudable.get | public function get($id = null){
if(!is_null($id)){
return $this->find($id);
}
return $this->model->get();
} | php | public function get($id = null){
if(!is_null($id)){
return $this->find($id);
}
return $this->model->get();
} | [
"public",
"function",
"get",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"id",
")",
")",
"{",
"return",
"$",
"this",
"->",
"find",
"(",
"$",
"id",
")",
";",
"}",
"return",
"$",
"this",
"->",
"model",
"->",
"get... | Get a single item or collection
@param int $id
@return Model/Collection | [
"Get",
"a",
"single",
"item",
"or",
"collection"
] | 02ccc148de1962cfb7be857f47cfe19ff19bd9bc | https://github.com/Flobbos/laravel-crudable/blob/02ccc148de1962cfb7be857f47cfe19ff19bd9bc/src/Crudable/Crudable.php#L25-L30 |
190,749 | Flobbos/laravel-crudable | src/Crudable/Crudable.php | Crudable.getTrash | public function getTrash($id = null){
if(!is_null($id)){
return $this->getTrashedItem($id);
}
return $this->model->onlyTrashed()->get();
} | php | public function getTrash($id = null){
if(!is_null($id)){
return $this->getTrashedItem($id);
}
return $this->model->onlyTrashed()->get();
} | [
"public",
"function",
"getTrash",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"id",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getTrashedItem",
"(",
"$",
"id",
")",
";",
"}",
"return",
"$",
"this",
"->",
"model",... | Retrieve single trashed item or all
@param int $id
@return Model/Collection | [
"Retrieve",
"single",
"trashed",
"item",
"or",
"all"
] | 02ccc148de1962cfb7be857f47cfe19ff19bd9bc | https://github.com/Flobbos/laravel-crudable/blob/02ccc148de1962cfb7be857f47cfe19ff19bd9bc/src/Crudable/Crudable.php#L72-L77 |
190,750 | Flobbos/laravel-crudable | src/Crudable/Crudable.php | Crudable.orderBy | public function orderBy($field, $order = 'asc'){
$this->model = $this->model->orderBy(...func_get_args());
return $this;
} | php | public function orderBy($field, $order = 'asc'){
$this->model = $this->model->orderBy(...func_get_args());
return $this;
} | [
"public",
"function",
"orderBy",
"(",
"$",
"field",
",",
"$",
"order",
"=",
"'asc'",
")",
"{",
"$",
"this",
"->",
"model",
"=",
"$",
"this",
"->",
"model",
"->",
"orderBy",
"(",
"...",
"func_get_args",
"(",
")",
")",
";",
"return",
"$",
"this",
";"... | Order the collection you pull
@param string $field
@param string $order default asc | [
"Order",
"the",
"collection",
"you",
"pull"
] | 02ccc148de1962cfb7be857f47cfe19ff19bd9bc | https://github.com/Flobbos/laravel-crudable/blob/02ccc148de1962cfb7be857f47cfe19ff19bd9bc/src/Crudable/Crudable.php#L112-L115 |
190,751 | Flobbos/laravel-crudable | src/Crudable/Crudable.php | Crudable.create | public function create(array $data){
$model = $this->model->create($data);
//check for hasMany
if($this->validateRelationData($this->withHasMany,'many')){
$model->{$this->withHasMany['relation']}()->saveMany($this->withHasMany['data']);
}
//check for belongsToMany
... | php | public function create(array $data){
$model = $this->model->create($data);
//check for hasMany
if($this->validateRelationData($this->withHasMany,'many')){
$model->{$this->withHasMany['relation']}()->saveMany($this->withHasMany['data']);
}
//check for belongsToMany
... | [
"public",
"function",
"create",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"model",
"->",
"create",
"(",
"$",
"data",
")",
";",
"//check for hasMany",
"if",
"(",
"$",
"this",
"->",
"validateRelationData",
"(",
"$",
"this... | Create new database entry including related models
@param array $data
@return Model | [
"Create",
"new",
"database",
"entry",
"including",
"related",
"models"
] | 02ccc148de1962cfb7be857f47cfe19ff19bd9bc | https://github.com/Flobbos/laravel-crudable/blob/02ccc148de1962cfb7be857f47cfe19ff19bd9bc/src/Crudable/Crudable.php#L122-L133 |
190,752 | Flobbos/laravel-crudable | src/Crudable/Crudable.php | Crudable.delete | public function delete($id, $hardDelete = false){
if($hardDelete){
return $this->model->withTrashed()->find($id)->forceDelete($id);
}
return $this->model->find($id)->delete($id);
} | php | public function delete($id, $hardDelete = false){
if($hardDelete){
return $this->model->withTrashed()->find($id)->forceDelete($id);
}
return $this->model->find($id)->delete($id);
} | [
"public",
"function",
"delete",
"(",
"$",
"id",
",",
"$",
"hardDelete",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"hardDelete",
")",
"{",
"return",
"$",
"this",
"->",
"model",
"->",
"withTrashed",
"(",
")",
"->",
"find",
"(",
"$",
"id",
")",
"->",
... | Delete model either soft or hard delete
@param int $id
@param bool $hardDelete
@return bool | [
"Delete",
"model",
"either",
"soft",
"or",
"hard",
"delete"
] | 02ccc148de1962cfb7be857f47cfe19ff19bd9bc | https://github.com/Flobbos/laravel-crudable/blob/02ccc148de1962cfb7be857f47cfe19ff19bd9bc/src/Crudable/Crudable.php#L155-L160 |
190,753 | Flobbos/laravel-crudable | src/Crudable/Crudable.php | Crudable.withHasMany | public function withHasMany(array $data, $relatedModel, $relation_name){
$this->withHasMany['relation'] = $relation_name;
foreach($data as $k=>$v){
$this->withHasMany['data'][] = new $relatedModel($v);
}
return $this;
} | php | public function withHasMany(array $data, $relatedModel, $relation_name){
$this->withHasMany['relation'] = $relation_name;
foreach($data as $k=>$v){
$this->withHasMany['data'][] = new $relatedModel($v);
}
return $this;
} | [
"public",
"function",
"withHasMany",
"(",
"array",
"$",
"data",
",",
"$",
"relatedModel",
",",
"$",
"relation_name",
")",
"{",
"$",
"this",
"->",
"withHasMany",
"[",
"'relation'",
"]",
"=",
"$",
"relation_name",
";",
"foreach",
"(",
"$",
"data",
"as",
"$... | Set related models that need to be created
for a hasMany relationship
@param array $data
@param string $relatedModel
@return self | [
"Set",
"related",
"models",
"that",
"need",
"to",
"be",
"created",
"for",
"a",
"hasMany",
"relationship"
] | 02ccc148de1962cfb7be857f47cfe19ff19bd9bc | https://github.com/Flobbos/laravel-crudable/blob/02ccc148de1962cfb7be857f47cfe19ff19bd9bc/src/Crudable/Crudable.php#L178-L184 |
190,754 | Flobbos/laravel-crudable | src/Crudable/Crudable.php | Crudable.handleUpload | public function handleUpload(\Illuminate\Http\Request $request, $fieldname = 'photo', $folder = 'images', $storage_disk = 'public', $randomize = true){
if(is_null($request->file($fieldname)) || !$request->file($fieldname)->isValid()){
throw new \Exception(trans('crud.invalid_file_upload'));
... | php | public function handleUpload(\Illuminate\Http\Request $request, $fieldname = 'photo', $folder = 'images', $storage_disk = 'public', $randomize = true){
if(is_null($request->file($fieldname)) || !$request->file($fieldname)->isValid()){
throw new \Exception(trans('crud.invalid_file_upload'));
... | [
"public",
"function",
"handleUpload",
"(",
"\\",
"Illuminate",
"\\",
"Http",
"\\",
"Request",
"$",
"request",
",",
"$",
"fieldname",
"=",
"'photo'",
",",
"$",
"folder",
"=",
"'images'",
",",
"$",
"storage_disk",
"=",
"'public'",
",",
"$",
"randomize",
"=",... | Handle a file upload
@param \Illuminate\Http\Request $request
@param type $fieldname
@param type $folder
@param type $storage_disk
@return string filename | [
"Handle",
"a",
"file",
"upload"
] | 02ccc148de1962cfb7be857f47cfe19ff19bd9bc | https://github.com/Flobbos/laravel-crudable/blob/02ccc148de1962cfb7be857f47cfe19ff19bd9bc/src/Crudable/Crudable.php#L207-L222 |
190,755 | Flobbos/laravel-crudable | src/Crudable/Translations/Translatable.php | Translatable.processTranslations | public function processTranslations(
array $translations,
$trans_key = null,
$language_key = 'language_id'){
$approved = [];
foreach($translations as $trans){
//Check if translation is array at and skip
if(!is_array($trans))... | php | public function processTranslations(
array $translations,
$trans_key = null,
$language_key = 'language_id'){
$approved = [];
foreach($translations as $trans){
//Check if translation is array at and skip
if(!is_array($trans))... | [
"public",
"function",
"processTranslations",
"(",
"array",
"$",
"translations",
",",
"$",
"trans_key",
"=",
"null",
",",
"$",
"language_key",
"=",
"'language_id'",
")",
"{",
"$",
"approved",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"translations",
"as",
"$... | Process translation input data for saving them.
@param array $translations
@param string $trans_key translation key field name
@param string $language_key language identifier field
@return array | [
"Process",
"translation",
"input",
"data",
"for",
"saving",
"them",
"."
] | 02ccc148de1962cfb7be857f47cfe19ff19bd9bc | https://github.com/Flobbos/laravel-crudable/blob/02ccc148de1962cfb7be857f47cfe19ff19bd9bc/src/Crudable/Translations/Translatable.php#L18-L42 |
190,756 | Flobbos/laravel-crudable | src/Crudable/Translations/Translatable.php | Translatable.saveTranslations | public function saveTranslations(
\Illuminate\Database\Eloquent\Model $model,
array $translations){
if(empty($translations))
throw new MissingTranslationsException;
if(empty($this->translation_name))
throw new MissingTranslationNameExcep... | php | public function saveTranslations(
\Illuminate\Database\Eloquent\Model $model,
array $translations){
if(empty($translations))
throw new MissingTranslationsException;
if(empty($this->translation_name))
throw new MissingTranslationNameExcep... | [
"public",
"function",
"saveTranslations",
"(",
"\\",
"Illuminate",
"\\",
"Database",
"\\",
"Eloquent",
"\\",
"Model",
"$",
"model",
",",
"array",
"$",
"translations",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"translations",
")",
")",
"throw",
"new",
"Missin... | Save translations to model
@param \Illuminate\Database\Eloquent\Model $model
@param array $translations
@param string $relation_name
@return Model | [
"Save",
"translations",
"to",
"model"
] | 02ccc148de1962cfb7be857f47cfe19ff19bd9bc | https://github.com/Flobbos/laravel-crudable/blob/02ccc148de1962cfb7be857f47cfe19ff19bd9bc/src/Crudable/Translations/Translatable.php#L51-L62 |
190,757 | Flobbos/laravel-crudable | src/Crudable/Translations/Translatable.php | Translatable.checkRequired | public function checkRequired(array $arr){
//Filter out null values
$filtered = $this->filterNull($arr);
if(isset($this->required_trans))
throw new MissingRequiredFieldsException;
//check if all required fields are present
return count(array_intersec... | php | public function checkRequired(array $arr){
//Filter out null values
$filtered = $this->filterNull($arr);
if(isset($this->required_trans))
throw new MissingRequiredFieldsException;
//check if all required fields are present
return count(array_intersec... | [
"public",
"function",
"checkRequired",
"(",
"array",
"$",
"arr",
")",
"{",
"//Filter out null values",
"$",
"filtered",
"=",
"$",
"this",
"->",
"filterNull",
"(",
"$",
"arr",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"required_trans",
")",
")... | If you set the required fields in your service class
you can check if these fields were set.
@param array $arr
@return bool | [
"If",
"you",
"set",
"the",
"required",
"fields",
"in",
"your",
"service",
"class",
"you",
"can",
"check",
"if",
"these",
"fields",
"were",
"set",
"."
] | 02ccc148de1962cfb7be857f47cfe19ff19bd9bc | https://github.com/Flobbos/laravel-crudable/blob/02ccc148de1962cfb7be857f47cfe19ff19bd9bc/src/Crudable/Translations/Translatable.php#L70-L79 |
190,758 | Flobbos/laravel-crudable | src/Crudable/Commands/ViewCommand.php | ViewCommand.replaceServiceVar | protected function replaceServiceVar($name){
//dd($name);
$class = str_replace($this->getNamespace($name).'\\', '', $name);
$class = strtolower(snake_case(str_replace('Service', '', $class)));
//dd($class);
return str_plural($class);
} | php | protected function replaceServiceVar($name){
//dd($name);
$class = str_replace($this->getNamespace($name).'\\', '', $name);
$class = strtolower(snake_case(str_replace('Service', '', $class)));
//dd($class);
return str_plural($class);
} | [
"protected",
"function",
"replaceServiceVar",
"(",
"$",
"name",
")",
"{",
"//dd($name);",
"$",
"class",
"=",
"str_replace",
"(",
"$",
"this",
"->",
"getNamespace",
"(",
"$",
"name",
")",
".",
"'\\\\'",
",",
"''",
",",
"$",
"name",
")",
";",
"$",
"class... | Replace the service variable in the stub using pluralization
@param string $stub
@param string $name
@return string | [
"Replace",
"the",
"service",
"variable",
"in",
"the",
"stub",
"using",
"pluralization"
] | 02ccc148de1962cfb7be857f47cfe19ff19bd9bc | https://github.com/Flobbos/laravel-crudable/blob/02ccc148de1962cfb7be857f47cfe19ff19bd9bc/src/Crudable/Commands/ViewCommand.php#L64-L70 |
190,759 | Flobbos/laravel-crudable | src/Crudable/Commands/ViewCommand.php | ViewCommand.replaceSingularServiceVar | protected function replaceSingularServiceVar($name){
//dd($name);
$class = str_replace($this->getNamespace($name).'\\', '', $name);
$class = strtolower(snake_case(str_replace('Service', '', $class)));
//dd($class);
return $class;
} | php | protected function replaceSingularServiceVar($name){
//dd($name);
$class = str_replace($this->getNamespace($name).'\\', '', $name);
$class = strtolower(snake_case(str_replace('Service', '', $class)));
//dd($class);
return $class;
} | [
"protected",
"function",
"replaceSingularServiceVar",
"(",
"$",
"name",
")",
"{",
"//dd($name);",
"$",
"class",
"=",
"str_replace",
"(",
"$",
"this",
"->",
"getNamespace",
"(",
"$",
"name",
")",
".",
"'\\\\'",
",",
"''",
",",
"$",
"name",
")",
";",
"$",
... | Replace the service variable in stubs in singular
@param type $name
@return type | [
"Replace",
"the",
"service",
"variable",
"in",
"stubs",
"in",
"singular"
] | 02ccc148de1962cfb7be857f47cfe19ff19bd9bc | https://github.com/Flobbos/laravel-crudable/blob/02ccc148de1962cfb7be857f47cfe19ff19bd9bc/src/Crudable/Commands/ViewCommand.php#L77-L83 |
190,760 | nadar/stemming | src/Stemm.php | Stemm.stem | public static function stem($word, $language)
{
if (empty($language)) {
return $word;
}
foreach (static::$classMap as $stemmer => $languages) {
if (in_array($language, $languages)) {
return $stemmer::stem($word);
}
}
... | php | public static function stem($word, $language)
{
if (empty($language)) {
return $word;
}
foreach (static::$classMap as $stemmer => $languages) {
if (in_array($language, $languages)) {
return $stemmer::stem($word);
}
}
... | [
"public",
"static",
"function",
"stem",
"(",
"$",
"word",
",",
"$",
"language",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"language",
")",
")",
"{",
"return",
"$",
"word",
";",
"}",
"foreach",
"(",
"static",
"::",
"$",
"classMap",
"as",
"$",
"stemmer... | Stem a word.
If the language could not be found the world will returned.
@param string $word The word to stem e.g. `drinking`
@param string $language The language to stem with e.g. `de`,`en`
@return string The stemmed word, if language not found original input returned. | [
"Stem",
"a",
"word",
"."
] | a46d6eccf303c86a4670064ffa665654cb6eceab | https://github.com/nadar/stemming/blob/a46d6eccf303c86a4670064ffa665654cb6eceab/src/Stemm.php#L26-L39 |
190,761 | nadar/stemming | src/Stemm.php | Stemm.stemPhrase | public static function stemPhrase($phares, $language)
{
$words = [];
foreach (explode(" ", $phares) as $word) {
$words[] = static::stem($word, $language);
}
return implode(" ", $words);
} | php | public static function stemPhrase($phares, $language)
{
$words = [];
foreach (explode(" ", $phares) as $word) {
$words[] = static::stem($word, $language);
}
return implode(" ", $words);
} | [
"public",
"static",
"function",
"stemPhrase",
"(",
"$",
"phares",
",",
"$",
"language",
")",
"{",
"$",
"words",
"=",
"[",
"]",
";",
"foreach",
"(",
"explode",
"(",
"\" \"",
",",
"$",
"phares",
")",
"as",
"$",
"word",
")",
"{",
"$",
"words",
"[",
... | Stem a phrase by its words.
If the language could not be found the world will returned.
@param string $phares The phares to stem e.g. `A drinking drinker`
@param string $language The language to stem with e.g. `de`,`en`
@return string The stemmed word, if language not found original input returned. | [
"Stem",
"a",
"phrase",
"by",
"its",
"words",
"."
] | a46d6eccf303c86a4670064ffa665654cb6eceab | https://github.com/nadar/stemming/blob/a46d6eccf303c86a4670064ffa665654cb6eceab/src/Stemm.php#L50-L58 |
190,762 | weberhofer/jsonrpcphp | src/org/jsonrpcphp/JsonRPCClient.php | JsonRPCClient.setRPCNotification | public function setRPCNotification($notification)
{
empty($notification) ? $this->notification = false : $this->notification = true;
} | php | public function setRPCNotification($notification)
{
empty($notification) ? $this->notification = false : $this->notification = true;
} | [
"public",
"function",
"setRPCNotification",
"(",
"$",
"notification",
")",
"{",
"empty",
"(",
"$",
"notification",
")",
"?",
"$",
"this",
"->",
"notification",
"=",
"false",
":",
"$",
"this",
"->",
"notification",
"=",
"true",
";",
"}"
] | Sets the notification state of the object.
In this state, notifications are performed, instead of requests.
@param boolean $notification | [
"Sets",
"the",
"notification",
"state",
"of",
"the",
"object",
".",
"In",
"this",
"state",
"notifications",
"are",
"performed",
"instead",
"of",
"requests",
"."
] | e1a79bb3f08e20ae04e1e32deaff6a32eed4dad2 | https://github.com/weberhofer/jsonrpcphp/blob/e1a79bb3f08e20ae04e1e32deaff6a32eed4dad2/src/org/jsonrpcphp/JsonRPCClient.php#L96-L99 |
190,763 | nadar/stemming | src/Stemms/EnglishStemmer.php | PorterStemmer.Stem | public static function Stem($word)
{
if (strlen($word) <= 2) {
return $word;
}
$word = self::step1ab($word);
$word = self::step1c($word);
$word = self::step2($word);
$word = self::step3($word);
$word = self::step4($word);
$word = self::ste... | php | public static function Stem($word)
{
if (strlen($word) <= 2) {
return $word;
}
$word = self::step1ab($word);
$word = self::step1c($word);
$word = self::step2($word);
$word = self::step3($word);
$word = self::step4($word);
$word = self::ste... | [
"public",
"static",
"function",
"Stem",
"(",
"$",
"word",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"word",
")",
"<=",
"2",
")",
"{",
"return",
"$",
"word",
";",
"}",
"$",
"word",
"=",
"self",
"::",
"step1ab",
"(",
"$",
"word",
")",
";",
"$",
... | Stems a word. Simple huh?
@param string $word Word to stem
@return string Stemmed word | [
"Stems",
"a",
"word",
".",
"Simple",
"huh?"
] | a46d6eccf303c86a4670064ffa665654cb6eceab | https://github.com/nadar/stemming/blob/a46d6eccf303c86a4670064ffa665654cb6eceab/src/Stemms/EnglishStemmer.php#L56-L70 |
190,764 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/UserEmailVerificationServiceProvider.php | UserEmailVerificationServiceProvider.registerCommands | protected function registerCommands()
{
$this->app->singleton('command.verification.make', function ($app) {
return new MakeVerificationCommand($app['composer']);
});
$this->app->singleton('command.verification.clear', function ($app) {
return new ClearVerificationTo... | php | protected function registerCommands()
{
$this->app->singleton('command.verification.make', function ($app) {
return new MakeVerificationCommand($app['composer']);
});
$this->app->singleton('command.verification.clear', function ($app) {
return new ClearVerificationTo... | [
"protected",
"function",
"registerCommands",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'command.verification.make'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"MakeVerificationCommand",
"(",
"$",
"app",
"[",
"'compose... | Register the related console commands.
@return void | [
"Register",
"the",
"related",
"console",
"commands",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/UserEmailVerificationServiceProvider.php#L76-L88 |
190,765 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/Console/MakeVerificationCommand.php | MakeVerificationCommand.createMigrations | protected function createMigrations()
{
file_put_contents(
$this->createUsersVerificationsMigration(),
file_get_contents(__DIR__.'/stubs/migrations/users_verifications.stub')
);
file_put_contents(
$this->createUsersMigration(),
file_get_conten... | php | protected function createMigrations()
{
file_put_contents(
$this->createUsersVerificationsMigration(),
file_get_contents(__DIR__.'/stubs/migrations/users_verifications.stub')
);
file_put_contents(
$this->createUsersMigration(),
file_get_conten... | [
"protected",
"function",
"createMigrations",
"(",
")",
"{",
"file_put_contents",
"(",
"$",
"this",
"->",
"createUsersVerificationsMigration",
"(",
")",
",",
"file_get_contents",
"(",
"__DIR__",
".",
"'/stubs/migrations/users_verifications.stub'",
")",
")",
";",
"file_pu... | Create migrations.
@return void | [
"Create",
"migrations",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/Console/MakeVerificationCommand.php#L72-L85 |
190,766 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/Console/MakeVerificationCommand.php | MakeVerificationCommand.createUsersVerificationsMigration | protected function createUsersVerificationsMigration()
{
$name = 'create_users_verifications_table';
$path = $this->laravel->databasePath().'/migrations';
return $this->laravel['migration.creator']->create($name, $path);
} | php | protected function createUsersVerificationsMigration()
{
$name = 'create_users_verifications_table';
$path = $this->laravel->databasePath().'/migrations';
return $this->laravel['migration.creator']->create($name, $path);
} | [
"protected",
"function",
"createUsersVerificationsMigration",
"(",
")",
"{",
"$",
"name",
"=",
"'create_users_verifications_table'",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"laravel",
"->",
"databasePath",
"(",
")",
".",
"'/migrations'",
";",
"return",
"$",
"t... | Create a base migration file for the verifications table.
@return string | [
"Create",
"a",
"base",
"migration",
"file",
"for",
"the",
"verifications",
"table",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/Console/MakeVerificationCommand.php#L92-L99 |
190,767 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/Console/MakeVerificationCommand.php | MakeVerificationCommand.createUsersMigration | protected function createUsersMigration()
{
$name = 'add_verified_columns_to_users_table';
$path = $this->laravel->databasePath().'/migrations';
return $this->laravel['migration.creator']->create($name, $path);
} | php | protected function createUsersMigration()
{
$name = 'add_verified_columns_to_users_table';
$path = $this->laravel->databasePath().'/migrations';
return $this->laravel['migration.creator']->create($name, $path);
} | [
"protected",
"function",
"createUsersMigration",
"(",
")",
"{",
"$",
"name",
"=",
"'add_verified_columns_to_users_table'",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"laravel",
"->",
"databasePath",
"(",
")",
".",
"'/migrations'",
";",
"return",
"$",
"this",
"-... | Create a base migration file for the users table.
@return string | [
"Create",
"a",
"base",
"migration",
"file",
"for",
"the",
"users",
"table",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/Console/MakeVerificationCommand.php#L106-L113 |
190,768 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/VerificationBroker.php | VerificationBroker.sendVerificationLink | public function sendVerificationLink(array $credentials, Closure $callback = null)
{
$user = $this->getUser($credentials);
if (is_null($user)) {
return Contracts\VerificationBroker::INVALID_USER;
}
$token = $this->tokens->create($user);
$this->emailVerification... | php | public function sendVerificationLink(array $credentials, Closure $callback = null)
{
$user = $this->getUser($credentials);
if (is_null($user)) {
return Contracts\VerificationBroker::INVALID_USER;
}
$token = $this->tokens->create($user);
$this->emailVerification... | [
"public",
"function",
"sendVerificationLink",
"(",
"array",
"$",
"credentials",
",",
"Closure",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
"$",
"credentials",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"... | Send a user verification link.
@param array $credentials
@param \Closure|null $callback
@return string | [
"Send",
"a",
"user",
"verification",
"link",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/VerificationBroker.php#L63-L76 |
190,769 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/VerificationBroker.php | VerificationBroker.verify | public function verify(array $credentials, Closure $callback)
{
$user = $this->validateVerification($credentials);
if (!$user instanceof Contracts\RequiresEmailVerification) {
return $user;
}
call_user_func($callback, $user);
$this->tokens->delete($credentials[... | php | public function verify(array $credentials, Closure $callback)
{
$user = $this->validateVerification($credentials);
if (!$user instanceof Contracts\RequiresEmailVerification) {
return $user;
}
call_user_func($callback, $user);
$this->tokens->delete($credentials[... | [
"public",
"function",
"verify",
"(",
"array",
"$",
"credentials",
",",
"Closure",
"$",
"callback",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"validateVerification",
"(",
"$",
"credentials",
")",
";",
"if",
"(",
"!",
"$",
"user",
"instanceof",
"Contr... | Verify given account.
@param array $credentials
@param \Closure $callback
@return mixed | [
"Verify",
"given",
"account",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/VerificationBroker.php#L106-L119 |
190,770 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/VerificationBroker.php | VerificationBroker.validateVerification | protected function validateVerification(array $credentials)
{
if (is_null($user = $this->getUser($credentials))) {
return Contracts\VerificationBroker::INVALID_USER;
}
if (!$this->tokens->exists($user, $credentials['token'])) {
return Contracts\VerificationBroker::IN... | php | protected function validateVerification(array $credentials)
{
if (is_null($user = $this->getUser($credentials))) {
return Contracts\VerificationBroker::INVALID_USER;
}
if (!$this->tokens->exists($user, $credentials['token'])) {
return Contracts\VerificationBroker::IN... | [
"protected",
"function",
"validateVerification",
"(",
"array",
"$",
"credentials",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
"$",
"credentials",
")",
")",
")",
"{",
"return",
"Contracts",
"\\",
"VerificationB... | Validate verification for the given credentials.
@param array $credentials
@return \Krucas\LaravelUserEmailVerification\Contracts\RequiresEmailVerification | [
"Validate",
"verification",
"for",
"the",
"given",
"credentials",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/VerificationBroker.php#L127-L138 |
190,771 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/VerificationBrokerManager.php | VerificationBrokerManager.broker | public function broker($name = null)
{
$name = $name ?: $this->getDefaultDriver();
return $this->brokers[$name] = $this->get($name);
} | php | public function broker($name = null)
{
$name = $name ?: $this->getDefaultDriver();
return $this->brokers[$name] = $this->get($name);
} | [
"public",
"function",
"broker",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"name",
"=",
"$",
"name",
"?",
":",
"$",
"this",
"->",
"getDefaultDriver",
"(",
")",
";",
"return",
"$",
"this",
"->",
"brokers",
"[",
"$",
"name",
"]",
"=",
"$",
"this... | Get a verification broker instance by name.
@param string|null $name
@return mixed | [
"Get",
"a",
"verification",
"broker",
"instance",
"by",
"name",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/VerificationBrokerManager.php#L48-L53 |
190,772 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/VerificationBrokerManager.php | VerificationBrokerManager.createUsersBroker | protected function createUsersBroker(array $config)
{
return new VerificationBroker(
$this->createTokenRepository($this->app['config']['verification.repositories.'.$config['repository']]),
$this->app['auth']->createUserProvider($config['provider']),
$this->app['mailer'],
... | php | protected function createUsersBroker(array $config)
{
return new VerificationBroker(
$this->createTokenRepository($this->app['config']['verification.repositories.'.$config['repository']]),
$this->app['auth']->createUserProvider($config['provider']),
$this->app['mailer'],
... | [
"protected",
"function",
"createUsersBroker",
"(",
"array",
"$",
"config",
")",
"{",
"return",
"new",
"VerificationBroker",
"(",
"$",
"this",
"->",
"createTokenRepository",
"(",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"[",
"'verification.repositories.'",
... | Create users broker.
@param array $config
@return \Krucas\LaravelUserEmailVerification\Contracts\VerificationBroker | [
"Create",
"users",
"broker",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/VerificationBrokerManager.php#L105-L113 |
190,773 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/VerificationBrokerManager.php | VerificationBrokerManager.createDatabaseRepository | protected function createDatabaseRepository(array $config)
{
return new DatabaseTokenRepository(
$this->app['db']->connection($config['connection']),
$config['table'],
$this->app['config']['app.key'],
$config['expires']
);
} | php | protected function createDatabaseRepository(array $config)
{
return new DatabaseTokenRepository(
$this->app['db']->connection($config['connection']),
$config['table'],
$this->app['config']['app.key'],
$config['expires']
);
} | [
"protected",
"function",
"createDatabaseRepository",
"(",
"array",
"$",
"config",
")",
"{",
"return",
"new",
"DatabaseTokenRepository",
"(",
"$",
"this",
"->",
"app",
"[",
"'db'",
"]",
"->",
"connection",
"(",
"$",
"config",
"[",
"'connection'",
"]",
")",
",... | Create database token repository.
@param array $config
@return \Krucas\LaravelUserEmailVerification\Contracts\TokenRepositoryInterface | [
"Create",
"database",
"token",
"repository",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/VerificationBrokerManager.php#L132-L140 |
190,774 | Stolz/laravel-schema-spy | src/Command.php | Command.setParameters | protected function setParameters()
{
$parameters = [];
// Set output directory
$parameters['-o'] = Config::get('spy.output', base_path('database/schema'));
// Set database connection details
$connections = Config::get('database.connections', []);
$connection = ($this->argument('connection')) ?: Config::g... | php | protected function setParameters()
{
$parameters = [];
// Set output directory
$parameters['-o'] = Config::get('spy.output', base_path('database/schema'));
// Set database connection details
$connections = Config::get('database.connections', []);
$connection = ($this->argument('connection')) ?: Config::g... | [
"protected",
"function",
"setParameters",
"(",
")",
"{",
"$",
"parameters",
"=",
"[",
"]",
";",
"// Set output directory",
"$",
"parameters",
"[",
"'-o'",
"]",
"=",
"Config",
"::",
"get",
"(",
"'spy.output'",
",",
"base_path",
"(",
"'database/schema'",
")",
... | Set schemaspy command parameters.
@return array | [
"Set",
"schemaspy",
"command",
"parameters",
"."
] | 19b94c8ca38a7e6d1f719f299dabd1dc84bd85f0 | https://github.com/Stolz/laravel-schema-spy/blob/19b94c8ca38a7e6d1f719f299dabd1dc84bd85f0/src/Command.php#L35-L68 |
190,775 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/VerifiesUsers.php | VerifiesUsers.verifyUser | protected function verifyUser($user)
{
$user->verified = true;
$user->verified_at = new Carbon('now');
$user->save();
Auth::guard($this->getGuard())->login($user);
} | php | protected function verifyUser($user)
{
$user->verified = true;
$user->verified_at = new Carbon('now');
$user->save();
Auth::guard($this->getGuard())->login($user);
} | [
"protected",
"function",
"verifyUser",
"(",
"$",
"user",
")",
"{",
"$",
"user",
"->",
"verified",
"=",
"true",
";",
"$",
"user",
"->",
"verified_at",
"=",
"new",
"Carbon",
"(",
"'now'",
")",
";",
"$",
"user",
"->",
"save",
"(",
")",
";",
"Auth",
":... | Verify user.
@param \Krucas\LaravelUserEmailVerification\Contracts\RequiresEmailVerification $user
@return void | [
"Verify",
"user",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/VerifiesUsers.php#L64-L72 |
190,776 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/VerifiesUsers.php | VerifiesUsers.sendVerificationLinkEmail | public function sendVerificationLinkEmail(Request $request)
{
$this->validate($request, ['email' => 'required|email']);
$broker = $this->getBroker();
$credentials = $request->only('email');
$response = Verification::broker($broker)->sendVerificationLink($credentials, function (Mes... | php | public function sendVerificationLinkEmail(Request $request)
{
$this->validate($request, ['email' => 'required|email']);
$broker = $this->getBroker();
$credentials = $request->only('email');
$response = Verification::broker($broker)->sendVerificationLink($credentials, function (Mes... | [
"public",
"function",
"sendVerificationLinkEmail",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"validate",
"(",
"$",
"request",
",",
"[",
"'email'",
"=>",
"'required|email'",
"]",
")",
";",
"$",
"broker",
"=",
"$",
"this",
"->",
"getBroker... | Send a verification link to the given user.
@param \Illuminate\Http\Request $request
@return \Illuminate\Http\Response | [
"Send",
"a",
"verification",
"link",
"to",
"the",
"given",
"user",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/VerifiesUsers.php#L121-L140 |
190,777 | tecnocen-com/yii2-oauth2-server | src/filters/auth/CompositeAuth.php | CompositeAuth.fetchActionScope | protected function fetchActionScope($actionId)
{
if (empty($this->actionScopes)) {
return null;
}
$ownerId = $this->owner->getUniqueId();
foreach ($this->actionScopes as $actionPattern => $scope) {
if (StringHelper::matchWildcard(
"$ownerId/$... | php | protected function fetchActionScope($actionId)
{
if (empty($this->actionScopes)) {
return null;
}
$ownerId = $this->owner->getUniqueId();
foreach ($this->actionScopes as $actionPattern => $scope) {
if (StringHelper::matchWildcard(
"$ownerId/$... | [
"protected",
"function",
"fetchActionScope",
"(",
"$",
"actionId",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"actionScopes",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"ownerId",
"=",
"$",
"this",
"->",
"owner",
"->",
"getUniqueId",
"(... | Fetch the scope required for the action id.
@param string $actionId
@return ?string the required scope or `null` if no scope is required. | [
"Fetch",
"the",
"scope",
"required",
"for",
"the",
"action",
"id",
"."
] | 4f257188d095cbe79c0cad7636ccd25e59c3ae75 | https://github.com/tecnocen-com/yii2-oauth2-server/blob/4f257188d095cbe79c0cad7636ccd25e59c3ae75/src/filters/auth/CompositeAuth.php#L66-L84 |
190,778 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/RedirectsUsers.php | RedirectsUsers.verificationRedirectPath | public function verificationRedirectPath()
{
if (property_exists($this, 'verificationRedirectPath')) {
return $this->verificationRedirectPath;
}
return property_exists($this, 'verificationRedirectTo')
? $this->verificationRedirectTo : route('verification.verify', [],... | php | public function verificationRedirectPath()
{
if (property_exists($this, 'verificationRedirectPath')) {
return $this->verificationRedirectPath;
}
return property_exists($this, 'verificationRedirectTo')
? $this->verificationRedirectTo : route('verification.verify', [],... | [
"public",
"function",
"verificationRedirectPath",
"(",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",",
"'verificationRedirectPath'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"verificationRedirectPath",
";",
"}",
"return",
"property_exists",
"(",
... | Get the post register redirect path if user must verify account.
@return string | [
"Get",
"the",
"post",
"register",
"redirect",
"path",
"if",
"user",
"must",
"verify",
"account",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/RedirectsUsers.php#L12-L20 |
190,779 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/DatabaseTokenRepository.php | DatabaseTokenRepository.create | public function create(Contracts\RequiresEmailVerification $user)
{
$email = $user->getEmailForVerification();
$this->deleteExisting($user);
$token = $this->createNewToken();
$this->getTable()->insert($this->getPayload($email, $token));
return $token;
} | php | public function create(Contracts\RequiresEmailVerification $user)
{
$email = $user->getEmailForVerification();
$this->deleteExisting($user);
$token = $this->createNewToken();
$this->getTable()->insert($this->getPayload($email, $token));
return $token;
} | [
"public",
"function",
"create",
"(",
"Contracts",
"\\",
"RequiresEmailVerification",
"$",
"user",
")",
"{",
"$",
"email",
"=",
"$",
"user",
"->",
"getEmailForVerification",
"(",
")",
";",
"$",
"this",
"->",
"deleteExisting",
"(",
"$",
"user",
")",
";",
"$"... | Create a new token.
@param \Krucas\LaravelUserEmailVerification\Contracts\RequiresEmailVerification $user
@return string | [
"Create",
"a",
"new",
"token",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/DatabaseTokenRepository.php#L62-L73 |
190,780 | edvinaskrucas/laravel-user-email-verification | src/Krucas/LaravelUserEmailVerification/AuthenticatesUsers.php | AuthenticatesUsers.authenticated | public function authenticated(Request $request, Contracts\RequiresEmailVerification $user)
{
if (config('verification.verify') && !$user->isUserEmailVerified()) {
Auth::guard($this->getGuard())->logout();
return redirect($this->verificationRedirectPath());
}
return ... | php | public function authenticated(Request $request, Contracts\RequiresEmailVerification $user)
{
if (config('verification.verify') && !$user->isUserEmailVerified()) {
Auth::guard($this->getGuard())->logout();
return redirect($this->verificationRedirectPath());
}
return ... | [
"public",
"function",
"authenticated",
"(",
"Request",
"$",
"request",
",",
"Contracts",
"\\",
"RequiresEmailVerification",
"$",
"user",
")",
"{",
"if",
"(",
"config",
"(",
"'verification.verify'",
")",
"&&",
"!",
"$",
"user",
"->",
"isUserEmailVerified",
"(",
... | Check if user is verified or not.
@param \Illuminate\Http\Request $request
@param \Krucas\LaravelUserEmailVerification\Contracts\RequiresEmailVerification $user
@return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector | [
"Check",
"if",
"user",
"is",
"verified",
"or",
"not",
"."
] | 75f7139543c2be5bb3c71f87fa016cc14be9d733 | https://github.com/edvinaskrucas/laravel-user-email-verification/blob/75f7139543c2be5bb3c71f87fa016cc14be9d733/src/Krucas/LaravelUserEmailVerification/AuthenticatesUsers.php#L21-L30 |
190,781 | tecnocen-com/yii2-oauth2-server | src/Module.php | Module.initOauth2Server | public function initOauth2Server()
{
if ($this->serverInitialized) {
return;
}
$this->serverInitialized = true;
$this->modelMap = array_merge($this->defaultModelMap, $this->modelMap);
$this->storageMap = array_merge($this->defaultStorageMap, $this->storageMap);
... | php | public function initOauth2Server()
{
if ($this->serverInitialized) {
return;
}
$this->serverInitialized = true;
$this->modelMap = array_merge($this->defaultModelMap, $this->modelMap);
$this->storageMap = array_merge($this->defaultStorageMap, $this->storageMap);
... | [
"public",
"function",
"initOauth2Server",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"serverInitialized",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"serverInitialized",
"=",
"true",
";",
"$",
"this",
"->",
"modelMap",
"=",
"array_merge",
"(",
"$... | Initializes the oauth2 server and its dependencies. | [
"Initializes",
"the",
"oauth2",
"server",
"and",
"its",
"dependencies",
"."
] | 4f257188d095cbe79c0cad7636ccd25e59c3ae75 | https://github.com/tecnocen-com/yii2-oauth2-server/blob/4f257188d095cbe79c0cad7636ccd25e59c3ae75/src/Module.php#L123-L174 |
190,782 | krisanalfa/lumen-dingo-adapter | src/Providers/LumenDingoAdapterServiceProvider.php | LumenDingoAdapterServiceProvider.configure | protected function configure($name)
{
$path = $this->app->basePath("config/{$name}.php");
if (!is_readable($path)) {
$path = dirname(__DIR__) . "/config/{$name}.php";
}
$this->app->make('config')->set($name, require $path);
} | php | protected function configure($name)
{
$path = $this->app->basePath("config/{$name}.php");
if (!is_readable($path)) {
$path = dirname(__DIR__) . "/config/{$name}.php";
}
$this->app->make('config')->set($name, require $path);
} | [
"protected",
"function",
"configure",
"(",
"$",
"name",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"app",
"->",
"basePath",
"(",
"\"config/{$name}.php\"",
")",
";",
"if",
"(",
"!",
"is_readable",
"(",
"$",
"path",
")",
")",
"{",
"$",
"path",
"=",... | Configure provider.
@param string $name
@return void | [
"Configure",
"provider",
"."
] | 1e18076421b752650a6073aa916e3a0a243e8b07 | https://github.com/krisanalfa/lumen-dingo-adapter/blob/1e18076421b752650a6073aa916e3a0a243e8b07/src/Providers/LumenDingoAdapterServiceProvider.php#L45-L54 |
190,783 | flagrow/flarum-ext-image-upload | src/Commands/UploadImageHandler.php | UploadImageHandler.handle | public function handle(UploadImage $command)
{
// check if the user can upload images, otherwise return
$this->assertCan(
$command->actor,
'flagrow.image.upload'
);
$tmpFile = tempnam($this->app->storagePath() . '/tmp', 'image');
$command->file->moveT... | php | public function handle(UploadImage $command)
{
// check if the user can upload images, otherwise return
$this->assertCan(
$command->actor,
'flagrow.image.upload'
);
$tmpFile = tempnam($this->app->storagePath() . '/tmp', 'image');
$command->file->moveT... | [
"public",
"function",
"handle",
"(",
"UploadImage",
"$",
"command",
")",
"{",
"// check if the user can upload images, otherwise return",
"$",
"this",
"->",
"assertCan",
"(",
"$",
"command",
"->",
"actor",
",",
"'flagrow.image.upload'",
")",
";",
"$",
"tmpFile",
"="... | Handles the command execution.
@param UploadImage $command
@return null|string
@todo check permission | [
"Handles",
"the",
"command",
"execution",
"."
] | fd23bdef9b37272243b6bd4cbf0aa2ada477c6ca | https://github.com/flagrow/flarum-ext-image-upload/blob/fd23bdef9b37272243b6bd4cbf0aa2ada477c6ca/src/Commands/UploadImageHandler.php#L98-L167 |
190,784 | flagrow/flarum-ext-image-upload | src/Listeners/AddUploadsApi.php | AddUploadsApi.subscribe | public function subscribe(Dispatcher $events)
{
$events->listen(ConfigureApiRoutes::class, [$this, 'configureApiRoutes']);
$events->listen(PrepareApiAttributes::class, [$this, 'prepareApiAttributes']);
} | php | public function subscribe(Dispatcher $events)
{
$events->listen(ConfigureApiRoutes::class, [$this, 'configureApiRoutes']);
$events->listen(PrepareApiAttributes::class, [$this, 'prepareApiAttributes']);
} | [
"public",
"function",
"subscribe",
"(",
"Dispatcher",
"$",
"events",
")",
"{",
"$",
"events",
"->",
"listen",
"(",
"ConfigureApiRoutes",
"::",
"class",
",",
"[",
"$",
"this",
",",
"'configureApiRoutes'",
"]",
")",
";",
"$",
"events",
"->",
"listen",
"(",
... | Subscribes to the Flarum api routes configuration event.
@param Dispatcher $events | [
"Subscribes",
"to",
"the",
"Flarum",
"api",
"routes",
"configuration",
"event",
"."
] | fd23bdef9b37272243b6bd4cbf0aa2ada477c6ca | https://github.com/flagrow/flarum-ext-image-upload/blob/fd23bdef9b37272243b6bd4cbf0aa2ada477c6ca/src/Listeners/AddUploadsApi.php#L28-L32 |
190,785 | mcustiel/phiremock-codeception-extension | src/Extension/PhiremockProcess.php | PhiremockProcess.start | public function start($ip, $port, $path, $logsPath, $debug, $expectationsPath)
{
$phiremockPath = is_file($path) ? $path : $path . DIRECTORY_SEPARATOR . 'phiremock';
$expectationsPath = is_dir($expectationsPath) ? $expectationsPath : '';
$logFile = $logsPath . DIRECTORY_SEPARATOR . self::LOG... | php | public function start($ip, $port, $path, $logsPath, $debug, $expectationsPath)
{
$phiremockPath = is_file($path) ? $path : $path . DIRECTORY_SEPARATOR . 'phiremock';
$expectationsPath = is_dir($expectationsPath) ? $expectationsPath : '';
$logFile = $logsPath . DIRECTORY_SEPARATOR . self::LOG... | [
"public",
"function",
"start",
"(",
"$",
"ip",
",",
"$",
"port",
",",
"$",
"path",
",",
"$",
"logsPath",
",",
"$",
"debug",
",",
"$",
"expectationsPath",
")",
"{",
"$",
"phiremockPath",
"=",
"is_file",
"(",
"$",
"path",
")",
"?",
"$",
"path",
":",
... | Starts Phiremock.
@param string $ip
@param int $port
@param string $path
@param string $logsPath
@param bool $debug
@param mixed $expectationsPath | [
"Starts",
"Phiremock",
"."
] | b3d45a65b2c761f9aadfcb9f4fefd665eed7c325 | https://github.com/mcustiel/phiremock-codeception-extension/blob/b3d45a65b2c761f9aadfcb9f4fefd665eed7c325/src/Extension/PhiremockProcess.php#L50-L58 |
190,786 | flagrow/flarum-ext-image-upload | src/Api/Controllers/UploadImageController.php | UploadImageController.data | protected function data(ServerRequestInterface $request, Document $document)
{
$postId = array_get($request->getQueryParams(), 'post');
$actor = $request->getAttribute('actor');
$file = array_get($request->getUploadedFiles(), 'image');
return $this->bus->dispatch(
new Up... | php | protected function data(ServerRequestInterface $request, Document $document)
{
$postId = array_get($request->getQueryParams(), 'post');
$actor = $request->getAttribute('actor');
$file = array_get($request->getUploadedFiles(), 'image');
return $this->bus->dispatch(
new Up... | [
"protected",
"function",
"data",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"Document",
"$",
"document",
")",
"{",
"$",
"postId",
"=",
"array_get",
"(",
"$",
"request",
"->",
"getQueryParams",
"(",
")",
",",
"'post'",
")",
";",
"$",
"actor",
"=",
... | Get the data to be serialized and assigned to the response document.
@param ServerRequestInterface $request
@param Document $document
@return mixed | [
"Get",
"the",
"data",
"to",
"be",
"serialized",
"and",
"assigned",
"to",
"the",
"response",
"document",
"."
] | fd23bdef9b37272243b6bd4cbf0aa2ada477c6ca | https://github.com/flagrow/flarum-ext-image-upload/blob/fd23bdef9b37272243b6bd4cbf0aa2ada477c6ca/src/Api/Controllers/UploadImageController.php#L52-L61 |
190,787 | krisanalfa/lumen-dingo-adapter | src/Providers/LumenJWTServiceProvider.php | LumenJWTServiceProvider.registerJWTAuthDependency | protected function registerJWTAuthDependency()
{
$this->registerRequest();
$this->registerRoutingAlias();
$this->registerSessionServiceProvider();
$this->registerCookieComponent();
$this->registerCacheServiceProvider();
$this->registerAuthManagerAlias();
} | php | protected function registerJWTAuthDependency()
{
$this->registerRequest();
$this->registerRoutingAlias();
$this->registerSessionServiceProvider();
$this->registerCookieComponent();
$this->registerCacheServiceProvider();
$this->registerAuthManagerAlias();
} | [
"protected",
"function",
"registerJWTAuthDependency",
"(",
")",
"{",
"$",
"this",
"->",
"registerRequest",
"(",
")",
";",
"$",
"this",
"->",
"registerRoutingAlias",
"(",
")",
";",
"$",
"this",
"->",
"registerSessionServiceProvider",
"(",
")",
";",
"$",
"this",... | Here we do some internal function to fulfill JWTAuth dependency. | [
"Here",
"we",
"do",
"some",
"internal",
"function",
"to",
"fulfill",
"JWTAuth",
"dependency",
"."
] | 1e18076421b752650a6073aa916e3a0a243e8b07 | https://github.com/krisanalfa/lumen-dingo-adapter/blob/1e18076421b752650a6073aa916e3a0a243e8b07/src/Providers/LumenJWTServiceProvider.php#L46-L59 |
190,788 | krisanalfa/lumen-dingo-adapter | src/Providers/LumenJWTServiceProvider.php | LumenJWTServiceProvider.loadComponent | protected function loadComponent($bindings, $name)
{
$aliases = array_values($bindings);
$abstracts = array_keys($bindings);
foreach ($abstracts as $index => $abstract) {
$this->app->singleton(
$abstract,
$this->{"load{$name}Component"}()
... | php | protected function loadComponent($bindings, $name)
{
$aliases = array_values($bindings);
$abstracts = array_keys($bindings);
foreach ($abstracts as $index => $abstract) {
$this->app->singleton(
$abstract,
$this->{"load{$name}Component"}()
... | [
"protected",
"function",
"loadComponent",
"(",
"$",
"bindings",
",",
"$",
"name",
")",
"{",
"$",
"aliases",
"=",
"array_values",
"(",
"$",
"bindings",
")",
";",
"$",
"abstracts",
"=",
"array_keys",
"(",
"$",
"bindings",
")",
";",
"foreach",
"(",
"$",
"... | Load component by given bindings an name resolver.
@param array $bindings
@param string $name | [
"Load",
"component",
"by",
"given",
"bindings",
"an",
"name",
"resolver",
"."
] | 1e18076421b752650a6073aa916e3a0a243e8b07 | https://github.com/krisanalfa/lumen-dingo-adapter/blob/1e18076421b752650a6073aa916e3a0a243e8b07/src/Providers/LumenJWTServiceProvider.php#L357-L373 |
190,789 | fordnox/php-queue-manager | Queue/Manager.php | Manager.queueSummary | public function queueSummary($name)
{
$qid = $this->getQueueId($name);
$db = $this->getDb();
$list = array();
$sql = 'SELECT * FROM ' . $this->messageTable . ' WHERE queue_id = :queue_id';
$sth = $db->prepare($sql);
$sth->execute(array('queue_id'=>$qid));
... | php | public function queueSummary($name)
{
$qid = $this->getQueueId($name);
$db = $this->getDb();
$list = array();
$sql = 'SELECT * FROM ' . $this->messageTable . ' WHERE queue_id = :queue_id';
$sth = $db->prepare($sql);
$sth->execute(array('queue_id'=>$qid));
... | [
"public",
"function",
"queueSummary",
"(",
"$",
"name",
")",
"{",
"$",
"qid",
"=",
"$",
"this",
"->",
"getQueueId",
"(",
"$",
"name",
")",
";",
"$",
"db",
"=",
"$",
"this",
"->",
"getDb",
"(",
")",
";",
"$",
"list",
"=",
"array",
"(",
")",
";",... | Return Queue summary
@param string $name
@return array | [
"Return",
"Queue",
"summary"
] | 68f8918a367e672eea1d95a98e3f5a82f20724f9 | https://github.com/fordnox/php-queue-manager/blob/68f8918a367e672eea1d95a98e3f5a82f20724f9/Queue/Manager.php#L56-L79 |
190,790 | fordnox/php-queue-manager | Queue/Manager.php | Manager.summary | public function summary()
{
$list = array();
foreach($this->getQueues() as $queue) {
$list = array_merge($list, $this->queueSummary($queue->getName()));
}
return $list;
} | php | public function summary()
{
$list = array();
foreach($this->getQueues() as $queue) {
$list = array_merge($list, $this->queueSummary($queue->getName()));
}
return $list;
} | [
"public",
"function",
"summary",
"(",
")",
"{",
"$",
"list",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getQueues",
"(",
")",
"as",
"$",
"queue",
")",
"{",
"$",
"list",
"=",
"array_merge",
"(",
"$",
"list",
",",
"$",
"this",... | Return all Queues summary
@return array | [
"Return",
"all",
"Queues",
"summary"
] | 68f8918a367e672eea1d95a98e3f5a82f20724f9 | https://github.com/fordnox/php-queue-manager/blob/68f8918a367e672eea1d95a98e3f5a82f20724f9/Queue/Manager.php#L86-L93 |
190,791 | fordnox/php-queue-manager | Queue/Manager.php | Manager.receiveQueueMessages | private function receiveQueueMessages(Queue $queue, $max, $timeout)
{
$messages = array();
$microtime = microtime(true); // cache microtime
$db = $this->getDb();
$qid = $this->getQueueId($queue->getName());
// start transaction handling
try ... | php | private function receiveQueueMessages(Queue $queue, $max, $timeout)
{
$messages = array();
$microtime = microtime(true); // cache microtime
$db = $this->getDb();
$qid = $this->getQueueId($queue->getName());
// start transaction handling
try ... | [
"private",
"function",
"receiveQueueMessages",
"(",
"Queue",
"$",
"queue",
",",
"$",
"max",
",",
"$",
"timeout",
")",
"{",
"$",
"messages",
"=",
"array",
"(",
")",
";",
"$",
"microtime",
"=",
"microtime",
"(",
"true",
")",
";",
"// cache microtime",
"$",... | Select unselected messages from queue
@param Queue $queue
@param int $max
@param int $timeout
@throws Exception
@return \ArrayObject | [
"Select",
"unselected",
"messages",
"from",
"queue"
] | 68f8918a367e672eea1d95a98e3f5a82f20724f9 | https://github.com/fordnox/php-queue-manager/blob/68f8918a367e672eea1d95a98e3f5a82f20724f9/Queue/Manager.php#L104-L162 |
190,792 | fordnox/php-queue-manager | Queue/Manager.php | Manager.executeQueue | public function executeQueue(Queue $queue, $max, $timeout = 30)
{
foreach($this->receiveQueueMessages($queue, $max, $timeout) as $message) {
try {
$message->execute();
$this->deleteMessage($message);
} catch(\Exception $e) {
$this->log(... | php | public function executeQueue(Queue $queue, $max, $timeout = 30)
{
foreach($this->receiveQueueMessages($queue, $max, $timeout) as $message) {
try {
$message->execute();
$this->deleteMessage($message);
} catch(\Exception $e) {
$this->log(... | [
"public",
"function",
"executeQueue",
"(",
"Queue",
"$",
"queue",
",",
"$",
"max",
",",
"$",
"timeout",
"=",
"30",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"receiveQueueMessages",
"(",
"$",
"queue",
",",
"$",
"max",
",",
"$",
"timeout",
")",
"as"... | Execute messages in queue
@param Queue $queue
@param int $max
@param int $timeout | [
"Execute",
"messages",
"in",
"queue"
] | 68f8918a367e672eea1d95a98e3f5a82f20724f9 | https://github.com/fordnox/php-queue-manager/blob/68f8918a367e672eea1d95a98e3f5a82f20724f9/Queue/Manager.php#L171-L181 |
190,793 | fordnox/php-queue-manager | Queue/Manager.php | Manager.executeAll | public function executeAll($max = 50)
{
$sth = $this->getDb()->prepare('SELECT * FROM ' . $this->queueTable . ' WHERE 1');
$sth->execute();
foreach($sth->fetchAll() as $queue) {
$q = new Queue($queue['queue_name'], $queue['timeout']);
$q->setManager($this);
... | php | public function executeAll($max = 50)
{
$sth = $this->getDb()->prepare('SELECT * FROM ' . $this->queueTable . ' WHERE 1');
$sth->execute();
foreach($sth->fetchAll() as $queue) {
$q = new Queue($queue['queue_name'], $queue['timeout']);
$q->setManager($this);
... | [
"public",
"function",
"executeAll",
"(",
"$",
"max",
"=",
"50",
")",
"{",
"$",
"sth",
"=",
"$",
"this",
"->",
"getDb",
"(",
")",
"->",
"prepare",
"(",
"'SELECT * FROM '",
".",
"$",
"this",
"->",
"queueTable",
".",
"' WHERE 1'",
")",
";",
"$",
"sth",
... | Execute all queues
@param int $max | [
"Execute",
"all",
"queues"
] | 68f8918a367e672eea1d95a98e3f5a82f20724f9 | https://github.com/fordnox/php-queue-manager/blob/68f8918a367e672eea1d95a98e3f5a82f20724f9/Queue/Manager.php#L188-L197 |
190,794 | fordnox/php-queue-manager | Queue/Manager.php | Manager.addMessageToQueue | public function addMessageToQueue(Message $message, $name)
{
$q = $this->getQueue($name);
$qid = $this->getQueueId($q->getName());
$body = base64_encode(serialize($message));
$md5 = md5($body);
$sql = 'INSERT INTO ' . $this->messageTable . '
(queue_i... | php | public function addMessageToQueue(Message $message, $name)
{
$q = $this->getQueue($name);
$qid = $this->getQueueId($q->getName());
$body = base64_encode(serialize($message));
$md5 = md5($body);
$sql = 'INSERT INTO ' . $this->messageTable . '
(queue_i... | [
"public",
"function",
"addMessageToQueue",
"(",
"Message",
"$",
"message",
",",
"$",
"name",
")",
"{",
"$",
"q",
"=",
"$",
"this",
"->",
"getQueue",
"(",
"$",
"name",
")",
";",
"$",
"qid",
"=",
"$",
"this",
"->",
"getQueueId",
"(",
"$",
"q",
"->",
... | Add new message to queue
@param Message $message
@param string $name
@return bool | [
"Add",
"new",
"message",
"to",
"queue"
] | 68f8918a367e672eea1d95a98e3f5a82f20724f9 | https://github.com/fordnox/php-queue-manager/blob/68f8918a367e672eea1d95a98e3f5a82f20724f9/Queue/Manager.php#L206-L226 |
190,795 | fordnox/php-queue-manager | Queue/Manager.php | Manager.getQueue | public function getQueue($name, $timeout = null)
{
if (!is_string($name)) {
throw new Exception('$name is not a string');
}
if ((null !== $timeout) && !is_integer($timeout)) {
throw new Exception('$timeout must be an integer');
}
if(!$this->getQueueI... | php | public function getQueue($name, $timeout = null)
{
if (!is_string($name)) {
throw new Exception('$name is not a string');
}
if ((null !== $timeout) && !is_integer($timeout)) {
throw new Exception('$timeout must be an integer');
}
if(!$this->getQueueI... | [
"public",
"function",
"getQueue",
"(",
"$",
"name",
",",
"$",
"timeout",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'$name is not a string'",
")",
";",
"}",
"if",
"(",
"(",
... | Return new queue instance
@param string $name
@param int $timeout
@throws Exception
@return Queue | [
"Return",
"new",
"queue",
"instance"
] | 68f8918a367e672eea1d95a98e3f5a82f20724f9 | https://github.com/fordnox/php-queue-manager/blob/68f8918a367e672eea1d95a98e3f5a82f20724f9/Queue/Manager.php#L236-L253 |
190,796 | fordnox/php-queue-manager | Queue/Manager.php | Manager.getQueueId | public function getQueueId($name)
{
$sql = 'SELECT queue_id FROM ' . $this->queueTable . ' WHERE queue_name = ? LIMIT 1';
$stmt = $this->getDb()->prepare($sql);
$stmt->execute(array($name));
return $stmt->fetchColumn();
} | php | public function getQueueId($name)
{
$sql = 'SELECT queue_id FROM ' . $this->queueTable . ' WHERE queue_name = ? LIMIT 1';
$stmt = $this->getDb()->prepare($sql);
$stmt->execute(array($name));
return $stmt->fetchColumn();
} | [
"public",
"function",
"getQueueId",
"(",
"$",
"name",
")",
"{",
"$",
"sql",
"=",
"'SELECT queue_id FROM '",
".",
"$",
"this",
"->",
"queueTable",
".",
"' WHERE queue_name = ? LIMIT 1'",
";",
"$",
"stmt",
"=",
"$",
"this",
"->",
"getDb",
"(",
")",
"->",
"pr... | Returns queue id or bool false
@param string $name
@return int | [
"Returns",
"queue",
"id",
"or",
"bool",
"false"
] | 68f8918a367e672eea1d95a98e3f5a82f20724f9 | https://github.com/fordnox/php-queue-manager/blob/68f8918a367e672eea1d95a98e3f5a82f20724f9/Queue/Manager.php#L260-L266 |
190,797 | fordnox/php-queue-manager | Queue/Manager.php | Manager.create | private function create($name, $timeout = null)
{
if(null === $timeout) {
$timeout = 10000;
}
$sql = 'INSERT INTO ' . $this->queueTable . '
(queue_name, timeout)
VALUES
(:queue_name, :timeout)
';
$stmt = $this->getDb()->pre... | php | private function create($name, $timeout = null)
{
if(null === $timeout) {
$timeout = 10000;
}
$sql = 'INSERT INTO ' . $this->queueTable . '
(queue_name, timeout)
VALUES
(:queue_name, :timeout)
';
$stmt = $this->getDb()->pre... | [
"private",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"timeout",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"timeout",
")",
"{",
"$",
"timeout",
"=",
"10000",
";",
"}",
"$",
"sql",
"=",
"'INSERT INTO '",
".",
"$",
"this",
"->",
... | Creates new Queue
@param string $name
@param int $timeout
@return bool | [
"Creates",
"new",
"Queue"
] | 68f8918a367e672eea1d95a98e3f5a82f20724f9 | https://github.com/fordnox/php-queue-manager/blob/68f8918a367e672eea1d95a98e3f5a82f20724f9/Queue/Manager.php#L275-L291 |
190,798 | fordnox/php-queue-manager | Queue/Manager.php | Manager.deleteMessageById | public function deleteMessageById($id)
{
$sql = 'DELETE FROM ' . $this->messageTable . ' WHERE message_id = ?';
$stmt = $this->getDb()->prepare($sql);
$stmt->execute(array($id));
return true;
} | php | public function deleteMessageById($id)
{
$sql = 'DELETE FROM ' . $this->messageTable . ' WHERE message_id = ?';
$stmt = $this->getDb()->prepare($sql);
$stmt->execute(array($id));
return true;
} | [
"public",
"function",
"deleteMessageById",
"(",
"$",
"id",
")",
"{",
"$",
"sql",
"=",
"'DELETE FROM '",
".",
"$",
"this",
"->",
"messageTable",
".",
"' WHERE message_id = ?'",
";",
"$",
"stmt",
"=",
"$",
"this",
"->",
"getDb",
"(",
")",
"->",
"prepare",
... | Remove message from queue by id
@param int $id
@return bool | [
"Remove",
"message",
"from",
"queue",
"by",
"id"
] | 68f8918a367e672eea1d95a98e3f5a82f20724f9 | https://github.com/fordnox/php-queue-manager/blob/68f8918a367e672eea1d95a98e3f5a82f20724f9/Queue/Manager.php#L365-L371 |
190,799 | fordnox/php-queue-manager | Queue/Manager.php | Manager.log | public function log(Message $message, \Exception $e)
{
$sql = "UPDATE " . $this->messageTable . "
SET log = :log
WHERE message_id = :id
";
$stmt = $this->getDb()->prepare($sql);
$stmt->bindValue(':log', $e->getMessage(), \PDO::PARAM_STR);
$stmt... | php | public function log(Message $message, \Exception $e)
{
$sql = "UPDATE " . $this->messageTable . "
SET log = :log
WHERE message_id = :id
";
$stmt = $this->getDb()->prepare($sql);
$stmt->bindValue(':log', $e->getMessage(), \PDO::PARAM_STR);
$stmt... | [
"public",
"function",
"log",
"(",
"Message",
"$",
"message",
",",
"\\",
"Exception",
"$",
"e",
")",
"{",
"$",
"sql",
"=",
"\"UPDATE \"",
".",
"$",
"this",
"->",
"messageTable",
".",
"\"\n SET log = :log\n WHERE message_id = :id\n \... | Saves error message to message on execution failure
@param Message $message
@param \Exception $e
@return void | [
"Saves",
"error",
"message",
"to",
"message",
"on",
"execution",
"failure"
] | 68f8918a367e672eea1d95a98e3f5a82f20724f9 | https://github.com/fordnox/php-queue-manager/blob/68f8918a367e672eea1d95a98e3f5a82f20724f9/Queue/Manager.php#L380-L390 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.