repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
bariew/yii2-rbac-cms-module | models/AuthItem.php | AuthItem.addChild | public function addChild(AuthItem $item)
{
if ($item->isNewRecord && !$item->save()) {
return false;
}
return Yii::$app->authManager->addChild($this, $item);
} | php | public function addChild(AuthItem $item)
{
if ($item->isNewRecord && !$item->save()) {
return false;
}
return Yii::$app->authManager->addChild($this, $item);
} | [
"public",
"function",
"addChild",
"(",
"AuthItem",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"->",
"isNewRecord",
"&&",
"!",
"$",
"item",
"->",
"save",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"Yii",
"::",
"$",
"app",
"->",
... | Attaches child related to this model by AuthItemChild.
@param AuthItem $item child.
@return integer whether child is attached. | [
"Attaches",
"child",
"related",
"to",
"this",
"model",
"by",
"AuthItemChild",
"."
] | train | https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/models/AuthItem.php#L314-L320 |
mimmi20/Wurfl | src/Handlers/Normalizer/Generic/BlackBerry.php | BlackBerry.normalize | public function normalize($userAgent)
{
$userAgent = str_ireplace('blackberry', 'BlackBerry', $userAgent);
$pos = strpos($userAgent, 'BlackBerry');
if ($pos !== false && $pos > 0) {
$userAgent = substr($userAgent, $pos);
}
return $userAgent;
} | php | public function normalize($userAgent)
{
$userAgent = str_ireplace('blackberry', 'BlackBerry', $userAgent);
$pos = strpos($userAgent, 'BlackBerry');
if ($pos !== false && $pos > 0) {
$userAgent = substr($userAgent, $pos);
}
return $userAgent;
} | [
"public",
"function",
"normalize",
"(",
"$",
"userAgent",
")",
"{",
"$",
"userAgent",
"=",
"str_ireplace",
"(",
"'blackberry'",
",",
"'BlackBerry'",
",",
"$",
"userAgent",
")",
";",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"userAgent",
",",
"'BlackBerry'",
")"... | @param string $userAgent
@return mixed|string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Normalizer/Generic/BlackBerry.php#L33-L43 |
soloproyectos-php/text-tokenizer | src/text/tokenizer/TextTokenizer.php | TextTokenizer.eq | public function eq($str, $flags = 0)
{
$ret = false;
if (list($str) = $this->match(preg_quote($str, "/"), $matches, $flags)
) {
$ret = array($str);
}
return $ret;
} | php | public function eq($str, $flags = 0)
{
$ret = false;
if (list($str) = $this->match(preg_quote($str, "/"), $matches, $flags)
) {
$ret = array($str);
}
return $ret;
} | [
"public",
"function",
"eq",
"(",
"$",
"str",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"list",
"(",
"$",
"str",
")",
"=",
"$",
"this",
"->",
"match",
"(",
"preg_quote",
"(",
"$",
"str",
",",
"\"/\"",
")"... | Is the next token equal to a given string?
This function returns false if the next token is not equal to a given string
or an array with a single string.
@param string $str A string
@param integer $flags Flags (default is 0)
@return false|array of a single string | [
"Is",
"the",
"next",
"token",
"equal",
"to",
"a",
"given",
"string?"
] | train | https://github.com/soloproyectos-php/text-tokenizer/blob/792b463ad8790fa19a7120d1354ee852fc70c017/src/text/tokenizer/TextTokenizer.php#L146-L156 |
soloproyectos-php/text-tokenizer | src/text/tokenizer/TextTokenizer.php | TextTokenizer.in | public function in($items, $flags = 0)
{
$ret = false;
// sorts the items in descending order according to their length
usort(
$items,
function ($item1, $item2) {
return strlen($item1) < strlen($item2);
}
);
foreach ($item... | php | public function in($items, $flags = 0)
{
$ret = false;
// sorts the items in descending order according to their length
usort(
$items,
function ($item1, $item2) {
return strlen($item1) < strlen($item2);
}
);
foreach ($item... | [
"public",
"function",
"in",
"(",
"$",
"items",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"// sorts the items in descending order according to their length",
"usort",
"(",
"$",
"items",
",",
"function",
"(",
"$",
"item1",
",",
"$",... | Is the next token the in a given list?
This function returns false if the next token is not in a given list
or an array with a single string.
@param array $items An array of strings
@param integer $flags Flags (default is 0)
@return false|array of a single string | [
"Is",
"the",
"next",
"token",
"the",
"in",
"a",
"given",
"list?"
] | train | https://github.com/soloproyectos-php/text-tokenizer/blob/792b463ad8790fa19a7120d1354ee852fc70c017/src/text/tokenizer/TextTokenizer.php#L169-L189 |
soloproyectos-php/text-tokenizer | src/text/tokenizer/TextTokenizer.php | TextTokenizer.number | public function number($flags = 0)
{
$ret = false;
if ($number = $this->match(TextTokenizer::NUMBER, $matches, $flags)) {
$ret = $number;
}
return $ret;
} | php | public function number($flags = 0)
{
$ret = false;
if ($number = $this->match(TextTokenizer::NUMBER, $matches, $flags)) {
$ret = $number;
}
return $ret;
} | [
"public",
"function",
"number",
"(",
"$",
"flags",
"=",
"0",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"$",
"number",
"=",
"$",
"this",
"->",
"match",
"(",
"TextTokenizer",
"::",
"NUMBER",
",",
"$",
"matches",
",",
"$",
"flags",
")",
")... | Is the next token a number?
This function returns false if the next token is not a number or an array
with a single string.
@param integer $flags Flags (default is 0)
@return false|array of a single string | [
"Is",
"the",
"next",
"token",
"a",
"number?"
] | train | https://github.com/soloproyectos-php/text-tokenizer/blob/792b463ad8790fa19a7120d1354ee852fc70c017/src/text/tokenizer/TextTokenizer.php#L201-L210 |
soloproyectos-php/text-tokenizer | src/text/tokenizer/TextTokenizer.php | TextTokenizer.str | public function str($flags = 0)
{
$ret = false;
if ($this->match(TextTokenizer::STRING, $matches, $flags)) {
$delimiter = $matches[2];
$str = $matches[3];
$str = str_replace("\\$delimiter", "$delimiter", $str);
$ret = array($str);
}
r... | php | public function str($flags = 0)
{
$ret = false;
if ($this->match(TextTokenizer::STRING, $matches, $flags)) {
$delimiter = $matches[2];
$str = $matches[3];
$str = str_replace("\\$delimiter", "$delimiter", $str);
$ret = array($str);
}
r... | [
"public",
"function",
"str",
"(",
"$",
"flags",
"=",
"0",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"match",
"(",
"TextTokenizer",
"::",
"STRING",
",",
"$",
"matches",
",",
"$",
"flags",
")",
")",
"{",
"$",
"delimiter... | Is the next token a string?
This function returns false if the next token is not a string or an array
with a single string.
@param integer $flags Flags (default is 0)
@return false|array of a single string | [
"Is",
"the",
"next",
"token",
"a",
"string?"
] | train | https://github.com/soloproyectos-php/text-tokenizer/blob/792b463ad8790fa19a7120d1354ee852fc70c017/src/text/tokenizer/TextTokenizer.php#L222-L234 |
soloproyectos-php/text-tokenizer | src/text/tokenizer/TextTokenizer.php | TextTokenizer.token | public function token()
{
$ret = false;
if (list($token) = $this->match(TextTokenizer::TOKEN)) {
$ret = array($token);
}
return $ret;
} | php | public function token()
{
$ret = false;
if (list($token) = $this->match(TextTokenizer::TOKEN)) {
$ret = array($token);
}
return $ret;
} | [
"public",
"function",
"token",
"(",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"list",
"(",
"$",
"token",
")",
"=",
"$",
"this",
"->",
"match",
"(",
"TextTokenizer",
"::",
"TOKEN",
")",
")",
"{",
"$",
"ret",
"=",
"array",
"(",
"$",
"to... | Gets the next token.
This function returns false if there are no more tokens or an array with a
single string.
For example:
```php
// splits a string into tokens
$t = new TextTokenizer("lorem ipsum; dolor sit amet.");
while (list($token) = $t->token()) {
echo "$token-";
}
```
@return false|array of a single string | [
"Gets",
"the",
"next",
"token",
"."
] | train | https://github.com/soloproyectos-php/text-tokenizer/blob/792b463ad8790fa19a7120d1354ee852fc70c017/src/text/tokenizer/TextTokenizer.php#L253-L262 |
soloproyectos-php/text-tokenizer | src/text/tokenizer/TextTokenizer.php | TextTokenizer.id | public function id()
{
$ret = false;
if (list($id) = $this->match(TextTokenizer::IDENTIFIER)) {
$ret = array($id);
}
return $ret;
} | php | public function id()
{
$ret = false;
if (list($id) = $this->match(TextTokenizer::IDENTIFIER)) {
$ret = array($id);
}
return $ret;
} | [
"public",
"function",
"id",
"(",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"list",
"(",
"$",
"id",
")",
"=",
"$",
"this",
"->",
"match",
"(",
"TextTokenizer",
"::",
"IDENTIFIER",
")",
")",
"{",
"$",
"ret",
"=",
"array",
"(",
"$",
"id"... | Is the next token an identifier?
This function returns false if the next token is not an identifier or an
array with a single string.
@return false|array of a single string | [
"Is",
"the",
"next",
"token",
"an",
"identifier?"
] | train | https://github.com/soloproyectos-php/text-tokenizer/blob/792b463ad8790fa19a7120d1354ee852fc70c017/src/text/tokenizer/TextTokenizer.php#L272-L281 |
soloproyectos-php/text-tokenizer | src/text/tokenizer/TextTokenizer.php | TextTokenizer.match | public function match($regexp, &$matches = array(), $flags = 0)
{
// we do not like empty strings
if (strlen($regexp) == 0) {
return false;
}
$ret = false;
$explicitRegexp = strlen($regexp) > 0 && $regexp[0] == "/";
$substr = substr($this->string, $this->... | php | public function match($regexp, &$matches = array(), $flags = 0)
{
// we do not like empty strings
if (strlen($regexp) == 0) {
return false;
}
$ret = false;
$explicitRegexp = strlen($regexp) > 0 && $regexp[0] == "/";
$substr = substr($this->string, $this->... | [
"public",
"function",
"match",
"(",
"$",
"regexp",
",",
"&",
"$",
"matches",
"=",
"array",
"(",
")",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"// we do not like empty strings",
"if",
"(",
"strlen",
"(",
"$",
"regexp",
")",
"==",
"0",
")",
"{",
"return"... | Matches the string against a regex.
This function matches the string against a regular expressión. If they
match, it advances the offset position and returns an array with a single
string. Otherwise, it returns false. You can use regex without delimiters.
Instead of using /^\s*(\w+)/, you can use simply '\w+'.
Exampl... | [
"Matches",
"the",
"string",
"against",
"a",
"regex",
"."
] | train | https://github.com/soloproyectos-php/text-tokenizer/blob/792b463ad8790fa19a7120d1354ee852fc70c017/src/text/tokenizer/TextTokenizer.php#L344-L394 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Complex/GMPComplexType.php | GMPComplexType.isZero | public function isZero()
{
return (
gmp_sign($this->value['real']->numerator()->gmp()) == 0
&& gmp_sign($this->value['imaginary']->numerator()->gmp()) == 0
);
} | php | public function isZero()
{
return (
gmp_sign($this->value['real']->numerator()->gmp()) == 0
&& gmp_sign($this->value['imaginary']->numerator()->gmp()) == 0
);
} | [
"public",
"function",
"isZero",
"(",
")",
"{",
"return",
"(",
"gmp_sign",
"(",
"$",
"this",
"->",
"value",
"[",
"'real'",
"]",
"->",
"numerator",
"(",
")",
"->",
"gmp",
"(",
")",
")",
"==",
"0",
"&&",
"gmp_sign",
"(",
"$",
"this",
"->",
"value",
... | Is this number equal to zero?
@return boolean | [
"Is",
"this",
"number",
"equal",
"to",
"zero?"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Complex/GMPComplexType.php#L67-L73 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Complex/GMPComplexType.php | GMPComplexType.modulus | public function modulus()
{
if ($this->isReal()) {
//sqrt(r^2 + 0^2) = sqrt(r^2) = abs(r)
/** @noinspection PhpUndefinedMethodInspection */
return $this->value['real']->abs();
}
//get r^2 and i^2
$sqrR = array(
'n' => gmp_pow($this->val... | php | public function modulus()
{
if ($this->isReal()) {
//sqrt(r^2 + 0^2) = sqrt(r^2) = abs(r)
/** @noinspection PhpUndefinedMethodInspection */
return $this->value['real']->abs();
}
//get r^2 and i^2
$sqrR = array(
'n' => gmp_pow($this->val... | [
"public",
"function",
"modulus",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isReal",
"(",
")",
")",
"{",
"//sqrt(r^2 + 0^2) = sqrt(r^2) = abs(r)",
"/** @noinspection PhpUndefinedMethodInspection */",
"return",
"$",
"this",
"->",
"value",
"[",
"'real'",
"]",
"->... | Return the modulus, also known as absolute value or magnitude of this number
= sqrt(r^2 + i^2);
@return \Chippyash\Type\Number\Rational\GMPRationalType | [
"Return",
"the",
"modulus",
"also",
"known",
"as",
"absolute",
"value",
"or",
"magnitude",
"of",
"this",
"number",
"=",
"sqrt",
"(",
"r^2",
"+",
"i^2",
")",
";"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Complex/GMPComplexType.php#L81-L123 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Complex/GMPComplexType.php | GMPComplexType.asRational | public function asRational()
{
if ($this->isReal()) {
return new RationalType(
$this->value['real']->numerator()->asIntType(),
$this->value['real']->denominator()->asIntType()
);
}
throw new NotRealComplexException();
} | php | public function asRational()
{
if ($this->isReal()) {
return new RationalType(
$this->value['real']->numerator()->asIntType(),
$this->value['real']->denominator()->asIntType()
);
}
throw new NotRealComplexException();
} | [
"public",
"function",
"asRational",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isReal",
"(",
")",
")",
"{",
"return",
"new",
"RationalType",
"(",
"$",
"this",
"->",
"value",
"[",
"'real'",
"]",
"->",
"numerator",
"(",
")",
"->",
"asIntType",
"(",
... | Return number as Rational number.
NB, numerator and denominator will be caste as IntTypes
@return \Chippyash\Type\Number\Rational\RationalType
@throws NotRealComplexException | [
"Return",
"number",
"as",
"Rational",
"number",
".",
"NB",
"numerator",
"and",
"denominator",
"will",
"be",
"caste",
"as",
"IntTypes"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Complex/GMPComplexType.php#L217-L227 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Complex/GMPComplexType.php | GMPComplexType.lcm | private function lcm($a, $b)
{
return gmp_abs(gmp_div_q(gmp_mul($a, $b), gmp_gcd($a, $b)));
} | php | private function lcm($a, $b)
{
return gmp_abs(gmp_div_q(gmp_mul($a, $b), gmp_gcd($a, $b)));
} | [
"private",
"function",
"lcm",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"return",
"gmp_abs",
"(",
"gmp_div_q",
"(",
"gmp_mul",
"(",
"$",
"a",
",",
"$",
"b",
")",
",",
"gmp_gcd",
"(",
"$",
"a",
",",
"$",
"b",
")",
")",
")",
";",
"}"
] | Return Least Common Multiple of two numbers
@param int $a
@param int $b
@return int | [
"Return",
"Least",
"Common",
"Multiple",
"of",
"two",
"numbers"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Complex/GMPComplexType.php#L250-L253 |
serverdensity/sd-php-wrapper | lib/serverdensity/HttpClient/Listener/ErrorListener.php | ErrorListener.onRequestError | public function onRequestError(ErrorEvent $event)
{
$request = $event->getRequest();
$hasResponse = $event->hasResponse();
if ($hasResponse){
$response = $event->getResponse();
if ($this->isClientError($response) || $this->isServerError($response)) {
$... | php | public function onRequestError(ErrorEvent $event)
{
$request = $event->getRequest();
$hasResponse = $event->hasResponse();
if ($hasResponse){
$response = $event->getResponse();
if ($this->isClientError($response) || $this->isServerError($response)) {
$... | [
"public",
"function",
"onRequestError",
"(",
"ErrorEvent",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"$",
"hasResponse",
"=",
"$",
"event",
"->",
"hasResponse",
"(",
")",
";",
"if",
"(",
"$",
"hasResp... | {@inheritDoc} | [
"{"
] | train | https://github.com/serverdensity/sd-php-wrapper/blob/9c742a9ee61e32a9bc4ed17b5fe0eca1f4c3015e/lib/serverdensity/HttpClient/Listener/ErrorListener.php#L39-L93 |
bwaidelich/Wwwision.AssetConstraints | Classes/DataSource/AssetCollectionDataSource.php | AssetCollectionDataSource.getData | public function getData(NodeInterface $node = null, array $arguments)
{
$assetCollections = [];
/** @var AssetCollection $assetCollection */
foreach ($this->assetCollectionRepository->findAll() as $assetCollection) {
$assetCollections[] = ['value' => $this->persistenceManager->ge... | php | public function getData(NodeInterface $node = null, array $arguments)
{
$assetCollections = [];
/** @var AssetCollection $assetCollection */
foreach ($this->assetCollectionRepository->findAll() as $assetCollection) {
$assetCollections[] = ['value' => $this->persistenceManager->ge... | [
"public",
"function",
"getData",
"(",
"NodeInterface",
"$",
"node",
"=",
"null",
",",
"array",
"$",
"arguments",
")",
"{",
"$",
"assetCollections",
"=",
"[",
"]",
";",
"/** @var AssetCollection $assetCollection */",
"foreach",
"(",
"$",
"this",
"->",
"assetColle... | Get data
@param NodeInterface $node unused
@param array $arguments unused
@return array title of all asset collections | [
"Get",
"data"
] | train | https://github.com/bwaidelich/Wwwision.AssetConstraints/blob/fddd5389cf5eb8e44f3caf709258d7044345d0ae/Classes/DataSource/AssetCollectionDataSource.php#L51-L60 |
yosmanyga/validation | src/Yosmanyga/Validation/Resource/Normalizer/SuddenAnnotationFile/ObjectReferenceNormalizer.php | ObjectReferenceNormalizer.supports | public function supports($data, Resource $resource)
{
if (strrpos($data['key'], '\\') !== false) {
$data = substr($data['key'], strrpos($data['key'], '\\') + 1);
} else {
$data = $data['key'];
}
return parent::supports($data, $resource);
} | php | public function supports($data, Resource $resource)
{
if (strrpos($data['key'], '\\') !== false) {
$data = substr($data['key'], strrpos($data['key'], '\\') + 1);
} else {
$data = $data['key'];
}
return parent::supports($data, $resource);
} | [
"public",
"function",
"supports",
"(",
"$",
"data",
",",
"Resource",
"$",
"resource",
")",
"{",
"if",
"(",
"strrpos",
"(",
"$",
"data",
"[",
"'key'",
"]",
",",
"'\\\\'",
")",
"!==",
"false",
")",
"{",
"$",
"data",
"=",
"substr",
"(",
"$",
"data",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Resource/Normalizer/SuddenAnnotationFile/ObjectReferenceNormalizer.php#L24-L33 |
markwatkinson/luminous | extern/markuplite/markuplite.class.php | MarkupLite.AddHandler | function AddHandler($name, $func, $priority)
{
$handler = array(
'name'=>$name,
'func'=>$func,
'priority'=>$priority
);
$this->handlers[] = $handler;
} | php | function AddHandler($name, $func, $priority)
{
$handler = array(
'name'=>$name,
'func'=>$func,
'priority'=>$priority
);
$this->handlers[] = $handler;
} | [
"function",
"AddHandler",
"(",
"$",
"name",
",",
"$",
"func",
",",
"$",
"priority",
")",
"{",
"$",
"handler",
"=",
"array",
"(",
"'name'",
"=>",
"$",
"name",
",",
"'func'",
"=>",
"$",
"func",
",",
"'priority'",
"=>",
"$",
"priority",
")",
";",
"$",... | Adds a handler
'func' is a function which receives the string as its only argument.
It should return the string (with modifications) afterwards
Priority is an integer 0-10 which allows the caller to define a simple
hierarchy of what order the handlers should be executed in | [
"Adds",
"a",
"handler",
"func",
"is",
"a",
"function",
"which",
"receives",
"the",
"string",
"as",
"its",
"only",
"argument",
".",
"It",
"should",
"return",
"the",
"string",
"(",
"with",
"modifications",
")",
"afterwards"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/extern/markuplite/markuplite.class.php#L95-L103 |
serverdensity/sd-php-wrapper | lib/serverdensity/Api/Users.php | Users.create | public function create(array $user, array $tagNames = array())
{
if (!empty($tagNames)){
$tagEndpoint = new Tags($this->client);
$tags = $tagEndpoint->findAll($tagNames);
if(!empty($tags['notFound'])){
foreach($tags['notFound'] as $name){
... | php | public function create(array $user, array $tagNames = array())
{
if (!empty($tagNames)){
$tagEndpoint = new Tags($this->client);
$tags = $tagEndpoint->findAll($tagNames);
if(!empty($tags['notFound'])){
foreach($tags['notFound'] as $name){
... | [
"public",
"function",
"create",
"(",
"array",
"$",
"user",
",",
"array",
"$",
"tagNames",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"tagNames",
")",
")",
"{",
"$",
"tagEndpoint",
"=",
"new",
"Tags",
"(",
"$",
"this",
"-... | Create a user
@link https://developer.serverdensity.com/docs/creating-a-user
@param array $user
@return an array with the user that got created | [
"Create",
"a",
"user"
] | train | https://github.com/serverdensity/sd-php-wrapper/blob/9c742a9ee61e32a9bc4ed17b5fe0eca1f4c3015e/lib/serverdensity/Api/Users.php#L43-L66 |
serverdensity/sd-php-wrapper | lib/serverdensity/Api/Users.php | Users.update | public function update($id, $fields)
{
$fields = $this->makeJsonReady($fields);
return $this->put('users/users/'.rawurlencode($id), $fields);
} | php | public function update($id, $fields)
{
$fields = $this->makeJsonReady($fields);
return $this->put('users/users/'.rawurlencode($id), $fields);
} | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"$",
"fields",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"makeJsonReady",
"(",
"$",
"fields",
")",
";",
"return",
"$",
"this",
"->",
"put",
"(",
"'users/users/'",
".",
"rawurlencode",
"(",
"... | Update a user
@link https://developer.serverdensity.com/docs/updating-a-user
@param string $id
@param array $fields
@return an array with the fields that got updated plus when it got updated | [
"Update",
"a",
"user"
] | train | https://github.com/serverdensity/sd-php-wrapper/blob/9c742a9ee61e32a9bc4ed17b5fe0eca1f4c3015e/lib/serverdensity/Api/Users.php#L75-L79 |
crysalead/net | src/Http/Psr7/Uri.php | Uri.getAuthority | public function getAuthority()
{
if (empty($this->_host)) {
return '';
}
$authority = $this->_host;
if (! empty($this->_userInfo)) {
$authority = $this->_userInfo . '@' . $authority;
}
if ($this->_isNonStandardPort($this->_scheme, $this->_hos... | php | public function getAuthority()
{
if (empty($this->_host)) {
return '';
}
$authority = $this->_host;
if (! empty($this->_userInfo)) {
$authority = $this->_userInfo . '@' . $authority;
}
if ($this->_isNonStandardPort($this->_scheme, $this->_hos... | [
"public",
"function",
"getAuthority",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_host",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"authority",
"=",
"$",
"this",
"->",
"_host",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/Uri.php#L149-L165 |
crysalead/net | src/Http/Psr7/Uri.php | Uri.getPort | public function getPort()
{
return $this->_isNonStandardPort($this->_scheme, $this->_host, $this->_port)
? $this->_port
: null;
} | php | public function getPort()
{
return $this->_isNonStandardPort($this->_scheme, $this->_host, $this->_port)
? $this->_port
: null;
} | [
"public",
"function",
"getPort",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"_isNonStandardPort",
"(",
"$",
"this",
"->",
"_scheme",
",",
"$",
"this",
"->",
"_host",
",",
"$",
"this",
"->",
"_port",
")",
"?",
"$",
"this",
"->",
"_port",
":",
"null",... | {@inheritdoc} | [
"{"
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/Uri.php#L186-L191 |
crysalead/net | src/Http/Psr7/Uri.php | Uri.withScheme | public function withScheme($scheme)
{
if (! is_string($scheme)) {
throw new InvalidArgumentException(sprintf(
'%s expects a string argument; received %s',
__METHOD__,
(is_object($scheme) ? get_class($scheme) : gettype($scheme))
));
... | php | public function withScheme($scheme)
{
if (! is_string($scheme)) {
throw new InvalidArgumentException(sprintf(
'%s expects a string argument; received %s',
__METHOD__,
(is_object($scheme) ? get_class($scheme) : gettype($scheme))
));
... | [
"public",
"function",
"withScheme",
"(",
"$",
"scheme",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"scheme",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'%s expects a string argument; received %s'",
",",
"__METHOD__",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/Uri.php#L220-L241 |
crysalead/net | src/Http/Psr7/Uri.php | Uri.withHost | public function withHost($host)
{
if (! is_string($host)) {
throw new InvalidArgumentException(sprintf(
'%s expects a string argument; received %s',
__METHOD__,
(is_object($host) ? get_class($host) : gettype($host))
));
}
... | php | public function withHost($host)
{
if (! is_string($host)) {
throw new InvalidArgumentException(sprintf(
'%s expects a string argument; received %s',
__METHOD__,
(is_object($host) ? get_class($host) : gettype($host))
));
}
... | [
"public",
"function",
"withHost",
"(",
"$",
"host",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"host",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'%s expects a string argument; received %s'",
",",
"__METHOD__",
",",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/Uri.php#L282-L301 |
crysalead/net | src/Http/Psr7/Uri.php | Uri.withPort | public function withPort($port)
{
if (! is_numeric($port) && $port !== null) {
throw new InvalidArgumentException(sprintf(
'Invalid port "%s" specified; must be an integer, an integer string, or null',
(is_object($port) ? get_class($port) : gettype($port))
... | php | public function withPort($port)
{
if (! is_numeric($port) && $port !== null) {
throw new InvalidArgumentException(sprintf(
'Invalid port "%s" specified; must be an integer, an integer string, or null',
(is_object($port) ? get_class($port) : gettype($port))
... | [
"public",
"function",
"withPort",
"(",
"$",
"port",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"port",
")",
"&&",
"$",
"port",
"!==",
"null",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Invalid port \"%s\" specified; m... | {@inheritdoc} | [
"{"
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/Uri.php#L306-L335 |
crysalead/net | src/Http/Psr7/Uri.php | Uri._parseUri | protected function _parseUri($uri)
{
$parts = parse_url($uri);
if (false === $parts) {
throw new \InvalidArgumentException(
'The source URI string appears to be malformed'
);
}
$this->_scheme = isset($parts['scheme']) ? $this->_filterSch... | php | protected function _parseUri($uri)
{
$parts = parse_url($uri);
if (false === $parts) {
throw new \InvalidArgumentException(
'The source URI string appears to be malformed'
);
}
$this->_scheme = isset($parts['scheme']) ? $this->_filterSch... | [
"protected",
"function",
"_parseUri",
"(",
"$",
"uri",
")",
"{",
"$",
"parts",
"=",
"parse_url",
"(",
"$",
"uri",
")",
";",
"if",
"(",
"false",
"===",
"$",
"parts",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The source URI string ap... | Parse a URI into its parts, and set the properties
@param string $uri | [
"Parse",
"a",
"URI",
"into",
"its",
"parts",
"and",
"set",
"the",
"properties"
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/Uri.php#L434-L455 |
crysalead/net | src/Http/Psr7/Uri.php | Uri._createUriString | protected static function _createUriString($scheme, $authority, $path, $query, $fragment)
{
$uri = '';
if (! empty($scheme)) {
$uri .= sprintf('%s://', $scheme);
}
if (! empty($authority)) {
$uri .= $authority;
}
if ($path) {
if ... | php | protected static function _createUriString($scheme, $authority, $path, $query, $fragment)
{
$uri = '';
if (! empty($scheme)) {
$uri .= sprintf('%s://', $scheme);
}
if (! empty($authority)) {
$uri .= $authority;
}
if ($path) {
if ... | [
"protected",
"static",
"function",
"_createUriString",
"(",
"$",
"scheme",
",",
"$",
"authority",
",",
"$",
"path",
",",
"$",
"query",
",",
"$",
"fragment",
")",
"{",
"$",
"uri",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"scheme",
")",
")"... | Create a URI string from its various parts
@param string $scheme
@param string $authority
@param string $path
@param string $query
@param string $fragment
@return string | [
"Create",
"a",
"URI",
"string",
"from",
"its",
"various",
"parts"
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/Uri.php#L467-L496 |
crysalead/net | src/Http/Psr7/Uri.php | Uri._filterScheme | protected function _filterScheme($scheme)
{
$scheme = strtolower($scheme);
$scheme = preg_replace('#:(//)?$#', '', $scheme);
if (empty($scheme)) {
return '';
}
if (! array_key_exists($scheme, $this->_allowedSchemes)) {
throw new InvalidArgumentExcept... | php | protected function _filterScheme($scheme)
{
$scheme = strtolower($scheme);
$scheme = preg_replace('#:(//)?$#', '', $scheme);
if (empty($scheme)) {
return '';
}
if (! array_key_exists($scheme, $this->_allowedSchemes)) {
throw new InvalidArgumentExcept... | [
"protected",
"function",
"_filterScheme",
"(",
"$",
"scheme",
")",
"{",
"$",
"scheme",
"=",
"strtolower",
"(",
"$",
"scheme",
")",
";",
"$",
"scheme",
"=",
"preg_replace",
"(",
"'#:(//)?$#'",
",",
"''",
",",
"$",
"scheme",
")",
";",
"if",
"(",
"empty",... | Filters the scheme to ensure it is a valid scheme.
@param string $scheme Scheme name.
@return string Filtered scheme. | [
"Filters",
"the",
"scheme",
"to",
"ensure",
"it",
"is",
"a",
"valid",
"scheme",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/Uri.php#L526-L544 |
crysalead/net | src/Http/Psr7/Uri.php | Uri._filterPath | protected function _filterPath($path)
{
$path = preg_replace_callback(
'/(?:[^' . self::CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/',
[$this, '_urlEncodeChar'],
$path
);
if (empty($path)) {
// No path
return $path;
... | php | protected function _filterPath($path)
{
$path = preg_replace_callback(
'/(?:[^' . self::CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/',
[$this, '_urlEncodeChar'],
$path
);
if (empty($path)) {
// No path
return $path;
... | [
"protected",
"function",
"_filterPath",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"preg_replace_callback",
"(",
"'/(?:[^'",
".",
"self",
"::",
"CHAR_UNRESERVED",
".",
"':@&=\\+\\$,\\/;%]+|%(?![A-Fa-f0-9]{2}))/'",
",",
"[",
"$",
"this",
",",
"'_urlEncodeChar'",
... | Filters the path of a URI to ensure it is properly encoded.
@param string $path
@return string | [
"Filters",
"the",
"path",
"of",
"a",
"URI",
"to",
"ensure",
"it",
"is",
"properly",
"encoded",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/Uri.php#L552-L572 |
crysalead/net | src/Http/Psr7/Uri.php | Uri._filterQuery | protected function _filterQuery($query)
{
if (! empty($query) && strpos($query, '?') === 0) {
$query = substr($query, 1);
}
$parts = explode('&', $query);
foreach ($parts as $index => $part) {
list($key, $value) = $this->_splitQueryValue($part);
i... | php | protected function _filterQuery($query)
{
if (! empty($query) && strpos($query, '?') === 0) {
$query = substr($query, 1);
}
$parts = explode('&', $query);
foreach ($parts as $index => $part) {
list($key, $value) = $this->_splitQueryValue($part);
i... | [
"protected",
"function",
"_filterQuery",
"(",
"$",
"query",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"query",
")",
"&&",
"strpos",
"(",
"$",
"query",
",",
"'?'",
")",
"===",
"0",
")",
"{",
"$",
"query",
"=",
"substr",
"(",
"$",
"query",
",",
... | Filter a query string to ensure it is propertly encoded.
Ensures that the values in the query string are properly urlencoded.
@param string $query
@return string | [
"Filter",
"a",
"query",
"string",
"to",
"ensure",
"it",
"is",
"propertly",
"encoded",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/Uri.php#L582-L603 |
crysalead/net | src/Http/Psr7/Uri.php | Uri._splitQueryValue | protected function _splitQueryValue($value)
{
$data = explode('=', $value, 2);
if (1 === count($data)) {
$data[] = null;
}
return $data;
} | php | protected function _splitQueryValue($value)
{
$data = explode('=', $value, 2);
if (1 === count($data)) {
$data[] = null;
}
return $data;
} | [
"protected",
"function",
"_splitQueryValue",
"(",
"$",
"value",
")",
"{",
"$",
"data",
"=",
"explode",
"(",
"'='",
",",
"$",
"value",
",",
"2",
")",
";",
"if",
"(",
"1",
"===",
"count",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"[",
"]",
"=... | Split a query value into a key/value tuple.
@param string $value
@return array A value with exactly two elements, key and value | [
"Split",
"a",
"query",
"value",
"into",
"a",
"key",
"/",
"value",
"tuple",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/Uri.php#L611-L618 |
crysalead/net | src/Http/Psr7/Uri.php | Uri._filterFragment | protected function _filterFragment($fragment)
{
if (! empty($fragment) && strpos($fragment, '#') === 0) {
$fragment = substr($fragment, 1);
}
return $this->_filterQueryOrFragment($fragment);
} | php | protected function _filterFragment($fragment)
{
if (! empty($fragment) && strpos($fragment, '#') === 0) {
$fragment = substr($fragment, 1);
}
return $this->_filterQueryOrFragment($fragment);
} | [
"protected",
"function",
"_filterFragment",
"(",
"$",
"fragment",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"fragment",
")",
"&&",
"strpos",
"(",
"$",
"fragment",
",",
"'#'",
")",
"===",
"0",
")",
"{",
"$",
"fragment",
"=",
"substr",
"(",
"$",
"... | Filter a fragment value to ensure it is properly encoded.
@param null|string $fragment
@return string | [
"Filter",
"a",
"fragment",
"value",
"to",
"ensure",
"it",
"is",
"properly",
"encoded",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/Uri.php#L626-L633 |
ganlvtech/php-simple-cas | src/PhpCas.php | PhpCas.forceAuthentication | public function forceAuthentication()
{
if (self::isAuthenticated()) {
return true;
} elseif ($this->getTicket()) {
return $this->validateCas();
}
session_write_close();
$this->redirectToCas();
// never reached
return true;
} | php | public function forceAuthentication()
{
if (self::isAuthenticated()) {
return true;
} elseif ($this->getTicket()) {
return $this->validateCas();
}
session_write_close();
$this->redirectToCas();
// never reached
return true;
} | [
"public",
"function",
"forceAuthentication",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"isAuthenticated",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"getTicket",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"v... | If not authenticated, redirect to CAS.
If authenticated, return true.
@return bool always true. | [
"If",
"not",
"authenticated",
"redirect",
"to",
"CAS",
".",
"If",
"authenticated",
"return",
"true",
"."
] | train | https://github.com/ganlvtech/php-simple-cas/blob/21ce1e0988f14136536ff705a1b39e3603ea4a5c/src/PhpCas.php#L79-L90 |
ganlvtech/php-simple-cas | src/PhpCas.php | PhpCas.checkAuthentication | public function checkAuthentication()
{
if (self::isAuthenticated()) {
return true;
} elseif (self::isGatewayed()) {
return $this->validateCas();
}
self::setGatewayed(true);
session_write_close();
$this->redirectToCas(true);
// never re... | php | public function checkAuthentication()
{
if (self::isAuthenticated()) {
return true;
} elseif (self::isGatewayed()) {
return $this->validateCas();
}
self::setGatewayed(true);
session_write_close();
$this->redirectToCas(true);
// never re... | [
"public",
"function",
"checkAuthentication",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"isAuthenticated",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"elseif",
"(",
"self",
"::",
"isGatewayed",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"valida... | If not gatewayed, redirect to CAS with gateway=true.
@return bool true - authenticated. false - guess mode. | [
"If",
"not",
"gatewayed",
"redirect",
"to",
"CAS",
"with",
"gateway",
"=",
"true",
"."
] | train | https://github.com/ganlvtech/php-simple-cas/blob/21ce1e0988f14136536ff705a1b39e3603ea4a5c/src/PhpCas.php#L97-L109 |
ganlvtech/php-simple-cas | src/PhpCas.php | PhpCas.redirectToCas | protected function redirectToCas($gateway = false)
{
$query['service'] = self::getDefaultService();
if ($gateway) {
$query['gateway'] = 'true';
}
self::http_redirect($this->server['login_url'] . '?' . http_build_query($query));
// never reached
return true... | php | protected function redirectToCas($gateway = false)
{
$query['service'] = self::getDefaultService();
if ($gateway) {
$query['gateway'] = 'true';
}
self::http_redirect($this->server['login_url'] . '?' . http_build_query($query));
// never reached
return true... | [
"protected",
"function",
"redirectToCas",
"(",
"$",
"gateway",
"=",
"false",
")",
"{",
"$",
"query",
"[",
"'service'",
"]",
"=",
"self",
"::",
"getDefaultService",
"(",
")",
";",
"if",
"(",
"$",
"gateway",
")",
"{",
"$",
"query",
"[",
"'gateway'",
"]",... | Redirect to CAS server for login
@param bool $gateway
@return bool always true, but never reach. | [
"Redirect",
"to",
"CAS",
"server",
"for",
"login"
] | train | https://github.com/ganlvtech/php-simple-cas/blob/21ce1e0988f14136536ff705a1b39e3603ea4a5c/src/PhpCas.php#L166-L175 |
ganlvtech/php-simple-cas | src/PhpCas.php | PhpCas.file_get_contents | protected static function file_get_contents($url, $timeout = 10)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if (substr($url, 0, 8) === 'https://') {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
}
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate'... | php | protected static function file_get_contents($url, $timeout = 10)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if (substr($url, 0, 8) === 'https://') {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
}
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate'... | [
"protected",
"static",
"function",
"file_get_contents",
"(",
"$",
"url",
",",
"$",
"timeout",
"=",
"10",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_URL",
",",
"$",
"url",
")",
";",
"if",
"(",
... | Send GET request
@param string $url URL
@param int $timeout Timeout(seconds)
@return string Text response | [
"Send",
"GET",
"request"
] | train | https://github.com/ganlvtech/php-simple-cas/blob/21ce1e0988f14136536ff705a1b39e3603ea4a5c/src/PhpCas.php#L239-L257 |
ganlvtech/php-simple-cas | src/PhpCas.php | PhpCas.build_url | protected static function build_url($parts)
{
return (!empty($parts['scheme']) ? "{$parts['scheme']}:" : '') .
((!empty($parts['user']) || !empty($parts['host'])) ? '//' : '') .
(!empty($parts['user']) ? $parts['user'] : '') .
(!empty($parts['pass']) ? ":{$parts['pass']}"... | php | protected static function build_url($parts)
{
return (!empty($parts['scheme']) ? "{$parts['scheme']}:" : '') .
((!empty($parts['user']) || !empty($parts['host'])) ? '//' : '') .
(!empty($parts['user']) ? $parts['user'] : '') .
(!empty($parts['pass']) ? ":{$parts['pass']}"... | [
"protected",
"static",
"function",
"build_url",
"(",
"$",
"parts",
")",
"{",
"return",
"(",
"!",
"empty",
"(",
"$",
"parts",
"[",
"'scheme'",
"]",
")",
"?",
"\"{$parts['scheme']}:\"",
":",
"''",
")",
".",
"(",
"(",
"!",
"empty",
"(",
"$",
"parts",
"[... | reverse parse_url
@link http://stackoverflow.com/questions/4354904/php-parse-url-reverse-parsed-url/4355011#4355011
@param array $parts
@return string | [
"reverse",
"parse_url"
] | train | https://github.com/ganlvtech/php-simple-cas/blob/21ce1e0988f14136536ff705a1b39e3603ea4a5c/src/PhpCas.php#L268-L280 |
ganlvtech/php-simple-cas | src/PhpCas.php | PhpCas.getDefaultService | protected static function getDefaultService()
{
$service = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$parts = parse_url($service);
if (isset($parts['query'])) {
parse_str($parts['query'], $query);
} else {
... | php | protected static function getDefaultService()
{
$service = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$parts = parse_url($service);
if (isset($parts['query'])) {
parse_str($parts['query'], $query);
} else {
... | [
"protected",
"static",
"function",
"getDefaultService",
"(",
")",
"{",
"$",
"service",
"=",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTPS'",
"]",
")",
"?",
"'https'",
":",
"'http'",
")",
".",
"'://'",
".",
"$",
"_SERVER",
"[",
"'SERVER_NAME'",
"]",
"... | Get the service name of this request
@return string default service name | [
"Get",
"the",
"service",
"name",
"of",
"this",
"request"
] | train | https://github.com/ganlvtech/php-simple-cas/blob/21ce1e0988f14136536ff705a1b39e3603ea4a5c/src/PhpCas.php#L287-L301 |
keboola/juicer | Pagination/Decorator/ForceStopScrollerDecorator.php | ForceStopScrollerDecorator.checkPages | private function checkPages()
{
if (is_null($this->pageLimit)) {
return false;
}
if (++$this->pageCounter > $this->pageLimit) {
return true;
}
return false;
} | php | private function checkPages()
{
if (is_null($this->pageLimit)) {
return false;
}
if (++$this->pageCounter > $this->pageLimit) {
return true;
}
return false;
} | [
"private",
"function",
"checkPages",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"pageLimit",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"++",
"$",
"this",
"->",
"pageCounter",
">",
"$",
"this",
"->",
"pageLimit",
")",
... | Uses internal counter to check page limit
@return bool | [
"Uses",
"internal",
"counter",
"to",
"check",
"page",
"limit"
] | train | https://github.com/keboola/juicer/blob/780e7900ccd23082ed234cc2c51b279a4223e9f5/Pagination/Decorator/ForceStopScrollerDecorator.php#L118-L128 |
keboola/juicer | Pagination/Decorator/ForceStopScrollerDecorator.php | ForceStopScrollerDecorator.checkTime | private function checkTime()
{
if (is_null($this->timeLimit)) {
return false;
}
if (($this->startTime + $this->timeLimit) <= time()) {
return true;
}
return false;
} | php | private function checkTime()
{
if (is_null($this->timeLimit)) {
return false;
}
if (($this->startTime + $this->timeLimit) <= time()) {
return true;
}
return false;
} | [
"private",
"function",
"checkTime",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"timeLimit",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"(",
"$",
"this",
"->",
"startTime",
"+",
"$",
"this",
"->",
"timeLimit",
")",
"<="... | Checks time between first and current request
@return bool | [
"Checks",
"time",
"between",
"first",
"and",
"current",
"request"
] | train | https://github.com/keboola/juicer/blob/780e7900ccd23082ed234cc2c51b279a4223e9f5/Pagination/Decorator/ForceStopScrollerDecorator.php#L134-L144 |
keboola/juicer | Pagination/Decorator/ForceStopScrollerDecorator.php | ForceStopScrollerDecorator.checkVolume | private function checkVolume($response)
{
if (is_null($this->volumeLimit)) {
return false;
}
$this->volumeCounter += strlen(json_encode($response));
if ($this->volumeCounter > $this->volumeLimit) {
return true;
}
return false;
} | php | private function checkVolume($response)
{
if (is_null($this->volumeLimit)) {
return false;
}
$this->volumeCounter += strlen(json_encode($response));
if ($this->volumeCounter > $this->volumeLimit) {
return true;
}
return false;
} | [
"private",
"function",
"checkVolume",
"(",
"$",
"response",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"volumeLimit",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"volumeCounter",
"+=",
"strlen",
"(",
"json_encode",
"(",
... | Count the size of $response and check the limit
@param object|array $response
@return bool | [
"Count",
"the",
"size",
"of",
"$response",
"and",
"check",
"the",
"limit"
] | train | https://github.com/keboola/juicer/blob/780e7900ccd23082ed234cc2c51b279a4223e9f5/Pagination/Decorator/ForceStopScrollerDecorator.php#L151-L162 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/ConfigSchema.php | HTMLPurifier_ConfigSchema.add | public function add($key, $default, $type, $allow_null) {
$obj = new stdclass();
$obj->type = is_int($type) ? $type : HTMLPurifier_VarParser::$types[$type];
if ($allow_null) $obj->allow_null = true;
$this->info[$key] = $obj;
$this->defaults[$key] = $default;
$this->defaul... | php | public function add($key, $default, $type, $allow_null) {
$obj = new stdclass();
$obj->type = is_int($type) ? $type : HTMLPurifier_VarParser::$types[$type];
if ($allow_null) $obj->allow_null = true;
$this->info[$key] = $obj;
$this->defaults[$key] = $default;
$this->defaul... | [
"public",
"function",
"add",
"(",
"$",
"key",
",",
"$",
"default",
",",
"$",
"type",
",",
"$",
"allow_null",
")",
"{",
"$",
"obj",
"=",
"new",
"stdclass",
"(",
")",
";",
"$",
"obj",
"->",
"type",
"=",
"is_int",
"(",
"$",
"type",
")",
"?",
"$",
... | Defines a directive for configuration
@warning Will fail of directive's namespace is defined.
@warning This method's signature is slightly different from the legacy
define() static method! Beware!
@param $namespace Namespace the directive is in
@param $name Key of directive
@param $default Default value of directive
@p... | [
"Defines",
"a",
"directive",
"for",
"configuration"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/ConfigSchema.php#L90-L97 |
venta/framework | src/Console/src/ConsoleApplication.php | ConsoleApplication.run | public function run(InputInterface $input, OutputInterface $output): int
{
return $this->console->run($input, $output);
} | php | public function run(InputInterface $input, OutputInterface $output): int
{
return $this->console->run($input, $output);
} | [
"public",
"function",
"run",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
":",
"int",
"{",
"return",
"$",
"this",
"->",
"console",
"->",
"run",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"}"
] | Runs Console Application.
@param InputInterface $input
@param OutputInterface $output
@return int | [
"Runs",
"Console",
"Application",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Console/src/ConsoleApplication.php#L47-L50 |
venta/framework | src/Console/src/ConsoleApplication.php | ConsoleApplication.initConsole | private function initConsole(string $name, string $version)
{
$this->console = $this->container->get(SymfonyConsoleApplication::class);
$this->console->setName($name);
$this->console->setVersion($version);
$this->console->setCatchExceptions(false);
$this->console->setAutoExit... | php | private function initConsole(string $name, string $version)
{
$this->console = $this->container->get(SymfonyConsoleApplication::class);
$this->console->setName($name);
$this->console->setVersion($version);
$this->console->setCatchExceptions(false);
$this->console->setAutoExit... | [
"private",
"function",
"initConsole",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"version",
")",
"{",
"$",
"this",
"->",
"console",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"SymfonyConsoleApplication",
"::",
"class",
")",
";",
"$",
"th... | Initiates Symfony Console Application.
@param string $name
@param string $version | [
"Initiates",
"Symfony",
"Console",
"Application",
"."
] | train | https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Console/src/ConsoleApplication.php#L58-L71 |
chippyash/Strong-Type | src/Chippyash/Type/Number/IntType.php | IntType.asRational | public function asRational()
{
if (RequiredType::getInstance()->get() == RequiredType::TYPE_NATIVE) {
return new RationalType(clone $this, new static(1));
}
return new GMPRationalType(new GMPIntType($this->value), new GMPIntType(1));
} | php | public function asRational()
{
if (RequiredType::getInstance()->get() == RequiredType::TYPE_NATIVE) {
return new RationalType(clone $this, new static(1));
}
return new GMPRationalType(new GMPIntType($this->value), new GMPIntType(1));
} | [
"public",
"function",
"asRational",
"(",
")",
"{",
"if",
"(",
"RequiredType",
"::",
"getInstance",
"(",
")",
"->",
"get",
"(",
")",
"==",
"RequiredType",
"::",
"TYPE_NATIVE",
")",
"{",
"return",
"new",
"RationalType",
"(",
"clone",
"$",
"this",
",",
"new... | Return number as Rational number.
NB, numerator and denominator will be caste as IntTypes
@return \Chippyash\Type\Number\Rational\RationalType | [
"Return",
"number",
"as",
"Rational",
"number",
".",
"NB",
"numerator",
"and",
"denominator",
"will",
"be",
"caste",
"as",
"IntTypes"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/IntType.php#L57-L64 |
chippyash/Strong-Type | src/Chippyash/Type/Number/IntType.php | IntType.factors | public function factors()
{
$number = $this->value;
$limit = floor(sqrt(abs($number)));
$ret = array();
for ($x = 1; $x <= $limit; $x++) {
if ($number % $x == 0) {
$other = intval($number / $x);
$ret[$x] = $x;
$ret[$other] =... | php | public function factors()
{
$number = $this->value;
$limit = floor(sqrt(abs($number)));
$ret = array();
for ($x = 1; $x <= $limit; $x++) {
if ($number % $x == 0) {
$other = intval($number / $x);
$ret[$x] = $x;
$ret[$other] =... | [
"public",
"function",
"factors",
"(",
")",
"{",
"$",
"number",
"=",
"$",
"this",
"->",
"value",
";",
"$",
"limit",
"=",
"floor",
"(",
"sqrt",
"(",
"abs",
"(",
"$",
"number",
")",
")",
")",
";",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"for",
... | Return all factors of this number (sorted)
@return array [factor,factor, ...] | [
"Return",
"all",
"factors",
"of",
"this",
"number",
"(",
"sorted",
")"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/IntType.php#L101-L115 |
chippyash/Strong-Type | src/Chippyash/Type/Number/IntType.php | IntType.primeFactors | public function primeFactors()
{
// max_n = 2^31-1 = 2147483647
$number = $this->value;
$divisor = 2;
$factors = array();
$dmax = floor(sqrt($number));
$sieve = array_fill(1, $dmax, 1);
do {
$rFlag = false;
while ($number % $divisor == ... | php | public function primeFactors()
{
// max_n = 2^31-1 = 2147483647
$number = $this->value;
$divisor = 2;
$factors = array();
$dmax = floor(sqrt($number));
$sieve = array_fill(1, $dmax, 1);
do {
$rFlag = false;
while ($number % $divisor == ... | [
"public",
"function",
"primeFactors",
"(",
")",
"{",
"// max_n = 2^31-1 = 2147483647",
"$",
"number",
"=",
"$",
"this",
"->",
"value",
";",
"$",
"divisor",
"=",
"2",
";",
"$",
"factors",
"=",
"array",
"(",
")",
";",
"$",
"dmax",
"=",
"floor",
"(",
"sqr... | Return all prime factors of this number
Adapted from
@link http://www.thatsgeeky.com/2011/03/prime-factoring-with-php/
@return array [primeFactor => exponent,...] | [
"Return",
"all",
"prime",
"factors",
"of",
"this",
"number"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/IntType.php#L125-L157 |
mimmi20/Wurfl | src/Device/CustomDeviceRepository.php | CustomDeviceRepository.init | private function init()
{
/** @var $genericDevice \Wurfl\Device\ModelDeviceInterface */
$genericDevice = $this->getDevice(WurflConstants::GENERIC);
if (!is_null($genericDevice)) {
$this->capabilitiesName = array_keys($genericDevice->getCapabilities());
$this->g... | php | private function init()
{
/** @var $genericDevice \Wurfl\Device\ModelDeviceInterface */
$genericDevice = $this->getDevice(WurflConstants::GENERIC);
if (!is_null($genericDevice)) {
$this->capabilitiesName = array_keys($genericDevice->getCapabilities());
$this->g... | [
"private",
"function",
"init",
"(",
")",
"{",
"/** @var $genericDevice \\Wurfl\\Device\\ModelDeviceInterface */",
"$",
"genericDevice",
"=",
"$",
"this",
"->",
"getDevice",
"(",
"WurflConstants",
"::",
"GENERIC",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"gen... | Initializes this device repository by loading the base generic device capabilities names and group ID map
@throws \InvalidArgumentException | [
"Initializes",
"this",
"device",
"repository",
"by",
"loading",
"the",
"base",
"generic",
"device",
"capabilities",
"names",
"and",
"group",
"ID",
"map"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/CustomDeviceRepository.php#L89-L98 |
mimmi20/Wurfl | src/Device/CustomDeviceRepository.php | CustomDeviceRepository.getDevice | public function getDevice($deviceId)
{
if (!isset($this->deviceCache[$deviceId])) {
$device = $this->persistenceStorage->load($deviceId);
if (!$device) {
throw new \InvalidArgumentException(
'There is no device with ID [' . $deviceId . '] in the l... | php | public function getDevice($deviceId)
{
if (!isset($this->deviceCache[$deviceId])) {
$device = $this->persistenceStorage->load($deviceId);
if (!$device) {
throw new \InvalidArgumentException(
'There is no device with ID [' . $deviceId . '] in the l... | [
"public",
"function",
"getDevice",
"(",
"$",
"deviceId",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"deviceCache",
"[",
"$",
"deviceId",
"]",
")",
")",
"{",
"$",
"device",
"=",
"$",
"this",
"->",
"persistenceStorage",
"->",
"load",
"(... | Returns a device for the given device ID
@param string $deviceId
@throws \InvalidArgumentException
@return \Wurfl\Device\ModelDeviceInterface | [
"Returns",
"a",
"device",
"for",
"the",
"given",
"device",
"ID"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/CustomDeviceRepository.php#L139-L154 |
mimmi20/Wurfl | src/Device/CustomDeviceRepository.php | CustomDeviceRepository.getAllDevices | public function getAllDevices()
{
$devices = array();
$devicesId = $this->getAllDevicesID();
foreach ($devicesId as $deviceId) {
/** @var $device \Wurfl\Device\ModelDeviceInterface */
$device = $this->getDevice($deviceId);
$devices[] = $device;
... | php | public function getAllDevices()
{
$devices = array();
$devicesId = $this->getAllDevicesID();
foreach ($devicesId as $deviceId) {
/** @var $device \Wurfl\Device\ModelDeviceInterface */
$device = $this->getDevice($deviceId);
$devices[] = $device;
... | [
"public",
"function",
"getAllDevices",
"(",
")",
"{",
"$",
"devices",
"=",
"array",
"(",
")",
";",
"$",
"devicesId",
"=",
"$",
"this",
"->",
"getAllDevicesID",
"(",
")",
";",
"foreach",
"(",
"$",
"devicesId",
"as",
"$",
"deviceId",
")",
"{",
"/** @var ... | Returns all devices in the repository
@throws \Wurfl\Exception
@return \Wurfl\Device\ModelDeviceInterface[] | [
"Returns",
"all",
"devices",
"in",
"the",
"repository"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/CustomDeviceRepository.php#L163-L175 |
mimmi20/Wurfl | src/Device/CustomDeviceRepository.php | CustomDeviceRepository.getAllDevicesID | public function getAllDevicesID()
{
$devicesId = array();
foreach ($this->deviceClassificationNames as $className) {
$currentMap = $this->persistenceStorage->load($className);
if (!is_array($currentMap)) {
$currentMap = array();
}
$o... | php | public function getAllDevicesID()
{
$devicesId = array();
foreach ($this->deviceClassificationNames as $className) {
$currentMap = $this->persistenceStorage->load($className);
if (!is_array($currentMap)) {
$currentMap = array();
}
$o... | [
"public",
"function",
"getAllDevicesID",
"(",
")",
"{",
"$",
"devicesId",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"deviceClassificationNames",
"as",
"$",
"className",
")",
"{",
"$",
"currentMap",
"=",
"$",
"this",
"->",
"persistence... | Returns an array of all the device ids
@return array | [
"Returns",
"an",
"array",
"of",
"all",
"the",
"device",
"ids"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/CustomDeviceRepository.php#L182-L203 |
mimmi20/Wurfl | src/Device/CustomDeviceRepository.php | CustomDeviceRepository.getCapabilityForDevice | public function getCapabilityForDevice($deviceId, $capabilityName)
{
if (!$this->isCapabilityDefined($capabilityName)) {
throw new \InvalidArgumentException('capability name: ' . $capabilityName . ' not found');
}
$capabilityValue = null;
while (strcmp($deviceId, 'root'... | php | public function getCapabilityForDevice($deviceId, $capabilityName)
{
if (!$this->isCapabilityDefined($capabilityName)) {
throw new \InvalidArgumentException('capability name: ' . $capabilityName . ' not found');
}
$capabilityValue = null;
while (strcmp($deviceId, 'root'... | [
"public",
"function",
"getCapabilityForDevice",
"(",
"$",
"deviceId",
",",
"$",
"capabilityName",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isCapabilityDefined",
"(",
"$",
"capabilityName",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"... | Returns the value for the given $deviceId and $capabilityName
@param string $deviceId
@param string $capabilityName
@throws \InvalidArgumentException device ID or capability was not found
@return string value | [
"Returns",
"the",
"value",
"for",
"the",
"given",
"$deviceId",
"and",
"$capabilityName"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/CustomDeviceRepository.php#L215-L239 |
mimmi20/Wurfl | src/Device/CustomDeviceRepository.php | CustomDeviceRepository.getAllCapabilitiesForDevice | public function getAllCapabilitiesForDevice($deviceID)
{
$devices = array_reverse($this->getDeviceHierarchy($deviceID));
$capabilities = array();
foreach ($devices as $device) {
/** @var $device \Wurfl\Device\ModelDeviceInterface */
if (is_array($device->capabil... | php | public function getAllCapabilitiesForDevice($deviceID)
{
$devices = array_reverse($this->getDeviceHierarchy($deviceID));
$capabilities = array();
foreach ($devices as $device) {
/** @var $device \Wurfl\Device\ModelDeviceInterface */
if (is_array($device->capabil... | [
"public",
"function",
"getAllCapabilitiesForDevice",
"(",
"$",
"deviceID",
")",
"{",
"$",
"devices",
"=",
"array_reverse",
"(",
"$",
"this",
"->",
"getDeviceHierarchy",
"(",
"$",
"deviceID",
")",
")",
";",
"$",
"capabilities",
"=",
"array",
"(",
")",
";",
... | Returns an associative array of capabilityName => capabilityValue for the given $deviceID
@param string $deviceID
@return array associative array of capabilityName, capabilityValue | [
"Returns",
"an",
"associative",
"array",
"of",
"capabilityName",
"=",
">",
"capabilityValue",
"for",
"the",
"given",
"$deviceID"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/CustomDeviceRepository.php#L260-L274 |
mimmi20/Wurfl | src/Device/CustomDeviceRepository.php | CustomDeviceRepository.getDeviceHierarchy | public function getDeviceHierarchy($deviceId)
{
$devices = array();
while (strcmp($deviceId, 'root')) {
/** @var $device \Wurfl\Device\ModelDeviceInterface */
$device = $this->getDevice($deviceId);
if (!($device instanceof ModelDeviceInterface)) {
... | php | public function getDeviceHierarchy($deviceId)
{
$devices = array();
while (strcmp($deviceId, 'root')) {
/** @var $device \Wurfl\Device\ModelDeviceInterface */
$device = $this->getDevice($deviceId);
if (!($device instanceof ModelDeviceInterface)) {
... | [
"public",
"function",
"getDeviceHierarchy",
"(",
"$",
"deviceId",
")",
"{",
"$",
"devices",
"=",
"array",
"(",
")",
";",
"while",
"(",
"strcmp",
"(",
"$",
"deviceId",
",",
"'root'",
")",
")",
"{",
"/** @var $device \\Wurfl\\Device\\ModelDeviceInterface */",
"$",... | Returns an array containing all devices from the root
device to the device of the given $deviceId
@param string $deviceId
@throws \InvalidArgumentException
@return \Wurfl\Device\ModelDeviceInterface[] All ModelDevice objects in the fallback tree | [
"Returns",
"an",
"array",
"containing",
"all",
"devices",
"from",
"the",
"root",
"device",
"to",
"the",
"device",
"of",
"the",
"given",
"$deviceId"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/CustomDeviceRepository.php#L286-L303 |
mimmi20/Wurfl | src/Device/CustomDeviceRepository.php | CustomDeviceRepository.getCapabilitiesNameForGroup | public function getCapabilitiesNameForGroup($groupID)
{
if (!array_key_exists($groupID, $this->groupIDCapabilitiesMap)) {
throw new \InvalidArgumentException('The Group ID ' . $groupID . ' supplied does not exist');
}
return $this->groupIDCapabilitiesMap[$groupID];
} | php | public function getCapabilitiesNameForGroup($groupID)
{
if (!array_key_exists($groupID, $this->groupIDCapabilitiesMap)) {
throw new \InvalidArgumentException('The Group ID ' . $groupID . ' supplied does not exist');
}
return $this->groupIDCapabilitiesMap[$groupID];
} | [
"public",
"function",
"getCapabilitiesNameForGroup",
"(",
"$",
"groupID",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"groupID",
",",
"$",
"this",
"->",
"groupIDCapabilitiesMap",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
... | Returns an array of all capability names defined in
the given group ID
@param string $groupID
@throws \InvalidArgumentException The given $groupID does not exist
@return array of capability names | [
"Returns",
"an",
"array",
"of",
"all",
"capability",
"names",
"defined",
"in",
"the",
"given",
"group",
"ID"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/CustomDeviceRepository.php#L325-L332 |
mimmi20/Wurfl | src/Device/CustomDeviceRepository.php | CustomDeviceRepository.getGroupIDForCapability | public function getGroupIDForCapability($capability)
{
if (!isset($capability) || !array_key_exists($capability, $this->groupIDCapabilitiesMap)) {
throw new \InvalidArgumentException('an invalid capability was specified.');
}
return $this->groupIDCapabilitiesMap[$capability];
... | php | public function getGroupIDForCapability($capability)
{
if (!isset($capability) || !array_key_exists($capability, $this->groupIDCapabilitiesMap)) {
throw new \InvalidArgumentException('an invalid capability was specified.');
}
return $this->groupIDCapabilitiesMap[$capability];
... | [
"public",
"function",
"getGroupIDForCapability",
"(",
"$",
"capability",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"capability",
")",
"||",
"!",
"array_key_exists",
"(",
"$",
"capability",
",",
"$",
"this",
"->",
"groupIDCapabilitiesMap",
")",
")",
"{",
... | Returns the group id that contains the given $capability
@param string $capability
@throws \InvalidArgumentException an invalid $capability was specified
@return string | [
"Returns",
"the",
"group",
"id",
"that",
"contains",
"the",
"given",
"$capability"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Device/CustomDeviceRepository.php#L343-L350 |
FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php | DWDStationsController.getNearestStation | public static function getNearestStation($stations, $coordinatesRequest)
{
$calculator = new Vincenty();
$nearestStation = null;
$nextDist = INF;
foreach ($stations as $activeStation) {
if (is_object($activeStation) && $activeStation instanceof DWDStation) {
... | php | public static function getNearestStation($stations, $coordinatesRequest)
{
$calculator = new Vincenty();
$nearestStation = null;
$nextDist = INF;
foreach ($stations as $activeStation) {
if (is_object($activeStation) && $activeStation instanceof DWDStation) {
... | [
"public",
"static",
"function",
"getNearestStation",
"(",
"$",
"stations",
",",
"$",
"coordinatesRequest",
")",
"{",
"$",
"calculator",
"=",
"new",
"Vincenty",
"(",
")",
";",
"$",
"nearestStation",
"=",
"null",
";",
"$",
"nextDist",
"=",
"INF",
";",
"forea... | Return the nearest stations from a stations array.
@param $stations - array of DWDStation
@param $coordinatesRequest
@return DWDStation|null
@throws DWDLibException - if stations is empty | [
"Return",
"the",
"nearest",
"stations",
"from",
"a",
"stations",
"array",
"."
] | train | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php#L30-L49 |
FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php | DWDStationsController.getNearestStations | public static function getNearestStations($stations, Coordinate $coordinatesRequest, int $radiusKM = 200)
{
//todo: make radius loadable from the config.
DWDUtil::log(self::class, "Getting nearest stations from a list of " . count($stations) . ", around coordinates: " . $coordinatesRequest->format(n... | php | public static function getNearestStations($stations, Coordinate $coordinatesRequest, int $radiusKM = 200)
{
//todo: make radius loadable from the config.
DWDUtil::log(self::class, "Getting nearest stations from a list of " . count($stations) . ", around coordinates: " . $coordinatesRequest->format(n... | [
"public",
"static",
"function",
"getNearestStations",
"(",
"$",
"stations",
",",
"Coordinate",
"$",
"coordinatesRequest",
",",
"int",
"$",
"radiusKM",
"=",
"200",
")",
"{",
"//todo: make radius loadable from the config.",
"DWDUtil",
"::",
"log",
"(",
"self",
"::",
... | Get all stations in an x km radius.
@param $stations - array of DWDStation
@param int $radiusKM - default 20km
@return array - of nearest stations in the given radius | [
"Get",
"all",
"stations",
"in",
"an",
"x",
"km",
"radius",
"."
] | train | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php#L57-L84 |
FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php | DWDStationsController.getStationFile | public static function getStationFile($stationFtpPath, $outputPath)
{
$ftpConfig = DWDConfiguration::getFTPConfiguration();
$ftp_connection = ftp_connect($ftpConfig->url);
$login_result = ftp_login($ftp_connection, $ftpConfig->userName, $ftpConfig->userPassword);
if ($login_result ... | php | public static function getStationFile($stationFtpPath, $outputPath)
{
$ftpConfig = DWDConfiguration::getFTPConfiguration();
$ftp_connection = ftp_connect($ftpConfig->url);
$login_result = ftp_login($ftp_connection, $ftpConfig->userName, $ftpConfig->userPassword);
if ($login_result ... | [
"public",
"static",
"function",
"getStationFile",
"(",
"$",
"stationFtpPath",
",",
"$",
"outputPath",
")",
"{",
"$",
"ftpConfig",
"=",
"DWDConfiguration",
"::",
"getFTPConfiguration",
"(",
")",
";",
"$",
"ftp_connection",
"=",
"ftp_connect",
"(",
"$",
"ftpConfig... | Tries to download the station file from the given path.
@param $stationFtpPath - path/to/the/station_file.txt
@param $outputPath - location of the resulting file
@throws DWDLibException - if result is empty | [
"Tries",
"to",
"download",
"the",
"station",
"file",
"from",
"the",
"given",
"path",
"."
] | train | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php#L91-L109 |
FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php | DWDStationsController.parseStations | public static function parseStations($filePath)
{
if (DIRECTORY_SEPARATOR == '\\')
$filePath = str_replace('/', '\\', $filePath);
ini_set('display_errors', 1);
error_reporting(E_ALL);
$stationConf = DWDConfiguration::getStationConfiguration();
$stations = array();... | php | public static function parseStations($filePath)
{
if (DIRECTORY_SEPARATOR == '\\')
$filePath = str_replace('/', '\\', $filePath);
ini_set('display_errors', 1);
error_reporting(E_ALL);
$stationConf = DWDConfiguration::getStationConfiguration();
$stations = array();... | [
"public",
"static",
"function",
"parseStations",
"(",
"$",
"filePath",
")",
"{",
"if",
"(",
"DIRECTORY_SEPARATOR",
"==",
"'\\\\'",
")",
"$",
"filePath",
"=",
"str_replace",
"(",
"'/'",
",",
"'\\\\'",
",",
"$",
"filePath",
")",
";",
"ini_set",
"(",
"'displa... | Parse the station files into station objects.
@param $filePath - path to the station file
@return array - of stations
@throws DWDLibException - if zip opening fails or zip does not exist | [
"Parse",
"the",
"station",
"files",
"into",
"station",
"objects",
"."
] | train | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/hourly/DWDStationsController.php#L117-L170 |
nyeholt/silverstripe-simplewiki | code/form/MarkItUpField.php | MarkItUpField.include_js | public static function include_js($type, $callback = null) {
Requirements::javascript(THIRDPARTY_DIR.'/jquery/jquery.js');
Requirements::javascript(THIRDPARTY_DIR.'/jquery-ui/jquery-ui.js');
Requirements::javascript(THIRDPARTY_DIR .'/jquery-livequery/jquery.livequery.js');
Requirements::javascript(THIRDPARTY... | php | public static function include_js($type, $callback = null) {
Requirements::javascript(THIRDPARTY_DIR.'/jquery/jquery.js');
Requirements::javascript(THIRDPARTY_DIR.'/jquery-ui/jquery-ui.js');
Requirements::javascript(THIRDPARTY_DIR .'/jquery-livequery/jquery.livequery.js');
Requirements::javascript(THIRDPARTY... | [
"public",
"static",
"function",
"include_js",
"(",
"$",
"type",
",",
"$",
"callback",
"=",
"null",
")",
"{",
"Requirements",
"::",
"javascript",
"(",
"THIRDPARTY_DIR",
".",
"'/jquery/jquery.js'",
")",
";",
"Requirements",
"::",
"javascript",
"(",
"THIRDPARTY_DIR... | Includes the JavaScript neccesary for this field to work using the {@link Requirements} system. | [
"Includes",
"the",
"JavaScript",
"neccesary",
"for",
"this",
"field",
"to",
"work",
"using",
"the",
"{"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/code/form/MarkItUpField.php#L18-L46 |
vardius/crud-bundle | Controller/Factory/CrudControllerFactory.php | CrudControllerFactory.get | public function get(string $entityName, string $routePrefix = '', AbstractType $formType = null, CrudManagerInterface $crudManager = null, $view = null, $actions = [], string $controller = 'Vardius\Bundle\CrudBundle\Controller\CrudController'):CrudController
{
switch ($this->container->getParameter('vardius... | php | public function get(string $entityName, string $routePrefix = '', AbstractType $formType = null, CrudManagerInterface $crudManager = null, $view = null, $actions = [], string $controller = 'Vardius\Bundle\CrudBundle\Controller\CrudController'):CrudController
{
switch ($this->container->getParameter('vardius... | [
"public",
"function",
"get",
"(",
"string",
"$",
"entityName",
",",
"string",
"$",
"routePrefix",
"=",
"''",
",",
"AbstractType",
"$",
"formType",
"=",
"null",
",",
"CrudManagerInterface",
"$",
"crudManager",
"=",
"null",
",",
"$",
"view",
"=",
"null",
","... | @param string $entityName
@param string $routePrefix
@param AbstractType $formType
@param CrudManagerInterface $crudManager
@param string $view
@param array|ActionsProviderInterface $actions
@param string $controller
@throws \Exception
@return CrudController | [
"@param",
"string",
"$entityName",
"@param",
"string",
"$routePrefix",
"@param",
"AbstractType",
"$formType",
"@param",
"CrudManagerInterface",
"$crudManager",
"@param",
"string",
"$view",
"@param",
"array|ActionsProviderInterface",
"$actions",
"@param",
"string",
"$controlle... | train | https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Controller/Factory/CrudControllerFactory.php#L76-L120 |
yosmanyga/validation | src/Yosmanyga/Validation/Resource/Normalizer/YamlFile/ArrayNormalizer.php | ArrayNormalizer.normalize | public function normalize($data, Resource $resource)
{
if (isset($data['value']['map'])) {
$options = isset($data['value']['map']['options']) ? $data['value']['map']['options'] : [];
$data['value']['map'] = $this->normalizer->normalize(
[
'key' =... | php | public function normalize($data, Resource $resource)
{
if (isset($data['value']['map'])) {
$options = isset($data['value']['map']['options']) ? $data['value']['map']['options'] : [];
$data['value']['map'] = $this->normalizer->normalize(
[
'key' =... | [
"public",
"function",
"normalize",
"(",
"$",
"data",
",",
"Resource",
"$",
"resource",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'value'",
"]",
"[",
"'map'",
"]",
")",
")",
"{",
"$",
"options",
"=",
"isset",
"(",
"$",
"data",
"[",
"'v... | @param mixed $data
@param \Yosmanyga\Resource\Resource $resource
@return \Yosmanyga\Validation\Resource\Definition\ArrayDefinition | [
"@param",
"mixed",
"$data",
"@param",
"\\",
"Yosmanyga",
"\\",
"Resource",
"\\",
"Resource",
"$resource"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Resource/Normalizer/YamlFile/ArrayNormalizer.php#L36-L50 |
wpup/digster | src/class-view.php | View.gather_data | protected function gather_data() {
$data = $this->factory->gather_data( $this );
foreach ( $data as $index => $value ) {
if ( is_array( $value ) ) {
$this->data = array_merge( $value, $this->data );
} else if ( is_string( $value ) && class_exists( $value ) ) {
$class = new $value();
$class->compo... | php | protected function gather_data() {
$data = $this->factory->gather_data( $this );
foreach ( $data as $index => $value ) {
if ( is_array( $value ) ) {
$this->data = array_merge( $value, $this->data );
} else if ( is_string( $value ) && class_exists( $value ) ) {
$class = new $value();
$class->compo... | [
"protected",
"function",
"gather_data",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"factory",
"->",
"gather_data",
"(",
"$",
"this",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"index",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_ar... | Gather the data that should be used when render.
@return array | [
"Gather",
"the",
"data",
"that",
"should",
"be",
"used",
"when",
"render",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/class-view.php#L57-L76 |
wpup/digster | src/class-view.php | View.nest | public function nest( $key, $view_name, $data = [] ) {
return $this->with( $key, $this->factory->make( $view_name, $data ) );
} | php | public function nest( $key, $view_name, $data = [] ) {
return $this->with( $key, $this->factory->make( $view_name, $data ) );
} | [
"public",
"function",
"nest",
"(",
"$",
"key",
",",
"$",
"view_name",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"with",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"factory",
"->",
"make",
"(",
"$",
"view_name",
",",
... | Add a view instance to the view data.
@param string $key
@param string $view_name
@param array $data
@return $this | [
"Add",
"a",
"view",
"instance",
"to",
"the",
"view",
"data",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/class-view.php#L105-L107 |
wpup/digster | src/class-view.php | View.render | public function render() {
if ( $this->factory->exists( $this->view ) ) {
return $this->engine->render( $this->view, $this->gather_data() );
}
return '';
} | php | public function render() {
if ( $this->factory->exists( $this->view ) ) {
return $this->engine->render( $this->view, $this->gather_data() );
}
return '';
} | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"factory",
"->",
"exists",
"(",
"$",
"this",
"->",
"view",
")",
")",
"{",
"return",
"$",
"this",
"->",
"engine",
"->",
"render",
"(",
"$",
"this",
"->",
"view",
",",
"$"... | Render the view.
@return string | [
"Render",
"the",
"view",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/class-view.php#L114-L120 |
wpup/digster | src/class-view.php | View.with | public function with( $key, $value = null ) {
if ( is_array( $key ) ) {
$this->data = array_merge( $this->data, $key );
} else if ( is_object( $key ) && method_exists( $key, 'to_array' ) ) {
$this->data = array_merge( $this->data, $key->to_array() );
} else {
$this->data[$key] = $value;
}
return $th... | php | public function with( $key, $value = null ) {
if ( is_array( $key ) ) {
$this->data = array_merge( $this->data, $key );
} else if ( is_object( $key ) && method_exists( $key, 'to_array' ) ) {
$this->data = array_merge( $this->data, $key->to_array() );
} else {
$this->data[$key] = $value;
}
return $th... | [
"public",
"function",
"with",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"key",
")",... | Add a piece of data to the view.
@param array|string $key
@param mixed $value
@return $this | [
"Add",
"a",
"piece",
"of",
"data",
"to",
"the",
"view",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/class-view.php#L130-L140 |
abhi1693/yii2-enum | helpers/BaseEnum.php | BaseEnum.createByName | public static function createByName($name)
{
$constants = self::getConstantsByName();
if (!array_key_exists($name, $constants)) {
throw EnumException::invalidName(get_called_class(), $name);
}
return new static($constants[$name]);
} | php | public static function createByName($name)
{
$constants = self::getConstantsByName();
if (!array_key_exists($name, $constants)) {
throw EnumException::invalidName(get_called_class(), $name);
}
return new static($constants[$name]);
} | [
"public",
"static",
"function",
"createByName",
"(",
"$",
"name",
")",
"{",
"$",
"constants",
"=",
"self",
"::",
"getConstantsByName",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"constants",
")",
")",
"{",
"throw",
"... | Creates a new type instance using the name of a value
@param string $name The name of a value
@return $this The new type instance
@throws EnumException If the name is invalid | [
"Creates",
"a",
"new",
"type",
"instance",
"using",
"the",
"name",
"of",
"a",
"value"
] | train | https://github.com/abhi1693/yii2-enum/blob/1def6522303fa8f0277f09d1123229c32c942cd9/helpers/BaseEnum.php#L69-L78 |
abhi1693/yii2-enum | helpers/BaseEnum.php | BaseEnum.createByValue | public static function createByValue($value)
{
$constants = self::getConstantsByValue();
if (!array_key_exists($value, $constants)) {
throw EnumException::invalidValue(get_called_class(), $value);
}
return new static ($value);
} | php | public static function createByValue($value)
{
$constants = self::getConstantsByValue();
if (!array_key_exists($value, $constants)) {
throw EnumException::invalidValue(get_called_class(), $value);
}
return new static ($value);
} | [
"public",
"static",
"function",
"createByValue",
"(",
"$",
"value",
")",
"{",
"$",
"constants",
"=",
"self",
"::",
"getConstantsByValue",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"value",
",",
"$",
"constants",
")",
")",
"{",
"throw",... | Creates a new type instance using the value
@param mixed $value The value
@throws EnumException If the value is invalid
@return $this The new instance | [
"Creates",
"a",
"new",
"type",
"instance",
"using",
"the",
"value"
] | train | https://github.com/abhi1693/yii2-enum/blob/1def6522303fa8f0277f09d1123229c32c942cd9/helpers/BaseEnum.php#L88-L97 |
FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/hourly/services/AbstractHourlyService.php | AbstractHourlyService.parseHourlyDataOld | public function parseHourlyDataOld(String $content, DWDStation $nearestStation, Coordinate $coordinate, Carbon $startDate = null, Carbon $endDate = null): array
{
$time = microtime(true);
$lines = explode('eor', $content);
$data = array();
/**
* steps to refactor:
... | php | public function parseHourlyDataOld(String $content, DWDStation $nearestStation, Coordinate $coordinate, Carbon $startDate = null, Carbon $endDate = null): array
{
$time = microtime(true);
$lines = explode('eor', $content);
$data = array();
/**
* steps to refactor:
... | [
"public",
"function",
"parseHourlyDataOld",
"(",
"String",
"$",
"content",
",",
"DWDStation",
"$",
"nearestStation",
",",
"Coordinate",
"$",
"coordinate",
",",
"Carbon",
"$",
"startDate",
"=",
"null",
",",
"Carbon",
"$",
"endDate",
"=",
"null",
")",
":",
"ar... | Parse the textual representation of DWD Data, can be filtered by specifying before and after.
This means if you specify after - you will get timestamps after the specified team
If you also specify before you can pinpoint values.
@deprecated
@param String $content - Textual representation of a DWD Hourly/Recent pressure... | [
"Parse",
"the",
"textual",
"representation",
"of",
"DWD",
"Data",
"can",
"be",
"filtered",
"by",
"specifying",
"before",
"and",
"after",
".",
"This",
"means",
"if",
"you",
"specify",
"after",
"-",
"you",
"will",
"get",
"timestamps",
"after",
"the",
"specifie... | train | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/hourly/services/AbstractHourlyService.php#L54-L147 |
FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/hourly/services/AbstractHourlyService.php | AbstractHourlyService.binarySearch | private function binarySearch($item, $array)
{
$low = 0;
$high = count($array);
while ($high - $low > 1) {
$center = ($high + $low) / 2;
// print("high=$high, low=$low, center=$center -- val=".(int)explode(';', $array[$center])[1]."<br>");
if ((int)explode(... | php | private function binarySearch($item, $array)
{
$low = 0;
$high = count($array);
while ($high - $low > 1) {
$center = ($high + $low) / 2;
// print("high=$high, low=$low, center=$center -- val=".(int)explode(';', $array[$center])[1]."<br>");
if ((int)explode(... | [
"private",
"function",
"binarySearch",
"(",
"$",
"item",
",",
"$",
"array",
")",
"{",
"$",
"low",
"=",
"0",
";",
"$",
"high",
"=",
"count",
"(",
"$",
"array",
")",
";",
"while",
"(",
"$",
"high",
"-",
"$",
"low",
">",
"1",
")",
"{",
"$",
"cen... | Finds the position of $item in $array
@param $item
@param $array
@return int | [
"Finds",
"the",
"position",
"of",
"$item",
"in",
"$array"
] | train | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/hourly/services/AbstractHourlyService.php#L179-L195 |
FWidm/dwd-hourly-crawler | src/fwidm/dwdHourlyCrawler/hourly/services/AbstractHourlyService.php | AbstractHourlyService.getStationFTPPath | public function getStationFTPPath(string $ftpPath)
{
$fileName = DWDUtil::getFileNameFromPath($ftpPath);
$filePath = DWDConfiguration::getConfiguration()->baseDirectory . DWDConfiguration::getConfiguration()->dwdHourly->localBaseFolder . '/' . $fileName;
return $filePath;
} | php | public function getStationFTPPath(string $ftpPath)
{
$fileName = DWDUtil::getFileNameFromPath($ftpPath);
$filePath = DWDConfiguration::getConfiguration()->baseDirectory . DWDConfiguration::getConfiguration()->dwdHourly->localBaseFolder . '/' . $fileName;
return $filePath;
} | [
"public",
"function",
"getStationFTPPath",
"(",
"string",
"$",
"ftpPath",
")",
"{",
"$",
"fileName",
"=",
"DWDUtil",
"::",
"getFileNameFromPath",
"(",
"$",
"ftpPath",
")",
";",
"$",
"filePath",
"=",
"DWDConfiguration",
"::",
"getConfiguration",
"(",
")",
"->",... | Return the path to the file that contains the stations.
@param string $ftpPath
@return string | [
"Return",
"the",
"path",
"to",
"the",
"file",
"that",
"contains",
"the",
"stations",
"."
] | train | https://github.com/FWidm/dwd-hourly-crawler/blob/36dec7d84a85af599e9d4fb6a3bcc302378ce4a8/src/fwidm/dwdHourlyCrawler/hourly/services/AbstractHourlyService.php#L238-L243 |
o2system/parser | src/Template/Adapters/Mustache.php | Mustache.initialize | public function initialize(array $config = [])
{
if (empty($this->engine)) {
if ($this->isSupported()) {
$this->engine = new \Mustache_Engine();
} else {
throw new RuntimeException(
'PARSER_E_THIRD_PARTY',
... | php | public function initialize(array $config = [])
{
if (empty($this->engine)) {
if ($this->isSupported()) {
$this->engine = new \Mustache_Engine();
} else {
throw new RuntimeException(
'PARSER_E_THIRD_PARTY',
... | [
"public",
"function",
"initialize",
"(",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"engine",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSupported",
"(",
")",
")",
"{",
"$",
"this",
"->",
"... | Mustache::initialize
@param array $config
@return static
@throws \O2System\Spl\Exceptions\RuntimeException | [
"Mustache",
"::",
"initialize"
] | train | https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Template/Adapters/Mustache.php#L38-L53 |
PandaPlatform/framework | src/Panda/Foundation/Http/Kernel.php | Kernel.boot | public function boot($request = null)
{
// Initialize application
$this->getApp()->boot($request, $this->bootstrapRegistry->getItems());
// Set base controller router
Controller::setRouter($this->getRouter());
// Include routes
include_once $this->routesConfiguratio... | php | public function boot($request = null)
{
// Initialize application
$this->getApp()->boot($request, $this->bootstrapRegistry->getItems());
// Set base controller router
Controller::setRouter($this->getRouter());
// Include routes
include_once $this->routesConfiguratio... | [
"public",
"function",
"boot",
"(",
"$",
"request",
"=",
"null",
")",
"{",
"// Initialize application",
"$",
"this",
"->",
"getApp",
"(",
")",
"->",
"boot",
"(",
"$",
"request",
",",
"$",
"this",
"->",
"bootstrapRegistry",
"->",
"getItems",
"(",
")",
")",... | Init the panda application and start all the interfaces that
are needed for runtime.
@param Request|SymfonyRequest $request
@throws InvalidArgumentException
@throws \DI\DependencyException
@throws \DI\NotFoundException | [
"Init",
"the",
"panda",
"application",
"and",
"start",
"all",
"the",
"interfaces",
"that",
"are",
"needed",
"for",
"runtime",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Foundation/Http/Kernel.php#L97-L107 |
PandaPlatform/framework | src/Panda/Foundation/Http/Kernel.php | Kernel.handle | public function handle(SymfonyRequest $request)
{
// Boot kernel
$this->boot($request);
// Dispatch the response
return $this->getRouter()->dispatch($request);
} | php | public function handle(SymfonyRequest $request)
{
// Boot kernel
$this->boot($request);
// Dispatch the response
return $this->getRouter()->dispatch($request);
} | [
"public",
"function",
"handle",
"(",
"SymfonyRequest",
"$",
"request",
")",
"{",
"// Boot kernel",
"$",
"this",
"->",
"boot",
"(",
"$",
"request",
")",
";",
"// Dispatch the response",
"return",
"$",
"this",
"->",
"getRouter",
"(",
")",
"->",
"dispatch",
"("... | Handle the incoming request and return a response.
@param Request|SymfonyRequest $request
@return Response
@throws InvalidArgumentException
@throws \DI\DependencyException
@throws \DI\NotFoundException
@throws \LogicException
@throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
@throws \UnexpectedVal... | [
"Handle",
"the",
"incoming",
"request",
"and",
"return",
"a",
"response",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Foundation/Http/Kernel.php#L122-L129 |
Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/Query/Dimensions.php | Dimensions.setDimension | public function setDimension($dimensionName, $dimensionValue = null)
{
$this->pipeline['$match']['name'] = $dimensionName;
if (!empty($dimensionValue)) {
$this->pipeline['$match']['value'] = $dimensionValue;
}
return $this;
} | php | public function setDimension($dimensionName, $dimensionValue = null)
{
$this->pipeline['$match']['name'] = $dimensionName;
if (!empty($dimensionValue)) {
$this->pipeline['$match']['value'] = $dimensionValue;
}
return $this;
} | [
"public",
"function",
"setDimension",
"(",
"$",
"dimensionName",
",",
"$",
"dimensionValue",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"pipeline",
"[",
"'$match'",
"]",
"[",
"'name'",
"]",
"=",
"$",
"dimensionName",
";",
"if",
"(",
"!",
"empty",
"(",
"... | Filter the dimension records.
@param string $dimensionName Dimension name.
@param string|null $dimensionValue Dimension value.
@return $this | [
"Filter",
"the",
"dimension",
"records",
"."
] | train | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query/Dimensions.php#L29-L38 |
Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/Query/Dimensions.php | Dimensions.sortByDimensionName | public function sortByDimensionName($direction)
{
if ($this->id != '$name' && $this->id != '$value') {
throw new AnalyticsDbException('In order to sort by dimension name, you need to first group by dimension name or dimension value.');
}
$direction = (int)$direction;
if... | php | public function sortByDimensionName($direction)
{
if ($this->id != '$name' && $this->id != '$value') {
throw new AnalyticsDbException('In order to sort by dimension name, you need to first group by dimension name or dimension value.');
}
$direction = (int)$direction;
if... | [
"public",
"function",
"sortByDimensionName",
"(",
"$",
"direction",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"id",
"!=",
"'$name'",
"&&",
"$",
"this",
"->",
"id",
"!=",
"'$value'",
")",
"{",
"throw",
"new",
"AnalyticsDbException",
"(",
"'In order to sort by d... | Sort records by dimension name.
@param string $direction Mongo sort direction: 1 => ascending; -1 => descending
@return $this
@throws AnalyticsDbException | [
"Sort",
"records",
"by",
"dimension",
"name",
"."
] | train | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query/Dimensions.php#L48-L64 |
Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/Query/Dimensions.php | Dimensions.sortByDimensionValue | public function sortByDimensionValue($direction)
{
if ($this->id != '$value') {
throw new AnalyticsDbException('In order to sort by dimension value, you need to first group by dimension value.');
}
$direction = (int)$direction;
$this->pipeline['$sort'] = ['_id.value' =>... | php | public function sortByDimensionValue($direction)
{
if ($this->id != '$value') {
throw new AnalyticsDbException('In order to sort by dimension value, you need to first group by dimension value.');
}
$direction = (int)$direction;
$this->pipeline['$sort'] = ['_id.value' =>... | [
"public",
"function",
"sortByDimensionValue",
"(",
"$",
"direction",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"id",
"!=",
"'$value'",
")",
"{",
"throw",
"new",
"AnalyticsDbException",
"(",
"'In order to sort by dimension value, you need to first group by dimension value.'"... | Sort records by dimension value.
@param string $direction Mongo sort direction: 1 => ascending; -1 => descending
@return $this
@throws AnalyticsDbException | [
"Sort",
"records",
"by",
"dimension",
"value",
"."
] | train | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query/Dimensions.php#L74-L86 |
Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/Query/Dimensions.php | Dimensions.populate | protected function populate()
{
$this->collection = AnalyticsDb::ADB_DIMS;
// $match
$this->pipeline['$match']['entity'] = $this->entity;
$this->pipeline['$match']['ts'] = ['$gte' => $this->dateRange[0], '$lte' => $this->dateRange[1]];
if(!empty($this->ref)){
$th... | php | protected function populate()
{
$this->collection = AnalyticsDb::ADB_DIMS;
// $match
$this->pipeline['$match']['entity'] = $this->entity;
$this->pipeline['$match']['ts'] = ['$gte' => $this->dateRange[0], '$lte' => $this->dateRange[1]];
if(!empty($this->ref)){
$th... | [
"protected",
"function",
"populate",
"(",
")",
"{",
"$",
"this",
"->",
"collection",
"=",
"AnalyticsDb",
"::",
"ADB_DIMS",
";",
"// $match",
"$",
"this",
"->",
"pipeline",
"[",
"'$match'",
"]",
"[",
"'entity'",
"]",
"=",
"$",
"this",
"->",
"entity",
";",... | This is the callback method that is triggered after the constructor call.
@return void | [
"This",
"is",
"the",
"callback",
"method",
"that",
"is",
"triggered",
"after",
"the",
"constructor",
"call",
"."
] | train | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query/Dimensions.php#L154-L188 |
itrnka/ha-framework | src/ha/Component/Configuration/Simple/ConfigurationFromArray.php | ConfigurationFromArray.get | public function get(string $key, bool $throwException = true)
{
if (!array_key_exists($key, $this->configData)) {
if ($throwException) {
throw new \InvalidArgumentException("Key \"{$key}\" not found in configuration with name \"{$this->instanceName}\"");
}
... | php | public function get(string $key, bool $throwException = true)
{
if (!array_key_exists($key, $this->configData)) {
if ($throwException) {
throw new \InvalidArgumentException("Key \"{$key}\" not found in configuration with name \"{$this->instanceName}\"");
}
... | [
"public",
"function",
"get",
"(",
"string",
"$",
"key",
",",
"bool",
"$",
"throwException",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"configData",
")",
")",
"{",
"if",
"(",
"$",
"throwExcepti... | Get configuration variable by $key.
@param string $key
@param bool $throwException
@return mixed | [
"Get",
"configuration",
"variable",
"by",
"$key",
"."
] | train | https://github.com/itrnka/ha-framework/blob/a72b09c28f8e966c37f98a0004e4fbbce80df42c/src/ha/Component/Configuration/Simple/ConfigurationFromArray.php#L43-L52 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/LanguageFactory.php | HTMLPurifier_LanguageFactory.loadLanguage | public function loadLanguage($code) {
static $languages_seen = array(); // recursion guard
// abort if we've already loaded it
if (isset($this->cache[$code])) return;
// generate filename
$filename = $this->dir . '/Language/messages/' . $code . '.php';
// default fallb... | php | public function loadLanguage($code) {
static $languages_seen = array(); // recursion guard
// abort if we've already loaded it
if (isset($this->cache[$code])) return;
// generate filename
$filename = $this->dir . '/Language/messages/' . $code . '.php';
// default fallb... | [
"public",
"function",
"loadLanguage",
"(",
"$",
"code",
")",
"{",
"static",
"$",
"languages_seen",
"=",
"array",
"(",
")",
";",
"// recursion guard",
"// abort if we've already loaded it",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"$",
"code",
... | Loads language into the cache, handles message file and fallbacks
@param $code string language code | [
"Loads",
"language",
"into",
"the",
"cache",
"handles",
"message",
"file",
"and",
"fallbacks"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/LanguageFactory.php#L138-L194 |
pantera-digital/yii2-seo | models/SeoRedirectSearch.php | SeoRedirectSearch.search | public function search($params)
{
$query = SeoRedirect::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => [
'defaultOrder' => ['id' => SORT_DESC],
],
]);
$this->load($params);
if (!$this->validate... | php | public function search($params)
{
$query = SeoRedirect::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => [
'defaultOrder' => ['id' => SORT_DESC],
],
]);
$this->load($params);
if (!$this->validate... | [
"public",
"function",
"search",
"(",
"$",
"params",
")",
"{",
"$",
"query",
"=",
"SeoRedirect",
"::",
"find",
"(",
")",
";",
"$",
"dataProvider",
"=",
"new",
"ActiveDataProvider",
"(",
"[",
"'query'",
"=>",
"$",
"query",
",",
"'sort'",
"=>",
"[",
"'def... | Creates data provider instance with search query applied
@param array $params
@return ActiveDataProvider | [
"Creates",
"data",
"provider",
"instance",
"with",
"search",
"query",
"applied"
] | train | https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/models/SeoRedirectSearch.php#L37-L56 |
yosmanyga/validation | src/Yosmanyga/Validation/Validator/ObjectValidator.php | ObjectValidator.validate | public function validate($value)
{
if (!is_object($value)) {
return [new Error($this->options['message'])];
}
$this->validators = $this->fixValidators($this->validators);
$errors = [];
foreach ($this->validators as $property => $validators) {
/** @v... | php | public function validate($value)
{
if (!is_object($value)) {
return [new Error($this->options['message'])];
}
$this->validators = $this->fixValidators($this->validators);
$errors = [];
foreach ($this->validators as $property => $validators) {
/** @v... | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"value",
")",
")",
"{",
"return",
"[",
"new",
"Error",
"(",
"$",
"this",
"->",
"options",
"[",
"'message'",
"]",
")",
"]",
";",
"}",
"$",
"this"... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Validator/ObjectValidator.php#L35-L64 |
yosmanyga/validation | src/Yosmanyga/Validation/Validator/ObjectValidator.php | ObjectValidator.fixValidators | private function fixValidators($objectValidators)
{
$fixedValidators = [];
foreach ($objectValidators as $property => $propertyValidators) {
if (!is_array($propertyValidators)) {
$propertyValidators = [$propertyValidators];
}
$fixedPropertyValidat... | php | private function fixValidators($objectValidators)
{
$fixedValidators = [];
foreach ($objectValidators as $property => $propertyValidators) {
if (!is_array($propertyValidators)) {
$propertyValidators = [$propertyValidators];
}
$fixedPropertyValidat... | [
"private",
"function",
"fixValidators",
"(",
"$",
"objectValidators",
")",
"{",
"$",
"fixedValidators",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"objectValidators",
"as",
"$",
"property",
"=>",
"$",
"propertyValidators",
")",
"{",
"if",
"(",
"!",
"is_array",... | @param array $objectValidators
@return \Yosmanyga\Validation\Validator\PropertyValidatorInterface[] | [
"@param",
"array",
"$objectValidators"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Validator/ObjectValidator.php#L87-L108 |
mimmi20/Wurfl | src/Handlers/NetFrontOnAndroidHandler.php | NetFrontOnAndroidHandler.applyConclusiveMatch | public function applyConclusiveMatch($userAgent)
{
$find = 'NetFrontLifeBrowser/2.2';
$tolerance = strpos($userAgent, $find) + strlen($find);
if ($tolerance > strlen($userAgent)) {
$tolerance = strlen($userAgent);
}
return $this->getDeviceIDFromRIS($userAge... | php | public function applyConclusiveMatch($userAgent)
{
$find = 'NetFrontLifeBrowser/2.2';
$tolerance = strpos($userAgent, $find) + strlen($find);
if ($tolerance > strlen($userAgent)) {
$tolerance = strlen($userAgent);
}
return $this->getDeviceIDFromRIS($userAge... | [
"public",
"function",
"applyConclusiveMatch",
"(",
"$",
"userAgent",
")",
"{",
"$",
"find",
"=",
"'NetFrontLifeBrowser/2.2'",
";",
"$",
"tolerance",
"=",
"strpos",
"(",
"$",
"userAgent",
",",
"$",
"find",
")",
"+",
"strlen",
"(",
"$",
"find",
")",
";",
"... | @param string $userAgent
@return null|string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/NetFrontOnAndroidHandler.php#L60-L70 |
epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.setCasServer | public function setCasServer($server)
{
$this->casServer = $server;
$this->guzzleClient = new Client(['base_uri' => $server, 'cookies' => true]);
} | php | public function setCasServer($server)
{
$this->casServer = $server;
$this->guzzleClient = new Client(['base_uri' => $server, 'cookies' => true]);
} | [
"public",
"function",
"setCasServer",
"(",
"$",
"server",
")",
"{",
"$",
"this",
"->",
"casServer",
"=",
"$",
"server",
";",
"$",
"this",
"->",
"guzzleClient",
"=",
"new",
"Client",
"(",
"[",
"'base_uri'",
"=>",
"$",
"server",
",",
"'cookies'",
"=>",
"... | Set the CAS server URL
@param string $server | [
"Set",
"the",
"CAS",
"server",
"URL"
] | train | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L57-L61 |
epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.setTGT | public function setTGT($tgt)
{
$this->tgt = $tgt;
$this->tgtLocation = $this->casServer . $this->casRESTcontext . '/' . $tgt;
} | php | public function setTGT($tgt)
{
$this->tgt = $tgt;
$this->tgtLocation = $this->casServer . $this->casRESTcontext . '/' . $tgt;
} | [
"public",
"function",
"setTGT",
"(",
"$",
"tgt",
")",
"{",
"$",
"this",
"->",
"tgt",
"=",
"$",
"tgt",
";",
"$",
"this",
"->",
"tgtLocation",
"=",
"$",
"this",
"->",
"casServer",
".",
"$",
"this",
"->",
"casRESTcontext",
".",
"'/'",
".",
"$",
"tgt",... | Accepts the Ticket-Granting Ticket from the app running the client.
@param string $tgt | [
"Accepts",
"the",
"Ticket",
"-",
"Granting",
"Ticket",
"from",
"the",
"app",
"running",
"the",
"client",
"."
] | train | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L130-L134 |
epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.logout | public function logout()
{
// Make sure a TGT exists
$this->checkTgtExists();
$this->guzzleClient->delete($this->tgtLocation);
$this->tgtLocation = null;
$this->tgt = null;
// Remove the TGT storage file
if ($this->tgtStorageLocation) {
unlink($t... | php | public function logout()
{
// Make sure a TGT exists
$this->checkTgtExists();
$this->guzzleClient->delete($this->tgtLocation);
$this->tgtLocation = null;
$this->tgt = null;
// Remove the TGT storage file
if ($this->tgtStorageLocation) {
unlink($t... | [
"public",
"function",
"logout",
"(",
")",
"{",
"// Make sure a TGT exists",
"$",
"this",
"->",
"checkTgtExists",
"(",
")",
";",
"$",
"this",
"->",
"guzzleClient",
"->",
"delete",
"(",
"$",
"this",
"->",
"tgtLocation",
")",
";",
"$",
"this",
"->",
"tgtLocat... | Logout of the CAS session and destroy the TGT.
@return bool
@throws \Exception | [
"Logout",
"of",
"the",
"CAS",
"session",
"and",
"destroy",
"the",
"TGT",
"."
] | train | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L142-L157 |
epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.post | public function post($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('POST', $service, $headers, $body, $form_params);
} | php | public function post($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('POST', $service, $headers, $body, $form_params);
} | [
"public",
"function",
"post",
"(",
"$",
"service",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
",",
"$",
"form_params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"callRestService",
"(",
"'POST'",
",",
"$",
"service"... | Request a Service Ticket for the CAS server and perform a HTTP POST operation.
@param $service
@param array $headers
@param array $body
@return mixed
@throws \Exception | [
"Request",
"a",
"Service",
"Ticket",
"for",
"the",
"CAS",
"server",
"and",
"perform",
"a",
"HTTP",
"POST",
"operation",
"."
] | train | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L182-L185 |
epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.patch | public function patch($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('PATCH', $service, $headers, $body, $form_params);
} | php | public function patch($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('PATCH', $service, $headers, $body, $form_params);
} | [
"public",
"function",
"patch",
"(",
"$",
"service",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
",",
"$",
"form_params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"callRestService",
"(",
"'PATCH'",
",",
"$",
"servic... | Request a Service Ticket for the CAS server and perform a HTTP PATCH operation.
@param $service
@param array $headers
@param array $body
@return mixed
@throws \Exception | [
"Request",
"a",
"Service",
"Ticket",
"for",
"the",
"CAS",
"server",
"and",
"perform",
"a",
"HTTP",
"PATCH",
"operation",
"."
] | train | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L196-L199 |
epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.head | public function head($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('HEAD', $service, $headers, $body, $form_params);
} | php | public function head($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('HEAD', $service, $headers, $body, $form_params);
} | [
"public",
"function",
"head",
"(",
"$",
"service",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
",",
"$",
"form_params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"callRestService",
"(",
"'HEAD'",
",",
"$",
"service"... | Request a Service Ticket for the CAS server and perform a HTTP HEAD operation.
@param $service
@param array $headers
@param array $body
@return mixed
@throws \Exception | [
"Request",
"a",
"Service",
"Ticket",
"for",
"the",
"CAS",
"server",
"and",
"perform",
"a",
"HTTP",
"HEAD",
"operation",
"."
] | train | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L210-L213 |
epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.put | public function put($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('PUT', $service, $headers, $body, $form_params);
} | php | public function put($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('PUT', $service, $headers, $body, $form_params);
} | [
"public",
"function",
"put",
"(",
"$",
"service",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
",",
"$",
"form_params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"callRestService",
"(",
"'PUT'",
",",
"$",
"service",
... | Request a Service Ticket for the CAS server and perform a HTTP PUT operation.
@param $service
@param array $headers
@param array $body
@return mixed
@throws \Exception | [
"Request",
"a",
"Service",
"Ticket",
"for",
"the",
"CAS",
"server",
"and",
"perform",
"a",
"HTTP",
"PUT",
"operation",
"."
] | train | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L224-L227 |
epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.options | public function options($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('OPTIONS', $service, $headers, $body, $form_params);
} | php | public function options($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('OPTIONS', $service, $headers, $body, $form_params);
} | [
"public",
"function",
"options",
"(",
"$",
"service",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
",",
"$",
"form_params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"callRestService",
"(",
"'OPTIONS'",
",",
"$",
"se... | Request a Service Ticket for the CAS server and perform a HTTP OPTIONS operation.
@param $service
@param array $headers
@param array $body
@return mixed
@throws \Exception | [
"Request",
"a",
"Service",
"Ticket",
"for",
"the",
"CAS",
"server",
"and",
"perform",
"a",
"HTTP",
"OPTIONS",
"operation",
"."
] | train | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L238-L241 |
epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.delete | public function delete($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('DELETE', $service, $headers, $body, $form_params);
} | php | public function delete($service, $headers = [], $body = '', $form_params = [])
{
return $this->callRestService('DELETE', $service, $headers, $body, $form_params);
} | [
"public",
"function",
"delete",
"(",
"$",
"service",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
",",
"$",
"form_params",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"callRestService",
"(",
"'DELETE'",
",",
"$",
"serv... | Request a Service Ticket for the CAS server and perform a HTTP DELETE operation.
@param $service
@param array $headers
@param array $body
@return mixed
@throws \Exception | [
"Request",
"a",
"Service",
"Ticket",
"for",
"the",
"CAS",
"server",
"and",
"perform",
"a",
"HTTP",
"DELETE",
"operation",
"."
] | train | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L252-L255 |
epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.callRestService | private function callRestService($method, $service, $headers = [], $body = '', $form_params = [])
{
// Make sure a TGT exists
$this->checkTgtExists();
$serviceTicket = $this->getServiceTicket($service);
// Append the ticket to the end of the service's parameters
if (strpos(... | php | private function callRestService($method, $service, $headers = [], $body = '', $form_params = [])
{
// Make sure a TGT exists
$this->checkTgtExists();
$serviceTicket = $this->getServiceTicket($service);
// Append the ticket to the end of the service's parameters
if (strpos(... | [
"private",
"function",
"callRestService",
"(",
"$",
"method",
",",
"$",
"service",
",",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"''",
",",
"$",
"form_params",
"=",
"[",
"]",
")",
"{",
"// Make sure a TGT exists",
"$",
"this",
"->",
"check... | Set up and execute a REST request.
@param $method
@param $service
@param array $headers
@param array $body
@return mixed|null
@throws \Exception | [
"Set",
"up",
"and",
"execute",
"a",
"REST",
"request",
"."
] | train | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L279-L333 |
epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.getServiceTicket | private function getServiceTicket($service)
{
try {
$response = $this->guzzleClient->request(
'POST',
$this->tgtLocation,
[
'verify' => $this->verifySSL,
'form_params' => [
'service'... | php | private function getServiceTicket($service)
{
try {
$response = $this->guzzleClient->request(
'POST',
$this->tgtLocation,
[
'verify' => $this->verifySSL,
'form_params' => [
'service'... | [
"private",
"function",
"getServiceTicket",
"(",
"$",
"service",
")",
"{",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"guzzleClient",
"->",
"request",
"(",
"'POST'",
",",
"$",
"this",
"->",
"tgtLocation",
",",
"[",
"'verify'",
"=>",
"$",
"this",... | Request Service ticket from CAS server
@param $service
@return bool|\GuzzleHttp\Stream\StreamInterface|null
@throws \Exception | [
"Request",
"Service",
"ticket",
"from",
"CAS",
"server"
] | train | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L342-L373 |
epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.login | public function login($tgtStorageLocation = '', $forceAuth = false)
{
if ((!$this->casServer) || (!$this->casPassword) || (!$this->casUsername)) {
throw new \Exception('CAS server and credentials must be set before calling login()', 1);
}
$this->tgtStorageLocation = $tgtStorage... | php | public function login($tgtStorageLocation = '', $forceAuth = false)
{
if ((!$this->casServer) || (!$this->casPassword) || (!$this->casUsername)) {
throw new \Exception('CAS server and credentials must be set before calling login()', 1);
}
$this->tgtStorageLocation = $tgtStorage... | [
"public",
"function",
"login",
"(",
"$",
"tgtStorageLocation",
"=",
"''",
",",
"$",
"forceAuth",
"=",
"false",
")",
"{",
"if",
"(",
"(",
"!",
"$",
"this",
"->",
"casServer",
")",
"||",
"(",
"!",
"$",
"this",
"->",
"casPassword",
")",
"||",
"(",
"!"... | Validate credentials against the CAS server and retrieve a Ticket-Granting Ticket. If a tgtStorageLocation is
specified, the fle is read and the saved TGT is used instead of validating credentials. If force_auth is TRUE,
always validate credentials.
@param string $tgtStorageLocation
@param bool $forceAuth
@return bo... | [
"Validate",
"credentials",
"against",
"the",
"CAS",
"server",
"and",
"retrieve",
"a",
"Ticket",
"-",
"Granting",
"Ticket",
".",
"If",
"a",
"tgtStorageLocation",
"is",
"specified",
"the",
"fle",
"is",
"read",
"and",
"the",
"saved",
"TGT",
"is",
"used",
"inste... | train | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L385-L445 |
epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.loadTGTfromFile | private function loadTGTfromFile($tgtStorageLocation)
{
$tgtStorageData = json_decode(file_get_contents($tgtStorageLocation), true);
if ($tgtStorageData['username']) {
$this->casUsername = $tgtStorageData['username'];
} else {
throw new \Exception('TGT storage missin... | php | private function loadTGTfromFile($tgtStorageLocation)
{
$tgtStorageData = json_decode(file_get_contents($tgtStorageLocation), true);
if ($tgtStorageData['username']) {
$this->casUsername = $tgtStorageData['username'];
} else {
throw new \Exception('TGT storage missin... | [
"private",
"function",
"loadTGTfromFile",
"(",
"$",
"tgtStorageLocation",
")",
"{",
"$",
"tgtStorageData",
"=",
"json_decode",
"(",
"file_get_contents",
"(",
"$",
"tgtStorageLocation",
")",
",",
"true",
")",
";",
"if",
"(",
"$",
"tgtStorageData",
"[",
"'username... | Read the TGT data from a file
@param string $tgtStorageLocation
@throws \Exception | [
"Read",
"the",
"TGT",
"data",
"from",
"a",
"file"
] | train | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L453-L478 |
epierce/cas-rest-client | src/CasRestClient.php | CasRestClient.writeTGTtoFile | private function writeTGTtoFile($tgtStorageLocation, $tgt)
{
$tgtStorageData = [
'TGT' => $tgt,
'username' => $this->casUsername,
'server' => $this->casServer,
'context' => $this->casRESTcontext,
'saved' => time()
];
file_put_conte... | php | private function writeTGTtoFile($tgtStorageLocation, $tgt)
{
$tgtStorageData = [
'TGT' => $tgt,
'username' => $this->casUsername,
'server' => $this->casServer,
'context' => $this->casRESTcontext,
'saved' => time()
];
file_put_conte... | [
"private",
"function",
"writeTGTtoFile",
"(",
"$",
"tgtStorageLocation",
",",
"$",
"tgt",
")",
"{",
"$",
"tgtStorageData",
"=",
"[",
"'TGT'",
"=>",
"$",
"tgt",
",",
"'username'",
"=>",
"$",
"this",
"->",
"casUsername",
",",
"'server'",
"=>",
"$",
"this",
... | Save the TGT data to a local file
@param string $tgtStorageLocation
@param string $tgt | [
"Save",
"the",
"TGT",
"data",
"to",
"a",
"local",
"file"
] | train | https://github.com/epierce/cas-rest-client/blob/342ce958ec5ce40d182a4ffad59c9fa123564ecd/src/CasRestClient.php#L486-L497 |
mimmi20/Wurfl | src/VirtualCapability/Tool/NameVersionPair.php | NameVersionPair.set | public function set($name = null, $version = null)
{
if ($name !== null) {
$this->name = trim($name);
}
if ($version !== null) {
$this->version = trim($version);
}
return true;
} | php | public function set($name = null, $version = null)
{
if ($name !== null) {
$this->name = trim($name);
}
if ($version !== null) {
$this->version = trim($version);
}
return true;
} | [
"public",
"function",
"set",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"version",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"trim",
"(",
"$",
"name",
")",
";",
"}",
"if",
"(",
"$",
... | @param string|null $name
@param string|null $version
@return bool | [
"@param",
"string|null",
"$name",
"@param",
"string|null",
"$version"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/VirtualCapability/Tool/NameVersionPair.php#L46-L57 |
lukebro/flash | src/lukebro/Flash/FlashFactory.php | FlashFactory.create | public function create($level, $message)
{
$this->next[] = ['level' => $level, 'message' => $message];
$this->session->flash($this->key, $this->next);
return $this;
} | php | public function create($level, $message)
{
$this->next[] = ['level' => $level, 'message' => $message];
$this->session->flash($this->key, $this->next);
return $this;
} | [
"public",
"function",
"create",
"(",
"$",
"level",
",",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"next",
"[",
"]",
"=",
"[",
"'level'",
"=>",
"$",
"level",
",",
"'message'",
"=>",
"$",
"message",
"]",
";",
"$",
"this",
"->",
"session",
"->",
... | Create a new flash message.
@param string $message
@param string $level
@return this | [
"Create",
"a",
"new",
"flash",
"message",
"."
] | train | https://github.com/lukebro/flash/blob/5cecd16e6fe399cd8a222084f4f50fc813110ef9/src/lukebro/Flash/FlashFactory.php#L57-L64 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.