id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
29,600 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Product/Services/IdentResultsService.php | IdentResultsService.process | private function process(IdentResult &$result)
{
if (isset($result->person)) {
foreach ($result->person as $p) {
$attachments = $p->attachments;
if (!empty($attachments)) {
foreach ($attachments as $attachment) {
$this->... | php | private function process(IdentResult &$result)
{
if (isset($result->person)) {
foreach ($result->person as $p) {
$attachments = $p->attachments;
if (!empty($attachments)) {
foreach ($attachments as $attachment) {
$this->... | [
"private",
"function",
"process",
"(",
"IdentResult",
"&",
"$",
"result",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"result",
"->",
"person",
")",
")",
"{",
"foreach",
"(",
"$",
"result",
"->",
"person",
"as",
"$",
"p",
")",
"{",
"$",
"attachments",
... | Handles proper attachments initialization after retrieval of a ident result.
@param IdentResult $result | [
"Handles",
"proper",
"attachments",
"initialization",
"after",
"retrieval",
"of",
"a",
"ident",
"result",
"."
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Product/Services/IdentResultsService.php#L79-L91 |
29,601 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.array_compare | public static function array_compare(&$arr1, &$arr2) {
// Obviously bad data.
if (! \is_array($arr1) || ! \is_array($arr2)) {
return false;
}
$length = \count($arr1);
// Length mismatch.
if (\count($arr2) !== $length) {
return false;
}
// Different keys, we don't need to check further.
if (\c... | php | public static function array_compare(&$arr1, &$arr2) {
// Obviously bad data.
if (! \is_array($arr1) || ! \is_array($arr2)) {
return false;
}
$length = \count($arr1);
// Length mismatch.
if (\count($arr2) !== $length) {
return false;
}
// Different keys, we don't need to check further.
if (\c... | [
"public",
"static",
"function",
"array_compare",
"(",
"&",
"$",
"arr1",
",",
"&",
"$",
"arr2",
")",
"{",
"// Obviously bad data.",
"if",
"(",
"!",
"\\",
"is_array",
"(",
"$",
"arr1",
")",
"||",
"!",
"\\",
"is_array",
"(",
"$",
"arr2",
")",
")",
"{",
... | Compare Two Arrays
@param array $arr1 Array.
@param array $arr2 Array.
@return bool True/false. | [
"Compare",
"Two",
"Arrays"
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L22-L66 |
29,602 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.array_pop | public static function array_pop(array &$arr) {
if (! \count($arr)) {
return false;
}
$reversed = \array_reverse($arr);
return static::array_pop_top($reversed);
} | php | public static function array_pop(array &$arr) {
if (! \count($arr)) {
return false;
}
$reversed = \array_reverse($arr);
return static::array_pop_top($reversed);
} | [
"public",
"static",
"function",
"array_pop",
"(",
"array",
"&",
"$",
"arr",
")",
"{",
"if",
"(",
"!",
"\\",
"count",
"(",
"$",
"arr",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"reversed",
"=",
"\\",
"array_reverse",
"(",
"$",
"arr",
")",
"... | Return the last value of an array.
This is like array_pop() but non-destructive.
@param array $arr Array.
@return mixed Value. False on error. | [
"Return",
"the",
"last",
"value",
"of",
"an",
"array",
"."
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L275-L282 |
29,603 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.array_pop_rand | public static function array_pop_rand(array &$arr) {
$length = \count($arr);
if (! $length) {
return false;
}
// Nothing random about an array with one thing.
if (1 === $length) {
return static::array_pop_top($arr);
}
$keys = \array_keys($arr);
$index = static::random_int(0, $length - 1);
re... | php | public static function array_pop_rand(array &$arr) {
$length = \count($arr);
if (! $length) {
return false;
}
// Nothing random about an array with one thing.
if (1 === $length) {
return static::array_pop_top($arr);
}
$keys = \array_keys($arr);
$index = static::random_int(0, $length - 1);
re... | [
"public",
"static",
"function",
"array_pop_rand",
"(",
"array",
"&",
"$",
"arr",
")",
"{",
"$",
"length",
"=",
"\\",
"count",
"(",
"$",
"arr",
")",
";",
"if",
"(",
"!",
"$",
"length",
")",
"{",
"return",
"false",
";",
"}",
"// Nothing random about an a... | Return a random array element.
@param array $arr Array.
@return mixed Value. False on error. | [
"Return",
"a",
"random",
"array",
"element",
"."
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L290-L306 |
29,604 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.array_pop_top | public static function array_pop_top(array &$arr) {
if (! \count($arr)) {
return false;
}
\reset($arr);
return $arr[\key($arr)];
} | php | public static function array_pop_top(array &$arr) {
if (! \count($arr)) {
return false;
}
\reset($arr);
return $arr[\key($arr)];
} | [
"public",
"static",
"function",
"array_pop_top",
"(",
"array",
"&",
"$",
"arr",
")",
"{",
"if",
"(",
"!",
"\\",
"count",
"(",
"$",
"arr",
")",
")",
"{",
"return",
"false",
";",
"}",
"\\",
"reset",
"(",
"$",
"arr",
")",
";",
"return",
"$",
"arr",
... | Return the first value of an array.
@param array $arr Array.
@return mixed Value. False on error. | [
"Return",
"the",
"first",
"value",
"of",
"an",
"array",
"."
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L314-L321 |
29,605 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.cc_exp_months | public static function cc_exp_months(string $format='m - M') {
$months = array();
for ($x = 1; $x <= 12; ++$x) {
$months[$x] = \date($format, \strtotime('2000-' . \sprintf('%02d', $x) . '-01'));
}
return $months;
} | php | public static function cc_exp_months(string $format='m - M') {
$months = array();
for ($x = 1; $x <= 12; ++$x) {
$months[$x] = \date($format, \strtotime('2000-' . \sprintf('%02d', $x) . '-01'));
}
return $months;
} | [
"public",
"static",
"function",
"cc_exp_months",
"(",
"string",
"$",
"format",
"=",
"'m - M'",
")",
"{",
"$",
"months",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"x",
"=",
"1",
";",
"$",
"x",
"<=",
"12",
";",
"++",
"$",
"x",
")",
"{",
"$",
... | Generate Credit Card Expiration Months
@param string $format Date format.
@return array Months. | [
"Generate",
"Credit",
"Card",
"Expiration",
"Months"
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L329-L335 |
29,606 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.cc_exp_years | public static function cc_exp_years(int $length=10) {
if ($length < 1) {
$length = 10;
}
$years = array();
for ($x = 0; $x < $length; ++$x) {
$year = (int) (\date('Y') + $x);
$years[$year] = $year;
}
return $years;
} | php | public static function cc_exp_years(int $length=10) {
if ($length < 1) {
$length = 10;
}
$years = array();
for ($x = 0; $x < $length; ++$x) {
$year = (int) (\date('Y') + $x);
$years[$year] = $year;
}
return $years;
} | [
"public",
"static",
"function",
"cc_exp_years",
"(",
"int",
"$",
"length",
"=",
"10",
")",
"{",
"if",
"(",
"$",
"length",
"<",
"1",
")",
"{",
"$",
"length",
"=",
"10",
";",
"}",
"$",
"years",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"x",
... | Generate Credit Card Expiration Years
@param int $length Number of years.
@return array Years. | [
"Generate",
"Credit",
"Card",
"Expiration",
"Years"
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L343-L355 |
29,607 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.datediff | public static function datediff($date1, $date2) {
ref\sanitize::date($date1);
ref\sanitize::date($date2);
// Same or bad dates.
if (
! \is_string($date1) ||
! \is_string($date2) ||
($date1 === $date2) ||
('0000-00-00' === $date1) ||
('0000-00-00' === $date2)
) {
return 0;
}
// Prefer D... | php | public static function datediff($date1, $date2) {
ref\sanitize::date($date1);
ref\sanitize::date($date2);
// Same or bad dates.
if (
! \is_string($date1) ||
! \is_string($date2) ||
($date1 === $date2) ||
('0000-00-00' === $date1) ||
('0000-00-00' === $date2)
) {
return 0;
}
// Prefer D... | [
"public",
"static",
"function",
"datediff",
"(",
"$",
"date1",
",",
"$",
"date2",
")",
"{",
"ref",
"\\",
"sanitize",
"::",
"date",
"(",
"$",
"date1",
")",
";",
"ref",
"\\",
"sanitize",
"::",
"date",
"(",
"$",
"date2",
")",
";",
"// Same or bad dates.",... | Days Between Dates
@param string $date1 Date.
@param string $date2 Date.
@return int Difference in Days. | [
"Days",
"Between",
"Dates"
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L364-L392 |
29,608 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.in_range | public static function in_range($value, $min=null, $max=null) {
return sanitize::to_range($value, $min, $max) === $value;
} | php | public static function in_range($value, $min=null, $max=null) {
return sanitize::to_range($value, $min, $max) === $value;
} | [
"public",
"static",
"function",
"in_range",
"(",
"$",
"value",
",",
"$",
"min",
"=",
"null",
",",
"$",
"max",
"=",
"null",
")",
"{",
"return",
"sanitize",
"::",
"to_range",
"(",
"$",
"value",
",",
"$",
"min",
",",
"$",
"max",
")",
"===",
"$",
"va... | Is Value In Range?
@param mixed $value Value.
@param mixed $min Min.
@param mixed $max Max.
@return bool True/false. | [
"Is",
"Value",
"In",
"Range?"
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L414-L416 |
29,609 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.ip_in_range | public static function ip_in_range(string $ip, $min, $max=null) {
ref\sanitize::ip($ip, true);
if (! \is_string($min)) {
return false;
}
// Bad IP.
if (! $ip) {
return false;
}
// Is $min a range?
if (false !== \strpos($min, '/')) {
if (false === ($range = format::cidr_to_range($min))) {
... | php | public static function ip_in_range(string $ip, $min, $max=null) {
ref\sanitize::ip($ip, true);
if (! \is_string($min)) {
return false;
}
// Bad IP.
if (! $ip) {
return false;
}
// Is $min a range?
if (false !== \strpos($min, '/')) {
if (false === ($range = format::cidr_to_range($min))) {
... | [
"public",
"static",
"function",
"ip_in_range",
"(",
"string",
"$",
"ip",
",",
"$",
"min",
",",
"$",
"max",
"=",
"null",
")",
"{",
"ref",
"\\",
"sanitize",
"::",
"ip",
"(",
"$",
"ip",
",",
"true",
")",
";",
"if",
"(",
"!",
"\\",
"is_string",
"(",
... | IP in Range?
Check to see if an IP is in range. This
either accepts a minimum and maximum IP,
or a CIDR.
@param string $ip String.
@param string $min Min or CIDR.
@param string $max Max.
@return bool True/false. | [
"IP",
"in",
"Range?"
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L430-L468 |
29,610 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.is_utf8 | public static function is_utf8($str) {
if (\is_numeric($str) || \is_bool($str)) {
return true;
}
elseif (\is_string($str)) {
return (bool) \preg_match('//u', $str);
}
return false;
} | php | public static function is_utf8($str) {
if (\is_numeric($str) || \is_bool($str)) {
return true;
}
elseif (\is_string($str)) {
return (bool) \preg_match('//u', $str);
}
return false;
} | [
"public",
"static",
"function",
"is_utf8",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"\\",
"is_numeric",
"(",
"$",
"str",
")",
"||",
"\\",
"is_bool",
"(",
"$",
"str",
")",
")",
"{",
"return",
"true",
";",
"}",
"elseif",
"(",
"\\",
"is_string",
"(",
"... | Is Value Valid UTF-8?
@param string $str String.
@return bool True/false. | [
"Is",
"Value",
"Valid",
"UTF",
"-",
"8?"
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L496-L505 |
29,611 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.json_decode_array | public static function json_decode_array($json, $defaults=null, bool $strict=true, bool $recursive=true) {
ref\format::json_decode($json);
if ((null === $json) || (\is_string($json) && ! $json)) {
$json = array();
}
else {
ref\cast::array($json);
}
if (\is_array($defaults)) {
return static::parse... | php | public static function json_decode_array($json, $defaults=null, bool $strict=true, bool $recursive=true) {
ref\format::json_decode($json);
if ((null === $json) || (\is_string($json) && ! $json)) {
$json = array();
}
else {
ref\cast::array($json);
}
if (\is_array($defaults)) {
return static::parse... | [
"public",
"static",
"function",
"json_decode_array",
"(",
"$",
"json",
",",
"$",
"defaults",
"=",
"null",
",",
"bool",
"$",
"strict",
"=",
"true",
",",
"bool",
"$",
"recursive",
"=",
"true",
")",
"{",
"ref",
"\\",
"format",
"::",
"json_decode",
"(",
"$... | JSON Decode As Array
This ensures a JSON string is always decoded to
an array, optionally matching the structure of
a template object.
@param string $json JSON.
@param mixed $defaults Template.
@param bool $strict Enforce types if templating.
@param bool $recursive Recursive templating.
@return array Data. | [
"JSON",
"Decode",
"As",
"Array"
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L520-L536 |
29,612 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.length_in_range | public static function length_in_range(string $str, $min=null, $max=null) {
if ((null !== $min) && ! \is_int($min)) {
ref\cast::int($min, true);
}
if ((null !== $max) && ! \is_int($max)) {
ref\cast::int($max, true);
}
$length = mb::strlen($str);
if ((null !== $min) && (null !== $max) && $min > $max) ... | php | public static function length_in_range(string $str, $min=null, $max=null) {
if ((null !== $min) && ! \is_int($min)) {
ref\cast::int($min, true);
}
if ((null !== $max) && ! \is_int($max)) {
ref\cast::int($max, true);
}
$length = mb::strlen($str);
if ((null !== $min) && (null !== $max) && $min > $max) ... | [
"public",
"static",
"function",
"length_in_range",
"(",
"string",
"$",
"str",
",",
"$",
"min",
"=",
"null",
",",
"$",
"max",
"=",
"null",
")",
"{",
"if",
"(",
"(",
"null",
"!==",
"$",
"min",
")",
"&&",
"!",
"\\",
"is_int",
"(",
"$",
"min",
")",
... | Length in Range
See if the length of a string is between two extremes.
@param string $str String.
@param int $min Min length.
@param int $max Max length.
@return bool True/false. | [
"Length",
"in",
"Range"
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L548-L570 |
29,613 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.random_int | public static function random_int(int $min=0, int $max=1) {
if ($min > $max) {
static::switcheroo($min, $max);
}
return \random_int($min, $max);
} | php | public static function random_int(int $min=0, int $max=1) {
if ($min > $max) {
static::switcheroo($min, $max);
}
return \random_int($min, $max);
} | [
"public",
"static",
"function",
"random_int",
"(",
"int",
"$",
"min",
"=",
"0",
",",
"int",
"$",
"max",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"min",
">",
"$",
"max",
")",
"{",
"static",
"::",
"switcheroo",
"(",
"$",
"min",
",",
"$",
"max",
")",
... | Generate Random Integer
This will use the most secure function
available for the environment.
@param int $min Min.
@param int $max Max.
@return int Random number. | [
"Generate",
"Random",
"Integer"
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L629-L635 |
29,614 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.random_string | public static function random_string(int $length=10, $soup=null) {
if ($length < 1) {
return '';
}
if (\is_array($soup) && \count($soup)) {
ref\cast::string($soup);
$soup = \implode('', $soup);
ref\sanitize::printable($soup);
$soup = \preg_replace('/\s/u', '', $soup);
$soup = \array_unique(mb... | php | public static function random_string(int $length=10, $soup=null) {
if ($length < 1) {
return '';
}
if (\is_array($soup) && \count($soup)) {
ref\cast::string($soup);
$soup = \implode('', $soup);
ref\sanitize::printable($soup);
$soup = \preg_replace('/\s/u', '', $soup);
$soup = \array_unique(mb... | [
"public",
"static",
"function",
"random_string",
"(",
"int",
"$",
"length",
"=",
"10",
",",
"$",
"soup",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"length",
"<",
"1",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"soup",... | Generate Random String
By default the string will only contain
unambiguous uppercase letters and numbers.
Alternate alphabets can be passed instead.
@param int $length Length.
@param array $soup Alternate alphabet.
@return string Random string. | [
"Generate",
"Random",
"String"
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L648-L680 |
29,615 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.switcheroo | public static function switcheroo(&$var1, &$var2) {
$tmp = $var1;
$var1 = $var2;
$var2 = $tmp;
return true;
} | php | public static function switcheroo(&$var1, &$var2) {
$tmp = $var1;
$var1 = $var2;
$var2 = $tmp;
return true;
} | [
"public",
"static",
"function",
"switcheroo",
"(",
"&",
"$",
"var1",
",",
"&",
"$",
"var2",
")",
"{",
"$",
"tmp",
"=",
"$",
"var1",
";",
"$",
"var1",
"=",
"$",
"var2",
";",
"$",
"var2",
"=",
"$",
"tmp",
";",
"return",
"true",
";",
"}"
] | Switch Two Variables
@param mixed $var1 Variable.
@param mixed $var2 Variable.
@return bool True. | [
"Switch",
"Two",
"Variables"
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L689-L695 |
29,616 | Blobfolio/blob-common | lib/blobfolio/common/data.php | data.unsetcookie | public static function unsetcookie(string $name, string $path='', string $domain='', bool $secure=false, bool $httponly=false) {
if (! \headers_sent()) {
\setcookie($name, false, -1, $path, $domain, $secure, $httponly);
if (isset($_COOKIE[$name])) {
unset($_COOKIE[$name]);
}
return true;
}
retu... | php | public static function unsetcookie(string $name, string $path='', string $domain='', bool $secure=false, bool $httponly=false) {
if (! \headers_sent()) {
\setcookie($name, false, -1, $path, $domain, $secure, $httponly);
if (isset($_COOKIE[$name])) {
unset($_COOKIE[$name]);
}
return true;
}
retu... | [
"public",
"static",
"function",
"unsetcookie",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"path",
"=",
"''",
",",
"string",
"$",
"domain",
"=",
"''",
",",
"bool",
"$",
"secure",
"=",
"false",
",",
"bool",
"$",
"httponly",
"=",
"false",
")",
"{",... | Delete a Cookie
A companion to PHP's `setcookie()` function. It
attempts to remove the cookie. The same path, etc.,
values should be passed as were used to first set it.
@param string $name Name.
@param string $path Path.
@param string $domain Domain.
@param bool $secure SSL only.
@param bool $httponly HTTP only.
@re... | [
"Delete",
"a",
"Cookie"
] | 7b43d5526cc9d09853771d950b2956e98e680db1 | https://github.com/Blobfolio/blob-common/blob/7b43d5526cc9d09853771d950b2956e98e680db1/lib/blobfolio/common/data.php#L711-L723 |
29,617 | polyfony-inc/polyfony | Private/Polyfony/Uploader.php | Uploader.source | public function source($path, $override_chroot = true) {
// if chroot is enabled, restrict the path to the chroot
$this->Source = Filesystem::chroot($path, $override_chroot);
// return self
return($this);
} | php | public function source($path, $override_chroot = true) {
// if chroot is enabled, restrict the path to the chroot
$this->Source = Filesystem::chroot($path, $override_chroot);
// return self
return($this);
} | [
"public",
"function",
"source",
"(",
"$",
"path",
",",
"$",
"override_chroot",
"=",
"true",
")",
"{",
"// if chroot is enabled, restrict the path to the chroot",
"$",
"this",
"->",
"Source",
"=",
"Filesystem",
"::",
"chroot",
"(",
"$",
"path",
",",
"$",
"overrid... | set the source file path, disable chroot before of the tmp folder | [
"set",
"the",
"source",
"file",
"path",
"disable",
"chroot",
"before",
"of",
"the",
"tmp",
"folder"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Uploader.php#L42-L47 |
29,618 | polyfony-inc/polyfony | Private/Polyfony/Uploader.php | Uploader.destination | public function destination($path, $override_chroot = false) {
// set the path
$this->Destination = Filesystem::chroot($path, $override_chroot);
// return self
return($this);
} | php | public function destination($path, $override_chroot = false) {
// set the path
$this->Destination = Filesystem::chroot($path, $override_chroot);
// return self
return($this);
} | [
"public",
"function",
"destination",
"(",
"$",
"path",
",",
"$",
"override_chroot",
"=",
"false",
")",
"{",
"// set the path",
"$",
"this",
"->",
"Destination",
"=",
"Filesystem",
"::",
"chroot",
"(",
"$",
"path",
",",
"$",
"override_chroot",
")",
";",
"//... | set the destination | [
"set",
"the",
"destination"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Uploader.php#L50-L55 |
29,619 | polyfony-inc/polyfony | Private/Polyfony/Uploader.php | Uploader.limitTypes | public function limitTypes($allowed) {
// if allowed is an array
if(is_array($allowed)) {
// push the whole table
$this->Limits->Types = $allowed;
}
// allowed is a string
else {
// push it
$this->Limits->Types[] = $allowed;
}
// return self
return($this);
} | php | public function limitTypes($allowed) {
// if allowed is an array
if(is_array($allowed)) {
// push the whole table
$this->Limits->Types = $allowed;
}
// allowed is a string
else {
// push it
$this->Limits->Types[] = $allowed;
}
// return self
return($this);
} | [
"public",
"function",
"limitTypes",
"(",
"$",
"allowed",
")",
"{",
"// if allowed is an array",
"if",
"(",
"is_array",
"(",
"$",
"allowed",
")",
")",
"{",
"// push the whole table",
"$",
"this",
"->",
"Limits",
"->",
"Types",
"=",
"$",
"allowed",
";",
"}",
... | limit types to array or mimetypes | [
"limit",
"types",
"to",
"array",
"or",
"mimetypes"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Uploader.php#L69-L82 |
29,620 | hnhdigital-os/laravel-model-schema | src/Model.php | Model.schemaCache | private static function schemaCache(...$args)
{
if (count($args) == 1) {
$key = array_pop($args);
if (isset(static::$schema_cache[$key])) {
return static::$schema_cache[$key];
}
return false;
}
list($key, $value) = $args;
... | php | private static function schemaCache(...$args)
{
if (count($args) == 1) {
$key = array_pop($args);
if (isset(static::$schema_cache[$key])) {
return static::$schema_cache[$key];
}
return false;
}
list($key, $value) = $args;
... | [
"private",
"static",
"function",
"schemaCache",
"(",
"...",
"$",
"args",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"==",
"1",
")",
"{",
"$",
"key",
"=",
"array_pop",
"(",
"$",
"args",
")",
";",
"if",
"(",
"isset",
"(",
"static",
"::",
... | Set or get Cache for this key.
@param string $key
@param array $data
@return void | [
"Set",
"or",
"get",
"Cache",
"for",
"this",
"key",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Model.php#L174-L188 |
29,621 | hnhdigital-os/laravel-model-schema | src/Model.php | Model.getSchemaCache | private function getSchemaCache($key)
{
if (isset($this->model_schema_cache[$key])) {
return $this->model_schema_cache[$key];
}
return false;
} | php | private function getSchemaCache($key)
{
if (isset($this->model_schema_cache[$key])) {
return $this->model_schema_cache[$key];
}
return false;
} | [
"private",
"function",
"getSchemaCache",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"model_schema_cache",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"model_schema_cache",
"[",
"$",
"key",
"]",
";",
"... | Get cache for this key.
@param string $key
@return void | [
"Get",
"cache",
"for",
"this",
"key",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Model.php#L270-L277 |
29,622 | hnhdigital-os/laravel-model-schema | src/Model.php | Model.setSchema | public function setSchema($entry, $keys, $value, $reset = false, $reset_value = null)
{
// Reset existing values in the schema.
if ($reset) {
$current = $this->getSchema($entry);
foreach ($current as $key => $value) {
if (is_null($reset_value)) {
... | php | public function setSchema($entry, $keys, $value, $reset = false, $reset_value = null)
{
// Reset existing values in the schema.
if ($reset) {
$current = $this->getSchema($entry);
foreach ($current as $key => $value) {
if (is_null($reset_value)) {
... | [
"public",
"function",
"setSchema",
"(",
"$",
"entry",
",",
"$",
"keys",
",",
"$",
"value",
",",
"$",
"reset",
"=",
"false",
",",
"$",
"reset_value",
"=",
"null",
")",
"{",
"// Reset existing values in the schema.",
"if",
"(",
"$",
"reset",
")",
"{",
"$",... | Set an entry within the schema.
@param string $entry
@param string|array $keys
@param bool $reset
@param mixed $reset_value
@return array | [
"Set",
"an",
"entry",
"within",
"the",
"schema",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Model.php#L301-L331 |
29,623 | hnhdigital-os/laravel-model-schema | src/Model.php | Model.cache | protected function cache($key, $value)
{
if (array_has($this->model_cache, $key)) {
return array_get($this->model_cache, $key);
}
if (is_callable($value)) {
$result = $value();
} else {
$result = $value;
}
array_set($this->model_c... | php | protected function cache($key, $value)
{
if (array_has($this->model_cache, $key)) {
return array_get($this->model_cache, $key);
}
if (is_callable($value)) {
$result = $value();
} else {
$result = $value;
}
array_set($this->model_c... | [
"protected",
"function",
"cache",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"array_has",
"(",
"$",
"this",
"->",
"model_cache",
",",
"$",
"key",
")",
")",
"{",
"return",
"array_get",
"(",
"$",
"this",
"->",
"model_cache",
",",
"$",
"... | Cache this value.
@param string $key
@param mixed $value
@return mixed | [
"Cache",
"this",
"value",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Model.php#L357-L372 |
29,624 | hnhdigital-os/laravel-model-schema | src/Model.php | Model.boot | protected static function boot()
{
parent::boot();
// Boot event for creating this model.
// Set default values if specified.
// Validate dirty attributes before commiting to save.
static::creating(function ($model) {
$model->setDefaultValuesForAttributes();
... | php | protected static function boot()
{
parent::boot();
// Boot event for creating this model.
// Set default values if specified.
// Validate dirty attributes before commiting to save.
static::creating(function ($model) {
$model->setDefaultValuesForAttributes();
... | [
"protected",
"static",
"function",
"boot",
"(",
")",
"{",
"parent",
"::",
"boot",
"(",
")",
";",
"// Boot event for creating this model.",
"// Set default values if specified.",
"// Validate dirty attributes before commiting to save.",
"static",
"::",
"creating",
"(",
"functi... | Boot events.
@return void | [
"Boot",
"events",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Model.php#L379-L425 |
29,625 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Auth/OauthProvider.php | OauthProvider.appyAuthorization | public function appyAuthorization(RequestInterface $request, array $options = null)
{
// Only sign requests using "auth"="oauth"
// IMPORTANT: you have to create special auth client (GuzzleHttp\Client) if you want to get all the request authorized
if (!isset($options['auth']) || $options['au... | php | public function appyAuthorization(RequestInterface $request, array $options = null)
{
// Only sign requests using "auth"="oauth"
// IMPORTANT: you have to create special auth client (GuzzleHttp\Client) if you want to get all the request authorized
if (!isset($options['auth']) || $options['au... | [
"public",
"function",
"appyAuthorization",
"(",
"RequestInterface",
"$",
"request",
",",
"array",
"$",
"options",
"=",
"null",
")",
"{",
"// Only sign requests using \"auth\"=\"oauth\"",
"// IMPORTANT: you have to create special auth client (GuzzleHttp\\Client) if you want to get all... | Adds the authorization header if an access token was found
@param RequestInterface $request
@param array $options
@return RequestInterface If the access token could not properly set to the request.
@throws ClientError
@throws ApiError
@throws AuthError | [
"Adds",
"the",
"authorization",
"header",
"if",
"an",
"access",
"token",
"was",
"found"
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Auth/OauthProvider.php#L105-L120 |
29,626 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Auth/OauthProvider.php | OauthProvider.updateToken | private function updateToken(RefreshTokenCredentials $refreshToken = null, $deviceCode = null)
{
$tokenData = null;
// array of url parameters that will be sent in auth request
$params = [];
if ($refreshToken == null && !empty($deviceCode)) {
$tokenData = $this->pollDevi... | php | private function updateToken(RefreshTokenCredentials $refreshToken = null, $deviceCode = null)
{
$tokenData = null;
// array of url parameters that will be sent in auth request
$params = [];
if ($refreshToken == null && !empty($deviceCode)) {
$tokenData = $this->pollDevi... | [
"private",
"function",
"updateToken",
"(",
"RefreshTokenCredentials",
"$",
"refreshToken",
"=",
"null",
",",
"$",
"deviceCode",
"=",
"null",
")",
"{",
"$",
"tokenData",
"=",
"null",
";",
"// array of url parameters that will be sent in auth request",
"$",
"params",
"=... | Function to update token based on GrantTypeInterface
@param RefreshTokenCredentials|null $refreshToken Refresh token to update existing token or null to obtain new
token.
@param null|string $deviceCode
@return bool False on pending auth, true else.
@throws ClientError
@throws ApiError
@throws AuthError
@throws Exceptio... | [
"Function",
"to",
"update",
"token",
"based",
"on",
"GrantTypeInterface"
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Auth/OauthProvider.php#L201-L244 |
29,627 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Auth/OauthProvider.php | OauthProvider.obtainDeviceVerification | private function obtainDeviceVerification()
{
if (!$this->credentials instanceof DeviceCredentials) {
throw new ClientError('Invalid credentials set up, must be of type ' . DeviceCredentials::class);
}
$params = [];
$this->setParams($params, $this->credentials);
... | php | private function obtainDeviceVerification()
{
if (!$this->credentials instanceof DeviceCredentials) {
throw new ClientError('Invalid credentials set up, must be of type ' . DeviceCredentials::class);
}
$params = [];
$this->setParams($params, $this->credentials);
... | [
"private",
"function",
"obtainDeviceVerification",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"credentials",
"instanceof",
"DeviceCredentials",
")",
"{",
"throw",
"new",
"ClientError",
"(",
"'Invalid credentials set up, must be of type '",
".",
"DeviceCredentials... | Function to get device verification codes.
@return mixed
@throws ClientError
@throws ApiError
@throws AuthError
@throws Exception | [
"Function",
"to",
"get",
"device",
"verification",
"codes",
"."
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Auth/OauthProvider.php#L254-L271 |
29,628 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Auth/OauthProvider.php | OauthProvider.pollDeviceAccessToken | private function pollDeviceAccessToken($deviceCode)
{
if (!$this->credentials instanceof DeviceCredentials) {
throw new ClientError('Invalid credentials set up, must be of type ' . DeviceCredentials::class);
}
$this->credentials->deviceCode = $deviceCode;
$params = [];
... | php | private function pollDeviceAccessToken($deviceCode)
{
if (!$this->credentials instanceof DeviceCredentials) {
throw new ClientError('Invalid credentials set up, must be of type ' . DeviceCredentials::class);
}
$this->credentials->deviceCode = $deviceCode;
$params = [];
... | [
"private",
"function",
"pollDeviceAccessToken",
"(",
"$",
"deviceCode",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"credentials",
"instanceof",
"DeviceCredentials",
")",
"{",
"throw",
"new",
"ClientError",
"(",
"'Invalid credentials set up, must be of type '",
".",
... | Function to get access token data for device authorization.
This method may be invoked multiple times until it returns the token data.
@param string $deviceCode The device code obtained by obtainDeviceVerification().
@throws \Exception If a error happens.
@return mixed | boolean Returns false if the authorization is st... | [
"Function",
"to",
"get",
"access",
"token",
"data",
"for",
"device",
"authorization",
".",
"This",
"method",
"may",
"be",
"invoked",
"multiple",
"times",
"until",
"it",
"returns",
"the",
"token",
"data",
"."
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Auth/OauthProvider.php#L281-L308 |
29,629 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Product/Smart/TransactionsService.php | TransactionsService.prepare | public function prepare($transactionId, $type, $object = null)
{
if (!in_array(
$type,
[
self::TYPE_AUTO,
self::TYPE_DIRECT_DEBIT,
self::TYPE_CREDIT_CARD,
self::TYPE_INVOICE,
self::TYPE_PAYPAL,
... | php | public function prepare($transactionId, $type, $object = null)
{
if (!in_array(
$type,
[
self::TYPE_AUTO,
self::TYPE_DIRECT_DEBIT,
self::TYPE_CREDIT_CARD,
self::TYPE_INVOICE,
self::TYPE_PAYPAL,
... | [
"public",
"function",
"prepare",
"(",
"$",
"transactionId",
",",
"$",
"type",
",",
"$",
"object",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"type",
",",
"[",
"self",
"::",
"TYPE_AUTO",
",",
"self",
"::",
"TYPE_DIRECT_DEBIT",
",",
"... | Preparing a transaction.
@param string $transactionId The transaction id.
@param string $type The transaction type like "auto" or "cash".
@param null $object
@return Transaction The prepared transaction.
@throws GuzzleException
@throws ApiError
@throws AuthError
@throws ClientError | [
"Preparing",
"a",
"transaction",
"."
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Product/Smart/TransactionsService.php#L60-L76 |
29,630 | ventoviro/windwalker-core | src/Core/Mailer/MailAttachment.php | MailAttachment.getBody | public function getBody()
{
if ($this->body instanceof \Closure) {
$method = $this->body;
$this->body = $method();
}
return $this->body;
} | php | public function getBody()
{
if ($this->body instanceof \Closure) {
$method = $this->body;
$this->body = $method();
}
return $this->body;
} | [
"public",
"function",
"getBody",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"body",
"instanceof",
"\\",
"Closure",
")",
"{",
"$",
"method",
"=",
"$",
"this",
"->",
"body",
";",
"$",
"this",
"->",
"body",
"=",
"$",
"method",
"(",
")",
";",
"}",
... | Method to get property Body
@return string | [
"Method",
"to",
"get",
"property",
"Body"
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Mailer/MailAttachment.php#L133-L142 |
29,631 | ventoviro/windwalker-core | src/Core/Schedule/Schedule.php | Schedule.getEvents | public function getEvents(array $tags = []): array
{
if ($tags === []) {
return $this->events;
}
return array_filter($this->events, function (ScheduleEvent $event) use ($tags) {
return array_intersect($event->getTags(), $tags) === $tags;
});
} | php | public function getEvents(array $tags = []): array
{
if ($tags === []) {
return $this->events;
}
return array_filter($this->events, function (ScheduleEvent $event) use ($tags) {
return array_intersect($event->getTags(), $tags) === $tags;
});
} | [
"public",
"function",
"getEvents",
"(",
"array",
"$",
"tags",
"=",
"[",
"]",
")",
":",
"array",
"{",
"if",
"(",
"$",
"tags",
"===",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"events",
";",
"}",
"return",
"array_filter",
"(",
"$",
"this",
"... | Method to get property Events
@param array $tags
@return ScheduleEvent[]
@since 3.5.3 | [
"Method",
"to",
"get",
"property",
"Events"
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Schedule/Schedule.php#L279-L288 |
29,632 | ventoviro/windwalker-core | src/Core/View/Traits/LayoutRenderableTrait.php | LayoutRenderableTrait.setRenderer | public function setRenderer($renderer)
{
$this->renderer = $renderer instanceof AbstractRenderer ?: $this->getRendererManager()->getRenderer((string) $renderer);
return $this;
} | php | public function setRenderer($renderer)
{
$this->renderer = $renderer instanceof AbstractRenderer ?: $this->getRendererManager()->getRenderer((string) $renderer);
return $this;
} | [
"public",
"function",
"setRenderer",
"(",
"$",
"renderer",
")",
"{",
"$",
"this",
"->",
"renderer",
"=",
"$",
"renderer",
"instanceof",
"AbstractRenderer",
"?",
":",
"$",
"this",
"->",
"getRendererManager",
"(",
")",
"->",
"getRenderer",
"(",
"(",
"string",
... | Method to set property renderer
@param AbstractRenderer|string $renderer
@return static Return self to support chaining. | [
"Method",
"to",
"set",
"property",
"renderer"
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/View/Traits/LayoutRenderableTrait.php#L89-L94 |
29,633 | ventoviro/windwalker-core | src/Core/View/Traits/LayoutRenderableTrait.php | LayoutRenderableTrait.getRendererManager | public function getRendererManager()
{
if (!$this->rendererManager) {
$this->rendererManager = $this->getPackage()->getContainer()->get('renderer.manager');
}
return $this->rendererManager;
} | php | public function getRendererManager()
{
if (!$this->rendererManager) {
$this->rendererManager = $this->getPackage()->getContainer()->get('renderer.manager');
}
return $this->rendererManager;
} | [
"public",
"function",
"getRendererManager",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"rendererManager",
")",
"{",
"$",
"this",
"->",
"rendererManager",
"=",
"$",
"this",
"->",
"getPackage",
"(",
")",
"->",
"getContainer",
"(",
")",
"->",
"get",
... | Method to get property RendererManager
@return RendererManager | [
"Method",
"to",
"get",
"property",
"RendererManager"
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/View/Traits/LayoutRenderableTrait.php#L248-L255 |
29,634 | acdh-oeaw/repo-php-util | src/acdhOeaw/fedora/FedoraCache.php | FedoraCache.deleteByUri | public function deleteByUri(string $uri) {
if (!isset($this->cache[$uri])) {
throw new NotInCache();
}
foreach ($this->uri2id[$uri] as $id) {
unset($this->id2uri[$id]);
}
unset($this->uri2id[$uri]);
unset($this->cache[$uri]);
} | php | public function deleteByUri(string $uri) {
if (!isset($this->cache[$uri])) {
throw new NotInCache();
}
foreach ($this->uri2id[$uri] as $id) {
unset($this->id2uri[$id]);
}
unset($this->uri2id[$uri]);
unset($this->cache[$uri]);
} | [
"public",
"function",
"deleteByUri",
"(",
"string",
"$",
"uri",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"$",
"uri",
"]",
")",
")",
"{",
"throw",
"new",
"NotInCache",
"(",
")",
";",
"}",
"foreach",
"(",
"$",
"this"... | Removes given resource from cache.
@param string $uri resource URI | [
"Removes",
"given",
"resource",
"from",
"cache",
"."
] | e22c7cd2613f3c8daf0deee879896d9cd7f61b41 | https://github.com/acdh-oeaw/repo-php-util/blob/e22c7cd2613f3c8daf0deee879896d9cd7f61b41/src/acdhOeaw/fedora/FedoraCache.php#L77-L86 |
29,635 | acdh-oeaw/repo-php-util | src/acdhOeaw/fedora/FedoraCache.php | FedoraCache.deleteById | public function deleteById(string $id) {
if (!isset($this->id2uri[$id])) {
throw new NotInCache();
}
$this->deleteByUri($this->id2uri[$id]);
} | php | public function deleteById(string $id) {
if (!isset($this->id2uri[$id])) {
throw new NotInCache();
}
$this->deleteByUri($this->id2uri[$id]);
} | [
"public",
"function",
"deleteById",
"(",
"string",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"id2uri",
"[",
"$",
"id",
"]",
")",
")",
"{",
"throw",
"new",
"NotInCache",
"(",
")",
";",
"}",
"$",
"this",
"->",
"deleteByU... | Removes resource with a given internal id from cache.
@param string $id resource repo internal id
@throws NotInCache | [
"Removes",
"resource",
"with",
"a",
"given",
"internal",
"id",
"from",
"cache",
"."
] | e22c7cd2613f3c8daf0deee879896d9cd7f61b41 | https://github.com/acdh-oeaw/repo-php-util/blob/e22c7cd2613f3c8daf0deee879896d9cd7f61b41/src/acdhOeaw/fedora/FedoraCache.php#L93-L98 |
29,636 | acdh-oeaw/repo-php-util | src/acdhOeaw/fedora/FedoraCache.php | FedoraCache.reload | public function reload(FedoraResource $res) {
if (isset($this->cache[$res->getUri(true)])) {
$this->delete($res);
}
$this->add($res);
} | php | public function reload(FedoraResource $res) {
if (isset($this->cache[$res->getUri(true)])) {
$this->delete($res);
}
$this->add($res);
} | [
"public",
"function",
"reload",
"(",
"FedoraResource",
"$",
"res",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"$",
"res",
"->",
"getUri",
"(",
"true",
")",
"]",
")",
")",
"{",
"$",
"this",
"->",
"delete",
"(",
"$",
"res",... | Refreshes given resource in cache.
@param FedoraResource $res resource object | [
"Refreshes",
"given",
"resource",
"in",
"cache",
"."
] | e22c7cd2613f3c8daf0deee879896d9cd7f61b41 | https://github.com/acdh-oeaw/repo-php-util/blob/e22c7cd2613f3c8daf0deee879896d9cd7f61b41/src/acdhOeaw/fedora/FedoraCache.php#L112-L117 |
29,637 | acdh-oeaw/repo-php-util | src/acdhOeaw/fedora/FedoraCache.php | FedoraCache.add | public function add(FedoraResource $res) {
$uri = $res->getUri(true);
if (isset($this->cache[$uri])) {
if (get_class($res) === get_class($this->cache[$uri])) {
throw new AlreadyInCache();
} else {
$this->deleteByUri($uri);
}
}
... | php | public function add(FedoraResource $res) {
$uri = $res->getUri(true);
if (isset($this->cache[$uri])) {
if (get_class($res) === get_class($this->cache[$uri])) {
throw new AlreadyInCache();
} else {
$this->deleteByUri($uri);
}
}
... | [
"public",
"function",
"add",
"(",
"FedoraResource",
"$",
"res",
")",
"{",
"$",
"uri",
"=",
"$",
"res",
"->",
"getUri",
"(",
"true",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"$",
"uri",
"]",
")",
")",
"{",
"if",
"(",
... | Adds given object to the cache.
@param FedoraResource $res resource object
@throws AlreadyInCache
@throws NotFound
@throws Deleted
@throws ClientException | [
"Adds",
"given",
"object",
"to",
"the",
"cache",
"."
] | e22c7cd2613f3c8daf0deee879896d9cd7f61b41 | https://github.com/acdh-oeaw/repo-php-util/blob/e22c7cd2613f3c8daf0deee879896d9cd7f61b41/src/acdhOeaw/fedora/FedoraCache.php#L127-L154 |
29,638 | acdh-oeaw/repo-php-util | src/acdhOeaw/fedora/FedoraCache.php | FedoraCache.getById | public function getById(string $id): FedoraResource {
if (!isset($this->id2uri[$id])) {
throw new NotInCache();
}
return $this->cache[$this->id2uri[$id]];
} | php | public function getById(string $id): FedoraResource {
if (!isset($this->id2uri[$id])) {
throw new NotInCache();
}
return $this->cache[$this->id2uri[$id]];
} | [
"public",
"function",
"getById",
"(",
"string",
"$",
"id",
")",
":",
"FedoraResource",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"id2uri",
"[",
"$",
"id",
"]",
")",
")",
"{",
"throw",
"new",
"NotInCache",
"(",
")",
";",
"}",
"return",
... | Gets a resource from cache by its repo internal id.
@param string $id resource's repo internal id
@return FedoraResource
@throws NotInCache | [
"Gets",
"a",
"resource",
"from",
"cache",
"by",
"its",
"repo",
"internal",
"id",
"."
] | e22c7cd2613f3c8daf0deee879896d9cd7f61b41 | https://github.com/acdh-oeaw/repo-php-util/blob/e22c7cd2613f3c8daf0deee879896d9cd7f61b41/src/acdhOeaw/fedora/FedoraCache.php#L162-L167 |
29,639 | acdh-oeaw/repo-php-util | src/acdhOeaw/fedora/FedoraCache.php | FedoraCache.getByUri | public function getByUri(string $uri): FedoraResource {
if (!isset($this->cache[$uri])) {
throw new NotInCache();
}
return $this->cache[$uri];
} | php | public function getByUri(string $uri): FedoraResource {
if (!isset($this->cache[$uri])) {
throw new NotInCache();
}
return $this->cache[$uri];
} | [
"public",
"function",
"getByUri",
"(",
"string",
"$",
"uri",
")",
":",
"FedoraResource",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"cache",
"[",
"$",
"uri",
"]",
")",
")",
"{",
"throw",
"new",
"NotInCache",
"(",
")",
";",
"}",
"return",... | Gets a resource from cache by its URI.
@param string $uri resource URI
@return FedoraResource
@throws NotInCache | [
"Gets",
"a",
"resource",
"from",
"cache",
"by",
"its",
"URI",
"."
] | e22c7cd2613f3c8daf0deee879896d9cd7f61b41 | https://github.com/acdh-oeaw/repo-php-util/blob/e22c7cd2613f3c8daf0deee879896d9cd7f61b41/src/acdhOeaw/fedora/FedoraCache.php#L175-L180 |
29,640 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Event/EventDispatcher.php | EventDispatcher.dispatch | public function dispatch($eventStr)
{
try {
// decode as array because data proprty, which has unknown structure (only known by handler),
// must remain array after mapping to event
$arr = MapperUtil::jsonDecode($eventStr, true);
$event = MapperUtil::map($arr,... | php | public function dispatch($eventStr)
{
try {
// decode as array because data proprty, which has unknown structure (only known by handler),
// must remain array after mapping to event
$arr = MapperUtil::jsonDecode($eventStr, true);
$event = MapperUtil::map($arr,... | [
"public",
"function",
"dispatch",
"(",
"$",
"eventStr",
")",
"{",
"try",
"{",
"// decode as array because data proprty, which has unknown structure (only known by handler),",
"// must remain array after mapping to event",
"$",
"arr",
"=",
"MapperUtil",
"::",
"jsonDecode",
"(",
... | Dispatch the event string to a responsible handler if any.
@param string $eventStr The event JSON.
@return void
@throws AbstractError | [
"Dispatch",
"the",
"event",
"string",
"to",
"a",
"responsible",
"handler",
"if",
"any",
"."
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Event/EventDispatcher.php#L42-L66 |
29,641 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Client/FileStorage.php | FileStorage.set | public function set($key, $value)
{
// take care about replacing keys !
if (is_resource($value) || $value instanceof StreamInterface) {
$res = file_put_contents($this->filePath($key), $value);
if ($res !== false) {
// clear plain storage from key
... | php | public function set($key, $value)
{
// take care about replacing keys !
if (is_resource($value) || $value instanceof StreamInterface) {
$res = file_put_contents($this->filePath($key), $value);
if ($res !== false) {
// clear plain storage from key
... | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"// take care about replacing keys !",
"if",
"(",
"is_resource",
"(",
"$",
"value",
")",
"||",
"$",
"value",
"instanceof",
"StreamInterface",
")",
"{",
"$",
"res",
"=",
"file_put_cont... | Set an item in the cache
@param string $key
@param mixed $value
@return bool | [
"Set",
"an",
"item",
"in",
"the",
"cache"
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Client/FileStorage.php#L68-L87 |
29,642 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Client/FileStorage.php | FileStorage.delete | public function delete($key)
{
$res = $this->deleteFile($key);
if ($res === false) {
return false;
}
return $this->deleteStore($key);
} | php | public function delete($key)
{
$res = $this->deleteFile($key);
if ($res === false) {
return false;
}
return $this->deleteStore($key);
} | [
"public",
"function",
"delete",
"(",
"$",
"key",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"deleteFile",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"res",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"... | Remove a key from the cache.
@param string $key
@return bool | [
"Remove",
"a",
"key",
"from",
"the",
"cache",
"."
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Client/FileStorage.php#L96-L104 |
29,643 | polyfony-inc/polyfony | Private/Polyfony/Mail.php | Mail.configureEnvironmentSpecifics | private function configureEnvironmentSpecifics() {
// if we are in production we set the actual recipients
if(Config::isProd()) {
// set the main recipients
foreach($this->recipients['to'] as $mail => $name) {
// add to the mailer
$this->mailer->addAddre... | php | private function configureEnvironmentSpecifics() {
// if we are in production we set the actual recipients
if(Config::isProd()) {
// set the main recipients
foreach($this->recipients['to'] as $mail => $name) {
// add to the mailer
$this->mailer->addAddre... | [
"private",
"function",
"configureEnvironmentSpecifics",
"(",
")",
"{",
"// if we are in production we set the actual recipients",
"if",
"(",
"Config",
"::",
"isProd",
"(",
")",
")",
"{",
"// set the main recipients",
"foreach",
"(",
"$",
"this",
"->",
"recipients",
"[",... | this applies options that are only used in development, or only in production | [
"this",
"applies",
"options",
"that",
"are",
"only",
"used",
"in",
"development",
"or",
"only",
"in",
"production"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Mail.php#L303-L327 |
29,644 | polyfony-inc/polyfony | Private/Polyfony/Response/HTML.php | HTML.setLinks | public static function setLinks(array $links, bool $replace_existing=false) :void {
// if we want to purge existing links
!$replace_existing ?: self::$_links = [];
// href is the key for storing links
foreach($links as $href_or_index => $attributes_or_href) {
// if arguments are provided
if(is_array($att... | php | public static function setLinks(array $links, bool $replace_existing=false) :void {
// if we want to purge existing links
!$replace_existing ?: self::$_links = [];
// href is the key for storing links
foreach($links as $href_or_index => $attributes_or_href) {
// if arguments are provided
if(is_array($att... | [
"public",
"static",
"function",
"setLinks",
"(",
"array",
"$",
"links",
",",
"bool",
"$",
"replace_existing",
"=",
"false",
")",
":",
"void",
"{",
"// if we want to purge existing links",
"!",
"$",
"replace_existing",
"?",
":",
"self",
"::",
"$",
"_links",
"="... | set links for the current HTML page | [
"set",
"links",
"for",
"the",
"current",
"HTML",
"page"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Response/HTML.php#L15-L61 |
29,645 | polyfony-inc/polyfony | Private/Polyfony/Response/HTML.php | HTML.setScripts | public static function setScripts(array $scripts, bool $replace_existing=false) :void {
// if we want to purge existing scripts
!$replace_existing ?: self::$_scripts = [];
// for each script we have to set
foreach($scripts as $script) {
// rewrite its path
self::$_scripts[] = self::getPublicAssetPath($scr... | php | public static function setScripts(array $scripts, bool $replace_existing=false) :void {
// if we want to purge existing scripts
!$replace_existing ?: self::$_scripts = [];
// for each script we have to set
foreach($scripts as $script) {
// rewrite its path
self::$_scripts[] = self::getPublicAssetPath($scr... | [
"public",
"static",
"function",
"setScripts",
"(",
"array",
"$",
"scripts",
",",
"bool",
"$",
"replace_existing",
"=",
"false",
")",
":",
"void",
"{",
"// if we want to purge existing scripts",
"!",
"$",
"replace_existing",
"?",
":",
"self",
"::",
"$",
"_scripts... | set scripts for the current HTML page | [
"set",
"scripts",
"for",
"the",
"current",
"HTML",
"page"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Response/HTML.php#L64-L72 |
29,646 | polyfony-inc/polyfony | Private/Polyfony/Response/HTML.php | HTML.setMetas | public static function setMetas(array $metas, bool $replace_existing=false) :void {
// if we want to purge existing metas
!$replace_existing ?: self::$_metas = [];
// name is the key for storing metas
self::$_metas += $metas;
} | php | public static function setMetas(array $metas, bool $replace_existing=false) :void {
// if we want to purge existing metas
!$replace_existing ?: self::$_metas = [];
// name is the key for storing metas
self::$_metas += $metas;
} | [
"public",
"static",
"function",
"setMetas",
"(",
"array",
"$",
"metas",
",",
"bool",
"$",
"replace_existing",
"=",
"false",
")",
":",
"void",
"{",
"// if we want to purge existing metas",
"!",
"$",
"replace_existing",
"?",
":",
"self",
"::",
"$",
"_metas",
"="... | set metas for the current HTML page | [
"set",
"metas",
"for",
"the",
"current",
"HTML",
"page"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Response/HTML.php#L76-L81 |
29,647 | polyfony-inc/polyfony | Private/Polyfony/Response/HTML.php | HTML.set | public static function set(array $assets) :void {
// for each batch
foreach($assets as $category => $scripts_or_links_or_metas) {
// if the batch is scripts
if($category == 'scripts') {
self::setScripts($scripts_or_links_or_metas);
}
// if the batch is links
elseif($category == 'links') {
sel... | php | public static function set(array $assets) :void {
// for each batch
foreach($assets as $category => $scripts_or_links_or_metas) {
// if the batch is scripts
if($category == 'scripts') {
self::setScripts($scripts_or_links_or_metas);
}
// if the batch is links
elseif($category == 'links') {
sel... | [
"public",
"static",
"function",
"set",
"(",
"array",
"$",
"assets",
")",
":",
"void",
"{",
"// for each batch",
"foreach",
"(",
"$",
"assets",
"as",
"$",
"category",
"=>",
"$",
"scripts_or_links_or_metas",
")",
"{",
"// if the batch is scripts",
"if",
"(",
"$"... | shortcuts to quickly set multiple things | [
"shortcuts",
"to",
"quickly",
"set",
"multiple",
"things"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Response/HTML.php#L84-L100 |
29,648 | polyfony-inc/polyfony | Private/Polyfony/Response/HTML.php | HTML.buildAndGetPage | public static function buildAndGetPage(string $content) :string {
// initial content
$page = '<!doctype html><html lang="'.\Polyfony\Locales::getLanguage().'"><head><title>'.(isset(self::$_metas['title']) ? self::$_metas['title'] : '').'</title><meta http-equiv="content-type" content="text/html; charset=' . \Polyfo... | php | public static function buildAndGetPage(string $content) :string {
// initial content
$page = '<!doctype html><html lang="'.\Polyfony\Locales::getLanguage().'"><head><title>'.(isset(self::$_metas['title']) ? self::$_metas['title'] : '').'</title><meta http-equiv="content-type" content="text/html; charset=' . \Polyfo... | [
"public",
"static",
"function",
"buildAndGetPage",
"(",
"string",
"$",
"content",
")",
":",
"string",
"{",
"// initial content",
"$",
"page",
"=",
"'<!doctype html><html lang=\"'",
".",
"\\",
"Polyfony",
"\\",
"Locales",
"::",
"getLanguage",
"(",
")",
".",
"'\">... | build an html page | [
"build",
"an",
"html",
"page"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Response/HTML.php#L103-L115 |
29,649 | polyfony-inc/polyfony | Private/Polyfony/Response/HTML.php | HTML.buildMetasTags | private static function buildMetasTags() :string {
// this is where formatted meta tags go
$metas = '';
// for each available meta
foreach(self::$_metas as $name => $content) {
// add the formated the meta
$metas .= '<meta name="'.$name.'" content="'.\Polyfony\Format::htmlSafe($content).'" />';
}
retu... | php | private static function buildMetasTags() :string {
// this is where formatted meta tags go
$metas = '';
// for each available meta
foreach(self::$_metas as $name => $content) {
// add the formated the meta
$metas .= '<meta name="'.$name.'" content="'.\Polyfony\Format::htmlSafe($content).'" />';
}
retu... | [
"private",
"static",
"function",
"buildMetasTags",
"(",
")",
":",
"string",
"{",
"// this is where formatted meta tags go",
"$",
"metas",
"=",
"''",
";",
"// for each available meta",
"foreach",
"(",
"self",
"::",
"$",
"_metas",
"as",
"$",
"name",
"=>",
"$",
"co... | builds meta code | [
"builds",
"meta",
"code"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Response/HTML.php#L120-L130 |
29,650 | polyfony-inc/polyfony | Private/Polyfony/Response/HTML.php | HTML.buildLinksTags | private static function buildLinksTags() :string {
// this is where formatted links tags go
$links = [];
// pack and minify
self::packAndMinifyLinks();
// for each available link
foreach(self::$_links as $href => $attributes) {
// sort the attributes (compulse order needs)
ksort($attributes);
// bu... | php | private static function buildLinksTags() :string {
// this is where formatted links tags go
$links = [];
// pack and minify
self::packAndMinifyLinks();
// for each available link
foreach(self::$_links as $href => $attributes) {
// sort the attributes (compulse order needs)
ksort($attributes);
// bu... | [
"private",
"static",
"function",
"buildLinksTags",
"(",
")",
":",
"string",
"{",
"// this is where formatted links tags go",
"$",
"links",
"=",
"[",
"]",
";",
"// pack and minify",
"self",
"::",
"packAndMinifyLinks",
"(",
")",
";",
"// for each available link",
"forea... | build links code | [
"build",
"links",
"code"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Response/HTML.php#L133-L146 |
29,651 | polyfony-inc/polyfony | Private/Polyfony/Response/HTML.php | HTML.doesThisPackNeedRegeneration | private static function doesThisPackNeedRegeneration(string $pack_path) :bool {
return
// if the file does not exist
!file_exists($pack_path) ||
// or if we're not allowed to use cached items
!\Polyfony\Config::get('response','cache') ||
// of if the request explicitely disallows that
!\Polyfony\R... | php | private static function doesThisPackNeedRegeneration(string $pack_path) :bool {
return
// if the file does not exist
!file_exists($pack_path) ||
// or if we're not allowed to use cached items
!\Polyfony\Config::get('response','cache') ||
// of if the request explicitely disallows that
!\Polyfony\R... | [
"private",
"static",
"function",
"doesThisPackNeedRegeneration",
"(",
"string",
"$",
"pack_path",
")",
":",
"bool",
"{",
"return",
"// if the file does not exist",
"!",
"file_exists",
"(",
"$",
"pack_path",
")",
"||",
"// or if we're not allowed to use cached items",
"!",... | if this pack needs to be generated again | [
"if",
"this",
"pack",
"needs",
"to",
"be",
"generated",
"again"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Response/HTML.php#L266-L274 |
29,652 | polyfony-inc/polyfony | Private/Polyfony/Response/HTML.php | HTML.getPublicAssetPath | private static function getPublicAssetPath(string $asset_path, string $asset_type) :string {
// if the asset path is absolute in any way
return (substr($asset_path,0,1) == '/' || substr($asset_path,0,4) == 'http') ?
// it is returned as is, // otherwise it is made relative to the Assets folder
$asset_path : "... | php | private static function getPublicAssetPath(string $asset_path, string $asset_type) :string {
// if the asset path is absolute in any way
return (substr($asset_path,0,1) == '/' || substr($asset_path,0,4) == 'http') ?
// it is returned as is, // otherwise it is made relative to the Assets folder
$asset_path : "... | [
"private",
"static",
"function",
"getPublicAssetPath",
"(",
"string",
"$",
"asset_path",
",",
"string",
"$",
"asset_type",
")",
":",
"string",
"{",
"// if the asset path is absolute in any way",
"return",
"(",
"substr",
"(",
"$",
"asset_path",
",",
"0",
",",
"1",
... | assets path converter | [
"assets",
"path",
"converter"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Response/HTML.php#L277-L282 |
29,653 | polyfony-inc/polyfony | Private/Polyfony/Response/HTML.php | HTML.getMinifiedPackIfAllowed | private static function getMinifiedPackIfAllowed(string $pack_contents, object $packer_object=null) :string {
// if we are allowed to minify
return \Polyfony\Config::get('response','minify') ?
($packer_object)->add($pack_contents)->minify() :
$pack_contents;
} | php | private static function getMinifiedPackIfAllowed(string $pack_contents, object $packer_object=null) :string {
// if we are allowed to minify
return \Polyfony\Config::get('response','minify') ?
($packer_object)->add($pack_contents)->minify() :
$pack_contents;
} | [
"private",
"static",
"function",
"getMinifiedPackIfAllowed",
"(",
"string",
"$",
"pack_contents",
",",
"object",
"$",
"packer_object",
"=",
"null",
")",
":",
"string",
"{",
"// if we are allowed to minify",
"return",
"\\",
"Polyfony",
"\\",
"Config",
"::",
"get",
... | minify the packed content if it's allowed, otherwise return is at is | [
"minify",
"the",
"packed",
"content",
"if",
"it",
"s",
"allowed",
"otherwise",
"return",
"is",
"at",
"is"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Response/HTML.php#L294-L300 |
29,654 | hnhdigital-os/laravel-model-schema | src/Concerns/HasAttributes.php | HasAttributes.addMissingAttributes | public function addMissingAttributes()
{
foreach ($this->getSchema() as $key => $settings) {
if (!array_has($this->attributes, $key)) {
array_set($this->attributes, $key, array_get($settings, 'default', null));
}
}
} | php | public function addMissingAttributes()
{
foreach ($this->getSchema() as $key => $settings) {
if (!array_has($this->attributes, $key)) {
array_set($this->attributes, $key, array_get($settings, 'default', null));
}
}
} | [
"public",
"function",
"addMissingAttributes",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getSchema",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"settings",
")",
"{",
"if",
"(",
"!",
"array_has",
"(",
"$",
"this",
"->",
"attributes",
",",
"$",
"ke... | Set's mising attributes.
This covers situations where values have defaults but are not fillable, or
date field.
@return void | [
"Set",
"s",
"mising",
"attributes",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Concerns/HasAttributes.php#L109-L116 |
29,655 | hnhdigital-os/laravel-model-schema | src/Concerns/HasAttributes.php | HasAttributes.hasWriteAccess | public function hasWriteAccess($key)
{
if (static::$unguarded) {
return true;
}
// Attribute is guarded.
if (in_array($key, $this->getGuarded())) {
return false;
}
if (($method = $this->getAuthMethod($key)) !== false) {
return $th... | php | public function hasWriteAccess($key)
{
if (static::$unguarded) {
return true;
}
// Attribute is guarded.
if (in_array($key, $this->getGuarded())) {
return false;
}
if (($method = $this->getAuthMethod($key)) !== false) {
return $th... | [
"public",
"function",
"hasWriteAccess",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"unguarded",
")",
"{",
"return",
"true",
";",
"}",
"// Attribute is guarded.",
"if",
"(",
"in_array",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"getGuarded"... | Has write access to a given key on this model.
@param string $key
@return bool | [
"Has",
"write",
"access",
"to",
"a",
"given",
"key",
"on",
"this",
"model",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Concerns/HasAttributes.php#L145-L170 |
29,656 | hnhdigital-os/laravel-model-schema | src/Concerns/HasAttributes.php | HasAttributes.setDefaultValuesForAttributes | public function setDefaultValuesForAttributes()
{
// Only works on new models.
if ($this->exists) {
return $this;
}
// Defaults on attributes.
$defaults = $this->getAttributesFromSchema('default', true);
// Remove attributes that have been given values.
... | php | public function setDefaultValuesForAttributes()
{
// Only works on new models.
if ($this->exists) {
return $this;
}
// Defaults on attributes.
$defaults = $this->getAttributesFromSchema('default', true);
// Remove attributes that have been given values.
... | [
"public",
"function",
"setDefaultValuesForAttributes",
"(",
")",
"{",
"// Only works on new models.",
"if",
"(",
"$",
"this",
"->",
"exists",
")",
"{",
"return",
"$",
"this",
";",
"}",
"// Defaults on attributes.",
"$",
"defaults",
"=",
"$",
"this",
"->",
"getAt... | Set default values on this attribute.
@return $this | [
"Set",
"default",
"values",
"on",
"this",
"attribute",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Concerns/HasAttributes.php#L177-L202 |
29,657 | hnhdigital-os/laravel-model-schema | src/Concerns/HasAttributes.php | HasAttributes.getCastParams | public function getCastParams()
{
if ($this->getIncrementing()) {
return array_merge(
[
$this->getKeyName() => $this->getKeyType(),
],
$this->getAttributesFromSchema('cast', true)
);
}
return $this->... | php | public function getCastParams()
{
if ($this->getIncrementing()) {
return array_merge(
[
$this->getKeyName() => $this->getKeyType(),
],
$this->getAttributesFromSchema('cast', true)
);
}
return $this->... | [
"public",
"function",
"getCastParams",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getIncrementing",
"(",
")",
")",
"{",
"return",
"array_merge",
"(",
"[",
"$",
"this",
"->",
"getKeyName",
"(",
")",
"=>",
"$",
"this",
"->",
"getKeyType",
"(",
")",
... | Get the casts params array.
@return array | [
"Get",
"the",
"casts",
"params",
"array",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Concerns/HasAttributes.php#L228-L240 |
29,658 | hnhdigital-os/laravel-model-schema | src/Concerns/HasAttributes.php | HasAttributes.getCastFromDefinition | protected function getCastFromDefinition($type)
{
// Custom definitions.
if (array_has(static::$cast_from, $type)) {
return array_get(static::$cast_from, $type);
}
// Fallback to default.
if (array_has(static::$default_cast_from, $type)) {
return arra... | php | protected function getCastFromDefinition($type)
{
// Custom definitions.
if (array_has(static::$cast_from, $type)) {
return array_get(static::$cast_from, $type);
}
// Fallback to default.
if (array_has(static::$default_cast_from, $type)) {
return arra... | [
"protected",
"function",
"getCastFromDefinition",
"(",
"$",
"type",
")",
"{",
"// Custom definitions.",
"if",
"(",
"array_has",
"(",
"static",
"::",
"$",
"cast_from",
",",
"$",
"type",
")",
")",
"{",
"return",
"array_get",
"(",
"static",
"::",
"$",
"cast_fro... | Get the method to cast this attribte type.
@param string $type
@return string|array|bool | [
"Get",
"the",
"method",
"to",
"cast",
"this",
"attribte",
"type",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Concerns/HasAttributes.php#L290-L303 |
29,659 | hnhdigital-os/laravel-model-schema | src/Concerns/HasAttributes.php | HasAttributes.getCastAsParamaters | protected function getCastAsParamaters($key)
{
$cast_params = $this->getCastParams();
$paramaters = explode(':', array_get($cast_params, $key, ''));
$parsed = $this->parseCastParamaters($paramaters);
return $parsed;
} | php | protected function getCastAsParamaters($key)
{
$cast_params = $this->getCastParams();
$paramaters = explode(':', array_get($cast_params, $key, ''));
$parsed = $this->parseCastParamaters($paramaters);
return $parsed;
} | [
"protected",
"function",
"getCastAsParamaters",
"(",
"$",
"key",
")",
"{",
"$",
"cast_params",
"=",
"$",
"this",
"->",
"getCastParams",
"(",
")",
";",
"$",
"paramaters",
"=",
"explode",
"(",
"':'",
",",
"array_get",
"(",
"$",
"cast_params",
",",
"$",
"ke... | Get the method to cast this attribte tyepca.
@param string $type
@return string|array|bool | [
"Get",
"the",
"method",
"to",
"cast",
"this",
"attribte",
"tyepca",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Concerns/HasAttributes.php#L312-L320 |
29,660 | hnhdigital-os/laravel-model-schema | src/Concerns/HasAttributes.php | HasAttributes.parseCastParamaters | private function parseCastParamaters($paramaters)
{
foreach ($paramaters as &$value) {
// Local callable method. ($someMethod())
if (substr($value, 0, 1) === '$' && stripos($value, '()') !== false) {
$method = substr($value, 1, -2);
$value = is_callabl... | php | private function parseCastParamaters($paramaters)
{
foreach ($paramaters as &$value) {
// Local callable method. ($someMethod())
if (substr($value, 0, 1) === '$' && stripos($value, '()') !== false) {
$method = substr($value, 1, -2);
$value = is_callabl... | [
"private",
"function",
"parseCastParamaters",
"(",
"$",
"paramaters",
")",
"{",
"foreach",
"(",
"$",
"paramaters",
"as",
"&",
"$",
"value",
")",
"{",
"// Local callable method. ($someMethod())",
"if",
"(",
"substr",
"(",
"$",
"value",
",",
"0",
",",
"1",
")"... | Parse the given cast parameters.
@param array $paramaters
@return array | [
"Parse",
"the",
"given",
"cast",
"parameters",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Concerns/HasAttributes.php#L329-L352 |
29,661 | hnhdigital-os/laravel-model-schema | src/Concerns/HasAttributes.php | HasAttributes.getAuthMethod | public function getAuthMethod($key)
{
if (array_has($this->getAuths(), $key)) {
$method = 'auth'.studly_case(array_get($this->getAuths(), $key));
return method_exists($this, $method) ? $method : false;
}
return false;
} | php | public function getAuthMethod($key)
{
if (array_has($this->getAuths(), $key)) {
$method = 'auth'.studly_case(array_get($this->getAuths(), $key));
return method_exists($this, $method) ? $method : false;
}
return false;
} | [
"public",
"function",
"getAuthMethod",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"array_has",
"(",
"$",
"this",
"->",
"getAuths",
"(",
")",
",",
"$",
"key",
")",
")",
"{",
"$",
"method",
"=",
"'auth'",
".",
"studly_case",
"(",
"array_get",
"(",
"$",
"t... | Get auth method.
@param string $key
@return string|array | [
"Get",
"auth",
"method",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Concerns/HasAttributes.php#L393-L402 |
29,662 | hnhdigital-os/laravel-model-schema | src/Concerns/HasAttributes.php | HasAttributes.getCastToDefinition | protected function getCastToDefinition($type)
{
// Custom definitions.
if (array_has(static::$cast_to, $type)) {
return array_get(static::$cast_to, $type);
}
// Fallback to default.
if (array_has(static::$default_cast_to, $type)) {
return array_get(st... | php | protected function getCastToDefinition($type)
{
// Custom definitions.
if (array_has(static::$cast_to, $type)) {
return array_get(static::$cast_to, $type);
}
// Fallback to default.
if (array_has(static::$default_cast_to, $type)) {
return array_get(st... | [
"protected",
"function",
"getCastToDefinition",
"(",
"$",
"type",
")",
"{",
"// Custom definitions.",
"if",
"(",
"array_has",
"(",
"static",
"::",
"$",
"cast_to",
",",
"$",
"type",
")",
")",
"{",
"return",
"array_get",
"(",
"static",
"::",
"$",
"cast_to",
... | Get the method to cast this attribte back to it's original form.
@param string $type
@return string|array|bool | [
"Get",
"the",
"method",
"to",
"cast",
"this",
"attribte",
"back",
"to",
"it",
"s",
"original",
"form",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Concerns/HasAttributes.php#L475-L488 |
29,663 | hnhdigital-os/laravel-model-schema | src/Concerns/HasAttributes.php | HasAttributes.savingValidation | public function savingValidation()
{
global $app;
$this->preValidationCast();
$this->validator = new Validator($app['translator'], $this->getDirty(), $this->getAttributeRules());
if ($this->validator->fails()) {
return false;
}
return true;
} | php | public function savingValidation()
{
global $app;
$this->preValidationCast();
$this->validator = new Validator($app['translator'], $this->getDirty(), $this->getAttributeRules());
if ($this->validator->fails()) {
return false;
}
return true;
} | [
"public",
"function",
"savingValidation",
"(",
")",
"{",
"global",
"$",
"app",
";",
"$",
"this",
"->",
"preValidationCast",
"(",
")",
";",
"$",
"this",
"->",
"validator",
"=",
"new",
"Validator",
"(",
"$",
"app",
"[",
"'translator'",
"]",
",",
"$",
"th... | Validate the model before saving.
@return array | [
"Validate",
"the",
"model",
"before",
"saving",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Concerns/HasAttributes.php#L687-L699 |
29,664 | hnhdigital-os/laravel-model-schema | src/Concerns/HasAttributes.php | HasAttributes.preValidationCast | private function preValidationCast()
{
$rules = $this->getAttributeRules();
// Check each dirty attribute.
foreach ($this->getDirty() as $key => $value) {
// Get the rules.
$rules_array = explode('|', array_get($rules, $key, ''));
// First item is always... | php | private function preValidationCast()
{
$rules = $this->getAttributeRules();
// Check each dirty attribute.
foreach ($this->getDirty() as $key => $value) {
// Get the rules.
$rules_array = explode('|', array_get($rules, $key, ''));
// First item is always... | [
"private",
"function",
"preValidationCast",
"(",
")",
"{",
"$",
"rules",
"=",
"$",
"this",
"->",
"getAttributeRules",
"(",
")",
";",
"// Check each dirty attribute.",
"foreach",
"(",
"$",
"this",
"->",
"getDirty",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"va... | Before validating, ensure the values are correctly casted.
Mostly integer or boolean values where they can be set to either.
eg 1 for true.
@return void | [
"Before",
"validating",
"ensure",
"the",
"values",
"are",
"correctly",
"casted",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Concerns/HasAttributes.php#L709-L746 |
29,665 | hnhdigital-os/laravel-model-schema | src/Concerns/HasAttributes.php | HasAttributes.getAttributeRules | public function getAttributeRules()
{
$result = [];
$attributes = $this->getAttributesFromSchema();
$casts = $this->getCasts();
$casts_back = $this->getAttributesFromSchema('cast-back', true);
$rules = $this->getAttributesFromSchema('rules', true);
// Build full rule... | php | public function getAttributeRules()
{
$result = [];
$attributes = $this->getAttributesFromSchema();
$casts = $this->getCasts();
$casts_back = $this->getAttributesFromSchema('cast-back', true);
$rules = $this->getAttributesFromSchema('rules', true);
// Build full rule... | [
"public",
"function",
"getAttributeRules",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"attributes",
"=",
"$",
"this",
"->",
"getAttributesFromSchema",
"(",
")",
";",
"$",
"casts",
"=",
"$",
"this",
"->",
"getCasts",
"(",
")",
";",
"$",
"c... | Get rules for attributes.
@return array | [
"Get",
"rules",
"for",
"attributes",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Concerns/HasAttributes.php#L753-L795 |
29,666 | hnhdigital-os/laravel-model-schema | src/Concerns/HasAttributes.php | HasAttributes.parseCastToValidator | private function parseCastToValidator($type)
{
if (array_has(static::$cast_validation, $type)) {
return array_get(static::$cast_validation, $type);
}
if (array_has(static::$default_cast_validation, $type)) {
return array_get(static::$default_cast_validation, $type);
... | php | private function parseCastToValidator($type)
{
if (array_has(static::$cast_validation, $type)) {
return array_get(static::$cast_validation, $type);
}
if (array_has(static::$default_cast_validation, $type)) {
return array_get(static::$default_cast_validation, $type);
... | [
"private",
"function",
"parseCastToValidator",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"array_has",
"(",
"static",
"::",
"$",
"cast_validation",
",",
"$",
"type",
")",
")",
"{",
"return",
"array_get",
"(",
"static",
"::",
"$",
"cast_validation",
",",
"$",
... | Convert attribute type to validation type.
@param string $type
@return string | [
"Convert",
"attribute",
"type",
"to",
"validation",
"type",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Concerns/HasAttributes.php#L804-L815 |
29,667 | polyfony-inc/polyfony | Private/Polyfony/Security/Accounts.php | Accounts.createCookieSession | private function createCookieSession(string $session_signature) :bool {
// store a cookie with our current session key in it
return Cook::put(
Conf::get('security', 'cookie'),
$session_signature,
true,
Conf::get('security', 'session_duration')
);
} | php | private function createCookieSession(string $session_signature) :bool {
// store a cookie with our current session key in it
return Cook::put(
Conf::get('security', 'cookie'),
$session_signature,
true,
Conf::get('security', 'session_duration')
);
} | [
"private",
"function",
"createCookieSession",
"(",
"string",
"$",
"session_signature",
")",
":",
"bool",
"{",
"// store a cookie with our current session key in it",
"return",
"Cook",
"::",
"put",
"(",
"Conf",
"::",
"get",
"(",
"'security'",
",",
"'cookie'",
")",
",... | first part of the session opening process | [
"first",
"part",
"of",
"the",
"session",
"opening",
"process"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Security/Accounts.php#L99-L109 |
29,668 | polyfony-inc/polyfony | Private/Polyfony/Security/Accounts.php | Accounts.createDatabaseSessionUntil | private function createDatabaseSessionUntil(int $expiration_date, string $session_signature) :bool {
// open the session
return $this->set([
'session_expiration_date' => $expiration_date,
'session_key' => $session_signature,
'last_login_origin' => Sec::getSafeRemoteAddress(),
'last_login_agent' ... | php | private function createDatabaseSessionUntil(int $expiration_date, string $session_signature) :bool {
// open the session
return $this->set([
'session_expiration_date' => $expiration_date,
'session_key' => $session_signature,
'last_login_origin' => Sec::getSafeRemoteAddress(),
'last_login_agent' ... | [
"private",
"function",
"createDatabaseSessionUntil",
"(",
"int",
"$",
"expiration_date",
",",
"string",
"$",
"session_signature",
")",
":",
"bool",
"{",
"// open the session",
"return",
"$",
"this",
"->",
"set",
"(",
"[",
"'session_expiration_date'",
"=>",
"$",
"e... | second part of the session opening process | [
"second",
"part",
"of",
"the",
"session",
"opening",
"process"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Security/Accounts.php#L112-L123 |
29,669 | acdh-oeaw/repo-php-util | src/acdhOeaw/fedora/acl/WebAclRule.php | WebAclRule.checkMode | static public function checkMode(int $mode) {
if (!in_array($mode, array(self::NONE, self::READ, self::WRITE))) {
throw new AclException('wrong mode');
}
} | php | static public function checkMode(int $mode) {
if (!in_array($mode, array(self::NONE, self::READ, self::WRITE))) {
throw new AclException('wrong mode');
}
} | [
"static",
"public",
"function",
"checkMode",
"(",
"int",
"$",
"mode",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"mode",
",",
"array",
"(",
"self",
"::",
"NONE",
",",
"self",
"::",
"READ",
",",
"self",
"::",
"WRITE",
")",
")",
")",
"{",
"thr... | Checks the access mode enumaration
@param int $mode WebAclRule::READ or WebAclRule::WRITE
@throws AclException | [
"Checks",
"the",
"access",
"mode",
"enumaration"
] | e22c7cd2613f3c8daf0deee879896d9cd7f61b41 | https://github.com/acdh-oeaw/repo-php-util/blob/e22c7cd2613f3c8daf0deee879896d9cd7f61b41/src/acdhOeaw/fedora/acl/WebAclRule.php#L73-L77 |
29,670 | acdh-oeaw/repo-php-util | src/acdhOeaw/fedora/acl/WebAclRule.php | WebAclRule.makeValid | public function makeValid(): array {
if ($this->isValid()) {
return array($this);
}
$ret = array();
foreach ($this->resources as $uri => $res) {
$tmp = clone($this);
$tmp->uri = '';
$tmp->resources = array($uri => $res);
... | php | public function makeValid(): array {
if ($this->isValid()) {
return array($this);
}
$ret = array();
foreach ($this->resources as $uri => $res) {
$tmp = clone($this);
$tmp->uri = '';
$tmp->resources = array($uri => $res);
... | [
"public",
"function",
"makeValid",
"(",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"isValid",
"(",
")",
")",
"{",
"return",
"array",
"(",
"$",
"this",
")",
";",
"}",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this... | Returns collection of WebAclRule objects each describing exactly one
resource or class.
@return array
@see isValid() | [
"Returns",
"collection",
"of",
"WebAclRule",
"objects",
"each",
"describing",
"exactly",
"one",
"resource",
"or",
"class",
"."
] | e22c7cd2613f3c8daf0deee879896d9cd7f61b41 | https://github.com/acdh-oeaw/repo-php-util/blob/e22c7cd2613f3c8daf0deee879896d9cd7f61b41/src/acdhOeaw/fedora/acl/WebAclRule.php#L264-L285 |
29,671 | acdh-oeaw/repo-php-util | src/acdhOeaw/fedora/acl/WebAclRule.php | WebAclRule.getAclMetadata | public function getAclMetadata(): Resource {
$meta = (new Graph())->resource($this->uri ? $this->uri : '.');
$meta->addType('http://www.w3.org/ns/auth/acl#Authorization');
$meta->addLiteral(RC::titleProp(), 'Fedora WebAC rule');
foreach ($this->resources as $i) {
$meta->addRe... | php | public function getAclMetadata(): Resource {
$meta = (new Graph())->resource($this->uri ? $this->uri : '.');
$meta->addType('http://www.w3.org/ns/auth/acl#Authorization');
$meta->addLiteral(RC::titleProp(), 'Fedora WebAC rule');
foreach ($this->resources as $i) {
$meta->addRe... | [
"public",
"function",
"getAclMetadata",
"(",
")",
":",
"Resource",
"{",
"$",
"meta",
"=",
"(",
"new",
"Graph",
"(",
")",
")",
"->",
"resource",
"(",
"$",
"this",
"->",
"uri",
"?",
"$",
"this",
"->",
"uri",
":",
"'.'",
")",
";",
"$",
"meta",
"->",... | Returns ACL triples.
@return Resource | [
"Returns",
"ACL",
"triples",
"."
] | e22c7cd2613f3c8daf0deee879896d9cd7f61b41 | https://github.com/acdh-oeaw/repo-php-util/blob/e22c7cd2613f3c8daf0deee879896d9cd7f61b41/src/acdhOeaw/fedora/acl/WebAclRule.php#L291-L322 |
29,672 | acdh-oeaw/repo-php-util | src/acdhOeaw/fedora/acl/WebAclRule.php | WebAclRule.save | public function save(string $location = null): FedoraResource {
if ($this->uri != '') {
$meta = $this->getMetadata();
$meta->merge($this->getAclMetadata(), [RC::idProp()]);
$this->setMetadata($meta);
$this->updateMetadata();
} else {
if ($locat... | php | public function save(string $location = null): FedoraResource {
if ($this->uri != '') {
$meta = $this->getMetadata();
$meta->merge($this->getAclMetadata(), [RC::idProp()]);
$this->setMetadata($meta);
$this->updateMetadata();
} else {
if ($locat... | [
"public",
"function",
"save",
"(",
"string",
"$",
"location",
"=",
"null",
")",
":",
"FedoraResource",
"{",
"if",
"(",
"$",
"this",
"->",
"uri",
"!=",
"''",
")",
"{",
"$",
"meta",
"=",
"$",
"this",
"->",
"getMetadata",
"(",
")",
";",
"$",
"meta",
... | Saves the ACL rule.
If there is no corresponging Fedora resource, it is created as a Fedora
child of a resource denpted by the `$location` parameter.
@param string $location URI of the parent resource (typically an ACL
collection)
@return FedoraResource | [
"Saves",
"the",
"ACL",
"rule",
"."
] | e22c7cd2613f3c8daf0deee879896d9cd7f61b41 | https://github.com/acdh-oeaw/repo-php-util/blob/e22c7cd2613f3c8daf0deee879896d9cd7f61b41/src/acdhOeaw/fedora/acl/WebAclRule.php#L333-L352 |
29,673 | acdh-oeaw/repo-php-util | src/acdhOeaw/fedora/acl/WebAclRule.php | WebAclRule.delete | public function delete(bool $deep = false, bool $children = false,
bool $references = false) {
if ($this->uri != '') {
parent::delete($deep, $children, $references);
}
$this->uri = '';
$this->resources = $this->classes = array();
$th... | php | public function delete(bool $deep = false, bool $children = false,
bool $references = false) {
if ($this->uri != '') {
parent::delete($deep, $children, $references);
}
$this->uri = '';
$this->resources = $this->classes = array();
$th... | [
"public",
"function",
"delete",
"(",
"bool",
"$",
"deep",
"=",
"false",
",",
"bool",
"$",
"children",
"=",
"false",
",",
"bool",
"$",
"references",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"uri",
"!=",
"''",
")",
"{",
"parent",
"::",
... | Removes the ACL rule from the Fedora
@param bool $deep should tombstone resource will be deleted?
@param bool $children should children be removed?
@param bool $references should references to the resource be removed?
(applies also for children when `$children == true`) | [
"Removes",
"the",
"ACL",
"rule",
"from",
"the",
"Fedora"
] | e22c7cd2613f3c8daf0deee879896d9cd7f61b41 | https://github.com/acdh-oeaw/repo-php-util/blob/e22c7cd2613f3c8daf0deee879896d9cd7f61b41/src/acdhOeaw/fedora/acl/WebAclRule.php#L361-L372 |
29,674 | acdh-oeaw/repo-php-util | src/acdhOeaw/fedora/acl/WebAclRule.php | WebAclRule.loadMetadata | protected function loadMetadata(bool $force = false) {
$metaEmpty = $this->metadata == null;
parent::loadMetadata($force);
if ($metaEmpty || $force) {
foreach ($this->metadata->allResources('http://www.w3.org/ns/auth/acl#mode') as $i) {
$mode = preg_replace('#^.*(Rea... | php | protected function loadMetadata(bool $force = false) {
$metaEmpty = $this->metadata == null;
parent::loadMetadata($force);
if ($metaEmpty || $force) {
foreach ($this->metadata->allResources('http://www.w3.org/ns/auth/acl#mode') as $i) {
$mode = preg_replace('#^.*(Rea... | [
"protected",
"function",
"loadMetadata",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"metaEmpty",
"=",
"$",
"this",
"->",
"metadata",
"==",
"null",
";",
"parent",
"::",
"loadMetadata",
"(",
"$",
"force",
")",
";",
"if",
"(",
"$",
"metaEmpty... | Loads current metadata from the Fedora and parses read ACL triples.
@param bool $force enforce fetch from Fedora
(when you want to make sure metadata are in line with ones in the Fedora
or e.g. reset them back to their current state in Fedora)
@throws AclException | [
"Loads",
"current",
"metadata",
"from",
"the",
"Fedora",
"and",
"parses",
"read",
"ACL",
"triples",
"."
] | e22c7cd2613f3c8daf0deee879896d9cd7f61b41 | https://github.com/acdh-oeaw/repo-php-util/blob/e22c7cd2613f3c8daf0deee879896d9cd7f61b41/src/acdhOeaw/fedora/acl/WebAclRule.php#L406-L435 |
29,675 | hnhdigital-os/laravel-model-schema | src/Concerns/GuardsAttributes.php | GuardsAttributes.getGuarded | public function getGuarded()
{
$guarded_create = !$this->exists ? $this->getAttributesFromSchema('guarded-create', false, true) : [];
$guarded_update = $this->exists ? $this->getAttributesFromSchema('guarded-update', false, true) : [];
$guarded = $this->getAttributesFromSchema('guarded', fal... | php | public function getGuarded()
{
$guarded_create = !$this->exists ? $this->getAttributesFromSchema('guarded-create', false, true) : [];
$guarded_update = $this->exists ? $this->getAttributesFromSchema('guarded-update', false, true) : [];
$guarded = $this->getAttributesFromSchema('guarded', fal... | [
"public",
"function",
"getGuarded",
"(",
")",
"{",
"$",
"guarded_create",
"=",
"!",
"$",
"this",
"->",
"exists",
"?",
"$",
"this",
"->",
"getAttributesFromSchema",
"(",
"'guarded-create'",
",",
"false",
",",
"true",
")",
":",
"[",
"]",
";",
"$",
"guarded... | Get the guarded attributes for the model.
@return array | [
"Get",
"the",
"guarded",
"attributes",
"for",
"the",
"model",
"."
] | ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e | https://github.com/hnhdigital-os/laravel-model-schema/blob/ca0c51e9862aac43d19cf06fb8bb810d6bc7d41e/src/Concerns/GuardsAttributes.php#L36-L43 |
29,676 | ventoviro/windwalker-core | src/Core/Event/CompositeDispatcher.php | CompositeDispatcher.setDispatchers | public function setDispatchers(array $dispatchers)
{
foreach ($dispatchers as $name => $dispatcher) {
$this->addDispatcher($name, $dispatcher);
}
return $this;
} | php | public function setDispatchers(array $dispatchers)
{
foreach ($dispatchers as $name => $dispatcher) {
$this->addDispatcher($name, $dispatcher);
}
return $this;
} | [
"public",
"function",
"setDispatchers",
"(",
"array",
"$",
"dispatchers",
")",
"{",
"foreach",
"(",
"$",
"dispatchers",
"as",
"$",
"name",
"=>",
"$",
"dispatcher",
")",
"{",
"$",
"this",
"->",
"addDispatcher",
"(",
"$",
"name",
",",
"$",
"dispatcher",
")... | Method to set property dispatchers
@param \Windwalker\Event\Dispatcher[] $dispatchers
@return static Return self to support chaining. | [
"Method",
"to",
"set",
"property",
"dispatchers"
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Event/CompositeDispatcher.php#L239-L246 |
29,677 | ventoviro/windwalker-core | src/Core/Security/CsrfGuard.php | CsrfGuard.validate | public function validate($justDie = false, $message = 'Invalid Token')
{
if (!$this->checkToken()) {
if ($justDie) {
exit($message);
}
throw new InvalidTokenException($message);
}
return true;
} | php | public function validate($justDie = false, $message = 'Invalid Token')
{
if (!$this->checkToken()) {
if ($justDie) {
exit($message);
}
throw new InvalidTokenException($message);
}
return true;
} | [
"public",
"function",
"validate",
"(",
"$",
"justDie",
"=",
"false",
",",
"$",
"message",
"=",
"'Invalid Token'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"checkToken",
"(",
")",
")",
"{",
"if",
"(",
"$",
"justDie",
")",
"{",
"exit",
"(",
"$",
... | Validate token or die.
@param bool $justDie
@param string $message
@return bool | [
"Validate",
"token",
"or",
"die",
"."
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Security/CsrfGuard.php#L81-L92 |
29,678 | ventoviro/windwalker-core | src/Core/Security/CsrfGuard.php | CsrfGuard.input | public function input($userId = null, $attribs = [])
{
$attribs['type'] = 'hidden';
$attribs['name'] = $this->getFormToken($userId);
$attribs['value'] = 1;
return h('input', $attribs, null);
} | php | public function input($userId = null, $attribs = [])
{
$attribs['type'] = 'hidden';
$attribs['name'] = $this->getFormToken($userId);
$attribs['value'] = 1;
return h('input', $attribs, null);
} | [
"public",
"function",
"input",
"(",
"$",
"userId",
"=",
"null",
",",
"$",
"attribs",
"=",
"[",
"]",
")",
"{",
"$",
"attribs",
"[",
"'type'",
"]",
"=",
"'hidden'",
";",
"$",
"attribs",
"[",
"'name'",
"]",
"=",
"$",
"this",
"->",
"getFormToken",
"(",... | Create token input.
@param mixed $userId
@param array $attribs
@return HtmlElement
@throws \Exception | [
"Create",
"token",
"input",
"."
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Security/CsrfGuard.php#L103-L110 |
29,679 | ventoviro/windwalker-core | src/Core/Security/CsrfGuard.php | CsrfGuard.getToken | public function getToken($forceNew = false)
{
/** @var Session $session */
$session = $this->session;
$token = $session->get(static::TOKEN_KEY);
// Create a token
if ($token === null || $forceNew) {
$token = $this->createToken(12);
$session->set(sta... | php | public function getToken($forceNew = false)
{
/** @var Session $session */
$session = $this->session;
$token = $session->get(static::TOKEN_KEY);
// Create a token
if ($token === null || $forceNew) {
$token = $this->createToken(12);
$session->set(sta... | [
"public",
"function",
"getToken",
"(",
"$",
"forceNew",
"=",
"false",
")",
"{",
"/** @var Session $session */",
"$",
"session",
"=",
"$",
"this",
"->",
"session",
";",
"$",
"token",
"=",
"$",
"session",
"->",
"get",
"(",
"static",
"::",
"TOKEN_KEY",
")",
... | Get form token string.
@param boolean $forceNew Force create new token.
@return string
@throws \UnexpectedValueException
@throws \RuntimeException
@throws \Exception | [
"Get",
"form",
"token",
"string",
"."
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Security/CsrfGuard.php#L145-L160 |
29,680 | ventoviro/windwalker-core | src/Core/Security/CsrfGuard.php | CsrfGuard.getFormToken | public function getFormToken($userId = null, $forceNew = false)
{
$userId = $userId ?: $this->userManager->getUser()->id;
$userId = $userId ?: $this->session->getId();
$config = $this->config;
return md5($config['system.secret'] . $userId . $this->getToken($forceNew));
} | php | public function getFormToken($userId = null, $forceNew = false)
{
$userId = $userId ?: $this->userManager->getUser()->id;
$userId = $userId ?: $this->session->getId();
$config = $this->config;
return md5($config['system.secret'] . $userId . $this->getToken($forceNew));
} | [
"public",
"function",
"getFormToken",
"(",
"$",
"userId",
"=",
"null",
",",
"$",
"forceNew",
"=",
"false",
")",
"{",
"$",
"userId",
"=",
"$",
"userId",
"?",
":",
"$",
"this",
"->",
"userManager",
"->",
"getUser",
"(",
")",
"->",
"id",
";",
"$",
"us... | Get a token for specific user.
@param mixed $userId An identify of current user.
@param boolean $forceNew Force create new token.
@return string
@throws \RuntimeException
@throws \UnexpectedValueException
@throws \Exception | [
"Get",
"a",
"token",
"for",
"specific",
"user",
"."
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Security/CsrfGuard.php#L173-L181 |
29,681 | locomotivemtl/charcoal-ui | src/Charcoal/Ui/PrioritizableTrait.php | PrioritizableTrait.setPriority | public function setPriority($priority)
{
if (!is_numeric($priority)) {
throw new InvalidArgumentException(
'Priority must be an integer'
);
}
$this->priority = intval($priority);
return $this;
} | php | public function setPriority($priority)
{
if (!is_numeric($priority)) {
throw new InvalidArgumentException(
'Priority must be an integer'
);
}
$this->priority = intval($priority);
return $this;
} | [
"public",
"function",
"setPriority",
"(",
"$",
"priority",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"priority",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Priority must be an integer'",
")",
";",
"}",
"$",
"this",
"->",
"prior... | Set the entity's priority index.
@param integer $priority An index, for sorting.
@throws InvalidArgumentException If the priority is not an integer.
@return self | [
"Set",
"the",
"entity",
"s",
"priority",
"index",
"."
] | 0070f35d89ea24ae93720734d261c02a10e218b6 | https://github.com/locomotivemtl/charcoal-ui/blob/0070f35d89ea24ae93720734d261c02a10e218b6/src/Charcoal/Ui/PrioritizableTrait.php#L28-L38 |
29,682 | acdh-oeaw/repo-php-util | src/acdhOeaw/fedora/dissemination/parameter/RemoveProtocol.php | RemoveProtocol.transform | public function transform(string $value): string {
if (strpos($value, 'hdl.handle.net') !== false) {
$value = str_replace("http://", "", $value);
}else if(strpos($value, 'https') !== false) {
$value = str_replace("https://", "", $value);
}else {
$valu... | php | public function transform(string $value): string {
if (strpos($value, 'hdl.handle.net') !== false) {
$value = str_replace("http://", "", $value);
}else if(strpos($value, 'https') !== false) {
$value = str_replace("https://", "", $value);
}else {
$valu... | [
"public",
"function",
"transform",
"(",
"string",
"$",
"value",
")",
":",
"string",
"{",
"if",
"(",
"strpos",
"(",
"$",
"value",
",",
"'hdl.handle.net'",
")",
"!==",
"false",
")",
"{",
"$",
"value",
"=",
"str_replace",
"(",
"\"http://\"",
",",
"\"\"",
... | Returns raw URL decoded value from the acdh identifier.
@param string $value value to be transformed
@return string | [
"Returns",
"raw",
"URL",
"decoded",
"value",
"from",
"the",
"acdh",
"identifier",
"."
] | e22c7cd2613f3c8daf0deee879896d9cd7f61b41 | https://github.com/acdh-oeaw/repo-php-util/blob/e22c7cd2613f3c8daf0deee879896d9cd7f61b41/src/acdhOeaw/fedora/dissemination/parameter/RemoveProtocol.php#L52-L63 |
29,683 | locomotivemtl/charcoal-ui | src/Charcoal/Ui/Menu/AbstractMenu.php | AbstractMenu.items | public function items(callable $itemCallback = null)
{
$items = $this->items;
uasort($items, [ $this, 'sortItemsByPriority' ]);
$itemCallback = isset($itemCallback) ? $itemCallback : $this->itemCallback;
foreach ($items as $item) {
if ($itemCallback) {
$i... | php | public function items(callable $itemCallback = null)
{
$items = $this->items;
uasort($items, [ $this, 'sortItemsByPriority' ]);
$itemCallback = isset($itemCallback) ? $itemCallback : $this->itemCallback;
foreach ($items as $item) {
if ($itemCallback) {
$i... | [
"public",
"function",
"items",
"(",
"callable",
"$",
"itemCallback",
"=",
"null",
")",
"{",
"$",
"items",
"=",
"$",
"this",
"->",
"items",
";",
"uasort",
"(",
"$",
"items",
",",
"[",
"$",
"this",
",",
"'sortItemsByPriority'",
"]",
")",
";",
"$",
"ite... | Menu Item generator.
@param callable $itemCallback Optional. Item callback.
@return MenuItemInterface[] | [
"Menu",
"Item",
"generator",
"."
] | 0070f35d89ea24ae93720734d261c02a10e218b6 | https://github.com/locomotivemtl/charcoal-ui/blob/0070f35d89ea24ae93720734d261c02a10e218b6/src/Charcoal/Ui/Menu/AbstractMenu.php#L125-L139 |
29,684 | ventoviro/windwalker-core | src/Core/Renderer/RendererManager.php | RendererManager.getRenderer | public function getRenderer($type = self::PHP, $config = [])
{
$type = strtolower($type);
$class = sprintf('Windwalker\Core\Renderer\%sRenderer', ucfirst($type));
if (!class_exists($class)) {
$class = sprintf('Windwalker\Renderer\%sRenderer', ucfirst($type));
}
... | php | public function getRenderer($type = self::PHP, $config = [])
{
$type = strtolower($type);
$class = sprintf('Windwalker\Core\Renderer\%sRenderer', ucfirst($type));
if (!class_exists($class)) {
$class = sprintf('Windwalker\Renderer\%sRenderer', ucfirst($type));
}
... | [
"public",
"function",
"getRenderer",
"(",
"$",
"type",
"=",
"self",
"::",
"PHP",
",",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"type",
"=",
"strtolower",
"(",
"$",
"type",
")",
";",
"$",
"class",
"=",
"sprintf",
"(",
"'Windwalker\\Core\\Renderer\\%... | Create a renderer object and auto inject the global paths.
@param string $type Renderer engine name, php, blade, twig or mustache.
@param array $config Renderer config array.
@return AbstractRenderer|CoreRendererInterface
@since 2.0 | [
"Create",
"a",
"renderer",
"object",
"and",
"auto",
"inject",
"the",
"global",
"paths",
"."
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Renderer/RendererManager.php#L97-L136 |
29,685 | ventoviro/windwalker-core | src/Core/Renderer/RendererManager.php | RendererManager.addGlobalPath | public function addGlobalPath($path, $priority = PriorityQueue::LOW)
{
$this->getPaths()->insert($path, $priority);
return $this;
} | php | public function addGlobalPath($path, $priority = PriorityQueue::LOW)
{
$this->getPaths()->insert($path, $priority);
return $this;
} | [
"public",
"function",
"addGlobalPath",
"(",
"$",
"path",
",",
"$",
"priority",
"=",
"PriorityQueue",
"::",
"LOW",
")",
"{",
"$",
"this",
"->",
"getPaths",
"(",
")",
"->",
"insert",
"(",
"$",
"path",
",",
"$",
"priority",
")",
";",
"return",
"$",
"thi... | Add a global path for Renderer search.
@param string $path The path you want to set.
@param int $priority Priority flag to order paths.
@return static
@since 2.0 | [
"Add",
"a",
"global",
"path",
"for",
"Renderer",
"search",
"."
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Renderer/RendererManager.php#L230-L235 |
29,686 | ventoviro/windwalker-core | src/Core/Renderer/RendererManager.php | RendererManager.getPaths | protected function getPaths()
{
if (!$this->paths) {
$this->paths = new PriorityQueue();
$this->registerPaths();
}
return $this->paths;
} | php | protected function getPaths()
{
if (!$this->paths) {
$this->paths = new PriorityQueue();
$this->registerPaths();
}
return $this->paths;
} | [
"protected",
"function",
"getPaths",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"paths",
")",
"{",
"$",
"this",
"->",
"paths",
"=",
"new",
"PriorityQueue",
"(",
")",
";",
"$",
"this",
"->",
"registerPaths",
"(",
")",
";",
"}",
"return",
"$",... | Get or create paths queue.
@return PriorityQueue
@since 2.0 | [
"Get",
"or",
"create",
"paths",
"queue",
"."
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Renderer/RendererManager.php#L261-L270 |
29,687 | ventoviro/windwalker-core | src/Core/Renderer/RendererManager.php | RendererManager.registerPaths | protected function registerPaths()
{
$config = $this->config;
// Priority (1)
$this->addPath(
realpath($config->get('path.templates')),
PriorityQueue::LOW - 20
);
// Priority (2)
$this->addPath(
realpath(__DIR__ . '/../Resources/T... | php | protected function registerPaths()
{
$config = $this->config;
// Priority (1)
$this->addPath(
realpath($config->get('path.templates')),
PriorityQueue::LOW - 20
);
// Priority (2)
$this->addPath(
realpath(__DIR__ . '/../Resources/T... | [
"protected",
"function",
"registerPaths",
"(",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
";",
"// Priority (1)",
"$",
"this",
"->",
"addPath",
"(",
"realpath",
"(",
"$",
"config",
"->",
"get",
"(",
"'path.templates'",
")",
")",
",",
"Pri... | Register default global paths.
@return static
@since 2.0 | [
"Register",
"default",
"global",
"paths",
"."
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Renderer/RendererManager.php#L279-L296 |
29,688 | ventoviro/windwalker-core | src/Core/Renderer/RendererManager.php | RendererManager.setPaths | public function setPaths($paths)
{
if (!$paths instanceof PriorityQueue) {
$paths = new PriorityQueue($paths);
}
$this->paths = $paths;
return $this;
} | php | public function setPaths($paths)
{
if (!$paths instanceof PriorityQueue) {
$paths = new PriorityQueue($paths);
}
$this->paths = $paths;
return $this;
} | [
"public",
"function",
"setPaths",
"(",
"$",
"paths",
")",
"{",
"if",
"(",
"!",
"$",
"paths",
"instanceof",
"PriorityQueue",
")",
"{",
"$",
"paths",
"=",
"new",
"PriorityQueue",
"(",
"$",
"paths",
")",
";",
"}",
"$",
"this",
"->",
"paths",
"=",
"$",
... | Method to set property paths
@param array $paths
@return static Return self to support chaining. | [
"Method",
"to",
"set",
"property",
"paths"
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Renderer/RendererManager.php#L319-L328 |
29,689 | ventoviro/windwalker-core | src/Core/Seeder/Command/SeedCommand.php | SeedCommand.init | public function init()
{
$this->addCommand(ImportCommand::class);
$this->addCommand(ClearCommand::class);
$this->addGlobalOption('c')
->alias('class')
->defaultValue('MainSeeder')
->description('The class to import.');
$this->addGlobalOption('d')... | php | public function init()
{
$this->addCommand(ImportCommand::class);
$this->addCommand(ClearCommand::class);
$this->addGlobalOption('c')
->alias('class')
->defaultValue('MainSeeder')
->description('The class to import.');
$this->addGlobalOption('d')... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"addCommand",
"(",
"ImportCommand",
"::",
"class",
")",
";",
"$",
"this",
"->",
"addCommand",
"(",
"ClearCommand",
"::",
"class",
")",
";",
"$",
"this",
"->",
"addGlobalOption",
"(",
"'c'",
... | Initialise command information.
@return void | [
"Initialise",
"command",
"information",
"."
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Seeder/Command/SeedCommand.php#L60-L79 |
29,690 | polyfony-inc/polyfony | Private/Polyfony/Filesystem.php | Filesystem.chroot | public static function chroot(string $path='/', bool $override = false) {
// this is now deprecated, will probably be removed in a future release
trigger_error(
'Usage of Polyfony\Filesystem is deprecated, require symfony/filesystem instead',
E_USER_DEPRECATED
);
// if chrooting is enabled in ... | php | public static function chroot(string $path='/', bool $override = false) {
// this is now deprecated, will probably be removed in a future release
trigger_error(
'Usage of Polyfony\Filesystem is deprecated, require symfony/filesystem instead',
E_USER_DEPRECATED
);
// if chrooting is enabled in ... | [
"public",
"static",
"function",
"chroot",
"(",
"string",
"$",
"path",
"=",
"'/'",
",",
"bool",
"$",
"override",
"=",
"false",
")",
"{",
"// this is now deprecated, will probably be removed in a future release",
"trigger_error",
"(",
"'Usage of Polyfony\\Filesystem is deprec... | this will restrict a path to the data storage folder | [
"this",
"will",
"restrict",
"a",
"path",
"to",
"the",
"data",
"storage",
"folder"
] | 76dac2f4141c8f480370236295c07dfa52e5c589 | https://github.com/polyfony-inc/polyfony/blob/76dac2f4141c8f480370236295c07dfa52e5c589/Private/Polyfony/Filesystem.php#L14-L40 |
29,691 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Client/ProductService.php | ProductService.get | public function get($id)
{
if (empty($id)) {
throw new \Exception('cannot load object with empty id');
}
$params = new RequestParams(RequestOps::GET, $this->resourceMetadata, $id);
$jsonResponse = $this->request($params);
if ($jsonResponse == false) {
... | php | public function get($id)
{
if (empty($id)) {
throw new \Exception('cannot load object with empty id');
}
$params = new RequestParams(RequestOps::GET, $this->resourceMetadata, $id);
$jsonResponse = $this->request($params);
if ($jsonResponse == false) {
... | [
"public",
"function",
"get",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"id",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'cannot load object with empty id'",
")",
";",
"}",
"$",
"params",
"=",
"new",
"RequestParams",
"(",
"Req... | Method to get object identified by id
@param string $id
@return BaseModel
@throws ApiError
@throws AuthError
@throws ClientError
@throws GuzzleException
@throws Exception | [
"Method",
"to",
"get",
"object",
"identified",
"by",
"id"
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Client/ProductService.php#L226-L244 |
29,692 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Client/ProductService.php | ProductService.delete | public function delete(BaseModel $model)
{
if (empty($model->id)) {
throw new Exception('Cannot delete object with empty primary key value');
}
$params = new RequestParams(RequestOps::DELETE, $this->resourceMetadata, $model->id);
$jsonResponse = $this->request($params);
... | php | public function delete(BaseModel $model)
{
if (empty($model->id)) {
throw new Exception('Cannot delete object with empty primary key value');
}
$params = new RequestParams(RequestOps::DELETE, $this->resourceMetadata, $model->id);
$jsonResponse = $this->request($params);
... | [
"public",
"function",
"delete",
"(",
"BaseModel",
"$",
"model",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"model",
"->",
"id",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Cannot delete object with empty primary key value'",
")",
";",
"}",
"$",
"params",... | Function to delete the model identified by id
@param BaseModel $model
@return bool
@throws ApiError
@throws AuthError
@throws ClientError
@throws GuzzleException
@throws Exception
@internal param string $id default null | [
"Function",
"to",
"delete",
"the",
"model",
"identified",
"by",
"id"
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Client/ProductService.php#L276-L292 |
29,693 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Client/ProductService.php | ProductService.save | public function save(BaseModel $model)
{
if ($this->resourceMetadata->resourceClass != get_class($model)) {
throw new Exception('Unable save data, data type and service must match.');
}
// default add new object
$method = RequestOps::CREATE;
if (!empty($model->i... | php | public function save(BaseModel $model)
{
if ($this->resourceMetadata->resourceClass != get_class($model)) {
throw new Exception('Unable save data, data type and service must match.');
}
// default add new object
$method = RequestOps::CREATE;
if (!empty($model->i... | [
"public",
"function",
"save",
"(",
"BaseModel",
"$",
"model",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"resourceMetadata",
"->",
"resourceClass",
"!=",
"get_class",
"(",
"$",
"model",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Unable save data, data t... | Function to save object
It can update existing or create new object, if the given object has an id with value null ist will create a
new object.
@param BaseModel $model The object to save.
@return BaseModel The created object, has same type as the given input.
@throws ApiError
@throws AuthError
@throws ClientError
@th... | [
"Function",
"to",
"save",
"object",
"It",
"can",
"update",
"existing",
"or",
"create",
"new",
"object",
"if",
"the",
"given",
"object",
"has",
"an",
"id",
"with",
"value",
"null",
"ist",
"will",
"create",
"a",
"new",
"object",
"."
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Client/ProductService.php#L307-L334 |
29,694 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Client/ProductService.php | ProductService.initMediaResource | protected function initMediaResource(&$arg)
{
if (is_string($arg)) {
$mr = new MediaResource();
$mr->setUrl($arg);
} else {
$mr = $arg;
}
$mr->setHttpClient($this->httpClient);
$mr->setStore($this->storage);
return $mr;
} | php | protected function initMediaResource(&$arg)
{
if (is_string($arg)) {
$mr = new MediaResource();
$mr->setUrl($arg);
} else {
$mr = $arg;
}
$mr->setHttpClient($this->httpClient);
$mr->setStore($this->storage);
return $mr;
} | [
"protected",
"function",
"initMediaResource",
"(",
"&",
"$",
"arg",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"arg",
")",
")",
"{",
"$",
"mr",
"=",
"new",
"MediaResource",
"(",
")",
";",
"$",
"mr",
"->",
"setUrl",
"(",
"$",
"arg",
")",
";",
"}"... | Create new or complete a media resource object.
@param MediaResource|string $arg The media resource to initialize or a url of a resource.
@return MediaResource The initialized media resource instance. | [
"Create",
"new",
"or",
"complete",
"a",
"media",
"resource",
"object",
"."
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Client/ProductService.php#L702-L714 |
29,695 | ventoviro/windwalker-core | src/Core/Package/Resolver/AbstractPackageObjectResolver.php | AbstractPackageObjectResolver.getNamespaces | public static function getNamespaces()
{
$called = get_called_class();
if (!isset(static::$namespaces[$called])) {
static::$namespaces[$called] = new PriorityQueue();
}
return static::$namespaces[$called];
} | php | public static function getNamespaces()
{
$called = get_called_class();
if (!isset(static::$namespaces[$called])) {
static::$namespaces[$called] = new PriorityQueue();
}
return static::$namespaces[$called];
} | [
"public",
"static",
"function",
"getNamespaces",
"(",
")",
"{",
"$",
"called",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"namespaces",
"[",
"$",
"called",
"]",
")",
")",
"{",
"static",
"::",
"$",
"name... | Method to get property Namespaces
@return PriorityQueue | [
"Method",
"to",
"get",
"property",
"Namespaces"
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/Package/Resolver/AbstractPackageObjectResolver.php#L171-L180 |
29,696 | ventoviro/windwalker-core | src/Core/View/ViewModel.php | ViewModel.getRepository | public function getRepository($name = null)
{
$name = strtolower($name);
if ($name) {
if (isset($this->repositories[$name])) {
return $this->repositories[$name];
}
return $this->getNullRepository();
}
return $this->repository ?: ... | php | public function getRepository($name = null)
{
$name = strtolower($name);
if ($name) {
if (isset($this->repositories[$name])) {
return $this->repositories[$name];
}
return $this->getNullRepository();
}
return $this->repository ?: ... | [
"public",
"function",
"getRepository",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"repositories",
"[",
"$",
"n... | Method to get property Model
@param string $name
@return Repository | [
"Method",
"to",
"get",
"property",
"Model"
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/View/ViewModel.php#L48-L61 |
29,697 | ventoviro/windwalker-core | src/Core/View/ViewModel.php | ViewModel.getNullRepository | public function getNullRepository()
{
if (!$this->nullRepository) {
$this->nullRepository = new Repository();
$this->nullRepository['is.null'] = true;
$this->nullRepository['null'] = true;
return $this->nullRepository;
}
return $this->nul... | php | public function getNullRepository()
{
if (!$this->nullRepository) {
$this->nullRepository = new Repository();
$this->nullRepository['is.null'] = true;
$this->nullRepository['null'] = true;
return $this->nullRepository;
}
return $this->nul... | [
"public",
"function",
"getNullRepository",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"nullRepository",
")",
"{",
"$",
"this",
"->",
"nullRepository",
"=",
"new",
"Repository",
"(",
")",
";",
"$",
"this",
"->",
"nullRepository",
"[",
"'is.null'",
... | Method to get property NullModel
@return Repository | [
"Method",
"to",
"get",
"property",
"NullModel"
] | 0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074 | https://github.com/ventoviro/windwalker-core/blob/0ed53059fc2d5d2d9b72f0e4aeef2fdf6aac0074/src/Core/View/ViewModel.php#L258-L270 |
29,698 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Client/MediaResourceTrait.php | MediaResourceTrait.clear | public function clear()
{
if (empty($this->store)) {
throw new ClientError('Missing store instance to use for this operation.');
}
if (!empty($this->url)) {
$this->store->delete($this->getKey($this->url));
}
$this->cached = false;
} | php | public function clear()
{
if (empty($this->store)) {
throw new ClientError('Missing store instance to use for this operation.');
}
if (!empty($this->url)) {
$this->store->delete($this->getKey($this->url));
}
$this->cached = false;
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"store",
")",
")",
"{",
"throw",
"new",
"ClientError",
"(",
"'Missing store instance to use for this operation.'",
")",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
... | Removes this object from cache.
@throws ClientError | [
"Removes",
"this",
"object",
"from",
"cache",
"."
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Client/MediaResourceTrait.php#L80-L91 |
29,699 | secucard/secucard-connect-php-sdk | src/SecucardConnect/Client/MediaResourceTrait.php | MediaResourceTrait.getContents | public function getContents($cache = true)
{
$result = $this->downloadMe($cache);
if ($cache) {
$result = $this->store->get($this->getKey($this->url));
}
return $result;
} | php | public function getContents($cache = true)
{
$result = $this->downloadMe($cache);
if ($cache) {
$result = $this->store->get($this->getKey($this->url));
}
return $result;
} | [
"public",
"function",
"getContents",
"(",
"$",
"cache",
"=",
"true",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"downloadMe",
"(",
"$",
"cache",
")",
";",
"if",
"(",
"$",
"cache",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"store",
"-... | Return the contents of this resource as stream.
@param bool $cache True if the content should be cached locally by using the storage instance passed when
creating the secucard connect API client.
@return StreamInterface
@throws ClientError | [
"Return",
"the",
"contents",
"of",
"this",
"resource",
"as",
"stream",
"."
] | d990686095e4e02d0924fc12b9bf60140fe8efab | https://github.com/secucard/secucard-connect-php-sdk/blob/d990686095e4e02d0924fc12b9bf60140fe8efab/src/SecucardConnect/Client/MediaResourceTrait.php#L110-L118 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.