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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
14,400 | cornernote/yii-return-url | return-url/components/EReturnUrl.php | EReturnUrl.getFormValue | public function getFormValue($currentPage = false, $encode = false)
{
if ($currentPage)
$url = $encode ? $this->urlEncode(Yii::app()->getRequest()->getUrl()) : Yii::app()->getRequest()->getUrl();
else
$url = $this->getUrlFromSubmitFields();
return $url;
} | php | public function getFormValue($currentPage = false, $encode = false)
{
if ($currentPage)
$url = $encode ? $this->urlEncode(Yii::app()->getRequest()->getUrl()) : Yii::app()->getRequest()->getUrl();
else
$url = $this->getUrlFromSubmitFields();
return $url;
} | [
"public",
"function",
"getFormValue",
"(",
"$",
"currentPage",
"=",
"false",
",",
"$",
"encode",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"currentPage",
")",
"$",
"url",
"=",
"$",
"encode",
"?",
"$",
"this",
"->",
"urlEncode",
"(",
"Yii",
"::",
"app",... | Get url from submitted data or the current page url
for usage in a hidden form element
@usage
in views/your_page.php
<pre>
CHtml::hiddenField('returnUrl', Yii::app()->returnUrl->getFormValue());
</pre>
@param bool $currentPage
@param bool $encode
@return null|string | [
"Get",
"url",
"from",
"submitted",
"data",
"or",
"the",
"current",
"page",
"url",
"for",
"usage",
"in",
"a",
"hidden",
"form",
"element"
] | 9dc2dac5a3957ab193a1e8c80224c9f77479d3f0 | https://github.com/cornernote/yii-return-url/blob/9dc2dac5a3957ab193a1e8c80224c9f77479d3f0/return-url/components/EReturnUrl.php#L36-L43 |
14,401 | cornernote/yii-return-url | return-url/components/EReturnUrl.php | EReturnUrl.getLinkValue | public function getLinkValue($currentPage = false)
{
return $this->encodeLinkValue($currentPage ? Yii::app()->request->getUrl() : $this->getUrlFromSubmitFields());
} | php | public function getLinkValue($currentPage = false)
{
return $this->encodeLinkValue($currentPage ? Yii::app()->request->getUrl() : $this->getUrlFromSubmitFields());
} | [
"public",
"function",
"getLinkValue",
"(",
"$",
"currentPage",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"encodeLinkValue",
"(",
"$",
"currentPage",
"?",
"Yii",
"::",
"app",
"(",
")",
"->",
"request",
"->",
"getUrl",
"(",
")",
":",
"$",
"thi... | Get url from submitted data or the current page url
for usage in a link
@usage
in views/your_page.php
<pre>
CHtml::link('my link', array('test/form', 'returnUrl' => Yii::app()->returnUrl->getLinkValue(true)));
</pre>
@param bool $currentPage
@return string | [
"Get",
"url",
"from",
"submitted",
"data",
"or",
"the",
"current",
"page",
"url",
"for",
"usage",
"in",
"a",
"link"
] | 9dc2dac5a3957ab193a1e8c80224c9f77479d3f0 | https://github.com/cornernote/yii-return-url/blob/9dc2dac5a3957ab193a1e8c80224c9f77479d3f0/return-url/components/EReturnUrl.php#L58-L61 |
14,402 | cornernote/yii-return-url | return-url/components/EReturnUrl.php | EReturnUrl.getUrl | public function getUrl($altUrl = false)
{
$url = $this->getUrlFromSubmitFields();
// alt url or current page
if (!$url && $altUrl)
$url = $altUrl;
return $url ? $url : Yii::app()->homeUrl;
} | php | public function getUrl($altUrl = false)
{
$url = $this->getUrlFromSubmitFields();
// alt url or current page
if (!$url && $altUrl)
$url = $altUrl;
return $url ? $url : Yii::app()->homeUrl;
} | [
"public",
"function",
"getUrl",
"(",
"$",
"altUrl",
"=",
"false",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"getUrlFromSubmitFields",
"(",
")",
";",
"// alt url or current page",
"if",
"(",
"!",
"$",
"url",
"&&",
"$",
"altUrl",
")",
"$",
"url",
"="... | Get url from submitted data or session
@usage
in YourController::actionYourAction()
<pre>
$this->redirect(Yii::app()->returnUrl->getUrl());
</pre>
@param bool|mixed $altUrl
@return mixed|null | [
"Get",
"url",
"from",
"submitted",
"data",
"or",
"session"
] | 9dc2dac5a3957ab193a1e8c80224c9f77479d3f0 | https://github.com/cornernote/yii-return-url/blob/9dc2dac5a3957ab193a1e8c80224c9f77479d3f0/return-url/components/EReturnUrl.php#L93-L100 |
14,403 | cornernote/yii-return-url | return-url/components/EReturnUrl.php | EReturnUrl.getUrlFromSubmitFields | private function getUrlFromSubmitFields()
{
$requestKey = $this->requestKey;
$url = isset($_GET[$requestKey]) && is_scalar($_GET[$requestKey]) ? $_GET[$requestKey] : (isset($_POST[$requestKey]) && is_scalar($_POST[$requestKey]) ? $_POST[$requestKey] : false);
$url = str_replace(chr(0), '', $... | php | private function getUrlFromSubmitFields()
{
$requestKey = $this->requestKey;
$url = isset($_GET[$requestKey]) && is_scalar($_GET[$requestKey]) ? $_GET[$requestKey] : (isset($_POST[$requestKey]) && is_scalar($_POST[$requestKey]) ? $_POST[$requestKey] : false);
$url = str_replace(chr(0), '', $... | [
"private",
"function",
"getUrlFromSubmitFields",
"(",
")",
"{",
"$",
"requestKey",
"=",
"$",
"this",
"->",
"requestKey",
";",
"$",
"url",
"=",
"isset",
"(",
"$",
"_GET",
"[",
"$",
"requestKey",
"]",
")",
"&&",
"is_scalar",
"(",
"$",
"_GET",
"[",
"$",
... | Get the url from the request, decodes if needed
@return null|string | [
"Get",
"the",
"url",
"from",
"the",
"request",
"decodes",
"if",
"needed"
] | 9dc2dac5a3957ab193a1e8c80224c9f77479d3f0 | https://github.com/cornernote/yii-return-url/blob/9dc2dac5a3957ab193a1e8c80224c9f77479d3f0/return-url/components/EReturnUrl.php#L107-L114 |
14,404 | acasademont/wurfl | WURFL/UserAgentHandlerChain.php | WURFL_UserAgentHandlerChain.addUserAgentHandler | public function addUserAgentHandler(WURFL_Handlers_Handler $handler)
{
$size = count($this->_userAgentHandlers);
if ($size > 0) {
$this->_userAgentHandlers[$size-1]->setNextHandler($handler);
}
$this->_userAgentHandlers[] = $handler;
return $this;
} | php | public function addUserAgentHandler(WURFL_Handlers_Handler $handler)
{
$size = count($this->_userAgentHandlers);
if ($size > 0) {
$this->_userAgentHandlers[$size-1]->setNextHandler($handler);
}
$this->_userAgentHandlers[] = $handler;
return $this;
} | [
"public",
"function",
"addUserAgentHandler",
"(",
"WURFL_Handlers_Handler",
"$",
"handler",
")",
"{",
"$",
"size",
"=",
"count",
"(",
"$",
"this",
"->",
"_userAgentHandlers",
")",
";",
"if",
"(",
"$",
"size",
">",
"0",
")",
"{",
"$",
"this",
"->",
"_user... | Adds a WURFL_Handlers_Handler to the chain
@param WURFL_Handlers_Handler $handler
@return WURFL_UserAgentHandlerChain $this | [
"Adds",
"a",
"WURFL_Handlers_Handler",
"to",
"the",
"chain"
] | 0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2 | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/UserAgentHandlerChain.php#L37-L45 |
14,405 | axelitus/php-base | src/Arr.php | Arr.set | public function set($key, $value = null)
{
DotArr::set($this->data, $key, $value);
} | php | public function set($key, $value = null)
{
DotArr::set($this->data, $key, $value);
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"DotArr",
"::",
"set",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"key",
",",
"$",
"value",
")",
";",
"}"
] | Sets a value to the dot-notated internal array.
@param int|string|array $key The key of the item to be set or an array of key=>value pairs.
@param mixed $value The value to be set to the item.
@see DotArr::set | [
"Sets",
"a",
"value",
"to",
"the",
"dot",
"-",
"notated",
"internal",
"array",
"."
] | c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075 | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Arr.php#L75-L78 |
14,406 | FrenchFrogs/framework | src/Modal/Renderer/Bootstrap.php | Bootstrap.modal | public function modal(Modal\Modal $modal)
{
$html = '';
// header
if ($modal->hasCloseButton()) {
$html .= html('button', ['type' => 'button', 'class' => 'close', 'data-dismiss' => 'modal', 'aria-label' => $modal->getCloseButtonLabel()], '<span aria-hidden="true">×</span>... | php | public function modal(Modal\Modal $modal)
{
$html = '';
// header
if ($modal->hasCloseButton()) {
$html .= html('button', ['type' => 'button', 'class' => 'close', 'data-dismiss' => 'modal', 'aria-label' => $modal->getCloseButtonLabel()], '<span aria-hidden="true">×</span>... | [
"public",
"function",
"modal",
"(",
"Modal",
"\\",
"Modal",
"$",
"modal",
")",
"{",
"$",
"html",
"=",
"''",
";",
"// header",
"if",
"(",
"$",
"modal",
"->",
"hasCloseButton",
"(",
")",
")",
"{",
"$",
"html",
".=",
"html",
"(",
"'button'",
",",
"[",... | Render a modal
@param \FrenchFrogs\Modal\Modal\Modal $modal
@return string | [
"Render",
"a",
"modal"
] | a4838c698a5600437e87dac6d35ba8ebe32c4395 | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Modal/Renderer/Bootstrap.php#L33-L78 |
14,407 | czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.normalizeRelationsData | protected function normalizeRelationsData()
{
if (is_null($this->data['relationships'])) {
$this->data['relationships'] = [];
}
foreach ([ 'normal', 'reverse', 'image', 'file', 'checkbox', 'category' ] as $key) {
if ( ! array_key_exists($key, $this->data['relatio... | php | protected function normalizeRelationsData()
{
if (is_null($this->data['relationships'])) {
$this->data['relationships'] = [];
}
foreach ([ 'normal', 'reverse', 'image', 'file', 'checkbox', 'category' ] as $key) {
if ( ! array_key_exists($key, $this->data['relatio... | [
"protected",
"function",
"normalizeRelationsData",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"data",
"[",
"'relationships'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'relationships'",
"]",
"=",
"[",
"]",
";",
"}",
"foreac... | Makes sure that expected relations data is traversable
@return $this | [
"Makes",
"sure",
"that",
"expected",
"relations",
"data",
"is",
"traversable"
] | 910297d2a3f2db86dde51b0e10fe5aad45f1aa1a | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L34-L50 |
14,408 | czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.getRelationsConfigReplace | protected function getRelationsConfigReplace()
{
$relationships = $this->collectRelationshipDataForConfig();
if ( ! count($relationships)) return '';
$replace = $this->tab() . "protected \$relationsConfig = [\n";
foreach ($relationships as $name => $relationship) {
$... | php | protected function getRelationsConfigReplace()
{
$relationships = $this->collectRelationshipDataForConfig();
if ( ! count($relationships)) return '';
$replace = $this->tab() . "protected \$relationsConfig = [\n";
foreach ($relationships as $name => $relationship) {
$... | [
"protected",
"function",
"getRelationsConfigReplace",
"(",
")",
"{",
"$",
"relationships",
"=",
"$",
"this",
"->",
"collectRelationshipDataForConfig",
"(",
")",
";",
"if",
"(",
"!",
"count",
"(",
"$",
"relationships",
")",
")",
"return",
"''",
";",
"$",
"rep... | Returns the replacement for the relations config placeholder
@return string | [
"Returns",
"the",
"replacement",
"for",
"the",
"relations",
"config",
"placeholder"
] | 910297d2a3f2db86dde51b0e10fe5aad45f1aa1a | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L82-L127 |
14,409 | czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.getRelationshipsReplace | protected function getRelationshipsReplace()
{
$totalCount = $this->getTotalRelevantRelationshipCount();
if ( ! $totalCount) return '';
$replace = "\n" . $this->getRelationshipsIntro();
$replace .= $this->getReplaceForNormalRelationships()
. $this->getReplaceFor... | php | protected function getRelationshipsReplace()
{
$totalCount = $this->getTotalRelevantRelationshipCount();
if ( ! $totalCount) return '';
$replace = "\n" . $this->getRelationshipsIntro();
$replace .= $this->getReplaceForNormalRelationships()
. $this->getReplaceFor... | [
"protected",
"function",
"getRelationshipsReplace",
"(",
")",
"{",
"$",
"totalCount",
"=",
"$",
"this",
"->",
"getTotalRelevantRelationshipCount",
"(",
")",
";",
"if",
"(",
"!",
"$",
"totalCount",
")",
"return",
"''",
";",
"$",
"replace",
"=",
"\"\\n\"",
"."... | Returns the replacement for the relationships placeholder
@return string | [
"Returns",
"the",
"replacement",
"for",
"the",
"relationships",
"placeholder"
] | 910297d2a3f2db86dde51b0e10fe5aad45f1aa1a | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L183-L196 |
14,410 | czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.getTotalRelevantRelationshipCount | protected function getTotalRelevantRelationshipCount()
{
return count($this->getCombinedRelationships())
+ count( $this->data['relationships']['image'] )
+ count( $this->data['relationships']['file'] )
+ count( $this->data['relationships']['checkbox'] )
+ ... | php | protected function getTotalRelevantRelationshipCount()
{
return count($this->getCombinedRelationships())
+ count( $this->data['relationships']['image'] )
+ count( $this->data['relationships']['file'] )
+ count( $this->data['relationships']['checkbox'] )
+ ... | [
"protected",
"function",
"getTotalRelevantRelationshipCount",
"(",
")",
"{",
"return",
"count",
"(",
"$",
"this",
"->",
"getCombinedRelationships",
"(",
")",
")",
"+",
"count",
"(",
"$",
"this",
"->",
"data",
"[",
"'relationships'",
"]",
"[",
"'image'",
"]",
... | Returns the number of relationships to be considered
for building up the stub replacement.
@return mixed | [
"Returns",
"the",
"number",
"of",
"relationships",
"to",
"be",
"considered",
"for",
"building",
"up",
"the",
"stub",
"replacement",
"."
] | 910297d2a3f2db86dde51b0e10fe5aad45f1aa1a | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L215-L222 |
14,411 | czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.determineCategoryRelationName | protected function determineCategoryRelationName()
{
// pick a name and see if it conflicts with anything
$tryNames = config('pxlcms.generator.standard_models.category_relation_names', []);
$this->categoryRelationName = null;
foreach ($tryNames as $tryName) {
$tryName ... | php | protected function determineCategoryRelationName()
{
// pick a name and see if it conflicts with anything
$tryNames = config('pxlcms.generator.standard_models.category_relation_names', []);
$this->categoryRelationName = null;
foreach ($tryNames as $tryName) {
$tryName ... | [
"protected",
"function",
"determineCategoryRelationName",
"(",
")",
"{",
"// pick a name and see if it conflicts with anything",
"$",
"tryNames",
"=",
"config",
"(",
"'pxlcms.generator.standard_models.category_relation_names'",
",",
"[",
"]",
")",
";",
"$",
"this",
"->",
"c... | Attempts to determine a non-conflicting name for the relationship to the Category model
@return string|false | [
"Attempts",
"to",
"determine",
"a",
"non",
"-",
"conflicting",
"name",
"for",
"the",
"relationship",
"to",
"the",
"Category",
"model"
] | 910297d2a3f2db86dde51b0e10fe5aad45f1aa1a | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L351-L378 |
14,412 | czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.doesRelationNameConflict | protected function doesRelationNameConflict($name)
{
// relationships
$relationships = array_merge(
$this->data['relationships']['normal'],
$this->data['relationships']['reverse'],
$this->data['relationships']['image'],
$this->data['relationships']['fi... | php | protected function doesRelationNameConflict($name)
{
// relationships
$relationships = array_merge(
$this->data['relationships']['normal'],
$this->data['relationships']['reverse'],
$this->data['relationships']['image'],
$this->data['relationships']['fi... | [
"protected",
"function",
"doesRelationNameConflict",
"(",
"$",
"name",
")",
"{",
"// relationships",
"$",
"relationships",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"data",
"[",
"'relationships'",
"]",
"[",
"'normal'",
"]",
",",
"$",
"this",
"->",
"data",
... | Returns whether a given name is already in use by anything that it would conflict with
for this model
@param string $name
@return bool | [
"Returns",
"whether",
"a",
"given",
"name",
"is",
"already",
"in",
"use",
"by",
"anything",
"that",
"it",
"would",
"conflict",
"with",
"for",
"this",
"model"
] | 910297d2a3f2db86dde51b0e10fe5aad45f1aa1a | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L387-L409 |
14,413 | czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.getRelationMethodSection | protected function getRelationMethodSection(array $relationships, $type = CmsModel::RELATION_TYPE_MODEL)
{
$replace = '';
$relatedClassName = $this->context->getModelNamespaceForSpecialModel($type);
foreach ($relationships as $name => $relationship) {
$relationParameters ... | php | protected function getRelationMethodSection(array $relationships, $type = CmsModel::RELATION_TYPE_MODEL)
{
$replace = '';
$relatedClassName = $this->context->getModelNamespaceForSpecialModel($type);
foreach ($relationships as $name => $relationship) {
$relationParameters ... | [
"protected",
"function",
"getRelationMethodSection",
"(",
"array",
"$",
"relationships",
",",
"$",
"type",
"=",
"CmsModel",
"::",
"RELATION_TYPE_MODEL",
")",
"{",
"$",
"replace",
"=",
"''",
";",
"$",
"relatedClassName",
"=",
"$",
"this",
"->",
"context",
"->",... | Returns stub section for relation method
@param array $relationships
@param int|null $type CmsModel::RELATION_TYPE_...
@return string | [
"Returns",
"stub",
"section",
"for",
"relation",
"method"
] | 910297d2a3f2db86dde51b0e10fe5aad45f1aa1a | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L418-L467 |
14,414 | Teamsisu/contao-mm-frontendInput | src/Teamsisu/MetaModelsFrontendInput/DataContainer/Field/MMAttributeField.php | MMAttributeField.setDefaultValue | public function setDefaultValue($value)
{
$value = $this->mmAttribute->valueToWidget($value);
$this->set('value', $value);
} | php | public function setDefaultValue($value)
{
$value = $this->mmAttribute->valueToWidget($value);
$this->set('value', $value);
} | [
"public",
"function",
"setDefaultValue",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"mmAttribute",
"->",
"valueToWidget",
"(",
"$",
"value",
")",
";",
"$",
"this",
"->",
"set",
"(",
"'value'",
",",
"$",
"value",
")",
";",
"}"
... | Set the default value of the Attribute
@param mixed $value | [
"Set",
"the",
"default",
"value",
"of",
"the",
"Attribute"
] | ab92e61c24644f1e61265304b6a35e505007d021 | https://github.com/Teamsisu/contao-mm-frontendInput/blob/ab92e61c24644f1e61265304b6a35e505007d021/src/Teamsisu/MetaModelsFrontendInput/DataContainer/Field/MMAttributeField.php#L153-L159 |
14,415 | phramework/validate | src/ObjectValidator.php | ObjectValidator.addProperties | public function addProperties($properties)
{
if (empty($properties) || !count((array)$properties)) {
throw new \Exception('Empty properties given');
}
if (!is_array($properties) && !is_object($properties)) {
throw new \Exception('Expected array or object');
}... | php | public function addProperties($properties)
{
if (empty($properties) || !count((array)$properties)) {
throw new \Exception('Empty properties given');
}
if (!is_array($properties) && !is_object($properties)) {
throw new \Exception('Expected array or object');
}... | [
"public",
"function",
"addProperties",
"(",
"$",
"properties",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"properties",
")",
"||",
"!",
"count",
"(",
"(",
"array",
")",
"$",
"properties",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Empty prop... | Add properties to this object validator
@param array||object $properties [description]
@throws \Exception If properties is not an array | [
"Add",
"properties",
"to",
"this",
"object",
"validator"
] | 22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/ObjectValidator.php#L495-L510 |
14,416 | phramework/validate | src/ObjectValidator.php | ObjectValidator.addProperty | public function addProperty($key, BaseValidator $property)
{
if (property_exists($this->properties, $key)) {
throw new \Exception('Property key exists');
}
//Add this key, value to
$this->properties->{$key} = $property;
return $this;
} | php | public function addProperty($key, BaseValidator $property)
{
if (property_exists($this->properties, $key)) {
throw new \Exception('Property key exists');
}
//Add this key, value to
$this->properties->{$key} = $property;
return $this;
} | [
"public",
"function",
"addProperty",
"(",
"$",
"key",
",",
"BaseValidator",
"$",
"property",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
"->",
"properties",
",",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Property ... | Add a property to this object validator
@param BaseValidator $property
@throws \Exception If property key exists | [
"Add",
"a",
"property",
"to",
"this",
"object",
"validator"
] | 22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/ObjectValidator.php#L517-L527 |
14,417 | stubbles/stubbles-webapp-core | src/main/php/routing/CalledUri.php | CalledUri.castFrom | public static function castFrom($requestUri, string $requestMethod = null)
{
if ($requestUri instanceof self) {
return $requestUri;
}
return new self($requestUri, (string) $requestMethod);
} | php | public static function castFrom($requestUri, string $requestMethod = null)
{
if ($requestUri instanceof self) {
return $requestUri;
}
return new self($requestUri, (string) $requestMethod);
} | [
"public",
"static",
"function",
"castFrom",
"(",
"$",
"requestUri",
",",
"string",
"$",
"requestMethod",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"requestUri",
"instanceof",
"self",
")",
"{",
"return",
"$",
"requestUri",
";",
"}",
"return",
"new",
"self",
... | casts given values to an instance of UriRequest
@param string|\stubbles\webapp\routing\CalledUri $requestUri
@param string $requestMethod
@return \stubbles\webapp\routing\CalledUri
@since 4.0.0 | [
"casts",
"given",
"values",
"to",
"an",
"instance",
"of",
"UriRequest"
] | 7705f129011a81d5cc3c76b4b150fab3dadac6a3 | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/CalledUri.php#L59-L66 |
14,418 | stubbles/stubbles-webapp-core | src/main/php/routing/CalledUri.php | CalledUri.methodEquals | public function methodEquals(string $method = null): bool
{
if (empty($method)) {
return true;
}
return $this->method === $method;
} | php | public function methodEquals(string $method = null): bool
{
if (empty($method)) {
return true;
}
return $this->method === $method;
} | [
"public",
"function",
"methodEquals",
"(",
"string",
"$",
"method",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"empty",
"(",
"$",
"method",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"$",
"this",
"->",
"method",
"===",
"$",
"method",
... | checks if request method equals given method
@param string $method
@return bool | [
"checks",
"if",
"request",
"method",
"equals",
"given",
"method"
] | 7705f129011a81d5cc3c76b4b150fab3dadac6a3 | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/CalledUri.php#L85-L92 |
14,419 | stubbles/stubbles-webapp-core | src/main/php/routing/CalledUri.php | CalledUri.satisfiesPath | public function satisfiesPath(string $expectedPath = null): bool
{
if (empty($expectedPath)) {
return true;
}
if (preg_match('/^' . UriPath::pattern($expectedPath) . '/', $this->uri->path()) >= 1) {
return true;
}
return false;
} | php | public function satisfiesPath(string $expectedPath = null): bool
{
if (empty($expectedPath)) {
return true;
}
if (preg_match('/^' . UriPath::pattern($expectedPath) . '/', $this->uri->path()) >= 1) {
return true;
}
return false;
} | [
"public",
"function",
"satisfiesPath",
"(",
"string",
"$",
"expectedPath",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"empty",
"(",
"$",
"expectedPath",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"preg_match",
"(",
"'/^'",
".",
"UriPath"... | checks if given path is satisfied by request path
@param string $expectedPath
@return bool | [
"checks",
"if",
"given",
"path",
"is",
"satisfied",
"by",
"request",
"path"
] | 7705f129011a81d5cc3c76b4b150fab3dadac6a3 | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/CalledUri.php#L100-L111 |
14,420 | stubbles/stubbles-webapp-core | src/main/php/routing/CalledUri.php | CalledUri.satisfies | public function satisfies(string $method = null, string $expectedPath = null): bool
{
return $this->methodEquals($method) && $this->satisfiesPath($expectedPath);
} | php | public function satisfies(string $method = null, string $expectedPath = null): bool
{
return $this->methodEquals($method) && $this->satisfiesPath($expectedPath);
} | [
"public",
"function",
"satisfies",
"(",
"string",
"$",
"method",
"=",
"null",
",",
"string",
"$",
"expectedPath",
"=",
"null",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"methodEquals",
"(",
"$",
"method",
")",
"&&",
"$",
"this",
"->",
"satisf... | checks if given method and path is satisfied by request
@param string $method
@param string $expectedPath
@return bool
@since 3.4.0 | [
"checks",
"if",
"given",
"method",
"and",
"path",
"is",
"satisfied",
"by",
"request"
] | 7705f129011a81d5cc3c76b4b150fab3dadac6a3 | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/CalledUri.php#L121-L124 |
14,421 | contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/ChildAware.php | ChildAware.eachChild | public function eachChild($callback)
{
foreach ($this->children as $child) {
call_user_func($callback, $child);
}
return $this;
} | php | public function eachChild($callback)
{
foreach ($this->children as $child) {
call_user_func($callback, $child);
}
return $this;
} | [
"public",
"function",
"eachChild",
"(",
"$",
"callback",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"child",
")",
"{",
"call_user_func",
"(",
"$",
"callback",
",",
"$",
"child",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
... | Run a callback for each child.
@param \Callable $callback Callback which accepts the child as argument.
@return $this | [
"Run",
"a",
"callback",
"for",
"each",
"child",
"."
] | f573a24c19ec059aae528a12ba46dfc993844201 | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/ChildAware.php#L66-L73 |
14,422 | contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/ChildAware.php | ChildAware.generateChildren | protected function generateChildren()
{
$buffer = '';
foreach ($this->children as $child) {
$buffer .= $child->generate();
}
return $buffer;
} | php | protected function generateChildren()
{
$buffer = '';
foreach ($this->children as $child) {
$buffer .= $child->generate();
}
return $buffer;
} | [
"protected",
"function",
"generateChildren",
"(",
")",
"{",
"$",
"buffer",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"child",
")",
"{",
"$",
"buffer",
".=",
"$",
"child",
"->",
"generate",
"(",
")",
";",
"}",
"return",... | Generate children.
@return string | [
"Generate",
"children",
"."
] | f573a24c19ec059aae528a12ba46dfc993844201 | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/ChildAware.php#L107-L116 |
14,423 | jasny/router | src/Router/Routes/RouteBinding.php | RouteBinding.bind | protected function bind($vars, ServerRequestInterface $request, array $parts)
{
$type = is_array($vars) && array_keys($vars) === array_keys(array_keys($vars)) ? 'numeric' : 'assoc';
$values = $this->bindParts($vars, $type, $request, $parts);
if ($vars instanceof Route) {
$class... | php | protected function bind($vars, ServerRequestInterface $request, array $parts)
{
$type = is_array($vars) && array_keys($vars) === array_keys(array_keys($vars)) ? 'numeric' : 'assoc';
$values = $this->bindParts($vars, $type, $request, $parts);
if ($vars instanceof Route) {
$class... | [
"protected",
"function",
"bind",
"(",
"$",
"vars",
",",
"ServerRequestInterface",
"$",
"request",
",",
"array",
"$",
"parts",
")",
"{",
"$",
"type",
"=",
"is_array",
"(",
"$",
"vars",
")",
"&&",
"array_keys",
"(",
"$",
"vars",
")",
"===",
"array_keys",
... | Fill out the routes variables based on the url parts.
@param array|\stdClass $vars Route variables
@param ServerRequestInterface $request
@param array $parts URL parts
@return array | [
"Fill",
"out",
"the",
"routes",
"variables",
"based",
"on",
"the",
"url",
"parts",
"."
] | 4c776665ba343150b442c21893946e3d54190896 | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Routes/RouteBinding.php#L21-L35 |
14,424 | jasny/router | src/Router/Routes/RouteBinding.php | RouteBinding.bindParts | protected function bindParts($vars, $type, ServerRequestInterface $request, array $parts)
{
$values = [];
foreach ($vars as $key => $var) {
$part = null;
$bound =
$this->bindPartObject($var, $part) ||
$this->bindPartArray(... | php | protected function bindParts($vars, $type, ServerRequestInterface $request, array $parts)
{
$values = [];
foreach ($vars as $key => $var) {
$part = null;
$bound =
$this->bindPartObject($var, $part) ||
$this->bindPartArray(... | [
"protected",
"function",
"bindParts",
"(",
"$",
"vars",
",",
"$",
"type",
",",
"ServerRequestInterface",
"$",
"request",
",",
"array",
"$",
"parts",
")",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"vars",
"as",
"$",
"key",
"=>",
"$"... | Fill out the values based on the url parts.
@param array|\stdClass $vars Route variables
@param string $type
@param ServerRequestInterface $request
@param array $parts URL parts
@return array | [
"Fill",
"out",
"the",
"values",
"based",
"on",
"the",
"url",
"parts",
"."
] | 4c776665ba343150b442c21893946e3d54190896 | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Routes/RouteBinding.php#L47-L71 |
14,425 | jasny/router | src/Router/Routes/RouteBinding.php | RouteBinding.bindPartArray | protected function bindPartArray($var, ServerRequestInterface $request, array $parts, &$part)
{
if (!is_array($var) && !$var instanceof \stdClass) {
return false;
}
$part = [$this->bind($var, $request, $parts)];
return true;
} | php | protected function bindPartArray($var, ServerRequestInterface $request, array $parts, &$part)
{
if (!is_array($var) && !$var instanceof \stdClass) {
return false;
}
$part = [$this->bind($var, $request, $parts)];
return true;
} | [
"protected",
"function",
"bindPartArray",
"(",
"$",
"var",
",",
"ServerRequestInterface",
"$",
"request",
",",
"array",
"$",
"parts",
",",
"&",
"$",
"part",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"var",
")",
"&&",
"!",
"$",
"var",
"instanceof"... | Bind part if it's an array
@param mixed $var
@param ServerRequestInterface $request
@param array $parts
@param array $part OUTPUT
@return boolean | [
"Bind",
"part",
"if",
"it",
"s",
"an",
"array"
] | 4c776665ba343150b442c21893946e3d54190896 | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Routes/RouteBinding.php#L99-L107 |
14,426 | jasny/router | src/Router/Routes/RouteBinding.php | RouteBinding.bindPartVar | protected function bindPartVar($var, $type, ServerRequestInterface $request, array $parts, &$part)
{
if (!is_string($var) || $var[0] !== '$') {
return false;
}
$options = array_map('trim', explode('|', $var));
$part = $this->bindVar($type, $request, $parts, $opti... | php | protected function bindPartVar($var, $type, ServerRequestInterface $request, array $parts, &$part)
{
if (!is_string($var) || $var[0] !== '$') {
return false;
}
$options = array_map('trim', explode('|', $var));
$part = $this->bindVar($type, $request, $parts, $opti... | [
"protected",
"function",
"bindPartVar",
"(",
"$",
"var",
",",
"$",
"type",
",",
"ServerRequestInterface",
"$",
"request",
",",
"array",
"$",
"parts",
",",
"&",
"$",
"part",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"var",
")",
"||",
"$",
"var"... | Bind part if it's an variable
@param mixed $var
@param string $type
@param ServerRequestInterface $request
@param array $parts
@param array $part OUTPUT
@return boolean | [
"Bind",
"part",
"if",
"it",
"s",
"an",
"variable"
] | 4c776665ba343150b442c21893946e3d54190896 | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Routes/RouteBinding.php#L119-L128 |
14,427 | jasny/router | src/Router/Routes/RouteBinding.php | RouteBinding.bindPartConcat | protected function bindPartConcat($var, ServerRequestInterface $request, array $parts, &$part)
{
if (!is_string($var) || $var[0] !== '~' || substr($var, -1) !== '~') {
return false;
}
$pieces = array_map('trim', explode('~', substr($var, 1, -1)));
$bound = array_... | php | protected function bindPartConcat($var, ServerRequestInterface $request, array $parts, &$part)
{
if (!is_string($var) || $var[0] !== '~' || substr($var, -1) !== '~') {
return false;
}
$pieces = array_map('trim', explode('~', substr($var, 1, -1)));
$bound = array_... | [
"protected",
"function",
"bindPartConcat",
"(",
"$",
"var",
",",
"ServerRequestInterface",
"$",
"request",
",",
"array",
"$",
"parts",
",",
"&",
"$",
"part",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"var",
")",
"||",
"$",
"var",
"[",
"0",
"]"... | Bind part if it's an concatenation
@param mixed $var
@param ServerRequestInterface $request
@param array $parts
@param array $part OUTPUT
@return boolean | [
"Bind",
"part",
"if",
"it",
"s",
"an",
"concatenation"
] | 4c776665ba343150b442c21893946e3d54190896 | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Routes/RouteBinding.php#L139-L150 |
14,428 | jasny/router | src/Router/Routes/RouteBinding.php | RouteBinding.bindVarSuperGlobal | protected function bindVarSuperGlobal($option, ServerRequestInterface $request, &$value)
{
if (preg_match('/^\$_(GET|POST|COOKIE)\[([^\[]*)\]$/i', $option, $matches)) {
list(, $var, $key) = $matches;
$var = strtolower($var);
$data = null;
if ($var === 'get')... | php | protected function bindVarSuperGlobal($option, ServerRequestInterface $request, &$value)
{
if (preg_match('/^\$_(GET|POST|COOKIE)\[([^\[]*)\]$/i', $option, $matches)) {
list(, $var, $key) = $matches;
$var = strtolower($var);
$data = null;
if ($var === 'get')... | [
"protected",
"function",
"bindVarSuperGlobal",
"(",
"$",
"option",
",",
"ServerRequestInterface",
"$",
"request",
",",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^\\$_(GET|POST|COOKIE)\\[([^\\[]*)\\]$/i'",
",",
"$",
"option",
",",
"$",
"matches"... | Bind variable when option is a super global
@param string $option
@param mixed $value OUTPUT
@return boolean | [
"Bind",
"variable",
"when",
"option",
"is",
"a",
"super",
"global"
] | 4c776665ba343150b442c21893946e3d54190896 | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Routes/RouteBinding.php#L222-L243 |
14,429 | jasny/router | src/Router/Routes/RouteBinding.php | RouteBinding.bindVarRequestHeader | protected function bindVarRequestHeader($option, ServerRequestInterface $request, &$value)
{
if (preg_match('/^\$(?:HTTP_)?([A-Z_]+)$/', $option, $matches)) {
$sentence = preg_replace('/[\W_]+/', ' ', $matches[1]);
$name = str_replace(' ', '-', ucwords($sentence));
... | php | protected function bindVarRequestHeader($option, ServerRequestInterface $request, &$value)
{
if (preg_match('/^\$(?:HTTP_)?([A-Z_]+)$/', $option, $matches)) {
$sentence = preg_replace('/[\W_]+/', ' ', $matches[1]);
$name = str_replace(' ', '-', ucwords($sentence));
... | [
"protected",
"function",
"bindVarRequestHeader",
"(",
"$",
"option",
",",
"ServerRequestInterface",
"$",
"request",
",",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^\\$(?:HTTP_)?([A-Z_]+)$/'",
",",
"$",
"option",
",",
"$",
"matches",
")",
")... | Bind variable when option is a request header
@param string $option
@param ServerRequestInterface $request
@param mixed $value OUTPUT
@return boolean | [
"Bind",
"variable",
"when",
"option",
"is",
"a",
"request",
"header"
] | 4c776665ba343150b442c21893946e3d54190896 | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Routes/RouteBinding.php#L253-L264 |
14,430 | jasny/router | src/Router/Routes/RouteBinding.php | RouteBinding.bindVarMultipleUrlParts | protected function bindVarMultipleUrlParts($option, $type, array $parts, &$value)
{
if (substr($option, -3) === '...' && ctype_digit(substr($option, 1, -3))) {
$i = (int)substr($option, 1, -3);
if ($type === 'assoc') {
throw new \InvalidArgumentException("Binding mul... | php | protected function bindVarMultipleUrlParts($option, $type, array $parts, &$value)
{
if (substr($option, -3) === '...' && ctype_digit(substr($option, 1, -3))) {
$i = (int)substr($option, 1, -3);
if ($type === 'assoc') {
throw new \InvalidArgumentException("Binding mul... | [
"protected",
"function",
"bindVarMultipleUrlParts",
"(",
"$",
"option",
",",
"$",
"type",
",",
"array",
"$",
"parts",
",",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"option",
",",
"-",
"3",
")",
"===",
"'...'",
"&&",
"ctype_digit",
... | Bind variable when option contains multiple URL parts
@param string $option
@param string $type 'assoc' or 'numeric'
@param array $parts Url parts
@param mixed $value OUTPUT
@return boolean | [
"Bind",
"variable",
"when",
"option",
"contains",
"multiple",
"URL",
"parts"
] | 4c776665ba343150b442c21893946e3d54190896 | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Routes/RouteBinding.php#L275-L290 |
14,431 | jasny/router | src/Router/Routes/RouteBinding.php | RouteBinding.bindVarSingleUrlPart | protected function bindVarSingleUrlPart($option, array $parts, &$value)
{
if (ctype_digit(substr($option, 1))) {
$i = (int)substr($option, 1);
$part = array_slice($parts, $i - 1, 1);
if (!empty($part)) {
$value = $part;
return true;
... | php | protected function bindVarSingleUrlPart($option, array $parts, &$value)
{
if (ctype_digit(substr($option, 1))) {
$i = (int)substr($option, 1);
$part = array_slice($parts, $i - 1, 1);
if (!empty($part)) {
$value = $part;
return true;
... | [
"protected",
"function",
"bindVarSingleUrlPart",
"(",
"$",
"option",
",",
"array",
"$",
"parts",
",",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"ctype_digit",
"(",
"substr",
"(",
"$",
"option",
",",
"1",
")",
")",
")",
"{",
"$",
"i",
"=",
"(",
"int",... | Bind variable when option contains a single URL part
@param string $option
@param array $parts Url parts
@param mixed $value OUTPUT
@return boolean | [
"Bind",
"variable",
"when",
"option",
"contains",
"a",
"single",
"URL",
"part"
] | 4c776665ba343150b442c21893946e3d54190896 | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Routes/RouteBinding.php#L300-L313 |
14,432 | crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtSupports/SupportsRule.php | SupportsRule.addCondition | public function addCondition(ConditionAbstract $condition)
{
if ($condition instanceof SupportsCondition) {
$this->conditions[] = $condition;
} else {
throw new \InvalidArgumentException(
"Invalid condition instance. Instance of 'SupportsCondition' expected."
... | php | public function addCondition(ConditionAbstract $condition)
{
if ($condition instanceof SupportsCondition) {
$this->conditions[] = $condition;
} else {
throw new \InvalidArgumentException(
"Invalid condition instance. Instance of 'SupportsCondition' expected."
... | [
"public",
"function",
"addCondition",
"(",
"ConditionAbstract",
"$",
"condition",
")",
"{",
"if",
"(",
"$",
"condition",
"instanceof",
"SupportsCondition",
")",
"{",
"$",
"this",
"->",
"conditions",
"[",
"]",
"=",
"$",
"condition",
";",
"}",
"else",
"{",
"... | Adds a supports condition.
@param SupportsCondition $condition
@return $this | [
"Adds",
"a",
"supports",
"condition",
"."
] | 7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3 | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtSupports/SupportsRule.php#L38-L49 |
14,433 | crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtSupports/SupportsRule.php | SupportsRule.parseRuleString | protected function parseRuleString($ruleString)
{
// Remove at-rule name and unnecessary white-spaces
$ruleString = preg_replace('/^[ \r\n\t\f]*@supports[ \r\n\t\f]*/i', '', $ruleString);
$ruleString = trim($ruleString, " \r\n\t\f");
$charset = $this->getCharset();
$conditi... | php | protected function parseRuleString($ruleString)
{
// Remove at-rule name and unnecessary white-spaces
$ruleString = preg_replace('/^[ \r\n\t\f]*@supports[ \r\n\t\f]*/i', '', $ruleString);
$ruleString = trim($ruleString, " \r\n\t\f");
$charset = $this->getCharset();
$conditi... | [
"protected",
"function",
"parseRuleString",
"(",
"$",
"ruleString",
")",
"{",
"// Remove at-rule name and unnecessary white-spaces",
"$",
"ruleString",
"=",
"preg_replace",
"(",
"'/^[ \\r\\n\\t\\f]*@supports[ \\r\\n\\t\\f]*/i'",
",",
"''",
",",
"$",
"ruleString",
")",
";",
... | Parses the supports rule.
@param $ruleString | [
"Parses",
"the",
"supports",
"rule",
"."
] | 7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3 | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtSupports/SupportsRule.php#L56-L110 |
14,434 | phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/User.php | User.getUserRoles | public function getUserRoles(Criteria $criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collUserRolesPartial && !$this->isNew();
if (null === $this->collUserRoles || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collUserRoles) {
... | php | public function getUserRoles(Criteria $criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collUserRolesPartial && !$this->isNew();
if (null === $this->collUserRoles || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collUserRoles) {
... | [
"public",
"function",
"getUserRoles",
"(",
"Criteria",
"$",
"criteria",
"=",
"null",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"partial",
"=",
"$",
"this",
"->",
"collUserRolesPartial",
"&&",
"!",
"$",
"this",
"->",
"isNew",
"(",
... | Gets an array of ChildUserRole objects which contain a foreign key that references this object.
If the $criteria is not null, it is used to always fetch the results from the database.
Otherwise the results are fetched from the database the first time, then cached.
Next time the same method is called without $criteria,... | [
"Gets",
"an",
"array",
"of",
"ChildUserRole",
"objects",
"which",
"contain",
"a",
"foreign",
"key",
"that",
"references",
"this",
"object",
"."
] | 3424a360c9bded71eb5b570bc114a7759cb23ec6 | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/User.php#L1528-L1570 |
14,435 | phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/User.php | User.addUserRole | public function addUserRole(ChildUserRole $l)
{
if ($this->collUserRoles === null) {
$this->initUserRoles();
$this->collUserRolesPartial = true;
}
if (!$this->collUserRoles->contains($l)) {
$this->doAddUserRole($l);
}
return $this;
} | php | public function addUserRole(ChildUserRole $l)
{
if ($this->collUserRoles === null) {
$this->initUserRoles();
$this->collUserRolesPartial = true;
}
if (!$this->collUserRoles->contains($l)) {
$this->doAddUserRole($l);
}
return $this;
} | [
"public",
"function",
"addUserRole",
"(",
"ChildUserRole",
"$",
"l",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"collUserRoles",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"initUserRoles",
"(",
")",
";",
"$",
"this",
"->",
"collUserRolesPartial",
"=",
"tru... | Method called to associate a ChildUserRole object to this object
through the ChildUserRole foreign key attribute.
@param ChildUserRole $l ChildUserRole
@return $this|\Alchemy\Component\Cerberus\Model\User The current object (for fluent API support) | [
"Method",
"called",
"to",
"associate",
"a",
"ChildUserRole",
"object",
"to",
"this",
"object",
"through",
"the",
"ChildUserRole",
"foreign",
"key",
"attribute",
"."
] | 3424a360c9bded71eb5b570bc114a7759cb23ec6 | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/User.php#L1649-L1661 |
14,436 | phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/User.php | User.getUserRolesJoinRole | public function getUserRolesJoinRole(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildUserRoleQuery::create(null, $criteria);
$query->joinWith('Role', $joinBehavior);
return $this->getUserRoles($query, $con);
} | php | public function getUserRolesJoinRole(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildUserRoleQuery::create(null, $criteria);
$query->joinWith('Role', $joinBehavior);
return $this->getUserRoles($query, $con);
} | [
"public",
"function",
"getUserRolesJoinRole",
"(",
"Criteria",
"$",
"criteria",
"=",
"null",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
",",
"$",
"joinBehavior",
"=",
"Criteria",
"::",
"LEFT_JOIN",
")",
"{",
"$",
"query",
"=",
"ChildUserRoleQuery",
"... | If this collection has already been initialized with
an identical criteria, it returns the collection.
Otherwise if this User is new, it will return
an empty collection; or if this User has previously
been saved, it will retrieve related UserRoles from storage.
This method is protected by default in order to keep the ... | [
"If",
"this",
"collection",
"has",
"already",
"been",
"initialized",
"with",
"an",
"identical",
"criteria",
"it",
"returns",
"the",
"collection",
".",
"Otherwise",
"if",
"this",
"User",
"is",
"new",
"it",
"will",
"return",
"an",
"empty",
"collection",
";",
"... | 3424a360c9bded71eb5b570bc114a7759cb23ec6 | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/User.php#L1709-L1715 |
14,437 | phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/User.php | User.initRoles | public function initRoles()
{
$this->collRoles = new ObjectCollection();
$this->collRolesPartial = true;
$this->collRoles->setModel('\Alchemy\Component\Cerberus\Model\Role');
} | php | public function initRoles()
{
$this->collRoles = new ObjectCollection();
$this->collRolesPartial = true;
$this->collRoles->setModel('\Alchemy\Component\Cerberus\Model\Role');
} | [
"public",
"function",
"initRoles",
"(",
")",
"{",
"$",
"this",
"->",
"collRoles",
"=",
"new",
"ObjectCollection",
"(",
")",
";",
"$",
"this",
"->",
"collRolesPartial",
"=",
"true",
";",
"$",
"this",
"->",
"collRoles",
"->",
"setModel",
"(",
"'\\Alchemy\\Co... | Initializes the collRoles collection.
By default this just sets the collRoles collection to an empty collection (like clearRoles());
however, you may wish to override this method in your stub class to provide setting appropriate
to your application -- for example, setting the initial array to the values stored in data... | [
"Initializes",
"the",
"collRoles",
"collection",
"."
] | 3424a360c9bded71eb5b570bc114a7759cb23ec6 | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/User.php#L1740-L1746 |
14,438 | phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/User.php | User.addRole | public function addRole(ChildRole $role)
{
if ($this->collRoles === null) {
$this->initRoles();
}
if (!$this->getRoles()->contains($role)) {
// only add it if the **same** object is not already associated
$this->collRoles->push($role);
$this->... | php | public function addRole(ChildRole $role)
{
if ($this->collRoles === null) {
$this->initRoles();
}
if (!$this->getRoles()->contains($role)) {
// only add it if the **same** object is not already associated
$this->collRoles->push($role);
$this->... | [
"public",
"function",
"addRole",
"(",
"ChildRole",
"$",
"role",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"collRoles",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"initRoles",
"(",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"getRoles",
"(",
... | Associate a ChildRole to this object
through the user_role cross reference table.
@param ChildRole $role
@return ChildUser The current object (for fluent API support) | [
"Associate",
"a",
"ChildRole",
"to",
"this",
"object",
"through",
"the",
"user_role",
"cross",
"reference",
"table",
"."
] | 3424a360c9bded71eb5b570bc114a7759cb23ec6 | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/User.php#L1884-L1897 |
14,439 | phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/User.php | User.removeRole | public function removeRole(ChildRole $role)
{
if ($this->getRoles()->contains($role)) { $userRole = new ChildUserRole();
$userRole->setRole($role);
if ($role->isUsersLoaded()) {
//remove the back reference if available
$role->getUsers()->removeObject(... | php | public function removeRole(ChildRole $role)
{
if ($this->getRoles()->contains($role)) { $userRole = new ChildUserRole();
$userRole->setRole($role);
if ($role->isUsersLoaded()) {
//remove the back reference if available
$role->getUsers()->removeObject(... | [
"public",
"function",
"removeRole",
"(",
"ChildRole",
"$",
"role",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getRoles",
"(",
")",
"->",
"contains",
"(",
"$",
"role",
")",
")",
"{",
"$",
"userRole",
"=",
"new",
"ChildUserRole",
"(",
")",
";",
"$",
"u... | Remove role of this object
through the user_role cross reference table.
@param ChildRole $role
@return ChildUser The current object (for fluent API support) | [
"Remove",
"role",
"of",
"this",
"object",
"through",
"the",
"user_role",
"cross",
"reference",
"table",
"."
] | 3424a360c9bded71eb5b570bc114a7759cb23ec6 | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/User.php#L1931-L1957 |
14,440 | darkwebdesign/doctrine-unit-testing | src/Mocks/ConcurrentRegionMock.php | ConcurrentRegionMock.throwException | private function throwException($method)
{
if (isset($this->exceptions[$method]) && ! empty($this->exceptions[$method])) {
$exception = array_shift($this->exceptions[$method]);
if ($exception != null) {
throw $exception;
}
}
} | php | private function throwException($method)
{
if (isset($this->exceptions[$method]) && ! empty($this->exceptions[$method])) {
$exception = array_shift($this->exceptions[$method]);
if ($exception != null) {
throw $exception;
}
}
} | [
"private",
"function",
"throwException",
"(",
"$",
"method",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"exceptions",
"[",
"$",
"method",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"exceptions",
"[",
"$",
"method",
"]",
")",
"... | Dequeue an exception for a specific method invocation
@param string $method
@param mixed $default
@return mixed | [
"Dequeue",
"an",
"exception",
"for",
"a",
"specific",
"method",
"invocation"
] | 0daf50359563bc0679925e573a7105d6cd57168a | https://github.com/darkwebdesign/doctrine-unit-testing/blob/0daf50359563bc0679925e573a7105d6cd57168a/src/Mocks/ConcurrentRegionMock.php#L45-L54 |
14,441 | darkwebdesign/doctrine-unit-testing | src/Mocks/ConcurrentRegionMock.php | ConcurrentRegionMock.setLock | public function setLock(CacheKey $key, Lock $lock)
{
$this->locks[$key->hash] = $lock;
} | php | public function setLock(CacheKey $key, Lock $lock)
{
$this->locks[$key->hash] = $lock;
} | [
"public",
"function",
"setLock",
"(",
"CacheKey",
"$",
"key",
",",
"Lock",
"$",
"lock",
")",
"{",
"$",
"this",
"->",
"locks",
"[",
"$",
"key",
"->",
"hash",
"]",
"=",
"$",
"lock",
";",
"}"
] | Locks a specific cache entry
@param \Doctrine\ORM\Cache\CacheKey $key
@param \Doctrine\ORM\Cache\Lock $lock | [
"Locks",
"a",
"specific",
"cache",
"entry"
] | 0daf50359563bc0679925e573a7105d6cd57168a | https://github.com/darkwebdesign/doctrine-unit-testing/blob/0daf50359563bc0679925e573a7105d6cd57168a/src/Mocks/ConcurrentRegionMock.php#L73-L76 |
14,442 | mythteam/yii2-schedule | src/Event.php | Event.emailOutput | public function emailOutput($address)
{
if (is_null($this->_output)
|| $this->_output == $this->getDefaultOutput()
) {
throw new InvalidCallException('Must direct output to file in order to email results.');
}
$address = is_array($address) ? $address : func_ge... | php | public function emailOutput($address)
{
if (is_null($this->_output)
|| $this->_output == $this->getDefaultOutput()
) {
throw new InvalidCallException('Must direct output to file in order to email results.');
}
$address = is_array($address) ? $address : func_ge... | [
"public",
"function",
"emailOutput",
"(",
"$",
"address",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_output",
")",
"||",
"$",
"this",
"->",
"_output",
"==",
"$",
"this",
"->",
"getDefaultOutput",
"(",
")",
")",
"{",
"throw",
"new",
"In... | Register the send email logic.
@param array $address
@return $this | [
"Register",
"the",
"send",
"email",
"logic",
"."
] | 259db00e4f2a02619545166774081c60957c5faf | https://github.com/mythteam/yii2-schedule/blob/259db00e4f2a02619545166774081c60957c5faf/src/Event.php#L228-L240 |
14,443 | mythteam/yii2-schedule | src/Event.php | Event.buildCommand | public function buildCommand()
{
$command = $this->command . ' >> ' . $this->_output . ' 2>&1 &';
return $this->_user ? 'sudo -u ' . $this->_user . ' ' . $command : $command;
} | php | public function buildCommand()
{
$command = $this->command . ' >> ' . $this->_output . ' 2>&1 &';
return $this->_user ? 'sudo -u ' . $this->_user . ' ' . $command : $command;
} | [
"public",
"function",
"buildCommand",
"(",
")",
"{",
"$",
"command",
"=",
"$",
"this",
"->",
"command",
".",
"' >> '",
".",
"$",
"this",
"->",
"_output",
".",
"' 2>&1 &'",
";",
"return",
"$",
"this",
"->",
"_user",
"?",
"'sudo -u '",
".",
"$",
"this",
... | Build the execute command.
@return string | [
"Build",
"the",
"execute",
"command",
"."
] | 259db00e4f2a02619545166774081c60957c5faf | https://github.com/mythteam/yii2-schedule/blob/259db00e4f2a02619545166774081c60957c5faf/src/Event.php#L620-L625 |
14,444 | mythteam/yii2-schedule | src/Event.php | Event.sendEmail | protected function sendEmail(MailerInterface $mailer, $address)
{
$message = $mailer->compose();
$message->setTextBody(file_get_contents($this->_output))
->setSubject($this->getEmailSubject())
->setTo($address);
$message->send();
} | php | protected function sendEmail(MailerInterface $mailer, $address)
{
$message = $mailer->compose();
$message->setTextBody(file_get_contents($this->_output))
->setSubject($this->getEmailSubject())
->setTo($address);
$message->send();
} | [
"protected",
"function",
"sendEmail",
"(",
"MailerInterface",
"$",
"mailer",
",",
"$",
"address",
")",
"{",
"$",
"message",
"=",
"$",
"mailer",
"->",
"compose",
"(",
")",
";",
"$",
"message",
"->",
"setTextBody",
"(",
"file_get_contents",
"(",
"$",
"this",... | Send email logic.
@param MailerInterface $mailer
@param array $address | [
"Send",
"email",
"logic",
"."
] | 259db00e4f2a02619545166774081c60957c5faf | https://github.com/mythteam/yii2-schedule/blob/259db00e4f2a02619545166774081c60957c5faf/src/Event.php#L633-L641 |
14,445 | activecollab/databasemigrations | src/Migrations.php | Migrations.getMigrationInstances | private function getMigrationInstances(array $migration_class_file_path_map)
{
$result = [];
foreach ($migration_class_file_path_map as $migration_class => $migration_file_path) {
if (is_file($migration_file_path)) {
require_once $migration_file_path;
if... | php | private function getMigrationInstances(array $migration_class_file_path_map)
{
$result = [];
foreach ($migration_class_file_path_map as $migration_class => $migration_file_path) {
if (is_file($migration_file_path)) {
require_once $migration_file_path;
if... | [
"private",
"function",
"getMigrationInstances",
"(",
"array",
"$",
"migration_class_file_path_map",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"migration_class_file_path_map",
"as",
"$",
"migration_class",
"=>",
"$",
"migration_file_path",
")"... | Return an array of MigrationInterface instances indexed by class name.
@param array $migration_class_file_path_map
@return MigrationInterface[] | [
"Return",
"an",
"array",
"of",
"MigrationInterface",
"instances",
"indexed",
"by",
"class",
"name",
"."
] | ef91d5b5f74d79b4a75695393eb25c7c47dad093 | https://github.com/activecollab/databasemigrations/blob/ef91d5b5f74d79b4a75695393eb25c7c47dad093/src/Migrations.php#L123-L146 |
14,446 | activecollab/databasemigrations | src/Migrations.php | Migrations.getTableName | public function getTableName()
{
if ($this->table_exists === null && !in_array($this->table_name, $this->connection->getTableNames())) {
$this->connection->execute('CREATE TABLE ' . $this->connection->escapeTableName($this->table_name) . ' (
`id` int(10) unsigned NOT NULL AUTO_IN... | php | public function getTableName()
{
if ($this->table_exists === null && !in_array($this->table_name, $this->connection->getTableNames())) {
$this->connection->execute('CREATE TABLE ' . $this->connection->escapeTableName($this->table_name) . ' (
`id` int(10) unsigned NOT NULL AUTO_IN... | [
"public",
"function",
"getTableName",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"table_exists",
"===",
"null",
"&&",
"!",
"in_array",
"(",
"$",
"this",
"->",
"table_name",
",",
"$",
"this",
"->",
"connection",
"->",
"getTableNames",
"(",
")",
")",
"... | Return name of the table where we store info about executed migrations.
@return string | [
"Return",
"name",
"of",
"the",
"table",
"where",
"we",
"store",
"info",
"about",
"executed",
"migrations",
"."
] | ef91d5b5f74d79b4a75695393eb25c7c47dad093 | https://github.com/activecollab/databasemigrations/blob/ef91d5b5f74d79b4a75695393eb25c7c47dad093/src/Migrations.php#L208-L224 |
14,447 | bfitech/zapcore | src/Logger.php | Logger.format | protected function format(
string $timestamp, string $levelstr, string $msg
) {
$fmt = "[%s] %s: %s\n";
return sprintf($fmt, $timestamp, $levelstr, $msg);
} | php | protected function format(
string $timestamp, string $levelstr, string $msg
) {
$fmt = "[%s] %s: %s\n";
return sprintf($fmt, $timestamp, $levelstr, $msg);
} | [
"protected",
"function",
"format",
"(",
"string",
"$",
"timestamp",
",",
"string",
"$",
"levelstr",
",",
"string",
"$",
"msg",
")",
"{",
"$",
"fmt",
"=",
"\"[%s] %s: %s\\n\"",
";",
"return",
"sprintf",
"(",
"$",
"fmt",
",",
"$",
"timestamp",
",",
"$",
... | Log line formatter.
Patch this to customize line format or add additional
information.
@param string $timestamp Timestamp, always in UTC ISO-8601.
@param string $levelstr String representation of current log
level, e.g. `DEB` for debug.
@param string $msg Error message.
@return string Formatted line. | [
"Log",
"line",
"formatter",
"."
] | 0ae4cb9370876ab3583556bf272063685ec57948 | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Logger.php#L64-L69 |
14,448 | bfitech/zapcore | src/Logger.php | Logger.one_line | private function one_line(string $msg) {
$msg = trim($msg);
$msg = str_replace([
"\t", "\n", "\r",
], [
'\t', '\n', '\r',
], $msg);
return preg_replace('! +!', ' ', $msg);
} | php | private function one_line(string $msg) {
$msg = trim($msg);
$msg = str_replace([
"\t", "\n", "\r",
], [
'\t', '\n', '\r',
], $msg);
return preg_replace('! +!', ' ', $msg);
} | [
"private",
"function",
"one_line",
"(",
"string",
"$",
"msg",
")",
"{",
"$",
"msg",
"=",
"trim",
"(",
"$",
"msg",
")",
";",
"$",
"msg",
"=",
"str_replace",
"(",
"[",
"\"\\t\"",
",",
"\"\\n\"",
",",
"\"\\r\"",
",",
"]",
",",
"[",
"'\\t'",
",",
"'\... | Write lines as single line, with tab, CR and LF written
symbolically. | [
"Write",
"lines",
"as",
"single",
"line",
"with",
"tab",
"CR",
"and",
"LF",
"written",
"symbolically",
"."
] | 0ae4cb9370876ab3583556bf272063685ec57948 | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Logger.php#L75-L83 |
14,449 | bfitech/zapcore | src/Logger.php | Logger.write | private function write(string $levelstr, string $msg) {
$timestamp = gmdate(\DateTime::ATOM);
// @codeCoverageIgnoreStart
try {
// @codeCoverageIgnoreEnd
$msg = $this->one_line($msg);
$line = $this->format($timestamp, $levelstr, $msg);
fwrite($this->handle, $line);
// @codeCoverageIgnoreStart
} ... | php | private function write(string $levelstr, string $msg) {
$timestamp = gmdate(\DateTime::ATOM);
// @codeCoverageIgnoreStart
try {
// @codeCoverageIgnoreEnd
$msg = $this->one_line($msg);
$line = $this->format($timestamp, $levelstr, $msg);
fwrite($this->handle, $line);
// @codeCoverageIgnoreStart
} ... | [
"private",
"function",
"write",
"(",
"string",
"$",
"levelstr",
",",
"string",
"$",
"msg",
")",
"{",
"$",
"timestamp",
"=",
"gmdate",
"(",
"\\",
"DateTime",
"::",
"ATOM",
")",
";",
"// @codeCoverageIgnoreStart",
"try",
"{",
"// @codeCoverageIgnoreEnd",
"$",
... | Write to handle. | [
"Write",
"to",
"handle",
"."
] | 0ae4cb9370876ab3583556bf272063685ec57948 | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Logger.php#L88-L100 |
14,450 | phizzl/deployee | src/Bootstrap/Bootstrap.php | Bootstrap.bootstrap | public function bootstrap()
{
$this->registerBootstrapArguments();
$this->registerEventDispatcher();
$this->registerConfigLoader();
$this->registerConfig();
$this->registerPlugins();
$this->registerTaskDispatcherCollection();
$this->registerLogger();
... | php | public function bootstrap()
{
$this->registerBootstrapArguments();
$this->registerEventDispatcher();
$this->registerConfigLoader();
$this->registerConfig();
$this->registerPlugins();
$this->registerTaskDispatcherCollection();
$this->registerLogger();
... | [
"public",
"function",
"bootstrap",
"(",
")",
"{",
"$",
"this",
"->",
"registerBootstrapArguments",
"(",
")",
";",
"$",
"this",
"->",
"registerEventDispatcher",
"(",
")",
";",
"$",
"this",
"->",
"registerConfigLoader",
"(",
")",
";",
"$",
"this",
"->",
"reg... | Run bootstrap an register services to the DI container
@return Container | [
"Run",
"bootstrap",
"an",
"register",
"services",
"to",
"the",
"DI",
"container"
] | def884e49608589d9594b8d538f3ec9aa0e25add | https://github.com/phizzl/deployee/blob/def884e49608589d9594b8d538f3ec9aa0e25add/src/Bootstrap/Bootstrap.php#L44-L65 |
14,451 | axelitus/php-base | src/BoolOr.php | BoolOr.val | public static function val($value1, $value2, $_ = null)
{
if (!static::is($value1) || !static::is($value2)) {
throw new \InvalidArgumentException("All parameters must be of type bool.");
}
$ret = ($value1 || $value2);
$args = array_slice(func_get_args(), 2);
whil... | php | public static function val($value1, $value2, $_ = null)
{
if (!static::is($value1) || !static::is($value2)) {
throw new \InvalidArgumentException("All parameters must be of type bool.");
}
$ret = ($value1 || $value2);
$args = array_slice(func_get_args(), 2);
whil... | [
"public",
"static",
"function",
"val",
"(",
"$",
"value1",
",",
"$",
"value2",
",",
"$",
"_",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"is",
"(",
"$",
"value1",
")",
"||",
"!",
"static",
"::",
"is",
"(",
"$",
"value2",
")",
")",
... | Applies the OR operation to the given values.
The function is optimized to return early (if a true is found the function returns true immediately),
therefore we can't assume that all values had been tested for validity.
@param bool $value1 The left operand to apply the operation to.
@param bool $value2 The right oper... | [
"Applies",
"the",
"OR",
"operation",
"to",
"the",
"given",
"values",
"."
] | c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075 | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BoolOr.php#L43-L60 |
14,452 | pencepay/pencepay-php | lib/Pencepay/User.php | Pencepay_User.enable2FA | public static function enable2FA($userUid, $authenticationKey, $verificationCode) {
$request = array(
'authenticationKey' => $authenticationKey,
'verificationCode' => $verificationCode
);
return Pencepay_Util_HttpClient::postArray("/user/$userUid/tfa_enable", $request);
... | php | public static function enable2FA($userUid, $authenticationKey, $verificationCode) {
$request = array(
'authenticationKey' => $authenticationKey,
'verificationCode' => $verificationCode
);
return Pencepay_Util_HttpClient::postArray("/user/$userUid/tfa_enable", $request);
... | [
"public",
"static",
"function",
"enable2FA",
"(",
"$",
"userUid",
",",
"$",
"authenticationKey",
",",
"$",
"verificationCode",
")",
"{",
"$",
"request",
"=",
"array",
"(",
"'authenticationKey'",
"=>",
"$",
"authenticationKey",
",",
"'verificationCode'",
"=>",
"$... | Enables the two-factor authentication for this user.
@param string $userUid
@param string $authenticationKey
@param string $verificationCode
@return array | [
"Enables",
"the",
"two",
"-",
"factor",
"authentication",
"for",
"this",
"user",
"."
] | fad91d56f3a39640ff6cb7e9d137d03a65cdd1cd | https://github.com/pencepay/pencepay-php/blob/fad91d56f3a39640ff6cb7e9d137d03a65cdd1cd/lib/Pencepay/User.php#L96-L102 |
14,453 | huasituo/hstcms | src/Providers/LibrariesServiceProvider.php | LibrariesServiceProvider.register | public function register()
{
$file = $this->app->make(Filesystem::class);
$path = realpath(__DIR__.'/../Libraries');
$libraries = $file->glob($path.'/*.php');
foreach ($libraries as $librarie) {
require_once($librarie);
}
$libraries2 = $file->glob($pa... | php | public function register()
{
$file = $this->app->make(Filesystem::class);
$path = realpath(__DIR__.'/../Libraries');
$libraries = $file->glob($path.'/*.php');
foreach ($libraries as $librarie) {
require_once($librarie);
}
$libraries2 = $file->glob($pa... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"Filesystem",
"::",
"class",
")",
";",
"$",
"path",
"=",
"realpath",
"(",
"__DIR__",
".",
"'/../Libraries'",
")",
";",
"$",
"libraries",
"... | Register the libraries services.
@return void | [
"Register",
"the",
"libraries",
"services",
"."
] | 12819979289e58ce38e3e92540aeeb16e205e525 | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Providers/LibrariesServiceProvider.php#L29-L58 |
14,454 | e0ipso/drupal-unit-autoload | src/Discovery/PathFinderContrib.php | PathFinderContrib.isWantedContrib | protected function isWantedContrib(\SplFileInfo $dir) {
$info_file = $this->cleanDirPath($dir->getPathName()) . DIRECTORY_SEPARATOR . $this->moduleName . '.info';
return file_exists($info_file);
} | php | protected function isWantedContrib(\SplFileInfo $dir) {
$info_file = $this->cleanDirPath($dir->getPathName()) . DIRECTORY_SEPARATOR . $this->moduleName . '.info';
return file_exists($info_file);
} | [
"protected",
"function",
"isWantedContrib",
"(",
"\\",
"SplFileInfo",
"$",
"dir",
")",
"{",
"$",
"info_file",
"=",
"$",
"this",
"->",
"cleanDirPath",
"(",
"$",
"dir",
"->",
"getPathName",
"(",
")",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"this",
"->",
... | Checks if the passed directory is the contrib module we are looking for.
@param \SplFileInfo $dir
The info object about the directory.
@return bool
TRUE if the contrib is detected. FALSE otherwise. | [
"Checks",
"if",
"the",
"passed",
"directory",
"is",
"the",
"contrib",
"module",
"we",
"are",
"looking",
"for",
"."
] | 7ce147b269c7333eca31e2cd04b736d6274b9cbf | https://github.com/e0ipso/drupal-unit-autoload/blob/7ce147b269c7333eca31e2cd04b736d6274b9cbf/src/Discovery/PathFinderContrib.php#L82-L85 |
14,455 | dantleech/glob | lib/DTL/Glob/GlobHelper.php | GlobHelper.isGlobbed | public function isGlobbed($string)
{
$segments = $this->parser->parse($string);
foreach ($segments as $segment) {
// if bitmask contains pattern
if ($segment[1] & SelectorParser::T_PATTERN) {
return true;
}
}
return false;
} | php | public function isGlobbed($string)
{
$segments = $this->parser->parse($string);
foreach ($segments as $segment) {
// if bitmask contains pattern
if ($segment[1] & SelectorParser::T_PATTERN) {
return true;
}
}
return false;
} | [
"public",
"function",
"isGlobbed",
"(",
"$",
"string",
")",
"{",
"$",
"segments",
"=",
"$",
"this",
"->",
"parser",
"->",
"parse",
"(",
"$",
"string",
")",
";",
"foreach",
"(",
"$",
"segments",
"as",
"$",
"segment",
")",
"{",
"// if bitmask contains patt... | Return true if the given string is contains a glob pattern
@param string $string
@return boolean | [
"Return",
"true",
"if",
"the",
"given",
"string",
"is",
"contains",
"a",
"glob",
"pattern"
] | 1f618e6b77a5de4c6b0538d82572fe19cbb1c446 | https://github.com/dantleech/glob/blob/1f618e6b77a5de4c6b0538d82572fe19cbb1c446/lib/DTL/Glob/GlobHelper.php#L31-L42 |
14,456 | mayoturis/properties-ini | src/FileLoader.php | FileLoader.load | public function load($fileName) {
if (!file_exists($fileName)) {
throw new \InvalidArgumentException('File ' . $fileName . ' does not exist');
}
$lines = $this->readLinesFromFile($fileName);
return $this->getArrayFromLines($lines);
} | php | public function load($fileName) {
if (!file_exists($fileName)) {
throw new \InvalidArgumentException('File ' . $fileName . ' does not exist');
}
$lines = $this->readLinesFromFile($fileName);
return $this->getArrayFromLines($lines);
} | [
"public",
"function",
"load",
"(",
"$",
"fileName",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"fileName",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'File '",
".",
"$",
"fileName",
".",
"' does not exist'",
")",
";",
... | Returns array which consists of value array and map
@param string $fileName
@return array
@throws \Exception | [
"Returns",
"array",
"which",
"consists",
"of",
"value",
"array",
"and",
"map"
] | 79d56d8174637b1124eb90a41ffa3dca4c4a4e93 | https://github.com/mayoturis/properties-ini/blob/79d56d8174637b1124eb90a41ffa3dca4c4a4e93/src/FileLoader.php#L24-L32 |
14,457 | mayoturis/properties-ini | src/FileLoader.php | FileLoader.getArrayFromLines | public function getArrayFromLines(array $lines) {
$array = [];
$map = [];
$i = 1;
foreach ($lines as $line) {
if ($this->processor->isEmptyLine($line)) {
$map[$i] = ['type' => 'empty'];
} elseif ($this->processor->isCommentLine($line)) {
$map[$i] = ['type' => 'comment', 'value' => $line];
} el... | php | public function getArrayFromLines(array $lines) {
$array = [];
$map = [];
$i = 1;
foreach ($lines as $line) {
if ($this->processor->isEmptyLine($line)) {
$map[$i] = ['type' => 'empty'];
} elseif ($this->processor->isCommentLine($line)) {
$map[$i] = ['type' => 'comment', 'value' => $line];
} el... | [
"public",
"function",
"getArrayFromLines",
"(",
"array",
"$",
"lines",
")",
"{",
"$",
"array",
"=",
"[",
"]",
";",
"$",
"map",
"=",
"[",
"]",
";",
"$",
"i",
"=",
"1",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"line",
")",
"{",
"if",
"(",
... | Creates value and map array from string lines
@param array $lines
@return array
@throws InvalidLineException | [
"Creates",
"value",
"and",
"map",
"array",
"from",
"string",
"lines"
] | 79d56d8174637b1124eb90a41ffa3dca4c4a4e93 | https://github.com/mayoturis/properties-ini/blob/79d56d8174637b1124eb90a41ffa3dca4c4a4e93/src/FileLoader.php#L41-L69 |
14,458 | mayoturis/properties-ini | src/FileLoader.php | FileLoader.processValue | public function processValue($value) {
$value = ltrim(rtrim($value));
if ($this->processor->isBool($value)) {
return $this->processor->getBool($value);
}
if ($this->processor->isNumber($value)) {
return $this->processor->getNumber($value);
}
if ($this->processor->isNull($value)) {
return null;
... | php | public function processValue($value) {
$value = ltrim(rtrim($value));
if ($this->processor->isBool($value)) {
return $this->processor->getBool($value);
}
if ($this->processor->isNumber($value)) {
return $this->processor->getNumber($value);
}
if ($this->processor->isNull($value)) {
return null;
... | [
"public",
"function",
"processValue",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"ltrim",
"(",
"rtrim",
"(",
"$",
"value",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"processor",
"->",
"isBool",
"(",
"$",
"value",
")",
")",
"{",
"return",
... | Creates value from string
@param string $value
@return bool|number|null|string | [
"Creates",
"value",
"from",
"string"
] | 79d56d8174637b1124eb90a41ffa3dca4c4a4e93 | https://github.com/mayoturis/properties-ini/blob/79d56d8174637b1124eb90a41ffa3dca4c4a4e93/src/FileLoader.php#L77-L93 |
14,459 | andyvenus/form | src/FormHandler.php | FormHandler.getDefaultOptions | protected function getDefaultOptions(array $fields)
{
$fieldsUpdated = array();
foreach ($fields as $fieldName => $field) {
$fieldsUpdated[$fieldName] = $this->typeHandler->getDefaultOptions($field);
}
return $fieldsUpdated;
} | php | protected function getDefaultOptions(array $fields)
{
$fieldsUpdated = array();
foreach ($fields as $fieldName => $field) {
$fieldsUpdated[$fieldName] = $this->typeHandler->getDefaultOptions($field);
}
return $fieldsUpdated;
} | [
"protected",
"function",
"getDefaultOptions",
"(",
"array",
"$",
"fields",
")",
"{",
"$",
"fieldsUpdated",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"fieldName",
"=>",
"$",
"field",
")",
"{",
"$",
"fieldsUpdated",
"[",
"$",
... | Get the default options for the fields for their type
@param $fields array An array of field data
@return array The fields, updated with default data | [
"Get",
"the",
"default",
"options",
"for",
"the",
"fields",
"for",
"their",
"type"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L197-L205 |
14,460 | andyvenus/form | src/FormHandler.php | FormHandler.setDefaultValues | public function setDefaultValues(array $defaultValues)
{
foreach ($defaultValues as $name => $value) {
if (isset($this->fields[$name])) {
$this->data[$name] = $value;
}
}
} | php | public function setDefaultValues(array $defaultValues)
{
foreach ($defaultValues as $name => $value) {
if (isset($this->fields[$name])) {
$this->data[$name] = $value;
}
}
} | [
"public",
"function",
"setDefaultValues",
"(",
"array",
"$",
"defaultValues",
")",
"{",
"foreach",
"(",
"$",
"defaultValues",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"fields",
"[",
"$",
"name",
"]",
... | Set the default values of matching fields
@param array $defaultValues | [
"Set",
"the",
"default",
"values",
"of",
"matching",
"fields"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L222-L229 |
14,461 | andyvenus/form | src/FormHandler.php | FormHandler.bindEntity | public function bindEntity($entity, $fields = null, $validatable = true)
{
if ($this->submitted) {
throw new BadMethodCallException("Entities cannot be assigned after FormHandler::handleRequest has been called");
}
$this->entities[] = array('entity' => $entity, 'fields' => $fiel... | php | public function bindEntity($entity, $fields = null, $validatable = true)
{
if ($this->submitted) {
throw new BadMethodCallException("Entities cannot be assigned after FormHandler::handleRequest has been called");
}
$this->entities[] = array('entity' => $entity, 'fields' => $fiel... | [
"public",
"function",
"bindEntity",
"(",
"$",
"entity",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"validatable",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"submitted",
")",
"{",
"throw",
"new",
"BadMethodCallException",
"(",
"\"Entities cannot ... | Add an entity to the form. The entities values will be used to fill the form and the forms data
will be assigned to the entity when saveToEntities is called
@param $entity
@param null $fields
@param bool $validatable
@throws \Exception | [
"Add",
"an",
"entity",
"to",
"the",
"form",
".",
"The",
"entities",
"values",
"will",
"be",
"used",
"to",
"fill",
"the",
"form",
"and",
"the",
"forms",
"data",
"will",
"be",
"assigned",
"to",
"the",
"entity",
"when",
"saveToEntities",
"is",
"called"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L240-L257 |
14,462 | andyvenus/form | src/FormHandler.php | FormHandler.handleRequest | public function handleRequest($request = null)
{
$this->submitted = true;
$requestData = $this->requestHandler->handleRequest($this, $request);
$validRequestData = $this->checkFieldsSubmitted($this->fields, $requestData);
if ($this->submitted === true && !empty($validRequestData))... | php | public function handleRequest($request = null)
{
$this->submitted = true;
$requestData = $this->requestHandler->handleRequest($this, $request);
$validRequestData = $this->checkFieldsSubmitted($this->fields, $requestData);
if ($this->submitted === true && !empty($validRequestData))... | [
"public",
"function",
"handleRequest",
"(",
"$",
"request",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"submitted",
"=",
"true",
";",
"$",
"requestData",
"=",
"$",
"this",
"->",
"requestHandler",
"->",
"handleRequest",
"(",
"$",
"this",
",",
"$",
"request... | Use a request handler to get data from a request and store the values that match fields
in the form blueprint
@param null $request | [
"Use",
"a",
"request",
"handler",
"to",
"get",
"data",
"from",
"a",
"request",
"and",
"store",
"the",
"values",
"that",
"match",
"fields",
"in",
"the",
"form",
"blueprint"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L273-L307 |
14,463 | andyvenus/form | src/FormHandler.php | FormHandler.saveToEntities | public function saveToEntities()
{
$data = $this->transformFromFormData($this->data);
foreach ($this->entities as $entity) {
if ($entity['entity'] instanceof EntityInterface) {
$entity['entity']->setFormData($data, $entity['fields']);
} else {
... | php | public function saveToEntities()
{
$data = $this->transformFromFormData($this->data);
foreach ($this->entities as $entity) {
if ($entity['entity'] instanceof EntityInterface) {
$entity['entity']->setFormData($data, $entity['fields']);
} else {
... | [
"public",
"function",
"saveToEntities",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"transformFromFormData",
"(",
"$",
"this",
"->",
"data",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"entities",
"as",
"$",
"entity",
")",
"{",
"if",
"(",
"$... | Save the current form data to the assigned entities | [
"Save",
"the",
"current",
"form",
"data",
"to",
"the",
"assigned",
"entities"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L356-L367 |
14,464 | andyvenus/form | src/FormHandler.php | FormHandler.saveToAndGetClonedEntities | public function saveToAndGetClonedEntities()
{
$data = $this->transformFromFormData($this->data);
$cloned_entities = array();
foreach ($this->entities as $entity) {
$entity['entity'] = clone $entity['entity'];
$cloned_entities[] = $entity;
if ($entity['e... | php | public function saveToAndGetClonedEntities()
{
$data = $this->transformFromFormData($this->data);
$cloned_entities = array();
foreach ($this->entities as $entity) {
$entity['entity'] = clone $entity['entity'];
$cloned_entities[] = $entity;
if ($entity['e... | [
"public",
"function",
"saveToAndGetClonedEntities",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"transformFromFormData",
"(",
"$",
"this",
"->",
"data",
")",
";",
"$",
"cloned_entities",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"... | Save the form data to cloned entities and retrieve them.
Useful for getting entities with the data assigned without affecting
the original entities
@return array | [
"Save",
"the",
"form",
"data",
"to",
"cloned",
"entities",
"and",
"retrieve",
"them",
"."
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L377-L394 |
14,465 | andyvenus/form | src/FormHandler.php | FormHandler.getProcessedFields | public function getProcessedFields()
{
$fields = array();
foreach ($this->fields as $fieldName => $field) {
$fields[$fieldName] = $this->getProcessedField($fieldName);
}
return $fields;
} | php | public function getProcessedFields()
{
$fields = array();
foreach ($this->fields as $fieldName => $field) {
$fields[$fieldName] = $this->getProcessedField($fieldName);
}
return $fields;
} | [
"public",
"function",
"getProcessedFields",
"(",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"fieldName",
"=>",
"$",
"field",
")",
"{",
"$",
"fields",
"[",
"$",
"fieldName",
"]",
"=",
... | Process all fields and return them
@return array | [
"Process",
"all",
"fields",
"and",
"return",
"them"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L422-L430 |
14,466 | andyvenus/form | src/FormHandler.php | FormHandler.getProcessedField | public function getProcessedField($fieldName)
{
if (!isset($this->fields[$fieldName])) {
return false;
}
$field = $this->fields[$fieldName];
$field['has_error'] = $this->fieldHasError($fieldName);
return $this->typeHandler->makeView($field, $this->data, $this);... | php | public function getProcessedField($fieldName)
{
if (!isset($this->fields[$fieldName])) {
return false;
}
$field = $this->fields[$fieldName];
$field['has_error'] = $this->fieldHasError($fieldName);
return $this->typeHandler->makeView($field, $this->data, $this);... | [
"public",
"function",
"getProcessedField",
"(",
"$",
"fieldName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"fields",
"[",
"$",
"fieldName",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"field",
"=",
"$",
"this",
"->",
"fi... | Process a field and return it
@param $fieldName
@return bool | [
"Process",
"a",
"field",
"and",
"return",
"it"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L438-L449 |
14,467 | andyvenus/form | src/FormHandler.php | FormHandler.fieldHasError | public function fieldHasError($fieldName)
{
foreach ($this->errors as $error) {
if ($error->getParam() == $fieldName) {
return true;
}
}
if (!$this->isSubmitted()) {
return false;
}
if (isset($this->validator) && $this->va... | php | public function fieldHasError($fieldName)
{
foreach ($this->errors as $error) {
if ($error->getParam() == $fieldName) {
return true;
}
}
if (!$this->isSubmitted()) {
return false;
}
if (isset($this->validator) && $this->va... | [
"public",
"function",
"fieldHasError",
"(",
"$",
"fieldName",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"errors",
"as",
"$",
"error",
")",
"{",
"if",
"(",
"$",
"error",
"->",
"getParam",
"(",
")",
"==",
"$",
"fieldName",
")",
"{",
"return",
"true"... | Check if a field has an error
@param $fieldName
@return bool | [
"Check",
"if",
"a",
"field",
"has",
"an",
"error"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L457-L472 |
14,468 | andyvenus/form | src/FormHandler.php | FormHandler.hasFieldOfType | public function hasFieldOfType($fieldType)
{
foreach ($this->fields as $field) {
if ($field['type'] == $fieldType) {
return true;
}
}
return false;
} | php | public function hasFieldOfType($fieldType)
{
foreach ($this->fields as $field) {
if ($field['type'] == $fieldType) {
return true;
}
}
return false;
} | [
"public",
"function",
"hasFieldOfType",
"(",
"$",
"fieldType",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"[",
"'type'",
"]",
"==",
"$",
"fieldType",
")",
"{",
"return",
"true",
";",
... | Check if the form contains any fields of a certain type like "select" or "textarea"
@param $fieldType
@return bool | [
"Check",
"if",
"the",
"form",
"contains",
"any",
"fields",
"of",
"a",
"certain",
"type",
"like",
"select",
"or",
"textarea"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L480-L489 |
14,469 | andyvenus/form | src/FormHandler.php | FormHandler.getData | public function getData($name = null, $transform = true)
{
$data = $this->data;
if ($transform === true) {
$data = $this->transformFromFormData($this->data);
}
if ($name === null) {
return $data;
}
else {
if (isset($data[$name])) {... | php | public function getData($name = null, $transform = true)
{
$data = $this->data;
if ($transform === true) {
$data = $this->transformFromFormData($this->data);
}
if ($name === null) {
return $data;
}
else {
if (isset($data[$name])) {... | [
"public",
"function",
"getData",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"transform",
"=",
"true",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"data",
";",
"if",
"(",
"$",
"transform",
"===",
"true",
")",
"{",
"$",
"data",
"=",
"$",
"this",
... | Get the values of all the form fields or a single form field
@param null|string|int $name
@param bool $transform
@return mixed | [
"Get",
"the",
"values",
"of",
"all",
"the",
"form",
"fields",
"or",
"a",
"single",
"form",
"field"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L503-L521 |
14,470 | andyvenus/form | src/FormHandler.php | FormHandler.createView | public function createView()
{
if (!$this->formView) {
$this->formView = new FormView();
}
$this->formView->setFormBlueprint($this->form);
$this->formView->setFields($this->getProcessedFields());
$this->formView->setSections($this->form->getSections());
$... | php | public function createView()
{
if (!$this->formView) {
$this->formView = new FormView();
}
$this->formView->setFormBlueprint($this->form);
$this->formView->setFields($this->getProcessedFields());
$this->formView->setSections($this->form->getSections());
$... | [
"public",
"function",
"createView",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"formView",
")",
"{",
"$",
"this",
"->",
"formView",
"=",
"new",
"FormView",
"(",
")",
";",
"}",
"$",
"this",
"->",
"formView",
"->",
"setFormBlueprint",
"(",
"$",
... | Assign the form data to the view
@return FormViewInterface | [
"Assign",
"the",
"form",
"data",
"to",
"the",
"view"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L652-L676 |
14,471 | andyvenus/form | src/FormHandler.php | FormHandler.setValidator | public function setValidator(ValidatorExtensionInterface $validator)
{
$this->validator = $validator;
$this->validator->setFormHandler($this);
} | php | public function setValidator(ValidatorExtensionInterface $validator)
{
$this->validator = $validator;
$this->validator->setFormHandler($this);
} | [
"public",
"function",
"setValidator",
"(",
"ValidatorExtensionInterface",
"$",
"validator",
")",
"{",
"$",
"this",
"->",
"validator",
"=",
"$",
"validator",
";",
"$",
"this",
"->",
"validator",
"->",
"setFormHandler",
"(",
"$",
"this",
")",
";",
"}"
] | Set a validator wrapped in a ValidatorExtension class
@param ValidatorExtensionInterface $validator | [
"Set",
"a",
"validator",
"wrapped",
"in",
"a",
"ValidatorExtension",
"class"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L683-L687 |
14,472 | andyvenus/form | src/FormHandler.php | FormHandler.isValid | public function isValid($scope = null, $options = null)
{
if (!$this->isSubmitted()) {
return false;
}
// Check for internal errors & validator errors
if ((isset($this->validator) && $this->validator->isValid($scope, $options) && empty($this->errors)) || (!isset($this->v... | php | public function isValid($scope = null, $options = null)
{
if (!$this->isSubmitted()) {
return false;
}
// Check for internal errors & validator errors
if ((isset($this->validator) && $this->validator->isValid($scope, $options) && empty($this->errors)) || (!isset($this->v... | [
"public",
"function",
"isValid",
"(",
"$",
"scope",
"=",
"null",
",",
"$",
"options",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isSubmitted",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Check for internal errors & validator errors... | Check if the form is valid using the validator if it is set and checking for any
custom errors. Will save data to entities.
@param null $scope
@param null $options
@return bool | [
"Check",
"if",
"the",
"form",
"is",
"valid",
"using",
"the",
"validator",
"if",
"it",
"is",
"set",
"and",
"checking",
"for",
"any",
"custom",
"errors",
".",
"Will",
"save",
"data",
"to",
"entities",
"."
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L713-L739 |
14,473 | andyvenus/form | src/FormHandler.php | FormHandler.setRequiredFieldErrors | protected function setRequiredFieldErrors($fields = null, $data = null)
{
if ($fields === null) {
$fields =& $this->fields;
}
if ($data === null) {
$data =& $this->data;
}
foreach ($fields as $field) {
if (isset($field['options']['require... | php | protected function setRequiredFieldErrors($fields = null, $data = null)
{
if ($fields === null) {
$fields =& $this->fields;
}
if ($data === null) {
$data =& $this->data;
}
foreach ($fields as $field) {
if (isset($field['options']['require... | [
"protected",
"function",
"setRequiredFieldErrors",
"(",
"$",
"fields",
"=",
"null",
",",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"fields",
"===",
"null",
")",
"{",
"$",
"fields",
"=",
"&",
"$",
"this",
"->",
"fields",
";",
"}",
"if",
"(... | Check each field to see if they're required. If they have no data set, assign the error
@param null $fields
@param null $data | [
"Check",
"each",
"field",
"to",
"see",
"if",
"they",
"re",
"required",
".",
"If",
"they",
"have",
"no",
"data",
"set",
"assign",
"the",
"error"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L758-L785 |
14,474 | andyvenus/form | src/FormHandler.php | FormHandler.setError | public function setError($param, $message, $translate = false, $translationParams = array())
{
$this->errors[] = new FormError($param, $message, $translate, $translationParams);
// Call isValid to update valid status in restore data handlers
$this->isValid();
} | php | public function setError($param, $message, $translate = false, $translationParams = array())
{
$this->errors[] = new FormError($param, $message, $translate, $translationParams);
// Call isValid to update valid status in restore data handlers
$this->isValid();
} | [
"public",
"function",
"setError",
"(",
"$",
"param",
",",
"$",
"message",
",",
"$",
"translate",
"=",
"false",
",",
"$",
"translationParams",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"errors",
"[",
"]",
"=",
"new",
"FormError",
"(",
"$",
... | Set a custom error on the form
@param $param
@param $message
@param bool|false $translate
@param array $translationParams | [
"Set",
"a",
"custom",
"error",
"on",
"the",
"form"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L795-L801 |
14,475 | andyvenus/form | src/FormHandler.php | FormHandler.addCustomErrors | public function addCustomErrors($errors)
{
if ($errors) {
foreach ($errors as $error) {
if (!is_a($error, 'AV\Form\FormError')) {
throw new InvalidArgumentException('Custom errors must be AV\Form\FormError objects');
}
else {
... | php | public function addCustomErrors($errors)
{
if ($errors) {
foreach ($errors as $error) {
if (!is_a($error, 'AV\Form\FormError')) {
throw new InvalidArgumentException('Custom errors must be AV\Form\FormError objects');
}
else {
... | [
"public",
"function",
"addCustomErrors",
"(",
"$",
"errors",
")",
"{",
"if",
"(",
"$",
"errors",
")",
"{",
"foreach",
"(",
"$",
"errors",
"as",
"$",
"error",
")",
"{",
"if",
"(",
"!",
"is_a",
"(",
"$",
"error",
",",
"'AV\\Form\\FormError'",
")",
")",... | Add custom errors to the form. Must be an array of FormError objects
@param $errors FormError[]
@throws InvalidArgumentException | [
"Add",
"custom",
"errors",
"to",
"the",
"form",
".",
"Must",
"be",
"an",
"array",
"of",
"FormError",
"objects"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L809-L824 |
14,476 | andyvenus/form | src/FormHandler.php | FormHandler.getValidationErrors | public function getValidationErrors()
{
$errors = $this->errors;
if (isset($this->validator)) {
$validator_errors = $this->validator->getErrors();
$errors = array_merge($errors, $validator_errors);
}
return $errors;
} | php | public function getValidationErrors()
{
$errors = $this->errors;
if (isset($this->validator)) {
$validator_errors = $this->validator->getErrors();
$errors = array_merge($errors, $validator_errors);
}
return $errors;
} | [
"public",
"function",
"getValidationErrors",
"(",
")",
"{",
"$",
"errors",
"=",
"$",
"this",
"->",
"errors",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"validator",
")",
")",
"{",
"$",
"validator_errors",
"=",
"$",
"this",
"->",
"validator",
"->"... | Get the errors from the validator
@return mixed | [
"Get",
"the",
"errors",
"from",
"the",
"validator"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormHandler.php#L831-L841 |
14,477 | crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtMedia/MediaQuery.php | MediaQuery.setType | public function setType($type)
{
if (is_string($type)) {
if (in_array($type, [
self::TYPE_ALL, self::TYPE_PRINT, self::TYPE_SCREEN, self::TYPE_SPEECH,
self::TYPE_AURAL, self::TYPE_BRAILLE, self::TYPE_EMBOSSED, self::TYPE_HANDHELD,
self::TYPE_PROJEC... | php | public function setType($type)
{
if (is_string($type)) {
if (in_array($type, [
self::TYPE_ALL, self::TYPE_PRINT, self::TYPE_SCREEN, self::TYPE_SPEECH,
self::TYPE_AURAL, self::TYPE_BRAILLE, self::TYPE_EMBOSSED, self::TYPE_HANDHELD,
self::TYPE_PROJEC... | [
"public",
"function",
"setType",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"type",
",",
"[",
"self",
"::",
"TYPE_ALL",
",",
"self",
"::",
"TYPE_PRINT",
",",
"self",
"::",
... | Sets the media type.
@param string $type
@return $this | [
"Sets",
"the",
"media",
"type",
"."
] | 7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3 | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtMedia/MediaQuery.php#L55-L78 |
14,478 | crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtMedia/MediaQuery.php | MediaQuery.addCondition | public function addCondition(ConditionAbstract $condition)
{
if ($condition instanceof MediaCondition) {
$this->conditions[] = $condition;
} else {
throw new \InvalidArgumentException(
"Invalid condition instance. Instance of 'MediaCondition' expected."
... | php | public function addCondition(ConditionAbstract $condition)
{
if ($condition instanceof MediaCondition) {
$this->conditions[] = $condition;
} else {
throw new \InvalidArgumentException(
"Invalid condition instance. Instance of 'MediaCondition' expected."
... | [
"public",
"function",
"addCondition",
"(",
"ConditionAbstract",
"$",
"condition",
")",
"{",
"if",
"(",
"$",
"condition",
"instanceof",
"MediaCondition",
")",
"{",
"$",
"this",
"->",
"conditions",
"[",
"]",
"=",
"$",
"condition",
";",
"}",
"else",
"{",
"thr... | Adds a media rule condition.
@param MediaCondition $condition
@return $this | [
"Adds",
"a",
"media",
"rule",
"condition",
"."
] | 7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3 | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtMedia/MediaQuery.php#L96-L107 |
14,479 | vcn/enum | src/Enum.php | Enum.byName | final public static function byName($name)
{
$instances = &static::getInstances();
if (!array_key_exists($name, $instances)) {
$instances[$name] = new static($name);
}
return $instances[$name];
} | php | final public static function byName($name)
{
$instances = &static::getInstances();
if (!array_key_exists($name, $instances)) {
$instances[$name] = new static($name);
}
return $instances[$name];
} | [
"final",
"public",
"static",
"function",
"byName",
"(",
"$",
"name",
")",
"{",
"$",
"instances",
"=",
"&",
"static",
"::",
"getInstances",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"instances",
")",
")",
"{",
"$",... | Attempts to instantiate an Enum from a label name.
For example:
```
Fruit::byName('APPLE'); // Fruit::APPLE()
Fruit::byName('BANANA'); // Fruit::BANANA()
Fruit::byName('UNKNOWN'); // exception
```
@param string $name
@return static
@throws Enum\Exception\InvalidInstance | [
"Attempts",
"to",
"instantiate",
"an",
"Enum",
"from",
"a",
"label",
"name",
"."
] | ced38687b6140858956778140915d5d5a6397f23 | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum.php#L67-L76 |
14,480 | vcn/enum | src/Enum.php | Enum.getAllInstances | public static function getAllInstances()
{
try {
$instances = array();
foreach (static::getAllNames() as $name) {
$instances[] = static::byName($name);
}
return $instances;
} catch (Enum\Exception\InvalidInstance $e) {
thr... | php | public static function getAllInstances()
{
try {
$instances = array();
foreach (static::getAllNames() as $name) {
$instances[] = static::byName($name);
}
return $instances;
} catch (Enum\Exception\InvalidInstance $e) {
thr... | [
"public",
"static",
"function",
"getAllInstances",
"(",
")",
"{",
"try",
"{",
"$",
"instances",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"static",
"::",
"getAllNames",
"(",
")",
"as",
"$",
"name",
")",
"{",
"$",
"instances",
"[",
"]",
"=",
"stati... | Gets an array of all possible instances.
<br/>
For example:
<br/>
```
Fruit::getAllInstances(); // [Fruit::APPLE(), Fruit::BANANA()]
```
@return static[] | [
"Gets",
"an",
"array",
"of",
"all",
"possible",
"instances",
"."
] | ced38687b6140858956778140915d5d5a6397f23 | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum.php#L114-L127 |
14,481 | vcn/enum | src/Enum.php | Enum.getAllNames | public static function getAllNames()
{
$className = get_called_class();
if (!array_key_exists($className, self::$constantsArray)) {
try {
$class = new ReflectionClass($className);
} catch (ReflectionException $e) {
throw new RuntimeException($... | php | public static function getAllNames()
{
$className = get_called_class();
if (!array_key_exists($className, self::$constantsArray)) {
try {
$class = new ReflectionClass($className);
} catch (ReflectionException $e) {
throw new RuntimeException($... | [
"public",
"static",
"function",
"getAllNames",
"(",
")",
"{",
"$",
"className",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"className",
",",
"self",
"::",
"$",
"constantsArray",
")",
")",
"{",
"try",
"{",
"$",
... | Gets an array of all possible instances' label names.
<br/>
For example:
<br/>
```
Fruit::getAllNames(); // ['APPLE', 'BANANA']
```
@return string[] | [
"Gets",
"an",
"array",
"of",
"all",
"possible",
"instances",
"label",
"names",
"."
] | ced38687b6140858956778140915d5d5a6397f23 | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum.php#L158-L173 |
14,482 | vcn/enum | src/Enum.php | Enum.equals | final public function equals(Enum $b)
{
$aClass = get_class($this);
$bClass = get_class($b);
if ($aClass !== $bClass) {
throw new InvalidArgumentException("Unexpected type {$bClass} is not of type {$aClass}.");
}
return $b->getName() === $this->getName();
} | php | final public function equals(Enum $b)
{
$aClass = get_class($this);
$bClass = get_class($b);
if ($aClass !== $bClass) {
throw new InvalidArgumentException("Unexpected type {$bClass} is not of type {$aClass}.");
}
return $b->getName() === $this->getName();
} | [
"final",
"public",
"function",
"equals",
"(",
"Enum",
"$",
"b",
")",
"{",
"$",
"aClass",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"bClass",
"=",
"get_class",
"(",
"$",
"b",
")",
";",
"if",
"(",
"$",
"aClass",
"!==",
"$",
"bClass",
")",
... | Only two Enums of the same type can be compared.
They are equal if their label is the same.
<br/>
For example:
<br/>
```
Fruit::APPLE()->equals(Fruit::BANANA()); // false
Fruit::APPLE()->equals(Fruit::APPLE()); // true
Fruit::APPLE()->equals(VEGETABLE::SPINACH()); // exception
```
@param Enum $b
@return bool
@thr... | [
"Only",
"two",
"Enums",
"of",
"the",
"same",
"type",
"can",
"be",
"compared",
".",
"They",
"are",
"equal",
"if",
"their",
"label",
"is",
"the",
"same",
"."
] | ced38687b6140858956778140915d5d5a6397f23 | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum.php#L320-L330 |
14,483 | fuzz-productions/laravel-api-data | src/Transformations/TransformationFactory.php | TransformationFactory.resourceWith | public function resourceWith($entity, $transformer, $key = null): TransformationFactory
{
// if collection, paginator, or array with first value being an array use collection resource.
if ((is_array($entity) && isset($entity[0]) && is_array($entity[0])) || $entity instanceof LaravelCollection || $entity instanceof... | php | public function resourceWith($entity, $transformer, $key = null): TransformationFactory
{
// if collection, paginator, or array with first value being an array use collection resource.
if ((is_array($entity) && isset($entity[0]) && is_array($entity[0])) || $entity instanceof LaravelCollection || $entity instanceof... | [
"public",
"function",
"resourceWith",
"(",
"$",
"entity",
",",
"$",
"transformer",
",",
"$",
"key",
"=",
"null",
")",
":",
"TransformationFactory",
"{",
"// if collection, paginator, or array with first value being an array use collection resource.",
"if",
"(",
"(",
"is_a... | Adds data and transformer, and chooses whether to use the Item or Collection Resource
based on what's most suitable for the data passed in.
@param mixed $entity
@param TransformerAbstract|callable $transformer
@param null|mixed $key
@return \Fuzz\Data\Transformations\Transform... | [
"Adds",
"data",
"and",
"transformer",
"and",
"chooses",
"whether",
"to",
"use",
"the",
"Item",
"or",
"Collection",
"Resource",
"based",
"on",
"what",
"s",
"most",
"suitable",
"for",
"the",
"data",
"passed",
"in",
"."
] | 25e181860d2f269b3b212195944c2bca95b411bb | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Transformations/TransformationFactory.php#L101-L109 |
14,484 | fuzz-productions/laravel-api-data | src/Transformations/TransformationFactory.php | TransformationFactory.collectionWith | public function collectionWith($entity, $transformer, $key = null): TransformationFactory
{
$this->entity = $entity;
$this->transformer = $transformer;
$this->resource = new Collection($entity, $transformer, $key);
return $this;
} | php | public function collectionWith($entity, $transformer, $key = null): TransformationFactory
{
$this->entity = $entity;
$this->transformer = $transformer;
$this->resource = new Collection($entity, $transformer, $key);
return $this;
} | [
"public",
"function",
"collectionWith",
"(",
"$",
"entity",
",",
"$",
"transformer",
",",
"$",
"key",
"=",
"null",
")",
":",
"TransformationFactory",
"{",
"$",
"this",
"->",
"entity",
"=",
"$",
"entity",
";",
"$",
"this",
"->",
"transformer",
"=",
"$",
... | Uses a Collection resource on the data and transformer passed in.
@param mixed $entity
@param TransformerAbstract|callable $transformer
@param null|mixed $key
@return \Fuzz\Data\Transformations\TransformationFactory | [
"Uses",
"a",
"Collection",
"resource",
"on",
"the",
"data",
"and",
"transformer",
"passed",
"in",
"."
] | 25e181860d2f269b3b212195944c2bca95b411bb | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Transformations/TransformationFactory.php#L120-L127 |
14,485 | fuzz-productions/laravel-api-data | src/Transformations/TransformationFactory.php | TransformationFactory.itemWith | public function itemWith($entity, $transformer, $key = null): TransformationFactory
{
$this->entity = $entity;
$this->transformer = $transformer;
$this->resource = new Item($entity, $transformer, $key);
return $this;
} | php | public function itemWith($entity, $transformer, $key = null): TransformationFactory
{
$this->entity = $entity;
$this->transformer = $transformer;
$this->resource = new Item($entity, $transformer, $key);
return $this;
} | [
"public",
"function",
"itemWith",
"(",
"$",
"entity",
",",
"$",
"transformer",
",",
"$",
"key",
"=",
"null",
")",
":",
"TransformationFactory",
"{",
"$",
"this",
"->",
"entity",
"=",
"$",
"entity",
";",
"$",
"this",
"->",
"transformer",
"=",
"$",
"tran... | Uses an Item resource on the data and transformer passed in.
@param mixed $entity
@param TransformerAbstract|callable $transformer
@param null|mixed $key
@return \Fuzz\Data\Transformations\TransformationFactory | [
"Uses",
"an",
"Item",
"resource",
"on",
"the",
"data",
"and",
"transformer",
"passed",
"in",
"."
] | 25e181860d2f269b3b212195944c2bca95b411bb | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Transformations/TransformationFactory.php#L138-L145 |
14,486 | fuzz-productions/laravel-api-data | src/Transformations/TransformationFactory.php | TransformationFactory.serialize | public function serialize($serializer = ApiDataSerializer::class): array
{
if (! is_a($serializer, SerializerAbstract::class, true)) {
throw new \InvalidArgumentException(
sprintf('The serializer must either be an instance,
or string representation of %s. The passed value %s is neither.',
SerializerA... | php | public function serialize($serializer = ApiDataSerializer::class): array
{
if (! is_a($serializer, SerializerAbstract::class, true)) {
throw new \InvalidArgumentException(
sprintf('The serializer must either be an instance,
or string representation of %s. The passed value %s is neither.',
SerializerA... | [
"public",
"function",
"serialize",
"(",
"$",
"serializer",
"=",
"ApiDataSerializer",
"::",
"class",
")",
":",
"array",
"{",
"if",
"(",
"!",
"is_a",
"(",
"$",
"serializer",
",",
"SerializerAbstract",
"::",
"class",
",",
"true",
")",
")",
"{",
"throw",
"ne... | Completes the the transformation and serialization flow, returning the data.
This could be thought of as a `flush` method.
// @TODO it does too much currently. toArray is really the `flush` method and should be moved into it's own
method.
@param \League\Fractal\Serializer\SerializerAbstract|string $serializer
@retu... | [
"Completes",
"the",
"the",
"transformation",
"and",
"serialization",
"flow",
"returning",
"the",
"data",
"."
] | 25e181860d2f269b3b212195944c2bca95b411bb | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Transformations/TransformationFactory.php#L159-L176 |
14,487 | fuzz-productions/laravel-api-data | src/Transformations/TransformationFactory.php | TransformationFactory.usingPaginator | public function usingPaginator($paginator = null): TransformationFactory
{
if (! ($this->resource instanceof Collection) || ! ($this->entity instanceof LengthAwarePaginator)) {
throw new \InvalidArgumentException('Bad Request Issued');
}
$this->resource->setPaginator(new IlluminatePaginatorAdapter($this->ent... | php | public function usingPaginator($paginator = null): TransformationFactory
{
if (! ($this->resource instanceof Collection) || ! ($this->entity instanceof LengthAwarePaginator)) {
throw new \InvalidArgumentException('Bad Request Issued');
}
$this->resource->setPaginator(new IlluminatePaginatorAdapter($this->ent... | [
"public",
"function",
"usingPaginator",
"(",
"$",
"paginator",
"=",
"null",
")",
":",
"TransformationFactory",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"resource",
"instanceof",
"Collection",
")",
"||",
"!",
"(",
"$",
"this",
"->",
"entity",
"instanceo... | Applies a LengthAwarePaginator for paged resources.
@param null $paginator
@throws \InvalidArgumentException
@return \Fuzz\Data\Transformations\TransformationFactory | [
"Applies",
"a",
"LengthAwarePaginator",
"for",
"paged",
"resources",
"."
] | 25e181860d2f269b3b212195944c2bca95b411bb | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Transformations/TransformationFactory.php#L202-L211 |
14,488 | czim/laravel-pxlcms | src/Generator/Analyzer/Steps/LoadRawData.php | LoadRawData.parseFieldOptionsJson | protected function parseFieldOptionsJson()
{
foreach ($this->data->rawData['fields'] as $fieldId => &$fieldData) {
$optionsJson = trim( $fieldData['options'] );
if (empty($optionsJson)) continue;
$fieldData['options'] = json_decode($optionsJson, true);
}
... | php | protected function parseFieldOptionsJson()
{
foreach ($this->data->rawData['fields'] as $fieldId => &$fieldData) {
$optionsJson = trim( $fieldData['options'] );
if (empty($optionsJson)) continue;
$fieldData['options'] = json_decode($optionsJson, true);
}
... | [
"protected",
"function",
"parseFieldOptionsJson",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"->",
"rawData",
"[",
"'fields'",
"]",
"as",
"$",
"fieldId",
"=>",
"&",
"$",
"fieldData",
")",
"{",
"$",
"optionsJson",
"=",
"trim",
"(",
"$",
"... | Parses json to array for fields with 'options' set | [
"Parses",
"json",
"to",
"array",
"for",
"fields",
"with",
"options",
"set"
] | 910297d2a3f2db86dde51b0e10fe5aad45f1aa1a | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Analyzer/Steps/LoadRawData.php#L272-L284 |
14,489 | harp-orm/query | src/Compiler/Columns.php | Columns.renderItem | public static function renderItem(SQL\Columns $item)
{
return Compiler::braced(
Arr::join(', ', Arr::map(__NAMESPACE__.'\Compiler::name', $item->all()))
);
} | php | public static function renderItem(SQL\Columns $item)
{
return Compiler::braced(
Arr::join(', ', Arr::map(__NAMESPACE__.'\Compiler::name', $item->all()))
);
} | [
"public",
"static",
"function",
"renderItem",
"(",
"SQL",
"\\",
"Columns",
"$",
"item",
")",
"{",
"return",
"Compiler",
"::",
"braced",
"(",
"Arr",
"::",
"join",
"(",
"', '",
",",
"Arr",
"::",
"map",
"(",
"__NAMESPACE__",
".",
"'\\Compiler::name'",
",",
... | Render Columns object
@param SQL\Columns $item
@return string | [
"Render",
"Columns",
"object"
] | 98ce2468a0a31fe15ed3692bad32547bf6dbe41a | https://github.com/harp-orm/query/blob/98ce2468a0a31fe15ed3692bad32547bf6dbe41a/src/Compiler/Columns.php#L30-L35 |
14,490 | harp-orm/query | src/Compiler/Select.php | Select.render | public static function render(Query\Select $query)
{
return Compiler::withDb($query->getDb(), function () use ($query) {
return Compiler::expression(array(
'SELECT',
$query->getType(),
Aliased::combine($query->getColumns()) ?: '*',
... | php | public static function render(Query\Select $query)
{
return Compiler::withDb($query->getDb(), function () use ($query) {
return Compiler::expression(array(
'SELECT',
$query->getType(),
Aliased::combine($query->getColumns()) ?: '*',
... | [
"public",
"static",
"function",
"render",
"(",
"Query",
"\\",
"Select",
"$",
"query",
")",
"{",
"return",
"Compiler",
"::",
"withDb",
"(",
"$",
"query",
"->",
"getDb",
"(",
")",
",",
"function",
"(",
")",
"use",
"(",
"$",
"query",
")",
"{",
"return",... | Render a Select object
@param Query\Select $query
@return string | [
"Render",
"a",
"Select",
"object"
] | 98ce2468a0a31fe15ed3692bad32547bf6dbe41a | https://github.com/harp-orm/query/blob/98ce2468a0a31fe15ed3692bad32547bf6dbe41a/src/Compiler/Select.php#L19-L36 |
14,491 | siriusphp/html | src/Builder.php | Builder.with | public function with($options)
{
$clone = clone $this;
foreach ($options as $name => $value) {
$clone->setOption($name, $value);
}
return $clone;
} | php | public function with($options)
{
$clone = clone $this;
foreach ($options as $name => $value) {
$clone->setOption($name, $value);
}
return $clone;
} | [
"public",
"function",
"with",
"(",
"$",
"options",
")",
"{",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"foreach",
"(",
"$",
"options",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"clone",
"->",
"setOption",
"(",
"$",
"name",
",",
"$... | Clones the instance and applies new set of options
@param $options
@return Builder | [
"Clones",
"the",
"instance",
"and",
"applies",
"new",
"set",
"of",
"options"
] | bc3e0cb98e80780e2ca01d88c3181605b7136f59 | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Builder.php#L72-L80 |
14,492 | JoffreyPoreeCoding/MongoDB-ODM | src/Tools/QueryCaster.php | QueryCaster.getCastedQuery | public function getCastedQuery()
{
$newQuery = $this->castArray($this->query, $this->initialMetadata);
ArrayModifier::aggregate($newQuery, self::$mongoDbQueryOperators);
return $newQuery;
} | php | public function getCastedQuery()
{
$newQuery = $this->castArray($this->query, $this->initialMetadata);
ArrayModifier::aggregate($newQuery, self::$mongoDbQueryOperators);
return $newQuery;
} | [
"public",
"function",
"getCastedQuery",
"(",
")",
"{",
"$",
"newQuery",
"=",
"$",
"this",
"->",
"castArray",
"(",
"$",
"this",
"->",
"query",
",",
"$",
"this",
"->",
"initialMetadata",
")",
";",
"ArrayModifier",
"::",
"aggregate",
"(",
"$",
"newQuery",
"... | Get the caster query
@return array | [
"Get",
"the",
"caster",
"query"
] | 56fd7ab28c22f276573a89d56bb93c8d74ad7f74 | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Tools/QueryCaster.php#L75-L80 |
14,493 | heyday/heystack | src/Console/Command/GenerateDataObjects.php | GenerateDataObjects.execute | protected function execute(Input\InputInterface $input, Output\OutputInterface $output)
{
$this->generatorService->process($input->getOption('force'));
$output->writeln('Completed');
} | php | protected function execute(Input\InputInterface $input, Output\OutputInterface $output)
{
$this->generatorService->process($input->getOption('force'));
$output->writeln('Completed');
} | [
"protected",
"function",
"execute",
"(",
"Input",
"\\",
"InputInterface",
"$",
"input",
",",
"Output",
"\\",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"generatorService",
"->",
"process",
"(",
"$",
"input",
"->",
"getOption",
"(",
"'forc... | Generate the container
@param Input\InputInterface $input The commands input
@param Output\OutputInterface $output The commands output
@return null | [
"Generate",
"the",
"container"
] | 2c051933f8c532d0a9a23be6ee1ff5c619e47dfe | https://github.com/heyday/heystack/blob/2c051933f8c532d0a9a23be6ee1ff5c619e47dfe/src/Console/Command/GenerateDataObjects.php#L67-L71 |
14,494 | comelyio/comely | src/Comely/IO/Session/ComelySession/Bag.php | Bag.has | public function has(string ...$props): bool
{
foreach ($props as $prop) {
if (!array_key_exists(strtolower($prop), $this->props)) {
return false;
}
}
return true;
} | php | public function has(string ...$props): bool
{
foreach ($props as $prop) {
if (!array_key_exists(strtolower($prop), $this->props)) {
return false;
}
}
return true;
} | [
"public",
"function",
"has",
"(",
"string",
"...",
"$",
"props",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"props",
"as",
"$",
"prop",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"strtolower",
"(",
"$",
"prop",
")",
",",
"$",
"this",
"->",... | Checks if 1 or all the keys exist in Bag
@param string[] ...$props
@return bool | [
"Checks",
"if",
"1",
"or",
"all",
"the",
"keys",
"exist",
"in",
"Bag"
] | 561ea7aef36fea347a1a79d3ee5597d4057ddf82 | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Session/ComelySession/Bag.php#L88-L97 |
14,495 | jan-dolata/crude-crud | src/Engine/CrudeSetupTrait/ModelDefaults.php | ModelDefaults.setModelDefaults | public function setModelDefaults($attr, $value = null)
{
if (is_array($attr))
$this->modelDefaults = array_merge($this->modelDefaults, $attr);
else
$this->modelDefaults[$attr] = $value;
return $this;
} | php | public function setModelDefaults($attr, $value = null)
{
if (is_array($attr))
$this->modelDefaults = array_merge($this->modelDefaults, $attr);
else
$this->modelDefaults[$attr] = $value;
return $this;
} | [
"public",
"function",
"setModelDefaults",
"(",
"$",
"attr",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"attr",
")",
")",
"$",
"this",
"->",
"modelDefaults",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"modelDefaults",
",... | Sets the Model default values.
@param string|array $attr
@param array $value
@return self | [
"Sets",
"the",
"Model",
"default",
"values",
"."
] | 9129ea08278835cf5cecfd46a90369226ae6bdd7 | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeSetupTrait/ModelDefaults.php#L32-L40 |
14,496 | okvpn/fixture-bundle | src/Migration/Sorter/DataFixturesSorter.php | DataFixturesSorter.orderFixturesByNumber | protected function orderFixturesByNumber()
{
$this->orderedFixtures = $this->fixtures;
usort(
$this->orderedFixtures,
function ($a, $b) {
if ($a instanceof OrderedFixtureInterface && $b instanceof OrderedFixtureInterface) {
if ($a->getOrder... | php | protected function orderFixturesByNumber()
{
$this->orderedFixtures = $this->fixtures;
usort(
$this->orderedFixtures,
function ($a, $b) {
if ($a instanceof OrderedFixtureInterface && $b instanceof OrderedFixtureInterface) {
if ($a->getOrder... | [
"protected",
"function",
"orderFixturesByNumber",
"(",
")",
"{",
"$",
"this",
"->",
"orderedFixtures",
"=",
"$",
"this",
"->",
"fixtures",
";",
"usort",
"(",
"$",
"this",
"->",
"orderedFixtures",
",",
"function",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
... | Order fixtures by priority
@return array | [
"Order",
"fixtures",
"by",
"priority"
] | 243b5e4dff9773e97fa447280e929c936a5d66ae | https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Migration/Sorter/DataFixturesSorter.php#L59-L80 |
14,497 | heyday/heystack | src/DataObjectSchema/JsonDataObjectSchema.php | JsonDataObjectSchema.getLastJsonError | protected function getLastJsonError()
{
$error = json_last_error();
return array_key_exists($error, self::$errors) ? self::$errors[$error] : "Unknown error ({$error})";
} | php | protected function getLastJsonError()
{
$error = json_last_error();
return array_key_exists($error, self::$errors) ? self::$errors[$error] : "Unknown error ({$error})";
} | [
"protected",
"function",
"getLastJsonError",
"(",
")",
"{",
"$",
"error",
"=",
"json_last_error",
"(",
")",
";",
"return",
"array_key_exists",
"(",
"$",
"error",
",",
"self",
"::",
"$",
"errors",
")",
"?",
"self",
"::",
"$",
"errors",
"[",
"$",
"error",
... | Get the last error
@return string | [
"Get",
"the",
"last",
"error"
] | 2c051933f8c532d0a9a23be6ee1ff5c619e47dfe | https://github.com/heyday/heystack/blob/2c051933f8c532d0a9a23be6ee1ff5c619e47dfe/src/DataObjectSchema/JsonDataObjectSchema.php#L63-L67 |
14,498 | drpdigital/json-api-parser | src/Concerns/ChecksTypes.php | ChecksTypes.isTypeWithinArray | protected function isTypeWithinArray($type, array $haystackTypes)
{
$iterator = new \ArrayIterator($haystackTypes);
while($iterator->valid()) {
$seenValue = $iterator->current();
if ($seenValue === $type) {
return true;
}
$parts = ex... | php | protected function isTypeWithinArray($type, array $haystackTypes)
{
$iterator = new \ArrayIterator($haystackTypes);
while($iterator->valid()) {
$seenValue = $iterator->current();
if ($seenValue === $type) {
return true;
}
$parts = ex... | [
"protected",
"function",
"isTypeWithinArray",
"(",
"$",
"type",
",",
"array",
"$",
"haystackTypes",
")",
"{",
"$",
"iterator",
"=",
"new",
"\\",
"ArrayIterator",
"(",
"$",
"haystackTypes",
")",
";",
"while",
"(",
"$",
"iterator",
"->",
"valid",
"(",
")",
... | Checks if the given type exists within the array of types.
@param string $type
@param array $haystackTypes
@return boolean | [
"Checks",
"if",
"the",
"given",
"type",
"exists",
"within",
"the",
"array",
"of",
"types",
"."
] | b1ceefc0c19ec326129126253114c121e97ca943 | https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/Concerns/ChecksTypes.php#L14-L37 |
14,499 | jasny/router | src/Router/Middleware/ErrorPage.php | ErrorPage.reviveRequest | protected function reviveRequest(ServerRequestInterface $request)
{
$isStale = interface_exists('Jasny\HttpMessage\GlobalEnvironmentInterface') &&
$request instanceof GlobalEnvironmentInterface &&
$request->isStale();
return $isStale ? $request->revive() : $request;
... | php | protected function reviveRequest(ServerRequestInterface $request)
{
$isStale = interface_exists('Jasny\HttpMessage\GlobalEnvironmentInterface') &&
$request instanceof GlobalEnvironmentInterface &&
$request->isStale();
return $isStale ? $request->revive() : $request;
... | [
"protected",
"function",
"reviveRequest",
"(",
"ServerRequestInterface",
"$",
"request",
")",
"{",
"$",
"isStale",
"=",
"interface_exists",
"(",
"'Jasny\\HttpMessage\\GlobalEnvironmentInterface'",
")",
"&&",
"$",
"request",
"instanceof",
"GlobalEnvironmentInterface",
"&&",
... | Revive a stale request
@param ServerRequestInterface $request
@return ServerRequestInterface | [
"Revive",
"a",
"stale",
"request"
] | 4c776665ba343150b442c21893946e3d54190896 | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Middleware/ErrorPage.php#L68-L75 |
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.