repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
ondrakoupil/tools | src/Arrays.php | Arrays.filterByKeys | static function filterByKeys($array, $requiredKeys) {
if (is_array($array)) {
return array_intersect_key($array, array_fill_keys($requiredKeys, true));
}
if ($array instanceof \ArrayAccess) {
$ret = array();
foreach ($requiredKeys as $k) {
if (isset($array[$k])) {
$ret[$k] = $array[$k];
}
... | php | static function filterByKeys($array, $requiredKeys) {
if (is_array($array)) {
return array_intersect_key($array, array_fill_keys($requiredKeys, true));
}
if ($array instanceof \ArrayAccess) {
$ret = array();
foreach ($requiredKeys as $k) {
if (isset($array[$k])) {
$ret[$k] = $array[$k];
}
... | [
"static",
"function",
"filterByKeys",
"(",
"$",
"array",
",",
"$",
"requiredKeys",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"array",
")",
")",
"{",
"return",
"array_intersect_key",
"(",
"$",
"array",
",",
"array_fill_keys",
"(",
"$",
"requiredKeys",
",",... | Ze zadaného pole vybere jen ty položky, které mají klíč udaný v druhém poli.
@param array|\ArrayAccess $array Asociativní pole
@param array $requiredKeys Obyčejné pole klíčů
@return array | [
"Ze",
"zadaného",
"pole",
"vybere",
"jen",
"ty",
"položky",
"které",
"mají",
"klíč",
"udaný",
"v",
"druhém",
"poli",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L159-L174 |
ondrakoupil/tools | src/Arrays.php | Arrays.group | static public function group($data,$groupBy,$orderByKey=false) {
$vrat=array();
foreach($data as $index=>$radek) {
if (!isset($radek[$groupBy])) {
$radek[$groupBy]="0";
}
if (!isset($vrat[$radek[$groupBy]])) {
$vrat[$radek[$groupBy]]=array();
}
$vrat[$radek[$groupBy]][$index]=$radek;
}
if... | php | static public function group($data,$groupBy,$orderByKey=false) {
$vrat=array();
foreach($data as $index=>$radek) {
if (!isset($radek[$groupBy])) {
$radek[$groupBy]="0";
}
if (!isset($vrat[$radek[$groupBy]])) {
$vrat[$radek[$groupBy]]=array();
}
$vrat[$radek[$groupBy]][$index]=$radek;
}
if... | [
"static",
"public",
"function",
"group",
"(",
"$",
"data",
",",
"$",
"groupBy",
",",
"$",
"orderByKey",
"=",
"false",
")",
"{",
"$",
"vrat",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"index",
"=>",
"$",
"radek",
")",
"{... | Z klasického dvojrozměrného pole udělá trojrozměrné pole, kde první index bude sdružovat řádku dle nějaké z hodnot.
@param array $data
@param string $groupBy Název políčka v $data, podle něhož se má sdružovat
@param bool|string $orderByKey False (def.) = nechat, jak to přišlo pod ruku. True = seřadit dle sdružované hod... | [
"Z",
"klasického",
"dvojrozměrného",
"pole",
"udělá",
"trojrozměrné",
"pole",
"kde",
"první",
"index",
"bude",
"sdružovat",
"řádku",
"dle",
"nějaké",
"z",
"hodnot",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L183-L201 |
ondrakoupil/tools | src/Arrays.php | Arrays.indexByKey | static public function indexByKey($input, $keyName) {
if (!is_array($input) and !($input instanceof \Traversable)) {
throw new \InvalidArgumentException("Given argument must be an array or traversable object.");
}
$returnedArray = array();
foreach($input as $index => $f) {
if (is_array($f)) {
$key =... | php | static public function indexByKey($input, $keyName) {
if (!is_array($input) and !($input instanceof \Traversable)) {
throw new \InvalidArgumentException("Given argument must be an array or traversable object.");
}
$returnedArray = array();
foreach($input as $index => $f) {
if (is_array($f)) {
$key =... | [
"static",
"public",
"function",
"indexByKey",
"(",
"$",
"input",
",",
"$",
"keyName",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"input",
")",
"and",
"!",
"(",
"$",
"input",
"instanceof",
"\\",
"Traversable",
")",
")",
"{",
"throw",
"new",
"\\",... | Zadané dvourozměrné pole nebo traversable objekt přeindexuje tak, že jeho jednotlivé indexy
budou tvořeny určitým prvkem nebo public vlastností z každého prvku.
Pokud některý z prvků vstupního pole neobsahuje $keyName, zachová se jeho původní index.
@param array|\Traversable $input Vstupní pole/objekt
@param string $... | [
"Zadané",
"dvourozměrné",
"pole",
"nebo",
"traversable",
"objekt",
"přeindexuje",
"tak",
"že",
"jeho",
"jednotlivé",
"indexy",
"budou",
"tvořeny",
"určitým",
"prvkem",
"nebo",
"public",
"vlastností",
"z",
"každého",
"prvku",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L213-L235 |
ondrakoupil/tools | src/Arrays.php | Arrays.deleteValue | static public function deleteValue($dataArray, $valueToDelete, $keysInsignificant = true, $strict = false) {
if ($valueToDelete === null) throw new \InvalidArgumentException("\$valueToDelete cannot be null.");
$keys = array_keys($dataArray, $valueToDelete, $strict);
if ($keys) {
foreach($keys as $k) {
unse... | php | static public function deleteValue($dataArray, $valueToDelete, $keysInsignificant = true, $strict = false) {
if ($valueToDelete === null) throw new \InvalidArgumentException("\$valueToDelete cannot be null.");
$keys = array_keys($dataArray, $valueToDelete, $strict);
if ($keys) {
foreach($keys as $k) {
unse... | [
"static",
"public",
"function",
"deleteValue",
"(",
"$",
"dataArray",
",",
"$",
"valueToDelete",
",",
"$",
"keysInsignificant",
"=",
"true",
",",
"$",
"strict",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"valueToDelete",
"===",
"null",
")",
"throw",
"new",
... | Zruší z pole všechny výskyty určité hodnoty.
@param array $dataArray
@param mixed $valueToDelete Nesmí být null!
@param bool $keysInsignificant True = přečíslovat vrácené pole, indexy nejsou podstatné. False = nechat původní indexy.
@param bool $strict == nebo ===
@return array Upravené $dataArray | [
"Zruší",
"z",
"pole",
"všechny",
"výskyty",
"určité",
"hodnoty",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L245-L257 |
ondrakoupil/tools | src/Arrays.php | Arrays.deleteValues | static public function deleteValues($dataArray, $arrayOfValuesToDelete, $keysInsignificant = true) {
$arrayOfValuesToDelete = self::arrayize($arrayOfValuesToDelete);
$invertedDeletes = array_fill_keys($arrayOfValuesToDelete, true);
foreach ($dataArray as $i=>$r) {
if (isset($invertedDeletes[$r])) {
unset($... | php | static public function deleteValues($dataArray, $arrayOfValuesToDelete, $keysInsignificant = true) {
$arrayOfValuesToDelete = self::arrayize($arrayOfValuesToDelete);
$invertedDeletes = array_fill_keys($arrayOfValuesToDelete, true);
foreach ($dataArray as $i=>$r) {
if (isset($invertedDeletes[$r])) {
unset($... | [
"static",
"public",
"function",
"deleteValues",
"(",
"$",
"dataArray",
",",
"$",
"arrayOfValuesToDelete",
",",
"$",
"keysInsignificant",
"=",
"true",
")",
"{",
"$",
"arrayOfValuesToDelete",
"=",
"self",
"::",
"arrayize",
"(",
"$",
"arrayOfValuesToDelete",
")",
"... | Zruší z jednoho pole všechny hodnoty, které se vyskytují ve druhém poli.
Ve druhém poli musí jít o skalární typy, objekty nebo array povedou k chybě.
@param array $dataArray
@param array $arrayOfValuesToDelete
@param bool $keysInsignificant True = přečíslovat vrácené pole, indexy nejsou podstatné. False = nechat původn... | [
"Zruší",
"z",
"jednoho",
"pole",
"všechny",
"hodnoty",
"které",
"se",
"vyskytují",
"ve",
"druhém",
"poli",
".",
"Ve",
"druhém",
"poli",
"musí",
"jít",
"o",
"skalární",
"typy",
"objekty",
"nebo",
"array",
"povedou",
"k",
"chybě",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L267-L280 |
ondrakoupil/tools | src/Arrays.php | Arrays.enrich | static public function enrich($mainArray, $mixinArray, $fields=true, $changeIndexes = array()) {
if ($fields!==true) $fields=self::arrayize($fields);
foreach($mixinArray as $mixinId=>$mixinData) {
if (!isset($mainArray[$mixinId])) continue;
if ($changeIndexes) {
foreach($changeIndexes as $fromI=>$toI) {
... | php | static public function enrich($mainArray, $mixinArray, $fields=true, $changeIndexes = array()) {
if ($fields!==true) $fields=self::arrayize($fields);
foreach($mixinArray as $mixinId=>$mixinData) {
if (!isset($mainArray[$mixinId])) continue;
if ($changeIndexes) {
foreach($changeIndexes as $fromI=>$toI) {
... | [
"static",
"public",
"function",
"enrich",
"(",
"$",
"mainArray",
",",
"$",
"mixinArray",
",",
"$",
"fields",
"=",
"true",
",",
"$",
"changeIndexes",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"fields",
"!==",
"true",
")",
"$",
"fields",
"=",
... | Obohatí $mainArray o nějaké prvky z $mixinArray. Obě pole by měla být dvourozměrná pole, kde
první rozměr je ID a další rozměr je asociativní pole s nějakými vlastnostmi.
<br />Data z $mainArray se považují za prioritnější a správnější, a pokud již příslušný prvek obsahují,
nepřepíší se tím z $mixinArray.
@param array ... | [
"Obohatí",
"$mainArray",
"o",
"nějaké",
"prvky",
"z",
"$mixinArray",
".",
"Obě",
"pole",
"by",
"měla",
"být",
"dvourozměrná",
"pole",
"kde",
"první",
"rozměr",
"je",
"ID",
"a",
"další",
"rozměr",
"je",
"asociativní",
"pole",
"s",
"nějakými",
"vlastnostmi",
"... | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L295-L324 |
ondrakoupil/tools | src/Arrays.php | Arrays.toObject | static function toObject($array) {
if (!is_array($array) and !($array instanceof \Traversable)) {
throw new \InvalidArgumentException("You must give me an array!");
}
$obj = new \stdClass();
foreach ($array as $i=>$r) {
$obj->$i = $r;
}
return $obj;
} | php | static function toObject($array) {
if (!is_array($array) and !($array instanceof \Traversable)) {
throw new \InvalidArgumentException("You must give me an array!");
}
$obj = new \stdClass();
foreach ($array as $i=>$r) {
$obj->$i = $r;
}
return $obj;
} | [
"static",
"function",
"toObject",
"(",
"$",
"array",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"array",
")",
"and",
"!",
"(",
"$",
"array",
"instanceof",
"\\",
"Traversable",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"... | Konverze asociativního pole na objekt třídy stdClass
@param array|Traversable $array
@return \stdClass | [
"Konverze",
"asociativního",
"pole",
"na",
"objekt",
"třídy",
"stdClass"
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L331-L340 |
ondrakoupil/tools | src/Arrays.php | Arrays.flatten | static public function flatten($array) {
$out=array();
foreach($array as $i=>$subArray) {
foreach($subArray as $value) {
$out[$value]=true;
}
}
return array_keys($out);
} | php | static public function flatten($array) {
$out=array();
foreach($array as $i=>$subArray) {
foreach($subArray as $value) {
$out[$value]=true;
}
}
return array_keys($out);
} | [
"static",
"public",
"function",
"flatten",
"(",
"$",
"array",
")",
"{",
"$",
"out",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"i",
"=>",
"$",
"subArray",
")",
"{",
"foreach",
"(",
"$",
"subArray",
"as",
"$",
"value",
"... | Z dvourozměrného pole, které bylo sgrupované podle nějaké hodnoty, udělá zpět jednorozměrné, s výčtem jednotlivých hodnot.
Funguje pouze za předpokladu, že jednotlivé hodnoty jsou obyčejné skalární typy. Objekty nebo array třetího rozměru povede k chybě.
@param array $array
@return array | [
"Z",
"dvourozměrného",
"pole",
"které",
"bylo",
"sgrupované",
"podle",
"nějaké",
"hodnoty",
"udělá",
"zpět",
"jednorozměrné",
"s",
"výčtem",
"jednotlivých",
"hodnot",
".",
"Funguje",
"pouze",
"za",
"předpokladu",
"že",
"jednotlivé",
"hodnoty",
"jsou",
"obyčejné",
... | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L348-L356 |
ondrakoupil/tools | src/Arrays.php | Arrays.normaliseValues | static public function normaliseValues($array) {
$array=self::arrayize($array);
if (!$array) return $array;
$minValue=min($array);
$maxValue=max($array);
if ($maxValue==$minValue) {
$minValue-=1;
}
foreach($array as $index=>$value) {
$array[$index]=($value-$minValue)/($maxValue-$minValue);
}
ret... | php | static public function normaliseValues($array) {
$array=self::arrayize($array);
if (!$array) return $array;
$minValue=min($array);
$maxValue=max($array);
if ($maxValue==$minValue) {
$minValue-=1;
}
foreach($array as $index=>$value) {
$array[$index]=($value-$minValue)/($maxValue-$minValue);
}
ret... | [
"static",
"public",
"function",
"normaliseValues",
"(",
"$",
"array",
")",
"{",
"$",
"array",
"=",
"self",
"::",
"arrayize",
"(",
"$",
"array",
")",
";",
"if",
"(",
"!",
"$",
"array",
")",
"return",
"$",
"array",
";",
"$",
"minValue",
"=",
"min",
"... | Normalizuje hodnoty v poli do rozsahu <0-1>
@param array $array
@return array | [
"Normalizuje",
"hodnoty",
"v",
"poli",
"do",
"rozsahu",
"<",
";",
"0",
"-",
"1>",
";"
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L364-L376 |
ondrakoupil/tools | src/Arrays.php | Arrays.traversableToArray | static function traversableToArray($traversable, $depth = 0) {
$vrat = array();
if ($depth > 10) throw new \RuntimeException("Recursion is too deep.");
if (!is_array($traversable) and !($traversable instanceof \Traversable)) {
throw new \InvalidArgumentException("\$traversable must be an array or Traversable o... | php | static function traversableToArray($traversable, $depth = 0) {
$vrat = array();
if ($depth > 10) throw new \RuntimeException("Recursion is too deep.");
if (!is_array($traversable) and !($traversable instanceof \Traversable)) {
throw new \InvalidArgumentException("\$traversable must be an array or Traversable o... | [
"static",
"function",
"traversableToArray",
"(",
"$",
"traversable",
",",
"$",
"depth",
"=",
"0",
")",
"{",
"$",
"vrat",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"depth",
">",
"10",
")",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"Recursion i... | Rekurzivně převede traversable objekt na obyčejné array.
@param \Traversable $traversable
@param int $depth Interní, pro kontorlu nekonečné rekurze
@return array
@throws \RuntimeException | [
"Rekurzivně",
"převede",
"traversable",
"objekt",
"na",
"obyčejné",
"array",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L385-L399 |
ondrakoupil/tools | src/Arrays.php | Arrays.enumItem | static function enumItem ($data,$index,$pattern=false,$default=0,$reverse=false) {
if ($index!==false) {
if (!isset($data[$index])) {
$index=$default;
if (!isset($data[$index])) return $default;
}
if ($pattern===false) return $data[$index];
return self::enumItemPattern($pattern,$index,$data[$index... | php | static function enumItem ($data,$index,$pattern=false,$default=0,$reverse=false) {
if ($index!==false) {
if (!isset($data[$index])) {
$index=$default;
if (!isset($data[$index])) return $default;
}
if ($pattern===false) return $data[$index];
return self::enumItemPattern($pattern,$index,$data[$index... | [
"static",
"function",
"enumItem",
"(",
"$",
"data",
",",
"$",
"index",
",",
"$",
"pattern",
"=",
"false",
",",
"$",
"default",
"=",
"0",
",",
"$",
"reverse",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"index",
"!==",
"false",
")",
"{",
"if",
"(",
... | Pomocná funkce zjednodušující práci s různými číselníky definovanými jako array v PHP. Umožňuje buď "lidsky" zformátovat jeden vybraný prvek z číselníku, nebo vrátit celé array hodnot.
@param array $data Celé array se všemi položkami ve tvaru [index]=>$value
@param string|int|bool $index False = vrať array se všemi. Ji... | [
"Pomocná",
"funkce",
"zjednodušující",
"práci",
"s",
"různými",
"číselníky",
"definovanými",
"jako",
"array",
"v",
"PHP",
".",
"Umožňuje",
"buď",
"lidsky",
"zformátovat",
"jeden",
"vybraný",
"prvek",
"z",
"číselníku",
"nebo",
"vrátit",
"celé",
"array",
"hodnot",
... | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L411-L434 |
ondrakoupil/tools | src/Arrays.php | Arrays.compareValues | static function compareValues($array1, $array2, $strict = false) {
if (count($array1) != count($array2)) return false;
$array1 = array_values($array1);
$array2 = array_values($array2);
sort($array1, SORT_STRING);
sort($array2, SORT_STRING);
foreach($array1 as $i=>$r) {
if ($array2[$i] != $r) return fal... | php | static function compareValues($array1, $array2, $strict = false) {
if (count($array1) != count($array2)) return false;
$array1 = array_values($array1);
$array2 = array_values($array2);
sort($array1, SORT_STRING);
sort($array2, SORT_STRING);
foreach($array1 as $i=>$r) {
if ($array2[$i] != $r) return fal... | [
"static",
"function",
"compareValues",
"(",
"$",
"array1",
",",
"$",
"array2",
",",
"$",
"strict",
"=",
"false",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"array1",
")",
"!=",
"count",
"(",
"$",
"array2",
")",
")",
"return",
"false",
";",
"$",
"array... | Porovná, zda jsou hodnoty ve dvou polích stejné. Nezáleží na indexech ani na pořadí prvků v poli.
@param array $array1
@param array $array2
@param bool $strict Používat ===
@return boolean True = stejné. False = rozdílné. | [
"Porovná",
"zda",
"jsou",
"hodnoty",
"ve",
"dvou",
"polích",
"stejné",
".",
"Nezáleží",
"na",
"indexech",
"ani",
"na",
"pořadí",
"prvků",
"v",
"poli",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L454-L468 |
ondrakoupil/tools | src/Arrays.php | Arrays.iconv | static function iconv($from, $to, $array, $keys=false, $checkDepth = 0) {
if (is_object($array)) {
return $array;
}
if (!is_array($array)) {
if (is_string($array)) {
return iconv($from,$to,$array);
} else {
return $array;
}
}
if ($checkDepth>20) return $array;
$vrat=array();
foreach($a... | php | static function iconv($from, $to, $array, $keys=false, $checkDepth = 0) {
if (is_object($array)) {
return $array;
}
if (!is_array($array)) {
if (is_string($array)) {
return iconv($from,$to,$array);
} else {
return $array;
}
}
if ($checkDepth>20) return $array;
$vrat=array();
foreach($a... | [
"static",
"function",
"iconv",
"(",
"$",
"from",
",",
"$",
"to",
",",
"$",
"array",
",",
"$",
"keys",
"=",
"false",
",",
"$",
"checkDepth",
"=",
"0",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"array",
")",
")",
"{",
"return",
"$",
"array",
";... | Rekurzivní změna kódování libovolného typu proměnné (array, string, atd., kromě objektů).
@param string $from Vstupní kódování
@param string $to Výstupní kódování
@param mixed $array Co překódovat
@param bool $keys Mají se iconvovat i klíče? Def. false.
@param int $checkDepth Tento parametr ignoruj, používá se jako poj... | [
"Rekurzivní",
"změna",
"kódování",
"libovolného",
"typu",
"proměnné",
"(",
"array",
"string",
"atd",
".",
"kromě",
"objektů",
")",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L479-L499 |
ondrakoupil/tools | src/Arrays.php | Arrays.cartesian | static function cartesian($input) {
$input = array_filter($input);
$result = array(array());
foreach ($input as $key => $values) {
$append = array();
foreach($result as $product) {
foreach($values as $item) {
$product[$key] = $item;
$append[] = $product;
}
}
$result = $append;
... | php | static function cartesian($input) {
$input = array_filter($input);
$result = array(array());
foreach ($input as $key => $values) {
$append = array();
foreach($result as $product) {
foreach($values as $item) {
$product[$key] = $item;
$append[] = $product;
}
}
$result = $append;
... | [
"static",
"function",
"cartesian",
"(",
"$",
"input",
")",
"{",
"$",
"input",
"=",
"array_filter",
"(",
"$",
"input",
")",
";",
"$",
"result",
"=",
"array",
"(",
"array",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"input",
"as",
"$",
"key",
"=>",
"... | Vytvoří kartézský součin.
<code>
$input = array(
"barva" => array("red", "green"),
"size" => array("small", "big")
);
$output = array(
[0] => array("barva" => "red", "size" => "small"),
[1] => array("barva" => "green", "size" => "small"),
[2] => array("barva" => "red", "size" => "big"),
[3] => array("barva" => "green"... | [
"Vytvoří",
"kartézský",
"součin",
".",
"<code",
">",
"$input",
"=",
"array",
"(",
"barva",
"=",
">",
"array",
"(",
"red",
"green",
")",
"size",
"=",
">",
"array",
"(",
"small",
"big",
")",
")",
";"
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Arrays.php#L521-L540 |
kattsoftware/phassets | src/Phassets/Filters/ScssCompilerFilter.php | ScssCompilerFilter.filter | public function filter(Asset $asset)
{
if ($asset->getOutputExtension() !== 'scss') {
throw new PhassetsInternalException('Only .scss files can be filtered by ' . __CLASS__);
}
$scssCompiler = new Compiler();
// Custom import paths?
$importPaths = $this->configu... | php | public function filter(Asset $asset)
{
if ($asset->getOutputExtension() !== 'scss') {
throw new PhassetsInternalException('Only .scss files can be filtered by ' . __CLASS__);
}
$scssCompiler = new Compiler();
// Custom import paths?
$importPaths = $this->configu... | [
"public",
"function",
"filter",
"(",
"Asset",
"$",
"asset",
")",
"{",
"if",
"(",
"$",
"asset",
"->",
"getOutputExtension",
"(",
")",
"!==",
"'scss'",
")",
"{",
"throw",
"new",
"PhassetsInternalException",
"(",
"'Only .scss files can be filtered by '",
".",
"__CL... | Process the Asset received and using Asset::setContents(), update
the contents accordingly. If it fails, will throw PhassetsInternalException
@param Asset $asset Asset instance which will be updated via setContents()
@throws PhassetsInternalException in case of failure | [
"Process",
"the",
"Asset",
"received",
"and",
"using",
"Asset",
"::",
"setContents",
"()",
"update",
"the",
"contents",
"accordingly",
".",
"If",
"it",
"fails",
"will",
"throw",
"PhassetsInternalException"
] | train | https://github.com/kattsoftware/phassets/blob/cc982cf1941eb5776287d64f027218bd4835ed2b/src/Phassets/Filters/ScssCompilerFilter.php#L42-L86 |
lode/fem | src/login_password.php | login_password.get_by_email | public static function get_by_email($email_address) {
$mysql = bootstrap::get_library('mysql');
$sql = "SELECT * FROM `login_passwords` WHERE `email_address` = '%s';";
$login = $mysql::select('row', $sql, $email_address);
if (empty($login)) {
return false;
}
return new static($login['id']);
} | php | public static function get_by_email($email_address) {
$mysql = bootstrap::get_library('mysql');
$sql = "SELECT * FROM `login_passwords` WHERE `email_address` = '%s';";
$login = $mysql::select('row', $sql, $email_address);
if (empty($login)) {
return false;
}
return new static($login['id']);
} | [
"public",
"static",
"function",
"get_by_email",
"(",
"$",
"email_address",
")",
"{",
"$",
"mysql",
"=",
"bootstrap",
"::",
"get_library",
"(",
"'mysql'",
")",
";",
"$",
"sql",
"=",
"\"SELECT * FROM `login_passwords` WHERE `email_address` = '%s';\"",
";",
"$",
"login... | checks whether the given email address match one on file
@param string $email_address
@return $this|boolean false when the email address is not found | [
"checks",
"whether",
"the",
"given",
"email",
"address",
"match",
"one",
"on",
"file"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_password.php#L74-L84 |
lode/fem | src/login_password.php | login_password.is_valid | public function is_valid($password, $check_rehash=true) {
if (password_verify($password, $this->data['hash']) == false) {
return false;
}
if ($check_rehash && password_needs_rehash($this->data['hash'], PASSWORD_DEFAULT)) {
$new_hash = self::hash_password($password);
$this->set_new_hash($this->data['user_id']... | php | public function is_valid($password, $check_rehash=true) {
if (password_verify($password, $this->data['hash']) == false) {
return false;
}
if ($check_rehash && password_needs_rehash($this->data['hash'], PASSWORD_DEFAULT)) {
$new_hash = self::hash_password($password);
$this->set_new_hash($this->data['user_id']... | [
"public",
"function",
"is_valid",
"(",
"$",
"password",
",",
"$",
"check_rehash",
"=",
"true",
")",
"{",
"if",
"(",
"password_verify",
"(",
"$",
"password",
",",
"$",
"this",
"->",
"data",
"[",
"'hash'",
"]",
")",
"==",
"false",
")",
"{",
"return",
"... | check if the password gives access to the login
also re-hashes the password hash if the algorithm is out of date
@param string $password in plain text
@param boolean $check_rehash set to false to skip re-hashing
@return boolean | [
"check",
"if",
"the",
"password",
"gives",
"access",
"to",
"the",
"login",
"also",
"re",
"-",
"hashes",
"the",
"password",
"hash",
"if",
"the",
"algorithm",
"is",
"out",
"of",
"date"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_password.php#L94-L105 |
lode/fem | src/login_password.php | login_password.add | public function add($user_id, $email_address, $password) {
$mysql = bootstrap::get_library('mysql');
$sql = "INSERT INTO `login_passwords` SET `user_id` = %d, `email_address` = '%s';";
$binds = [$user_id, $email_address];
$mysql::query($sql, $binds);
$login = new static($mysql::$insert_id);
$hash = self::... | php | public function add($user_id, $email_address, $password) {
$mysql = bootstrap::get_library('mysql');
$sql = "INSERT INTO `login_passwords` SET `user_id` = %d, `email_address` = '%s';";
$binds = [$user_id, $email_address];
$mysql::query($sql, $binds);
$login = new static($mysql::$insert_id);
$hash = self::... | [
"public",
"function",
"add",
"(",
"$",
"user_id",
",",
"$",
"email_address",
",",
"$",
"password",
")",
"{",
"$",
"mysql",
"=",
"bootstrap",
"::",
"get_library",
"(",
"'mysql'",
")",
";",
"$",
"sql",
"=",
"\"INSERT INTO `login_passwords` SET `user_id` = %d, `ema... | adds a login
@param int $user_id
@param string $email_address
@param string $password in plain text | [
"adds",
"a",
"login"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_password.php#L123-L134 |
lode/fem | src/login_password.php | login_password.set_new_hash | public function set_new_hash($new_hash) {
$mysql = bootstrap::get_library('mysql');
$sql = "UPDATE `login_passwords` SET `hash` = '%s' WHERE `id` = %d;";
$binds = [$new_hash, $this->data['id']];
$mysql::query($sql, $binds);
$this->data['hash'] = $new_hash;
} | php | public function set_new_hash($new_hash) {
$mysql = bootstrap::get_library('mysql');
$sql = "UPDATE `login_passwords` SET `hash` = '%s' WHERE `id` = %d;";
$binds = [$new_hash, $this->data['id']];
$mysql::query($sql, $binds);
$this->data['hash'] = $new_hash;
} | [
"public",
"function",
"set_new_hash",
"(",
"$",
"new_hash",
")",
"{",
"$",
"mysql",
"=",
"bootstrap",
"::",
"get_library",
"(",
"'mysql'",
")",
";",
"$",
"sql",
"=",
"\"UPDATE `login_passwords` SET `hash` = '%s' WHERE `id` = %d;\"",
";",
"$",
"binds",
"=",
"[",
... | stores a new hash for the current login
@param string $new_hash
@return void | [
"stores",
"a",
"new",
"hash",
"for",
"the",
"current",
"login"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_password.php#L142-L150 |
lode/fem | src/login_password.php | login_password.hash_password | public static function hash_password($password) {
$exception = bootstrap::get_library('exception');
if (mb_strlen($password) < self::MINIMUM_LENGTH) {
throw new $exception('passwords need a minimum length of '.self::MINIMUM_LENGTH);
}
$hash = password_hash($password, PASSWORD_DEFAULT);
if (empty($hash)) {
... | php | public static function hash_password($password) {
$exception = bootstrap::get_library('exception');
if (mb_strlen($password) < self::MINIMUM_LENGTH) {
throw new $exception('passwords need a minimum length of '.self::MINIMUM_LENGTH);
}
$hash = password_hash($password, PASSWORD_DEFAULT);
if (empty($hash)) {
... | [
"public",
"static",
"function",
"hash_password",
"(",
"$",
"password",
")",
"{",
"$",
"exception",
"=",
"bootstrap",
"::",
"get_library",
"(",
"'exception'",
")",
";",
"if",
"(",
"mb_strlen",
"(",
"$",
"password",
")",
"<",
"self",
"::",
"MINIMUM_LENGTH",
... | generates a new hash for the given password
we wrap the native method to ensure a successful hash
also enforces a minimum length for passwords
@see ::MINIMUM_LENGTH
@param string $password
@return string | [
"generates",
"a",
"new",
"hash",
"for",
"the",
"given",
"password",
"we",
"wrap",
"the",
"native",
"method",
"to",
"ensure",
"a",
"successful",
"hash"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/login_password.php#L162-L175 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Controller/InstallController.php | InstallController.requirementsAction | public function requirementsAction()
{
// include symfony requirements class
$sAppPath = $this->getParameter('kernel.root_dir');
require_once $sAppPath.'/SymfonyRequirements.php';
$symfonyRequirements = new \SymfonyRequirements();
// add additional r... | php | public function requirementsAction()
{
// include symfony requirements class
$sAppPath = $this->getParameter('kernel.root_dir');
require_once $sAppPath.'/SymfonyRequirements.php';
$symfonyRequirements = new \SymfonyRequirements();
// add additional r... | [
"public",
"function",
"requirementsAction",
"(",
")",
"{",
"// include symfony requirements class",
"$",
"sAppPath",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'kernel.root_dir'",
")",
";",
"require_once",
"$",
"sAppPath",
".",
"'/SymfonyRequirements.php'",
";",
"$... | Check System Requirements
@return \Symfony\Component\HttpFoundation\Response | [
"Check",
"System",
"Requirements"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Controller/InstallController.php#L43-L63 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Controller/InstallController.php | InstallController.installAction | public function installAction()
{
// create install form
$form = $this->createForm(new InstallType(), null, array('action' => $this->generateUrl('install_process')));
// redirect to login if config already filled
if ($this->container->getParameter('database_pass... | php | public function installAction()
{
// create install form
$form = $this->createForm(new InstallType(), null, array('action' => $this->generateUrl('install_process')));
// redirect to login if config already filled
if ($this->container->getParameter('database_pass... | [
"public",
"function",
"installAction",
"(",
")",
"{",
"// create install form",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"InstallType",
"(",
")",
",",
"null",
",",
"array",
"(",
"'action'",
"=>",
"$",
"this",
"->",
"generateUrl",
"(",... | Display install form
@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response | [
"Display",
"install",
"form"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Controller/InstallController.php#L96-L108 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Controller/InstallController.php | InstallController.processInstallAction | public function processInstallAction(Request $request)
{
// include symfony requirements class
$sAppPath = $this->getParameter('kernel.root_dir');
require_once $sAppPath.'/SymfonyRequirements.php';
// prevent from being called directly after install...
... | php | public function processInstallAction(Request $request)
{
// include symfony requirements class
$sAppPath = $this->getParameter('kernel.root_dir');
require_once $sAppPath.'/SymfonyRequirements.php';
// prevent from being called directly after install...
... | [
"public",
"function",
"processInstallAction",
"(",
"Request",
"$",
"request",
")",
"{",
"// include symfony requirements class",
"$",
"sAppPath",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'kernel.root_dir'",
")",
";",
"require_once",
"$",
"sAppPath",
".",
"'/Sym... | Process provided informations and perform installation
@param \Symfony\Component\HttpFoundation\Request $request
@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response | [
"Process",
"provided",
"informations",
"and",
"perform",
"installation"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Controller/InstallController.php#L118-L150 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/UserGroupManager.php | UserGroupManager.find | public function find(ValueObject $object, $throwException = false)
{
try {
if (isset($object->data['remote_id'])) {
$contentObject = $this->contentService->loadContentByRemoteId($object->data['remote_id']);
$userGroup = $this->userService->loadUserGroup($contentOb... | php | public function find(ValueObject $object, $throwException = false)
{
try {
if (isset($object->data['remote_id'])) {
$contentObject = $this->contentService->loadContentByRemoteId($object->data['remote_id']);
$userGroup = $this->userService->loadUserGroup($contentOb... | [
"public",
"function",
"find",
"(",
"ValueObject",
"$",
"object",
",",
"$",
"throwException",
"=",
"false",
")",
"{",
"try",
"{",
"if",
"(",
"isset",
"(",
"$",
"object",
"->",
"data",
"[",
"'remote_id'",
"]",
")",
")",
"{",
"$",
"contentObject",
"=",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/UserGroupManager.php#L86-L104 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/UserGroupManager.php | UserGroupManager.create | public function create(ObjectInterface $object)
{
if (!$object instanceof UserGroupObject) {
throw new UnsupportedObjectOperationException(UserGroupObject::class, get_class($object));
}
$this->ensureDefaults($object);
$parentUserGroup = $this->findById($object->data['pa... | php | public function create(ObjectInterface $object)
{
if (!$object instanceof UserGroupObject) {
throw new UnsupportedObjectOperationException(UserGroupObject::class, get_class($object));
}
$this->ensureDefaults($object);
$parentUserGroup = $this->findById($object->data['pa... | [
"public",
"function",
"create",
"(",
"ObjectInterface",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"UserGroupObject",
")",
"{",
"throw",
"new",
"UnsupportedObjectOperationException",
"(",
"UserGroupObject",
"::",
"class",
",",
"get_class... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/UserGroupManager.php#L124-L150 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/UserGroupManager.php | UserGroupManager.update | public function update(ObjectInterface $object)
{
if (!$object instanceof UserGroupObject) {
throw new UnsupportedObjectOperationException(UserGroupObject::class, get_class($object));
}
$userGroup = $this->find($object, true);
$this->ensureDefaults($object);
$u... | php | public function update(ObjectInterface $object)
{
if (!$object instanceof UserGroupObject) {
throw new UnsupportedObjectOperationException(UserGroupObject::class, get_class($object));
}
$userGroup = $this->find($object, true);
$this->ensureDefaults($object);
$u... | [
"public",
"function",
"update",
"(",
"ObjectInterface",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"UserGroupObject",
")",
"{",
"throw",
"new",
"UnsupportedObjectOperationException",
"(",
"UserGroupObject",
"::",
"class",
",",
"get_class... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/UserGroupManager.php#L155-L181 |
transfer-framework/ezplatform | src/Transfer/EzPlatform/Repository/Manager/UserGroupManager.php | UserGroupManager.remove | public function remove(ObjectInterface $object)
{
if (!$object instanceof UserGroupObject) {
throw new UnsupportedObjectOperationException(UserGroupObject::class, get_class($object));
}
try {
$userGroup = $this->find($object);
$this->userService->deleteUs... | php | public function remove(ObjectInterface $object)
{
if (!$object instanceof UserGroupObject) {
throw new UnsupportedObjectOperationException(UserGroupObject::class, get_class($object));
}
try {
$userGroup = $this->find($object);
$this->userService->deleteUs... | [
"public",
"function",
"remove",
"(",
"ObjectInterface",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"UserGroupObject",
")",
"{",
"throw",
"new",
"UnsupportedObjectOperationException",
"(",
"UserGroupObject",
"::",
"class",
",",
"get_class... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/ezplatform/blob/1b2d87caa1a6b79fd8fc78109c26a2d1d6359c2f/src/Transfer/EzPlatform/Repository/Manager/UserGroupManager.php#L204-L218 |
joomlatools/joomlatools-platform-legacy | code/request/request.php | JRequest.getVar | public static function getVar($name, $default = null, $hash = 'default', $type = 'none', $mask = 0)
{
// Ensure hash and type are uppercase
$hash = strtoupper($hash);
if ($hash === 'METHOD')
{
$hash = strtoupper($_SERVER['REQUEST_METHOD']);
}
$type = strtoupper($type);
$sig = $hash . $type . $mask;
... | php | public static function getVar($name, $default = null, $hash = 'default', $type = 'none', $mask = 0)
{
// Ensure hash and type are uppercase
$hash = strtoupper($hash);
if ($hash === 'METHOD')
{
$hash = strtoupper($_SERVER['REQUEST_METHOD']);
}
$type = strtoupper($type);
$sig = $hash . $type . $mask;
... | [
"public",
"static",
"function",
"getVar",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
",",
"$",
"hash",
"=",
"'default'",
",",
"$",
"type",
"=",
"'none'",
",",
"$",
"mask",
"=",
"0",
")",
"{",
"// Ensure hash and type are uppercase",
"$",
"hash",... | Fetches and returns a given variable.
The default behaviour is fetching variables depending on the
current request method: GET and HEAD will result in returning
an entry from $_GET, POST and PUT will result in returning an
entry from $_POST.
You can force the source by setting the $hash parameter:
post $_POST
get... | [
"Fetches",
"and",
"returns",
"a",
"given",
"variable",
"."
] | train | https://github.com/joomlatools/joomlatools-platform-legacy/blob/3a76944e2f2c415faa6504754c75321a3b478c06/code/request/request.php#L101-L172 |
joomlatools/joomlatools-platform-legacy | code/request/request.php | JRequest.getString | public static function getString($name, $default = '', $hash = 'default', $mask = 0)
{
// Cast to string, in case JREQUEST_ALLOWRAW was specified for mask
return (string) self::getVar($name, $default, $hash, 'string', $mask);
} | php | public static function getString($name, $default = '', $hash = 'default', $mask = 0)
{
// Cast to string, in case JREQUEST_ALLOWRAW was specified for mask
return (string) self::getVar($name, $default, $hash, 'string', $mask);
} | [
"public",
"static",
"function",
"getString",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"''",
",",
"$",
"hash",
"=",
"'default'",
",",
"$",
"mask",
"=",
"0",
")",
"{",
"// Cast to string, in case JREQUEST_ALLOWRAW was specified for mask",
"return",
"(",
"string... | Fetches and returns a given filtered variable. The string
filter deletes 'bad' HTML code, if not overridden by the mask.
This is currently only a proxy function for getVar().
See getVar() for more in-depth documentation on the parameters.
@param string $name Variable name
@param string $default Default v... | [
"Fetches",
"and",
"returns",
"a",
"given",
"filtered",
"variable",
".",
"The",
"string",
"filter",
"deletes",
"bad",
"HTML",
"code",
"if",
"not",
"overridden",
"by",
"the",
"mask",
".",
"This",
"is",
"currently",
"only",
"a",
"proxy",
"function",
"for",
"g... | train | https://github.com/joomlatools/joomlatools-platform-legacy/blob/3a76944e2f2c415faa6504754c75321a3b478c06/code/request/request.php#L323-L327 |
joomlatools/joomlatools-platform-legacy | code/request/request.php | JRequest.setVar | public static function setVar($name, $value = null, $hash = 'method', $overwrite = true)
{
// If overwrite is true, makes sure the variable hasn't been set yet
if (!$overwrite && array_key_exists($name, $_REQUEST))
{
return $_REQUEST[$name];
}
// Clean global request var
$GLOBALS['_JREQUEST'][$name] = ... | php | public static function setVar($name, $value = null, $hash = 'method', $overwrite = true)
{
// If overwrite is true, makes sure the variable hasn't been set yet
if (!$overwrite && array_key_exists($name, $_REQUEST))
{
return $_REQUEST[$name];
}
// Clean global request var
$GLOBALS['_JREQUEST'][$name] = ... | [
"public",
"static",
"function",
"setVar",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
",",
"$",
"hash",
"=",
"'method'",
",",
"$",
"overwrite",
"=",
"true",
")",
"{",
"// If overwrite is true, makes sure the variable hasn't been set yet",
"if",
"(",
"!",
... | Set a variable in one of the request variables.
@param string $name Name
@param string $value Value
@param string $hash Hash
@param boolean $overwrite Boolean
@return string Previous value
@since 11.1
@deprecated 12.1 | [
"Set",
"a",
"variable",
"in",
"one",
"of",
"the",
"request",
"variables",
"."
] | train | https://github.com/joomlatools/joomlatools-platform-legacy/blob/3a76944e2f2c415faa6504754c75321a3b478c06/code/request/request.php#L343-L394 |
joomlatools/joomlatools-platform-legacy | code/request/request.php | JRequest.get | public static function get($hash = 'default', $mask = 0)
{
$hash = strtoupper($hash);
if ($hash === 'METHOD')
{
$hash = strtoupper($_SERVER['REQUEST_METHOD']);
}
switch ($hash)
{
case 'GET':
$input = $_GET;
break;
case 'POST':
$input = $_POST;
break;
case 'FILES':
$input... | php | public static function get($hash = 'default', $mask = 0)
{
$hash = strtoupper($hash);
if ($hash === 'METHOD')
{
$hash = strtoupper($_SERVER['REQUEST_METHOD']);
}
switch ($hash)
{
case 'GET':
$input = $_GET;
break;
case 'POST':
$input = $_POST;
break;
case 'FILES':
$input... | [
"public",
"static",
"function",
"get",
"(",
"$",
"hash",
"=",
"'default'",
",",
"$",
"mask",
"=",
"0",
")",
"{",
"$",
"hash",
"=",
"strtoupper",
"(",
"$",
"hash",
")",
";",
"if",
"(",
"$",
"hash",
"===",
"'METHOD'",
")",
"{",
"$",
"hash",
"=",
... | Fetches and returns a request array.
The default behaviour is fetching variables depending on the
current request method: GET and HEAD will result in returning
$_GET, POST and PUT will result in returning $_POST.
You can force the source by setting the $hash parameter:
post $_POST
get $_GET
files $_FILES... | [
"Fetches",
"and",
"returns",
"a",
"request",
"array",
"."
] | train | https://github.com/joomlatools/joomlatools-platform-legacy/blob/3a76944e2f2c415faa6504754c75321a3b478c06/code/request/request.php#L423-L466 |
joomlatools/joomlatools-platform-legacy | code/request/request.php | JRequest.set | public static function set($array, $hash = 'default', $overwrite = true)
{
foreach ($array as $key => $value)
{
self::setVar($key, $value, $hash, $overwrite);
}
} | php | public static function set($array, $hash = 'default', $overwrite = true)
{
foreach ($array as $key => $value)
{
self::setVar($key, $value, $hash, $overwrite);
}
} | [
"public",
"static",
"function",
"set",
"(",
"$",
"array",
",",
"$",
"hash",
"=",
"'default'",
",",
"$",
"overwrite",
"=",
"true",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"self",
"::",
"setVar",
"(",
... | Sets a request variable.
@param array $array An associative array of key-value pairs.
@param string $hash The request variable to set (POST, GET, FILES, METHOD).
@param boolean $overwrite If true and an existing key is found, the value is overwritten, otherwise it is ignored.
@return void
@d... | [
"Sets",
"a",
"request",
"variable",
"."
] | train | https://github.com/joomlatools/joomlatools-platform-legacy/blob/3a76944e2f2c415faa6504754c75321a3b478c06/code/request/request.php#L481-L487 |
joomlatools/joomlatools-platform-legacy | code/request/request.php | JRequest._cleanVar | protected static function _cleanVar($var, $mask = 0, $type = null)
{
// If the no trim flag is not set, trim the variable
if (!($mask & 1) && is_string($var))
{
$var = trim($var);
}
// Now we handle input filtering
if ($mask & 2)
{
// If the allow raw flag is set, do not modify the variable
$va... | php | protected static function _cleanVar($var, $mask = 0, $type = null)
{
// If the no trim flag is not set, trim the variable
if (!($mask & 1) && is_string($var))
{
$var = trim($var);
}
// Now we handle input filtering
if ($mask & 2)
{
// If the allow raw flag is set, do not modify the variable
$va... | [
"protected",
"static",
"function",
"_cleanVar",
"(",
"$",
"var",
",",
"$",
"mask",
"=",
"0",
",",
"$",
"type",
"=",
"null",
")",
"{",
"// If the no trim flag is not set, trim the variable",
"if",
"(",
"!",
"(",
"$",
"mask",
"&",
"1",
")",
"&&",
"is_string"... | Clean up an input variable.
@param mixed $var The input variable.
@param integer $mask Filter bit mask.
1 = no trim: If this flag is cleared and the input is a string, the string will have leading and trailing
whitespace trimmed.
2 = allow_raw: If set, no more filtering is performed, higher bits are ignored... | [
"Clean",
"up",
"an",
"input",
"variable",
"."
] | train | https://github.com/joomlatools/joomlatools-platform-legacy/blob/3a76944e2f2c415faa6504754c75321a3b478c06/code/request/request.php#L528-L557 |
webforge-labs/psc-cms | lib/Psc/UI/Component/SingleImage.php | SingleImage.dpi | public function dpi(EntityMeta $entityMeta, DCPackage $dc) {
$this->entityMeta = $entityMeta;
$this->dc = $dc;
return $this;
} | php | public function dpi(EntityMeta $entityMeta, DCPackage $dc) {
$this->entityMeta = $entityMeta;
$this->dc = $dc;
return $this;
} | [
"public",
"function",
"dpi",
"(",
"EntityMeta",
"$",
"entityMeta",
",",
"DCPackage",
"$",
"dc",
")",
"{",
"$",
"this",
"->",
"entityMeta",
"=",
"$",
"entityMeta",
";",
"$",
"this",
"->",
"dc",
"=",
"$",
"dc",
";",
"return",
"$",
"this",
";",
"}"
] | EntityMeta der Bild-Klasse | [
"EntityMeta",
"der",
"Bild",
"-",
"Klasse"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/Component/SingleImage.php#L33-L37 |
phpmob/changmin | src/PhpMob/CoreBundle/Fixture/WebUserFactory.php | WebUserFactory.create | public function create(array $options = [])
{
$options = $this->optionsResolver->resolve($options);
/** @var WebUserInterface $user */
$user = $this->userFactory->createNew();
$user->setEmail($options['email']);
$user->setUsername($options['username']);
$user->setPla... | php | public function create(array $options = [])
{
$options = $this->optionsResolver->resolve($options);
/** @var WebUserInterface $user */
$user = $this->userFactory->createNew();
$user->setEmail($options['email']);
$user->setUsername($options['username']);
$user->setPla... | [
"public",
"function",
"create",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"optionsResolver",
"->",
"resolve",
"(",
"$",
"options",
")",
";",
"/** @var WebUserInterface $user */",
"$",
"user",
"=",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CoreBundle/Fixture/WebUserFactory.php#L53-L74 |
phpmob/changmin | src/PhpMob/CoreBundle/Fixture/WebUserFactory.php | WebUserFactory.configureOptions | protected function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefault('email', function (Options $options) {
return $this->faker->email;
})
->setDefault('username', function (Options $options) {
return $this->faker->userNa... | php | protected function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefault('email', function (Options $options) {
return $this->faker->email;
})
->setDefault('username', function (Options $options) {
return $this->faker->userNa... | [
"protected",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"$",
"resolver",
"->",
"setDefault",
"(",
"'email'",
",",
"function",
"(",
"Options",
"$",
"options",
")",
"{",
"return",
"$",
"this",
"->",
"faker",
"->",
"email... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CoreBundle/Fixture/WebUserFactory.php#L79-L114 |
anime-db/app-bundle | src/Util/Pagination/View.php | View.buildLink | protected function buildLink($page)
{
if ($page == 1 && $this->config->getFirstPageLink()) {
return $this->config->getFirstPageLink();
}
if (is_callable($this->config->getPageLink())) {
return call_user_func($this->config->getPageLink(), $page);
} else {
... | php | protected function buildLink($page)
{
if ($page == 1 && $this->config->getFirstPageLink()) {
return $this->config->getFirstPageLink();
}
if (is_callable($this->config->getPageLink())) {
return call_user_func($this->config->getPageLink(), $page);
} else {
... | [
"protected",
"function",
"buildLink",
"(",
"$",
"page",
")",
"{",
"if",
"(",
"$",
"page",
"==",
"1",
"&&",
"$",
"this",
"->",
"config",
"->",
"getFirstPageLink",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"config",
"->",
"getFirstPageLink",
"(",
... | @param int $page
@return string | [
"@param",
"int",
"$page"
] | train | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Util/Pagination/View.php#L186-L197 |
ondrakoupil/tools | src/Strings.php | Strings.plural | static function plural($amount, $one, $two = null, $five = null, $zero = null) {
if ($two === null) $two = $one;
if ($five === null) $five = $two;
if ($zero === null) $zero = $five;
if ($amount==1) return str_replace("%%",$amount,$one);
if ($amount>1 and $amount<5) return str_replace("%%",$amount,$two);
if ... | php | static function plural($amount, $one, $two = null, $five = null, $zero = null) {
if ($two === null) $two = $one;
if ($five === null) $five = $two;
if ($zero === null) $zero = $five;
if ($amount==1) return str_replace("%%",$amount,$one);
if ($amount>1 and $amount<5) return str_replace("%%",$amount,$two);
if ... | [
"static",
"function",
"plural",
"(",
"$",
"amount",
",",
"$",
"one",
",",
"$",
"two",
"=",
"null",
",",
"$",
"five",
"=",
"null",
",",
"$",
"zero",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"two",
"===",
"null",
")",
"$",
"two",
"=",
"$",
"one",... | Skloňuje řetězec dle českých pravidel řetězec
@param number $amount
@param string $one Lze použít dvě procenta - %% - pro nahrazení za $amount
@param string $two
@param string $five Vynechat nebo null = použít $two
@param string $zero Vynechat nebo null = použít $five
@return string | [
"Skloňuje",
"řetězec",
"dle",
"českých",
"pravidel",
"řetězec"
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Strings.php#L18-L26 |
ondrakoupil/tools | src/Strings.php | Strings.substring | static function substring($input, $start, $length = null) {
return self::substr($input, $start, $length, "utf-8");
} | php | static function substring($input, $start, $length = null) {
return self::substr($input, $start, $length, "utf-8");
} | [
"static",
"function",
"substring",
"(",
"$",
"input",
",",
"$",
"start",
",",
"$",
"length",
"=",
"null",
")",
"{",
"return",
"self",
"::",
"substr",
"(",
"$",
"input",
",",
"$",
"start",
",",
"$",
"length",
",",
"\"utf-8\"",
")",
";",
"}"
] | substr() pro UTF-8
@param string $input
@param int $start
@param int $length
@return string | [
"substr",
"()",
"pro",
"UTF",
"-",
"8"
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Strings.php#L54-L56 |
ondrakoupil/tools | src/Strings.php | Strings.substr | static function substr($input, $start, $length = null) {
if ($length === null) {
$length = self::length($input) - $start;
}
return mb_substr($input, $start, $length, "utf-8");
} | php | static function substr($input, $start, $length = null) {
if ($length === null) {
$length = self::length($input) - $start;
}
return mb_substr($input, $start, $length, "utf-8");
} | [
"static",
"function",
"substr",
"(",
"$",
"input",
",",
"$",
"start",
",",
"$",
"length",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"length",
"===",
"null",
")",
"{",
"$",
"length",
"=",
"self",
"::",
"length",
"(",
"$",
"input",
")",
"-",
"$",
"s... | substr() pro UTF-8
@param string $input
@param int $start
@param int $length
@return string | [
"substr",
"()",
"pro",
"UTF",
"-",
"8"
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Strings.php#L66-L71 |
ondrakoupil/tools | src/Strings.php | Strings.shorten | static function shorten($text, $length, $ending="…", $stripHtml=true, $ignoreWords = false) {
if ($stripHtml) {
$text=self::br2nl($text);
$text=strip_tags($text);
}
$text=trim($text);
if ($ending===true) $ending="…";
$needsTrim = (self::strlen($text) > $length);
if (!$needsTrim) {
re... | php | static function shorten($text, $length, $ending="…", $stripHtml=true, $ignoreWords = false) {
if ($stripHtml) {
$text=self::br2nl($text);
$text=strip_tags($text);
}
$text=trim($text);
if ($ending===true) $ending="…";
$needsTrim = (self::strlen($text) > $length);
if (!$needsTrim) {
re... | [
"static",
"function",
"shorten",
"(",
"$",
"text",
",",
"$",
"length",
",",
"$",
"ending",
"=",
"\"…\"",
",",
"$",
"stripHtml",
"=",
"true",
",",
"$",
"ignoreWords",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"stripHtml",
")",
"{",
"$",
"text",
... | Funkce pro zkrácení dlouhého textu na menší délku.
Ořezává tak, aby nerozdělovala slova, a případně umí i odstranit HTML znaky.
@param string $text Původní (dlouhý) text
@param int $length Požadovaná délka textu. Oříznutý text nebude mít přesně tuto délku, může být o nějaké znaky kratší nebo delší podle toho, kde končí... | [
"Funkce",
"pro",
"zkrácení",
"dlouhého",
"textu",
"na",
"menší",
"délku",
".",
"Ořezává",
"tak",
"aby",
"nerozdělovala",
"slova",
"a",
"případně",
"umí",
"i",
"odstranit",
"HTML",
"znaky",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Strings.php#L126-L152 |
ondrakoupil/tools | src/Strings.php | Strings.replaceEntities | static function replaceEntities($string, $valuesArray, $escapeFunction = "!!default", $entityDelimiter = "%", $entityNameChars = 'a-z0-9_-') {
if ($escapeFunction === "!!default") {
$escapeFunction = "\\OndraKoupil\\Tools\\Html::escape";
}
$arrayMode = is_array($valuesArray);
$arrayAccessMode = (!is_array($v... | php | static function replaceEntities($string, $valuesArray, $escapeFunction = "!!default", $entityDelimiter = "%", $entityNameChars = 'a-z0-9_-') {
if ($escapeFunction === "!!default") {
$escapeFunction = "\\OndraKoupil\\Tools\\Html::escape";
}
$arrayMode = is_array($valuesArray);
$arrayAccessMode = (!is_array($v... | [
"static",
"function",
"replaceEntities",
"(",
"$",
"string",
",",
"$",
"valuesArray",
",",
"$",
"escapeFunction",
"=",
"\"!!default\"",
",",
"$",
"entityDelimiter",
"=",
"\"%\"",
",",
"$",
"entityNameChars",
"=",
"'a-z0-9_-'",
")",
"{",
"if",
"(",
"$",
"esca... | Nahradí entity v řetězci hodnotami ze zadaného pole.
@param string $string
@param array|ArrayAccess $valuesArray
@param callback $escapeFunction Funkce, ktrsou se prožene každá nahrazená entita (např. kvůli escapování paznaků). Defaultně Html::escape()
@param string $entityDelimiter Jeden znak
@param string $entityName... | [
"Nahradí",
"entity",
"v",
"řetězci",
"hodnotami",
"ze",
"zadaného",
"pole",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Strings.php#L183-L221 |
ondrakoupil/tools | src/Strings.php | Strings.parsePhpNumber | static function parsePhpNumber($number) {
$number = trim($number);
if (is_numeric($number)) {
return $number * 1;
}
if (preg_match('~^(-?)([0-9\.,]+)([kmgt]?)$~i', $number, $parts)) {
$base = self::number($parts[2]);
switch ($parts[3]) {
case "K": case "k":
$base *= 1024;
break;
c... | php | static function parsePhpNumber($number) {
$number = trim($number);
if (is_numeric($number)) {
return $number * 1;
}
if (preg_match('~^(-?)([0-9\.,]+)([kmgt]?)$~i', $number, $parts)) {
$base = self::number($parts[2]);
switch ($parts[3]) {
case "K": case "k":
$base *= 1024;
break;
c... | [
"static",
"function",
"parsePhpNumber",
"(",
"$",
"number",
")",
"{",
"$",
"number",
"=",
"trim",
"(",
"$",
"number",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"number",
")",
")",
"{",
"return",
"$",
"number",
"*",
"1",
";",
"}",
"if",
"(",
"p... | Převede číslo s lidsky čitelným násobitelem, jako to zadávané v php.ini (např. 100M jako 100 mega), na normální číslo
@param string $number
@return number|boolean False, pokud je vstup nepřevoditelný | [
"Převede",
"číslo",
"s",
"lidsky",
"čitelným",
"násobitelem",
"jako",
"to",
"zadávané",
"v",
"php",
".",
"ini",
"(",
"např",
".",
"100M",
"jako",
"100",
"mega",
")",
"na",
"normální",
"číslo"
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Strings.php#L228-L267 |
ondrakoupil/tools | src/Strings.php | Strings.phoneNumberFormatter | static function phoneNumberFormatter($input, $international = true, $spaces = false, $internationalPrefix = "+", $defaultInternational = "420") {
if (!trim($input)) {
return "";
}
if ($spaces === true) {
$spaces = " ";
}
$filteredInput = preg_replace('~\D~', '', $input);
$parsedInternational = "";
... | php | static function phoneNumberFormatter($input, $international = true, $spaces = false, $internationalPrefix = "+", $defaultInternational = "420") {
if (!trim($input)) {
return "";
}
if ($spaces === true) {
$spaces = " ";
}
$filteredInput = preg_replace('~\D~', '', $input);
$parsedInternational = "";
... | [
"static",
"function",
"phoneNumberFormatter",
"(",
"$",
"input",
",",
"$",
"international",
"=",
"true",
",",
"$",
"spaces",
"=",
"false",
",",
"$",
"internationalPrefix",
"=",
"\"+\"",
",",
"$",
"defaultInternational",
"=",
"\"420\"",
")",
"{",
"if",
"(",
... | Naformátuje telefonní číslo
@param string $input
@param bool $international Nechat/přidat mezinárodní předvolbu?
@param bool|string $spaces Přidat mezery pro trojčíslí? True = mezery. False = žádné mezery. String = zadaný řetězec použít jako mezeru.
@param string $internationalPrefix Prefix pro mezinárodní řpedvolbu, p... | [
"Naformátuje",
"telefonní",
"číslo"
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Strings.php#L279-L328 |
ondrakoupil/tools | src/Strings.php | Strings.startsWith | static function startsWith($string, $startsWith, $caseSensitive = true) {
$len = self::strlen($startsWith);
if ($caseSensitive) return self::substr($string, 0, $len) == $startsWith;
return self::strtolower(self::substr($string, 0, $len)) == self::strtolower($startsWith);
} | php | static function startsWith($string, $startsWith, $caseSensitive = true) {
$len = self::strlen($startsWith);
if ($caseSensitive) return self::substr($string, 0, $len) == $startsWith;
return self::strtolower(self::substr($string, 0, $len)) == self::strtolower($startsWith);
} | [
"static",
"function",
"startsWith",
"(",
"$",
"string",
",",
"$",
"startsWith",
",",
"$",
"caseSensitive",
"=",
"true",
")",
"{",
"$",
"len",
"=",
"self",
"::",
"strlen",
"(",
"$",
"startsWith",
")",
";",
"if",
"(",
"$",
"caseSensitive",
")",
"return",... | Začíná $string na $startsWith?
@param string $string
@param string $startsWith
@param bool $caseSensitive
@return bool | [
"Začíná",
"$string",
"na",
"$startsWith?"
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Strings.php#L337-L341 |
ondrakoupil/tools | src/Strings.php | Strings.endsWith | static function endsWith($string, $endsWith, $caseSensitive = true) {
$len = self::strlen($endsWith);
if ($caseSensitive) return self::substr($string, -1 * $len) == $endsWith;
return self::strtolower(self::substr($string, -1 * $len)) == self::strtolower($endsWith);
} | php | static function endsWith($string, $endsWith, $caseSensitive = true) {
$len = self::strlen($endsWith);
if ($caseSensitive) return self::substr($string, -1 * $len) == $endsWith;
return self::strtolower(self::substr($string, -1 * $len)) == self::strtolower($endsWith);
} | [
"static",
"function",
"endsWith",
"(",
"$",
"string",
",",
"$",
"endsWith",
",",
"$",
"caseSensitive",
"=",
"true",
")",
"{",
"$",
"len",
"=",
"self",
"::",
"strlen",
"(",
"$",
"endsWith",
")",
";",
"if",
"(",
"$",
"caseSensitive",
")",
"return",
"se... | Končí $string na $endsWith?
@param string $string
@param string $endsWith
@return string | [
"Končí",
"$string",
"na",
"$endsWith?"
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Strings.php#L349-L353 |
ondrakoupil/tools | src/Strings.php | Strings.number | static function number($string, $default = 0, $positiveOnly = false) {
if (is_bool($string) or is_object($string) or is_array($string)) return $default;
$string=str_replace(array(","," "),array(".",""),trim($string));
if (!is_numeric($string)) return $default;
$string = $string * 1; // Convert to number
if ($... | php | static function number($string, $default = 0, $positiveOnly = false) {
if (is_bool($string) or is_object($string) or is_array($string)) return $default;
$string=str_replace(array(","," "),array(".",""),trim($string));
if (!is_numeric($string)) return $default;
$string = $string * 1; // Convert to number
if ($... | [
"static",
"function",
"number",
"(",
"$",
"string",
",",
"$",
"default",
"=",
"0",
",",
"$",
"positiveOnly",
"=",
"false",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"string",
")",
"or",
"is_object",
"(",
"$",
"string",
")",
"or",
"is_array",
"(",
"... | Ošetří zadanou hodnotu tak, aby z ní bylo číslo.
(normalizuje desetinnou čárku na tečku a ověří is_numeric).
@param mixed $string
@param int|float $default Vrátí se, pokud $vstup není čílený řetězec ani číslo (tj. je array, object, bool nebo nenumerický řetězec)
@param bool $positiveOnly Dáš-li true, tak se záporné čís... | [
"Ošetří",
"zadanou",
"hodnotu",
"tak",
"aby",
"z",
"ní",
"bylo",
"číslo",
".",
"(",
"normalizuje",
"desetinnou",
"čárku",
"na",
"tečku",
"a",
"ověří",
"is_numeric",
")",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Strings.php#L363-L370 |
ondrakoupil/tools | src/Strings.php | Strings.numberOnly | static function numberOnly($string, $decimalPoint = ".", $convertedDecimalPoint = ".") {
$vystup="";
for ($i=0;$i<strlen($string);$i++) {
$znak=substr($string,$i,1);
if (is_numeric($znak)) $vystup.=$znak;
else {
if ($znak==$decimalPoint) {
$vystup.=$convertedDecimalPoint;
}
}
}
return $... | php | static function numberOnly($string, $decimalPoint = ".", $convertedDecimalPoint = ".") {
$vystup="";
for ($i=0;$i<strlen($string);$i++) {
$znak=substr($string,$i,1);
if (is_numeric($znak)) $vystup.=$znak;
else {
if ($znak==$decimalPoint) {
$vystup.=$convertedDecimalPoint;
}
}
}
return $... | [
"static",
"function",
"numberOnly",
"(",
"$",
"string",
",",
"$",
"decimalPoint",
"=",
"\".\"",
",",
"$",
"convertedDecimalPoint",
"=",
"\".\"",
")",
"{",
"$",
"vystup",
"=",
"\"\"",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"strlen",
... | Funkce zlikviduje z řetězce všechno kromě číselných znaků a vybraného desetinného oddělovače.
@param string $string
@param string $decimalPoint
@param string $convertedDecimalPoint Takto lze normalizovat desetinný oddělovač.
@return string | [
"Funkce",
"zlikviduje",
"z",
"řetězce",
"všechno",
"kromě",
"číselných",
"znaků",
"a",
"vybraného",
"desetinného",
"oddělovače",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Strings.php#L379-L391 |
ondrakoupil/tools | src/Strings.php | Strings.toAscii | public static function toAscii($s)
{
$s = preg_replace('#[^\x09\x0A\x0D\x20-\x7E\xA0-\x{2FF}\x{370}-\x{10FFFF}]#u', '', $s);
$s = strtr($s, '`\'"^~', "\x01\x02\x03\x04\x05");
if (ICONV_IMPL === 'glibc') {
$s = @iconv('UTF-8', 'WINDOWS-1250//TRANSLIT', $s); // intentionally @
$s = strtr($s, "\xa5\xa3\xbc\x8... | php | public static function toAscii($s)
{
$s = preg_replace('#[^\x09\x0A\x0D\x20-\x7E\xA0-\x{2FF}\x{370}-\x{10FFFF}]#u', '', $s);
$s = strtr($s, '`\'"^~', "\x01\x02\x03\x04\x05");
if (ICONV_IMPL === 'glibc') {
$s = @iconv('UTF-8', 'WINDOWS-1250//TRANSLIT', $s); // intentionally @
$s = strtr($s, "\xa5\xa3\xbc\x8... | [
"public",
"static",
"function",
"toAscii",
"(",
"$",
"s",
")",
"{",
"$",
"s",
"=",
"preg_replace",
"(",
"'#[^\\x09\\x0A\\x0D\\x20-\\x7E\\xA0-\\x{2FF}\\x{370}-\\x{10FFFF}]#u'",
",",
"''",
",",
"$",
"s",
")",
";",
"$",
"s",
"=",
"strtr",
"(",
"$",
"s",
",",
... | Converts to ASCII.
@param string UTF-8 encoding
@return string ASCII
@author Nette Framework | [
"Converts",
"to",
"ASCII",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Strings.php#L410-L426 |
ondrakoupil/tools | src/Strings.php | Strings.formatSize | public static function formatSize($size, $decimalPrecision = 2) {
if ($size < 1024) return $size . ' B';
elseif ($size < 1048576) return round($size / 1024, $decimalPrecision) . ' kB';
elseif ($size < 1073741824) return round($size / 10... | php | public static function formatSize($size, $decimalPrecision = 2) {
if ($size < 1024) return $size . ' B';
elseif ($size < 1048576) return round($size / 1024, $decimalPrecision) . ' kB';
elseif ($size < 1073741824) return round($size / 10... | [
"public",
"static",
"function",
"formatSize",
"(",
"$",
"size",
",",
"$",
"decimalPrecision",
"=",
"2",
")",
"{",
"if",
"(",
"$",
"size",
"<",
"1024",
")",
"return",
"$",
"size",
".",
"' B'",
";",
"elseif",
"(",
"$",
"size",
"<",
"1048576",
")",
"r... | Převede číselnou velikost na textové výjádření v jednotkách velikosti (KB,MB,...)
@param $size
@return string | [
"Převede",
"číselnou",
"velikost",
"na",
"textové",
"výjádření",
"v",
"jednotkách",
"velikosti",
"(",
"KB",
"MB",
"...",
")"
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Strings.php#L454-L463 |
netgen/ngopengraph | autoloads/opengraphoperator.php | OpenGraphOperator.modify | function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace,
&$currentNamespace, &$operatorValue, &$namedParameters )
{
switch ( $operatorName )
{
case 'opengraph':
{
$operatorValue = $this->generateOpenGraphTags( $namedPar... | php | function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace,
&$currentNamespace, &$operatorValue, &$namedParameters )
{
switch ( $operatorName )
{
case 'opengraph':
{
$operatorValue = $this->generateOpenGraphTags( $namedPar... | [
"function",
"modify",
"(",
"&",
"$",
"tpl",
",",
"&",
"$",
"operatorName",
",",
"&",
"$",
"operatorParameters",
",",
"&",
"$",
"rootNamespace",
",",
"&",
"$",
"currentNamespace",
",",
"&",
"$",
"operatorValue",
",",
"&",
"$",
"namedParameters",
")",
"{",... | Executes the operators
@param eZTemplate $tpl
@param string $operatorName
@param array $operatorParameters
@param string $rootNamespace
@param string $currentNamespace
@param mixed $operatorValue
@param array $namedParameters | [
"Executes",
"the",
"operators"
] | train | https://github.com/netgen/ngopengraph/blob/68a99862f240ee74174ea9b888a9a33743142e27/autoloads/opengraphoperator.php#L78-L94 |
netgen/ngopengraph | autoloads/opengraphoperator.php | OpenGraphOperator.generateOpenGraphTags | function generateOpenGraphTags( $nodeID )
{
$this->ogIni = eZINI::instance( 'ngopengraph.ini' );
$this->facebookCompatible = $this->ogIni->variable( 'General', 'FacebookCompatible' );
$this->debug = $this->ogIni->variable( 'General', 'Debug' ) == 'enabled';
$availableClasses = $this... | php | function generateOpenGraphTags( $nodeID )
{
$this->ogIni = eZINI::instance( 'ngopengraph.ini' );
$this->facebookCompatible = $this->ogIni->variable( 'General', 'FacebookCompatible' );
$this->debug = $this->ogIni->variable( 'General', 'Debug' ) == 'enabled';
$availableClasses = $this... | [
"function",
"generateOpenGraphTags",
"(",
"$",
"nodeID",
")",
"{",
"$",
"this",
"->",
"ogIni",
"=",
"eZINI",
"::",
"instance",
"(",
"'ngopengraph.ini'",
")",
";",
"$",
"this",
"->",
"facebookCompatible",
"=",
"$",
"this",
"->",
"ogIni",
"->",
"variable",
"... | Executes opengraph operator
@param int|eZContentObjectTreeNode $nodeID
@return array | [
"Executes",
"opengraph",
"operator"
] | train | https://github.com/netgen/ngopengraph/blob/68a99862f240ee74174ea9b888a9a33743142e27/autoloads/opengraphoperator.php#L103-L148 |
netgen/ngopengraph | autoloads/opengraphoperator.php | OpenGraphOperator.processGenericData | function processGenericData( $contentNode )
{
$returnArray = array();
$siteName = trim( eZINI::instance()->variable( 'SiteSettings', 'SiteName' ) );
if ( !empty( $siteName ) )
{
$returnArray['og:site_name'] = $siteName;
}
$urlAlias = $contentNode->urlAli... | php | function processGenericData( $contentNode )
{
$returnArray = array();
$siteName = trim( eZINI::instance()->variable( 'SiteSettings', 'SiteName' ) );
if ( !empty( $siteName ) )
{
$returnArray['og:site_name'] = $siteName;
}
$urlAlias = $contentNode->urlAli... | [
"function",
"processGenericData",
"(",
"$",
"contentNode",
")",
"{",
"$",
"returnArray",
"=",
"array",
"(",
")",
";",
"$",
"siteName",
"=",
"trim",
"(",
"eZINI",
"::",
"instance",
"(",
")",
"->",
"variable",
"(",
"'SiteSettings'",
",",
"'SiteName'",
")",
... | Processes literal Open Graph metadata
@param eZContentObjectTreeNode $contentNode
@return array | [
"Processes",
"literal",
"Open",
"Graph",
"metadata"
] | train | https://github.com/netgen/ngopengraph/blob/68a99862f240ee74174ea9b888a9a33743142e27/autoloads/opengraphoperator.php#L157-L201 |
netgen/ngopengraph | autoloads/opengraphoperator.php | OpenGraphOperator.processObject | function processObject( $contentObject, $returnArray )
{
if ( $this->ogIni->hasVariable( $contentObject->contentClassIdentifier(), 'LiteralMap' ) )
{
$literalValues = $this->ogIni->variable( $contentObject->contentClassIdentifier(), 'LiteralMap' );
if ( $this->debug )
... | php | function processObject( $contentObject, $returnArray )
{
if ( $this->ogIni->hasVariable( $contentObject->contentClassIdentifier(), 'LiteralMap' ) )
{
$literalValues = $this->ogIni->variable( $contentObject->contentClassIdentifier(), 'LiteralMap' );
if ( $this->debug )
... | [
"function",
"processObject",
"(",
"$",
"contentObject",
",",
"$",
"returnArray",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ogIni",
"->",
"hasVariable",
"(",
"$",
"contentObject",
"->",
"contentClassIdentifier",
"(",
")",
",",
"'LiteralMap'",
")",
")",
"{",
... | Processes Open Graph metadata from object attributes
@param eZContentObject $contentObject
@param array $returnArray
@return array | [
"Processes",
"Open",
"Graph",
"metadata",
"from",
"object",
"attributes"
] | train | https://github.com/netgen/ngopengraph/blob/68a99862f240ee74174ea9b888a9a33743142e27/autoloads/opengraphoperator.php#L211-L281 |
netgen/ngopengraph | autoloads/opengraphoperator.php | OpenGraphOperator.checkRequirements | function checkRequirements( $returnArray )
{
$arrayKeys = array_keys( $returnArray );
if ( !in_array( 'og:title', $arrayKeys ) || !in_array( 'og:type', $arrayKeys ) ||
!in_array( 'og:image', $arrayKeys ) || !in_array( 'og:url', $arrayKeys ) )
{
if ( $this->debug )
... | php | function checkRequirements( $returnArray )
{
$arrayKeys = array_keys( $returnArray );
if ( !in_array( 'og:title', $arrayKeys ) || !in_array( 'og:type', $arrayKeys ) ||
!in_array( 'og:image', $arrayKeys ) || !in_array( 'og:url', $arrayKeys ) )
{
if ( $this->debug )
... | [
"function",
"checkRequirements",
"(",
"$",
"returnArray",
")",
"{",
"$",
"arrayKeys",
"=",
"array_keys",
"(",
"$",
"returnArray",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"'og:title'",
",",
"$",
"arrayKeys",
")",
"||",
"!",
"in_array",
"(",
"'og:type'",
... | Checks if all required Open Graph metadata are present
@param array $returnArray
@return bool | [
"Checks",
"if",
"all",
"required",
"Open",
"Graph",
"metadata",
"are",
"present"
] | train | https://github.com/netgen/ngopengraph/blob/68a99862f240ee74174ea9b888a9a33743142e27/autoloads/opengraphoperator.php#L290-L319 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Base/BaseScanner.php | BaseScanner.checkSourceAutoload | public function checkSourceAutoload($autoloadFile)
{
if (false === $this->coverFishHelper->checkFileExist($autoloadFile)) {
throw new \Exception(sprintf('autoload file "%s" not found! please define your autoload.php file to use (e.g. ../app/autoload.php in symfony)', $autoloadFile));
}
... | php | public function checkSourceAutoload($autoloadFile)
{
if (false === $this->coverFishHelper->checkFileExist($autoloadFile)) {
throw new \Exception(sprintf('autoload file "%s" not found! please define your autoload.php file to use (e.g. ../app/autoload.php in symfony)', $autoloadFile));
}
... | [
"public",
"function",
"checkSourceAutoload",
"(",
"$",
"autoloadFile",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"coverFishHelper",
"->",
"checkFileExist",
"(",
"$",
"autoloadFile",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"sprint... | check existence of given autoload file (raw/psr-0/psr-4)
@param string $autoloadFile
@return bool
@throws \Exception | [
"check",
"existence",
"of",
"given",
"autoload",
"file",
"(",
"raw",
"/",
"psr",
"-",
"0",
"/",
"psr",
"-",
"4",
")"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Base/BaseScanner.php#L262-L269 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Base/BaseScanner.php | BaseScanner.getAttributeFromXML | public function getAttributeFromXML($attribute, \SimpleXMLElement $xmlDocument)
{
/** @var \SimpleXMLElement $value */
foreach ($xmlDocument->attributes() as $key => $value) {
/** @var \SimpleXMLElement $attribute */
if ($attribute === $key) {
return (string) ... | php | public function getAttributeFromXML($attribute, \SimpleXMLElement $xmlDocument)
{
/** @var \SimpleXMLElement $value */
foreach ($xmlDocument->attributes() as $key => $value) {
/** @var \SimpleXMLElement $attribute */
if ($attribute === $key) {
return (string) ... | [
"public",
"function",
"getAttributeFromXML",
"(",
"$",
"attribute",
",",
"\\",
"SimpleXMLElement",
"$",
"xmlDocument",
")",
"{",
"/** @var \\SimpleXMLElement $value */",
"foreach",
"(",
"$",
"xmlDocument",
"->",
"attributes",
"(",
")",
"as",
"$",
"key",
"=>",
"$",... | get a testSuite main attribute of given phpunit xml file (like name, bootstrap ...)
@param string $attribute
@param \SimpleXMLElement $xmlDocument
@return bool|string | [
"get",
"a",
"testSuite",
"main",
"attribute",
"of",
"given",
"phpunit",
"xml",
"file",
"(",
"like",
"name",
"bootstrap",
"...",
")"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Base/BaseScanner.php#L279-L290 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Base/BaseScanner.php | BaseScanner.xmlToArray | public function xmlToArray($xmlObject, $output = array())
{
foreach ((array) $xmlObject as $index => $node) {
$output[$index] = ($node instanceof \SimpleXMLElement || is_array($node))
? $this->xmlToArray($node)
: $node;
}
return $output;
} | php | public function xmlToArray($xmlObject, $output = array())
{
foreach ((array) $xmlObject as $index => $node) {
$output[$index] = ($node instanceof \SimpleXMLElement || is_array($node))
? $this->xmlToArray($node)
: $node;
}
return $output;
} | [
"public",
"function",
"xmlToArray",
"(",
"$",
"xmlObject",
",",
"$",
"output",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"xmlObject",
"as",
"$",
"index",
"=>",
"$",
"node",
")",
"{",
"$",
"output",
"[",
"$",
"index",... | @param \SimpleXMLElement|array $xmlObject
@param array $output
@return array | [
"@param",
"\\",
"SimpleXMLElement|array",
"$xmlObject",
"@param",
"array",
"$output"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Base/BaseScanner.php#L342-L351 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Base/BaseScanner.php | BaseScanner.removeExcludedPath | public function removeExcludedPath(array $files, $excludePath)
{
$result = $includedFiles = array();
if (true === empty($excludePath)) {
return $files;
}
foreach ($files as $filePath) {
preg_match_all($this->coverFishHelper->getRegexPath($excludePath), $file... | php | public function removeExcludedPath(array $files, $excludePath)
{
$result = $includedFiles = array();
if (true === empty($excludePath)) {
return $files;
}
foreach ($files as $filePath) {
preg_match_all($this->coverFishHelper->getRegexPath($excludePath), $file... | [
"public",
"function",
"removeExcludedPath",
"(",
"array",
"$",
"files",
",",
"$",
"excludePath",
")",
"{",
"$",
"result",
"=",
"$",
"includedFiles",
"=",
"array",
"(",
")",
";",
"if",
"(",
"true",
"===",
"empty",
"(",
"$",
"excludePath",
")",
")",
"{",... | workaround for missing/buggy path exclude in symfony finder class
@param array $files
@param string $excludePath
@return array | [
"workaround",
"for",
"missing",
"/",
"buggy",
"path",
"exclude",
"in",
"symfony",
"finder",
"class"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Base/BaseScanner.php#L371-L387 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Base/BaseScanner.php | BaseScanner.scanFilesInPath | public function scanFilesInPath($sourcePath)
{
$filePattern = $this->filePattern;
if (strpos($sourcePath, str_replace('*', null, $filePattern))) {
$filePattern = $this->coverFishHelper->getFileNameFromPath($sourcePath);
}
$facade = new FinderFacade(
array($so... | php | public function scanFilesInPath($sourcePath)
{
$filePattern = $this->filePattern;
if (strpos($sourcePath, str_replace('*', null, $filePattern))) {
$filePattern = $this->coverFishHelper->getFileNameFromPath($sourcePath);
}
$facade = new FinderFacade(
array($so... | [
"public",
"function",
"scanFilesInPath",
"(",
"$",
"sourcePath",
")",
"{",
"$",
"filePattern",
"=",
"$",
"this",
"->",
"filePattern",
";",
"if",
"(",
"strpos",
"(",
"$",
"sourcePath",
",",
"str_replace",
"(",
"'*'",
",",
"null",
",",
"$",
"filePattern",
... | scan all files by given path recursively, if one php file will be provided within given path,
this file will be returned in finder format
@param string $sourcePath
@return array | [
"scan",
"all",
"files",
"by",
"given",
"path",
"recursively",
"if",
"one",
"php",
"file",
"will",
"be",
"provided",
"within",
"given",
"path",
"this",
"file",
"will",
"be",
"returned",
"in",
"finder",
"format"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Base/BaseScanner.php#L397-L411 |
yuncms/framework | src/rest/ErrorAction.php | ErrorAction.init | public function init()
{
$this->exception = $this->findException();
if ($this->defaultMessage === null) {
$this->defaultMessage = Yii::t('yii', 'An internal server error occurred.');
}
if ($this->defaultName === null) {
$this->defaultName = Yii::t('yuncms', 'E... | php | public function init()
{
$this->exception = $this->findException();
if ($this->defaultMessage === null) {
$this->defaultMessage = Yii::t('yii', 'An internal server error occurred.');
}
if ($this->defaultName === null) {
$this->defaultName = Yii::t('yuncms', 'E... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"exception",
"=",
"$",
"this",
"->",
"findException",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"defaultMessage",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"defaultMessage",
"=",
"Y... | {@inheritdoc} | [
"{"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/ErrorAction.php#L72-L81 |
yuncms/framework | src/rest/ErrorAction.php | ErrorAction.getExceptionName | protected function getExceptionName()
{
if ($this->exception instanceof Exception) {
$name = $this->exception->getName();
} elseif ($this->exception instanceof ErrorException) {
$name = $this->exception->getName();
} else {
$name = $this->defaultName;
... | php | protected function getExceptionName()
{
if ($this->exception instanceof Exception) {
$name = $this->exception->getName();
} elseif ($this->exception instanceof ErrorException) {
$name = $this->exception->getName();
} else {
$name = $this->defaultName;
... | [
"protected",
"function",
"getExceptionName",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exception",
"instanceof",
"Exception",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"exception",
"->",
"getName",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"this... | Returns the exception name, followed by the code (if present).
@return string | [
"Returns",
"the",
"exception",
"name",
"followed",
"by",
"the",
"code",
"(",
"if",
"present",
")",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/ErrorAction.php#L132-L142 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.& | public static function &getNameFromInstance($instance)
{
static $namnes;
if (!isset($namnes)) {
$namnes = array();
}
//only create a new plugin instance if it has not been created before
if (!isset($namnes[$instance])) {
$db = static::getDbo();
$query = $db->getQuery(true)
->select('original_na... | php | public static function &getNameFromInstance($instance)
{
static $namnes;
if (!isset($namnes)) {
$namnes = array();
}
//only create a new plugin instance if it has not been created before
if (!isset($namnes[$instance])) {
$db = static::getDbo();
$query = $db->getQuery(true)
->select('original_na... | [
"public",
"static",
"function",
"&",
"getNameFromInstance",
"(",
"$",
"instance",
")",
"{",
"static",
"$",
"namnes",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"namnes",
")",
")",
"{",
"$",
"namnes",
"=",
"array",
"(",
")",
";",
"}",
"//only create a new ... | Gets an Fusion front object
@param string $instance name of the JFusion plugin used
@return string object for the JFusion plugin | [
"Gets",
"an",
"Fusion",
"front",
"object"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L115-L139 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.& | public static function &getFront($instance)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
//only create a new plugin instance if it has not been created before
if (!isset($instances[$instance])) {
$name = static::getNameFromInstance($instance);
static::pluginAutoLoad($name)... | php | public static function &getFront($instance)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
//only create a new plugin instance if it has not been created before
if (!isset($instances[$instance])) {
$name = static::getNameFromInstance($instance);
static::pluginAutoLoad($name)... | [
"public",
"static",
"function",
"&",
"getFront",
"(",
"$",
"instance",
")",
"{",
"static",
"$",
"instances",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"instances",
")",
")",
"{",
"$",
"instances",
"=",
"array",
"(",
")",
";",
"}",
"//only create a new pl... | Gets an Fusion front object
@param string $instance name of the JFusion plugin used
@return Front object for the JFusion plugin | [
"Gets",
"an",
"Fusion",
"front",
"object"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L148-L167 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.& | public static function &getAdmin($instance)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
//only create a new plugin instance if it has not been created before
if (!isset($instances[$instance])) {
$name = static::getNameFromInstance($instance);
static::pluginAutoLoad($name)... | php | public static function &getAdmin($instance)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
//only create a new plugin instance if it has not been created before
if (!isset($instances[$instance])) {
$name = static::getNameFromInstance($instance);
static::pluginAutoLoad($name)... | [
"public",
"static",
"function",
"&",
"getAdmin",
"(",
"$",
"instance",
")",
"{",
"static",
"$",
"instances",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"instances",
")",
")",
"{",
"$",
"instances",
"=",
"array",
"(",
")",
";",
"}",
"//only create a new pl... | Gets an Fusion front object
@param string $instance name of the JFusion plugin used
@return Admin object for the JFusion plugin | [
"Gets",
"an",
"Fusion",
"front",
"object"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L175-L194 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.& | public static function &getAuth($instance)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
//only create a new authentication instance if it has not been created before
if (!isset($instances[$instance])) {
$name = static::getNameFromInstance($instance);
static::pluginAutoLoad... | php | public static function &getAuth($instance)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
//only create a new authentication instance if it has not been created before
if (!isset($instances[$instance])) {
$name = static::getNameFromInstance($instance);
static::pluginAutoLoad... | [
"public",
"static",
"function",
"&",
"getAuth",
"(",
"$",
"instance",
")",
"{",
"static",
"$",
"instances",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"instances",
")",
")",
"{",
"$",
"instances",
"=",
"array",
"(",
")",
";",
"}",
"//only create a new aut... | Gets an Authentication Class for the JFusion Plugin
@param string $instance name of the JFusion plugin used
@return Auth JFusion Authentication class for the JFusion plugin | [
"Gets",
"an",
"Authentication",
"Class",
"for",
"the",
"JFusion",
"Plugin"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L203-L222 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.& | public static function &getUser($instance)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
//only create a new user instance if it has not been created before
if (!isset($instances[$instance])) {
$name = static::getNameFromInstance($instance);
static::pluginAutoLoad($name);
... | php | public static function &getUser($instance)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
//only create a new user instance if it has not been created before
if (!isset($instances[$instance])) {
$name = static::getNameFromInstance($instance);
static::pluginAutoLoad($name);
... | [
"public",
"static",
"function",
"&",
"getUser",
"(",
"$",
"instance",
")",
"{",
"static",
"$",
"instances",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"instances",
")",
")",
"{",
"$",
"instances",
"=",
"array",
"(",
")",
";",
"}",
"//only create a new use... | Gets an User Class for the JFusion Plugin
@param string $instance name of the JFusion plugin used
@return User JFusion User class for the JFusion plugin | [
"Gets",
"an",
"User",
"Class",
"for",
"the",
"JFusion",
"Plugin"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L231-L250 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.& | public static function &getPlatform($platform, $instance)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
$platform = ucfirst(strtolower($platform));
//only create a new thread instance if it has not been created before
if (!isset($instances[$platform][$instance])) {
$name = ... | php | public static function &getPlatform($platform, $instance)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
$platform = ucfirst(strtolower($platform));
//only create a new thread instance if it has not been created before
if (!isset($instances[$platform][$instance])) {
$name = ... | [
"public",
"static",
"function",
"&",
"getPlatform",
"(",
"$",
"platform",
",",
"$",
"instance",
")",
"{",
"static",
"$",
"instances",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"instances",
")",
")",
"{",
"$",
"instances",
"=",
"array",
"(",
")",
";",
... | Gets a Forum Class for the JFusion Plugin
@param string $platform
@param string $instance name of the JFusion plugin used
@return Platform JFusion Thread class for the JFusion plugin | [
"Gets",
"a",
"Forum",
"Class",
"for",
"the",
"JFusion",
"Plugin"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L260-L285 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.& | public static function &getHelper($instance)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
//only create a new thread instance if it has not been created before
if (!isset($instances[$instance])) {
$name = static::getNameFromInstance($instance);
static::pluginAutoLoad($name... | php | public static function &getHelper($instance)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
//only create a new thread instance if it has not been created before
if (!isset($instances[$instance])) {
$name = static::getNameFromInstance($instance);
static::pluginAutoLoad($name... | [
"public",
"static",
"function",
"&",
"getHelper",
"(",
"$",
"instance",
")",
"{",
"static",
"$",
"instances",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"instances",
")",
")",
"{",
"$",
"instances",
"=",
"array",
"(",
")",
";",
"}",
"//only create a new t... | Gets a Helper Class for the JFusion Plugin which is only used internally by the plugin
@param string $instance name of the JFusion plugin used
@return Plugin|false JFusion Helper class for the JFusion plugin | [
"Gets",
"a",
"Helper",
"Class",
"for",
"the",
"JFusion",
"Plugin",
"which",
"is",
"only",
"used",
"internally",
"by",
"the",
"plugin"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L294-L314 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.& | public static function &getDatabase($jname)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
//only create a new database instance if it has not been created before
if (!isset($instances[$jname])) {
/**
* TODO: MUST BE CHANGED! as do not rely on joomla_int
*/
if ($jname... | php | public static function &getDatabase($jname)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
//only create a new database instance if it has not been created before
if (!isset($instances[$jname])) {
/**
* TODO: MUST BE CHANGED! as do not rely on joomla_int
*/
if ($jname... | [
"public",
"static",
"function",
"&",
"getDatabase",
"(",
"$",
"jname",
")",
"{",
"static",
"$",
"instances",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"instances",
")",
")",
"{",
"$",
"instances",
"=",
"array",
"(",
")",
";",
"}",
"//only create a new da... | Gets an Database Connection for the JFusion Plugin
@param string $jname name of the JFusion plugin used
@return DatabaseDriver Database connection for the JFusion plugin
@throws RuntimeException | [
"Gets",
"an",
"Database",
"Connection",
"for",
"the",
"JFusion",
"Plugin"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L338-L380 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.& | public static function &getParams($jname, $reset = false)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
try {
//only create a new parameter instance if it has not been created before
if (!isset($instances[$jname]) || $reset) {
$db = self::getDBO();
$query = $db->getQ... | php | public static function &getParams($jname, $reset = false)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
try {
//only create a new parameter instance if it has not been created before
if (!isset($instances[$jname]) || $reset) {
$db = self::getDBO();
$query = $db->getQ... | [
"public",
"static",
"function",
"&",
"getParams",
"(",
"$",
"jname",
",",
"$",
"reset",
"=",
"false",
")",
"{",
"static",
"$",
"instances",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"instances",
")",
")",
"{",
"$",
"instances",
"=",
"array",
"(",
")"... | Gets an Parameter Object for the JFusion Plugin
@param string $jname name of the JFusion plugin used
@param boolean $reset switch to force a recreate of the instance
@return Registry JParam object for the JFusion plugin | [
"Gets",
"an",
"Parameter",
"Object",
"for",
"the",
"JFusion",
"Plugin"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L390-L415 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.getPlugins | public static function getPlugins($criteria = 'both', $exclude = false, $status = 2)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
$db = self::getDBO();
$query = $db->getQuery(true)
->select('*')
->from('#__jfusion');
$key = $criteria . '_' . $exclude . '_' . $status;
... | php | public static function getPlugins($criteria = 'both', $exclude = false, $status = 2)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
$db = self::getDBO();
$query = $db->getQuery(true)
->select('*')
->from('#__jfusion');
$key = $criteria . '_' . $exclude . '_' . $status;
... | [
"public",
"static",
"function",
"getPlugins",
"(",
"$",
"criteria",
"=",
"'both'",
",",
"$",
"exclude",
"=",
"false",
",",
"$",
"status",
"=",
"2",
")",
"{",
"static",
"$",
"instances",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"instances",
")",
")",
... | returns array of plugins depending on the arguments
@param string $criteria the type of plugins to retrieve Use: master | slave | both
@param string|boolean $exclude should we exclude joomla_int
@param int $status only plugins with status equal or higher.
@return array|stdClass plugin details | [
"returns",
"array",
"of",
"plugins",
"depending",
"on",
"the",
"arguments"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L426-L466 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.getPluginNodeId | public static function getPluginNodeId($jname) {
$params = static::getParams($jname);
$source_url = $params->get('source_url');
return strtolower(rtrim(parse_url($source_url, PHP_URL_HOST) . parse_url($source_url, PHP_URL_PATH), '/'));
} | php | public static function getPluginNodeId($jname) {
$params = static::getParams($jname);
$source_url = $params->get('source_url');
return strtolower(rtrim(parse_url($source_url, PHP_URL_HOST) . parse_url($source_url, PHP_URL_PATH), '/'));
} | [
"public",
"static",
"function",
"getPluginNodeId",
"(",
"$",
"jname",
")",
"{",
"$",
"params",
"=",
"static",
"::",
"getParams",
"(",
"$",
"jname",
")",
";",
"$",
"source_url",
"=",
"$",
"params",
"->",
"get",
"(",
"'source_url'",
")",
";",
"return",
"... | Gets the jnode_id for the JFusion Plugin
@param string $jname name of the JFusion plugin used
@return string jnodeid for the JFusion Plugin | [
"Gets",
"the",
"jnode_id",
"for",
"the",
"JFusion",
"Plugin"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L473-L477 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.getPluginNameFromNodeId | public static function getPluginNameFromNodeId($jnode_id) {
$result = '';
//$jid = $jnode_id;
$plugins = static::getPlugins('both');
foreach($plugins as $plugin) {
$id = rtrim(static::getPluginNodeId($plugin->name), '/');
if (strcasecmp($jnode_id, $id) == 0) {
$result = $plugin->name;
break;
}
... | php | public static function getPluginNameFromNodeId($jnode_id) {
$result = '';
//$jid = $jnode_id;
$plugins = static::getPlugins('both');
foreach($plugins as $plugin) {
$id = rtrim(static::getPluginNodeId($plugin->name), '/');
if (strcasecmp($jnode_id, $id) == 0) {
$result = $plugin->name;
break;
}
... | [
"public",
"static",
"function",
"getPluginNameFromNodeId",
"(",
"$",
"jnode_id",
")",
"{",
"$",
"result",
"=",
"''",
";",
"//$jid = $jnode_id;",
"$",
"plugins",
"=",
"static",
"::",
"getPlugins",
"(",
"'both'",
")",
";",
"foreach",
"(",
"$",
"plugins",
"as",... | Gets the plugin name for a JFusion Plugin given the jnodeid
@param string $jnode_id jnodeid to use
@return string jname name for the JFusion Plugin, empty if no plugin found | [
"Gets",
"the",
"plugin",
"name",
"for",
"a",
"JFusion",
"Plugin",
"given",
"the",
"jnodeid",
"@param",
"string",
"$jnode_id",
"jnodeid",
"to",
"use"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L484-L496 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.& | public static function &getCookies() {
static $instance;
//only create a new plugin instance if it has not been created before
if (!isset($instance)) {
$instance = new Cookies(Config::get()->get('apikey'));
}
return $instance;
} | php | public static function &getCookies() {
static $instance;
//only create a new plugin instance if it has not been created before
if (!isset($instance)) {
$instance = new Cookies(Config::get()->get('apikey'));
}
return $instance;
} | [
"public",
"static",
"function",
"&",
"getCookies",
"(",
")",
"{",
"static",
"$",
"instance",
";",
"//only create a new plugin instance if it has not been created before",
"if",
"(",
"!",
"isset",
"(",
"$",
"instance",
")",
")",
"{",
"$",
"instance",
"=",
"new",
... | Gets an JFusion cross domain cookie object
@return Cookies object for the JFusion cookies | [
"Gets",
"an",
"JFusion",
"cross",
"domain",
"cookie",
"object"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L503-L510 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.getDbo | public static function getDbo()
{
if (!self::$database)
{
//get config values
$host = Config::get()->get('database.host');
$user = Config::get()->get('database.user');
$password = Config::get()->get('database.password');
$database = Config::get()->get('database.name');
$prefix = Config::get()->g... | php | public static function getDbo()
{
if (!self::$database)
{
//get config values
$host = Config::get()->get('database.host');
$user = Config::get()->get('database.user');
$password = Config::get()->get('database.password');
$database = Config::get()->get('database.name');
$prefix = Config::get()->g... | [
"public",
"static",
"function",
"getDbo",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"database",
")",
"{",
"//get config values",
"$",
"host",
"=",
"Config",
"::",
"get",
"(",
")",
"->",
"get",
"(",
"'database.host'",
")",
";",
"$",
"user",
"=... | Get a database object.
Returns the global {@link Driver} object, only creating it if it doesn't already exist.
@return DatabaseDriver | [
"Get",
"a",
"database",
"object",
"."
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L519-L543 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.getLanguage | public static function getLanguage()
{
if (!self::$language)
{
$locale = Config::get()->get('language.language');
$debug = Config::get()->get('language.debug');
self::$language = Language::getInstance($locale, $debug);
Text::setLanguage(self::$language);
}
return self::$language;
} | php | public static function getLanguage()
{
if (!self::$language)
{
$locale = Config::get()->get('language.language');
$debug = Config::get()->get('language.debug');
self::$language = Language::getInstance($locale, $debug);
Text::setLanguage(self::$language);
}
return self::$language;
} | [
"public",
"static",
"function",
"getLanguage",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"language",
")",
"{",
"$",
"locale",
"=",
"Config",
"::",
"get",
"(",
")",
"->",
"get",
"(",
"'language.language'",
")",
";",
"$",
"debug",
"=",
"Config"... | Get a language object.
Returns the global {@link JLanguage} object, only creating it if it doesn't already exist.
@return Language object
@see Language
@since 11.1 | [
"Get",
"a",
"language",
"object",
"."
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L555-L566 |
jfusion/org.jfusion.framework | src/Factory.php | Factory.getDate | public static function getDate($time = 'now', $tzOffset = null)
{
static $classname;
static $mainLocale;
$language = self::getLanguage();
$locale = $language->getTag();
if (!isset($classname) || $locale != $mainLocale)
{
// Store the locale for future reference
$mainLocale = $locale;
if ($mainL... | php | public static function getDate($time = 'now', $tzOffset = null)
{
static $classname;
static $mainLocale;
$language = self::getLanguage();
$locale = $language->getTag();
if (!isset($classname) || $locale != $mainLocale)
{
// Store the locale for future reference
$mainLocale = $locale;
if ($mainL... | [
"public",
"static",
"function",
"getDate",
"(",
"$",
"time",
"=",
"'now'",
",",
"$",
"tzOffset",
"=",
"null",
")",
"{",
"static",
"$",
"classname",
";",
"static",
"$",
"mainLocale",
";",
"$",
"language",
"=",
"self",
"::",
"getLanguage",
"(",
")",
";",... | Return the {@link JDate} object
@param mixed $time The initial time for the JDate object
@param mixed $tzOffset The timezone offset.
@return Date object
@see Date
@since 11.1 | [
"Return",
"the",
"{",
"@link",
"JDate",
"}",
"object"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Factory.php#L579-L619 |
ClanCats/Core | src/classes/CCRouter.php | CCRouter._init | public static function _init()
{
// default string
static::filter( 'any', '[a-zA-Z0-9'.ClanCats::$config->get( 'router.allowed_special_chars' ).']' );
// only numbers
static::filter( 'num', '[0-9]' );
// only alpha characters
static::filter( 'alpha', '[a-zA-Z]' );
// only alphanumeric characte... | php | public static function _init()
{
// default string
static::filter( 'any', '[a-zA-Z0-9'.ClanCats::$config->get( 'router.allowed_special_chars' ).']' );
// only numbers
static::filter( 'num', '[0-9]' );
// only alpha characters
static::filter( 'alpha', '[a-zA-Z]' );
// only alphanumeric characte... | [
"public",
"static",
"function",
"_init",
"(",
")",
"{",
"// default string",
"static",
"::",
"filter",
"(",
"'any'",
",",
"'[a-zA-Z0-9'",
".",
"ClanCats",
"::",
"$",
"config",
"->",
"get",
"(",
"'router.allowed_special_chars'",
")",
".",
"']'",
")",
";",
"//... | Set up the basic uri filters in our static init and
also add a default 404 response
@return void | [
"Set",
"up",
"the",
"basic",
"uri",
"filters",
"in",
"our",
"static",
"init",
"and",
"also",
"add",
"a",
"default",
"404",
"response"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCRouter.php#L64-L83 |
ClanCats/Core | src/classes/CCRouter.php | CCRouter.alias | public static function alias( $key, $to = null )
{
if ( is_null( $to ) || is_array( $to ) )
{
if ( array_key_exists( $key, static::$aliases ) )
{
if ( is_array( $to ) )
{
// Workaround for HHVM: return preg_replace( "/\[\w+\]/e", 'array_shift($to)', static::$aliases[$key] );
$return = sta... | php | public static function alias( $key, $to = null )
{
if ( is_null( $to ) || is_array( $to ) )
{
if ( array_key_exists( $key, static::$aliases ) )
{
if ( is_array( $to ) )
{
// Workaround for HHVM: return preg_replace( "/\[\w+\]/e", 'array_shift($to)', static::$aliases[$key] );
$return = sta... | [
"public",
"static",
"function",
"alias",
"(",
"$",
"key",
",",
"$",
"to",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"to",
")",
"||",
"is_array",
"(",
"$",
"to",
")",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"s... | Creates an alias to a route or gets one
@param string $key
@param string $to
@return void | false | [
"Creates",
"an",
"alias",
"to",
"a",
"route",
"or",
"gets",
"one"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCRouter.php#L92-L115 |
ClanCats/Core | src/classes/CCRouter.php | CCRouter.events_matching | public static function events_matching( $event, $rule )
{
if ( !array_key_exists( $event, static::$events ) )
{
return array();
}
$callbacks = array();
foreach( static::$events[$event] as $route => $events )
{
$rgx = "~^".str_replace( '*', '(.*)', $route )."$~";
if ( preg_match( $rgx, $rule ... | php | public static function events_matching( $event, $rule )
{
if ( !array_key_exists( $event, static::$events ) )
{
return array();
}
$callbacks = array();
foreach( static::$events[$event] as $route => $events )
{
$rgx = "~^".str_replace( '*', '(.*)', $route )."$~";
if ( preg_match( $rgx, $rule ... | [
"public",
"static",
"function",
"events_matching",
"(",
"$",
"event",
",",
"$",
"rule",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"event",
",",
"static",
"::",
"$",
"events",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
... | Get all events matching a rule
@param string $event
@param string $route
@param mixed $callback
@return void | [
"Get",
"all",
"events",
"matching",
"a",
"rule"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCRouter.php#L138-L157 |
ClanCats/Core | src/classes/CCRouter.php | CCRouter.on | public static function on( $param1, $param2 = null, $param3 = null )
{
// call contains options
if ( !is_null( $param3 ) && !is_callable( $param2 ) )
{
// if the param2 is a string we going to use it as alias
if ( is_string( $param2 ) )
{
static::alias( $param2, $param1 );
}
elseif ( is_ar... | php | public static function on( $param1, $param2 = null, $param3 = null )
{
// call contains options
if ( !is_null( $param3 ) && !is_callable( $param2 ) )
{
// if the param2 is a string we going to use it as alias
if ( is_string( $param2 ) )
{
static::alias( $param2, $param1 );
}
elseif ( is_ar... | [
"public",
"static",
"function",
"on",
"(",
"$",
"param1",
",",
"$",
"param2",
"=",
"null",
",",
"$",
"param3",
"=",
"null",
")",
"{",
"// call contains options",
"if",
"(",
"!",
"is_null",
"(",
"$",
"param3",
")",
"&&",
"!",
"is_callable",
"(",
"$",
... | Add a route to the router
example:
CCRouter::on( 'user/mario', function(){} )
CCRouter::on( 'user/mario', array( 'alias' => 'profile' ), function(){} )
@param mixed $param1
@param mixed $param2
@param mixed $param3
@return void | [
"Add",
"a",
"route",
"to",
"the",
"router"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCRouter.php#L171-L209 |
ClanCats/Core | src/classes/CCRouter.php | CCRouter.prepare | protected static function prepare( $routes )
{
// flatten if needed
if ( ClanCats::$config->get( 'router.flatten_routes' ) )
{
$routes = static::flatten( $routes );
}
foreach( $routes as $uri => $route )
{
// check for an alias to a private
if ( is_string( $route ) )
{
if ( substr... | php | protected static function prepare( $routes )
{
// flatten if needed
if ( ClanCats::$config->get( 'router.flatten_routes' ) )
{
$routes = static::flatten( $routes );
}
foreach( $routes as $uri => $route )
{
// check for an alias to a private
if ( is_string( $route ) )
{
if ( substr... | [
"protected",
"static",
"function",
"prepare",
"(",
"$",
"routes",
")",
"{",
"// flatten if needed",
"if",
"(",
"ClanCats",
"::",
"$",
"config",
"->",
"get",
"(",
"'router.flatten_routes'",
")",
")",
"{",
"$",
"routes",
"=",
"static",
"::",
"flatten",
"(",
... | Prepare the routes assing them to their containers
@param array $routes
@return void | [
"Prepare",
"the",
"routes",
"assing",
"them",
"to",
"their",
"containers"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCRouter.php#L217-L263 |
ClanCats/Core | src/classes/CCRouter.php | CCRouter.flatten | protected static function flatten( $routes, $param_prefix = '' )
{
$flattened = array();
foreach( $routes as $prefix => $route )
{
if ( is_array( $route ) && !is_callable( $route ) )
{
$flattened = array_merge( static::flatten( $route, $param_prefix.$prefix.'/' ), $flattened );
}
else
... | php | protected static function flatten( $routes, $param_prefix = '' )
{
$flattened = array();
foreach( $routes as $prefix => $route )
{
if ( is_array( $route ) && !is_callable( $route ) )
{
$flattened = array_merge( static::flatten( $route, $param_prefix.$prefix.'/' ), $flattened );
}
else
... | [
"protected",
"static",
"function",
"flatten",
"(",
"$",
"routes",
",",
"$",
"param_prefix",
"=",
"''",
")",
"{",
"$",
"flattened",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"routes",
"as",
"$",
"prefix",
"=>",
"$",
"route",
")",
"{",
"if",
... | Flatten the routes
@param array $routes
@param string $param_prefix
@return array | [
"Flatten",
"the",
"routes"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCRouter.php#L284-L311 |
ClanCats/Core | src/classes/CCRouter.php | CCRouter.resolve | public static function resolve( $uri )
{
// cut unnecessary slashes and params
if ( substr( $uri, -1 ) == '/' )
{
$uri = substr( $uri, 0, -1 );
}
if ( substr( $uri, 0, 1 ) == '/' )
{
$uri = substr( $uri, 1 );
}
$uri = CCStr::cut( $uri, '?' );
// create new route instance
$route =... | php | public static function resolve( $uri )
{
// cut unnecessary slashes and params
if ( substr( $uri, -1 ) == '/' )
{
$uri = substr( $uri, 0, -1 );
}
if ( substr( $uri, 0, 1 ) == '/' )
{
$uri = substr( $uri, 1 );
}
$uri = CCStr::cut( $uri, '?' );
// create new route instance
$route =... | [
"public",
"static",
"function",
"resolve",
"(",
"$",
"uri",
")",
"{",
"// cut unnecessary slashes and params",
"if",
"(",
"substr",
"(",
"$",
"uri",
",",
"-",
"1",
")",
"==",
"'/'",
")",
"{",
"$",
"uri",
"=",
"substr",
"(",
"$",
"uri",
",",
"0",
",",... | Resolve an uri and get the route object
@param string $uri
@return CCRoute | [
"Resolve",
"an",
"uri",
"and",
"get",
"the",
"route",
"object"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCRouter.php#L319-L443 |
ClanCats/Core | src/classes/CCRouter.php | CCRouter.configure | protected static function configure( $route, $raw_route )
{
// deal with emptiness
if ( is_null( $raw_route ) )
{
return false;
}
// this might be a controller
if ( is_string( $raw_route ) )
{
// are there overwrite parameters?
if ( strpos( $raw_route, '?' ) !== false )
{
$route->pa... | php | protected static function configure( $route, $raw_route )
{
// deal with emptiness
if ( is_null( $raw_route ) )
{
return false;
}
// this might be a controller
if ( is_string( $raw_route ) )
{
// are there overwrite parameters?
if ( strpos( $raw_route, '?' ) !== false )
{
$route->pa... | [
"protected",
"static",
"function",
"configure",
"(",
"$",
"route",
",",
"$",
"raw_route",
")",
"{",
"// deal with emptiness",
"if",
"(",
"is_null",
"(",
"$",
"raw_route",
")",
")",
"{",
"return",
"false",
";",
"}",
"// this might be a controller",
"if",
"(",
... | Check and complete a route
@param CCRoute $route
@param mixed $raw_route
@return false|CCRoute | [
"Check",
"and",
"complete",
"a",
"route"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCRouter.php#L452-L489 |
shrink0r/workflux | src/State/ExecutionTracker.php | ExecutionTracker.track | public function track(StateInterface $state): int
{
$this->breadcrumbs->push($state->getName());
$this->execution_counts[$state->getName()]++;
return $this->execution_counts[$state->getName()];
} | php | public function track(StateInterface $state): int
{
$this->breadcrumbs->push($state->getName());
$this->execution_counts[$state->getName()]++;
return $this->execution_counts[$state->getName()];
} | [
"public",
"function",
"track",
"(",
"StateInterface",
"$",
"state",
")",
":",
"int",
"{",
"$",
"this",
"->",
"breadcrumbs",
"->",
"push",
"(",
"$",
"state",
"->",
"getName",
"(",
")",
")",
";",
"$",
"this",
"->",
"execution_counts",
"[",
"$",
"state",
... | @param StateInterface $state
@return int | [
"@param",
"StateInterface",
"$state"
] | train | https://github.com/shrink0r/workflux/blob/008f45c64f52b1f795ab7f6ddbfc1a55580254d9/src/State/ExecutionTracker.php#L46-L51 |
fyuze/framework | src/Fyuze/Http/Message/Response.php | Response.withStatus | public function withStatus($code, $reasonPhrase = '')
{
$instance = clone $this;
$code = (int)$code;
if (is_float($code) || $code < 100 || $code >= 600) {
throw new \InvalidArgumentException(sprintf('Invalid status code %d', $code));
}
$instance->statusCode = $co... | php | public function withStatus($code, $reasonPhrase = '')
{
$instance = clone $this;
$code = (int)$code;
if (is_float($code) || $code < 100 || $code >= 600) {
throw new \InvalidArgumentException(sprintf('Invalid status code %d', $code));
}
$instance->statusCode = $co... | [
"public",
"function",
"withStatus",
"(",
"$",
"code",
",",
"$",
"reasonPhrase",
"=",
"''",
")",
"{",
"$",
"instance",
"=",
"clone",
"$",
"this",
";",
"$",
"code",
"=",
"(",
"int",
")",
"$",
"code",
";",
"if",
"(",
"is_float",
"(",
"$",
"code",
")... | {@inheritdoc}
@link http://tools.ietf.org/html/rfc7231#section-6
@link http://www.iana.org/assignments/http-status-code s/http-status-codes.xhtml
@param int $code The 3-digit integer result code to set.
@param string $reasonPhrase
@return self
@throws \InvalidArgumentException For invalid status code arguments. | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/fyuze/framework/blob/89b3984f7225e24bfcdafb090ee197275b3222c9/src/Fyuze/Http/Message/Response.php#L108-L119 |
ixudra/generators | src/Commands/GenerateFileCommand.php | GenerateFileCommand.deriveArguments | protected function deriveArguments()
{
$this->tableName = strtolower( $this->getPluralResourceName() );
$this->classSingular = $this->getSingularClassName();
$this->classPlural = $this->getPluralClassName();
$this->variableSingular = $this->getSingularVariableName();
$this-... | php | protected function deriveArguments()
{
$this->tableName = strtolower( $this->getPluralResourceName() );
$this->classSingular = $this->getSingularClassName();
$this->classPlural = $this->getPluralClassName();
$this->variableSingular = $this->getSingularVariableName();
$this-... | [
"protected",
"function",
"deriveArguments",
"(",
")",
"{",
"$",
"this",
"->",
"tableName",
"=",
"strtolower",
"(",
"$",
"this",
"->",
"getPluralResourceName",
"(",
")",
")",
";",
"$",
"this",
"->",
"classSingular",
"=",
"$",
"this",
"->",
"getSingularClassNa... | - Value deduction --- | [
"-",
"Value",
"deduction",
"---"
] | train | https://github.com/ixudra/generators/blob/3fa16efa157716f1425afa7a252b87df0d248a14/src/Commands/GenerateFileCommand.php#L79-L91 |
ixudra/generators | src/Commands/GenerateFileCommand.php | GenerateFileCommand.generateFromTemplate | protected function generateFromTemplate($template, $fileName, $path)
{
$file = $this->loadTemplate($template);
$content = $this->replaceValues( $file );
$this->createFile( $fileName, $path, $content );
return true;
} | php | protected function generateFromTemplate($template, $fileName, $path)
{
$file = $this->loadTemplate($template);
$content = $this->replaceValues( $file );
$this->createFile( $fileName, $path, $content );
return true;
} | [
"protected",
"function",
"generateFromTemplate",
"(",
"$",
"template",
",",
"$",
"fileName",
",",
"$",
"path",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"loadTemplate",
"(",
"$",
"template",
")",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"repla... | - File generation --- | [
"-",
"File",
"generation",
"---"
] | train | https://github.com/ixudra/generators/blob/3fa16efa157716f1425afa7a252b87df0d248a14/src/Commands/GenerateFileCommand.php#L96-L103 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Section/Header.php | PHPWord_Section_Header.addTable | public function addTable($style = null) {
$table = new PHPWord_Section_Table('header', $this->_headerCount, $style);
$this->_elementCollection[] = $table;
return $table;
} | php | public function addTable($style = null) {
$table = new PHPWord_Section_Table('header', $this->_headerCount, $style);
$this->_elementCollection[] = $table;
return $table;
} | [
"public",
"function",
"addTable",
"(",
"$",
"style",
"=",
"null",
")",
"{",
"$",
"table",
"=",
"new",
"PHPWord_Section_Table",
"(",
"'header'",
",",
"$",
"this",
"->",
"_headerCount",
",",
"$",
"style",
")",
";",
"$",
"this",
"->",
"_elementCollection",
... | Add a Table Element
@param mixed $style
@return PHPWord_Section_Table | [
"Add",
"a",
"Table",
"Element"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Section/Header.php#L108-L112 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Section/Header.php | PHPWord_Section_Header.addImage | public function addImage($src, $style = null) {
$image = new PHPWord_Section_Image($src, $style);
if(!is_null($image->getSource())) {
$rID = PHPWord_Media::addHeaderMediaElement($this->_headerCount, $src);
$image->setRelationId($rID);
$this->_elementCollection[] = $image;
return $image;
... | php | public function addImage($src, $style = null) {
$image = new PHPWord_Section_Image($src, $style);
if(!is_null($image->getSource())) {
$rID = PHPWord_Media::addHeaderMediaElement($this->_headerCount, $src);
$image->setRelationId($rID);
$this->_elementCollection[] = $image;
return $image;
... | [
"public",
"function",
"addImage",
"(",
"$",
"src",
",",
"$",
"style",
"=",
"null",
")",
"{",
"$",
"image",
"=",
"new",
"PHPWord_Section_Image",
"(",
"$",
"src",
",",
"$",
"style",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"image",
"->",
"getSo... | Add a Image Element
@param string $src
@param mixed $style
@return PHPWord_Section_Image | [
"Add",
"a",
"Image",
"Element"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Section/Header.php#L121-L133 |
egeloen/IvorySerializerBundle | DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = $this->createTreeBuilder();
$treeBuilder->root('ivory_serializer')
->children()
->append($this->createEventNode())
->append($this->createMappingNode())
->append($this->createTypesNode())
... | php | public function getConfigTreeBuilder()
{
$treeBuilder = $this->createTreeBuilder();
$treeBuilder->root('ivory_serializer')
->children()
->append($this->createEventNode())
->append($this->createMappingNode())
->append($this->createTypesNode())
... | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"$",
"this",
"->",
"createTreeBuilder",
"(",
")",
";",
"$",
"treeBuilder",
"->",
"root",
"(",
"'ivory_serializer'",
")",
"->",
"children",
"(",
")",
"->",
"append",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/egeloen/IvorySerializerBundle/blob/a2bdd912bf715c61b823cf7257ee232d5c823dd3/DependencyInjection/Configuration.php#L41-L52 |
RequestLab/Estat | src/RequestLab/HttpAdapter/JsonHttpAdapter.php | JsonHttpAdapter.fixContent | protected function fixContent($content)
{
if (is_array($content)) {
if (isset($content[0]) && $this->isJson($content[0])) {
return $content[0];
}
}
return parent::fixContent($content);
} | php | protected function fixContent($content)
{
if (is_array($content)) {
if (isset($content[0]) && $this->isJson($content[0])) {
return $content[0];
}
}
return parent::fixContent($content);
} | [
"protected",
"function",
"fixContent",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"content",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"content",
"[",
"0",
"]",
")",
"&&",
"$",
"this",
"->",
"isJson",
"(",
"$",
"content",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/RequestLab/Estat/blob/9517fcf359346f6c145c7a06975ab5a85352fed2/src/RequestLab/HttpAdapter/JsonHttpAdapter.php#L27-L36 |
webtown-php/KunstmaanExtensionBundle | src/Command/UserEditCommand.php | UserEditCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->logger = new SymfonyStyle($input, $output);
$this->input = $input;
$this->output = $output;
$this->userEditor = $this->getContainer()->get('webtown_kunstmaan_extension.user_edit');
$this->log... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->logger = new SymfonyStyle($input, $output);
$this->input = $input;
$this->output = $output;
$this->userEditor = $this->getContainer()->get('webtown_kunstmaan_extension.user_edit');
$this->log... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"logger",
"=",
"new",
"SymfonyStyle",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"this",
"->",
"input"... | {@inheritdoc} | [
"{"
] | train | https://github.com/webtown-php/KunstmaanExtensionBundle/blob/86c656c131295fe1f3f7694fd4da1e5e454076b9/src/Command/UserEditCommand.php#L67-L79 |
webtown-php/KunstmaanExtensionBundle | src/Command/UserEditCommand.php | UserEditCommand.selectionHandler | protected function selectionHandler()
{
$userCount = count($this->choices);
if ($userCount > static::MAX_USER_CHOICES) {
$this->autocomplete();
} elseif ($userCount > 1) {
$this->selector();
} elseif (1 === $userCount) {
$this->editor($this->choice... | php | protected function selectionHandler()
{
$userCount = count($this->choices);
if ($userCount > static::MAX_USER_CHOICES) {
$this->autocomplete();
} elseif ($userCount > 1) {
$this->selector();
} elseif (1 === $userCount) {
$this->editor($this->choice... | [
"protected",
"function",
"selectionHandler",
"(",
")",
"{",
"$",
"userCount",
"=",
"count",
"(",
"$",
"this",
"->",
"choices",
")",
";",
"if",
"(",
"$",
"userCount",
">",
"static",
"::",
"MAX_USER_CHOICES",
")",
"{",
"$",
"this",
"->",
"autocomplete",
"(... | Handle user selection depending on options and user count in db | [
"Handle",
"user",
"selection",
"depending",
"on",
"options",
"and",
"user",
"count",
"in",
"db"
] | train | https://github.com/webtown-php/KunstmaanExtensionBundle/blob/86c656c131295fe1f3f7694fd4da1e5e454076b9/src/Command/UserEditCommand.php#L84-L94 |
webtown-php/KunstmaanExtensionBundle | src/Command/UserEditCommand.php | UserEditCommand.selector | protected function selector(&$choices = null)
{
$choices = $choices ? $choices : $this->choices;
$choices = $this->userEditor->getChoicesAsEmailUsername($choices);
$question = new ChoiceQuestion(static::PLEASE_SELECT_A_USER, $choices);
$selectedUser = $this->ask($question);
$... | php | protected function selector(&$choices = null)
{
$choices = $choices ? $choices : $this->choices;
$choices = $this->userEditor->getChoicesAsEmailUsername($choices);
$question = new ChoiceQuestion(static::PLEASE_SELECT_A_USER, $choices);
$selectedUser = $this->ask($question);
$... | [
"protected",
"function",
"selector",
"(",
"&",
"$",
"choices",
"=",
"null",
")",
"{",
"$",
"choices",
"=",
"$",
"choices",
"?",
"$",
"choices",
":",
"$",
"this",
"->",
"choices",
";",
"$",
"choices",
"=",
"$",
"this",
"->",
"userEditor",
"->",
"getCh... | Multiple choices user select
@param User[] $choices | [
"Multiple",
"choices",
"user",
"select"
] | train | https://github.com/webtown-php/KunstmaanExtensionBundle/blob/86c656c131295fe1f3f7694fd4da1e5e454076b9/src/Command/UserEditCommand.php#L101-L111 |
webtown-php/KunstmaanExtensionBundle | src/Command/UserEditCommand.php | UserEditCommand.autocomplete | protected function autocomplete()
{
$question = new Question(static::PLEASE_SELECT_A_USER);
$question->setAutocompleterValues($this->userEditor->getChoicesAsSeparateEmailUsername($this->choices));
$selectedUser = $this->ask($question);
// nem választott usert, vége
if ('' ===... | php | protected function autocomplete()
{
$question = new Question(static::PLEASE_SELECT_A_USER);
$question->setAutocompleterValues($this->userEditor->getChoicesAsSeparateEmailUsername($this->choices));
$selectedUser = $this->ask($question);
// nem választott usert, vége
if ('' ===... | [
"protected",
"function",
"autocomplete",
"(",
")",
"{",
"$",
"question",
"=",
"new",
"Question",
"(",
"static",
"::",
"PLEASE_SELECT_A_USER",
")",
";",
"$",
"question",
"->",
"setAutocompleterValues",
"(",
"$",
"this",
"->",
"userEditor",
"->",
"getChoicesAsSepa... | Autocomplete user select | [
"Autocomplete",
"user",
"select"
] | train | https://github.com/webtown-php/KunstmaanExtensionBundle/blob/86c656c131295fe1f3f7694fd4da1e5e454076b9/src/Command/UserEditCommand.php#L116-L134 |
webtown-php/KunstmaanExtensionBundle | src/Command/UserEditCommand.php | UserEditCommand.editor | protected function editor(User $user)
{
// store props
$oldProps = new UserUpdater($user);
$newProps = $this->getNewValues($user);
// confirm
$ln = <<<EOL
Summary
-------
Username: "{$newProps->getUsername()}"
Email: "{$newProps->getEmail()}"
Password: "{$newProps->getPas... | php | protected function editor(User $user)
{
// store props
$oldProps = new UserUpdater($user);
$newProps = $this->getNewValues($user);
// confirm
$ln = <<<EOL
Summary
-------
Username: "{$newProps->getUsername()}"
Email: "{$newProps->getEmail()}"
Password: "{$newProps->getPas... | [
"protected",
"function",
"editor",
"(",
"User",
"$",
"user",
")",
"{",
"// store props",
"$",
"oldProps",
"=",
"new",
"UserUpdater",
"(",
"$",
"user",
")",
";",
"$",
"newProps",
"=",
"$",
"this",
"->",
"getNewValues",
"(",
"$",
"user",
")",
";",
"// co... | Show user editor
@param User $user | [
"Show",
"user",
"editor"
] | train | https://github.com/webtown-php/KunstmaanExtensionBundle/blob/86c656c131295fe1f3f7694fd4da1e5e454076b9/src/Command/UserEditCommand.php#L141-L181 |
webtown-php/KunstmaanExtensionBundle | src/Command/UserEditCommand.php | UserEditCommand.sendNotification | protected function sendNotification($to, array $changedValues)
{
$message = \Swift_Message::newInstance()
->setSubject('User details updated')
->setFrom($this->getContainer()->getParameter('fos_user.resetting.email.from_email'))
->setTo($to)
->setBody(
... | php | protected function sendNotification($to, array $changedValues)
{
$message = \Swift_Message::newInstance()
->setSubject('User details updated')
->setFrom($this->getContainer()->getParameter('fos_user.resetting.email.from_email'))
->setTo($to)
->setBody(
... | [
"protected",
"function",
"sendNotification",
"(",
"$",
"to",
",",
"array",
"$",
"changedValues",
")",
"{",
"$",
"message",
"=",
"\\",
"Swift_Message",
"::",
"newInstance",
"(",
")",
"->",
"setSubject",
"(",
"'User details updated'",
")",
"->",
"setFrom",
"(",
... | Send email notification about changes
@param $to
@param array $changedValues | [
"Send",
"email",
"notification",
"about",
"changes"
] | train | https://github.com/webtown-php/KunstmaanExtensionBundle/blob/86c656c131295fe1f3f7694fd4da1e5e454076b9/src/Command/UserEditCommand.php#L189-L203 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.