repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
CharlotteDunois/Collection | src/Collection.php | Collection.partition | function partition(callable $closure) {
$collection1 = new self();
$collection2 = new self();
foreach($this->data as $key => $val) {
if($closure($val, $key)) {
$collection1->set($key, $val);
} else {
$collection2->set($key, $val);
}
}
return array($collection1, $collection2);
} | php | function partition(callable $closure) {
$collection1 = new self();
$collection2 = new self();
foreach($this->data as $key => $val) {
if($closure($val, $key)) {
$collection1->set($key, $val);
} else {
$collection2->set($key, $val);
}
}
return array($collection1, $collection2);
} | [
"function",
"partition",
"(",
"callable",
"$",
"closure",
")",
"{",
"$",
"collection1",
"=",
"new",
"self",
"(",
")",
";",
"$",
"collection2",
"=",
"new",
"self",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"key",
"=>",
"$"... | Partitions the collection into two collections where the first collection contains the items that passed and the second contains the items that failed.
@param callable $closure Callback specification: `function ($value, $key): bool`
@return \CharlotteDunois\Collect\Collection[] | [
"Partitions",
"the",
"collection",
"into",
"two",
"collections",
"where",
"the",
"first",
"collection",
"contains",
"the",
"items",
"that",
"passed",
"and",
"the",
"second",
"contains",
"the",
"items",
"that",
"failed",
"."
] | 3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce | https://github.com/CharlotteDunois/Collection/blob/3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce/src/Collection.php#L511-L524 | train |
CharlotteDunois/Collection | src/Collection.php | Collection.pluck | function pluck($key, $index = null) {
$data = array();
$i = 0;
foreach($this->data as $v) {
$k = ($index ?
(\is_array($v) ?
(\array_key_exists($index, $v) ? $v[$index] : $i)
: (\is_object($v) ?
(\property_exists($v, $index) ?
$v->$index : $i)
: $i))
: $i);
if(\is_array($v) && \array_key_exists($key, $v)) {
$data[$k] = $v[$key];
} elseif(\is_object($v) && \property_exists($v, $key)) {
$data[$k] = $v->$key;
}
$i++;
}
return (new self($data));
} | php | function pluck($key, $index = null) {
$data = array();
$i = 0;
foreach($this->data as $v) {
$k = ($index ?
(\is_array($v) ?
(\array_key_exists($index, $v) ? $v[$index] : $i)
: (\is_object($v) ?
(\property_exists($v, $index) ?
$v->$index : $i)
: $i))
: $i);
if(\is_array($v) && \array_key_exists($key, $v)) {
$data[$k] = $v[$key];
} elseif(\is_object($v) && \property_exists($v, $key)) {
$data[$k] = $v->$key;
}
$i++;
}
return (new self($data));
} | [
"function",
"pluck",
"(",
"$",
"key",
",",
"$",
"index",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"$",
"i",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"v",
")",
"{",
"$",
"k",
"=",
"(",
"$... | Return the values from a single column in the input array. Returns a new Collection.
@param mixed $key
@param mixed $index
@return \CharlotteDunois\Collect\Collection | [
"Return",
"the",
"values",
"from",
"a",
"single",
"column",
"in",
"the",
"input",
"array",
".",
"Returns",
"a",
"new",
"Collection",
"."
] | 3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce | https://github.com/CharlotteDunois/Collection/blob/3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce/src/Collection.php#L532-L556 | train |
CharlotteDunois/Collection | src/Collection.php | Collection.random | function random(int $num = 1) {
$rand = \array_rand($this->data, $num);
if(!\is_array($rand)) {
$rand = array($rand);
}
$col = new self();
foreach($rand as $key) {
$col->set($key, $this->data[$key]);
}
return $col;
} | php | function random(int $num = 1) {
$rand = \array_rand($this->data, $num);
if(!\is_array($rand)) {
$rand = array($rand);
}
$col = new self();
foreach($rand as $key) {
$col->set($key, $this->data[$key]);
}
return $col;
} | [
"function",
"random",
"(",
"int",
"$",
"num",
"=",
"1",
")",
"{",
"$",
"rand",
"=",
"\\",
"array_rand",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"num",
")",
";",
"if",
"(",
"!",
"\\",
"is_array",
"(",
"$",
"rand",
")",
")",
"{",
"$",
"rand",... | Returns one random item, or multiple random items inside a Collection, from the Collection. Returns a new Collection.
@param int $num
@return \CharlotteDunois\Collect\Collection | [
"Returns",
"one",
"random",
"item",
"or",
"multiple",
"random",
"items",
"inside",
"a",
"Collection",
"from",
"the",
"Collection",
".",
"Returns",
"a",
"new",
"Collection",
"."
] | 3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce | https://github.com/CharlotteDunois/Collection/blob/3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce/src/Collection.php#L563-L575 | train |
CharlotteDunois/Collection | src/Collection.php | Collection.reduce | function reduce(callable $closure, $carry = null) {
foreach($this->data as $val) {
$carry = $closure($carry, $val);
}
return $carry;
} | php | function reduce(callable $closure, $carry = null) {
foreach($this->data as $val) {
$carry = $closure($carry, $val);
}
return $carry;
} | [
"function",
"reduce",
"(",
"callable",
"$",
"closure",
",",
"$",
"carry",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"val",
")",
"{",
"$",
"carry",
"=",
"$",
"closure",
"(",
"$",
"carry",
",",
"$",
"val",
")",
... | Reduces the collection to a single value, passing the result of each iteration into the subsequent iteration.
@param callable $closure Callback specification: `function ($carry, $value): mixed`
@param mixed|null $carry
@return mixed|null|void | [
"Reduces",
"the",
"collection",
"to",
"a",
"single",
"value",
"passing",
"the",
"result",
"of",
"each",
"iteration",
"into",
"the",
"subsequent",
"iteration",
"."
] | 3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce | https://github.com/CharlotteDunois/Collection/blob/3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce/src/Collection.php#L583-L589 | train |
CharlotteDunois/Collection | src/Collection.php | Collection.search | function search($needle, bool $strict = true) {
return \array_search($needle, $this->data, $strict);
} | php | function search($needle, bool $strict = true) {
return \array_search($needle, $this->data, $strict);
} | [
"function",
"search",
"(",
"$",
"needle",
",",
"bool",
"$",
"strict",
"=",
"true",
")",
"{",
"return",
"\\",
"array_search",
"(",
"$",
"needle",
",",
"$",
"this",
"->",
"data",
",",
"$",
"strict",
")",
";",
"}"
] | Searches the collection for the given value and returns its key if found. If the item is not found, false is returned.
@param mixed $needle
@param bool $strict
@return mixed|bool | [
"Searches",
"the",
"collection",
"for",
"the",
"given",
"value",
"and",
"returns",
"its",
"key",
"if",
"found",
".",
"If",
"the",
"item",
"is",
"not",
"found",
"false",
"is",
"returned",
"."
] | 3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce | https://github.com/CharlotteDunois/Collection/blob/3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce/src/Collection.php#L606-L608 | train |
CharlotteDunois/Collection | src/Collection.php | Collection.slice | function slice(int $offset, int $limit = null, bool $preserve_keys = false) {
$data = $this->data;
return (new self(\array_slice($data, $offset, $limit, $preserve_keys)));
} | php | function slice(int $offset, int $limit = null, bool $preserve_keys = false) {
$data = $this->data;
return (new self(\array_slice($data, $offset, $limit, $preserve_keys)));
} | [
"function",
"slice",
"(",
"int",
"$",
"offset",
",",
"int",
"$",
"limit",
"=",
"null",
",",
"bool",
"$",
"preserve_keys",
"=",
"false",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"data",
";",
"return",
"(",
"new",
"self",
"(",
"\\",
"array_slic... | Returns a slice of the collection starting at the given index. Returns a new Collection.
@param int $offset
@param int $limit
@param bool $preserve_keys
@return \CharlotteDunois\Collect\Collection | [
"Returns",
"a",
"slice",
"of",
"the",
"collection",
"starting",
"at",
"the",
"given",
"index",
".",
"Returns",
"a",
"new",
"Collection",
"."
] | 3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce | https://github.com/CharlotteDunois/Collection/blob/3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce/src/Collection.php#L628-L631 | train |
CharlotteDunois/Collection | src/Collection.php | Collection.some | function some(callable $closure) {
foreach($this->data as $key => $val) {
if($closure($val, $key)) {
return true;
}
}
return false;
} | php | function some(callable $closure) {
foreach($this->data as $key => $val) {
if($closure($val, $key)) {
return true;
}
}
return false;
} | [
"function",
"some",
"(",
"callable",
"$",
"closure",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"$",
"closure",
"(",
"$",
"val",
",",
"$",
"key",
")",
")",
"{",
"return",
"true"... | Returns true if at least one element passes the given truth test.
@param callable $closure Callback specification: `function ($value, $key): bool`
@return bool | [
"Returns",
"true",
"if",
"at",
"least",
"one",
"element",
"passes",
"the",
"given",
"truth",
"test",
"."
] | 3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce | https://github.com/CharlotteDunois/Collection/blob/3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce/src/Collection.php#L638-L646 | train |
CharlotteDunois/Collection | src/Collection.php | Collection.sort | function sort(bool $descending = false, int $options = \SORT_REGULAR) {
$data = $this->data;
if($descending) {
\arsort($data, $options);
} else {
\asort($data, $options);
}
return (new self($data));
} | php | function sort(bool $descending = false, int $options = \SORT_REGULAR) {
$data = $this->data;
if($descending) {
\arsort($data, $options);
} else {
\asort($data, $options);
}
return (new self($data));
} | [
"function",
"sort",
"(",
"bool",
"$",
"descending",
"=",
"false",
",",
"int",
"$",
"options",
"=",
"\\",
"SORT_REGULAR",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"data",
";",
"if",
"(",
"$",
"descending",
")",
"{",
"\\",
"arsort",
"(",
"$",
... | Sorts the collection, using sort behaviour flags. Returns a new Collection.
@param bool $descending
@param int $options
@return \CharlotteDunois\Collect\Collection | [
"Sorts",
"the",
"collection",
"using",
"sort",
"behaviour",
"flags",
".",
"Returns",
"a",
"new",
"Collection",
"."
] | 3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce | https://github.com/CharlotteDunois/Collection/blob/3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce/src/Collection.php#L654-L664 | train |
CharlotteDunois/Collection | src/Collection.php | Collection.sortKey | function sortKey(bool $descending = false, int $options = \SORT_REGULAR) {
$data = $this->data;
if($descending) {
\krsort($data, $options);
} else {
\ksort($data, $options);
}
return (new self($data));
} | php | function sortKey(bool $descending = false, int $options = \SORT_REGULAR) {
$data = $this->data;
if($descending) {
\krsort($data, $options);
} else {
\ksort($data, $options);
}
return (new self($data));
} | [
"function",
"sortKey",
"(",
"bool",
"$",
"descending",
"=",
"false",
",",
"int",
"$",
"options",
"=",
"\\",
"SORT_REGULAR",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"data",
";",
"if",
"(",
"$",
"descending",
")",
"{",
"\\",
"krsort",
"(",
"$"... | Sorts the collection by key, using sort behaviour flags. Returns a new Collection.
@param bool $descending
@param int $options
@return \CharlotteDunois\Collect\Collection | [
"Sorts",
"the",
"collection",
"by",
"key",
"using",
"sort",
"behaviour",
"flags",
".",
"Returns",
"a",
"new",
"Collection",
"."
] | 3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce | https://github.com/CharlotteDunois/Collection/blob/3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce/src/Collection.php#L672-L682 | train |
CharlotteDunois/Collection | src/Collection.php | Collection.sortCustom | function sortCustom(callable $closure) {
$data = $this->data;
\uasort($data, $closure);
return (new self($data));
} | php | function sortCustom(callable $closure) {
$data = $this->data;
\uasort($data, $closure);
return (new self($data));
} | [
"function",
"sortCustom",
"(",
"callable",
"$",
"closure",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"data",
";",
"\\",
"uasort",
"(",
"$",
"data",
",",
"$",
"closure",
")",
";",
"return",
"(",
"new",
"self",
"(",
"$",
"data",
")",
")",
";",... | Sorts the collection using a custom sorting function. Returns a new Collection.
@param callable $closure Callback specification: `function ($a, $b): int`
@return \CharlotteDunois\Collect\Collection | [
"Sorts",
"the",
"collection",
"using",
"a",
"custom",
"sorting",
"function",
".",
"Returns",
"a",
"new",
"Collection",
"."
] | 3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce | https://github.com/CharlotteDunois/Collection/blob/3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce/src/Collection.php#L689-L694 | train |
CharlotteDunois/Collection | src/Collection.php | Collection.sortCustomKey | function sortCustomKey(callable $closure) {
$data = $this->data;
\uksort($data, $closure);
return (new self($data));
} | php | function sortCustomKey(callable $closure) {
$data = $this->data;
\uksort($data, $closure);
return (new self($data));
} | [
"function",
"sortCustomKey",
"(",
"callable",
"$",
"closure",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"data",
";",
"\\",
"uksort",
"(",
"$",
"data",
",",
"$",
"closure",
")",
";",
"return",
"(",
"new",
"self",
"(",
"$",
"data",
")",
")",
"... | Sorts the collection by key using a custom sorting function. Returns a new Collection.
@param callable $closure Callback specification: `function ($a, $b): int`
@return \CharlotteDunois\Collect\Collection | [
"Sorts",
"the",
"collection",
"by",
"key",
"using",
"a",
"custom",
"sorting",
"function",
".",
"Returns",
"a",
"new",
"Collection",
"."
] | 3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce | https://github.com/CharlotteDunois/Collection/blob/3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce/src/Collection.php#L701-L706 | train |
CharlotteDunois/Collection | src/Collection.php | Collection.unique | function unique($key, $options = \SORT_REGULAR) {
if($key === null) {
return (new self(\array_unique($this->data, $options)));
}
$exists = array();
return $this->filter(function ($item) use ($key, &$exists) {
if(\is_array($item)) {
if(!isset($item[$key])) {
throw new \BadMethodCallException('Specified key "'.$key.'" does not exist on array');
}
$id = $item[$key];
} elseif(\is_object($item)) {
if(!isset($item->$key)) {
throw new \BadMethodCallException('Specified key "'.$key.'" does not exist on object');
}
$id = $item->$key;
} else {
$id = $item;
}
if(\in_array($id, $exists, true)) {
return false;
}
$exists[] = $id;
return true;
});
} | php | function unique($key, $options = \SORT_REGULAR) {
if($key === null) {
return (new self(\array_unique($this->data, $options)));
}
$exists = array();
return $this->filter(function ($item) use ($key, &$exists) {
if(\is_array($item)) {
if(!isset($item[$key])) {
throw new \BadMethodCallException('Specified key "'.$key.'" does not exist on array');
}
$id = $item[$key];
} elseif(\is_object($item)) {
if(!isset($item->$key)) {
throw new \BadMethodCallException('Specified key "'.$key.'" does not exist on object');
}
$id = $item->$key;
} else {
$id = $item;
}
if(\in_array($id, $exists, true)) {
return false;
}
$exists[] = $id;
return true;
});
} | [
"function",
"unique",
"(",
"$",
"key",
",",
"$",
"options",
"=",
"\\",
"SORT_REGULAR",
")",
"{",
"if",
"(",
"$",
"key",
"===",
"null",
")",
"{",
"return",
"(",
"new",
"self",
"(",
"\\",
"array_unique",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"o... | Returns all of the unique items in the collection. Returns a new Collection.
@param mixed|null $key
@param int $options
@return \CharlotteDunois\Collect\Collection
@throws \BadMethodCallException | [
"Returns",
"all",
"of",
"the",
"unique",
"items",
"in",
"the",
"collection",
".",
"Returns",
"a",
"new",
"Collection",
"."
] | 3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce | https://github.com/CharlotteDunois/Collection/blob/3b27d5fbd947f7f25a9d4d25d517f895aa3b1bce/src/Collection.php#L715-L745 | train |
mridang/pearify | src/Pearify/File.php | File.resolveClass | public function resolveClass(FoundClass $found)
{
Logger::trace("Resolving class %s", $found->name);
if ($found->name[0] === '\\') {
return new Classname($found->name);
}
$classParts = explode('\\', $found->name);
if (count($classParts) >= 2) {
$b = array_shift($classParts);
$baseClass = $this->originalUse->get($b);
if ($baseClass) {
return new Classname($baseClass . '\\' . implode('\\', $classParts));
}
}
if ($c = $this->originalUse->get($found->name)) {
Logger::trace("Found a use statement for class");
Logger::trace("Resolved to %s", $c);
return $c;
} else {
$class = Classname::build($this->getOriginalNamespace(), $found->name);
Logger::trace("Resolved to %s", $class->classname);
return $class;
}
} | php | public function resolveClass(FoundClass $found)
{
Logger::trace("Resolving class %s", $found->name);
if ($found->name[0] === '\\') {
return new Classname($found->name);
}
$classParts = explode('\\', $found->name);
if (count($classParts) >= 2) {
$b = array_shift($classParts);
$baseClass = $this->originalUse->get($b);
if ($baseClass) {
return new Classname($baseClass . '\\' . implode('\\', $classParts));
}
}
if ($c = $this->originalUse->get($found->name)) {
Logger::trace("Found a use statement for class");
Logger::trace("Resolved to %s", $c);
return $c;
} else {
$class = Classname::build($this->getOriginalNamespace(), $found->name);
Logger::trace("Resolved to %s", $class->classname);
return $class;
}
} | [
"public",
"function",
"resolveClass",
"(",
"FoundClass",
"$",
"found",
")",
"{",
"Logger",
"::",
"trace",
"(",
"\"Resolving class %s\"",
",",
"$",
"found",
"->",
"name",
")",
";",
"if",
"(",
"$",
"found",
"->",
"name",
"[",
"0",
"]",
"===",
"'\\\\'",
"... | Resolves a class to it's fully-qualified using a few different mechanisms. If the class
begins with a slash, we assume that it is already qualified. If the class exists in the list
of use-statements, then we resolve the fully qualified name using the uses. Lastly, if the
class doesn't begin with a slash or exist as a use-statement, we resolve the name using the
namespace of the current class.
@param $found FoundClass the found class to resolve
@return bool|Classname | [
"Resolves",
"a",
"class",
"to",
"it",
"s",
"fully",
"-",
"qualified",
"using",
"a",
"few",
"different",
"mechanisms",
".",
"If",
"the",
"class",
"begins",
"with",
"a",
"slash",
"we",
"assume",
"that",
"it",
"is",
"already",
"qualified",
".",
"If",
"the",... | 7bc0710beb4165164e07f88b456de47cad8b3002 | https://github.com/mridang/pearify/blob/7bc0710beb4165164e07f88b456de47cad8b3002/src/Pearify/File.php#L203-L227 | train |
mridang/pearify | src/Pearify/File.php | File.shortenClasses | public function shortenClasses($classesToFix, Configuration $config)
{
$cumulativeOffset = 0;
/** @var FoundClass $c */
foreach ($classesToFix as $c) {
$replacement = [];
if (in_array($c->name, $this->ignoredClassNames)) {
if ($c->name == $this->originalClassname) {
$replacement = [[T_STATIC, "static", 2]];
} else {
continue;
}
}
if (!$replacement) {
$resolvedClass = $this->resolveClass($c);
$alias = $config->replace($this->originalUse->getAliasForClassname($resolvedClass));
Logger::trace("Resolved class %s to %s", array($resolvedClass->classname, $alias));
$replacement = array(array(308, $alias, 2));
}
$offset = $c->from;
$length = $c->to - $c->from + 1;
array_splice($this->tokens, $offset + $cumulativeOffset, $length, $replacement);
$cumulativeOffset -= $length - 1;
}
} | php | public function shortenClasses($classesToFix, Configuration $config)
{
$cumulativeOffset = 0;
/** @var FoundClass $c */
foreach ($classesToFix as $c) {
$replacement = [];
if (in_array($c->name, $this->ignoredClassNames)) {
if ($c->name == $this->originalClassname) {
$replacement = [[T_STATIC, "static", 2]];
} else {
continue;
}
}
if (!$replacement) {
$resolvedClass = $this->resolveClass($c);
$alias = $config->replace($this->originalUse->getAliasForClassname($resolvedClass));
Logger::trace("Resolved class %s to %s", array($resolvedClass->classname, $alias));
$replacement = array(array(308, $alias, 2));
}
$offset = $c->from;
$length = $c->to - $c->from + 1;
array_splice($this->tokens, $offset + $cumulativeOffset, $length, $replacement);
$cumulativeOffset -= $length - 1;
}
} | [
"public",
"function",
"shortenClasses",
"(",
"$",
"classesToFix",
",",
"Configuration",
"$",
"config",
")",
"{",
"$",
"cumulativeOffset",
"=",
"0",
";",
"/** @var FoundClass $c */",
"foreach",
"(",
"$",
"classesToFix",
"as",
"$",
"c",
")",
"{",
"$",
"replaceme... | fixClasses replaces all classnames with the shortest version of a class name possible
@param $classesToFix
@param $config | [
"fixClasses",
"replaces",
"all",
"classnames",
"with",
"the",
"shortest",
"version",
"of",
"a",
"class",
"name",
"possible"
] | 7bc0710beb4165164e07f88b456de47cad8b3002 | https://github.com/mridang/pearify/blob/7bc0710beb4165164e07f88b456de47cad8b3002/src/Pearify/File.php#L235-L265 | train |
mridang/pearify | src/Pearify/File.php | File.getSrc | public function getSrc()
{
$content = "";
foreach ($this->tokens as $token) {
$content .= is_string($token) ? $token : $token[1];;
}
return $content;
} | php | public function getSrc()
{
$content = "";
foreach ($this->tokens as $token) {
$content .= is_string($token) ? $token : $token[1];;
}
return $content;
} | [
"public",
"function",
"getSrc",
"(",
")",
"{",
"$",
"content",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"tokens",
"as",
"$",
"token",
")",
"{",
"$",
"content",
".=",
"is_string",
"(",
"$",
"token",
")",
"?",
"$",
"token",
":",
"$",
"t... | Returns the rebuilt source code by processing each token back as it was
@return string the rebuilt source code | [
"Returns",
"the",
"rebuilt",
"source",
"code",
"by",
"processing",
"each",
"token",
"back",
"as",
"it",
"was"
] | 7bc0710beb4165164e07f88b456de47cad8b3002 | https://github.com/mridang/pearify/blob/7bc0710beb4165164e07f88b456de47cad8b3002/src/Pearify/File.php#L272-L280 | train |
mridang/pearify | src/Pearify/File.php | File.save | public function save($directory)
{
$parts = explode('_', $this->getClass());
array_unshift($parts, $directory);
$path = join(DIRECTORY_SEPARATOR, $parts) . '.php';
self::saveToFile($path, $this->getSrc());
} | php | public function save($directory)
{
$parts = explode('_', $this->getClass());
array_unshift($parts, $directory);
$path = join(DIRECTORY_SEPARATOR, $parts) . '.php';
self::saveToFile($path, $this->getSrc());
} | [
"public",
"function",
"save",
"(",
"$",
"directory",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'_'",
",",
"$",
"this",
"->",
"getClass",
"(",
")",
")",
";",
"array_unshift",
"(",
"$",
"parts",
",",
"$",
"directory",
")",
";",
"$",
"path",
"=",
... | Saves the file to the location complying with the Magento classloader's file placement
structure
@param string $directory the directory to which to save the file | [
"Saves",
"the",
"file",
"to",
"the",
"location",
"complying",
"with",
"the",
"Magento",
"classloader",
"s",
"file",
"placement",
"structure"
] | 7bc0710beb4165164e07f88b456de47cad8b3002 | https://github.com/mridang/pearify/blob/7bc0710beb4165164e07f88b456de47cad8b3002/src/Pearify/File.php#L288-L294 | train |
mridang/pearify | src/Pearify/File.php | File.saveToFile | private static function saveToFile($path, $contents)
{
$directory = pathinfo($path, PATHINFO_DIRNAME);
if (!file_exists($directory)) {
mkdir($directory, 0777, true);
}
file_put_contents($path, $contents);
} | php | private static function saveToFile($path, $contents)
{
$directory = pathinfo($path, PATHINFO_DIRNAME);
if (!file_exists($directory)) {
mkdir($directory, 0777, true);
}
file_put_contents($path, $contents);
} | [
"private",
"static",
"function",
"saveToFile",
"(",
"$",
"path",
",",
"$",
"contents",
")",
"{",
"$",
"directory",
"=",
"pathinfo",
"(",
"$",
"path",
",",
"PATHINFO_DIRNAME",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"directory",
")",
")",
"{"... | Extended version of file put contents that also creates the directory tree if it doesn't
exist.
@param string $path the absolute or relative path to which to save the data
@param string $contents the contents to be saved to the file | [
"Extended",
"version",
"of",
"file",
"put",
"contents",
"that",
"also",
"creates",
"the",
"directory",
"tree",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | 7bc0710beb4165164e07f88b456de47cad8b3002 | https://github.com/mridang/pearify/blob/7bc0710beb4165164e07f88b456de47cad8b3002/src/Pearify/File.php#L303-L310 | train |
VitexSoftware/FlexiPeeHP-Bricks | src/FlexiPeeHP/Bricks/HookReciever.php | HookReciever.saveLastProcessedVersion | public function saveLastProcessedVersion($version)
{
$this->lastProcessedVersion = $version;
$this->myCreateColumn = null;
$this->deleteFromSQL(['serverurl' => constant('FLEXIBEE_URL')]);
if (is_null($this->insertToSQL(['serverurl' => constant('FLEXIBEE_URL'),
'changeid' => $version]))) {
$this->addStatusMessage(_("Last Processed Change ID Saving Failed"),
'error');
} else {
if ($this->debug === true) {
$this->addStatusMessage(sprintf(_('Last Processed Change ID #%s Saved'),
$version));
}
}
} | php | public function saveLastProcessedVersion($version)
{
$this->lastProcessedVersion = $version;
$this->myCreateColumn = null;
$this->deleteFromSQL(['serverurl' => constant('FLEXIBEE_URL')]);
if (is_null($this->insertToSQL(['serverurl' => constant('FLEXIBEE_URL'),
'changeid' => $version]))) {
$this->addStatusMessage(_("Last Processed Change ID Saving Failed"),
'error');
} else {
if ($this->debug === true) {
$this->addStatusMessage(sprintf(_('Last Processed Change ID #%s Saved'),
$version));
}
}
} | [
"public",
"function",
"saveLastProcessedVersion",
"(",
"$",
"version",
")",
"{",
"$",
"this",
"->",
"lastProcessedVersion",
"=",
"$",
"version",
";",
"$",
"this",
"->",
"myCreateColumn",
"=",
"null",
";",
"$",
"this",
"->",
"deleteFromSQL",
"(",
"[",
"'serve... | Ulozi posledni zpracovanou verzi
@param int $version | [
"Ulozi",
"posledni",
"zpracovanou",
"verzi"
] | e6d6d9b6cb6ceffe31b35e0f8f396f614473047b | https://github.com/VitexSoftware/FlexiPeeHP-Bricks/blob/e6d6d9b6cb6ceffe31b35e0f8f396f614473047b/src/FlexiPeeHP/Bricks/HookReciever.php#L142-L157 | train |
conductorphp/conductor-core | src/Filesystem/MountManager/Plugin/SyncPlugin.php | SyncPlugin.putFile | private function putFile(MountManager $mountManager, string $from, string $to, array $config): bool
{
$this->logger->debug("Copying file $from to $to");
list($prefixFrom, $from) = $mountManager->getPrefixAndPath($from);
$buffer = $mountManager->getFilesystem($prefixFrom)->readStream($from);
if ($buffer === false) {
return false;
}
list($prefixTo, $to) = $mountManager->getPrefixAndPath($to);
$result = $mountManager->getFilesystem($prefixTo)->putStream($to, $buffer, $config);
if (is_resource($buffer)) {
fclose($buffer);
}
return $result;
} | php | private function putFile(MountManager $mountManager, string $from, string $to, array $config): bool
{
$this->logger->debug("Copying file $from to $to");
list($prefixFrom, $from) = $mountManager->getPrefixAndPath($from);
$buffer = $mountManager->getFilesystem($prefixFrom)->readStream($from);
if ($buffer === false) {
return false;
}
list($prefixTo, $to) = $mountManager->getPrefixAndPath($to);
$result = $mountManager->getFilesystem($prefixTo)->putStream($to, $buffer, $config);
if (is_resource($buffer)) {
fclose($buffer);
}
return $result;
} | [
"private",
"function",
"putFile",
"(",
"MountManager",
"$",
"mountManager",
",",
"string",
"$",
"from",
",",
"string",
"$",
"to",
",",
"array",
"$",
"config",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"\"Copying file $from to ... | This method is the same as copy, except that it does a putStream rather than writeStream, allowing it to write
even if the file exists.
@param MountManager $mountManager
@param string $from
@param string $to
@param array $config
@return bool | [
"This",
"method",
"is",
"the",
"same",
"as",
"copy",
"except",
"that",
"it",
"does",
"a",
"putStream",
"rather",
"than",
"writeStream",
"allowing",
"it",
"to",
"write",
"even",
"if",
"the",
"file",
"exists",
"."
] | a7aa5901988d8bc3ff280ae3aa6a47f9ce67608c | https://github.com/conductorphp/conductor-core/blob/a7aa5901988d8bc3ff280ae3aa6a47f9ce67608c/src/Filesystem/MountManager/Plugin/SyncPlugin.php#L83-L102 | train |
mrclay/UserlandSession | src/UserlandSession/IdGenerator.php | IdGenerator.generateSessionId | public static function generateSessionId($length = 40)
{
if ($length < 1) {
throw new \InvalidArgumentException('Length should be >= 1');
}
$chars = '0123456789abcdefghijklmnopqrstuvwxyz';
$numChars = 36;
$bytes = random_bytes($length);
$pos = 0;
$result = '';
for ($i = 0; $i < $length; $i++) {
$pos = ($pos + ord($bytes[$i])) % $numChars;
$result .= $chars[$pos];
}
return $result;
} | php | public static function generateSessionId($length = 40)
{
if ($length < 1) {
throw new \InvalidArgumentException('Length should be >= 1');
}
$chars = '0123456789abcdefghijklmnopqrstuvwxyz';
$numChars = 36;
$bytes = random_bytes($length);
$pos = 0;
$result = '';
for ($i = 0; $i < $length; $i++) {
$pos = ($pos + ord($bytes[$i])) % $numChars;
$result .= $chars[$pos];
}
return $result;
} | [
"public",
"static",
"function",
"generateSessionId",
"(",
"$",
"length",
"=",
"40",
")",
"{",
"if",
"(",
"$",
"length",
"<",
"1",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Length should be >= 1'",
")",
";",
"}",
"$",
"chars",
"=",
... | Create a base 36 random alphanumeric string. No uppercase because these would collide with
lowercase chars on Windows.
@param int $length
@return string
@throws \InvalidArgumentException
Based on Zend\Math\Rand::getString()
@copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
@license http://framework.zend.com/license/new-bsd New BSD License
@see https://github.com/zendframework/zf2/blob/master/library/Zend/Math/Rand.php#L179 | [
"Create",
"a",
"base",
"36",
"random",
"alphanumeric",
"string",
".",
"No",
"uppercase",
"because",
"these",
"would",
"collide",
"with",
"lowercase",
"chars",
"on",
"Windows",
"."
] | deabb1b487294efbd0bcb79ca83e6dab56036e45 | https://github.com/mrclay/UserlandSession/blob/deabb1b487294efbd0bcb79ca83e6dab56036e45/src/UserlandSession/IdGenerator.php#L23-L41 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Storage/Data/PlayerFactory.php | PlayerFactory.createPlayer | public function createPlayer(PlayerInfo $playerInfo, PlayerDetailedInfo $playerDetailedInfo)
{
$class = $this->class;
$player = new $class();
$player->merge($playerInfo);
$player->merge($playerDetailedInfo);
return $player;
} | php | public function createPlayer(PlayerInfo $playerInfo, PlayerDetailedInfo $playerDetailedInfo)
{
$class = $this->class;
$player = new $class();
$player->merge($playerInfo);
$player->merge($playerDetailedInfo);
return $player;
} | [
"public",
"function",
"createPlayer",
"(",
"PlayerInfo",
"$",
"playerInfo",
",",
"PlayerDetailedInfo",
"$",
"playerDetailedInfo",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"class",
";",
"$",
"player",
"=",
"new",
"$",
"class",
"(",
")",
";",
"$",
"... | Create a player obhect.
@param PlayerInfo $playerInfo
@param PlayerDetailedInfo $playerDetailedInfo
@return Player | [
"Create",
"a",
"player",
"obhect",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Storage/Data/PlayerFactory.php#L34-L43 | train |
Malwarebytes/Altamira | src/Altamira/ChartDatum/TwoDimensionalPoint.php | TwoDimensionalPoint.getRenderData | public function getRenderData( $useLabel = false )
{
if ( ( $this->jsWriter->getType( $this->series->getTitle() ) instanceof \Altamira\Type\Flot\Donut ) ) {
$value = array( 1, $this['y'] );
} else {
$value = array($this['x'], $this['y']);
if ( $useLabel ) {
$value[] = $this->getLabel();
}
}
return $value;
} | php | public function getRenderData( $useLabel = false )
{
if ( ( $this->jsWriter->getType( $this->series->getTitle() ) instanceof \Altamira\Type\Flot\Donut ) ) {
$value = array( 1, $this['y'] );
} else {
$value = array($this['x'], $this['y']);
if ( $useLabel ) {
$value[] = $this->getLabel();
}
}
return $value;
} | [
"public",
"function",
"getRenderData",
"(",
"$",
"useLabel",
"=",
"false",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"jsWriter",
"->",
"getType",
"(",
"$",
"this",
"->",
"series",
"->",
"getTitle",
"(",
")",
")",
"instanceof",
"\\",
"Altamira",
"\\"... | Provides the data prepared for json encoding
@see Altamira\ChartDatum.ChartDatumAbstract::getRenderData
@param bool $useLabel whether to include the label for this point
@return array | [
"Provides",
"the",
"data",
"prepared",
"for",
"json",
"encoding"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/ChartDatum/TwoDimensionalPoint.php#L41-L52 | train |
BugBuster1701/contao-dlstats-bundle | src/Resources/contao/classes/DlstatsHelper.php | DlstatsHelper.checkIP | public function checkIP($UserIP = false)
{
// Check if IP present
if ($UserIP === false)
{
$tempIP = $this->dlstatsGetUserIP();
if ($tempIP !== false)
{
$this->IP = $tempIP;
}
else
{
return false; // No IP, no search.
}
}
else
{
$this->IP = $UserIP;
}
// IPv4 or IPv6 ?
switch ($this->checkIPVersion($this->IP))
{
case "IPv4":
if ($this->checkIPv4($this->IP) === true)
{
$this->IP_Filter = true;
return $this->IP_Filter;
}
break;
case "IPv6":
if ($this->checkIPv6($this->IP) === true)
{
$this->IP_Filter = true;
return $this->IP_Filter;
}
break;
default:
$this->IP_Filter = false;
return $this->IP_Filter;
break;
}
$this->IP_Filter = false;
return $this->IP_Filter;
} | php | public function checkIP($UserIP = false)
{
// Check if IP present
if ($UserIP === false)
{
$tempIP = $this->dlstatsGetUserIP();
if ($tempIP !== false)
{
$this->IP = $tempIP;
}
else
{
return false; // No IP, no search.
}
}
else
{
$this->IP = $UserIP;
}
// IPv4 or IPv6 ?
switch ($this->checkIPVersion($this->IP))
{
case "IPv4":
if ($this->checkIPv4($this->IP) === true)
{
$this->IP_Filter = true;
return $this->IP_Filter;
}
break;
case "IPv6":
if ($this->checkIPv6($this->IP) === true)
{
$this->IP_Filter = true;
return $this->IP_Filter;
}
break;
default:
$this->IP_Filter = false;
return $this->IP_Filter;
break;
}
$this->IP_Filter = false;
return $this->IP_Filter;
} | [
"public",
"function",
"checkIP",
"(",
"$",
"UserIP",
"=",
"false",
")",
"{",
"// Check if IP present",
"if",
"(",
"$",
"UserIP",
"===",
"false",
")",
"{",
"$",
"tempIP",
"=",
"$",
"this",
"->",
"dlstatsGetUserIP",
"(",
")",
";",
"if",
"(",
"$",
"tempIP... | IP Check
Set IP, detect the IP version and calls the method CheckIPv4 respectively CheckIPv6.
@param string User IP, optional for tests
@return boolean true when bot found over IP
@access protected | [
"IP",
"Check",
"Set",
"IP",
"detect",
"the",
"IP",
"version",
"and",
"calls",
"the",
"method",
"CheckIPv4",
"respectively",
"CheckIPv6",
"."
] | d0d6f8cbbd6a6694bb0564d9865e24bd95e1f6e3 | https://github.com/BugBuster1701/contao-dlstats-bundle/blob/d0d6f8cbbd6a6694bb0564d9865e24bd95e1f6e3/src/Resources/contao/classes/DlstatsHelper.php#L113-L156 | train |
BugBuster1701/contao-dlstats-bundle | src/Resources/contao/classes/DlstatsHelper.php | DlstatsHelper.checkIPVersion | protected function checkIPVersion($UserIP = false)
{
// Test for IPv4
if (ip2long($UserIP) !== false)
{
$this->IP_Version = "IPv4";
return $this->IP_Version;
}
// Test for IPv6
if (substr_count($UserIP, ":") < 2)
{
$this->IP_Version = false;
return false;
}
// ::1 or 2001::0db8
if (substr_count($UserIP, "::") > 1)
{
$this->IP_Version = false;
return false; // one allowed
}
$groups = explode(':', $UserIP);
$num_groups = count($groups);
if (($num_groups > 8) || ($num_groups < 3))
{
$this->IP_Version = false;
return false;
}
$empty_groups = 0;
foreach ($groups as $group)
{
$group = trim($group);
if (! empty($group) && ! (is_numeric($group) && ($group == 0)))
{
if (! preg_match('#([a-fA-F0-9]{0,4})#', $group))
{
$this->IP_Version = false;
return false;
}
}
else
{
++ $empty_groups;
}
}
if ($empty_groups < $num_groups)
{
$this->IP_Version = "IPv6";
return $this->IP_Version;
}
$this->IP_Version = false;
return false; // no (valid) IP Address
} | php | protected function checkIPVersion($UserIP = false)
{
// Test for IPv4
if (ip2long($UserIP) !== false)
{
$this->IP_Version = "IPv4";
return $this->IP_Version;
}
// Test for IPv6
if (substr_count($UserIP, ":") < 2)
{
$this->IP_Version = false;
return false;
}
// ::1 or 2001::0db8
if (substr_count($UserIP, "::") > 1)
{
$this->IP_Version = false;
return false; // one allowed
}
$groups = explode(':', $UserIP);
$num_groups = count($groups);
if (($num_groups > 8) || ($num_groups < 3))
{
$this->IP_Version = false;
return false;
}
$empty_groups = 0;
foreach ($groups as $group)
{
$group = trim($group);
if (! empty($group) && ! (is_numeric($group) && ($group == 0)))
{
if (! preg_match('#([a-fA-F0-9]{0,4})#', $group))
{
$this->IP_Version = false;
return false;
}
}
else
{
++ $empty_groups;
}
}
if ($empty_groups < $num_groups)
{
$this->IP_Version = "IPv6";
return $this->IP_Version;
}
$this->IP_Version = false;
return false; // no (valid) IP Address
} | [
"protected",
"function",
"checkIPVersion",
"(",
"$",
"UserIP",
"=",
"false",
")",
"{",
"// Test for IPv4",
"if",
"(",
"ip2long",
"(",
"$",
"UserIP",
")",
"!==",
"false",
")",
"{",
"$",
"this",
"->",
"IP_Version",
"=",
"\"IPv4\"",
";",
"return",
"$",
"thi... | IP = IPv4 or IPv6 ?
@param string $ip IP Address (IPv4 or IPv6)
@return mixed false: no valid IPv4 and no valid IPv6
"IPv4" : IPv4 Address
"IPv6" : IPv6 Address
@access protected | [
"IP",
"=",
"IPv4",
"or",
"IPv6",
"?"
] | d0d6f8cbbd6a6694bb0564d9865e24bd95e1f6e3 | https://github.com/BugBuster1701/contao-dlstats-bundle/blob/d0d6f8cbbd6a6694bb0564d9865e24bd95e1f6e3/src/Resources/contao/classes/DlstatsHelper.php#L278-L330 | train |
BugBuster1701/contao-dlstats-bundle | src/Resources/contao/classes/DlstatsHelper.php | DlstatsHelper.checkIPv6 | protected function checkIPv6($UserIP = false)
{
// Check if IP present
if ($UserIP === false)
{
return false; // No IP, no search.
}
// search for user bot IP-filter definitions in localconfig.php
if (isset($GLOBALS['DLSTATS']['BOT_IPV6']))
{
foreach ($GLOBALS['DLSTATS']['BOT_IPV6'] as $lineleft)
{
$network = explode("/", trim($lineleft));
if (! isset($network[1]))
{
$network[1] = 128;
}
if ($this->dlstatsIPv6InNetwork($UserIP, $network[0], $network[1]))
{
return true; // IP found
}
}
}
return false;
} | php | protected function checkIPv6($UserIP = false)
{
// Check if IP present
if ($UserIP === false)
{
return false; // No IP, no search.
}
// search for user bot IP-filter definitions in localconfig.php
if (isset($GLOBALS['DLSTATS']['BOT_IPV6']))
{
foreach ($GLOBALS['DLSTATS']['BOT_IPV6'] as $lineleft)
{
$network = explode("/", trim($lineleft));
if (! isset($network[1]))
{
$network[1] = 128;
}
if ($this->dlstatsIPv6InNetwork($UserIP, $network[0], $network[1]))
{
return true; // IP found
}
}
}
return false;
} | [
"protected",
"function",
"checkIPv6",
"(",
"$",
"UserIP",
"=",
"false",
")",
"{",
"// Check if IP present",
"if",
"(",
"$",
"UserIP",
"===",
"false",
")",
"{",
"return",
"false",
";",
"// No IP, no search.",
"}",
"// search for user bot IP-filter definitions in localc... | IP Check for IPv6
@param string User IP
@return boolean true when own IP found in localconfig definitions
@access protected | [
"IP",
"Check",
"for",
"IPv6"
] | d0d6f8cbbd6a6694bb0564d9865e24bd95e1f6e3 | https://github.com/BugBuster1701/contao-dlstats-bundle/blob/d0d6f8cbbd6a6694bb0564d9865e24bd95e1f6e3/src/Resources/contao/classes/DlstatsHelper.php#L339-L363 | train |
BugBuster1701/contao-dlstats-bundle | src/Resources/contao/classes/DlstatsHelper.php | DlstatsHelper.checkIPv4 | protected function checkIPv4($UserIP = false)
{
// Check if IP present
if ($UserIP === false)
{
return false; // No IP, no search.
}
// search for user bot IP-filter definitions in localconfig.php
if (isset($GLOBALS['DLSTATS']['BOT_IPV4']))
{
foreach ($GLOBALS['DLSTATS']['BOT_IPV4'] as $lineleft)
{
$network = explode("/", trim($lineleft));
if (! isset($network[1]))
{
$network[1] = 32;
}
if ($this->dlstatsIPv4InNetwork($UserIP, $network[0], $network[1]))
{
return true; // IP found
}
}
}
return false;
} | php | protected function checkIPv4($UserIP = false)
{
// Check if IP present
if ($UserIP === false)
{
return false; // No IP, no search.
}
// search for user bot IP-filter definitions in localconfig.php
if (isset($GLOBALS['DLSTATS']['BOT_IPV4']))
{
foreach ($GLOBALS['DLSTATS']['BOT_IPV4'] as $lineleft)
{
$network = explode("/", trim($lineleft));
if (! isset($network[1]))
{
$network[1] = 32;
}
if ($this->dlstatsIPv4InNetwork($UserIP, $network[0], $network[1]))
{
return true; // IP found
}
}
}
return false;
} | [
"protected",
"function",
"checkIPv4",
"(",
"$",
"UserIP",
"=",
"false",
")",
"{",
"// Check if IP present",
"if",
"(",
"$",
"UserIP",
"===",
"false",
")",
"{",
"return",
"false",
";",
"// No IP, no search.",
"}",
"// search for user bot IP-filter definitions in localc... | IP Check for IPv4
@param string User IP
@return boolean true when own IP found in localconfig definitions
@access protected | [
"IP",
"Check",
"for",
"IPv4"
] | d0d6f8cbbd6a6694bb0564d9865e24bd95e1f6e3 | https://github.com/BugBuster1701/contao-dlstats-bundle/blob/d0d6f8cbbd6a6694bb0564d9865e24bd95e1f6e3/src/Resources/contao/classes/DlstatsHelper.php#L372-L396 | train |
BugBuster1701/contao-dlstats-bundle | src/Resources/contao/classes/DlstatsHelper.php | DlstatsHelper.dlstatsAnonymizeDomain | protected function dlstatsAnonymizeDomain()
{
if ($this->IP_Version === false || $this->IP === '0.0.0.0')
{
return '';
}
if (isset($GLOBALS['TL_CONFIG']['privacyAnonymizeIp']) &&
(bool) $GLOBALS['TL_CONFIG']['privacyAnonymizeIp'] === false)
{
// Anonymize is disabled
$domain = gethostbyaddr($this->IP);
return ($domain == $this->IP) ? '' : $domain;
}
// Anonymize is enabled
$domain = gethostbyaddr($this->IP);
if ($domain != $this->IP) // bei Fehler/keiner Aufloesung kommt IP zurueck
{
$arrURL = explode('.', $domain);
$tld = array_pop($arrURL);
$host = array_pop($arrURL);
return (strlen($host)) ? $host . '.' . $tld : $tld;
}
else
{
return '';
}
} | php | protected function dlstatsAnonymizeDomain()
{
if ($this->IP_Version === false || $this->IP === '0.0.0.0')
{
return '';
}
if (isset($GLOBALS['TL_CONFIG']['privacyAnonymizeIp']) &&
(bool) $GLOBALS['TL_CONFIG']['privacyAnonymizeIp'] === false)
{
// Anonymize is disabled
$domain = gethostbyaddr($this->IP);
return ($domain == $this->IP) ? '' : $domain;
}
// Anonymize is enabled
$domain = gethostbyaddr($this->IP);
if ($domain != $this->IP) // bei Fehler/keiner Aufloesung kommt IP zurueck
{
$arrURL = explode('.', $domain);
$tld = array_pop($arrURL);
$host = array_pop($arrURL);
return (strlen($host)) ? $host . '.' . $tld : $tld;
}
else
{
return '';
}
} | [
"protected",
"function",
"dlstatsAnonymizeDomain",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"IP_Version",
"===",
"false",
"||",
"$",
"this",
"->",
"IP",
"===",
"'0.0.0.0'",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"GLOBALS"... | dlstatsAnonymizeDomain - Anonymize the Domain of visitors, if enabled
@return string Domain anonymized, if DNS entry exists
@access protected | [
"dlstatsAnonymizeDomain",
"-",
"Anonymize",
"the",
"Domain",
"of",
"visitors",
"if",
"enabled"
] | d0d6f8cbbd6a6694bb0564d9865e24bd95e1f6e3 | https://github.com/BugBuster1701/contao-dlstats-bundle/blob/d0d6f8cbbd6a6694bb0564d9865e24bd95e1f6e3/src/Resources/contao/classes/DlstatsHelper.php#L563-L589 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Config/Model/TextListConfig.php | TextListConfig.add | public function add($element) {
$currentValue = $this->getRawValue();
if (!in_array($element, $currentValue)) {
$currentValue[] = $element;
$this->setRawValue($currentValue);
}
return $this;
} | php | public function add($element) {
$currentValue = $this->getRawValue();
if (!in_array($element, $currentValue)) {
$currentValue[] = $element;
$this->setRawValue($currentValue);
}
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"element",
")",
"{",
"$",
"currentValue",
"=",
"$",
"this",
"->",
"getRawValue",
"(",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"element",
",",
"$",
"currentValue",
")",
")",
"{",
"$",
"currentValue",
"[",... | Add a new value to the list.
@param $element
@return $this | [
"Add",
"a",
"new",
"value",
"to",
"the",
"list",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Config/Model/TextListConfig.php#L37-L46 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Config/Model/TextListConfig.php | TextListConfig.remove | public function remove($element)
{
$currentValue = $this->getRawValue();
if (($key = array_search($element, $currentValue)) !== false) {
unset($currentValue[$key]);
$this->setRawValue($currentValue);
}
} | php | public function remove($element)
{
$currentValue = $this->getRawValue();
if (($key = array_search($element, $currentValue)) !== false) {
unset($currentValue[$key]);
$this->setRawValue($currentValue);
}
} | [
"public",
"function",
"remove",
"(",
"$",
"element",
")",
"{",
"$",
"currentValue",
"=",
"$",
"this",
"->",
"getRawValue",
"(",
")",
";",
"if",
"(",
"(",
"$",
"key",
"=",
"array_search",
"(",
"$",
"element",
",",
"$",
"currentValue",
")",
")",
"!==",... | Remove an element from the list.
@param $element | [
"Remove",
"an",
"element",
"from",
"the",
"list",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Config/Model/TextListConfig.php#L53-L61 | train |
Malwarebytes/Altamira | src/Altamira/JsWriter/JqPlot.php | JqPlot.useCursor | public function useCursor()
{
$this->files = array_merge_recursive( array( 'jqplot.cursor.js' ), $this->files );
$this->setNestedOptVal( $this->options, 'cursor', 'show', true );
$this->setNestedOptVal( $this->options, 'cursor', 'showTooltip', true );
return $this;
} | php | public function useCursor()
{
$this->files = array_merge_recursive( array( 'jqplot.cursor.js' ), $this->files );
$this->setNestedOptVal( $this->options, 'cursor', 'show', true );
$this->setNestedOptVal( $this->options, 'cursor', 'showTooltip', true );
return $this;
} | [
"public",
"function",
"useCursor",
"(",
")",
"{",
"$",
"this",
"->",
"files",
"=",
"array_merge_recursive",
"(",
"array",
"(",
"'jqplot.cursor.js'",
")",
",",
"$",
"this",
"->",
"files",
")",
";",
"$",
"this",
"->",
"setNestedOptVal",
"(",
"$",
"this",
"... | Implemented from \Altamira\JsWriter\Ability\Cursorable
@see \Altamira\JsWriter\Ability\Cursorable::useCursor()
@return \Altamira\JsWriter\JqPlot | [
"Implemented",
"from",
"\\",
"Altamira",
"\\",
"JsWriter",
"\\",
"Ability",
"\\",
"Cursorable"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/JsWriter/JqPlot.php#L135-L142 | train |
Malwarebytes/Altamira | src/Altamira/JsWriter/JqPlot.php | JqPlot.setAxisOptions | public function setAxisOptions($axis, $name, $value)
{
if(strtolower($axis) === 'x' || strtolower($axis) === 'y') {
$axis = strtolower($axis) . 'axis';
if ( in_array( $name, array( 'min', 'max', 'numberTicks', 'tickInterval', 'numberTicks' ) ) ) {
$this->setNestedOptVal( $this->options, 'axes', $axis, $name, $value );
} elseif( in_array( $name, array( 'showGridline', 'formatString' ) ) ) {
$this->setNestedOptVal( $this->options, 'axes', $axis, 'tickOptions', $name, $value );
}
}
return $this;
} | php | public function setAxisOptions($axis, $name, $value)
{
if(strtolower($axis) === 'x' || strtolower($axis) === 'y') {
$axis = strtolower($axis) . 'axis';
if ( in_array( $name, array( 'min', 'max', 'numberTicks', 'tickInterval', 'numberTicks' ) ) ) {
$this->setNestedOptVal( $this->options, 'axes', $axis, $name, $value );
} elseif( in_array( $name, array( 'showGridline', 'formatString' ) ) ) {
$this->setNestedOptVal( $this->options, 'axes', $axis, 'tickOptions', $name, $value );
}
}
return $this;
} | [
"public",
"function",
"setAxisOptions",
"(",
"$",
"axis",
",",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"strtolower",
"(",
"$",
"axis",
")",
"===",
"'x'",
"||",
"strtolower",
"(",
"$",
"axis",
")",
"===",
"'y'",
")",
"{",
"$",
"axis",
... | Used to format the axis of the registered chart
@param string $axis
@param string $name
@param mixed $value
@return \Altamira\JsWriter\JqPlot | [
"Used",
"to",
"format",
"the",
"axis",
"of",
"the",
"registered",
"chart"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/JsWriter/JqPlot.php#L301-L318 | train |
Malwarebytes/Altamira | src/Altamira/JsWriter/JqPlot.php | JqPlot.setType | public function setType( $type, $options = array(), $series = 'default' )
{
parent::setType( $type, $options, $series );
if ( $series == 'default' ) {
$rendererOptions = $this->types['default']->getRendererOptions();
if ( $renderer = $this->types['default']->getRenderer() ) {
$this->options['seriesDefaults']['renderer'] = $renderer;
}
if (! empty( $rendererOptions ) ) {
$this->options['seriesDefaults']['rendererOptions'] = $rendererOptions;
}
}
return $this;
} | php | public function setType( $type, $options = array(), $series = 'default' )
{
parent::setType( $type, $options, $series );
if ( $series == 'default' ) {
$rendererOptions = $this->types['default']->getRendererOptions();
if ( $renderer = $this->types['default']->getRenderer() ) {
$this->options['seriesDefaults']['renderer'] = $renderer;
}
if (! empty( $rendererOptions ) ) {
$this->options['seriesDefaults']['rendererOptions'] = $rendererOptions;
}
}
return $this;
} | [
"public",
"function",
"setType",
"(",
"$",
"type",
",",
"$",
"options",
"=",
"array",
"(",
")",
",",
"$",
"series",
"=",
"'default'",
")",
"{",
"parent",
"::",
"setType",
"(",
"$",
"type",
",",
"$",
"options",
",",
"$",
"series",
")",
";",
"if",
... | Registers a type for a series or entire chart
@see \Altamira\JsWriter\JsWriterAbstract::setType()
@param string|Altamira\Type\TypeAbstract $type
@param array $options
@param string $series
@return \Altamira\JsWriter\JqPlot | [
"Registers",
"a",
"type",
"for",
"a",
"series",
"or",
"entire",
"chart"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/JsWriter/JqPlot.php#L328-L341 | train |
Malwarebytes/Altamira | src/Altamira/JsWriter/JqPlot.php | JqPlot.getOptionsJS | protected function getOptionsJS()
{
$opts = $this->options;
foreach ( $opts['seriesStorage'] as $label => $options ) {
$options['label'] = $label;
$opts['series'][] = $options;
}
if ( $this->chart->titleHidden() ) {
unset( $opts['title'] );
}
unset($opts['seriesStorage']);
return $this->makeJSArray( $opts );
} | php | protected function getOptionsJS()
{
$opts = $this->options;
foreach ( $opts['seriesStorage'] as $label => $options ) {
$options['label'] = $label;
$opts['series'][] = $options;
}
if ( $this->chart->titleHidden() ) {
unset( $opts['title'] );
}
unset($opts['seriesStorage']);
return $this->makeJSArray( $opts );
} | [
"protected",
"function",
"getOptionsJS",
"(",
")",
"{",
"$",
"opts",
"=",
"$",
"this",
"->",
"options",
";",
"foreach",
"(",
"$",
"opts",
"[",
"'seriesStorage'",
"]",
"as",
"$",
"label",
"=>",
"$",
"options",
")",
"{",
"$",
"options",
"[",
"'label'",
... | Prepares options and returns JSON
@return string | [
"Prepares",
"options",
"and",
"returns",
"JSON"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/JsWriter/JqPlot.php#L347-L361 | train |
Malwarebytes/Altamira | src/Altamira/JsWriter/JqPlot.php | JqPlot.setSeriesLabelSetting | public function setSeriesLabelSetting( $series, $name, $value )
{
if ( ( $name === 'location' && in_array( $value, array( 'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw' ) ) )
||( in_array( $name, array( 'xpadding', 'ypadding', 'edgeTolerance', 'stackValue' ) ) ) ) {
return $this->setNestedOptVal( $this->options, 'seriesStorage', $this->getSeriesTitle( $series ), 'pointLabels', $name, $value );
}
return $this;
} | php | public function setSeriesLabelSetting( $series, $name, $value )
{
if ( ( $name === 'location' && in_array( $value, array( 'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw' ) ) )
||( in_array( $name, array( 'xpadding', 'ypadding', 'edgeTolerance', 'stackValue' ) ) ) ) {
return $this->setNestedOptVal( $this->options, 'seriesStorage', $this->getSeriesTitle( $series ), 'pointLabels', $name, $value );
}
return $this;
} | [
"public",
"function",
"setSeriesLabelSetting",
"(",
"$",
"series",
",",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"(",
"$",
"name",
"===",
"'location'",
"&&",
"in_array",
"(",
"$",
"value",
",",
"array",
"(",
"'n'",
",",
"'ne'",
",",
"'e'"... | Sets label setting option values
@see \Altamira\JsWriter\Ability\Labelable::setSeriesLabelSetting()
@param string $series
@param string $name
@param mixed $value
@return \Altamira\JsWriter\JqPlot | [
"Sets",
"label",
"setting",
"option",
"values"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/JsWriter/JqPlot.php#L387-L394 | train |
Malwarebytes/Altamira | src/Altamira/ChartRenderer/TitleRenderer.php | TitleRenderer.preRender | public static function preRender( \Altamira\Chart $chart, array $styleOptions = array() )
{
if ( $chart->titleHidden() ) {
return '';
}
$tagType = isset( $styleOptions['titleTag'] ) ? $styleOptions['titleTag'] : 'h3';
$title = $chart->getTitle();
$output = <<<ENDDIV
<div class="altamira-chart-title">
<{$tagType}>{$title}</{$tagType}>
ENDDIV;
return $output;
} | php | public static function preRender( \Altamira\Chart $chart, array $styleOptions = array() )
{
if ( $chart->titleHidden() ) {
return '';
}
$tagType = isset( $styleOptions['titleTag'] ) ? $styleOptions['titleTag'] : 'h3';
$title = $chart->getTitle();
$output = <<<ENDDIV
<div class="altamira-chart-title">
<{$tagType}>{$title}</{$tagType}>
ENDDIV;
return $output;
} | [
"public",
"static",
"function",
"preRender",
"(",
"\\",
"Altamira",
"\\",
"Chart",
"$",
"chart",
",",
"array",
"$",
"styleOptions",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"chart",
"->",
"titleHidden",
"(",
")",
")",
"{",
"return",
"''",
";... | Adds open wrapping div and puts title in h3 tags by default, but configurable with titleTag key in style
If the chart has been set to hide its title, then it will not display
@param \Altamira\Chart $chart
@param array $styleOptions
@return string | [
"Adds",
"open",
"wrapping",
"div",
"and",
"puts",
"title",
"in",
"h3",
"tags",
"by",
"default",
"but",
"configurable",
"with",
"titleTag",
"key",
"in",
"style",
"If",
"the",
"chart",
"has",
"been",
"set",
"to",
"hide",
"its",
"title",
"then",
"it",
"will... | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/ChartRenderer/TitleRenderer.php#L23-L39 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/AdminGroups/Helpers/AdminGroups.php | AdminGroups.getUserGroups | public function getUserGroups()
{
$groups = [];
foreach ($this->adminGroupConfiguration->getGroups() as $groupName) {
$groups[] = $this->getUserGroup("$groupName");
}
$groups[] = $this->getUserGroup('guest');
return $groups;
} | php | public function getUserGroups()
{
$groups = [];
foreach ($this->adminGroupConfiguration->getGroups() as $groupName) {
$groups[] = $this->getUserGroup("$groupName");
}
$groups[] = $this->getUserGroup('guest');
return $groups;
} | [
"public",
"function",
"getUserGroups",
"(",
")",
"{",
"$",
"groups",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"adminGroupConfiguration",
"->",
"getGroups",
"(",
")",
"as",
"$",
"groupName",
")",
"{",
"$",
"groups",
"[",
"]",
"=",
"$",
"... | Get list of all user groups.
Can be useful for creating group based GUI widgets.
@return Group[] | [
"Get",
"list",
"of",
"all",
"user",
"groups",
".",
"Can",
"be",
"useful",
"for",
"creating",
"group",
"based",
"GUI",
"widgets",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/AdminGroups/Helpers/AdminGroups.php#L45-L54 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/AdminGroups/Helpers/AdminGroups.php | AdminGroups.getLoginUserGroups | public function getLoginUserGroups($login)
{
$groupName = $this->adminGroupConfiguration->getLoginGroupName($login);
if (empty($groupName)) {
$groupName = 'guest';
}
return $this->getUserGroup("$groupName");
} | php | public function getLoginUserGroups($login)
{
$groupName = $this->adminGroupConfiguration->getLoginGroupName($login);
if (empty($groupName)) {
$groupName = 'guest';
}
return $this->getUserGroup("$groupName");
} | [
"public",
"function",
"getLoginUserGroups",
"(",
"$",
"login",
")",
"{",
"$",
"groupName",
"=",
"$",
"this",
"->",
"adminGroupConfiguration",
"->",
"getLoginGroupName",
"(",
"$",
"login",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"groupName",
")",
")",
"{",
... | Get the group in which a user is.
This is useful for gui actions.
@param string $login
@return Group | [
"Get",
"the",
"group",
"in",
"which",
"a",
"user",
"is",
".",
"This",
"is",
"useful",
"for",
"gui",
"actions",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/AdminGroups/Helpers/AdminGroups.php#L64-L72 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/AdminGroups/Helpers/AdminGroups.php | AdminGroups.hasPermission | public function hasPermission($recipient, $permission)
{
if ($recipient instanceof Group) {
$check = true;
foreach ($recipient->getLogins() as $login) {
if ($this->hasLoginPermission($login, $permission) === false) {
$check = false;
}
}
return $check;
} else {
return $this->hasLoginPermission($recipient, $permission);
}
} | php | public function hasPermission($recipient, $permission)
{
if ($recipient instanceof Group) {
$check = true;
foreach ($recipient->getLogins() as $login) {
if ($this->hasLoginPermission($login, $permission) === false) {
$check = false;
}
}
return $check;
} else {
return $this->hasLoginPermission($recipient, $permission);
}
} | [
"public",
"function",
"hasPermission",
"(",
"$",
"recipient",
",",
"$",
"permission",
")",
"{",
"if",
"(",
"$",
"recipient",
"instanceof",
"Group",
")",
"{",
"$",
"check",
"=",
"true",
";",
"foreach",
"(",
"$",
"recipient",
"->",
"getLogins",
"(",
")",
... | Checks if group, a login or a player has a certain permission or not.
@param string|Group|Player $recipient
@param string $permission The permission to check for.
@return bool | [
"Checks",
"if",
"group",
"a",
"login",
"or",
"a",
"player",
"has",
"a",
"certain",
"permission",
"or",
"not",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/AdminGroups/Helpers/AdminGroups.php#L123-L138 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/AdminGroups/Helpers/AdminGroups.php | AdminGroups.hasGroupPermission | public function hasGroupPermission($groupName, $permission)
{
if (strpos($groupName, 'admin:') === 0) {
$groupName = str_replace("admin:", '', $groupName);
}
$logins = $this->adminGroupConfiguration->getGroupLogins($groupName);
if (!empty($logins)) {
return $this->hasPermission($logins[0], $permission);
}
// If guest group is unknow it has no permissions.
if ($groupName == 'guest' && is_null($logins)) {
return false;
}
if (is_null($logins)) {
throw new UnknownGroupException("'$groupName' admin group does not exist.");
}
return false;
} | php | public function hasGroupPermission($groupName, $permission)
{
if (strpos($groupName, 'admin:') === 0) {
$groupName = str_replace("admin:", '', $groupName);
}
$logins = $this->adminGroupConfiguration->getGroupLogins($groupName);
if (!empty($logins)) {
return $this->hasPermission($logins[0], $permission);
}
// If guest group is unknow it has no permissions.
if ($groupName == 'guest' && is_null($logins)) {
return false;
}
if (is_null($logins)) {
throw new UnknownGroupException("'$groupName' admin group does not exist.");
}
return false;
} | [
"public",
"function",
"hasGroupPermission",
"(",
"$",
"groupName",
",",
"$",
"permission",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"groupName",
",",
"'admin:'",
")",
"===",
"0",
")",
"{",
"$",
"groupName",
"=",
"str_replace",
"(",
"\"admin:\"",
",",
"''... | Check if a group has a certain permission or not.
@param string $groupName The name of the group to check permissions for.
@param string $permission The permission to check for.
@return bool
@throws UnknownGroupException Thrown when group isn't an admin group. | [
"Check",
"if",
"a",
"group",
"has",
"a",
"certain",
"permission",
"or",
"not",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/AdminGroups/Helpers/AdminGroups.php#L162-L183 | train |
dfeyer/Ttree.Oembed | Classes/ViewHelpers/EmbedViewHelper.php | EmbedViewHelper.render | public function render($uri, $maxWidth = 0, $maxHeight = 0, $objectName = null)
{
$consumer = new Consumer();
$this->prepareRequestParameters($maxWidth, $maxHeight, $consumer);
$resourceObject = $consumer->consume($uri);
if ($resourceObject !== null) {
if ($objectName !== null) {
if ($this->templateVariableContainer->exists($objectName)) {
throw new Exception('Object name for EmbedViewHelper given as: ' . htmlentities($objectName) . '. This variable name is already in use, choose another.', 1359969229);
}
$this->templateVariableContainer->add($objectName, $resourceObject);
$html = $this->renderChildren();
$this->templateVariableContainer->remove($objectName);
} else {
$html = $resourceObject->getAsString();
}
} else {
$html = 'Invalid oEmbed Resource';
}
return $html;
} | php | public function render($uri, $maxWidth = 0, $maxHeight = 0, $objectName = null)
{
$consumer = new Consumer();
$this->prepareRequestParameters($maxWidth, $maxHeight, $consumer);
$resourceObject = $consumer->consume($uri);
if ($resourceObject !== null) {
if ($objectName !== null) {
if ($this->templateVariableContainer->exists($objectName)) {
throw new Exception('Object name for EmbedViewHelper given as: ' . htmlentities($objectName) . '. This variable name is already in use, choose another.', 1359969229);
}
$this->templateVariableContainer->add($objectName, $resourceObject);
$html = $this->renderChildren();
$this->templateVariableContainer->remove($objectName);
} else {
$html = $resourceObject->getAsString();
}
} else {
$html = 'Invalid oEmbed Resource';
}
return $html;
} | [
"public",
"function",
"render",
"(",
"$",
"uri",
",",
"$",
"maxWidth",
"=",
"0",
",",
"$",
"maxHeight",
"=",
"0",
",",
"$",
"objectName",
"=",
"null",
")",
"{",
"$",
"consumer",
"=",
"new",
"Consumer",
"(",
")",
";",
"$",
"this",
"->",
"prepareRequ... | Renders a representation of a oEmbed resource
@param string $uri
@param integer $maxWidth
@param integer $maxHeight
@param string $objectName
@return string
@throws Exception | [
"Renders",
"a",
"representation",
"of",
"a",
"oEmbed",
"resource"
] | 1f38d18f51c1abe96c19fe4760acc9ef907194df | https://github.com/dfeyer/Ttree.Oembed/blob/1f38d18f51c1abe96c19fe4760acc9ef907194df/Classes/ViewHelpers/EmbedViewHelper.php#L56-L80 | train |
k-gun/oppa | src/ActiveRecord/ActiveRecord.php | ActiveRecord.removeAll | public final function removeAll($whereParams): int
{
$whereParams = [$whereParams];
if ($whereParams[0] === null || $whereParams[0] === '') {
throw new InvalidValueException('You need to pass a parameter for delete action!');
}
$return = $this->db->getLink()->getAgent()
->deleteAll($this->table, "{$this->tablePrimary} IN(?)", $whereParams);
if (method_exists($this, 'onRemove')) {
$this->onRemove($return);
}
return $return;
} | php | public final function removeAll($whereParams): int
{
$whereParams = [$whereParams];
if ($whereParams[0] === null || $whereParams[0] === '') {
throw new InvalidValueException('You need to pass a parameter for delete action!');
}
$return = $this->db->getLink()->getAgent()
->deleteAll($this->table, "{$this->tablePrimary} IN(?)", $whereParams);
if (method_exists($this, 'onRemove')) {
$this->onRemove($return);
}
return $return;
} | [
"public",
"final",
"function",
"removeAll",
"(",
"$",
"whereParams",
")",
":",
"int",
"{",
"$",
"whereParams",
"=",
"[",
"$",
"whereParams",
"]",
";",
"if",
"(",
"$",
"whereParams",
"[",
"0",
"]",
"===",
"null",
"||",
"$",
"whereParams",
"[",
"0",
"]... | Remove all.
@param any $whereParams
@return int
@throws Oppa\Exception\InvalidValueException | [
"Remove",
"all",
"."
] | 3a20b5cc85cb3899c41737678798ec3de73a3836 | https://github.com/k-gun/oppa/blob/3a20b5cc85cb3899c41737678798ec3de73a3836/src/ActiveRecord/ActiveRecord.php#L262-L277 | train |
ansas/php-component | src/Component/Session/ThriftyFileSession.php | ThriftyFileSession.end | public function end()
{
if ($this->isStarted()) {
if (is_callable($this->getCleanupCallback())) {
call_user_func($this->getCleanupCallback());
}
session_write_close();
}
return $this;
} | php | public function end()
{
if ($this->isStarted()) {
if (is_callable($this->getCleanupCallback())) {
call_user_func($this->getCleanupCallback());
}
session_write_close();
}
return $this;
} | [
"public",
"function",
"end",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isStarted",
"(",
")",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"this",
"->",
"getCleanupCallback",
"(",
")",
")",
")",
"{",
"call_user_func",
"(",
"$",
"this",
"->",
"g... | End session.
Call cleanup callback and close session.
@return $this | [
"End",
"session",
"."
] | 24574a1e32d5f1355a6e2b6f20f49b1eda7250ba | https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Session/ThriftyFileSession.php#L260-L270 | train |
ansas/php-component | src/Component/Session/ThriftyFileSession.php | ThriftyFileSession.setCleanupCallback | public function setCleanupCallback($callback)
{
if (!is_null($callback)
&& !is_callable($callback)
) {
throw new InvalidArgumentException("No callable function provided");
}
$this->cleanupCallback = $callback;
return $this;
} | php | public function setCleanupCallback($callback)
{
if (!is_null($callback)
&& !is_callable($callback)
) {
throw new InvalidArgumentException("No callable function provided");
}
$this->cleanupCallback = $callback;
return $this;
} | [
"public",
"function",
"setCleanupCallback",
"(",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"callback",
")",
"&&",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"No callable f... | Set session cleanup callback function.
@param callable $callback Cleanup callback function.
@return $this
@throws InvalidArgumentException | [
"Set",
"session",
"cleanup",
"callback",
"function",
"."
] | 24574a1e32d5f1355a6e2b6f20f49b1eda7250ba | https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Session/ThriftyFileSession.php#L431-L442 | train |
ansas/php-component | src/Component/Session/ThriftyFileSession.php | ThriftyFileSession.setCookieLifetime | public function setCookieLifetime($ttl)
{
if (!is_null($ttl)
&& !is_numeric($ttl)
) {
throw new InvalidArgumentException("No valid ttl provided");
}
$this->cookieLifetime = (int)$ttl;
return $this;
} | php | public function setCookieLifetime($ttl)
{
if (!is_null($ttl)
&& !is_numeric($ttl)
) {
throw new InvalidArgumentException("No valid ttl provided");
}
$this->cookieLifetime = (int)$ttl;
return $this;
} | [
"public",
"function",
"setCookieLifetime",
"(",
"$",
"ttl",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"ttl",
")",
"&&",
"!",
"is_numeric",
"(",
"$",
"ttl",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"No valid ttl provided\"",
")... | Set cookie time-to-live.
@param int $ttl Cookie time-to-live.
@return $this
@throws InvalidArgumentException | [
"Set",
"cookie",
"time",
"-",
"to",
"-",
"live",
"."
] | 24574a1e32d5f1355a6e2b6f20f49b1eda7250ba | https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Session/ThriftyFileSession.php#L452-L463 | train |
joshiausdemwald/Force.com-Toolkit-for-PHP-5.3 | Soap/Mapping/Type/ID.php | ID.fixSforceId | public static function fixSforceId($shortId)
{
$shortId = (string)$shortId;
if (strlen($shortId) !== 15)
{
return new self($shortId);
}
$suffix = '';
for ($i = 0; $i < 3; $i++)
{
$flags = 0;
for ($j = 0; $j < 5; $j++)
{
$c = substr($shortId, $i * 5 + $j, 1);
if (false !== strpos('ABCDEFGHIJKLMNOPQRSTUVWXYZ', $c))
{
$flags += (1 << $j);
}
}
if ($flags <= 25)
{
$suffix .= substr('ABCDEFGHIJKLMNOPQRSTUVWXYZ', $flags, 1);
}
else
{
$suffix .= substr('012345', $flags - 26, 1);
}
}
return new self($shortId . $suffix);
} | php | public static function fixSforceId($shortId)
{
$shortId = (string)$shortId;
if (strlen($shortId) !== 15)
{
return new self($shortId);
}
$suffix = '';
for ($i = 0; $i < 3; $i++)
{
$flags = 0;
for ($j = 0; $j < 5; $j++)
{
$c = substr($shortId, $i * 5 + $j, 1);
if (false !== strpos('ABCDEFGHIJKLMNOPQRSTUVWXYZ', $c))
{
$flags += (1 << $j);
}
}
if ($flags <= 25)
{
$suffix .= substr('ABCDEFGHIJKLMNOPQRSTUVWXYZ', $flags, 1);
}
else
{
$suffix .= substr('012345', $flags - 26, 1);
}
}
return new self($shortId . $suffix);
} | [
"public",
"static",
"function",
"fixSforceId",
"(",
"$",
"shortId",
")",
"{",
"$",
"shortId",
"=",
"(",
"string",
")",
"$",
"shortId",
";",
"if",
"(",
"strlen",
"(",
"$",
"shortId",
")",
"!==",
"15",
")",
"{",
"return",
"new",
"self",
"(",
"$",
"sh... | Create the 18 char ID from a 15 char ID
@see JavaScript Version here:
@link http://boards.developerforce.com/t5/General-Development/display-18-character-ID-in-Page-Layout/td-p/49900
@param $shortId
@param string $shortId
@return string | [
"Create",
"the",
"18",
"char",
"ID",
"from",
"a",
"15",
"char",
"ID"
] | 7fd3194eb3155f019e34439e586e6baf6cbb202f | https://github.com/joshiausdemwald/Force.com-Toolkit-for-PHP-5.3/blob/7fd3194eb3155f019e34439e586e6baf6cbb202f/Soap/Mapping/Type/ID.php#L24-L60 | train |
honeybee/trellis | src/Runtime/Entity/Entity.php | Entity.getRoot | public function getRoot()
{
$tmp_parent = $this->getParent();
$root = $tmp_parent;
while ($tmp_parent) {
$root = $tmp_parent;
$tmp_parent = $tmp_parent->getParent();
}
return $root;
} | php | public function getRoot()
{
$tmp_parent = $this->getParent();
$root = $tmp_parent;
while ($tmp_parent) {
$root = $tmp_parent;
$tmp_parent = $tmp_parent->getParent();
}
return $root;
} | [
"public",
"function",
"getRoot",
"(",
")",
"{",
"$",
"tmp_parent",
"=",
"$",
"this",
"->",
"getParent",
"(",
")",
";",
"$",
"root",
"=",
"$",
"tmp_parent",
";",
"while",
"(",
"$",
"tmp_parent",
")",
"{",
"$",
"root",
"=",
"$",
"tmp_parent",
";",
"$... | Returns the entity's root, if it has one.
@return EntityInterface|null | [
"Returns",
"the",
"entity",
"s",
"root",
"if",
"it",
"has",
"one",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/Entity/Entity.php#L134-L144 | train |
honeybee/trellis | src/Runtime/Entity/Entity.php | Entity.setValue | public function setValue($attribute_name, $attribute_value)
{
$value_holder = $this->getValueHolderFor($attribute_name);
$this->validation_results->setItem(
$attribute_name,
$value_holder->setValue($attribute_value, $this)
);
return $this->isValid();
} | php | public function setValue($attribute_name, $attribute_value)
{
$value_holder = $this->getValueHolderFor($attribute_name);
$this->validation_results->setItem(
$attribute_name,
$value_holder->setValue($attribute_value, $this)
);
return $this->isValid();
} | [
"public",
"function",
"setValue",
"(",
"$",
"attribute_name",
",",
"$",
"attribute_value",
")",
"{",
"$",
"value_holder",
"=",
"$",
"this",
"->",
"getValueHolderFor",
"(",
"$",
"attribute_name",
")",
";",
"$",
"this",
"->",
"validation_results",
"->",
"setItem... | Sets a specific value by attribute_name.
@param string $attribute_name
@param mixed $attribute_value | [
"Sets",
"a",
"specific",
"value",
"by",
"attribute_name",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/Entity/Entity.php#L152-L162 | train |
honeybee/trellis | src/Runtime/Entity/Entity.php | Entity.setValues | public function setValues(array $values)
{
foreach ($this->type->getAttributes()->getKeys() as $attribute_name) {
if (array_key_exists($attribute_name, $values)) {
$this->setValue($attribute_name, $values[$attribute_name]);
}
}
return $this->isValid();
} | php | public function setValues(array $values)
{
foreach ($this->type->getAttributes()->getKeys() as $attribute_name) {
if (array_key_exists($attribute_name, $values)) {
$this->setValue($attribute_name, $values[$attribute_name]);
}
}
return $this->isValid();
} | [
"public",
"function",
"setValues",
"(",
"array",
"$",
"values",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"type",
"->",
"getAttributes",
"(",
")",
"->",
"getKeys",
"(",
")",
"as",
"$",
"attribute_name",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
... | Batch set a given list of attribute values.
@param array $values | [
"Batch",
"set",
"a",
"given",
"list",
"of",
"attribute",
"values",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/Entity/Entity.php#L169-L178 | train |
honeybee/trellis | src/Runtime/Entity/Entity.php | Entity.toArray | public function toArray()
{
$attribute_values = [ self::OBJECT_TYPE => $this->getType()->getPrefix() ];
foreach ($this->value_holder_map as $attribute_name => $value_holder) {
$attribute_value = $value_holder->getValue();
if (is_object($attribute_value) && is_callable([ $attribute_value, 'toArray' ])) {
$attribute_values[$attribute_name] = $attribute_value->toArray();
} else {
$attribute_values[$attribute_name] = $value_holder->toNative();
}
}
return $attribute_values;
} | php | public function toArray()
{
$attribute_values = [ self::OBJECT_TYPE => $this->getType()->getPrefix() ];
foreach ($this->value_holder_map as $attribute_name => $value_holder) {
$attribute_value = $value_holder->getValue();
if (is_object($attribute_value) && is_callable([ $attribute_value, 'toArray' ])) {
$attribute_values[$attribute_name] = $attribute_value->toArray();
} else {
$attribute_values[$attribute_name] = $value_holder->toNative();
}
}
return $attribute_values;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"attribute_values",
"=",
"[",
"self",
"::",
"OBJECT_TYPE",
"=>",
"$",
"this",
"->",
"getType",
"(",
")",
"->",
"getPrefix",
"(",
")",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"value_holder_map",
... | Returns an array representation of a entity's current value state.
@return array | [
"Returns",
"an",
"array",
"representation",
"of",
"a",
"entity",
"s",
"current",
"value",
"state",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/Entity/Entity.php#L261-L276 | train |
honeybee/trellis | src/Runtime/Entity/Entity.php | Entity.isEqualTo | public function isEqualTo(EntityInterface $entity)
{
if ($entity->getType() !== $this->getType()) {
return false;
}
if ($this->getType()->getAttributes()->getSize() !== $this->value_holder_map->getSize()) {
return false;
}
foreach ($this->getType()->getAttributes()->getKeys() as $attribute_name) {
$value_holder = $this->value_holder_map->getItem($attribute_name);
if (!$value_holder->sameValueAs($entity->getValue($attribute_name))) {
return false;
}
}
return true;
} | php | public function isEqualTo(EntityInterface $entity)
{
if ($entity->getType() !== $this->getType()) {
return false;
}
if ($this->getType()->getAttributes()->getSize() !== $this->value_holder_map->getSize()) {
return false;
}
foreach ($this->getType()->getAttributes()->getKeys() as $attribute_name) {
$value_holder = $this->value_holder_map->getItem($attribute_name);
if (!$value_holder->sameValueAs($entity->getValue($attribute_name))) {
return false;
}
}
return true;
} | [
"public",
"function",
"isEqualTo",
"(",
"EntityInterface",
"$",
"entity",
")",
"{",
"if",
"(",
"$",
"entity",
"->",
"getType",
"(",
")",
"!==",
"$",
"this",
"->",
"getType",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"... | Tells whether this entity is considered equal to another given entity.
Entities are equal when they have the same type and values.
@param EntityInterface $entity
@return boolean true on both entities have the same type and values; false otherwise. | [
"Tells",
"whether",
"this",
"entity",
"is",
"considered",
"equal",
"to",
"another",
"given",
"entity",
".",
"Entities",
"are",
"equal",
"when",
"they",
"have",
"the",
"same",
"type",
"and",
"values",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/Entity/Entity.php#L286-L304 | train |
honeybee/trellis | src/Runtime/Entity/Entity.php | Entity.addEntityChangedListener | public function addEntityChangedListener(EntityChangedListenerInterface $listener)
{
if (!$this->listeners->hasItem($listener)) {
$this->listeners->push($listener);
}
} | php | public function addEntityChangedListener(EntityChangedListenerInterface $listener)
{
if (!$this->listeners->hasItem($listener)) {
$this->listeners->push($listener);
}
} | [
"public",
"function",
"addEntityChangedListener",
"(",
"EntityChangedListenerInterface",
"$",
"listener",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"listeners",
"->",
"hasItem",
"(",
"$",
"listener",
")",
")",
"{",
"$",
"this",
"->",
"listeners",
"->",
"p... | Attaches the given entity-changed listener.
@param EntityChangedListenerInterface $listener | [
"Attaches",
"the",
"given",
"entity",
"-",
"changed",
"listener",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/Entity/Entity.php#L405-L410 | train |
honeybee/trellis | src/Runtime/Entity/Entity.php | Entity.removeEntityChangedListener | public function removeEntityChangedListener(EntityChangedListenerInterface $listener)
{
if ($this->listeners->hasItem($listener)) {
$this->listeners->removeItem($listener);
}
} | php | public function removeEntityChangedListener(EntityChangedListenerInterface $listener)
{
if ($this->listeners->hasItem($listener)) {
$this->listeners->removeItem($listener);
}
} | [
"public",
"function",
"removeEntityChangedListener",
"(",
"EntityChangedListenerInterface",
"$",
"listener",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"listeners",
"->",
"hasItem",
"(",
"$",
"listener",
")",
")",
"{",
"$",
"this",
"->",
"listeners",
"->",
"remov... | Removes the given entity-changed listener.
@param EntityChangedListenerInterface $listener | [
"Removes",
"the",
"given",
"entity",
"-",
"changed",
"listener",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/Entity/Entity.php#L417-L422 | train |
honeybee/trellis | src/Runtime/Entity/Entity.php | Entity.onValueChanged | public function onValueChanged(ValueChangedEvent $event)
{
// @todo Possible optimization: only track events for EmbedRoot entities,
// what will save some memory when dealing with deeply nested embed structures.
$this->changes->push($event);
$this->propagateEntityChangedEvent($event);
} | php | public function onValueChanged(ValueChangedEvent $event)
{
// @todo Possible optimization: only track events for EmbedRoot entities,
// what will save some memory when dealing with deeply nested embed structures.
$this->changes->push($event);
$this->propagateEntityChangedEvent($event);
} | [
"public",
"function",
"onValueChanged",
"(",
"ValueChangedEvent",
"$",
"event",
")",
"{",
"// @todo Possible optimization: only track events for EmbedRoot entities,",
"// what will save some memory when dealing with deeply nested embed structures.",
"$",
"this",
"->",
"changes",
"->",
... | Handles value-changed events that are received from the entity's value holders.
@param ValueChangedEvent $event | [
"Handles",
"value",
"-",
"changed",
"events",
"that",
"are",
"received",
"from",
"the",
"entity",
"s",
"value",
"holders",
"."
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/Entity/Entity.php#L429-L435 | train |
honeybee/trellis | src/Runtime/Entity/Entity.php | Entity.collateChildren | public function collateChildren(Closure $criteria, $recursive = true)
{
$entity_map = new EntityMap;
$nested_attribute_types = [ EmbeddedEntityListAttribute::CLASS, EntityReferenceListAttribute::CLASS ];
foreach ($this->getType()->getAttributes([], $nested_attribute_types) as $attribute) {
foreach ($this->getValue($attribute->getName()) as $child_entity) {
if ($criteria($child_entity)) {
$entity_map->setItem($child_entity->asEmbedPath(), $child_entity);
}
if ($recursive) {
$entity_map->append($child_entity->collateChildren($criteria));
}
}
}
return $entity_map;
} | php | public function collateChildren(Closure $criteria, $recursive = true)
{
$entity_map = new EntityMap;
$nested_attribute_types = [ EmbeddedEntityListAttribute::CLASS, EntityReferenceListAttribute::CLASS ];
foreach ($this->getType()->getAttributes([], $nested_attribute_types) as $attribute) {
foreach ($this->getValue($attribute->getName()) as $child_entity) {
if ($criteria($child_entity)) {
$entity_map->setItem($child_entity->asEmbedPath(), $child_entity);
}
if ($recursive) {
$entity_map->append($child_entity->collateChildren($criteria));
}
}
}
return $entity_map;
} | [
"public",
"function",
"collateChildren",
"(",
"Closure",
"$",
"criteria",
",",
"$",
"recursive",
"=",
"true",
")",
"{",
"$",
"entity_map",
"=",
"new",
"EntityMap",
";",
"$",
"nested_attribute_types",
"=",
"[",
"EmbeddedEntityListAttribute",
"::",
"CLASS",
",",
... | Collate nested entities according to the given predicate and index by embed path
@param Closure $criteria
@param boolean $recursive
@return EntityMap | [
"Collate",
"nested",
"entities",
"according",
"to",
"the",
"given",
"predicate",
"and",
"index",
"by",
"embed",
"path"
] | 511300e193b22adc48a22e8ea8294ad40d53f681 | https://github.com/honeybee/trellis/blob/511300e193b22adc48a22e8ea8294ad40d53f681/src/Runtime/Entity/Entity.php#L476-L491 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Plugins/Gui/WindowHelpFactory.php | WindowHelpFactory.getChatCommands | protected function getChatCommands(ManialinkInterface $manialink)
{
$login = $manialink->getUserGroup()->getLogins()[0];
return array_map(
function ($command) {
/** @var AbstractChatCommand $command */
return [
'command' => $command->getCommand(),
'description' => $command->getDescription(),
'help' => $command->getHelp(),
'aliases' => $command->getAliases(),
];
},
array_filter(
$this->chatCommands->getChatCommands(),
function ($command) use ($login) {
if ($command instanceof AbstractAdminChatCommand) {
return $command->hasPermission($login);
}
return true;
}
)
);
} | php | protected function getChatCommands(ManialinkInterface $manialink)
{
$login = $manialink->getUserGroup()->getLogins()[0];
return array_map(
function ($command) {
/** @var AbstractChatCommand $command */
return [
'command' => $command->getCommand(),
'description' => $command->getDescription(),
'help' => $command->getHelp(),
'aliases' => $command->getAliases(),
];
},
array_filter(
$this->chatCommands->getChatCommands(),
function ($command) use ($login) {
if ($command instanceof AbstractAdminChatCommand) {
return $command->hasPermission($login);
}
return true;
}
)
);
} | [
"protected",
"function",
"getChatCommands",
"(",
"ManialinkInterface",
"$",
"manialink",
")",
"{",
"$",
"login",
"=",
"$",
"manialink",
"->",
"getUserGroup",
"(",
")",
"->",
"getLogins",
"(",
")",
"[",
"0",
"]",
";",
"return",
"array_map",
"(",
"function",
... | Get chat commands to display the admin.
@param ManialinkInterface $manialink
@return array | [
"Get",
"chat",
"commands",
"to",
"display",
"the",
"admin",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Plugins/Gui/WindowHelpFactory.php#L138-L164 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Plugins/Gui/WindowHelpFactory.php | WindowHelpFactory.callbackCallCommand | public function callbackCallCommand(ManialinkInterface $manialink, $login, $params, $arguments)
{
$this->chatCommandDataProvider->onPlayerChat(-1, $login, '/'.$arguments['command'], true);
} | php | public function callbackCallCommand(ManialinkInterface $manialink, $login, $params, $arguments)
{
$this->chatCommandDataProvider->onPlayerChat(-1, $login, '/'.$arguments['command'], true);
} | [
"public",
"function",
"callbackCallCommand",
"(",
"ManialinkInterface",
"$",
"manialink",
",",
"$",
"login",
",",
"$",
"params",
",",
"$",
"arguments",
")",
"{",
"$",
"this",
"->",
"chatCommandDataProvider",
"->",
"onPlayerChat",
"(",
"-",
"1",
",",
"$",
"lo... | Callback called when help button is pressed.
@param ManialinkInterface $manialink
@param $login
@param $params
@param $arguments | [
"Callback",
"called",
"when",
"help",
"button",
"is",
"pressed",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Plugins/Gui/WindowHelpFactory.php#L174-L177 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Plugins/Gui/WindowHelpFactory.php | WindowHelpFactory.callbackDescription | public function callbackDescription(ManialinkInterface $manialink, $login, $params, $arguments)
{
$chatCommands = $this->chatCommands->getChatCommands();
$this->windowHelpDetailsFactory->setCurrentCommand($chatCommands[$arguments['command']]);
$this->windowHelpDetailsFactory->create($login);
} | php | public function callbackDescription(ManialinkInterface $manialink, $login, $params, $arguments)
{
$chatCommands = $this->chatCommands->getChatCommands();
$this->windowHelpDetailsFactory->setCurrentCommand($chatCommands[$arguments['command']]);
$this->windowHelpDetailsFactory->create($login);
} | [
"public",
"function",
"callbackDescription",
"(",
"ManialinkInterface",
"$",
"manialink",
",",
"$",
"login",
",",
"$",
"params",
",",
"$",
"arguments",
")",
"{",
"$",
"chatCommands",
"=",
"$",
"this",
"->",
"chatCommands",
"->",
"getChatCommands",
"(",
")",
... | Callbacked called when description button is pressed.
@param ManialinkInterface $manialink
@param $login
@param $params
@param $arguments | [
"Callbacked",
"called",
"when",
"description",
"button",
"is",
"pressed",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Plugins/Gui/WindowHelpFactory.php#L187-L193 | train |
byrokrat/autogiro | src/Visitor/ErrorObject.php | ErrorObject.addError | public function addError(string $msg, string ...$args): void
{
$this->errors[] = sprintf($msg, ...$args);
} | php | public function addError(string $msg, string ...$args): void
{
$this->errors[] = sprintf($msg, ...$args);
} | [
"public",
"function",
"addError",
"(",
"string",
"$",
"msg",
",",
"string",
"...",
"$",
"args",
")",
":",
"void",
"{",
"$",
"this",
"->",
"errors",
"[",
"]",
"=",
"sprintf",
"(",
"$",
"msg",
",",
"...",
"$",
"args",
")",
";",
"}"
] | Add error message to store | [
"Add",
"error",
"message",
"to",
"store"
] | 7035467af18e991c0c130d83294b0779aa3e1583 | https://github.com/byrokrat/autogiro/blob/7035467af18e991c0c130d83294b0779aa3e1583/src/Visitor/ErrorObject.php#L56-L59 | train |
Corviz/framework | src/Database/ConnectionFactory.php | ConnectionFactory.build | public static function build(string $connectionName = null) : Connection
{
$configs = Application::current()->config('database');
$connectionName = $connectionName ?: $configs['default'];
if (!isset($configs[$connectionName])) {
throw new \Exception("Unknown database connection: '$connectionName'");
}
if (!isset(self::$connections[$connectionName])) {
$connectionClass = $configs[$connectionName]['driver'];
$options = $configs[$connectionName]['options'];
self::$connections[$connectionName] = new $connectionClass($options);
}
return self::$connections[$connectionName];
} | php | public static function build(string $connectionName = null) : Connection
{
$configs = Application::current()->config('database');
$connectionName = $connectionName ?: $configs['default'];
if (!isset($configs[$connectionName])) {
throw new \Exception("Unknown database connection: '$connectionName'");
}
if (!isset(self::$connections[$connectionName])) {
$connectionClass = $configs[$connectionName]['driver'];
$options = $configs[$connectionName]['options'];
self::$connections[$connectionName] = new $connectionClass($options);
}
return self::$connections[$connectionName];
} | [
"public",
"static",
"function",
"build",
"(",
"string",
"$",
"connectionName",
"=",
"null",
")",
":",
"Connection",
"{",
"$",
"configs",
"=",
"Application",
"::",
"current",
"(",
")",
"->",
"config",
"(",
"'database'",
")",
";",
"$",
"connectionName",
"=",... | Creates a connection instance by its name.
@param string|null $connectionName
@throws \Exception
@return \Corviz\Database\Connection | [
"Creates",
"a",
"connection",
"instance",
"by",
"its",
"name",
"."
] | e297f890aa1c5aad28aae383b2df5c913bf6c780 | https://github.com/Corviz/framework/blob/e297f890aa1c5aad28aae383b2df5c913bf6c780/src/Database/ConnectionFactory.php#L23-L39 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Helpers/Http.php | Http.call | public function call($url, $callback, $additionalData = null, $options = [])
{
$curlJob = $this->factory->createCurlJob($url, $callback, $additionalData, $options);
// Start job execution.
$this->factory->startJob($curlJob);
} | php | public function call($url, $callback, $additionalData = null, $options = [])
{
$curlJob = $this->factory->createCurlJob($url, $callback, $additionalData, $options);
// Start job execution.
$this->factory->startJob($curlJob);
} | [
"public",
"function",
"call",
"(",
"$",
"url",
",",
"$",
"callback",
",",
"$",
"additionalData",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"curlJob",
"=",
"$",
"this",
"->",
"factory",
"->",
"createCurlJob",
"(",
"$",
"url",
"... | Make a http query.
@param string $url
@param callable $callback
@param null|mixed $additionalData If you need to pass additional metadata.
You will get this back in the callback.
@param array $options curl options array | [
"Make",
"a",
"http",
"query",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/Http.php#L42-L48 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Helpers/Http.php | Http.get | public function get($url, callable $callback, $additionalData = null, $options = [])
{
$defaultOptions = [
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_USERAGENT => "eXpansionPluginPack v ".AbstractApplication::EXPANSION_VERSION,
];
$options = $options + $defaultOptions;
$additionalData['callback'] = $callback;
$this->call($url, [$this, 'process'], $additionalData, $options);
} | php | public function get($url, callable $callback, $additionalData = null, $options = [])
{
$defaultOptions = [
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_USERAGENT => "eXpansionPluginPack v ".AbstractApplication::EXPANSION_VERSION,
];
$options = $options + $defaultOptions;
$additionalData['callback'] = $callback;
$this->call($url, [$this, 'process'], $additionalData, $options);
} | [
"public",
"function",
"get",
"(",
"$",
"url",
",",
"callable",
"$",
"callback",
",",
"$",
"additionalData",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaultOptions",
"=",
"[",
"CURLOPT_FOLLOWLOCATION",
"=>",
"true",
",",
"CURLOPT_... | Make a get http query.
@param string $url address
@param callable $callback callback
@param null|mixed $additionalData If you need to pass additional metadata.
You will get this back in the callback.
@param array $options Single dimensional array of curl_setopt key->values | [
"Make",
"a",
"get",
"http",
"query",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/Http.php#L59-L71 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Helpers/Http.php | Http.post | public function post($url, $fields, callable $callback, $additionalData = null, $options = [])
{
$this->doCall("POST", $url, $fields, $callback, $additionalData, $options);
} | php | public function post($url, $fields, callable $callback, $additionalData = null, $options = [])
{
$this->doCall("POST", $url, $fields, $callback, $additionalData, $options);
} | [
"public",
"function",
"post",
"(",
"$",
"url",
",",
"$",
"fields",
",",
"callable",
"$",
"callback",
",",
"$",
"additionalData",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"doCall",
"(",
"\"POST\"",
",",
"$",
"url... | Make a post http query.
@param string $url address
@param string|array $fields
@param callable $callback callback with returning datas
@param null|mixed $additionalData If you need to pass additional metadata.
You will get this back in the callback.
@param array $options Single dimensional array of curl_setopt key->values | [
"Make",
"a",
"post",
"http",
"query",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/Http.php#L83-L86 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Helpers/Http.php | Http.process | public function process(HttpRequest $curl)
{
$data = $curl->getData();
$additionalData = $curl->getAdditionalData();
$callback = $additionalData['callback'];
unset($additionalData['callback']);
$obj = new HttpResult($data['response'], $data['curlInfo'], $curl->getCurlError(), $additionalData);
call_user_func($callback, $obj);
} | php | public function process(HttpRequest $curl)
{
$data = $curl->getData();
$additionalData = $curl->getAdditionalData();
$callback = $additionalData['callback'];
unset($additionalData['callback']);
$obj = new HttpResult($data['response'], $data['curlInfo'], $curl->getCurlError(), $additionalData);
call_user_func($callback, $obj);
} | [
"public",
"function",
"process",
"(",
"HttpRequest",
"$",
"curl",
")",
"{",
"$",
"data",
"=",
"$",
"curl",
"->",
"getData",
"(",
")",
";",
"$",
"additionalData",
"=",
"$",
"curl",
"->",
"getAdditionalData",
"(",
")",
";",
"$",
"callback",
"=",
"$",
"... | processes the request return value
@param HttpRequest $curl | [
"processes",
"the",
"request",
"return",
"value"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/Http.php#L123-L132 | train |
ansas/php-component | src/Component/Exception/LoggerException.php | LoggerException.addContext | public function addContext(array $context)
{
if ($context) {
$this->context = array_merge($this->context, $context);
}
return $this;
} | php | public function addContext(array $context)
{
if ($context) {
$this->context = array_merge($this->context, $context);
}
return $this;
} | [
"public",
"function",
"addContext",
"(",
"array",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"context",
")",
"{",
"$",
"this",
"->",
"context",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"context",
",",
"$",
"context",
")",
";",
"}",
"return",
"$",
... | Add log context.
@param array $context Log context
@return $this | [
"Add",
"log",
"context",
"."
] | 24574a1e32d5f1355a6e2b6f20f49b1eda7250ba | https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Exception/LoggerException.php#L65-L72 | train |
BenGorUser/UserBundle | src/BenGorUser/UserBundle/Controller/Api/JwtController.php | JwtController.newTokenAction | public function newTokenAction(Request $request, $userClass)
{
try {
$this->get('bengor_user.' . $userClass . '.api_command_bus')->handle(
new LogInUserCommand(
$request->getUser(),
$request->getPassword()
)
);
} catch (UserDoesNotExistException $exception) {
return new JsonResponse('', 400);
} catch (UserEmailInvalidException $exception) {
return new JsonResponse('', 400);
} catch (UserInactiveException $exception) {
return new JsonResponse('Inactive user', 400);
} catch (UserPasswordInvalidException $exception) {
return new JsonResponse('', 400);
}
$token = $this->get('lexik_jwt_authentication.encoder.default')->encode(['email' => $request->getUser()]);
return new JsonResponse(['token' => $token]);
} | php | public function newTokenAction(Request $request, $userClass)
{
try {
$this->get('bengor_user.' . $userClass . '.api_command_bus')->handle(
new LogInUserCommand(
$request->getUser(),
$request->getPassword()
)
);
} catch (UserDoesNotExistException $exception) {
return new JsonResponse('', 400);
} catch (UserEmailInvalidException $exception) {
return new JsonResponse('', 400);
} catch (UserInactiveException $exception) {
return new JsonResponse('Inactive user', 400);
} catch (UserPasswordInvalidException $exception) {
return new JsonResponse('', 400);
}
$token = $this->get('lexik_jwt_authentication.encoder.default')->encode(['email' => $request->getUser()]);
return new JsonResponse(['token' => $token]);
} | [
"public",
"function",
"newTokenAction",
"(",
"Request",
"$",
"request",
",",
"$",
"userClass",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"get",
"(",
"'bengor_user.'",
".",
"$",
"userClass",
".",
"'.api_command_bus'",
")",
"->",
"handle",
"(",
"new",
"LogInU... | Generates new token action.
@param Request $request The request
@param string $userClass Extra parameter that contains the user type
@return \Symfony\Component\HttpFoundation\JsonResponse | [
"Generates",
"new",
"token",
"action",
"."
] | a6d0173496c269a6c80e1319d42eaed4b3bbbd4a | https://github.com/BenGorUser/UserBundle/blob/a6d0173496c269a6c80e1319d42eaed4b3bbbd4a/src/BenGorUser/UserBundle/Controller/Api/JwtController.php#L39-L60 | train |
anklimsk/cakephp-theme | Vendor/PhpUnoconv/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php | ElasticaFormatter.getDocument | protected function getDocument($record)
{
$document = new Document();
$document->setData($record);
$document->setType($this->type);
$document->setIndex($this->index);
return $document;
} | php | protected function getDocument($record)
{
$document = new Document();
$document->setData($record);
$document->setType($this->type);
$document->setIndex($this->index);
return $document;
} | [
"protected",
"function",
"getDocument",
"(",
"$",
"record",
")",
"{",
"$",
"document",
"=",
"new",
"Document",
"(",
")",
";",
"$",
"document",
"->",
"setData",
"(",
"$",
"record",
")",
";",
"$",
"document",
"->",
"setType",
"(",
"$",
"this",
"->",
"t... | Convert a log message into an Elastica Document
@param array $record Log message
@return Document | [
"Convert",
"a",
"log",
"message",
"into",
"an",
"Elastica",
"Document"
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Vendor/PhpUnoconv/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php#L80-L88 | train |
TheBnl/event-tickets | code/controllers/CheckoutStepController.php | CheckoutStepController.init | public function init()
{
// If the step is not a registered step exit
if (!in_array($this->step, CheckoutSteps::getSteps())) {
$this->redirect($this->Link('/'));
}
// If no ReservationSession exists redirect back to the base event controller
elseif (empty(ReservationSession::get())) {
$this->redirect($this->Link('/'));
}
// If the reservation has been processed end the session and redirect
elseif (ReservationSession::get()->Status === 'PAID' && $this->step != 'success') {
ReservationSession::end();
$this->redirect($this->Link('/'));
} else {
$this->reservation = ReservationSession::get();
parent::init();
}
} | php | public function init()
{
// If the step is not a registered step exit
if (!in_array($this->step, CheckoutSteps::getSteps())) {
$this->redirect($this->Link('/'));
}
// If no ReservationSession exists redirect back to the base event controller
elseif (empty(ReservationSession::get())) {
$this->redirect($this->Link('/'));
}
// If the reservation has been processed end the session and redirect
elseif (ReservationSession::get()->Status === 'PAID' && $this->step != 'success') {
ReservationSession::end();
$this->redirect($this->Link('/'));
} else {
$this->reservation = ReservationSession::get();
parent::init();
}
} | [
"public",
"function",
"init",
"(",
")",
"{",
"// If the step is not a registered step exit",
"if",
"(",
"!",
"in_array",
"(",
"$",
"this",
"->",
"step",
",",
"CheckoutSteps",
"::",
"getSteps",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"redirect",
"(",
"$... | Init the controller and check if the current step is allowed | [
"Init",
"the",
"controller",
"and",
"check",
"if",
"the",
"current",
"step",
"is",
"allowed"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/controllers/CheckoutStepController.php#L31-L51 | train |
TheBnl/event-tickets | code/controllers/CheckoutStepController.php | CheckoutStepController.Link | public function Link($action = null)
{
if (!$action) {
$action = $this->step;
}
return $this->dataRecord->RelativeLink($action);
} | php | public function Link($action = null)
{
if (!$action) {
$action = $this->step;
}
return $this->dataRecord->RelativeLink($action);
} | [
"public",
"function",
"Link",
"(",
"$",
"action",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"action",
")",
"{",
"$",
"action",
"=",
"$",
"this",
"->",
"step",
";",
"}",
"return",
"$",
"this",
"->",
"dataRecord",
"->",
"RelativeLink",
"(",
"$",
... | Get a relative link to the current controller
@param null $action
@return string | [
"Get",
"a",
"relative",
"link",
"to",
"the",
"current",
"controller"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/controllers/CheckoutStepController.php#L76-L83 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Util/DateUtil.php | DateUtil.Validate | public static function Validate($date, $format = DATEFORMAT::YMD, $separator = "/")
{
$timestamp = DateUtil::TimeStampFromStr($date, $format);
$dateCheck = DateUtil::FormatDate($timestamp, $format, $separator, true);
$date = $date . substr('--/--/---- 00:00:00', strlen($date));
$timestamp2 = DateUtil::TimeStampFromStr($dateCheck, $format);
return ($timestamp == $timestamp2) && ($date == $dateCheck);
} | php | public static function Validate($date, $format = DATEFORMAT::YMD, $separator = "/")
{
$timestamp = DateUtil::TimeStampFromStr($date, $format);
$dateCheck = DateUtil::FormatDate($timestamp, $format, $separator, true);
$date = $date . substr('--/--/---- 00:00:00', strlen($date));
$timestamp2 = DateUtil::TimeStampFromStr($dateCheck, $format);
return ($timestamp == $timestamp2) && ($date == $dateCheck);
} | [
"public",
"static",
"function",
"Validate",
"(",
"$",
"date",
",",
"$",
"format",
"=",
"DATEFORMAT",
"::",
"YMD",
",",
"$",
"separator",
"=",
"\"/\"",
")",
"{",
"$",
"timestamp",
"=",
"DateUtil",
"::",
"TimeStampFromStr",
"(",
"$",
"date",
",",
"$",
"f... | Check if a date is Valid
@param type $date
@param type $format
@param type $separator
@param type $hour
@return type | [
"Check",
"if",
"a",
"date",
"is",
"Valid"
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Util/DateUtil.php#L112-L121 | train |
Malwarebytes/Altamira | src/Altamira/ScriptsRenderer.php | ScriptsRenderer.get | public function get( $withScript = false )
{
$retVal = '';
if ( $withScript ) {
$retVal .= "<script type='text/javascript'>\n";
}
$retVal .= $this->current();
if ( $withScript ) {
$retVal .= "\n</script>\n";
}
return $retVal;
} | php | public function get( $withScript = false )
{
$retVal = '';
if ( $withScript ) {
$retVal .= "<script type='text/javascript'>\n";
}
$retVal .= $this->current();
if ( $withScript ) {
$retVal .= "\n</script>\n";
}
return $retVal;
} | [
"public",
"function",
"get",
"(",
"$",
"withScript",
"=",
"false",
")",
"{",
"$",
"retVal",
"=",
"''",
";",
"if",
"(",
"$",
"withScript",
")",
"{",
"$",
"retVal",
".=",
"\"<script type='text/javascript'>\\n\"",
";",
"}",
"$",
"retVal",
".=",
"$",
"this",... | Returns the current script value.
@param boolean $withScript
@return Ambigous <string, mixed> | [
"Returns",
"the",
"current",
"script",
"value",
"."
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/ScriptsRenderer.php#L32-L48 | train |
TheBnl/event-tickets | code/model/user-fields/UserOptionSetField.php | UserOptionSetField.getValue | public function getValue()
{
if ($option = $this->Options()->byID($this->getField('Value'))) {
return $option->Title;
}
return null;
} | php | public function getValue()
{
if ($option = $this->Options()->byID($this->getField('Value'))) {
return $option->Title;
}
return null;
} | [
"public",
"function",
"getValue",
"(",
")",
"{",
"if",
"(",
"$",
"option",
"=",
"$",
"this",
"->",
"Options",
"(",
")",
"->",
"byID",
"(",
"$",
"this",
"->",
"getField",
"(",
"'Value'",
")",
")",
")",
"{",
"return",
"$",
"option",
"->",
"Title",
... | Get the value by set option
@return mixed | [
"Get",
"the",
"value",
"by",
"set",
"option"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/model/user-fields/UserOptionSetField.php#L58-L65 | train |
ansas/php-component | src/Component/Convert/ConvertPrice.php | ConvertPrice.setPrice | public function setPrice($price, $format = self::EURO)
{
$this->validatePriceFormat($format);
// sanitize: price is null if value like -1.123E-11 provided
if (preg_match('/^\-?\d+\.\d+E(\+|\-)\d+$/u', (string) $price)) {
$this->price = 0;
return $this;
}
if ($format == self::EURO) {
// remove: all not allowed chars
$price = preg_replace('/[^0-9,\-\.\+]/', '', $price);
// sanitize: +/- at end of number
$price = preg_replace('/^(.*)(\-|\+)$/', '$2$1', $price);
// sanitize: , in price
if (mb_strpos($price, ',') !== false) {
if (preg_match('/,\./', $price)) {
$price = str_replace(',', '', $price);
} else {
$price = str_replace('.', '', $price);
$price = str_replace(',', '.', $price);
}
}
// convert: to internal int structure
$price = (float) $price;
$price = $price * 100;
} else {
$price = (float) $price;
}
$this->price = (int) round($price);
return $this;
} | php | public function setPrice($price, $format = self::EURO)
{
$this->validatePriceFormat($format);
// sanitize: price is null if value like -1.123E-11 provided
if (preg_match('/^\-?\d+\.\d+E(\+|\-)\d+$/u', (string) $price)) {
$this->price = 0;
return $this;
}
if ($format == self::EURO) {
// remove: all not allowed chars
$price = preg_replace('/[^0-9,\-\.\+]/', '', $price);
// sanitize: +/- at end of number
$price = preg_replace('/^(.*)(\-|\+)$/', '$2$1', $price);
// sanitize: , in price
if (mb_strpos($price, ',') !== false) {
if (preg_match('/,\./', $price)) {
$price = str_replace(',', '', $price);
} else {
$price = str_replace('.', '', $price);
$price = str_replace(',', '.', $price);
}
}
// convert: to internal int structure
$price = (float) $price;
$price = $price * 100;
} else {
$price = (float) $price;
}
$this->price = (int) round($price);
return $this;
} | [
"public",
"function",
"setPrice",
"(",
"$",
"price",
",",
"$",
"format",
"=",
"self",
"::",
"EURO",
")",
"{",
"$",
"this",
"->",
"validatePriceFormat",
"(",
"$",
"format",
")",
";",
"// sanitize: price is null if value like -1.123E-11 provided",
"if",
"(",
"preg... | Set price after cutting out all unwanted chars.
This method converts (almost) every string into a price.
@param mixed $price
@param string $format [optional] the type of $price, default ConvertPrice::EURO
@return $this
@throws InvalidArgumentException | [
"Set",
"price",
"after",
"cutting",
"out",
"all",
"unwanted",
"chars",
"."
] | 24574a1e32d5f1355a6e2b6f20f49b1eda7250ba | https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Convert/ConvertPrice.php#L159-L197 | train |
ansas/php-component | src/Component/Convert/ConvertPrice.php | ConvertPrice.sanitize | public function sanitize($price, $format = self::EURO)
{
return $this->setPrice($price, $format)->getPrice($format);
} | php | public function sanitize($price, $format = self::EURO)
{
return $this->setPrice($price, $format)->getPrice($format);
} | [
"public",
"function",
"sanitize",
"(",
"$",
"price",
",",
"$",
"format",
"=",
"self",
"::",
"EURO",
")",
"{",
"return",
"$",
"this",
"->",
"setPrice",
"(",
"$",
"price",
",",
"$",
"format",
")",
"->",
"getPrice",
"(",
"$",
"format",
")",
";",
"}"
] | Set price and return sanitized value at once.
@param mixed $price
@param string $format [optional] the type of $price, default ConvertPrice::EURO.
@return float|int
@throws InvalidArgumentException | [
"Set",
"price",
"and",
"return",
"sanitized",
"value",
"at",
"once",
"."
] | 24574a1e32d5f1355a6e2b6f20f49b1eda7250ba | https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/Convert/ConvertPrice.php#L208-L211 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/Map.php | Map.initMxmaps | public function initMxmaps($overrideExisting = true)
{
if (null !== $this->collMxmaps && !$overrideExisting) {
return;
}
$collectionClassName = MxmapTableMap::getTableMap()->getCollectionClassName();
$this->collMxmaps = new $collectionClassName;
$this->collMxmaps->setModel('\eXpansion\Bundle\Maps\Model\Mxmap');
} | php | public function initMxmaps($overrideExisting = true)
{
if (null !== $this->collMxmaps && !$overrideExisting) {
return;
}
$collectionClassName = MxmapTableMap::getTableMap()->getCollectionClassName();
$this->collMxmaps = new $collectionClassName;
$this->collMxmaps->setModel('\eXpansion\Bundle\Maps\Model\Mxmap');
} | [
"public",
"function",
"initMxmaps",
"(",
"$",
"overrideExisting",
"=",
"true",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"collMxmaps",
"&&",
"!",
"$",
"overrideExisting",
")",
"{",
"return",
";",
"}",
"$",
"collectionClassName",
"=",
"MxmapTab... | Initializes the collMxmaps collection.
By default this just sets the collMxmaps collection to an empty array (like clearcollMxmaps());
however, you may wish to override this method in your stub class to provide setting appropriate
to your application -- for example, setting the initial array to the values stored in database.
@param boolean $overrideExisting If set to true, the method call initializes
the collection even if it is not empty
@return void | [
"Initializes",
"the",
"collMxmaps",
"collection",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/Map.php#L2180-L2190 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/Map.php | Map.getMxmaps | public function getMxmaps(Criteria $criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collMxmapsPartial && !$this->isNew();
if (null === $this->collMxmaps || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collMxmaps) {
// return empty collection
$this->initMxmaps();
} else {
$collMxmaps = ChildMxmapQuery::create(null, $criteria)
->filterByMap($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collMxmapsPartial && count($collMxmaps)) {
$this->initMxmaps(false);
foreach ($collMxmaps as $obj) {
if (false == $this->collMxmaps->contains($obj)) {
$this->collMxmaps->append($obj);
}
}
$this->collMxmapsPartial = true;
}
return $collMxmaps;
}
if ($partial && $this->collMxmaps) {
foreach ($this->collMxmaps as $obj) {
if ($obj->isNew()) {
$collMxmaps[] = $obj;
}
}
}
$this->collMxmaps = $collMxmaps;
$this->collMxmapsPartial = false;
}
}
return $this->collMxmaps;
} | php | public function getMxmaps(Criteria $criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collMxmapsPartial && !$this->isNew();
if (null === $this->collMxmaps || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collMxmaps) {
// return empty collection
$this->initMxmaps();
} else {
$collMxmaps = ChildMxmapQuery::create(null, $criteria)
->filterByMap($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collMxmapsPartial && count($collMxmaps)) {
$this->initMxmaps(false);
foreach ($collMxmaps as $obj) {
if (false == $this->collMxmaps->contains($obj)) {
$this->collMxmaps->append($obj);
}
}
$this->collMxmapsPartial = true;
}
return $collMxmaps;
}
if ($partial && $this->collMxmaps) {
foreach ($this->collMxmaps as $obj) {
if ($obj->isNew()) {
$collMxmaps[] = $obj;
}
}
}
$this->collMxmaps = $collMxmaps;
$this->collMxmapsPartial = false;
}
}
return $this->collMxmaps;
} | [
"public",
"function",
"getMxmaps",
"(",
"Criteria",
"$",
"criteria",
"=",
"null",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"partial",
"=",
"$",
"this",
"->",
"collMxmapsPartial",
"&&",
"!",
"$",
"this",
"->",
"isNew",
"(",
")",... | Gets an array of ChildMxmap objects which contain a foreign key that references this object.
If the $criteria is not null, it is used to always fetch the results from the database.
Otherwise the results are fetched from the database the first time, then cached.
Next time the same method is called without $criteria, the cached collection is returned.
If this ChildMap is new, it will return
an empty collection or the current collection; the criteria is ignored on a new object.
@param Criteria $criteria optional Criteria object to narrow the query
@param ConnectionInterface $con optional connection object
@return ObjectCollection|ChildMxmap[] List of ChildMxmap objects
@throws PropelException | [
"Gets",
"an",
"array",
"of",
"ChildMxmap",
"objects",
"which",
"contain",
"a",
"foreign",
"key",
"that",
"references",
"this",
"object",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/Map.php#L2206-L2248 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/Map.php | Map.countMxmaps | public function countMxmaps(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collMxmapsPartial && !$this->isNew();
if (null === $this->collMxmaps || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collMxmaps) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getMxmaps());
}
$query = ChildMxmapQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByMap($this)
->count($con);
}
return count($this->collMxmaps);
} | php | public function countMxmaps(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collMxmapsPartial && !$this->isNew();
if (null === $this->collMxmaps || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collMxmaps) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getMxmaps());
}
$query = ChildMxmapQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByMap($this)
->count($con);
}
return count($this->collMxmaps);
} | [
"public",
"function",
"countMxmaps",
"(",
"Criteria",
"$",
"criteria",
"=",
"null",
",",
"$",
"distinct",
"=",
"false",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"partial",
"=",
"$",
"this",
"->",
"collMxmapsPartial",
"&&",
"!",
... | Returns the number of related Mxmap objects.
@param Criteria $criteria
@param boolean $distinct
@param ConnectionInterface $con
@return int Count of related Mxmap objects.
@throws PropelException | [
"Returns",
"the",
"number",
"of",
"related",
"Mxmap",
"objects",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/Map.php#L2292-L2315 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Model/Base/Map.php | Map.addMxmap | public function addMxmap(ChildMxmap $l)
{
if ($this->collMxmaps === null) {
$this->initMxmaps();
$this->collMxmapsPartial = true;
}
if (!$this->collMxmaps->contains($l)) {
$this->doAddMxmap($l);
if ($this->mxmapsScheduledForDeletion and $this->mxmapsScheduledForDeletion->contains($l)) {
$this->mxmapsScheduledForDeletion->remove($this->mxmapsScheduledForDeletion->search($l));
}
}
return $this;
} | php | public function addMxmap(ChildMxmap $l)
{
if ($this->collMxmaps === null) {
$this->initMxmaps();
$this->collMxmapsPartial = true;
}
if (!$this->collMxmaps->contains($l)) {
$this->doAddMxmap($l);
if ($this->mxmapsScheduledForDeletion and $this->mxmapsScheduledForDeletion->contains($l)) {
$this->mxmapsScheduledForDeletion->remove($this->mxmapsScheduledForDeletion->search($l));
}
}
return $this;
} | [
"public",
"function",
"addMxmap",
"(",
"ChildMxmap",
"$",
"l",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"collMxmaps",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"initMxmaps",
"(",
")",
";",
"$",
"this",
"->",
"collMxmapsPartial",
"=",
"true",
";",
"}... | Method called to associate a ChildMxmap object to this object
through the ChildMxmap foreign key attribute.
@param ChildMxmap $l ChildMxmap
@return $this|\eXpansion\Bundle\Maps\Model\Map The current object (for fluent API support) | [
"Method",
"called",
"to",
"associate",
"a",
"ChildMxmap",
"object",
"to",
"this",
"object",
"through",
"the",
"ChildMxmap",
"foreign",
"key",
"attribute",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Model/Base/Map.php#L2324-L2340 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php | Services_Webservice.createServer | private function createServer()
{
$server = new SoapServer(null, $this->soapServerOptions);
$server->SetClass($this->wsdlclassname);
$server->handle();
} | php | private function createServer()
{
$server = new SoapServer(null, $this->soapServerOptions);
$server->SetClass($this->wsdlclassname);
$server->handle();
} | [
"private",
"function",
"createServer",
"(",
")",
"{",
"$",
"server",
"=",
"new",
"SoapServer",
"(",
"null",
",",
"$",
"this",
"->",
"soapServerOptions",
")",
";",
"$",
"server",
"->",
"SetClass",
"(",
"$",
"this",
"->",
"wsdlclassname",
")",
";",
"$",
... | create the soap-server
@access private
@return null | [
"create",
"the",
"soap",
"-",
"server"
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php#L249-L254 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php | Services_Webservice.intoStruct | protected function intoStruct()
{
$class = new ReflectionObject($this);
$this->classname = $class->getName();
$this->wsdlclassname = str_replace('\\', '.', $class->getName());
$this->classMethodsIntoStruct();
$this->classStructDispatch();
} | php | protected function intoStruct()
{
$class = new ReflectionObject($this);
$this->classname = $class->getName();
$this->wsdlclassname = str_replace('\\', '.', $class->getName());
$this->classMethodsIntoStruct();
$this->classStructDispatch();
} | [
"protected",
"function",
"intoStruct",
"(",
")",
"{",
"$",
"class",
"=",
"new",
"ReflectionObject",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"classname",
"=",
"$",
"class",
"->",
"getName",
"(",
")",
";",
"$",
"this",
"->",
"wsdlclassname",
"=",
... | parse classes into struct
@access private
@return null | [
"parse",
"classes",
"into",
"struct"
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php#L528-L535 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php | Services_Webservice.classPropertiesIntoStruct | protected function classPropertiesIntoStruct($className)
{
if (!isset($this->wsdlStruct[$className])) {
$class = new ReflectionClass($className);
$properties = $class->getProperties();
$this->wsdlStruct['class'][$className]['property'] = array();
for ($i = 0; $i < count($properties); ++$i) {
if ($properties[$i]->isPublic()) {
preg_match_all(
'~@var\s(\S+)~',
$properties[$i]->getDocComment(),
$var
);
$_cleanType = str_replace('[]', '', $var[1][0], $_length);
$_typens = str_repeat('ArrayOf', $_length);
$this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['type']
= $_cleanType;
$this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['wsdltype']
= $_typens.$_cleanType;
$this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['length']
= $_length;
$this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['array']
= ($_length > 0 && in_array($_cleanType, $this->simpleTypes)) ? true : false;
$isObject = (!in_array($_cleanType, $this->simpleTypes) && new ReflectionClass($_cleanType)) ? true : false;
$this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['class']
= $isObject;
if ($isObject == true) {
$this->classPropertiesIntoStruct($_cleanType);
}
if ($_length > 0) {
$_typensSource = '';
for ($j = $_length; $j > 0; --$j) {
$_typensSource .= 'ArrayOf';
$this->wsdlStruct['array'][$_typensSource.$_cleanType]
= substr(
$_typensSource,
0,
strlen($_typensSource) - 7
)
. $_cleanType;
}
}
}
}
}
} | php | protected function classPropertiesIntoStruct($className)
{
if (!isset($this->wsdlStruct[$className])) {
$class = new ReflectionClass($className);
$properties = $class->getProperties();
$this->wsdlStruct['class'][$className]['property'] = array();
for ($i = 0; $i < count($properties); ++$i) {
if ($properties[$i]->isPublic()) {
preg_match_all(
'~@var\s(\S+)~',
$properties[$i]->getDocComment(),
$var
);
$_cleanType = str_replace('[]', '', $var[1][0], $_length);
$_typens = str_repeat('ArrayOf', $_length);
$this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['type']
= $_cleanType;
$this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['wsdltype']
= $_typens.$_cleanType;
$this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['length']
= $_length;
$this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['array']
= ($_length > 0 && in_array($_cleanType, $this->simpleTypes)) ? true : false;
$isObject = (!in_array($_cleanType, $this->simpleTypes) && new ReflectionClass($_cleanType)) ? true : false;
$this->wsdlStruct['class'][$className]['property'][$properties[$i]->getName()]['class']
= $isObject;
if ($isObject == true) {
$this->classPropertiesIntoStruct($_cleanType);
}
if ($_length > 0) {
$_typensSource = '';
for ($j = $_length; $j > 0; --$j) {
$_typensSource .= 'ArrayOf';
$this->wsdlStruct['array'][$_typensSource.$_cleanType]
= substr(
$_typensSource,
0,
strlen($_typensSource) - 7
)
. $_cleanType;
}
}
}
}
}
} | [
"protected",
"function",
"classPropertiesIntoStruct",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"wsdlStruct",
"[",
"$",
"className",
"]",
")",
")",
"{",
"$",
"class",
"=",
"new",
"ReflectionClass",
"(",
"$",
"class... | parse classes properties into struct
@var string
@access private
@return null | [
"parse",
"classes",
"properties",
"into",
"struct"
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php#L581-L628 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php | Services_Webservice.createWSDL_definitions | protected function createWSDL_definitions()
{
/*
<definitions name="myService"
targetNamespace="urn:myService"
xmlns:typens="urn:myService"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
*/
$this->wsdl_definitions = $this->wsdl->createElement('definitions');
$this->wsdl_definitions->setAttribute('name', $this->wsdlclassname);
$this->wsdl_definitions->setAttribute(
'targetNamespace',
'urn:' . $this->wsdlclassname
);
$this->wsdl_definitions->setAttribute(
'xmlns:typens',
'urn:' . $this->wsdlclassname
);
$this->wsdl_definitions->setAttribute(
'xmlns:xsd',
self::SOAP_XML_SCHEMA_VERSION
);
$this->wsdl_definitions->setAttribute(
'xmlns:soap',
self::SCHEMA_SOAP
);
$this->wsdl_definitions->setAttribute(
'xmlns:soapenc',
self::SOAP_SCHEMA_ENCODING
);
$this->wsdl_definitions->setAttribute(
'xmlns:wsdl',
self::SCHEMA_WSDL
);
$this->wsdl_definitions->setAttribute(
'xmlns',
self::SCHEMA_WSDL
);
$this->wsdl->appendChild($this->wsdl_definitions);
} | php | protected function createWSDL_definitions()
{
/*
<definitions name="myService"
targetNamespace="urn:myService"
xmlns:typens="urn:myService"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
*/
$this->wsdl_definitions = $this->wsdl->createElement('definitions');
$this->wsdl_definitions->setAttribute('name', $this->wsdlclassname);
$this->wsdl_definitions->setAttribute(
'targetNamespace',
'urn:' . $this->wsdlclassname
);
$this->wsdl_definitions->setAttribute(
'xmlns:typens',
'urn:' . $this->wsdlclassname
);
$this->wsdl_definitions->setAttribute(
'xmlns:xsd',
self::SOAP_XML_SCHEMA_VERSION
);
$this->wsdl_definitions->setAttribute(
'xmlns:soap',
self::SCHEMA_SOAP
);
$this->wsdl_definitions->setAttribute(
'xmlns:soapenc',
self::SOAP_SCHEMA_ENCODING
);
$this->wsdl_definitions->setAttribute(
'xmlns:wsdl',
self::SCHEMA_WSDL
);
$this->wsdl_definitions->setAttribute(
'xmlns',
self::SCHEMA_WSDL
);
$this->wsdl->appendChild($this->wsdl_definitions);
} | [
"protected",
"function",
"createWSDL_definitions",
"(",
")",
"{",
"/*\n <definitions name=\"myService\"\n targetNamespace=\"urn:myService\"\n xmlns:typens=\"urn:myService\"\n xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:soap=\"http://schemas.x... | Create the definition node
@return void | [
"Create",
"the",
"definition",
"node"
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php#L727-L772 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php | Services_Webservice.createWSDL_types | protected function createWSDL_types()
{
/*
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:myService"/>
</types>
*/
$types = $this->wsdl->createElement('types');
$schema = $this->wsdl->createElement('xsd:schema');
$schema->setAttribute('xmlns', self::SOAP_XML_SCHEMA_VERSION);
$schema->setAttribute('targetNamespace', 'urn:'.$this->wsdlclassname);
$types->appendChild($schema);
// array
/*
<xsd:complexType name="ArrayOfclassC">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:classC[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
*/
if (isset($this->wsdlStruct['array'])) {
foreach ($this->wsdlStruct['array'] as $source => $target) {
//<s:complexType name="ArrayOfArrayOfInt">
//<s:sequence>
//<s:element minOccurs="0" maxOccurs="unbounded" name="ArrayOfInt" nillable="true" type="tns:ArrayOfInt"/>
//</s:sequence>
$complexType = $this->wsdl->createElement('xsd:complexType');
$complexContent = $this->wsdl->createElement('xsd:complexContent');
$restriction = $this->wsdl->createElement('xsd:restriction');
$attribute = $this->wsdl->createElement('xsd:attribute');
$restriction->appendChild($attribute);
$complexContent->appendChild($restriction);
$complexType->appendChild($complexContent);
$schema->appendChild($complexType);
$complexType->setAttribute('name', $source);
$restriction->setAttribute('base', 'soapenc:Array');
$attribute->setAttribute('ref', 'soapenc:arrayType');
try {
$class = new ReflectionClass($target);
} catch (Exception $e) {
}
if (in_array($target, $this->simpleTypes)) {
$attribute->setAttribute(
'wsdl:arrayType',
'xsd:'.$target.'[]'
);
} elseif (isset($class)) {
$attribute->setAttribute(
'wsdl:arrayType',
'typens:'.$target.'[]'
);
} else {
$attribute->setAttribute(
'wsdl:arrayType',
'typens:'.$target.'[]'
);
}
unset($class);
}
}
// class
/*
<xsd:complexType name="classB">
<xsd:all>
<xsd:element name="classCArray" type="typens:ArrayOfclassC" />
</xsd:all>
</xsd:complexType>
*/
if (isset($this->wsdlStruct['class'])) {
foreach ($this->wsdlStruct['class'] as $className=>$classProperty) {
$complextype = $this->wsdl->createElement('xsd:complexType');
$complextype->setAttribute('name', $className);
$sequence = $this->wsdl->createElement('xsd:all');
$complextype->appendChild($sequence);
$schema->appendChild($complextype);
foreach ($classProperty['property'] as $cpname => $cpValue) {
$element = $this->wsdl->createElement('xsd:element');
$element->setAttribute('name', $cpname);
$element->setAttribute(
'type', (
in_array(
$cpValue['wsdltype'],
$this->simpleTypes
)
? 'xsd:' : 'typens:') . $cpValue['wsdltype']
);
$sequence->appendChild($element);
}
}
}
$this->wsdl_definitions->appendChild($types);
} | php | protected function createWSDL_types()
{
/*
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:myService"/>
</types>
*/
$types = $this->wsdl->createElement('types');
$schema = $this->wsdl->createElement('xsd:schema');
$schema->setAttribute('xmlns', self::SOAP_XML_SCHEMA_VERSION);
$schema->setAttribute('targetNamespace', 'urn:'.$this->wsdlclassname);
$types->appendChild($schema);
// array
/*
<xsd:complexType name="ArrayOfclassC">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:classC[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
*/
if (isset($this->wsdlStruct['array'])) {
foreach ($this->wsdlStruct['array'] as $source => $target) {
//<s:complexType name="ArrayOfArrayOfInt">
//<s:sequence>
//<s:element minOccurs="0" maxOccurs="unbounded" name="ArrayOfInt" nillable="true" type="tns:ArrayOfInt"/>
//</s:sequence>
$complexType = $this->wsdl->createElement('xsd:complexType');
$complexContent = $this->wsdl->createElement('xsd:complexContent');
$restriction = $this->wsdl->createElement('xsd:restriction');
$attribute = $this->wsdl->createElement('xsd:attribute');
$restriction->appendChild($attribute);
$complexContent->appendChild($restriction);
$complexType->appendChild($complexContent);
$schema->appendChild($complexType);
$complexType->setAttribute('name', $source);
$restriction->setAttribute('base', 'soapenc:Array');
$attribute->setAttribute('ref', 'soapenc:arrayType');
try {
$class = new ReflectionClass($target);
} catch (Exception $e) {
}
if (in_array($target, $this->simpleTypes)) {
$attribute->setAttribute(
'wsdl:arrayType',
'xsd:'.$target.'[]'
);
} elseif (isset($class)) {
$attribute->setAttribute(
'wsdl:arrayType',
'typens:'.$target.'[]'
);
} else {
$attribute->setAttribute(
'wsdl:arrayType',
'typens:'.$target.'[]'
);
}
unset($class);
}
}
// class
/*
<xsd:complexType name="classB">
<xsd:all>
<xsd:element name="classCArray" type="typens:ArrayOfclassC" />
</xsd:all>
</xsd:complexType>
*/
if (isset($this->wsdlStruct['class'])) {
foreach ($this->wsdlStruct['class'] as $className=>$classProperty) {
$complextype = $this->wsdl->createElement('xsd:complexType');
$complextype->setAttribute('name', $className);
$sequence = $this->wsdl->createElement('xsd:all');
$complextype->appendChild($sequence);
$schema->appendChild($complextype);
foreach ($classProperty['property'] as $cpname => $cpValue) {
$element = $this->wsdl->createElement('xsd:element');
$element->setAttribute('name', $cpname);
$element->setAttribute(
'type', (
in_array(
$cpValue['wsdltype'],
$this->simpleTypes
)
? 'xsd:' : 'typens:') . $cpValue['wsdltype']
);
$sequence->appendChild($element);
}
}
}
$this->wsdl_definitions->appendChild($types);
} | [
"protected",
"function",
"createWSDL_types",
"(",
")",
"{",
"/*\n <types>\n <xsd:schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"urn:myService\"/>\n </types>\n */",
"$",
"types",
"=",
"$",
"this",
"->",
"wsdl",
"->",
"createElement",
... | Create the types node
@return void | [
"Create",
"the",
"types",
"node"
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php#L781-L883 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php | Services_Webservice.createWSDL_messages | protected function createWSDL_messages()
{
/*
<message name="hello">
<part name="i" type="xsd:int"/>
<part name="j" type="xsd:string"/>
</message>
<message name="helloResponse">
<part name="helloResponse" type="xsd:string"/>
</message>
*/
foreach ($this->wsdlStruct[$this->wsdlclassname]['method'] as $name => $method) {
$messageInput = $this->wsdl->createElement('message');
$messageInput->setAttribute('name', $name);
$messageOutput = $this->wsdl->createElement('message');
$messageOutput->setAttribute('name', $name . 'Response');
$this->wsdl_definitions->appendChild($messageInput);
$this->wsdl_definitions->appendChild($messageOutput);
foreach ($method['var'] as $methodVars) {
if (isset($methodVars['param'])) {
$part = $this->wsdl->createElement('part');
$part->setAttribute('name', $methodVars['name']);
$part->setAttribute(
'type',
(($methodVars['array'] != 1 && $methodVars['class'] != 1) ?
'xsd:' : 'typens:') . $methodVars['wsdltype']
);
$messageInput->appendChild($part);
}
if (isset($methodVars['return'])) {
$part = $this->wsdl->createElement('part');
$part->setAttribute('name', $name.'Response');
$part->setAttribute(
'type',
(($methodVars['array'] != 1 && $methodVars['class'] != 1) ?
'xsd:' : 'typens:') . $methodVars['wsdltype']
);
$messageOutput->appendChild($part);
}
}
}
} | php | protected function createWSDL_messages()
{
/*
<message name="hello">
<part name="i" type="xsd:int"/>
<part name="j" type="xsd:string"/>
</message>
<message name="helloResponse">
<part name="helloResponse" type="xsd:string"/>
</message>
*/
foreach ($this->wsdlStruct[$this->wsdlclassname]['method'] as $name => $method) {
$messageInput = $this->wsdl->createElement('message');
$messageInput->setAttribute('name', $name);
$messageOutput = $this->wsdl->createElement('message');
$messageOutput->setAttribute('name', $name . 'Response');
$this->wsdl_definitions->appendChild($messageInput);
$this->wsdl_definitions->appendChild($messageOutput);
foreach ($method['var'] as $methodVars) {
if (isset($methodVars['param'])) {
$part = $this->wsdl->createElement('part');
$part->setAttribute('name', $methodVars['name']);
$part->setAttribute(
'type',
(($methodVars['array'] != 1 && $methodVars['class'] != 1) ?
'xsd:' : 'typens:') . $methodVars['wsdltype']
);
$messageInput->appendChild($part);
}
if (isset($methodVars['return'])) {
$part = $this->wsdl->createElement('part');
$part->setAttribute('name', $name.'Response');
$part->setAttribute(
'type',
(($methodVars['array'] != 1 && $methodVars['class'] != 1) ?
'xsd:' : 'typens:') . $methodVars['wsdltype']
);
$messageOutput->appendChild($part);
}
}
}
} | [
"protected",
"function",
"createWSDL_messages",
"(",
")",
"{",
"/*\n <message name=\"hello\">\n <part name=\"i\" type=\"xsd:int\"/>\n <part name=\"j\" type=\"xsd:string\"/>\n </message>\n <message name=\"helloResponse\">\n <part name=\"helloResponse\... | Create the messages node
@return void | [
"Create",
"the",
"messages",
"node"
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php#L892-L934 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php | Services_Webservice.createWSDL_binding | protected function createWSDL_binding()
{
/*
<binding name="myServiceBinding" type="typens:myServicePort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="hello">
<soap:operation soapAction="urn:myServiceAction"/>
<input>
<soap:body use="encoded" namespace="urn:myService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:myService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
*/
$binding = $this->wsdl->createElement('binding');
$binding->setAttribute('name', $this->wsdlclassname . 'Binding');
$binding->setAttribute('type', 'typens:' . $this->wsdlclassname . 'Port');
$soap_binding = $this->wsdl->createElement('soap:binding');
$soap_binding->setAttribute('style', 'rpc');
$soap_binding->setAttribute('transport', self::SCHEMA_SOAP_HTTP);
$binding->appendChild($soap_binding);
foreach ($this->wsdlStruct[$this->wsdlclassname]['method'] as $name => $vars) {
$operation = $this->wsdl->createElement('operation');
$operation->setAttribute('name', $name);
$binding->appendChild($operation);
$soap_operation = $this->wsdl->createElement('soap:operation');
$soap_operation->setAttribute(
'soapAction',
'urn:'.$this->wsdlclassname.'Action'
);
$operation->appendChild($soap_operation);
$input = $this->wsdl->createElement('input');
$output = $this->wsdl->createElement('output');
$operation->appendChild($input);
$operation->appendChild($output);
$soap_body = $this->wsdl->createElement('soap:body');
$soap_body->setAttribute('use', 'encoded');
$soap_body->setAttribute('namespace', 'urn:'.$this->namespace);
$soap_body->setAttribute('encodingStyle', self::SOAP_SCHEMA_ENCODING);
$input->appendChild($soap_body);
$soap_body = $this->wsdl->createElement('soap:body');
$soap_body->setAttribute('use', 'encoded');
$soap_body->setAttribute('namespace', 'urn:'.$this->namespace);
$soap_body->setAttribute('encodingStyle', self::SOAP_SCHEMA_ENCODING);
$output->appendChild($soap_body);
}
$this->wsdl_definitions->appendChild($binding);
} | php | protected function createWSDL_binding()
{
/*
<binding name="myServiceBinding" type="typens:myServicePort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="hello">
<soap:operation soapAction="urn:myServiceAction"/>
<input>
<soap:body use="encoded" namespace="urn:myService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:myService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
*/
$binding = $this->wsdl->createElement('binding');
$binding->setAttribute('name', $this->wsdlclassname . 'Binding');
$binding->setAttribute('type', 'typens:' . $this->wsdlclassname . 'Port');
$soap_binding = $this->wsdl->createElement('soap:binding');
$soap_binding->setAttribute('style', 'rpc');
$soap_binding->setAttribute('transport', self::SCHEMA_SOAP_HTTP);
$binding->appendChild($soap_binding);
foreach ($this->wsdlStruct[$this->wsdlclassname]['method'] as $name => $vars) {
$operation = $this->wsdl->createElement('operation');
$operation->setAttribute('name', $name);
$binding->appendChild($operation);
$soap_operation = $this->wsdl->createElement('soap:operation');
$soap_operation->setAttribute(
'soapAction',
'urn:'.$this->wsdlclassname.'Action'
);
$operation->appendChild($soap_operation);
$input = $this->wsdl->createElement('input');
$output = $this->wsdl->createElement('output');
$operation->appendChild($input);
$operation->appendChild($output);
$soap_body = $this->wsdl->createElement('soap:body');
$soap_body->setAttribute('use', 'encoded');
$soap_body->setAttribute('namespace', 'urn:'.$this->namespace);
$soap_body->setAttribute('encodingStyle', self::SOAP_SCHEMA_ENCODING);
$input->appendChild($soap_body);
$soap_body = $this->wsdl->createElement('soap:body');
$soap_body->setAttribute('use', 'encoded');
$soap_body->setAttribute('namespace', 'urn:'.$this->namespace);
$soap_body->setAttribute('encodingStyle', self::SOAP_SCHEMA_ENCODING);
$output->appendChild($soap_body);
}
$this->wsdl_definitions->appendChild($binding);
} | [
"protected",
"function",
"createWSDL_binding",
"(",
")",
"{",
"/*\n <binding name=\"myServiceBinding\" type=\"typens:myServicePort\">\n <soap:binding style=\"rpc\" transport=\"http://schemas.xmlsoap.org/soap/http\"/>\n <operation name=\"hello\">\n <soa... | Create the binding node
@return void | [
"Create",
"the",
"binding",
"node"
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php#L943-L992 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php | Services_Webservice.createWSDL_portType | protected function createWSDL_portType()
{
/*
<portType name="myServicePort">
<operation name="hello">
<input message="typens:hello"/>
<output message="typens:helloResponse"/>
</operation>
</portType>
*/
$portType = $this->wsdl->createElement('portType');
$portType->setAttribute('name', $this->wsdlclassname.'Port');
foreach ($this->wsdlStruct[$this->wsdlclassname]['method'] as $methodName => $methodVars) {
$operation = $this->wsdl->createElement('operation');
$operation->setAttribute('name', $methodName);
$portType->appendChild($operation);
$documentation = $this->wsdl->createElement('documentation');
$documentation->appendChild(
$this->wsdl->createTextNode($methodVars['description'])
);
$operation->appendChild($documentation);
$input = $this->wsdl->createElement('input');
$output = $this->wsdl->createElement('output');
$input->setAttribute('message', 'typens:' . $methodName);
$output->setAttribute('message', 'typens:' . $methodName . 'Response');
$operation->appendChild($input);
$operation->appendChild($output);
}
$this->wsdl_definitions->appendChild($portType);
} | php | protected function createWSDL_portType()
{
/*
<portType name="myServicePort">
<operation name="hello">
<input message="typens:hello"/>
<output message="typens:helloResponse"/>
</operation>
</portType>
*/
$portType = $this->wsdl->createElement('portType');
$portType->setAttribute('name', $this->wsdlclassname.'Port');
foreach ($this->wsdlStruct[$this->wsdlclassname]['method'] as $methodName => $methodVars) {
$operation = $this->wsdl->createElement('operation');
$operation->setAttribute('name', $methodName);
$portType->appendChild($operation);
$documentation = $this->wsdl->createElement('documentation');
$documentation->appendChild(
$this->wsdl->createTextNode($methodVars['description'])
);
$operation->appendChild($documentation);
$input = $this->wsdl->createElement('input');
$output = $this->wsdl->createElement('output');
$input->setAttribute('message', 'typens:' . $methodName);
$output->setAttribute('message', 'typens:' . $methodName . 'Response');
$operation->appendChild($input);
$operation->appendChild($output);
}
$this->wsdl_definitions->appendChild($portType);
} | [
"protected",
"function",
"createWSDL_portType",
"(",
")",
"{",
"/*\n <portType name=\"myServicePort\">\n <operation name=\"hello\">\n <input message=\"typens:hello\"/>\n <output message=\"typens:helloResponse\"/>\n </operation>\n </portTy... | Create the portType node
@return void | [
"Create",
"the",
"portType",
"node"
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php#L1001-L1032 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php | Services_Webservice.createWSDL_service | protected function createWSDL_service()
{
/*
<service name="myService">
<port name="myServicePort" binding="typens:myServiceBinding">
<soap:address location="http://dschini.org/test1.php"/>
</port>
</service>
*/
$service = $this->wsdl->createElement('service');
$service->setAttribute('name', $this->wsdlclassname);
$port = $this->wsdl->createElement('port');
$port->setAttribute('name', $this->wsdlclassname . 'Port');
$port->setAttribute('binding', 'typens:' . $this->wsdlclassname . 'Binding');
$adress = $this->wsdl->createElement('soap:address');
$adress->setAttribute(
'location',
$this->protocol . '://' . $_SERVER['HTTP_HOST'] . $this->getSelfUrl()
);
$port->appendChild($adress);
$service->appendChild($port);
$this->wsdl_definitions->appendChild($service);
} | php | protected function createWSDL_service()
{
/*
<service name="myService">
<port name="myServicePort" binding="typens:myServiceBinding">
<soap:address location="http://dschini.org/test1.php"/>
</port>
</service>
*/
$service = $this->wsdl->createElement('service');
$service->setAttribute('name', $this->wsdlclassname);
$port = $this->wsdl->createElement('port');
$port->setAttribute('name', $this->wsdlclassname . 'Port');
$port->setAttribute('binding', 'typens:' . $this->wsdlclassname . 'Binding');
$adress = $this->wsdl->createElement('soap:address');
$adress->setAttribute(
'location',
$this->protocol . '://' . $_SERVER['HTTP_HOST'] . $this->getSelfUrl()
);
$port->appendChild($adress);
$service->appendChild($port);
$this->wsdl_definitions->appendChild($service);
} | [
"protected",
"function",
"createWSDL_service",
"(",
")",
"{",
"/*\n <service name=\"myService\">\n <port name=\"myServicePort\" binding=\"typens:myServiceBinding\">\n <soap:address location=\"http://dschini.org/test1.php\"/>\n </port>\n </service>\n */",
"$",
... | Create the service node
@return void | [
"Create",
"the",
"service",
"node"
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Library/webservice/webservice.php#L1041-L1063 | train |
ElijahGM/October-jwt | src/Providers/AbstractServiceProvider.php | AbstractServiceProvider.registerTokenParser | protected function registerTokenParser()
{
$this->app->singleton('tymon.jwt.parser', function ($app) {
$parser = new Parser(
$app['request'],
[
new AuthHeaders,
new QueryString,
new InputSource,
new RouteParams,
new Cookies,
]
);
$app->refresh('request', $parser, 'setRequest');
return $parser;
});
} | php | protected function registerTokenParser()
{
$this->app->singleton('tymon.jwt.parser', function ($app) {
$parser = new Parser(
$app['request'],
[
new AuthHeaders,
new QueryString,
new InputSource,
new RouteParams,
new Cookies,
]
);
$app->refresh('request', $parser, 'setRequest');
return $parser;
});
} | [
"protected",
"function",
"registerTokenParser",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'tymon.jwt.parser'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"parser",
"=",
"new",
"Parser",
"(",
"$",
"app",
"[",
"'request'",
"]"... | Register the bindings for the Token Parser.
@return void | [
"Register",
"the",
"bindings",
"for",
"the",
"Token",
"Parser",
"."
] | ab1c0749ae3d6953fe4dab278baf4ea7d874b36f | https://github.com/ElijahGM/October-jwt/blob/ab1c0749ae3d6953fe4dab278baf4ea7d874b36f/src/Providers/AbstractServiceProvider.php#L190-L208 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Gui/Components/Dropdown.php | Dropdown.setSelectedByValue | public function setSelectedByValue($value)
{
$x = 0;
foreach ($this->options as $idx => $data) {
if ($value == $data) {
$this->setSelectedIndex($x);
return;
}
$x++;
}
$this->setSelectedIndex(-1);
} | php | public function setSelectedByValue($value)
{
$x = 0;
foreach ($this->options as $idx => $data) {
if ($value == $data) {
$this->setSelectedIndex($x);
return;
}
$x++;
}
$this->setSelectedIndex(-1);
} | [
"public",
"function",
"setSelectedByValue",
"(",
"$",
"value",
")",
"{",
"$",
"x",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"options",
"as",
"$",
"idx",
"=>",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"value",
"==",
"$",
"data",
")",
"{",
... | Sets selected index by entry return value
@param $value | [
"Sets",
"selected",
"index",
"by",
"entry",
"return",
"value"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Gui/Components/Dropdown.php#L276-L289 | train |
ravage84/SwissPaymentSlipPdf | examples/Resources/ExamplePaymentSlipPdf.php | ExamplePaymentSlipPdf.writePaymentSlipLines | protected function writePaymentSlipLines($elementName, $element)
{
echo sprintf('Write the element "%s"<br>', $elementName);
parent::writePaymentSlipLines($elementName, $element);
echo '<br>';
return $this;
} | php | protected function writePaymentSlipLines($elementName, $element)
{
echo sprintf('Write the element "%s"<br>', $elementName);
parent::writePaymentSlipLines($elementName, $element);
echo '<br>';
return $this;
} | [
"protected",
"function",
"writePaymentSlipLines",
"(",
"$",
"elementName",
",",
"$",
"element",
")",
"{",
"echo",
"sprintf",
"(",
"'Write the element \"%s\"<br>'",
",",
"$",
"elementName",
")",
";",
"parent",
"::",
"writePaymentSlipLines",
"(",
"$",
"elementName",
... | Normally it is not necessary to overwrite this method
{@inheritDoc} | [
"Normally",
"it",
"is",
"not",
"necessary",
"to",
"overwrite",
"this",
"method"
] | 5806366158648f1d9b0af614d24ff08d65cc43b6 | https://github.com/ravage84/SwissPaymentSlipPdf/blob/5806366158648f1d9b0af614d24ff08d65cc43b6/examples/Resources/ExamplePaymentSlipPdf.php#L59-L66 | train |
mgallegos/decima-accounting | src/Mgallegos/DecimaAccounting/Accounting/Services/CostCenterManagement/CostCenterManager.php | CostCenterManager.getCostCenterChildrenIds | public function getCostCenterChildrenIds($id)
{
$ids = array();
$this->CostCenter->byParent($id)->each(function($CostCenter) use (&$ids)
{
if($CostCenter->is_group)
{
$ids = array_merge($ids, $this->getCostCenterChildrenIds($CostCenter->id));
}
array_push($ids, $CostCenter->id);
});
return $ids;
} | php | public function getCostCenterChildrenIds($id)
{
$ids = array();
$this->CostCenter->byParent($id)->each(function($CostCenter) use (&$ids)
{
if($CostCenter->is_group)
{
$ids = array_merge($ids, $this->getCostCenterChildrenIds($CostCenter->id));
}
array_push($ids, $CostCenter->id);
});
return $ids;
} | [
"public",
"function",
"getCostCenterChildrenIds",
"(",
"$",
"id",
")",
"{",
"$",
"ids",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"CostCenter",
"->",
"byParent",
"(",
"$",
"id",
")",
"->",
"each",
"(",
"function",
"(",
"$",
"CostCenter",
")",
"... | Get cost center children
@param int $id
@return array
An array of arrays as follows: array( $id0, $id1,…) | [
"Get",
"cost",
"center",
"children"
] | 6410585303a13892e64e9dfeacbae0ca212b458b | https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Services/CostCenterManagement/CostCenterManager.php#L416-L431 | train |
mgallegos/decima-accounting | src/Mgallegos/DecimaAccounting/Accounting/Services/CostCenterManagement/CostCenterManager.php | CostCenterManager.getCostCenterChildren | public function getCostCenterChildren($input)
{
$CostCenter = $this->CostCenter->byId($input['id']);
$costCenterTree = array('text' => $CostCenter->key . ' ' . $CostCenter->name, 'state' => array('opened' => true), 'icon' => 'fa fa-sitemap', 'children' => array());
$this->CostCenter->byParent($input['id'])->each(function($CostCenter) use (&$costCenterTree)
{
if($CostCenter->is_group)
{
array_push($costCenterTree['children'], array('text' => $CostCenter->key . ' ' . $CostCenter->name, 'icon' => 'fa fa-sitemap'));
}
else
{
array_push($costCenterTree['children'], array('text' => $CostCenter->key . ' ' . $CostCenter->name, 'icon' => 'fa fa-leaf'));
}
});
return json_encode(array($costCenterTree));
} | php | public function getCostCenterChildren($input)
{
$CostCenter = $this->CostCenter->byId($input['id']);
$costCenterTree = array('text' => $CostCenter->key . ' ' . $CostCenter->name, 'state' => array('opened' => true), 'icon' => 'fa fa-sitemap', 'children' => array());
$this->CostCenter->byParent($input['id'])->each(function($CostCenter) use (&$costCenterTree)
{
if($CostCenter->is_group)
{
array_push($costCenterTree['children'], array('text' => $CostCenter->key . ' ' . $CostCenter->name, 'icon' => 'fa fa-sitemap'));
}
else
{
array_push($costCenterTree['children'], array('text' => $CostCenter->key . ' ' . $CostCenter->name, 'icon' => 'fa fa-leaf'));
}
});
return json_encode(array($costCenterTree));
} | [
"public",
"function",
"getCostCenterChildren",
"(",
"$",
"input",
")",
"{",
"$",
"CostCenter",
"=",
"$",
"this",
"->",
"CostCenter",
"->",
"byId",
"(",
"$",
"input",
"[",
"'id'",
"]",
")",
";",
"$",
"costCenterTree",
"=",
"array",
"(",
"'text'",
"=>",
... | Get cost centers children
@param array $input
An array as follows: array(id => $id);
@return JSON encoded string
A string as follows: [{"text" : $costCenterKey . " " . $costCenterName, "state" : {"opened" : true }, "icon" : $icon, "children" : [{"text" : $childCostCenterKey0 . " " . $childCostCenterName0, "icon" : $childIcon0}, …]}] | [
"Get",
"cost",
"centers",
"children"
] | 6410585303a13892e64e9dfeacbae0ca212b458b | https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/Accounting/Services/CostCenterManagement/CostCenterManager.php#L454-L473 | train |
anklimsk/cakephp-theme | Model/Filter.php | Filter._getModelInfoFromField | protected function _getModelInfoFromField($field = null, $plugin = null) {
$result = false;
if (empty($field) || !is_string($field)) {
return $result;
}
if (strpos($field, '.') === false) {
return $result;
}
list($modelName, $fieldName) = pluginSplit($field);
if (!empty($plugin)) {
$modelName = $plugin . '.' . $modelName;
}
$modelObj = ClassRegistry::init($modelName, true);
if ($modelObj === false) {
return false;
}
$fieldFullName = $modelObj->alias . '.' . $fieldName;
$result = compact('modelName', 'fieldName', 'fieldFullName');
return $result;
} | php | protected function _getModelInfoFromField($field = null, $plugin = null) {
$result = false;
if (empty($field) || !is_string($field)) {
return $result;
}
if (strpos($field, '.') === false) {
return $result;
}
list($modelName, $fieldName) = pluginSplit($field);
if (!empty($plugin)) {
$modelName = $plugin . '.' . $modelName;
}
$modelObj = ClassRegistry::init($modelName, true);
if ($modelObj === false) {
return false;
}
$fieldFullName = $modelObj->alias . '.' . $fieldName;
$result = compact('modelName', 'fieldName', 'fieldFullName');
return $result;
} | [
"protected",
"function",
"_getModelInfoFromField",
"(",
"$",
"field",
"=",
"null",
",",
"$",
"plugin",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"empty",
"(",
"$",
"field",
")",
"||",
"!",
"is_string",
"(",
"$",
"field",
")"... | Return information of model from field name
@param string $field Field name
@param string $plugin Name of plugin for target model of filter.
@return array|bool Array information of model in format:
- key `modelName`, value - name of model;
- key `fieldName`, value - name of field;
- key `fieldFullName`, value - name of field include name of model.
Return False on failure. | [
"Return",
"information",
"of",
"model",
"from",
"field",
"name"
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Model/Filter.php#L109-L132 | train |
anklimsk/cakephp-theme | Model/Filter.php | Filter._parseConditionSign | protected function _parseConditionSign($conditionSign = null) {
$result = '';
if (empty($conditionSign)) {
return $result;
}
$conditionSign = (string)mb_convert_case($conditionSign, MB_CASE_LOWER);
switch ($conditionSign) {
case 'gt':
$result = '>';
break;
case 'ge':
$result = '>=';
break;
case 'lt':
$result = '<';
break;
case 'le':
$result = '<=';
break;
case 'ne':
$result = '<>';
break;
case 'eq':
default:
$result = '';
}
return $result;
} | php | protected function _parseConditionSign($conditionSign = null) {
$result = '';
if (empty($conditionSign)) {
return $result;
}
$conditionSign = (string)mb_convert_case($conditionSign, MB_CASE_LOWER);
switch ($conditionSign) {
case 'gt':
$result = '>';
break;
case 'ge':
$result = '>=';
break;
case 'lt':
$result = '<';
break;
case 'le':
$result = '<=';
break;
case 'ne':
$result = '<>';
break;
case 'eq':
default:
$result = '';
}
return $result;
} | [
"protected",
"function",
"_parseConditionSign",
"(",
"$",
"conditionSign",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"''",
";",
"if",
"(",
"empty",
"(",
"$",
"conditionSign",
")",
")",
"{",
"return",
"$",
"result",
";",
"}",
"$",
"conditionSign",
"=",
... | Return condition sign in SQL format from 2 char format.
@param string $conditionSign Condition sign in 2 char format.
@return string Condition sign in SQL format. | [
"Return",
"condition",
"sign",
"in",
"SQL",
"format",
"from",
"2",
"char",
"format",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Model/Filter.php#L140-L169 | train |
anklimsk/cakephp-theme | Model/Filter.php | Filter._parseConditionGroup | protected function _parseConditionGroup($condition = null) {
$result = 'AND';
if (empty($condition)) {
return $result;
}
$condition = (string)mb_convert_case($condition, MB_CASE_UPPER);
if (in_array($condition, ['AND', 'OR', 'NOT'])) {
$result = $condition;
}
return $result;
} | php | protected function _parseConditionGroup($condition = null) {
$result = 'AND';
if (empty($condition)) {
return $result;
}
$condition = (string)mb_convert_case($condition, MB_CASE_UPPER);
if (in_array($condition, ['AND', 'OR', 'NOT'])) {
$result = $condition;
}
return $result;
} | [
"protected",
"function",
"_parseConditionGroup",
"(",
"$",
"condition",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"'AND'",
";",
"if",
"(",
"empty",
"(",
"$",
"condition",
")",
")",
"{",
"return",
"$",
"result",
";",
"}",
"$",
"condition",
"=",
"(",
... | Return string of logical group condition.
@param string $condition Group condition, can be one of:
`AND`, `OR`, `NOT`.
@return string Group condition from input string,
or string `AND` on failure. | [
"Return",
"string",
"of",
"logical",
"group",
"condition",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Model/Filter.php#L179-L191 | train |
anklimsk/cakephp-theme | Model/Filter.php | Filter.buildConditions | public function buildConditions($filterData = null, $filterConditions = null, $plugin = null, $limit = CAKE_THEME_FILTER_ROW_LIMIT) {
$result = [];
if (empty($filterData) || !is_array($filterData)) {
return $result;
}
if (!is_array($filterConditions)) {
$filterConditions = [];
}
$conditionsGroup = null;
if (isset($filterConditions['group'])) {
$conditionsGroup = $filterConditions['group'];
}
$conditionSignGroup = $this->_parseConditionGroup($conditionsGroup);
$conditionsCache = [];
$filterRowCount = 0;
$limit = (int)$limit;
if ($limit <= 0) {
$limit = CAKE_THEME_FILTER_ROW_LIMIT;
}
foreach ($filterData as $index => $modelInfo) {
if (!is_int($index) || !is_array($modelInfo)) {
continue;
}
$filterRowCount++;
if ($filterRowCount > $limit) {
break;
}
foreach ($modelInfo as $filterModel => $filterField) {
if (!is_array($filterField)) {
continue;
}
foreach ($filterField as $filterFieldName => $filterFieldValue) {
if ($filterFieldValue === '') {
continue;
}
$condSign = null;
if (isset($filterConditions[$index][$filterModel][$filterFieldName])) {
$condSign = $filterConditions[$index][$filterModel][$filterFieldName];
}
$condition = $this->getCondition($filterModel . '.' . $filterFieldName, $filterFieldValue, $condSign, $plugin);
if ($condition === false) {
continue;
}
$cacheKey = md5(serialize($condition));
if (in_array($cacheKey, $conditionsCache)) {
continue;
}
$result[$conditionSignGroup][] = $condition;
$conditionsCache[] = $cacheKey;
}
}
}
if (isset($result[$conditionSignGroup]) && (count($result[$conditionSignGroup]) == 1)) {
$result = array_shift($result[$conditionSignGroup]);
}
return $result;
} | php | public function buildConditions($filterData = null, $filterConditions = null, $plugin = null, $limit = CAKE_THEME_FILTER_ROW_LIMIT) {
$result = [];
if (empty($filterData) || !is_array($filterData)) {
return $result;
}
if (!is_array($filterConditions)) {
$filterConditions = [];
}
$conditionsGroup = null;
if (isset($filterConditions['group'])) {
$conditionsGroup = $filterConditions['group'];
}
$conditionSignGroup = $this->_parseConditionGroup($conditionsGroup);
$conditionsCache = [];
$filterRowCount = 0;
$limit = (int)$limit;
if ($limit <= 0) {
$limit = CAKE_THEME_FILTER_ROW_LIMIT;
}
foreach ($filterData as $index => $modelInfo) {
if (!is_int($index) || !is_array($modelInfo)) {
continue;
}
$filterRowCount++;
if ($filterRowCount > $limit) {
break;
}
foreach ($modelInfo as $filterModel => $filterField) {
if (!is_array($filterField)) {
continue;
}
foreach ($filterField as $filterFieldName => $filterFieldValue) {
if ($filterFieldValue === '') {
continue;
}
$condSign = null;
if (isset($filterConditions[$index][$filterModel][$filterFieldName])) {
$condSign = $filterConditions[$index][$filterModel][$filterFieldName];
}
$condition = $this->getCondition($filterModel . '.' . $filterFieldName, $filterFieldValue, $condSign, $plugin);
if ($condition === false) {
continue;
}
$cacheKey = md5(serialize($condition));
if (in_array($cacheKey, $conditionsCache)) {
continue;
}
$result[$conditionSignGroup][] = $condition;
$conditionsCache[] = $cacheKey;
}
}
}
if (isset($result[$conditionSignGroup]) && (count($result[$conditionSignGroup]) == 1)) {
$result = array_shift($result[$conditionSignGroup]);
}
return $result;
} | [
"public",
"function",
"buildConditions",
"(",
"$",
"filterData",
"=",
"null",
",",
"$",
"filterConditions",
"=",
"null",
",",
"$",
"plugin",
"=",
"null",
",",
"$",
"limit",
"=",
"CAKE_THEME_FILTER_ROW_LIMIT",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
... | Return condition for filter data and filter condition.
@param array $filterData Data of filter for build conditions.
@param array $filterConditions Conditions of filter for build conditions.
@param string $plugin Name of plugin for target model of filter.
@param int $limit Limit of filter row for build conditions.
@return array Return array of condition. | [
"Return",
"condition",
"for",
"filter",
"data",
"and",
"filter",
"condition",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Model/Filter.php#L202-L268 | train |
Malwarebytes/Altamira | src/Altamira/Type/JqPlot/Bar.php | Bar.getOptions | public function getOptions()
{
$opts = array();
$first = array();
$second = array();
if ( $this->axisRenderer ) {
$first['renderer'] = '#' . $this->axisRenderer . '#';
}
if( isset( $this->options['ticks'] ) ) {
$first['ticks'] = $this->options['ticks'];
}
$second['min'] = isset( $this->options['min'] ) ? $this->options['min'] : 0;
if( isset( $this->options['horizontal'] ) && $this->options['horizontal'] ) {
$opts['xaxis'] = $second;
$opts['yaxis'] = $first;
} else {
$opts['xaxis'] = $first;
$opts['yaxis'] = $second;
}
$opts = array( 'axes' => $opts );
if( isset( $this->options['stackSeries'] ) ) {
$opts['stackSeries'] = $this->options['stackSeries'];
}
if( isset( $this->options['seriesColors'] ) ) {
$opts['seriesColors'] = $this->options['seriesColors'];
}
return $opts;
} | php | public function getOptions()
{
$opts = array();
$first = array();
$second = array();
if ( $this->axisRenderer ) {
$first['renderer'] = '#' . $this->axisRenderer . '#';
}
if( isset( $this->options['ticks'] ) ) {
$first['ticks'] = $this->options['ticks'];
}
$second['min'] = isset( $this->options['min'] ) ? $this->options['min'] : 0;
if( isset( $this->options['horizontal'] ) && $this->options['horizontal'] ) {
$opts['xaxis'] = $second;
$opts['yaxis'] = $first;
} else {
$opts['xaxis'] = $first;
$opts['yaxis'] = $second;
}
$opts = array( 'axes' => $opts );
if( isset( $this->options['stackSeries'] ) ) {
$opts['stackSeries'] = $this->options['stackSeries'];
}
if( isset( $this->options['seriesColors'] ) ) {
$opts['seriesColors'] = $this->options['seriesColors'];
}
return $opts;
} | [
"public",
"function",
"getOptions",
"(",
")",
"{",
"$",
"opts",
"=",
"array",
"(",
")",
";",
"$",
"first",
"=",
"array",
"(",
")",
";",
"$",
"second",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"axisRenderer",
")",
"{",
"$",
"fi... | This provides a limited set of options based on how it has been configured
@TODO this really looks like it should be refactored, but it's pretty opaque and legacy at this point
@see \Altamira\Type\TypeAbstract::getOptions()
@return array | [
"This",
"provides",
"a",
"limited",
"set",
"of",
"options",
"based",
"on",
"how",
"it",
"has",
"been",
"configured"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/Type/JqPlot/Bar.php#L29-L65 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/AdminGroups/Services/AdminGroupConfiguration.php | AdminGroupConfiguration.getGroupPermissions | public function getGroupPermissions($groupName)
{
if (!isset($this->config[$groupName])) {
return [];
}
return array_keys($this->config[$groupName]['permissions']);
} | php | public function getGroupPermissions($groupName)
{
if (!isset($this->config[$groupName])) {
return [];
}
return array_keys($this->config[$groupName]['permissions']);
} | [
"public",
"function",
"getGroupPermissions",
"(",
"$",
"groupName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"$",
"groupName",
"]",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"return",
"array_keys",
"(",
"$",
"this"... | Get list of all permissions given to a group.
@param string $groupName
@return string[] | [
"Get",
"list",
"of",
"all",
"permissions",
"given",
"to",
"a",
"group",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/AdminGroups/Services/AdminGroupConfiguration.php#L71-L78 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/AdminGroups/Services/AdminGroupConfiguration.php | AdminGroupConfiguration.getGroupLabel | public function getGroupLabel($groupName)
{
if (!isset($this->config[$groupName])) {
return "";
}
return $this->config[$groupName]['label']->get();
} | php | public function getGroupLabel($groupName)
{
if (!isset($this->config[$groupName])) {
return "";
}
return $this->config[$groupName]['label']->get();
} | [
"public",
"function",
"getGroupLabel",
"(",
"$",
"groupName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"$",
"groupName",
"]",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"return",
"$",
"this",
"->",
"config",
"[",
"$... | Get admin group label
@param string $groupName
@return string | [
"Get",
"admin",
"group",
"label"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/AdminGroups/Services/AdminGroupConfiguration.php#L86-L93 | train |
paulbunyannet/wordpress-artisan | src/Commands/Wordpress/Maintenance/Generate.php | Generate.makeMaintenanceFile | public function makeMaintenanceFile()
{ $filePath = $this->downClass->getFilePath();
$template = __DIR__ .'/.maintenance';
return exec('cat '.$template.' > '.$filePath);
} | php | public function makeMaintenanceFile()
{ $filePath = $this->downClass->getFilePath();
$template = __DIR__ .'/.maintenance';
return exec('cat '.$template.' > '.$filePath);
} | [
"public",
"function",
"makeMaintenanceFile",
"(",
")",
"{",
"$",
"filePath",
"=",
"$",
"this",
"->",
"downClass",
"->",
"getFilePath",
"(",
")",
";",
"$",
"template",
"=",
"__DIR__",
".",
"'/.maintenance'",
";",
"return",
"exec",
"(",
"'cat '",
".",
"$",
... | Create maintenance mode file
@return mixed | [
"Create",
"maintenance",
"mode",
"file"
] | 05518f8aa5d0f31090d0c2a891e4f4d0239a65bc | https://github.com/paulbunyannet/wordpress-artisan/blob/05518f8aa5d0f31090d0c2a891e4f4d0239a65bc/src/Commands/Wordpress/Maintenance/Generate.php#L58-L62 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/PlayersBundle/Plugins/Player.php | Player.updateWithScores | public function updateWithScores($scores)
{
// Update the winner player.
if (isset($scores['winnerplayer'])) {
$player = $this->getPlayer($scores['winnerplayer']);
if ($player) {
$this->playerQueryBuilder->save($player);
}
}
// Update remaining players.
foreach ($this->loggedInPlayers as $player) {
$this->updatePlayer($player);
}
$this->playerQueryBuilder->saveAll($this->loggedInPlayers);
} | php | public function updateWithScores($scores)
{
// Update the winner player.
if (isset($scores['winnerplayer'])) {
$player = $this->getPlayer($scores['winnerplayer']);
if ($player) {
$this->playerQueryBuilder->save($player);
}
}
// Update remaining players.
foreach ($this->loggedInPlayers as $player) {
$this->updatePlayer($player);
}
$this->playerQueryBuilder->saveAll($this->loggedInPlayers);
} | [
"public",
"function",
"updateWithScores",
"(",
"$",
"scores",
")",
"{",
"// Update the winner player.",
"if",
"(",
"isset",
"(",
"$",
"scores",
"[",
"'winnerplayer'",
"]",
")",
")",
"{",
"$",
"player",
"=",
"$",
"this",
"->",
"getPlayer",
"(",
"$",
"scores... | Update when scores is available.
@param $scores | [
"Update",
"when",
"scores",
"is",
"available",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/PlayersBundle/Plugins/Player.php#L123-L138 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.