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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9,900 | eFrane/Transfugio | src/Http/Method/ShowItemTrait.php | ShowItemTrait.getResolveMethod | protected function getResolveMethod()
{
if (is_array($this->resolveMethod)) {
$method = $this->resolveMethod;
} else {
if (strpos($this->resolveMethod, 'model:') >= 0) {
$method = substr($this->resolveMethod, strpos($this->resolveMethod, ':') + 1);
... | php | protected function getResolveMethod()
{
if (is_array($this->resolveMethod)) {
$method = $this->resolveMethod;
} else {
if (strpos($this->resolveMethod, 'model:') >= 0) {
$method = substr($this->resolveMethod, strpos($this->resolveMethod, ':') + 1);
... | [
"protected",
"function",
"getResolveMethod",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"resolveMethod",
")",
")",
"{",
"$",
"method",
"=",
"$",
"this",
"->",
"resolveMethod",
";",
"}",
"else",
"{",
"if",
"(",
"strpos",
"(",
"$",
"... | Get the resolve method for the query.
By default, entities are resolved by their id field. It is, however,
possible to choose a different resolving method for entities. You may
for instance have an API endpoint for stored git commits and it is obviously
not in anyway logical to return the id of that commit's database ... | [
"Get",
"the",
"resolve",
"method",
"for",
"the",
"query",
"."
] | c213b3c0e3649150d0c6675167e781930fda9125 | https://github.com/eFrane/Transfugio/blob/c213b3c0e3649150d0c6675167e781930fda9125/src/Http/Method/ShowItemTrait.php#L85-L107 |
9,901 | tekkla/core-framework | Core/Framework/Error/ErrorHandler.php | ErrorHandler.createErrorHtml | private function createErrorHtml(bool $dismissable = false)
{
$html = '
<div class="alert alert-danger' . ($dismissable == true ? ' alert-dismissible' : '') . '" role="alert" id="core-error-' . $this->throwable->getCode() . '">';
if ($dismissable) {
$html .= '<button type="butto... | php | private function createErrorHtml(bool $dismissable = false)
{
$html = '
<div class="alert alert-danger' . ($dismissable == true ? ' alert-dismissible' : '') . '" role="alert" id="core-error-' . $this->throwable->getCode() . '">';
if ($dismissable) {
$html .= '<button type="butto... | [
"private",
"function",
"createErrorHtml",
"(",
"bool",
"$",
"dismissable",
"=",
"false",
")",
"{",
"$",
"html",
"=",
"'\n <div class=\"alert alert-danger'",
".",
"(",
"$",
"dismissable",
"==",
"true",
"?",
"' alert-dismissible'",
":",
"''",
")",
".",
"'\"... | Creates html error message | [
"Creates",
"html",
"error",
"message"
] | ad69e9f15ee3644b6ca376edc30d8f5555399892 | https://github.com/tekkla/core-framework/blob/ad69e9f15ee3644b6ca376edc30d8f5555399892/Core/Framework/Error/ErrorHandler.php#L204-L232 |
9,902 | letyii/yii2-diy | models/DiyWidget.php | DiyWidget.generateTemplateWidget | public static function generateTemplateWidget($model){
$templateWidget = Html::beginTag('div', ['data-id' => (string) $model->_id, 'data-category' => $model->category, 'class' => 'let_widget_origin']);
$templateWidget .= $model->title;
$templateWidget .= Html::endTag('div');
... | php | public static function generateTemplateWidget($model){
$templateWidget = Html::beginTag('div', ['data-id' => (string) $model->_id, 'data-category' => $model->category, 'class' => 'let_widget_origin']);
$templateWidget .= $model->title;
$templateWidget .= Html::endTag('div');
... | [
"public",
"static",
"function",
"generateTemplateWidget",
"(",
"$",
"model",
")",
"{",
"$",
"templateWidget",
"=",
"Html",
"::",
"beginTag",
"(",
"'div'",
",",
"[",
"'data-id'",
"=>",
"(",
"string",
")",
"$",
"model",
"->",
"_id",
",",
"'data-category'",
"... | Ham hien thi widget khi duoc tao qua namespace
@param object $model thong tin cua widget khi duoc tao
@return string | [
"Ham",
"hien",
"thi",
"widget",
"khi",
"duoc",
"tao",
"qua",
"namespace"
] | 964f98c52976d7a2429c32864a9a93b635b6a4ef | https://github.com/letyii/yii2-diy/blob/964f98c52976d7a2429c32864a9a93b635b6a4ef/models/DiyWidget.php#L27-L33 |
9,903 | letyii/yii2-diy | models/DiyWidget.php | DiyWidget.getInputByType | private static function getInputByType($type = 'text', $templateSetting = null, $keySetting = null, $value = null, $items = []){
switch ($type) {
case 'textarea':
$templateSetting = Html::textarea($keySetting, $value, ['class' => 'form-control', 'title' => $keySetting]);
... | php | private static function getInputByType($type = 'text', $templateSetting = null, $keySetting = null, $value = null, $items = []){
switch ($type) {
case 'textarea':
$templateSetting = Html::textarea($keySetting, $value, ['class' => 'form-control', 'title' => $keySetting]);
... | [
"private",
"static",
"function",
"getInputByType",
"(",
"$",
"type",
"=",
"'text'",
",",
"$",
"templateSetting",
"=",
"null",
",",
"$",
"keySetting",
"=",
"null",
",",
"$",
"value",
"=",
"null",
",",
"$",
"items",
"=",
"[",
"]",
")",
"{",
"switch",
"... | Ham get html cho input theo type
@param string $type input co the la text, textarea, editor, date, datetime, daterange, dropdown, checkbox, radio
@param string $templateSetting giao dien input theo type
@param string $keySetting ten cua key setting
@param string $value gia tri cua key setting
@param array $items Mang c... | [
"Ham",
"get",
"html",
"cho",
"input",
"theo",
"type"
] | 964f98c52976d7a2429c32864a9a93b635b6a4ef | https://github.com/letyii/yii2-diy/blob/964f98c52976d7a2429c32864a9a93b635b6a4ef/models/DiyWidget.php#L111-L171 |
9,904 | iRAP-software/package-core-libs | src/TimeLib.php | TimeLib.getDaysInMonth | public static function getDaysInMonth($month='', $year='')
{
$firstOfSpecifiedMonth = self::getFirstOfMonth($month, $year);
$numDays = date("t", $firstOfSpecifiedMonth);
return $numDays;
} | php | public static function getDaysInMonth($month='', $year='')
{
$firstOfSpecifiedMonth = self::getFirstOfMonth($month, $year);
$numDays = date("t", $firstOfSpecifiedMonth);
return $numDays;
} | [
"public",
"static",
"function",
"getDaysInMonth",
"(",
"$",
"month",
"=",
"''",
",",
"$",
"year",
"=",
"''",
")",
"{",
"$",
"firstOfSpecifiedMonth",
"=",
"self",
"::",
"getFirstOfMonth",
"(",
"$",
"month",
",",
"$",
"year",
")",
";",
"$",
"numDays",
"=... | Fetches the number of days in a given month.
@param month - optional integer representing which month of the year.
e.g. 00 = january
if not specified we assume the current month.
@param year - optional integer representing which year. e.g. 2013 and
not 13
if not specified we assume the current year.
@return numDays -... | [
"Fetches",
"the",
"number",
"of",
"days",
"in",
"a",
"given",
"month",
"."
] | 244871d2fbc2f3fac26ff4b98715224953d9befb | https://github.com/iRAP-software/package-core-libs/blob/244871d2fbc2f3fac26ff4b98715224953d9befb/src/TimeLib.php#L25-L30 |
9,905 | iRAP-software/package-core-libs | src/TimeLib.php | TimeLib.roundTimestampToDay | public static function roundTimestampToDay($timestamp)
{
$day = date('d', $timestamp);
$month = date('m', $timestamp);
$year = date('Y', $timestamp);
$roundedTimestamp = mktime(0, 0, 0, $month, $day, $year);
return $roundedTimestamp;
} | php | public static function roundTimestampToDay($timestamp)
{
$day = date('d', $timestamp);
$month = date('m', $timestamp);
$year = date('Y', $timestamp);
$roundedTimestamp = mktime(0, 0, 0, $month, $day, $year);
return $roundedTimestamp;
} | [
"public",
"static",
"function",
"roundTimestampToDay",
"(",
"$",
"timestamp",
")",
"{",
"$",
"day",
"=",
"date",
"(",
"'d'",
",",
"$",
"timestamp",
")",
";",
"$",
"month",
"=",
"date",
"(",
"'m'",
",",
"$",
"timestamp",
")",
";",
"$",
"year",
"=",
... | Rounds a timestamp down to midnight of the day it was taken.
@param timestamp - the timestamp to round off.
@return roundedTimestamp - the timestamp rounded to midnight of that day. | [
"Rounds",
"a",
"timestamp",
"down",
"to",
"midnight",
"of",
"the",
"day",
"it",
"was",
"taken",
"."
] | 244871d2fbc2f3fac26ff4b98715224953d9befb | https://github.com/iRAP-software/package-core-libs/blob/244871d2fbc2f3fac26ff4b98715224953d9befb/src/TimeLib.php#L145-L154 |
9,906 | iRAP-software/package-core-libs | src/TimeLib.php | TimeLib.roundTimestampToWeek | public static function roundTimestampToWeek($timestamp)
{
$roundedToDay = self::roundTimestampToDay($timestamp);
$weekDay = date('w', $roundedToDay); # 1 = Monday
$daysToSubtract = $weekDay - 1;
$roundedToWeek = strtotime("-" . $daysToSubtract . " day", $roundedToDay);
... | php | public static function roundTimestampToWeek($timestamp)
{
$roundedToDay = self::roundTimestampToDay($timestamp);
$weekDay = date('w', $roundedToDay); # 1 = Monday
$daysToSubtract = $weekDay - 1;
$roundedToWeek = strtotime("-" . $daysToSubtract . " day", $roundedToDay);
... | [
"public",
"static",
"function",
"roundTimestampToWeek",
"(",
"$",
"timestamp",
")",
"{",
"$",
"roundedToDay",
"=",
"self",
"::",
"roundTimestampToDay",
"(",
"$",
"timestamp",
")",
";",
"$",
"weekDay",
"=",
"date",
"(",
"'w'",
",",
"$",
"roundedToDay",
")",
... | Rounds a timestamp down to midnight on Monday of time it was taken
@param timestamp - the timestamp to round off.
@return roundedTimestamp - the rounded timestamp | [
"Rounds",
"a",
"timestamp",
"down",
"to",
"midnight",
"on",
"Monday",
"of",
"time",
"it",
"was",
"taken"
] | 244871d2fbc2f3fac26ff4b98715224953d9befb | https://github.com/iRAP-software/package-core-libs/blob/244871d2fbc2f3fac26ff4b98715224953d9befb/src/TimeLib.php#L162-L170 |
9,907 | iRAP-software/package-core-libs | src/TimeLib.php | TimeLib.roundTimestampDownToMonth | public static function roundTimestampDownToMonth($timestamp)
{
$month = date('n', $timestamp);
$year = date('Y', $timestamp);
$roundedTimestamp = mktime(0, 0, 0, $month, $day="01", $year);
return $roundedTimestamp;
} | php | public static function roundTimestampDownToMonth($timestamp)
{
$month = date('n', $timestamp);
$year = date('Y', $timestamp);
$roundedTimestamp = mktime(0, 0, 0, $month, $day="01", $year);
return $roundedTimestamp;
} | [
"public",
"static",
"function",
"roundTimestampDownToMonth",
"(",
"$",
"timestamp",
")",
"{",
"$",
"month",
"=",
"date",
"(",
"'n'",
",",
"$",
"timestamp",
")",
";",
"$",
"year",
"=",
"date",
"(",
"'Y'",
",",
"$",
"timestamp",
")",
";",
"$",
"roundedTi... | Rounds a timestamp down to midnight on the first of the month it was
taken
@param timestamp - the timestamp to round off.
@return roundedTimestamp - the rounded timestamp | [
"Rounds",
"a",
"timestamp",
"down",
"to",
"midnight",
"on",
"the",
"first",
"of",
"the",
"month",
"it",
"was",
"taken"
] | 244871d2fbc2f3fac26ff4b98715224953d9befb | https://github.com/iRAP-software/package-core-libs/blob/244871d2fbc2f3fac26ff4b98715224953d9befb/src/TimeLib.php#L179-L187 |
9,908 | iRAP-software/package-core-libs | src/TimeLib.php | TimeLib.roundTimestampToYear | public static function roundTimestampToYear($timestamp)
{
$year = date('Y', $timestamp);
$roundedTimestamp = mktime(0, 0, 0, $month=1, $day=1, $year);
return $roundedTimestamp;
} | php | public static function roundTimestampToYear($timestamp)
{
$year = date('Y', $timestamp);
$roundedTimestamp = mktime(0, 0, 0, $month=1, $day=1, $year);
return $roundedTimestamp;
} | [
"public",
"static",
"function",
"roundTimestampToYear",
"(",
"$",
"timestamp",
")",
"{",
"$",
"year",
"=",
"date",
"(",
"'Y'",
",",
"$",
"timestamp",
")",
";",
"$",
"roundedTimestamp",
"=",
"mktime",
"(",
"0",
",",
"0",
",",
"0",
",",
"$",
"month",
"... | Rounds a timestamp down to midnight on the 1st of January of the year it
was taken
@param timestamp - the timestamp to round off.
@return roundedTimestamp - the rounded timestamp | [
"Rounds",
"a",
"timestamp",
"down",
"to",
"midnight",
"on",
"the",
"1st",
"of",
"January",
"of",
"the",
"year",
"it",
"was",
"taken"
] | 244871d2fbc2f3fac26ff4b98715224953d9befb | https://github.com/iRAP-software/package-core-libs/blob/244871d2fbc2f3fac26ff4b98715224953d9befb/src/TimeLib.php#L196-L203 |
9,909 | iRAP-software/package-core-libs | src/TimeLib.php | TimeLib.get_human_readble_time_difference | public static function get_human_readble_time_difference(\DateTime $timestamp)
{
$resultString = "";
$now = new \DateTime();
$diffInSeconds = $now->getTimestamp() - $timestamp->getTimestamp();
if ($diffInSeconds < 60)
{
$resultString = "$diffInSeconds se... | php | public static function get_human_readble_time_difference(\DateTime $timestamp)
{
$resultString = "";
$now = new \DateTime();
$diffInSeconds = $now->getTimestamp() - $timestamp->getTimestamp();
if ($diffInSeconds < 60)
{
$resultString = "$diffInSeconds se... | [
"public",
"static",
"function",
"get_human_readble_time_difference",
"(",
"\\",
"DateTime",
"$",
"timestamp",
")",
"{",
"$",
"resultString",
"=",
"\"\"",
";",
"$",
"now",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"diffInSeconds",
"=",
"$",
"now",
"... | Given a timestamp, get how long ago it was in human readable form.
E.g. 10 seconds
4 minutes
1 hour
456 days
@param \DateTime $timestamp - the timestamp we want the difference to
@return String - a human readable string to represent how long ago the timestamp was. | [
"Given",
"a",
"timestamp",
"get",
"how",
"long",
"ago",
"it",
"was",
"in",
"human",
"readable",
"form",
".",
"E",
".",
"g",
".",
"10",
"seconds",
"4",
"minutes",
"1",
"hour",
"456",
"days"
] | 244871d2fbc2f3fac26ff4b98715224953d9befb | https://github.com/iRAP-software/package-core-libs/blob/244871d2fbc2f3fac26ff4b98715224953d9befb/src/TimeLib.php#L235-L268 |
9,910 | tenside/core | src/Composer/Search/RepositorySearch.php | RepositorySearch.filter | protected function filter($packageNames, $filters)
{
if (empty($filters)) {
return $packageNames;
}
$packages = [];
foreach ($packageNames as $packageName) {
if (count($package = $this->repository->findPackages($packageName)) > 0) {
foreach ($... | php | protected function filter($packageNames, $filters)
{
if (empty($filters)) {
return $packageNames;
}
$packages = [];
foreach ($packageNames as $packageName) {
if (count($package = $this->repository->findPackages($packageName)) > 0) {
foreach ($... | [
"protected",
"function",
"filter",
"(",
"$",
"packageNames",
",",
"$",
"filters",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"filters",
")",
")",
"{",
"return",
"$",
"packageNames",
";",
"}",
"$",
"packages",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"... | Filter the passed list of package names.
@param string[] $packageNames The package names.
@param \Closure[] $filters The filters to apply.
@return string[] | [
"Filter",
"the",
"passed",
"list",
"of",
"package",
"names",
"."
] | 56422fa8cdecf03cb431bb6654c2942ade39bf7b | https://github.com/tenside/core/blob/56422fa8cdecf03cb431bb6654c2942ade39bf7b/src/Composer/Search/RepositorySearch.php#L150-L175 |
9,911 | tenside/core | src/Composer/Search/RepositorySearch.php | RepositorySearch.decorate | protected function decorate($packageName)
{
$results = $this->repository->findPackages($packageName);
if (!count($results)) {
throw new \InvalidArgumentException('Could not find package with specified name ' . $packageName);
}
$latest = array_slice($results, 0, 1)[0];... | php | protected function decorate($packageName)
{
$results = $this->repository->findPackages($packageName);
if (!count($results)) {
throw new \InvalidArgumentException('Could not find package with specified name ' . $packageName);
}
$latest = array_slice($results, 0, 1)[0];... | [
"protected",
"function",
"decorate",
"(",
"$",
"packageName",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"repository",
"->",
"findPackages",
"(",
"$",
"packageName",
")",
";",
"if",
"(",
"!",
"count",
"(",
"$",
"results",
")",
")",
"{",
"throw",... | Decorate a package.
@param string $packageName The name of the package to decorate.
@return VersionedPackage
@throws \InvalidArgumentException When the package could not be found. | [
"Decorate",
"a",
"package",
"."
] | 56422fa8cdecf03cb431bb6654c2942ade39bf7b | https://github.com/tenside/core/blob/56422fa8cdecf03cb431bb6654c2942ade39bf7b/src/Composer/Search/RepositorySearch.php#L186-L199 |
9,912 | tenside/core | src/Composer/Search/RepositorySearch.php | RepositorySearch.decorateWithPackagistStats | protected function decorateWithPackagistStats(VersionedPackage $package)
{
if (null === $this->decorateBaseUrl) {
return $package;
}
$rfs = new RemoteFilesystem(new BufferIO());
$requestUrl = sprintf($this->decorateBaseUrl, $package->getName());
if (!($jso... | php | protected function decorateWithPackagistStats(VersionedPackage $package)
{
if (null === $this->decorateBaseUrl) {
return $package;
}
$rfs = new RemoteFilesystem(new BufferIO());
$requestUrl = sprintf($this->decorateBaseUrl, $package->getName());
if (!($jso... | [
"protected",
"function",
"decorateWithPackagistStats",
"(",
"VersionedPackage",
"$",
"package",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"decorateBaseUrl",
")",
"{",
"return",
"$",
"package",
";",
"}",
"$",
"rfs",
"=",
"new",
"RemoteFilesystem",
... | Decorate the package with stats from packagist.
@param VersionedPackage $package The package version.
@return VersionedPackage | [
"Decorate",
"the",
"package",
"with",
"stats",
"from",
"packagist",
"."
] | 56422fa8cdecf03cb431bb6654c2942ade39bf7b | https://github.com/tenside/core/blob/56422fa8cdecf03cb431bb6654c2942ade39bf7b/src/Composer/Search/RepositorySearch.php#L208-L237 |
9,913 | tenside/core | src/Composer/Search/RepositorySearch.php | RepositorySearch.disableSearchType | public function disableSearchType($searchType)
{
if (($key = array_search($searchType, $this->enabledSearchTypes)) !== false) {
unset($this->enabledSearchTypes[$key]);
}
return $this;
} | php | public function disableSearchType($searchType)
{
if (($key = array_search($searchType, $this->enabledSearchTypes)) !== false) {
unset($this->enabledSearchTypes[$key]);
}
return $this;
} | [
"public",
"function",
"disableSearchType",
"(",
"$",
"searchType",
")",
"{",
"if",
"(",
"(",
"$",
"key",
"=",
"array_search",
"(",
"$",
"searchType",
",",
"$",
"this",
"->",
"enabledSearchTypes",
")",
")",
"!==",
"false",
")",
"{",
"unset",
"(",
"$",
"... | Disable a search type.
@param int $searchType The search type to disable.
@return $this | [
"Disable",
"a",
"search",
"type",
"."
] | 56422fa8cdecf03cb431bb6654c2942ade39bf7b | https://github.com/tenside/core/blob/56422fa8cdecf03cb431bb6654c2942ade39bf7b/src/Composer/Search/RepositorySearch.php#L301-L308 |
9,914 | phlexible/phlexible | src/Phlexible/Bundle/UserBundle/Controller/StatusController.php | StatusController.indexAction | public function indexAction()
{
$body = '';
$body .= '<a href="'.$this->generateUrl('phlexible_status_user_context').'">Context</a><br />';
$body .= '<a href="'.$this->generateUrl('phlexible_status_user_session').'">Session</a>';
return new Response($body);
} | php | public function indexAction()
{
$body = '';
$body .= '<a href="'.$this->generateUrl('phlexible_status_user_context').'">Context</a><br />';
$body .= '<a href="'.$this->generateUrl('phlexible_status_user_session').'">Session</a>';
return new Response($body);
} | [
"public",
"function",
"indexAction",
"(",
")",
"{",
"$",
"body",
"=",
"''",
";",
"$",
"body",
".=",
"'<a href=\"'",
".",
"$",
"this",
"->",
"generateUrl",
"(",
"'phlexible_status_user_context'",
")",
".",
"'\">Context</a><br />'",
";",
"$",
"body",
".=",
"'<... | Show security status.
@return Response
@Route("", name="phlexible_status_user") | [
"Show",
"security",
"status",
"."
] | 132f24924c9bb0dbb6c1ea84db0a463f97fa3893 | https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Bundle/UserBundle/Controller/StatusController.php#L35-L42 |
9,915 | phlexible/phlexible | src/Phlexible/Bundle/UserBundle/Controller/StatusController.php | StatusController.contextAction | public function contextAction()
{
$tokenStorage = $this->get('security.token_storage');
$token = $tokenStorage->getToken();
$user = $token->getUser();
$output = '<pre>';
$output .= 'Token class: '.get_class($token).PHP_EOL;
$output .= 'User class: '.(is_object($use... | php | public function contextAction()
{
$tokenStorage = $this->get('security.token_storage');
$token = $tokenStorage->getToken();
$user = $token->getUser();
$output = '<pre>';
$output .= 'Token class: '.get_class($token).PHP_EOL;
$output .= 'User class: '.(is_object($use... | [
"public",
"function",
"contextAction",
"(",
")",
"{",
"$",
"tokenStorage",
"=",
"$",
"this",
"->",
"get",
"(",
"'security.token_storage'",
")",
";",
"$",
"token",
"=",
"$",
"tokenStorage",
"->",
"getToken",
"(",
")",
";",
"$",
"user",
"=",
"$",
"token",
... | Show security context.
@return Response
@Route("/context", name="phlexible_status_user_context") | [
"Show",
"security",
"context",
"."
] | 132f24924c9bb0dbb6c1ea84db0a463f97fa3893 | https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Bundle/UserBundle/Controller/StatusController.php#L50-L71 |
9,916 | phlexible/phlexible | src/Phlexible/Bundle/UserBundle/Controller/StatusController.php | StatusController.sessionAction | public function sessionAction(Request $request)
{
$output = '<pre>';
$output .= 'Security session namespace:'.PHP_EOL;
$output .= '<ul>';
foreach ($request->getSession()->all() as $key => $value) {
if (is_object($value)) {
$o = get_class($value);
... | php | public function sessionAction(Request $request)
{
$output = '<pre>';
$output .= 'Security session namespace:'.PHP_EOL;
$output .= '<ul>';
foreach ($request->getSession()->all() as $key => $value) {
if (is_object($value)) {
$o = get_class($value);
... | [
"public",
"function",
"sessionAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"output",
"=",
"'<pre>'",
";",
"$",
"output",
".=",
"'Security session namespace:'",
".",
"PHP_EOL",
";",
"$",
"output",
".=",
"'<ul>'",
";",
"foreach",
"(",
"$",
"request"... | Show session.
@param Request $request
@return Response
@Route("/session", name="phlexible_status_user_session") | [
"Show",
"session",
"."
] | 132f24924c9bb0dbb6c1ea84db0a463f97fa3893 | https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Bundle/UserBundle/Controller/StatusController.php#L81-L102 |
9,917 | marando/phpSOFA | src/Marando/IAU/iauLd.php | iauLd.Ld | public static function Ld($bm, array $p, array $q, array $e, $em, $dlim,
array &$p1) {
$i;
$qpe = [];
$qdqpe;
$w;
$eq = [];
$peq = [];
/* q . (q + e). */
for ($i = 0; $i < 3; $i++) {
$qpe[$i] = $q[$i] + $e[$i];
}
$qdqpe = IAU::Pdp($q, $qpe);
/* 2 x G x bm ... | php | public static function Ld($bm, array $p, array $q, array $e, $em, $dlim,
array &$p1) {
$i;
$qpe = [];
$qdqpe;
$w;
$eq = [];
$peq = [];
/* q . (q + e). */
for ($i = 0; $i < 3; $i++) {
$qpe[$i] = $q[$i] + $e[$i];
}
$qdqpe = IAU::Pdp($q, $qpe);
/* 2 x G x bm ... | [
"public",
"static",
"function",
"Ld",
"(",
"$",
"bm",
",",
"array",
"$",
"p",
",",
"array",
"$",
"q",
",",
"array",
"$",
"e",
",",
"$",
"em",
",",
"$",
"dlim",
",",
"array",
"&",
"$",
"p1",
")",
"{",
"$",
"i",
";",
"$",
"qpe",
"=",
"[",
"... | - - - - - -
i a u L d
- - - - - -
Apply light deflection by a solar-system body, as part of
transforming coordinate direction into natural direction.
This function is part of the International Astronomical Union's
SOFA (Standards of Fundamental Astronomy) software collection.
Status: support function.
Given:
bm ... | [
"-",
"-",
"-",
"-",
"-",
"-",
"i",
"a",
"u",
"L",
"d",
"-",
"-",
"-",
"-",
"-",
"-"
] | 757fa49fe335ae1210eaa7735473fd4388b13f07 | https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauLd.php#L84-L113 |
9,918 | synapsestudios/synapse-base | src/Synapse/CliCommand/CliCommandExecutor.php | CliCommandExecutor.execute | public function execute($command = '', $cwd = null, array $env = null)
{
$fd = proc_open(
$command,
$this->descriptors,
$pipes,
$cwd,
$env
);
// Close the proc's stdin right away
fclose($pipes[0]);
// Read stdout
... | php | public function execute($command = '', $cwd = null, array $env = null)
{
$fd = proc_open(
$command,
$this->descriptors,
$pipes,
$cwd,
$env
);
// Close the proc's stdin right away
fclose($pipes[0]);
// Read stdout
... | [
"public",
"function",
"execute",
"(",
"$",
"command",
"=",
"''",
",",
"$",
"cwd",
"=",
"null",
",",
"array",
"$",
"env",
"=",
"null",
")",
"{",
"$",
"fd",
"=",
"proc_open",
"(",
"$",
"command",
",",
"$",
"this",
"->",
"descriptors",
",",
"$",
"pi... | Executes a cli command using proc_open
@param string $command the command to be executed
@param mixed $cwd the directory to execute in or null to use current
@param mixed $env an array of environment variables or null to use current
@return CliCommandResponse a DataObject with output and return_code set | [
"Executes",
"a",
"cli",
"command",
"using",
"proc_open"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/CliCommand/CliCommandExecutor.php#L25-L48 |
9,919 | synapsestudios/synapse-base | src/Synapse/CliCommand/CliCommandExecutor.php | CliCommandExecutor.parseOutput | protected function parseOutput($output)
{
$lines = explode("\n", $output);
// This is the escape sequence that kills the stuff on the line, then
// adds new text to it. The fake lines are separated by CRs instead of
// NLs. You can thank whoever invented Bash for that
$escap... | php | protected function parseOutput($output)
{
$lines = explode("\n", $output);
// This is the escape sequence that kills the stuff on the line, then
// adds new text to it. The fake lines are separated by CRs instead of
// NLs. You can thank whoever invented Bash for that
$escap... | [
"protected",
"function",
"parseOutput",
"(",
"$",
"output",
")",
"{",
"$",
"lines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"output",
")",
";",
"// This is the escape sequence that kills the stuff on the line, then",
"// adds new text to it. The fake lines are separated by ... | Parses output from shell into usable string
@param string $output the output from a shell commmand
@return string the actual lines of output | [
"Parses",
"output",
"from",
"shell",
"into",
"usable",
"string"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/CliCommand/CliCommandExecutor.php#L56-L82 |
9,920 | konservs/brilliant.framework | libraries/Users/BUsers.php | BUsers.getLoggedUser | public function getLoggedUser() {
$session = BUsersSession::getInstanceAndStart();
if (empty($session)) {
return NULL;
}
return $this->itemGet($session->userid);
} | php | public function getLoggedUser() {
$session = BUsersSession::getInstanceAndStart();
if (empty($session)) {
return NULL;
}
return $this->itemGet($session->userid);
} | [
"public",
"function",
"getLoggedUser",
"(",
")",
"{",
"$",
"session",
"=",
"BUsersSession",
"::",
"getInstanceAndStart",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"session",
")",
")",
"{",
"return",
"NULL",
";",
"}",
"return",
"$",
"this",
"->",
"it... | Get logged user class
@return BUser|null | [
"Get",
"logged",
"user",
"class"
] | 95f03f1917f746fee98bea8a906ba0588c87762d | https://github.com/konservs/brilliant.framework/blob/95f03f1917f746fee98bea8a906ba0588c87762d/libraries/Users/BUsers.php#L69-L75 |
9,921 | konservs/brilliant.framework | libraries/Users/BUsers.php | BUsers.login | public function login($email, $password, $longsession = false) {
$user = $this->getUserByEmail($email);
if ($user == false) {
BLog::addToLog('[Users]: login() wrong email!', LL_ERROR);
return USERS_ERROR_NOSUCHEMAIL;
}
if ($user->active == USER_STATUS_NOTACTIVATED) {
BLog::addToLog('[Users]: Not Activa... | php | public function login($email, $password, $longsession = false) {
$user = $this->getUserByEmail($email);
if ($user == false) {
BLog::addToLog('[Users]: login() wrong email!', LL_ERROR);
return USERS_ERROR_NOSUCHEMAIL;
}
if ($user->active == USER_STATUS_NOTACTIVATED) {
BLog::addToLog('[Users]: Not Activa... | [
"public",
"function",
"login",
"(",
"$",
"email",
",",
"$",
"password",
",",
"$",
"longsession",
"=",
"false",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getUserByEmail",
"(",
"$",
"email",
")",
";",
"if",
"(",
"$",
"user",
"==",
"false",
")",... | Login. Returns user object
@param $email
@param $password
@param bool|false $longsession
@return BUser|int|null | [
"Login",
".",
"Returns",
"user",
"object"
] | 95f03f1917f746fee98bea8a906ba0588c87762d | https://github.com/konservs/brilliant.framework/blob/95f03f1917f746fee98bea8a906ba0588c87762d/libraries/Users/BUsers.php#L85-L108 |
9,922 | konservs/brilliant.framework | libraries/Users/BUsers.php | BUsers.itemsFilterSql | public function itemsFilterSql($params, &$wh, &$jn) {
parent::itemsFilterSql($params, $wh, $jn);
$db = BFactory::getDBO();
//Filter users by Email
if (isset($params['email'])) {
$wh[] = '(`email`=' . $db->escapeString($params['email']) . ')';
}
return true;
} | php | public function itemsFilterSql($params, &$wh, &$jn) {
parent::itemsFilterSql($params, $wh, $jn);
$db = BFactory::getDBO();
//Filter users by Email
if (isset($params['email'])) {
$wh[] = '(`email`=' . $db->escapeString($params['email']) . ')';
}
return true;
} | [
"public",
"function",
"itemsFilterSql",
"(",
"$",
"params",
",",
"&",
"$",
"wh",
",",
"&",
"$",
"jn",
")",
"{",
"parent",
"::",
"itemsFilterSql",
"(",
"$",
"params",
",",
"$",
"wh",
",",
"$",
"jn",
")",
";",
"$",
"db",
"=",
"BFactory",
"::",
"get... | Items Filter SQL
@param $params
@param $wh
@param $jn
@return bool | [
"Items",
"Filter",
"SQL"
] | 95f03f1917f746fee98bea8a906ba0588c87762d | https://github.com/konservs/brilliant.framework/blob/95f03f1917f746fee98bea8a906ba0588c87762d/libraries/Users/BUsers.php#L118-L126 |
9,923 | konservs/brilliant.framework | libraries/Users/BUsers.php | BUsers.itemsFilterHash | public function itemsFilterHash($params) {
$itemsHash = parent::itemsFilterHash($params);
//Filter users by email
if (isset($params['email'])) {
$itemsHash .= ':email=' . $params['email'];
}
return $itemsHash;
} | php | public function itemsFilterHash($params) {
$itemsHash = parent::itemsFilterHash($params);
//Filter users by email
if (isset($params['email'])) {
$itemsHash .= ':email=' . $params['email'];
}
return $itemsHash;
} | [
"public",
"function",
"itemsFilterHash",
"(",
"$",
"params",
")",
"{",
"$",
"itemsHash",
"=",
"parent",
"::",
"itemsFilterHash",
"(",
"$",
"params",
")",
";",
"//Filter users by email",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'email'",
"]",
")",
")",... | Return items hash
@param array $params
@return string | [
"Return",
"items",
"hash"
] | 95f03f1917f746fee98bea8a906ba0588c87762d | https://github.com/konservs/brilliant.framework/blob/95f03f1917f746fee98bea8a906ba0588c87762d/libraries/Users/BUsers.php#L133-L140 |
9,924 | konservs/brilliant.framework | libraries/Users/BUsers.php | BUsers.getUserByEmail | public function getUserByEmail($email) {
$list = $this->itemsFilter(['email' => $email, 'limit' => 1]);
if (empty($list)) {
return NULL;
}
$user = reset($list);
return $user;
} | php | public function getUserByEmail($email) {
$list = $this->itemsFilter(['email' => $email, 'limit' => 1]);
if (empty($list)) {
return NULL;
}
$user = reset($list);
return $user;
} | [
"public",
"function",
"getUserByEmail",
"(",
"$",
"email",
")",
"{",
"$",
"list",
"=",
"$",
"this",
"->",
"itemsFilter",
"(",
"[",
"'email'",
"=>",
"$",
"email",
",",
"'limit'",
"=>",
"1",
"]",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"list",
")",
... | Get user By email
@param $email
@return BUser|null | [
"Get",
"user",
"By",
"email"
] | 95f03f1917f746fee98bea8a906ba0588c87762d | https://github.com/konservs/brilliant.framework/blob/95f03f1917f746fee98bea8a906ba0588c87762d/libraries/Users/BUsers.php#L147-L154 |
9,925 | mooti/framework | src/Util/FileSystem.php | FileSystem.filePutContents | public function filePutContents($filePath, $data)
{
$bytesWritten = @file_put_contents($filePath, $data);
if ($bytesWritten === false) {
throw new FileSystemException('File '.$filePath.' could not be written');
}
return true;
} | php | public function filePutContents($filePath, $data)
{
$bytesWritten = @file_put_contents($filePath, $data);
if ($bytesWritten === false) {
throw new FileSystemException('File '.$filePath.' could not be written');
}
return true;
} | [
"public",
"function",
"filePutContents",
"(",
"$",
"filePath",
",",
"$",
"data",
")",
"{",
"$",
"bytesWritten",
"=",
"@",
"file_put_contents",
"(",
"$",
"filePath",
",",
"$",
"data",
")",
";",
"if",
"(",
"$",
"bytesWritten",
"===",
"false",
")",
"{",
"... | write to a file
@param string $filePath The path of the file
@param string $data The contents of the file
@return string The contents of the file | [
"write",
"to",
"a",
"file"
] | 078da6699c5c6c7ac4e5a3d36751d645ad8aa93e | https://github.com/mooti/framework/blob/078da6699c5c6c7ac4e5a3d36751d645ad8aa93e/src/Util/FileSystem.php#L73-L80 |
9,926 | belgattitude/soluble-schema | src/Soluble/Schema/Source/AbstractSchemaSource.php | AbstractSchemaSource.validateTable | protected function validateTable($table)
{
$this->checkTableArgument($table);
if (!$this->hasTable($table)) {
throw new Exception\TableNotFoundException(__METHOD__ . ": Table '$table' does not exists in database '{$this->schema}'");
}
return $this;
} | php | protected function validateTable($table)
{
$this->checkTableArgument($table);
if (!$this->hasTable($table)) {
throw new Exception\TableNotFoundException(__METHOD__ . ": Table '$table' does not exists in database '{$this->schema}'");
}
return $this;
} | [
"protected",
"function",
"validateTable",
"(",
"$",
"table",
")",
"{",
"$",
"this",
"->",
"checkTableArgument",
"(",
"$",
"table",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"hasTable",
"(",
"$",
"table",
")",
")",
"{",
"throw",
"new",
"Exception",
... | Check whether a table parameter is valid and exists.
@throws Exception\InvalidArgumentException
@throws Exception\ErrorException
@throws Exception\ExceptionInterface
@throws Exception\TableNotFoundException
@param string $table
@return self | [
"Check",
"whether",
"a",
"table",
"parameter",
"is",
"valid",
"and",
"exists",
"."
] | 7c6959740f7392ef22c12c2118ddf53294a01955 | https://github.com/belgattitude/soluble-schema/blob/7c6959740f7392ef22c12c2118ddf53294a01955/src/Soluble/Schema/Source/AbstractSchemaSource.php#L100-L108 |
9,927 | belgattitude/soluble-schema | src/Soluble/Schema/Source/AbstractSchemaSource.php | AbstractSchemaSource.validateSchema | protected function validateSchema($schema)
{
if (!is_string($schema) || trim($schema) == '') {
throw new Exception\InvalidArgumentException(__METHOD__ . ': Schema name must be a valid string or an empty string detected');
}
return $this;
} | php | protected function validateSchema($schema)
{
if (!is_string($schema) || trim($schema) == '') {
throw new Exception\InvalidArgumentException(__METHOD__ . ': Schema name must be a valid string or an empty string detected');
}
return $this;
} | [
"protected",
"function",
"validateSchema",
"(",
"$",
"schema",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"schema",
")",
"||",
"trim",
"(",
"$",
"schema",
")",
"==",
"''",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"InvalidArgumentException",
"("... | Check whether a schema parameter is valid.
@throws Exception\InvalidArgumentException
@param string $schema
@return self | [
"Check",
"whether",
"a",
"schema",
"parameter",
"is",
"valid",
"."
] | 7c6959740f7392ef22c12c2118ddf53294a01955 | https://github.com/belgattitude/soluble-schema/blob/7c6959740f7392ef22c12c2118ddf53294a01955/src/Soluble/Schema/Source/AbstractSchemaSource.php#L119-L126 |
9,928 | belgattitude/soluble-schema | src/Soluble/Schema/Source/AbstractSchemaSource.php | AbstractSchemaSource.setSchemaSignature | protected function setSchemaSignature()
{
$host = $this->adapter->getConnection()->getHost();
$schema = $this->schema;
$this->schemaSignature = "$host:$schema";
} | php | protected function setSchemaSignature()
{
$host = $this->adapter->getConnection()->getHost();
$schema = $this->schema;
$this->schemaSignature = "$host:$schema";
} | [
"protected",
"function",
"setSchemaSignature",
"(",
")",
"{",
"$",
"host",
"=",
"$",
"this",
"->",
"adapter",
"->",
"getConnection",
"(",
")",
"->",
"getHost",
"(",
")",
";",
"$",
"schema",
"=",
"$",
"this",
"->",
"schema",
";",
"$",
"this",
"->",
"s... | Return current schema signature for caching. | [
"Return",
"current",
"schema",
"signature",
"for",
"caching",
"."
] | 7c6959740f7392ef22c12c2118ddf53294a01955 | https://github.com/belgattitude/soluble-schema/blob/7c6959740f7392ef22c12c2118ddf53294a01955/src/Soluble/Schema/Source/AbstractSchemaSource.php#L162-L167 |
9,929 | rollun-com/rollun-permission | src/Permission/src/OAuth/GoogleClient.php | GoogleClient.authenticateWithAuthCode | public function authenticateWithAuthCode($authCode)
{
$accessToken = $this->fetchAccessTokenWithAuthCode($authCode);
$this->getLogger()->debug('Access token with auth code: ' . json_encode($accessToken));
return !array_key_exists('error', $accessToken);
} | php | public function authenticateWithAuthCode($authCode)
{
$accessToken = $this->fetchAccessTokenWithAuthCode($authCode);
$this->getLogger()->debug('Access token with auth code: ' . json_encode($accessToken));
return !array_key_exists('error', $accessToken);
} | [
"public",
"function",
"authenticateWithAuthCode",
"(",
"$",
"authCode",
")",
"{",
"$",
"accessToken",
"=",
"$",
"this",
"->",
"fetchAccessTokenWithAuthCode",
"(",
"$",
"authCode",
")",
";",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"debug",
"(",
"'Acce... | Authentication passed if access token can be fetch using authorization code
@param $authCode
@return bool
@throws Exception | [
"Authentication",
"passed",
"if",
"access",
"token",
"can",
"be",
"fetch",
"using",
"authorization",
"code"
] | 9f58c814337fcfd1e52ecfbf496f95d276d8217e | https://github.com/rollun-com/rollun-permission/blob/9f58c814337fcfd1e52ecfbf496f95d276d8217e/src/Permission/src/OAuth/GoogleClient.php#L39-L45 |
9,930 | rollun-com/rollun-permission | src/Permission/src/OAuth/GoogleClient.php | GoogleClient.getAccessToken | public function getAccessToken()
{
$this->getLogger()->debug('Get access token. If expired try to update');
if ($this->isAccessTokenExpired() && $this->getRefreshToken()) {
$this->fetchAccessTokenWithRefreshToken($this->getRefreshToken());
}
return parent::getAccessToke... | php | public function getAccessToken()
{
$this->getLogger()->debug('Get access token. If expired try to update');
if ($this->isAccessTokenExpired() && $this->getRefreshToken()) {
$this->fetchAccessTokenWithRefreshToken($this->getRefreshToken());
}
return parent::getAccessToke... | [
"public",
"function",
"getAccessToken",
"(",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"debug",
"(",
"'Get access token. If expired try to update'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isAccessTokenExpired",
"(",
")",
"&&",
"$",
"this",
... | Proxy for parent method
Get new access token if it expired using refresh token
@return array | [
"Proxy",
"for",
"parent",
"method",
"Get",
"new",
"access",
"token",
"if",
"it",
"expired",
"using",
"refresh",
"token"
] | 9f58c814337fcfd1e52ecfbf496f95d276d8217e | https://github.com/rollun-com/rollun-permission/blob/9f58c814337fcfd1e52ecfbf496f95d276d8217e/src/Permission/src/OAuth/GoogleClient.php#L53-L62 |
9,931 | bishopb/vanilla | applications/dashboard/models/class.rolemodel.php | RoleModel.FilterPersonalInfo | public static function FilterPersonalInfo($Role) {
if (is_string($Role)) {
$Role = array_shift(self::GetByName($Role));
}
return (GetValue('PersonalInfo', $Role)) ? FALSE : TRUE;
} | php | public static function FilterPersonalInfo($Role) {
if (is_string($Role)) {
$Role = array_shift(self::GetByName($Role));
}
return (GetValue('PersonalInfo', $Role)) ? FALSE : TRUE;
} | [
"public",
"static",
"function",
"FilterPersonalInfo",
"(",
"$",
"Role",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"Role",
")",
")",
"{",
"$",
"Role",
"=",
"array_shift",
"(",
"self",
"::",
"GetByName",
"(",
"$",
"Role",
")",
")",
";",
"}",
"return"... | Use with array_filter to remove PersonalInfo roles.
@var mixed $Roles Role name (string) or $Role data (array or object).
@return bool Whether role is NOT personal info (FALSE = remove it, it's personal). | [
"Use",
"with",
"array_filter",
"to",
"remove",
"PersonalInfo",
"roles",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/models/class.rolemodel.php#L58-L64 |
9,932 | bishopb/vanilla | applications/dashboard/models/class.rolemodel.php | RoleModel.GetArray | public function GetArray() {
// $RoleData = $this->GetEditablePermissions();
$RoleData = $this->Get();
$RoleIDs = ConsolidateArrayValuesByKey($RoleData->ResultArray(), 'RoleID');
$RoleNames = ConsolidateArrayValuesByKey($RoleData->ResultArray(), 'Name');
return ArrayCombine($RoleIDs, $Role... | php | public function GetArray() {
// $RoleData = $this->GetEditablePermissions();
$RoleData = $this->Get();
$RoleIDs = ConsolidateArrayValuesByKey($RoleData->ResultArray(), 'RoleID');
$RoleNames = ConsolidateArrayValuesByKey($RoleData->ResultArray(), 'Name');
return ArrayCombine($RoleIDs, $Role... | [
"public",
"function",
"GetArray",
"(",
")",
"{",
"// $RoleData = $this->GetEditablePermissions();",
"$",
"RoleData",
"=",
"$",
"this",
"->",
"Get",
"(",
")",
";",
"$",
"RoleIDs",
"=",
"ConsolidateArrayValuesByKey",
"(",
"$",
"RoleData",
"->",
"ResultArray",
"(",
... | Returns an array of RoleID => RoleName pairs.
@return array | [
"Returns",
"an",
"array",
"of",
"RoleID",
"=",
">",
"RoleName",
"pairs",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/models/class.rolemodel.php#L82-L88 |
9,933 | bishopb/vanilla | applications/dashboard/models/class.rolemodel.php | RoleModel.GetByUserID | public function GetByUserID($UserID) {
return $this->SQL->Select()
->From('Role')
->Join('UserRole', 'Role.RoleID = UserRole.RoleID')
->Where('UserRole.UserID', $UserID)
->Get();
} | php | public function GetByUserID($UserID) {
return $this->SQL->Select()
->From('Role')
->Join('UserRole', 'Role.RoleID = UserRole.RoleID')
->Where('UserRole.UserID', $UserID)
->Get();
} | [
"public",
"function",
"GetByUserID",
"(",
"$",
"UserID",
")",
"{",
"return",
"$",
"this",
"->",
"SQL",
"->",
"Select",
"(",
")",
"->",
"From",
"(",
"'Role'",
")",
"->",
"Join",
"(",
"'UserRole'",
",",
"'Role.RoleID = UserRole.RoleID'",
")",
"->",
"Where",
... | Returns a resultset of role data related to the specified UserID.
@param int The UserID to filter to.
@return Gdn_DataSet | [
"Returns",
"a",
"resultset",
"of",
"role",
"data",
"related",
"to",
"the",
"specified",
"UserID",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/models/class.rolemodel.php#L118-L124 |
9,934 | bd808/moar-log | src/Moar/Log/Monolog/HierarchialLogger.php | HierarchialLogger.setParent | public function setParent (Logger $parent) {
$this->handlers = $parent->handlers;
$this->processors = $parent->processors;
$this->level = $parent->level;
} | php | public function setParent (Logger $parent) {
$this->handlers = $parent->handlers;
$this->processors = $parent->processors;
$this->level = $parent->level;
} | [
"public",
"function",
"setParent",
"(",
"Logger",
"$",
"parent",
")",
"{",
"$",
"this",
"->",
"handlers",
"=",
"$",
"parent",
"->",
"handlers",
";",
"$",
"this",
"->",
"processors",
"=",
"$",
"parent",
"->",
"processors",
";",
"$",
"this",
"->",
"level... | Set this logger's parent logger.
@param HierarchialLogger $parent Parent logger
@return void | [
"Set",
"this",
"logger",
"s",
"parent",
"logger",
"."
] | 01f44c46fef9a612cef6209c3bd69c97f3475064 | https://github.com/bd808/moar-log/blob/01f44c46fef9a612cef6209c3bd69c97f3475064/src/Moar/Log/Monolog/HierarchialLogger.php#L33-L37 |
9,935 | novuso/common | src/Domain/Value/DateTime/Date.php | Date.create | public static function create(int $year, int $month, int $day): Date
{
return new static($year, $month, $day);
} | php | public static function create(int $year, int $month, int $day): Date
{
return new static($year, $month, $day);
} | [
"public",
"static",
"function",
"create",
"(",
"int",
"$",
"year",
",",
"int",
"$",
"month",
",",
"int",
"$",
"day",
")",
":",
"Date",
"{",
"return",
"new",
"static",
"(",
"$",
"year",
",",
"$",
"month",
",",
"$",
"day",
")",
";",
"}"
] | Creates instance from date values
@param int $year The year
@param int $month The month
@param int $day The day
@return Date
@throws DomainException When the date is not valid | [
"Creates",
"instance",
"from",
"date",
"values"
] | 7d0e5a4f4c79c9622e068efc8b7c70815c460863 | https://github.com/novuso/common/blob/7d0e5a4f4c79c9622e068efc8b7c70815c460863/src/Domain/Value/DateTime/Date.php#L71-L74 |
9,936 | novuso/common | src/Domain/Value/DateTime/Date.php | Date.now | public static function now(?string $timezone = null): Date
{
$timezone = $timezone ?: date_default_timezone_get();
assert(Validate::isTimezone($timezone), sprintf('Invalid timezone: %s', $timezone));
$dateTime = new DateTimeImmutable('now', new DateTimeZone($timezone));
$year = (int... | php | public static function now(?string $timezone = null): Date
{
$timezone = $timezone ?: date_default_timezone_get();
assert(Validate::isTimezone($timezone), sprintf('Invalid timezone: %s', $timezone));
$dateTime = new DateTimeImmutable('now', new DateTimeZone($timezone));
$year = (int... | [
"public",
"static",
"function",
"now",
"(",
"?",
"string",
"$",
"timezone",
"=",
"null",
")",
":",
"Date",
"{",
"$",
"timezone",
"=",
"$",
"timezone",
"?",
":",
"date_default_timezone_get",
"(",
")",
";",
"assert",
"(",
"Validate",
"::",
"isTimezone",
"(... | Creates instance for the current date
@param string|null $timezone The timezone string or null for default
@return Date | [
"Creates",
"instance",
"for",
"the",
"current",
"date"
] | 7d0e5a4f4c79c9622e068efc8b7c70815c460863 | https://github.com/novuso/common/blob/7d0e5a4f4c79c9622e068efc8b7c70815c460863/src/Domain/Value/DateTime/Date.php#L83-L94 |
9,937 | novuso/common | src/Domain/Value/DateTime/Date.php | Date.guardDate | protected function guardDate(int $year, int $month, int $day): void
{
if (!checkdate($month, $day, $year)) {
$message = sprintf('Invalid date: %04d-%02d-%02d', $year, $month, $day);
throw new DomainException($message);
}
} | php | protected function guardDate(int $year, int $month, int $day): void
{
if (!checkdate($month, $day, $year)) {
$message = sprintf('Invalid date: %04d-%02d-%02d', $year, $month, $day);
throw new DomainException($message);
}
} | [
"protected",
"function",
"guardDate",
"(",
"int",
"$",
"year",
",",
"int",
"$",
"month",
",",
"int",
"$",
"day",
")",
":",
"void",
"{",
"if",
"(",
"!",
"checkdate",
"(",
"$",
"month",
",",
"$",
"day",
",",
"$",
"year",
")",
")",
"{",
"$",
"mess... | Validates the date
@param int $year The year
@param int $month The month
@param int $day The day
@return void
@throws DomainException When the date is not valid | [
"Validates",
"the",
"date"
] | 7d0e5a4f4c79c9622e068efc8b7c70815c460863 | https://github.com/novuso/common/blob/7d0e5a4f4c79c9622e068efc8b7c70815c460863/src/Domain/Value/DateTime/Date.php#L240-L246 |
9,938 | oroinc/OroChainProcessorComponent | ChainProcessorFactory.php | ChainProcessorFactory.addFactory | public function addFactory(ProcessorFactoryInterface $factory, $priority = 0)
{
$this->factories[$priority][] = $factory;
// sort by priority and flatten
// we do it here due to performance reasons (it is expected that it will be only several factories,
// but the getProcessor method... | php | public function addFactory(ProcessorFactoryInterface $factory, $priority = 0)
{
$this->factories[$priority][] = $factory;
// sort by priority and flatten
// we do it here due to performance reasons (it is expected that it will be only several factories,
// but the getProcessor method... | [
"public",
"function",
"addFactory",
"(",
"ProcessorFactoryInterface",
"$",
"factory",
",",
"$",
"priority",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"factories",
"[",
"$",
"priority",
"]",
"[",
"]",
"=",
"$",
"factory",
";",
"// sort by priority and flatten",
... | Registers a factory in the chain
@param ProcessorFactoryInterface $factory
@param int $priority | [
"Registers",
"a",
"factory",
"in",
"the",
"chain"
] | 89c9bc60140292c9367a0c3178f760ecbcec6bd2 | https://github.com/oroinc/OroChainProcessorComponent/blob/89c9bc60140292c9367a0c3178f760ecbcec6bd2/ChainProcessorFactory.php#L22-L30 |
9,939 | themichaelhall/datatypes | src/UrlPath.php | UrlPath.equals | public function equals(UrlPathInterface $urlPath): bool
{
return $this->isAbsolute() === $urlPath->isAbsolute() && $this->getDirectoryParts() === $urlPath->getDirectoryParts() && $this->getFilename() === $urlPath->getFilename();
} | php | public function equals(UrlPathInterface $urlPath): bool
{
return $this->isAbsolute() === $urlPath->isAbsolute() && $this->getDirectoryParts() === $urlPath->getDirectoryParts() && $this->getFilename() === $urlPath->getFilename();
} | [
"public",
"function",
"equals",
"(",
"UrlPathInterface",
"$",
"urlPath",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"isAbsolute",
"(",
")",
"===",
"$",
"urlPath",
"->",
"isAbsolute",
"(",
")",
"&&",
"$",
"this",
"->",
"getDirectoryParts",
"(",
"... | Returns true if the url path equals other url path, false otherwise.
@since 1.2.0
@param UrlPathInterface $urlPath The other url path.
@return bool True if the url path equals other url path, false otherwise. | [
"Returns",
"true",
"if",
"the",
"url",
"path",
"equals",
"other",
"url",
"path",
"false",
"otherwise",
"."
] | c738fdf4ffca2e613badcb3011dbd5268e4309d8 | https://github.com/themichaelhall/datatypes/blob/c738fdf4ffca2e613badcb3011dbd5268e4309d8/src/UrlPath.php#L34-L37 |
9,940 | themichaelhall/datatypes | src/UrlPath.php | UrlPath.getDirectory | public function getDirectory(): UrlPathInterface
{
return new self($this->myIsAbsolute, $this->myAboveBaseLevel, $this->myDirectoryParts, null);
} | php | public function getDirectory(): UrlPathInterface
{
return new self($this->myIsAbsolute, $this->myAboveBaseLevel, $this->myDirectoryParts, null);
} | [
"public",
"function",
"getDirectory",
"(",
")",
":",
"UrlPathInterface",
"{",
"return",
"new",
"self",
"(",
"$",
"this",
"->",
"myIsAbsolute",
",",
"$",
"this",
"->",
"myAboveBaseLevel",
",",
"$",
"this",
"->",
"myDirectoryParts",
",",
"null",
")",
";",
"}... | Returns the directory of the url path.
@since 1.0.0
@return UrlPathInterface The directory of the url path. | [
"Returns",
"the",
"directory",
"of",
"the",
"url",
"path",
"."
] | c738fdf4ffca2e613badcb3011dbd5268e4309d8 | https://github.com/themichaelhall/datatypes/blob/c738fdf4ffca2e613badcb3011dbd5268e4309d8/src/UrlPath.php#L46-L49 |
9,941 | themichaelhall/datatypes | src/UrlPath.php | UrlPath.getParentDirectory | public function getParentDirectory(): ?UrlPathInterface
{
if ($this->myParentDirectory($aboveBaseLevel, $directoryParts)) {
return new self($this->myIsAbsolute, $aboveBaseLevel, $directoryParts, null);
}
return null;
} | php | public function getParentDirectory(): ?UrlPathInterface
{
if ($this->myParentDirectory($aboveBaseLevel, $directoryParts)) {
return new self($this->myIsAbsolute, $aboveBaseLevel, $directoryParts, null);
}
return null;
} | [
"public",
"function",
"getParentDirectory",
"(",
")",
":",
"?",
"UrlPathInterface",
"{",
"if",
"(",
"$",
"this",
"->",
"myParentDirectory",
"(",
"$",
"aboveBaseLevel",
",",
"$",
"directoryParts",
")",
")",
"{",
"return",
"new",
"self",
"(",
"$",
"this",
"-... | Returns the parent directory of the url path or null if url path does not have a parent directory.
@since 1.0.0
@return UrlPathInterface|null The parent directory of the url path or null if url path does not have a parent directory. | [
"Returns",
"the",
"parent",
"directory",
"of",
"the",
"url",
"path",
"or",
"null",
"if",
"url",
"path",
"does",
"not",
"have",
"a",
"parent",
"directory",
"."
] | c738fdf4ffca2e613badcb3011dbd5268e4309d8 | https://github.com/themichaelhall/datatypes/blob/c738fdf4ffca2e613badcb3011dbd5268e4309d8/src/UrlPath.php#L58-L65 |
9,942 | themichaelhall/datatypes | src/UrlPath.php | UrlPath.toAbsolute | public function toAbsolute(): UrlPathInterface
{
if ($this->myAboveBaseLevel > 0) {
throw new UrlPathLogicException('Url path "' . $this->__toString() . '" can not be made absolute: Relative path is above base level.');
}
return new self(true, $this->myAboveBaseLevel, $this->myD... | php | public function toAbsolute(): UrlPathInterface
{
if ($this->myAboveBaseLevel > 0) {
throw new UrlPathLogicException('Url path "' . $this->__toString() . '" can not be made absolute: Relative path is above base level.');
}
return new self(true, $this->myAboveBaseLevel, $this->myD... | [
"public",
"function",
"toAbsolute",
"(",
")",
":",
"UrlPathInterface",
"{",
"if",
"(",
"$",
"this",
"->",
"myAboveBaseLevel",
">",
"0",
")",
"{",
"throw",
"new",
"UrlPathLogicException",
"(",
"'Url path \"'",
".",
"$",
"this",
"->",
"__toString",
"(",
")",
... | Returns The url path as an absolute path.
@since 1.0.0
@throws UrlPathLogicException if the url path could not be made absolute.
@return UrlPathInterface The url path as an absolute path. | [
"Returns",
"The",
"url",
"path",
"as",
"an",
"absolute",
"path",
"."
] | c738fdf4ffca2e613badcb3011dbd5268e4309d8 | https://github.com/themichaelhall/datatypes/blob/c738fdf4ffca2e613badcb3011dbd5268e4309d8/src/UrlPath.php#L76-L83 |
9,943 | themichaelhall/datatypes | src/UrlPath.php | UrlPath.toRelative | public function toRelative(): UrlPathInterface
{
return new self(false, $this->myAboveBaseLevel, $this->myDirectoryParts, $this->myFilename);
} | php | public function toRelative(): UrlPathInterface
{
return new self(false, $this->myAboveBaseLevel, $this->myDirectoryParts, $this->myFilename);
} | [
"public",
"function",
"toRelative",
"(",
")",
":",
"UrlPathInterface",
"{",
"return",
"new",
"self",
"(",
"false",
",",
"$",
"this",
"->",
"myAboveBaseLevel",
",",
"$",
"this",
"->",
"myDirectoryParts",
",",
"$",
"this",
"->",
"myFilename",
")",
";",
"}"
] | Returns the url path as a relative path.
@since 1.0.0
@return UrlPathInterface The url path as a relative path. | [
"Returns",
"the",
"url",
"path",
"as",
"a",
"relative",
"path",
"."
] | c738fdf4ffca2e613badcb3011dbd5268e4309d8 | https://github.com/themichaelhall/datatypes/blob/c738fdf4ffca2e613badcb3011dbd5268e4309d8/src/UrlPath.php#L92-L95 |
9,944 | themichaelhall/datatypes | src/UrlPath.php | UrlPath.withUrlPath | public function withUrlPath(UrlPathInterface $urlPath): UrlPathInterface
{
if (!$this->myCombine($urlPath, $isAbsolute, $aboveBaseLevel, $directoryParts, $filename, $error)) {
throw new UrlPathLogicException('Url path "' . $this->__toString() . '" can not be combined with url path "' . $urlPath-... | php | public function withUrlPath(UrlPathInterface $urlPath): UrlPathInterface
{
if (!$this->myCombine($urlPath, $isAbsolute, $aboveBaseLevel, $directoryParts, $filename, $error)) {
throw new UrlPathLogicException('Url path "' . $this->__toString() . '" can not be combined with url path "' . $urlPath-... | [
"public",
"function",
"withUrlPath",
"(",
"UrlPathInterface",
"$",
"urlPath",
")",
":",
"UrlPathInterface",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"myCombine",
"(",
"$",
"urlPath",
",",
"$",
"isAbsolute",
",",
"$",
"aboveBaseLevel",
",",
"$",
"directoryPart... | Returns a copy of the url path combined with another url path.
@since 1.0.0
@param UrlPathInterface $urlPath The other url path.
@throws UrlPathLogicException if the url paths could not be combined.
@return UrlPathInterface The combined url path. | [
"Returns",
"a",
"copy",
"of",
"the",
"url",
"path",
"combined",
"with",
"another",
"url",
"path",
"."
] | c738fdf4ffca2e613badcb3011dbd5268e4309d8 | https://github.com/themichaelhall/datatypes/blob/c738fdf4ffca2e613badcb3011dbd5268e4309d8/src/UrlPath.php#L108-L115 |
9,945 | themichaelhall/datatypes | src/UrlPath.php | UrlPath.isValid | public static function isValid(string $urlPath): bool
{
return self::myParse(
'/',
$urlPath,
function ($p, $d, &$e) {
return self::myPartValidator($p, $d, $e);
});
} | php | public static function isValid(string $urlPath): bool
{
return self::myParse(
'/',
$urlPath,
function ($p, $d, &$e) {
return self::myPartValidator($p, $d, $e);
});
} | [
"public",
"static",
"function",
"isValid",
"(",
"string",
"$",
"urlPath",
")",
":",
"bool",
"{",
"return",
"self",
"::",
"myParse",
"(",
"'/'",
",",
"$",
"urlPath",
",",
"function",
"(",
"$",
"p",
",",
"$",
"d",
",",
"&",
"$",
"e",
")",
"{",
"ret... | Checks if a url path is valid.
@since 1.0.0
@param string $urlPath The url path.
@return bool True if the $urlPath parameter is a valid url path, false otherwise. | [
"Checks",
"if",
"a",
"url",
"path",
"is",
"valid",
"."
] | c738fdf4ffca2e613badcb3011dbd5268e4309d8 | https://github.com/themichaelhall/datatypes/blob/c738fdf4ffca2e613badcb3011dbd5268e4309d8/src/UrlPath.php#L140-L148 |
9,946 | mszewcz/php-json-schema-validator | src/Validators/StringValidators/FormatValidator.php | FormatValidator.validateFormatUri | private function validateFormatUri(string $subject): bool
{
return \filter_var($subject, \FILTER_VALIDATE_URL, \FILTER_FLAG_SCHEME_REQUIRED | \FILTER_FLAG_HOST_REQUIRED)
!== false;
} | php | private function validateFormatUri(string $subject): bool
{
return \filter_var($subject, \FILTER_VALIDATE_URL, \FILTER_FLAG_SCHEME_REQUIRED | \FILTER_FLAG_HOST_REQUIRED)
!== false;
} | [
"private",
"function",
"validateFormatUri",
"(",
"string",
"$",
"subject",
")",
":",
"bool",
"{",
"return",
"\\",
"filter_var",
"(",
"$",
"subject",
",",
"\\",
"FILTER_VALIDATE_URL",
",",
"\\",
"FILTER_FLAG_SCHEME_REQUIRED",
"|",
"\\",
"FILTER_FLAG_HOST_REQUIRED",
... | 'uri' format validation
@param string $subject
@return bool | [
"uri",
"format",
"validation"
] | f7768bfe07ce6508bb1ff36163560a5e5791de7d | https://github.com/mszewcz/php-json-schema-validator/blob/f7768bfe07ce6508bb1ff36163560a5e5791de7d/src/Validators/StringValidators/FormatValidator.php#L117-L121 |
9,947 | oal/babble | src/Babble.php | Babble.serve | public function serve()
{
$request = Request::createFromGlobals();
$response = $this->handleRequest($request);
if ($this->liveReload) $this->injectLiveReload($response);
$response->send();
} | php | public function serve()
{
$request = Request::createFromGlobals();
$response = $this->handleRequest($request);
if ($this->liveReload) $this->injectLiveReload($response);
$response->send();
} | [
"public",
"function",
"serve",
"(",
")",
"{",
"$",
"request",
"=",
"Request",
"::",
"createFromGlobals",
"(",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"handleRequest",
"(",
"$",
"request",
")",
";",
"if",
"(",
"$",
"this",
"->",
"liveReload",... | Serves a response based on the request received from the client. | [
"Serves",
"a",
"response",
"based",
"on",
"the",
"request",
"received",
"from",
"the",
"client",
"."
] | 5a352d12ead6341294747831b0dfce097a0215e7 | https://github.com/oal/babble/blob/5a352d12ead6341294747831b0dfce097a0215e7/src/Babble.php#L37-L45 |
9,948 | oal/babble | src/Babble.php | Babble.injectLiveReload | private function injectLiveReload(Response $response)
{
$content = $response->getContent();
$content = str_replace('</body>', '
<script>
document.write(\'<script src="http://\' + (location.host || \'localhost\').split(\':\')[0] + \':35729/livereload.js?snipver=1"></\' + \... | php | private function injectLiveReload(Response $response)
{
$content = $response->getContent();
$content = str_replace('</body>', '
<script>
document.write(\'<script src="http://\' + (location.host || \'localhost\').split(\':\')[0] + \':35729/livereload.js?snipver=1"></\' + \... | [
"private",
"function",
"injectLiveReload",
"(",
"Response",
"$",
"response",
")",
"{",
"$",
"content",
"=",
"$",
"response",
"->",
"getContent",
"(",
")",
";",
"$",
"content",
"=",
"str_replace",
"(",
"'</body>'",
",",
"'\n <script>\n doc... | Injects script tag that loads livereload.js to the response.
@param Response $response | [
"Injects",
"script",
"tag",
"that",
"loads",
"livereload",
".",
"js",
"to",
"the",
"response",
"."
] | 5a352d12ead6341294747831b0dfce097a0215e7 | https://github.com/oal/babble/blob/5a352d12ead6341294747831b0dfce097a0215e7/src/Babble.php#L113-L121 |
9,949 | mirko-pagliai/cakephp-tokens | src/Model/Table/TokensTable.php | TokensTable.beforeSave | public function beforeSave(Event $event, Entity $entity, ArrayObject $options)
{
if (empty($entity->expiry)) {
$entity->expiry = Configure::read('Tokens.expiryDefaultValue');
}
if (!empty($entity->extra)) {
$entity->extra = serialize($entity->extra);
}
... | php | public function beforeSave(Event $event, Entity $entity, ArrayObject $options)
{
if (empty($entity->expiry)) {
$entity->expiry = Configure::read('Tokens.expiryDefaultValue');
}
if (!empty($entity->extra)) {
$entity->extra = serialize($entity->extra);
}
... | [
"public",
"function",
"beforeSave",
"(",
"Event",
"$",
"event",
",",
"Entity",
"$",
"entity",
",",
"ArrayObject",
"$",
"options",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"entity",
"->",
"expiry",
")",
")",
"{",
"$",
"entity",
"->",
"expiry",
"=",
"Co... | Called before each entity is saved.
Stopping this event will abort the save operation.
@param \Cake\Event\Event $event Event
@param \Cake\ORM\Entity $entity Entity
@param \ArrayObject $options Options
@return bool
@uses deleteExpired() | [
"Called",
"before",
"each",
"entity",
"is",
"saved",
".",
"Stopping",
"this",
"event",
"will",
"abort",
"the",
"save",
"operation",
"."
] | 1e6e2fb4bdabc1e3801c428775813d2a2f022ae7 | https://github.com/mirko-pagliai/cakephp-tokens/blob/1e6e2fb4bdabc1e3801c428775813d2a2f022ae7/src/Model/Table/TokensTable.php#L49-L64 |
9,950 | mirko-pagliai/cakephp-tokens | src/Model/Table/TokensTable.php | TokensTable.deleteExpired | public function deleteExpired(Token $entity = null)
{
$conditions[] = ['expiry <' => new Time];
if (!empty($entity->token)) {
$conditions[] = ['token' => $entity->token];
}
if (!empty($entity->user_id)) {
$conditions[] = ['user_id' => $entity->user_id];
... | php | public function deleteExpired(Token $entity = null)
{
$conditions[] = ['expiry <' => new Time];
if (!empty($entity->token)) {
$conditions[] = ['token' => $entity->token];
}
if (!empty($entity->user_id)) {
$conditions[] = ['user_id' => $entity->user_id];
... | [
"public",
"function",
"deleteExpired",
"(",
"Token",
"$",
"entity",
"=",
"null",
")",
"{",
"$",
"conditions",
"[",
"]",
"=",
"[",
"'expiry <'",
"=>",
"new",
"Time",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"entity",
"->",
"token",
")",
")",
"{"... | Deletes all expired tokens.
If a `$token` entity is passed, it also clears tokens with the same
token value and/or the same user.
This method should be called before creating a new token. In fact, it
prevents a user from having more than token or a token is created with
the same token value.
@param \Tokens\Model\Enti... | [
"Deletes",
"all",
"expired",
"tokens",
"."
] | 1e6e2fb4bdabc1e3801c428775813d2a2f022ae7 | https://github.com/mirko-pagliai/cakephp-tokens/blob/1e6e2fb4bdabc1e3801c428775813d2a2f022ae7/src/Model/Table/TokensTable.php#L78-L91 |
9,951 | mirko-pagliai/cakephp-tokens | src/Model/Table/TokensTable.php | TokensTable.buildRules | public function buildRules(RulesChecker $rules)
{
//Uses validation rules as application rules
$rules->add(function (Token $entity) {
$errors = $this->getValidator('default')->errors(
$entity->extract($this->getSchema()->columns(), true),
$entity->isNew()
... | php | public function buildRules(RulesChecker $rules)
{
//Uses validation rules as application rules
$rules->add(function (Token $entity) {
$errors = $this->getValidator('default')->errors(
$entity->extract($this->getSchema()->columns(), true),
$entity->isNew()
... | [
"public",
"function",
"buildRules",
"(",
"RulesChecker",
"$",
"rules",
")",
"{",
"//Uses validation rules as application rules",
"$",
"rules",
"->",
"add",
"(",
"function",
"(",
"Token",
"$",
"entity",
")",
"{",
"$",
"errors",
"=",
"$",
"this",
"->",
"getValid... | Build rules.
It uses validation rules as application rules.
@param Cake\ORM\RulesChecker $rules The rules object to be modified
@return Cake\ORM\RulesChecker | [
"Build",
"rules",
"."
] | 1e6e2fb4bdabc1e3801c428775813d2a2f022ae7 | https://github.com/mirko-pagliai/cakephp-tokens/blob/1e6e2fb4bdabc1e3801c428775813d2a2f022ae7/src/Model/Table/TokensTable.php#L174-L190 |
9,952 | ARCANESOFT/Core | src/Helpers/UI/Label.php | Label.activeIcon | public static function activeIcon($active, array $options = [], $withTooltip = true)
{
// TODO: Refactor the options to a dedicated config file.
$classes = Arr::get($options, 'classes', [
'enabled' => 'label label-success',
'disabled' => 'label label-default',
]... | php | public static function activeIcon($active, array $options = [], $withTooltip = true)
{
// TODO: Refactor the options to a dedicated config file.
$classes = Arr::get($options, 'classes', [
'enabled' => 'label label-success',
'disabled' => 'label label-default',
]... | [
"public",
"static",
"function",
"activeIcon",
"(",
"$",
"active",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"withTooltip",
"=",
"true",
")",
"{",
"// TODO: Refactor the options to a dedicated config file.",
"$",
"classes",
"=",
"Arr",
"::",
"get",
... | Generate active icon label.
@param bool $active
@param array $options
@param bool $withTooltip
@return \Illuminate\Support\HtmlString | [
"Generate",
"active",
"icon",
"label",
"."
] | d0798074d47785cf0a768f51d82c0315363213be | https://github.com/ARCANESOFT/Core/blob/d0798074d47785cf0a768f51d82c0315363213be/src/Helpers/UI/Label.php#L30-L53 |
9,953 | ARCANESOFT/Core | src/Helpers/UI/Label.php | Label.activeStatus | public static function activeStatus($active, array $options = [], $withIcon = true)
{
// TODO: Refactor the options to a dedicated config file.
$classes = Arr::get($options, 'classes', [
'enabled' => 'label label-success',
'disabled' => 'label label-default',
])... | php | public static function activeStatus($active, array $options = [], $withIcon = true)
{
// TODO: Refactor the options to a dedicated config file.
$classes = Arr::get($options, 'classes', [
'enabled' => 'label label-success',
'disabled' => 'label label-default',
])... | [
"public",
"static",
"function",
"activeStatus",
"(",
"$",
"active",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"withIcon",
"=",
"true",
")",
"{",
"// TODO: Refactor the options to a dedicated config file.",
"$",
"classes",
"=",
"Arr",
"::",
"get",
... | Generate active status label.
@param bool $active
@param array $options
@param bool $withIcon
@return \Illuminate\Support\HtmlString | [
"Generate",
"active",
"status",
"label",
"."
] | d0798074d47785cf0a768f51d82c0315363213be | https://github.com/ARCANESOFT/Core/blob/d0798074d47785cf0a768f51d82c0315363213be/src/Helpers/UI/Label.php#L64-L86 |
9,954 | ARCANESOFT/Core | src/Helpers/UI/Label.php | Label.checkStatus | public static function checkStatus($checked, array $options = [], $withIcon = true)
{
// TODO: Refactor the options to a dedicated config file.
$classes = Arr::get($options, 'classes', [
'checked' => 'label label-success',
'unchecked' => 'label label-default',
... | php | public static function checkStatus($checked, array $options = [], $withIcon = true)
{
// TODO: Refactor the options to a dedicated config file.
$classes = Arr::get($options, 'classes', [
'checked' => 'label label-success',
'unchecked' => 'label label-default',
... | [
"public",
"static",
"function",
"checkStatus",
"(",
"$",
"checked",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"withIcon",
"=",
"true",
")",
"{",
"// TODO: Refactor the options to a dedicated config file.",
"$",
"classes",
"=",
"Arr",
"::",
"get",
... | Generate check status label.
@param bool $checked
@param array $options
@param bool $withIcon
@return \Illuminate\Support\HtmlString | [
"Generate",
"check",
"status",
"label",
"."
] | d0798074d47785cf0a768f51d82c0315363213be | https://github.com/ARCANESOFT/Core/blob/d0798074d47785cf0a768f51d82c0315363213be/src/Helpers/UI/Label.php#L132-L154 |
9,955 | ARCANESOFT/Core | src/Helpers/UI/Label.php | Label.count | public static function count($count, array $options = []) {
// TODO: Refactor the options to a dedicated config file.
$classes = Arr::get($options, 'classes', [
'positive' => 'label label-info',
'zero' => 'label label-default',
'negative' => 'label label-danger',... | php | public static function count($count, array $options = []) {
// TODO: Refactor the options to a dedicated config file.
$classes = Arr::get($options, 'classes', [
'positive' => 'label label-info',
'zero' => 'label label-default',
'negative' => 'label label-danger',... | [
"public",
"static",
"function",
"count",
"(",
"$",
"count",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"// TODO: Refactor the options to a dedicated config file.",
"$",
"classes",
"=",
"Arr",
"::",
"get",
"(",
"$",
"options",
",",
"'classes'",
",",... | Generate count label.
@param int|float $count
@param array $options
@return \Illuminate\Support\HtmlString | [
"Generate",
"count",
"label",
"."
] | d0798074d47785cf0a768f51d82c0315363213be | https://github.com/ARCANESOFT/Core/blob/d0798074d47785cf0a768f51d82c0315363213be/src/Helpers/UI/Label.php#L164-L176 |
9,956 | ARCANESOFT/Core | src/Helpers/UI/Label.php | Label.lockedStatus | public static function lockedStatus($locked, array $options = [], $withIcon = true)
{
// TODO: Refactor the options to a dedicated config file.
$classes = Arr::get($options, 'classes', [
'locked' => 'label label-danger',
'unlocked' => 'label label-success',
]);... | php | public static function lockedStatus($locked, array $options = [], $withIcon = true)
{
// TODO: Refactor the options to a dedicated config file.
$classes = Arr::get($options, 'classes', [
'locked' => 'label label-danger',
'unlocked' => 'label label-success',
]);... | [
"public",
"static",
"function",
"lockedStatus",
"(",
"$",
"locked",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"withIcon",
"=",
"true",
")",
"{",
"// TODO: Refactor the options to a dedicated config file.",
"$",
"classes",
"=",
"Arr",
"::",
"get",
... | Generate locked status label.
@param bool $locked
@param array $options
@param bool $withIcon
@return \Illuminate\Support\HtmlString | [
"Generate",
"locked",
"status",
"label",
"."
] | d0798074d47785cf0a768f51d82c0315363213be | https://github.com/ARCANESOFT/Core/blob/d0798074d47785cf0a768f51d82c0315363213be/src/Helpers/UI/Label.php#L221-L244 |
9,957 | ARCANESOFT/Core | src/Helpers/UI/Label.php | Label.trashedStatus | public static function trashedStatus(array $options = [], $withIcon = true)
{
$trans = Arr::get($options, 'trans', 'core::statuses.trashed');
$icon = Arr::get($options, 'icon', 'fa fa-fw fa-trash-o');
$attributes = [
'class' => Arr::get($options, 'class', 'label label-... | php | public static function trashedStatus(array $options = [], $withIcon = true)
{
$trans = Arr::get($options, 'trans', 'core::statuses.trashed');
$icon = Arr::get($options, 'icon', 'fa fa-fw fa-trash-o');
$attributes = [
'class' => Arr::get($options, 'class', 'label label-... | [
"public",
"static",
"function",
"trashedStatus",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"withIcon",
"=",
"true",
")",
"{",
"$",
"trans",
"=",
"Arr",
"::",
"get",
"(",
"$",
"options",
",",
"'trans'",
",",
"'core::statuses.trashed'",
")",
... | Generate trashed icon label.
@param array $options
@return \Illuminate\Support\HtmlString | [
"Generate",
"trashed",
"icon",
"label",
"."
] | d0798074d47785cf0a768f51d82c0315363213be | https://github.com/ARCANESOFT/Core/blob/d0798074d47785cf0a768f51d82c0315363213be/src/Helpers/UI/Label.php#L252-L263 |
9,958 | ARCANESOFT/Core | src/Helpers/UI/Label.php | Label.generateWithTooltip | protected static function generateWithTooltip($value, $title, array $attributes = [])
{
$attributes['data-toggle'] = 'tooltip';
$attributes['data-original-title'] = $title;
return static::generate($value, $attributes);
} | php | protected static function generateWithTooltip($value, $title, array $attributes = [])
{
$attributes['data-toggle'] = 'tooltip';
$attributes['data-original-title'] = $title;
return static::generate($value, $attributes);
} | [
"protected",
"static",
"function",
"generateWithTooltip",
"(",
"$",
"value",
",",
"$",
"title",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"attributes",
"[",
"'data-toggle'",
"]",
"=",
"'tooltip'",
";",
"$",
"attributes",
"[",
"'data-or... | Generate the label with tooltip.
@param string $value
@param string $title
@param array $attributes
@return \Illuminate\Support\HtmlString | [
"Generate",
"the",
"label",
"with",
"tooltip",
"."
] | d0798074d47785cf0a768f51d82c0315363213be | https://github.com/ARCANESOFT/Core/blob/d0798074d47785cf0a768f51d82c0315363213be/src/Helpers/UI/Label.php#L294-L300 |
9,959 | RhubarbPHP/Module.CsrfProtection | src/CsrfProtection.php | CsrfProtection.validateHeaders | public function validateHeaders(WebRequest $request)
{
$settings = CsrfSettings::singleton();
$headersValid = false;
$referrerDomain = $this->getHost($request->header("Referer", ""));
if ($referrerDomain != "") {
if ($referrerDomain == $settings->domain){
... | php | public function validateHeaders(WebRequest $request)
{
$settings = CsrfSettings::singleton();
$headersValid = false;
$referrerDomain = $this->getHost($request->header("Referer", ""));
if ($referrerDomain != "") {
if ($referrerDomain == $settings->domain){
... | [
"public",
"function",
"validateHeaders",
"(",
"WebRequest",
"$",
"request",
")",
"{",
"$",
"settings",
"=",
"CsrfSettings",
"::",
"singleton",
"(",
")",
";",
"$",
"headersValid",
"=",
"false",
";",
"$",
"referrerDomain",
"=",
"$",
"this",
"->",
"getHost",
... | Validates that a request headers meets CSRF requirements.
@param WebRequest $request
@throws CsrfViolationException Thrown if the request does not validate on headers. | [
"Validates",
"that",
"a",
"request",
"headers",
"meets",
"CSRF",
"requirements",
"."
] | 3472b0cce4137b33e205183c19530b07f5a17a0d | https://github.com/RhubarbPHP/Module.CsrfProtection/blob/3472b0cce4137b33e205183c19530b07f5a17a0d/src/CsrfProtection.php#L28-L49 |
9,960 | RhubarbPHP/Module.CsrfProtection | src/CsrfProtection.php | CsrfProtection.validateCookie | public function validateCookie(WebRequest $request)
{
if ($request->cookie(self::TOKEN_COOKIE_NAME) != $request->post(self::TOKEN_COOKIE_NAME)) {
throw new CsrfViolationException();
}
} | php | public function validateCookie(WebRequest $request)
{
if ($request->cookie(self::TOKEN_COOKIE_NAME) != $request->post(self::TOKEN_COOKIE_NAME)) {
throw new CsrfViolationException();
}
} | [
"public",
"function",
"validateCookie",
"(",
"WebRequest",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"cookie",
"(",
"self",
"::",
"TOKEN_COOKIE_NAME",
")",
"!=",
"$",
"request",
"->",
"post",
"(",
"self",
"::",
"TOKEN_COOKIE_NAME",
")",
")... | Validates if the csrf_tk cookie matches the posted value. | [
"Validates",
"if",
"the",
"csrf_tk",
"cookie",
"matches",
"the",
"posted",
"value",
"."
] | 3472b0cce4137b33e205183c19530b07f5a17a0d | https://github.com/RhubarbPHP/Module.CsrfProtection/blob/3472b0cce4137b33e205183c19530b07f5a17a0d/src/CsrfProtection.php#L54-L59 |
9,961 | RhubarbPHP/Module.CsrfProtection | src/CsrfProtection.php | CsrfProtection.getCookie | public function getCookie()
{
$request = Request::current();
$settings = CsrfSettings::singleton();
if ($request instanceof WebRequest){
$existingCookie = $request->cookie(self::TOKEN_COOKIE_NAME, false);
if ($existingCookie){
$this->currentCookie = ... | php | public function getCookie()
{
$request = Request::current();
$settings = CsrfSettings::singleton();
if ($request instanceof WebRequest){
$existingCookie = $request->cookie(self::TOKEN_COOKIE_NAME, false);
if ($existingCookie){
$this->currentCookie = ... | [
"public",
"function",
"getCookie",
"(",
")",
"{",
"$",
"request",
"=",
"Request",
"::",
"current",
"(",
")",
";",
"$",
"settings",
"=",
"CsrfSettings",
"::",
"singleton",
"(",
")",
";",
"if",
"(",
"$",
"request",
"instanceof",
"WebRequest",
")",
"{",
"... | Returns the current cookie being used for CSRF or generates one if one doesn't exist. | [
"Returns",
"the",
"current",
"cookie",
"being",
"used",
"for",
"CSRF",
"or",
"generates",
"one",
"if",
"one",
"doesn",
"t",
"exist",
"."
] | 3472b0cce4137b33e205183c19530b07f5a17a0d | https://github.com/RhubarbPHP/Module.CsrfProtection/blob/3472b0cce4137b33e205183c19530b07f5a17a0d/src/CsrfProtection.php#L66-L99 |
9,962 | jinraynor1/threading | src/Pcntl/Thread.php | Thread.setRunnable | public function setRunnable($runnable)
{
if (self::isRunnableOk($runnable)) {
$this->runnable = $runnable;
} else {
$this->fatalError(Thread::FUNCTION_NOT_CALLABLE);
}
} | php | public function setRunnable($runnable)
{
if (self::isRunnableOk($runnable)) {
$this->runnable = $runnable;
} else {
$this->fatalError(Thread::FUNCTION_NOT_CALLABLE);
}
} | [
"public",
"function",
"setRunnable",
"(",
"$",
"runnable",
")",
"{",
"if",
"(",
"self",
"::",
"isRunnableOk",
"(",
"$",
"runnable",
")",
")",
"{",
"$",
"this",
"->",
"runnable",
"=",
"$",
"runnable",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"fatalEr... | Sets the callback
@param callback $runnable Callback reference
@return callback | [
"Sets",
"the",
"callback"
] | 8b63c75fe4fcc2523d26f060a75af1694dd020d4 | https://github.com/jinraynor1/threading/blob/8b63c75fe4fcc2523d26f060a75af1694dd020d4/src/Pcntl/Thread.php#L114-L121 |
9,963 | jinraynor1/threading | src/Pcntl/Thread.php | Thread.isAlive | public function isAlive()
{
$pid = pcntl_waitpid($this->_pid, $status, WNOHANG);
$this->result = unserialize(trim(socket_read($this->sockets[1], $this->message_length)));
socket_close($this->sockets[1]);
return ($pid === 0);
} | php | public function isAlive()
{
$pid = pcntl_waitpid($this->_pid, $status, WNOHANG);
$this->result = unserialize(trim(socket_read($this->sockets[1], $this->message_length)));
socket_close($this->sockets[1]);
return ($pid === 0);
} | [
"public",
"function",
"isAlive",
"(",
")",
"{",
"$",
"pid",
"=",
"pcntl_waitpid",
"(",
"$",
"this",
"->",
"_pid",
",",
"$",
"status",
",",
"WNOHANG",
")",
";",
"$",
"this",
"->",
"result",
"=",
"unserialize",
"(",
"trim",
"(",
"socket_read",
"(",
"$"... | Checks if the child thread is alive
@return boolean | [
"Checks",
"if",
"the",
"child",
"thread",
"is",
"alive"
] | 8b63c75fe4fcc2523d26f060a75af1694dd020d4 | https://github.com/jinraynor1/threading/blob/8b63c75fe4fcc2523d26f060a75af1694dd020d4/src/Pcntl/Thread.php#L163-L170 |
9,964 | jinraynor1/threading | src/Pcntl/Thread.php | Thread.start | public function start($arguments)
{
if (socket_create_pair(AF_UNIX, SOCK_STREAM, 0, $this->sockets) === false) {
throw new \Exception(socket_strerror(socket_last_error()));
}
$pid = @pcntl_fork();
if ($pid == -1) {
$this->fatalError(Thread::COULD_NOT_FORK);
... | php | public function start($arguments)
{
if (socket_create_pair(AF_UNIX, SOCK_STREAM, 0, $this->sockets) === false) {
throw new \Exception(socket_strerror(socket_last_error()));
}
$pid = @pcntl_fork();
if ($pid == -1) {
$this->fatalError(Thread::COULD_NOT_FORK);
... | [
"public",
"function",
"start",
"(",
"$",
"arguments",
")",
"{",
"if",
"(",
"socket_create_pair",
"(",
"AF_UNIX",
",",
"SOCK_STREAM",
",",
"0",
",",
"$",
"this",
"->",
"sockets",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"so... | Starts the thread, all the parameters are
passed to the callback function
@return void | [
"Starts",
"the",
"thread",
"all",
"the",
"parameters",
"are",
"passed",
"to",
"the",
"callback",
"function"
] | 8b63c75fe4fcc2523d26f060a75af1694dd020d4 | https://github.com/jinraynor1/threading/blob/8b63c75fe4fcc2523d26f060a75af1694dd020d4/src/Pcntl/Thread.php#L178-L208 |
9,965 | jinraynor1/threading | src/Pcntl/Thread.php | Thread.stop | public function stop($signal = SIGKILL, $wait = false)
{
if ($this->isAlive()) {
posix_kill($this->_pid, $signal);
if ($wait) {
pcntl_waitpid($this->_pid, $status = 0);
}
}
} | php | public function stop($signal = SIGKILL, $wait = false)
{
if ($this->isAlive()) {
posix_kill($this->_pid, $signal);
if ($wait) {
pcntl_waitpid($this->_pid, $status = 0);
}
}
} | [
"public",
"function",
"stop",
"(",
"$",
"signal",
"=",
"SIGKILL",
",",
"$",
"wait",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isAlive",
"(",
")",
")",
"{",
"posix_kill",
"(",
"$",
"this",
"->",
"_pid",
",",
"$",
"signal",
")",
";",
... | Attempts to stop the thread
returns true on success and false otherwise
@param integer $signal SIGKILL or SIGTERM
@param boolean $wait Wait until child has exited
@return void | [
"Attempts",
"to",
"stop",
"the",
"thread",
"returns",
"true",
"on",
"success",
"and",
"false",
"otherwise"
] | 8b63c75fe4fcc2523d26f060a75af1694dd020d4 | https://github.com/jinraynor1/threading/blob/8b63c75fe4fcc2523d26f060a75af1694dd020d4/src/Pcntl/Thread.php#L219-L227 |
9,966 | CakeCMS/Community | src/Controller/UsersController.php | UsersController.profile | public function profile()
{
$userId = $this->Auth->user('id');
if (!$userId) {
$this->Flash->error(__d('community', 'You are not logged in'));
$this->redirect($this->Auth->getConfig('loginAction'));
}
$this
->set('user', $this->Users->get($userId,... | php | public function profile()
{
$userId = $this->Auth->user('id');
if (!$userId) {
$this->Flash->error(__d('community', 'You are not logged in'));
$this->redirect($this->Auth->getConfig('loginAction'));
}
$this
->set('user', $this->Users->get($userId,... | [
"public",
"function",
"profile",
"(",
")",
"{",
"$",
"userId",
"=",
"$",
"this",
"->",
"Auth",
"->",
"user",
"(",
"'id'",
")",
";",
"if",
"(",
"!",
"$",
"userId",
")",
"{",
"$",
"this",
"->",
"Flash",
"->",
"error",
"(",
"__d",
"(",
"'community'"... | Default profile page action.
@return void
@throws \Aura\Intl\Exception | [
"Default",
"profile",
"page",
"action",
"."
] | cc2bdb596dd9617d42fd81f59e981024caa062e8 | https://github.com/CakeCMS/Community/blob/cc2bdb596dd9617d42fd81f59e981024caa062e8/src/Controller/UsersController.php#L38-L49 |
9,967 | CakeCMS/Community | src/Controller/UsersController.php | UsersController._getUser | private function _getUser($id, $token)
{
return $this->Users->find()
->where([
'id' => $id,
'token' => $token
])
->first();
} | php | private function _getUser($id, $token)
{
return $this->Users->find()
->where([
'id' => $id,
'token' => $token
])
->first();
} | [
"private",
"function",
"_getUser",
"(",
"$",
"id",
",",
"$",
"token",
")",
"{",
"return",
"$",
"this",
"->",
"Users",
"->",
"find",
"(",
")",
"->",
"where",
"(",
"[",
"'id'",
"=>",
"$",
"id",
",",
"'token'",
"=>",
"$",
"token",
"]",
")",
"->",
... | Get user by id and activation token.
@param int $id User id.
@param string $token User activation token.
@return array|User|null | [
"Get",
"user",
"by",
"id",
"and",
"activation",
"token",
"."
] | cc2bdb596dd9617d42fd81f59e981024caa062e8 | https://github.com/CakeCMS/Community/blob/cc2bdb596dd9617d42fd81f59e981024caa062e8/src/Controller/UsersController.php#L191-L199 |
9,968 | meliorframework/melior | Classes/Helper/LinkHelper.php | LinkHelper.buildLink | public function buildLink(
string $protocol = null,
string $host = null,
$path = null,
array $query = null,
string $fragment = null
): string {
if (empty($protocol)) {
$protocol = (array_key_exists('HTTPS', $_SERVER) && !empty($_SERVER['HTTPS']) ? 'https' ... | php | public function buildLink(
string $protocol = null,
string $host = null,
$path = null,
array $query = null,
string $fragment = null
): string {
if (empty($protocol)) {
$protocol = (array_key_exists('HTTPS', $_SERVER) && !empty($_SERVER['HTTPS']) ? 'https' ... | [
"public",
"function",
"buildLink",
"(",
"string",
"$",
"protocol",
"=",
"null",
",",
"string",
"$",
"host",
"=",
"null",
",",
"$",
"path",
"=",
"null",
",",
"array",
"$",
"query",
"=",
"null",
",",
"string",
"$",
"fragment",
"=",
"null",
")",
":",
... | Build an URL by the given arguments.
@param string $protocol The link protocol (defaults to the current request protocol)
@param string $host The link host (defaults to the current http host)
@param string|array|null $path The link path (optional)
@param array|null $query Additi... | [
"Build",
"an",
"URL",
"by",
"the",
"given",
"arguments",
"."
] | f6469fa6e85f66a0507ae13603d19d78f2774e0b | https://github.com/meliorframework/melior/blob/f6469fa6e85f66a0507ae13603d19d78f2774e0b/Classes/Helper/LinkHelper.php#L52-L97 |
9,969 | rawphp/RawSupport | src/RawPHP/RawSupport/Collection/Collection.php | Collection.getGroupByKey | protected function getGroupByKey( $group, $key, $value )
{
if ( !is_string( $group ) && is_callable( $group ) )
{
return $group( $value, $key );
}
return Util::dataGet( $value, $group );
} | php | protected function getGroupByKey( $group, $key, $value )
{
if ( !is_string( $group ) && is_callable( $group ) )
{
return $group( $value, $key );
}
return Util::dataGet( $value, $group );
} | [
"protected",
"function",
"getGroupByKey",
"(",
"$",
"group",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"group",
")",
"&&",
"is_callable",
"(",
"$",
"group",
")",
")",
"{",
"return",
"$",
"group",
"(",
"$",... | Get the 'group by' key value.
@param Closure|string $group
@param string $key
@param mixed $value
@return string | [
"Get",
"the",
"group",
"by",
"key",
"value",
"."
] | 0eb1601fa6b14bc0e40d30dc8d53126b2409ab37 | https://github.com/rawphp/RawSupport/blob/0eb1601fa6b14bc0e40d30dc8d53126b2409ab37/src/RawPHP/RawSupport/Collection/Collection.php#L210-L218 |
9,970 | rootworkit/phpunit-helpers | src/PHPUnit/Helper/Accessor.php | Accessor.getPropertyValue | public function getPropertyValue($object, $name)
{
$property = new ReflectionProperty($object, $name);
$property->setAccessible(true);
return $property->getValue($object);
} | php | public function getPropertyValue($object, $name)
{
$property = new ReflectionProperty($object, $name);
$property->setAccessible(true);
return $property->getValue($object);
} | [
"public",
"function",
"getPropertyValue",
"(",
"$",
"object",
",",
"$",
"name",
")",
"{",
"$",
"property",
"=",
"new",
"ReflectionProperty",
"(",
"$",
"object",
",",
"$",
"name",
")",
";",
"$",
"property",
"->",
"setAccessible",
"(",
"true",
")",
";",
... | Get the value of a non-public property.
@param object $object
@param string $name
@return mixed | [
"Get",
"the",
"value",
"of",
"a",
"non",
"-",
"public",
"property",
"."
] | 8578e6d7a477f8d97982d52c5a28236aecb8b10f | https://github.com/rootworkit/phpunit-helpers/blob/8578e6d7a477f8d97982d52c5a28236aecb8b10f/src/PHPUnit/Helper/Accessor.php#L40-L45 |
9,971 | rootworkit/phpunit-helpers | src/PHPUnit/Helper/Accessor.php | Accessor.invokeMethod | public function invokeMethod($object, $name, array $args = [])
{
$method = new ReflectionMethod($object, $name);
$method->setAccessible(true);
if (empty($args)) {
return $method->invoke($object);
}
return $method->invokeArgs($object, $args);
} | php | public function invokeMethod($object, $name, array $args = [])
{
$method = new ReflectionMethod($object, $name);
$method->setAccessible(true);
if (empty($args)) {
return $method->invoke($object);
}
return $method->invokeArgs($object, $args);
} | [
"public",
"function",
"invokeMethod",
"(",
"$",
"object",
",",
"$",
"name",
",",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"method",
"=",
"new",
"ReflectionMethod",
"(",
"$",
"object",
",",
"$",
"name",
")",
";",
"$",
"method",
"->",
"set... | Invoke a non-public method
@param object $object
@param string $name
@param array $args
@return mixed | [
"Invoke",
"a",
"non",
"-",
"public",
"method"
] | 8578e6d7a477f8d97982d52c5a28236aecb8b10f | https://github.com/rootworkit/phpunit-helpers/blob/8578e6d7a477f8d97982d52c5a28236aecb8b10f/src/PHPUnit/Helper/Accessor.php#L55-L65 |
9,972 | rootworkit/phpunit-helpers | src/PHPUnit/Helper/Accessor.php | Accessor.invokeStaticMethod | public function invokeStaticMethod($class, $name, array $args = [])
{
$method = new ReflectionMethod($class, $name);
$method->setAccessible(true);
if (empty($args)) {
return $method->invoke(null);
}
return $method->invokeArgs(null, $args);
} | php | public function invokeStaticMethod($class, $name, array $args = [])
{
$method = new ReflectionMethod($class, $name);
$method->setAccessible(true);
if (empty($args)) {
return $method->invoke(null);
}
return $method->invokeArgs(null, $args);
} | [
"public",
"function",
"invokeStaticMethod",
"(",
"$",
"class",
",",
"$",
"name",
",",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"method",
"=",
"new",
"ReflectionMethod",
"(",
"$",
"class",
",",
"$",
"name",
")",
";",
"$",
"method",
"->",
... | Invoke a non-public static method
@param string $class
@param string $name
@param array $args
@return mixed | [
"Invoke",
"a",
"non",
"-",
"public",
"static",
"method"
] | 8578e6d7a477f8d97982d52c5a28236aecb8b10f | https://github.com/rootworkit/phpunit-helpers/blob/8578e6d7a477f8d97982d52c5a28236aecb8b10f/src/PHPUnit/Helper/Accessor.php#L103-L113 |
9,973 | chilimatic/datastructure-component | src/Graph/TreeNode.php | TreeNode.createTree | protected function createTree(&$keyParts, TreeNode $rootNode) : TreeNode
{
if (!count($keyParts)) {
return $rootNode;
}
$newKey = array_shift($keyParts);
$newNode = new self($rootNode, $newKey, null, $rootNode->getKeyDelimiter());
$rootNode->addChild($newNode);
... | php | protected function createTree(&$keyParts, TreeNode $rootNode) : TreeNode
{
if (!count($keyParts)) {
return $rootNode;
}
$newKey = array_shift($keyParts);
$newNode = new self($rootNode, $newKey, null, $rootNode->getKeyDelimiter());
$rootNode->addChild($newNode);
... | [
"protected",
"function",
"createTree",
"(",
"&",
"$",
"keyParts",
",",
"TreeNode",
"$",
"rootNode",
")",
":",
"TreeNode",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"keyParts",
")",
")",
"{",
"return",
"$",
"rootNode",
";",
"}",
"$",
"newKey",
"=",
"arr... | recursive way to build tree structure
@param array $keyParts
@param TreeNode $rootNode
@return TreeNode | [
"recursive",
"way",
"to",
"build",
"tree",
"structure"
] | 37832e5fab2a9520f9b025160b31a34c06bd71cd | https://github.com/chilimatic/datastructure-component/blob/37832e5fab2a9520f9b025160b31a34c06bd71cd/src/Graph/TreeNode.php#L121-L132 |
9,974 | unyx/utils | traits/StaticallyExtendable.php | StaticallyExtendable.extend | public static function extend($name, callable $callable = null)
{
if (!is_array($name)) {
if (null === $callable) {
throw new \InvalidArgumentException("A callable must be given as second parameter if the first is not an array.");
}
self::$extensions[$nam... | php | public static function extend($name, callable $callable = null)
{
if (!is_array($name)) {
if (null === $callable) {
throw new \InvalidArgumentException("A callable must be given as second parameter if the first is not an array.");
}
self::$extensions[$nam... | [
"public",
"static",
"function",
"extend",
"(",
"$",
"name",
",",
"callable",
"$",
"callable",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"callable",
")",
"{",
"throw",
"new",
... | Registers an additional static method.
@param string|array $name The name the callable should be made available as or an array of
name => callable pairs.
@param callable $callable The actual code that should be called.
@throws \InvalidArgumentException When the first parameter is not an array ... | [
"Registers",
"an",
"additional",
"static",
"method",
"."
] | 503a3dd46fd2216024ab771b6e830be16d36b358 | https://github.com/unyx/utils/blob/503a3dd46fd2216024ab771b6e830be16d36b358/traits/StaticallyExtendable.php#L35-L53 |
9,975 | nubs/sensible | src/Browser.php | Browser.viewURI | public function viewURI(ProcessBuilder $processBuilder, $uri)
{
$proc = $processBuilder->setPrefix($this->_browserCommand)->setArguments([$uri])->getProcess();
$proc->setTty(true)->run();
return $proc;
} | php | public function viewURI(ProcessBuilder $processBuilder, $uri)
{
$proc = $processBuilder->setPrefix($this->_browserCommand)->setArguments([$uri])->getProcess();
$proc->setTty(true)->run();
return $proc;
} | [
"public",
"function",
"viewURI",
"(",
"ProcessBuilder",
"$",
"processBuilder",
",",
"$",
"uri",
")",
"{",
"$",
"proc",
"=",
"$",
"processBuilder",
"->",
"setPrefix",
"(",
"$",
"this",
"->",
"_browserCommand",
")",
"->",
"setArguments",
"(",
"[",
"$",
"uri"... | View the given URI using the symfony process builder to build the symfony
process to execute.
@api
@param \Symfony\Component\Process\ProcessBuilder $processBuilder The
process builder.
@param string $uri The URI to view.
@return \Symfony\Component\Process\Process The already-executed process. | [
"View",
"the",
"given",
"URI",
"using",
"the",
"symfony",
"process",
"builder",
"to",
"build",
"the",
"symfony",
"process",
"to",
"execute",
"."
] | d0ba8d66a93d42ac0a9fb813093e8c0c3559bac7 | https://github.com/nubs/sensible/blob/d0ba8d66a93d42ac0a9fb813093e8c0c3559bac7/src/Browser.php#L35-L41 |
9,976 | traq/installer | src/Controllers/Install.php | Install.installAction | public function installAction()
{
// Create database connection and load migrations
$connection = ConnectionManager::create($_SESSION['db']);
$this->loadMigrations();
// Migrate the database.
$m = new Migrator;
$m->migrate('up');
// Create admin account
... | php | public function installAction()
{
// Create database connection and load migrations
$connection = ConnectionManager::create($_SESSION['db']);
$this->loadMigrations();
// Migrate the database.
$m = new Migrator;
$m->migrate('up');
// Create admin account
... | [
"public",
"function",
"installAction",
"(",
")",
"{",
"// Create database connection and load migrations",
"$",
"connection",
"=",
"ConnectionManager",
"::",
"create",
"(",
"$",
"_SESSION",
"[",
"'db'",
"]",
")",
";",
"$",
"this",
"->",
"loadMigrations",
"(",
")",... | Migrate database and create admin account. | [
"Migrate",
"database",
"and",
"create",
"admin",
"account",
"."
] | 7d82ee13d11c59cb63bcb7739962c85a994271ef | https://github.com/traq/installer/blob/7d82ee13d11c59cb63bcb7739962c85a994271ef/src/Controllers/Install.php#L47-L76 |
9,977 | traq/installer | src/Controllers/Install.php | Install.makeConfig | protected function makeConfig()
{
$config = [
"<?php",
"return [",
" 'environment' => \"production\",",
" 'db' => [",
" 'production' => ["
];
if ($_SESSION['db']['driver'] == "pdo_pgsql" || $_SESSION['db']['driver'] ==... | php | protected function makeConfig()
{
$config = [
"<?php",
"return [",
" 'environment' => \"production\",",
" 'db' => [",
" 'production' => ["
];
if ($_SESSION['db']['driver'] == "pdo_pgsql" || $_SESSION['db']['driver'] ==... | [
"protected",
"function",
"makeConfig",
"(",
")",
"{",
"$",
"config",
"=",
"[",
"\"<?php\"",
",",
"\"return [\"",
",",
"\" 'environment' => \\\"production\\\",\"",
",",
"\" 'db' => [\"",
",",
"\" 'production' => [\"",
"]",
";",
"if",
"(",
"$",
"_SESSION",
... | Create the configuration file contents. | [
"Create",
"the",
"configuration",
"file",
"contents",
"."
] | 7d82ee13d11c59cb63bcb7739962c85a994271ef | https://github.com/traq/installer/blob/7d82ee13d11c59cb63bcb7739962c85a994271ef/src/Controllers/Install.php#L81-L107 |
9,978 | FiveLab/Query | src/Model/Join.php | Join.inner | public static function inner(string $fromAlias, string $to, string $toAlias, string $condition): Join
{
return new self(self::MODE_INNER, $fromAlias, $to, $toAlias, $condition);
} | php | public static function inner(string $fromAlias, string $to, string $toAlias, string $condition): Join
{
return new self(self::MODE_INNER, $fromAlias, $to, $toAlias, $condition);
} | [
"public",
"static",
"function",
"inner",
"(",
"string",
"$",
"fromAlias",
",",
"string",
"$",
"to",
",",
"string",
"$",
"toAlias",
",",
"string",
"$",
"condition",
")",
":",
"Join",
"{",
"return",
"new",
"self",
"(",
"self",
"::",
"MODE_INNER",
",",
"$... | Create inner mode
@param string $fromAlias
@param string $to
@param string $toAlias
@param string $condition
@return Join | [
"Create",
"inner",
"mode"
] | 9a677ae5fd680173feae08cd1c78b0ce92937af0 | https://github.com/FiveLab/Query/blob/9a677ae5fd680173feae08cd1c78b0ce92937af0/src/Model/Join.php#L79-L82 |
9,979 | FiveLab/Query | src/Model/Join.php | Join.left | public static function left(string $fromAlias, string $to, string $toAlias, string $condition): Join
{
return new self(self::MODE_LEFT, $fromAlias, $to, $toAlias, $condition);
} | php | public static function left(string $fromAlias, string $to, string $toAlias, string $condition): Join
{
return new self(self::MODE_LEFT, $fromAlias, $to, $toAlias, $condition);
} | [
"public",
"static",
"function",
"left",
"(",
"string",
"$",
"fromAlias",
",",
"string",
"$",
"to",
",",
"string",
"$",
"toAlias",
",",
"string",
"$",
"condition",
")",
":",
"Join",
"{",
"return",
"new",
"self",
"(",
"self",
"::",
"MODE_LEFT",
",",
"$",... | Create left mode
@param string $fromAlias
@param string $to
@param string $toAlias
@param string $condition
@return Join | [
"Create",
"left",
"mode"
] | 9a677ae5fd680173feae08cd1c78b0ce92937af0 | https://github.com/FiveLab/Query/blob/9a677ae5fd680173feae08cd1c78b0ce92937af0/src/Model/Join.php#L94-L97 |
9,980 | gplcart/gapi | models/Credential.php | Credential.getList | public function getList(array $options = array())
{
$sql = 'SELECT *';
if (!empty($options['count'])) {
$sql = 'SELECT COUNT(credential_id)';
}
$sql .= ' FROM module_gapi_credential WHERE credential_id IS NOT NULL';
$conditions = array();
if (isset($op... | php | public function getList(array $options = array())
{
$sql = 'SELECT *';
if (!empty($options['count'])) {
$sql = 'SELECT COUNT(credential_id)';
}
$sql .= ' FROM module_gapi_credential WHERE credential_id IS NOT NULL';
$conditions = array();
if (isset($op... | [
"public",
"function",
"getList",
"(",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"sql",
"=",
"'SELECT *'",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
"[",
"'count'",
"]",
")",
")",
"{",
"$",
"sql",
"=",
"'SELECT COUNT(c... | Returns an array of credentials or counts them
@param array $options
@return array|integer | [
"Returns",
"an",
"array",
"of",
"credentials",
"or",
"counts",
"them"
] | b1f8a737d8ff3b6a3e54f44d19af3295ce732fa8 | https://github.com/gplcart/gapi/blob/b1f8a737d8ff3b6a3e54f44d19af3295ce732fa8/models/Credential.php#L69-L110 |
9,981 | gplcart/gapi | models/Credential.php | Credential.deleteService | public function deleteService($id)
{
$data = $this->get($id);
if (empty($data)) {
return false;
}
if (!$this->delete($id)) {
return false;
}
$file = gplcart_file_absolute($data['data']['file']);
if (file_exists($file)) {
... | php | public function deleteService($id)
{
$data = $this->get($id);
if (empty($data)) {
return false;
}
if (!$this->delete($id)) {
return false;
}
$file = gplcart_file_absolute($data['data']['file']);
if (file_exists($file)) {
... | [
"public",
"function",
"deleteService",
"(",
"$",
"id",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"id",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"thi... | Delete "Service" credential
@param int
@return bool | [
"Delete",
"Service",
"credential"
] | b1f8a737d8ff3b6a3e54f44d19af3295ce732fa8 | https://github.com/gplcart/gapi/blob/b1f8a737d8ff3b6a3e54f44d19af3295ce732fa8/models/Credential.php#L138-L157 |
9,982 | gplcart/gapi | models/Credential.php | Credential.update | public function update($id, array $data)
{
$data['modified'] = GC_TIME;
return (bool) $this->db->update('module_gapi_credential', $data, array('credential_id' => $id));
} | php | public function update($id, array $data)
{
$data['modified'] = GC_TIME;
return (bool) $this->db->update('module_gapi_credential', $data, array('credential_id' => $id));
} | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"array",
"$",
"data",
")",
"{",
"$",
"data",
"[",
"'modified'",
"]",
"=",
"GC_TIME",
";",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"db",
"->",
"update",
"(",
"'module_gapi_credential'",
",",
... | Updates a credential
@param integer $id
@param array $data
@return boolean | [
"Updates",
"a",
"credential"
] | b1f8a737d8ff3b6a3e54f44d19af3295ce732fa8 | https://github.com/gplcart/gapi/blob/b1f8a737d8ff3b6a3e54f44d19af3295ce732fa8/models/Credential.php#L165-L169 |
9,983 | gplcart/gapi | models/Credential.php | Credential.getHandlers | public function getHandlers()
{
$handlers = array(
'key' => array(
'name' => $this->translation->text('API key'),
'handlers' => array(
'delete' => array(__CLASS__, 'delete'),
'edit' => array('gplcart\\modules\\gapi\\controll... | php | public function getHandlers()
{
$handlers = array(
'key' => array(
'name' => $this->translation->text('API key'),
'handlers' => array(
'delete' => array(__CLASS__, 'delete'),
'edit' => array('gplcart\\modules\\gapi\\controll... | [
"public",
"function",
"getHandlers",
"(",
")",
"{",
"$",
"handlers",
"=",
"array",
"(",
"'key'",
"=>",
"array",
"(",
"'name'",
"=>",
"$",
"this",
"->",
"translation",
"->",
"text",
"(",
"'API key'",
")",
",",
"'handlers'",
"=>",
"array",
"(",
"'delete'",... | Returns an array of credential handlers
@return array | [
"Returns",
"an",
"array",
"of",
"credential",
"handlers"
] | b1f8a737d8ff3b6a3e54f44d19af3295ce732fa8 | https://github.com/gplcart/gapi/blob/b1f8a737d8ff3b6a3e54f44d19af3295ce732fa8/models/Credential.php#L175-L203 |
9,984 | gplcart/gapi | models/Credential.php | Credential.callHandler | public function callHandler($handler_id, $name, array $arguments = array())
{
return Handler::call($this->getHandlers(), $handler_id, $name, $arguments);
} | php | public function callHandler($handler_id, $name, array $arguments = array())
{
return Handler::call($this->getHandlers(), $handler_id, $name, $arguments);
} | [
"public",
"function",
"callHandler",
"(",
"$",
"handler_id",
",",
"$",
"name",
",",
"array",
"$",
"arguments",
"=",
"array",
"(",
")",
")",
"{",
"return",
"Handler",
"::",
"call",
"(",
"$",
"this",
"->",
"getHandlers",
"(",
")",
",",
"$",
"handler_id",... | Call a credential handler
@param string $handler_id
@param string $name
@param array $arguments
@return mixed | [
"Call",
"a",
"credential",
"handler"
] | b1f8a737d8ff3b6a3e54f44d19af3295ce732fa8 | https://github.com/gplcart/gapi/blob/b1f8a737d8ff3b6a3e54f44d19af3295ce732fa8/models/Credential.php#L212-L215 |
9,985 | mszewcz/php-json-schema-validator | src/Validators/ArrayValidators/ItemsValidator.php | ItemsValidator.validate | public function validate($subject): bool
{
if (\is_array($this->schema['items'])) {
$schemaFirstKey = \array_keys($this->schema['items'])[0];
$schemaType = \is_int($schemaFirstKey) ? 'array' : 'object';
if (($schemaType === 'object') && !$this->validateItemsSchemaObject(... | php | public function validate($subject): bool
{
if (\is_array($this->schema['items'])) {
$schemaFirstKey = \array_keys($this->schema['items'])[0];
$schemaType = \is_int($schemaFirstKey) ? 'array' : 'object';
if (($schemaType === 'object') && !$this->validateItemsSchemaObject(... | [
"public",
"function",
"validate",
"(",
"$",
"subject",
")",
":",
"bool",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"this",
"->",
"schema",
"[",
"'items'",
"]",
")",
")",
"{",
"$",
"schemaFirstKey",
"=",
"\\",
"array_keys",
"(",
"$",
"this",
"->",
... | Validates subject against items
@param $subject
@return bool | [
"Validates",
"subject",
"against",
"items"
] | f7768bfe07ce6508bb1ff36163560a5e5791de7d | https://github.com/mszewcz/php-json-schema-validator/blob/f7768bfe07ce6508bb1ff36163560a5e5791de7d/src/Validators/ArrayValidators/ItemsValidator.php#L48-L62 |
9,986 | tenside/core-bundle | src/Command/SelfUpdateCommand.php | SelfUpdateCommand.cleanupOldBackups | protected function cleanupOldBackups($rollbackDir)
{
$finder = $this->getOldInstallationFinder($rollbackDir);
$fileSystem = new Filesystem;
foreach ($finder as $file) {
$file = (string) $file;
$this->getIO()->writeError('<info>Removing: ' . $file . '</info>');
... | php | protected function cleanupOldBackups($rollbackDir)
{
$finder = $this->getOldInstallationFinder($rollbackDir);
$fileSystem = new Filesystem;
foreach ($finder as $file) {
$file = (string) $file;
$this->getIO()->writeError('<info>Removing: ' . $file . '</info>');
... | [
"protected",
"function",
"cleanupOldBackups",
"(",
"$",
"rollbackDir",
")",
"{",
"$",
"finder",
"=",
"$",
"this",
"->",
"getOldInstallationFinder",
"(",
"$",
"rollbackDir",
")",
";",
"$",
"fileSystem",
"=",
"new",
"Filesystem",
";",
"foreach",
"(",
"$",
"fin... | Clean the backup directory.
@param string $rollbackDir The backup directory.
@return void | [
"Clean",
"the",
"backup",
"directory",
"."
] | a7ffad3649cddac1e5594b4f8b65a5504363fccd | https://github.com/tenside/core-bundle/blob/a7ffad3649cddac1e5594b4f8b65a5504363fccd/src/Command/SelfUpdateCommand.php#L372-L382 |
9,987 | tenside/core-bundle | src/Command/SelfUpdateCommand.php | SelfUpdateCommand.getBaseUrl | protected function getBaseUrl()
{
if (isset($this->baseUrl)) {
return $this->baseUrl;
}
$this->baseUrl = $this->container->getParameter('tenside.self_update.base_url');
if (false === strpos($this->baseUrl, '://')) {
$this->baseUrl = (extension_loaded('openss... | php | protected function getBaseUrl()
{
if (isset($this->baseUrl)) {
return $this->baseUrl;
}
$this->baseUrl = $this->container->getParameter('tenside.self_update.base_url');
if (false === strpos($this->baseUrl, '://')) {
$this->baseUrl = (extension_loaded('openss... | [
"protected",
"function",
"getBaseUrl",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"baseUrl",
")",
")",
"{",
"return",
"$",
"this",
"->",
"baseUrl",
";",
"}",
"$",
"this",
"->",
"baseUrl",
"=",
"$",
"this",
"->",
"container",
"->",
"... | Retrieve the base url for obtaining the latest version and phar files.
@return string | [
"Retrieve",
"the",
"base",
"url",
"for",
"obtaining",
"the",
"latest",
"version",
"and",
"phar",
"files",
"."
] | a7ffad3649cddac1e5594b4f8b65a5504363fccd | https://github.com/tenside/core-bundle/blob/a7ffad3649cddac1e5594b4f8b65a5504363fccd/src/Command/SelfUpdateCommand.php#L411-L424 |
9,988 | tenside/core-bundle | src/Command/SelfUpdateCommand.php | SelfUpdateCommand.determineRemoteFilename | protected function determineRemoteFilename($updateVersion)
{
// If sha, download from root.
if (preg_match('{^[0-9a-f]{40}$}', $updateVersion)) {
return $this->getBaseUrl() . '/' . $this->getPharName();
}
// Download from sub directory otherwise.
return sprintf(
... | php | protected function determineRemoteFilename($updateVersion)
{
// If sha, download from root.
if (preg_match('{^[0-9a-f]{40}$}', $updateVersion)) {
return $this->getBaseUrl() . '/' . $this->getPharName();
}
// Download from sub directory otherwise.
return sprintf(
... | [
"protected",
"function",
"determineRemoteFilename",
"(",
"$",
"updateVersion",
")",
"{",
"// If sha, download from root.",
"if",
"(",
"preg_match",
"(",
"'{^[0-9a-f]{40}$}'",
",",
"$",
"updateVersion",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getBaseUrl",
"(",
... | Calculate the remote filename from a version.
@param string $updateVersion The version to update to either an sha or a semver version.
@return string | [
"Calculate",
"the",
"remote",
"filename",
"from",
"a",
"version",
"."
] | a7ffad3649cddac1e5594b4f8b65a5504363fccd | https://github.com/tenside/core-bundle/blob/a7ffad3649cddac1e5594b4f8b65a5504363fccd/src/Command/SelfUpdateCommand.php#L443-L457 |
9,989 | tenside/core-bundle | src/Command/SelfUpdateCommand.php | SelfUpdateCommand.determineLocalFileName | protected function determineLocalFileName()
{
// First: try to convert server argv 0 to a real path first (absolute path to a phar).
if (false !== ($localFilename = realpath($_SERVER['argv'][0]))) {
return $localFilename;
}
// Second: try the currently running phar file ... | php | protected function determineLocalFileName()
{
// First: try to convert server argv 0 to a real path first (absolute path to a phar).
if (false !== ($localFilename = realpath($_SERVER['argv'][0]))) {
return $localFilename;
}
// Second: try the currently running phar file ... | [
"protected",
"function",
"determineLocalFileName",
"(",
")",
"{",
"// First: try to convert server argv 0 to a real path first (absolute path to a phar).",
"if",
"(",
"false",
"!==",
"(",
"$",
"localFilename",
"=",
"realpath",
"(",
"$",
"_SERVER",
"[",
"'argv'",
"]",
"[",... | Determine the local file name of the current running phar.
@return string
@SuppressWarnings(PHPMD.Superglobals)
@SuppressWarnings(PHPMD.CamelCaseVariableName) | [
"Determine",
"the",
"local",
"file",
"name",
"of",
"the",
"current",
"running",
"phar",
"."
] | a7ffad3649cddac1e5594b4f8b65a5504363fccd | https://github.com/tenside/core-bundle/blob/a7ffad3649cddac1e5594b4f8b65a5504363fccd/src/Command/SelfUpdateCommand.php#L467-L481 |
9,990 | staccatocode/listable | src/Repository/AbstractRepository.php | AbstractRepository.filterBy | public function filterBy(string $name, $value): AbstractRepository
{
$this->filters[$name] = $value;
return $this;
} | php | public function filterBy(string $name, $value): AbstractRepository
{
$this->filters[$name] = $value;
return $this;
} | [
"public",
"function",
"filterBy",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
":",
"AbstractRepository",
"{",
"$",
"this",
"->",
"filters",
"[",
"$",
"name",
"]",
"=",
"$",
"value",
";",
"return",
"$",
"this",
";",
"}"
] | Set new list filter.
@param string $name
@param mixed $value
@return AbstractRepository self | [
"Set",
"new",
"list",
"filter",
"."
] | 9e97ff44e7d2af59f5a46c8e0faa29880545a40b | https://github.com/staccatocode/listable/blob/9e97ff44e7d2af59f5a46c8e0faa29880545a40b/src/Repository/AbstractRepository.php#L61-L66 |
9,991 | staccatocode/listable | src/Repository/AbstractRepository.php | AbstractRepository.setFilters | public function setFilters(array $filters): AbstractRepository
{
foreach ($filters as $f => $v) {
$this->filterBy($f, $v);
}
return $this;
} | php | public function setFilters(array $filters): AbstractRepository
{
foreach ($filters as $f => $v) {
$this->filterBy($f, $v);
}
return $this;
} | [
"public",
"function",
"setFilters",
"(",
"array",
"$",
"filters",
")",
":",
"AbstractRepository",
"{",
"foreach",
"(",
"$",
"filters",
"as",
"$",
"f",
"=>",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"filterBy",
"(",
"$",
"f",
",",
"$",
"v",
")",
";",
... | Set list filters.
@param array $filters
@return AbstractRepository self | [
"Set",
"list",
"filters",
"."
] | 9e97ff44e7d2af59f5a46c8e0faa29880545a40b | https://github.com/staccatocode/listable/blob/9e97ff44e7d2af59f5a46c8e0faa29880545a40b/src/Repository/AbstractRepository.php#L75-L82 |
9,992 | staccatocode/listable | src/Repository/AbstractRepository.php | AbstractRepository.orderBy | public function orderBy(?string $name, string $type = self::ORDER_ASC): AbstractRepository
{
$this->sorter['name'] = $name;
$this->sorter['type'] = $type;
return $this;
} | php | public function orderBy(?string $name, string $type = self::ORDER_ASC): AbstractRepository
{
$this->sorter['name'] = $name;
$this->sorter['type'] = $type;
return $this;
} | [
"public",
"function",
"orderBy",
"(",
"?",
"string",
"$",
"name",
",",
"string",
"$",
"type",
"=",
"self",
"::",
"ORDER_ASC",
")",
":",
"AbstractRepository",
"{",
"$",
"this",
"->",
"sorter",
"[",
"'name'",
"]",
"=",
"$",
"name",
";",
"$",
"this",
"-... | Set list ordering.
@param string|null $name sorter name or null to disable
@param string $type `asc` or `desc`
@return AbstractRepository self | [
"Set",
"list",
"ordering",
"."
] | 9e97ff44e7d2af59f5a46c8e0faa29880545a40b | https://github.com/staccatocode/listable/blob/9e97ff44e7d2af59f5a46c8e0faa29880545a40b/src/Repository/AbstractRepository.php#L92-L98 |
9,993 | flowcode/AmulenNewsBundle | src/Flowcode/NewsBundle/Controller/AdminPostController.php | AdminPostController.createAction | public function createAction(Request $request) {
$entity = new Post();
$form = $this->createCreateForm($entity);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$this->processVideo($entity);
$em->persi... | php | public function createAction(Request $request) {
$entity = new Post();
$form = $this->createCreateForm($entity);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$this->processVideo($entity);
$em->persi... | [
"public",
"function",
"createAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"entity",
"=",
"new",
"Post",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createCreateForm",
"(",
"$",
"entity",
")",
";",
"$",
"form",
"->",
"handleRequest",... | Creates a new Post entity.
@Route("/", name="admin_post_create")
@Method("POST")
@Template("FlowcodeNewsBundle:AdminPost:new.html.twig") | [
"Creates",
"a",
"new",
"Post",
"entity",
"."
] | e870d2f09b629affeddf9a53ed43205300b66933 | https://github.com/flowcode/AmulenNewsBundle/blob/e870d2f09b629affeddf9a53ed43205300b66933/src/Flowcode/NewsBundle/Controller/AdminPostController.php#L48-L70 |
9,994 | leedave/resource-mysql | src/Mysql.php | Mysql.connect | public function connect()
{
$arrParams = [
'mysql:host='.$this->host,
'dbname='.$this->database,
'charset='.$this->charset,
];
$this->db = PdoSingleton::getInstance()->getConnection($arrParams, $this->username, $this->password);
} | php | public function connect()
{
$arrParams = [
'mysql:host='.$this->host,
'dbname='.$this->database,
'charset='.$this->charset,
];
$this->db = PdoSingleton::getInstance()->getConnection($arrParams, $this->username, $this->password);
} | [
"public",
"function",
"connect",
"(",
")",
"{",
"$",
"arrParams",
"=",
"[",
"'mysql:host='",
".",
"$",
"this",
"->",
"host",
",",
"'dbname='",
".",
"$",
"this",
"->",
"database",
",",
"'charset='",
".",
"$",
"this",
"->",
"charset",
",",
"]",
";",
"$... | Connect to MySql DB using constant params | [
"Connect",
"to",
"MySql",
"DB",
"using",
"constant",
"params"
] | 68305dac50b1b956f08f41267d0b2912850d8232 | https://github.com/leedave/resource-mysql/blob/68305dac50b1b956f08f41267d0b2912850d8232/src/Mysql.php#L110-L119 |
9,995 | leedave/resource-mysql | src/Mysql.php | Mysql.getTableColumns | public function getTableColumns() : array
{
if (!$this->isTableNameSet()) {
return [];
}
$sql = "SHOW COLUMNS FROM `".$this->tableName."`";
$stmt = $this->db->query($sql);
$arrResult = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $arrResult;
} | php | public function getTableColumns() : array
{
if (!$this->isTableNameSet()) {
return [];
}
$sql = "SHOW COLUMNS FROM `".$this->tableName."`";
$stmt = $this->db->query($sql);
$arrResult = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $arrResult;
} | [
"public",
"function",
"getTableColumns",
"(",
")",
":",
"array",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isTableNameSet",
"(",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"sql",
"=",
"\"SHOW COLUMNS FROM `\"",
".",
"$",
"this",
"->",
"tableName"... | Returns Columns in table
@return array | [
"Returns",
"Columns",
"in",
"table"
] | 68305dac50b1b956f08f41267d0b2912850d8232 | https://github.com/leedave/resource-mysql/blob/68305dac50b1b956f08f41267d0b2912850d8232/src/Mysql.php#L137-L147 |
9,996 | leedave/resource-mysql | src/Mysql.php | Mysql.save | public function save() : bool
{
if (!$this->isTableNameSet()) {
return false;
}
$pkName = $this->primaryKey;
if ((int) $this->$pkName > 0) {
$this->updateEntry();
} else {
$this->createEntry();
}
return true;
} | php | public function save() : bool
{
if (!$this->isTableNameSet()) {
return false;
}
$pkName = $this->primaryKey;
if ((int) $this->$pkName > 0) {
$this->updateEntry();
} else {
$this->createEntry();
}
return true;
} | [
"public",
"function",
"save",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isTableNameSet",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"pkName",
"=",
"$",
"this",
"->",
"primaryKey",
";",
"if",
"(",
"(",
"int",
")",
... | Save if new, update if primary key isset
@return bool | [
"Save",
"if",
"new",
"update",
"if",
"primary",
"key",
"isset"
] | 68305dac50b1b956f08f41267d0b2912850d8232 | https://github.com/leedave/resource-mysql/blob/68305dac50b1b956f08f41267d0b2912850d8232/src/Mysql.php#L153-L165 |
9,997 | leedave/resource-mysql | src/Mysql.php | Mysql.delete | public function delete() : int
{
$sql = "DELETE FROM `".$this->tableName."` "
. "WHERE `".$this->primaryKey."` = '".$this->id."';";
return $this->db->exec($sql);
} | php | public function delete() : int
{
$sql = "DELETE FROM `".$this->tableName."` "
. "WHERE `".$this->primaryKey."` = '".$this->id."';";
return $this->db->exec($sql);
} | [
"public",
"function",
"delete",
"(",
")",
":",
"int",
"{",
"$",
"sql",
"=",
"\"DELETE FROM `\"",
".",
"$",
"this",
"->",
"tableName",
".",
"\"` \"",
".",
"\"WHERE `\"",
".",
"$",
"this",
"->",
"primaryKey",
".",
"\"` = '\"",
".",
"$",
"this",
"->",
"id... | Delete Row from DB Table
@return int | [
"Delete",
"Row",
"from",
"DB",
"Table"
] | 68305dac50b1b956f08f41267d0b2912850d8232 | https://github.com/leedave/resource-mysql/blob/68305dac50b1b956f08f41267d0b2912850d8232/src/Mysql.php#L171-L176 |
9,998 | leedave/resource-mysql | src/Mysql.php | Mysql.createEntry | protected function createEntry()
{
$arrColumns = $this->getTableColumns();
$arrColumnNames = [];
$arrColumnTypes = [];
foreach ($arrColumns as $column) {
$arrColumnNames[] = $column['Field'];
$arrColumnTypes[] = $column['Type'];
}
... | php | protected function createEntry()
{
$arrColumns = $this->getTableColumns();
$arrColumnNames = [];
$arrColumnTypes = [];
foreach ($arrColumns as $column) {
$arrColumnNames[] = $column['Field'];
$arrColumnTypes[] = $column['Type'];
}
... | [
"protected",
"function",
"createEntry",
"(",
")",
"{",
"$",
"arrColumns",
"=",
"$",
"this",
"->",
"getTableColumns",
"(",
")",
";",
"$",
"arrColumnNames",
"=",
"[",
"]",
";",
"$",
"arrColumnTypes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"arrColumns",
... | Inset a new Row into DB Table | [
"Inset",
"a",
"new",
"Row",
"into",
"DB",
"Table"
] | 68305dac50b1b956f08f41267d0b2912850d8232 | https://github.com/leedave/resource-mysql/blob/68305dac50b1b956f08f41267d0b2912850d8232/src/Mysql.php#L181-L225 |
9,999 | leedave/resource-mysql | src/Mysql.php | Mysql.getAllRows | public function getAllRows(
array $arrWhat = ['*'],
array $arrWhere = [],
array $arrOrder = ['`id` ASC'],
array $arrLimit = []
) : array
{
if (count($arrWhat) < 1) {
throw new Exception('Missing MySQL Select Params');
}
$strWhere = "";
... | php | public function getAllRows(
array $arrWhat = ['*'],
array $arrWhere = [],
array $arrOrder = ['`id` ASC'],
array $arrLimit = []
) : array
{
if (count($arrWhat) < 1) {
throw new Exception('Missing MySQL Select Params');
}
$strWhere = "";
... | [
"public",
"function",
"getAllRows",
"(",
"array",
"$",
"arrWhat",
"=",
"[",
"'*'",
"]",
",",
"array",
"$",
"arrWhere",
"=",
"[",
"]",
",",
"array",
"$",
"arrOrder",
"=",
"[",
"'`id` ASC'",
"]",
",",
"array",
"$",
"arrLimit",
"=",
"[",
"]",
")",
":"... | Simple SELECT Query, no transactions, fetch multiple entries
@param array $arrWhat
@param array $arrWhere array of strings Example: "`name` LIKE 'Dave'"
@param array $arrOrder
@param array $arrLimit
@return array
@throws Exception | [
"Simple",
"SELECT",
"Query",
"no",
"transactions",
"fetch",
"multiple",
"entries"
] | 68305dac50b1b956f08f41267d0b2912850d8232 | https://github.com/leedave/resource-mysql/blob/68305dac50b1b956f08f41267d0b2912850d8232/src/Mysql.php#L345-L385 |
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.