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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
204,600 | as3io/modlr | src/Store/Cache.php | Cache.get | public function get($typeKey, $identifier)
{
$map = $this->getAllForType($typeKey);
if (isset($map[$identifier])) {
return $map[$identifier];
}
return null;
} | php | public function get($typeKey, $identifier)
{
$map = $this->getAllForType($typeKey);
if (isset($map[$identifier])) {
return $map[$identifier];
}
return null;
} | [
"public",
"function",
"get",
"(",
"$",
"typeKey",
",",
"$",
"identifier",
")",
"{",
"$",
"map",
"=",
"$",
"this",
"->",
"getAllForType",
"(",
"$",
"typeKey",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"map",
"[",
"$",
"identifier",
"]",
")",
")",
"{... | Gets a model from the memory cache, based on type and identifier.
@param string $typeKey
@param string $identifier
@return Model|null | [
"Gets",
"a",
"model",
"from",
"the",
"memory",
"cache",
"based",
"on",
"type",
"and",
"identifier",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Store/Cache.php#L106-L113 |
204,601 | CampaignChain/activity-ezplatform | Controller/EZPlatformScheduleHandler.php | EZPlatformScheduleHandler.createContent | public function createContent(Location $location = null, Campaign $campaign = null)
{
$connection = $this->getRestApiConnectionByLocation($location);
$remoteContentTypes = $connection->getContentTypes();
foreach($remoteContentTypes as $remoteContentType){
$id = $location->getId(... | php | public function createContent(Location $location = null, Campaign $campaign = null)
{
$connection = $this->getRestApiConnectionByLocation($location);
$remoteContentTypes = $connection->getContentTypes();
foreach($remoteContentTypes as $remoteContentType){
$id = $location->getId(... | [
"public",
"function",
"createContent",
"(",
"Location",
"$",
"location",
"=",
"null",
",",
"Campaign",
"$",
"campaign",
"=",
"null",
")",
"{",
"$",
"connection",
"=",
"$",
"this",
"->",
"getRestApiConnectionByLocation",
"(",
"$",
"location",
")",
";",
"$",
... | When a new Activity is being created, this handler method will be called
to retrieve a new Content object for the Activity.
Called in these views:
- new
@param Location $location
@param Campaign $campaign
@return null | [
"When",
"a",
"new",
"Activity",
"is",
"being",
"created",
"this",
"handler",
"method",
"will",
"be",
"called",
"to",
"retrieve",
"a",
"new",
"Content",
"object",
"for",
"the",
"Activity",
"."
] | bf965121bda47d90bcdcf4ef1d651fd9ec42113e | https://github.com/CampaignChain/activity-ezplatform/blob/bf965121bda47d90bcdcf4ef1d651fd9ec42113e/Controller/EZPlatformScheduleHandler.php#L67-L79 |
204,602 | uiii/tense | src/Console/BoxOutputFormatterStyle.php | BoxOutputFormatterStyle.setPadding | public function setPadding($padding = 0) {
$padding = $this->parseSizes($padding);
foreach ($padding as $side => $value) {
if (! is_int($value) || $value < 0) {
throw new InvalidArgumentException(sprintf(
'Invalid %s padding: "%s". Must be a positive integer value.',
$side, $value
));
}
... | php | public function setPadding($padding = 0) {
$padding = $this->parseSizes($padding);
foreach ($padding as $side => $value) {
if (! is_int($value) || $value < 0) {
throw new InvalidArgumentException(sprintf(
'Invalid %s padding: "%s". Must be a positive integer value.',
$side, $value
));
}
... | [
"public",
"function",
"setPadding",
"(",
"$",
"padding",
"=",
"0",
")",
"{",
"$",
"padding",
"=",
"$",
"this",
"->",
"parseSizes",
"(",
"$",
"padding",
")",
";",
"foreach",
"(",
"$",
"padding",
"as",
"$",
"side",
"=>",
"$",
"value",
")",
"{",
"if",... | Sets style padding.
@param array|int $padding The padding value/s | [
"Sets",
"style",
"padding",
"."
] | e5fb4d123f41dbf23796b445389b966c8de2bae1 | https://github.com/uiii/tense/blob/e5fb4d123f41dbf23796b445389b966c8de2bae1/src/Console/BoxOutputFormatterStyle.php#L102-L115 |
204,603 | uiii/tense | src/Console/BoxOutputFormatterStyle.php | BoxOutputFormatterStyle.setMargin | public function setMargin($margin = 0) {
$margin = $this->parseSizes($margin);
foreach ($margin as $side => $value) {
if (! is_int($value) || $value < 0) {
throw new InvalidArgumentException(sprintf(
'Invalid %s margin: "%s". Must be a positive integer value.',
$side, $value
));
}
$this... | php | public function setMargin($margin = 0) {
$margin = $this->parseSizes($margin);
foreach ($margin as $side => $value) {
if (! is_int($value) || $value < 0) {
throw new InvalidArgumentException(sprintf(
'Invalid %s margin: "%s". Must be a positive integer value.',
$side, $value
));
}
$this... | [
"public",
"function",
"setMargin",
"(",
"$",
"margin",
"=",
"0",
")",
"{",
"$",
"margin",
"=",
"$",
"this",
"->",
"parseSizes",
"(",
"$",
"margin",
")",
";",
"foreach",
"(",
"$",
"margin",
"as",
"$",
"side",
"=>",
"$",
"value",
")",
"{",
"if",
"(... | Sets style margin.
@param array|int $margin The margin value/s | [
"Sets",
"style",
"margin",
"."
] | e5fb4d123f41dbf23796b445389b966c8de2bae1 | https://github.com/uiii/tense/blob/e5fb4d123f41dbf23796b445389b966c8de2bae1/src/Console/BoxOutputFormatterStyle.php#L122-L135 |
204,604 | wigedev/farm | src/Validator/Validator/Validator.php | Validator.quickValidate | public static function quickValidate(?string $value, array $constraints = [])
{
// Initialize the validator
$validator = new static('quickValidate function', InputFieldTypes::PASSED, [], $value, null);
// Add the constraints
if (is_array($constraints) && count($constraints) > 0) {
... | php | public static function quickValidate(?string $value, array $constraints = [])
{
// Initialize the validator
$validator = new static('quickValidate function', InputFieldTypes::PASSED, [], $value, null);
// Add the constraints
if (is_array($constraints) && count($constraints) > 0) {
... | [
"public",
"static",
"function",
"quickValidate",
"(",
"?",
"string",
"$",
"value",
",",
"array",
"$",
"constraints",
"=",
"[",
"]",
")",
"{",
"// Initialize the validator",
"$",
"validator",
"=",
"new",
"static",
"(",
"'quickValidate function'",
",",
"InputField... | Validates input as a one-off. Allows quick and dirty validation. Returns null if the value is not valid.
TODO: Decide should this just return true/false if the value is/not valid?
@param string $value The value to test
@param array $constraints The definition of the constraints
@return mixed The value if valid
@throw... | [
"Validates",
"input",
"as",
"a",
"one",
"-",
"off",
".",
"Allows",
"quick",
"and",
"dirty",
"validation",
".",
"Returns",
"null",
"if",
"the",
"value",
"is",
"not",
"valid",
"."
] | 7a1729ec78628b7e5435e4a42e42d547a07af851 | https://github.com/wigedev/farm/blob/7a1729ec78628b7e5435e4a42e42d547a07af851/src/Validator/Validator/Validator.php#L51-L73 |
204,605 | wigedev/farm | src/Validator/Validator/Validator.php | Validator.addConstraint | public function addConstraint(Constraint $constraint) : void
{
$constraint->setValidator($this);
array_push($this->constraints, $constraint);
} | php | public function addConstraint(Constraint $constraint) : void
{
$constraint->setValidator($this);
array_push($this->constraints, $constraint);
} | [
"public",
"function",
"addConstraint",
"(",
"Constraint",
"$",
"constraint",
")",
":",
"void",
"{",
"$",
"constraint",
"->",
"setValidator",
"(",
"$",
"this",
")",
";",
"array_push",
"(",
"$",
"this",
"->",
"constraints",
",",
"$",
"constraint",
")",
";",
... | Add a constraint to the validator
@param Constraint $constraint | [
"Add",
"a",
"constraint",
"to",
"the",
"validator"
] | 7a1729ec78628b7e5435e4a42e42d547a07af851 | https://github.com/wigedev/farm/blob/7a1729ec78628b7e5435e4a42e42d547a07af851/src/Validator/Validator/Validator.php#L125-L129 |
204,606 | wigedev/farm | src/Validator/Validator/Validator.php | Validator.reportError | public function reportError(string $error_message) : void
{
$error_message = sprintf($error_message, $this->field_name);
if (null != $this->validation_set) {
$this->validation_set->addValidationError(new ValidationError($this->field_name, $error_message));
}
} | php | public function reportError(string $error_message) : void
{
$error_message = sprintf($error_message, $this->field_name);
if (null != $this->validation_set) {
$this->validation_set->addValidationError(new ValidationError($this->field_name, $error_message));
}
} | [
"public",
"function",
"reportError",
"(",
"string",
"$",
"error_message",
")",
":",
"void",
"{",
"$",
"error_message",
"=",
"sprintf",
"(",
"$",
"error_message",
",",
"$",
"this",
"->",
"field_name",
")",
";",
"if",
"(",
"null",
"!=",
"$",
"this",
"->",
... | Report the error message to validation set
@param string $error_message The error message to report | [
"Report",
"the",
"error",
"message",
"to",
"validation",
"set"
] | 7a1729ec78628b7e5435e4a42e42d547a07af851 | https://github.com/wigedev/farm/blob/7a1729ec78628b7e5435e4a42e42d547a07af851/src/Validator/Validator/Validator.php#L164-L170 |
204,607 | wigedev/farm | src/Validator/Validator/Validator.php | Validator.validate | public function validate() : void
{
$this->value = null;
$value = $this->filter($this->raw_value);
if (true === $this->checkValidity($value)) {
$this->is_valid = true;
} else {
$this->is_valid = false;
$this->reportError($this->error_message);
... | php | public function validate() : void
{
$this->value = null;
$value = $this->filter($this->raw_value);
if (true === $this->checkValidity($value)) {
$this->is_valid = true;
} else {
$this->is_valid = false;
$this->reportError($this->error_message);
... | [
"public",
"function",
"validate",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"value",
"=",
"null",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"filter",
"(",
"$",
"this",
"->",
"raw_value",
")",
";",
"if",
"(",
"true",
"===",
"$",
"this",
"->"... | Do the validation. This process starts by filtering the value, then checks the validity, and finally checks
the constraints. | [
"Do",
"the",
"validation",
".",
"This",
"process",
"starts",
"by",
"filtering",
"the",
"value",
"then",
"checks",
"the",
"validity",
"and",
"finally",
"checks",
"the",
"constraints",
"."
] | 7a1729ec78628b7e5435e4a42e42d547a07af851 | https://github.com/wigedev/farm/blob/7a1729ec78628b7e5435e4a42e42d547a07af851/src/Validator/Validator/Validator.php#L223-L248 |
204,608 | yii2lab/yii2-rbac | src/domain/repositories/traits/AssignmentTrait.php | AssignmentTrait.getAssignments | public function getAssignments($userId) {
if(empty($userId)) {
return [];
}
$roles = $this->allRoleNamesByUserId($userId);
return AssignmentHelper::forge($userId, $roles);
} | php | public function getAssignments($userId) {
if(empty($userId)) {
return [];
}
$roles = $this->allRoleNamesByUserId($userId);
return AssignmentHelper::forge($userId, $roles);
} | [
"public",
"function",
"getAssignments",
"(",
"$",
"userId",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"userId",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"roles",
"=",
"$",
"this",
"->",
"allRoleNamesByUserId",
"(",
"$",
"userId",
")",
";",
"... | Returns all role assignment information for the specified user.
@param string|int $userId the user ID (see [[\yii\web\User::id]])
@return Assignment[] the assignments indexed by role names. An empty array will be
returned if there is no role assigned to the user. | [
"Returns",
"all",
"role",
"assignment",
"information",
"for",
"the",
"specified",
"user",
"."
] | e72ac0359af660690c161451f864208b2d20919d | https://github.com/yii2lab/yii2-rbac/blob/e72ac0359af660690c161451f864208b2d20919d/src/domain/repositories/traits/AssignmentTrait.php#L114-L120 |
204,609 | yii2lab/yii2-rbac | src/domain/repositories/traits/AssignmentTrait.php | AssignmentTrait.revoke | public function revoke($role, $userId) {
$userId = $this->getId($userId);
$entity = \App::$domain->account->login->oneById($userId);
$this->model->deleteAll(['user_id' => $userId, 'item_name' => $role]);
} | php | public function revoke($role, $userId) {
$userId = $this->getId($userId);
$entity = \App::$domain->account->login->oneById($userId);
$this->model->deleteAll(['user_id' => $userId, 'item_name' => $role]);
} | [
"public",
"function",
"revoke",
"(",
"$",
"role",
",",
"$",
"userId",
")",
"{",
"$",
"userId",
"=",
"$",
"this",
"->",
"getId",
"(",
"$",
"userId",
")",
";",
"$",
"entity",
"=",
"\\",
"App",
"::",
"$",
"domain",
"->",
"account",
"->",
"login",
"-... | Revokes a role from a user.
@param Role|Permission $role
@param string|int $userId the user ID (see [[\yii\web\User::id]])
@return bool whether the revoking is successful | [
"Revokes",
"a",
"role",
"from",
"a",
"user",
"."
] | e72ac0359af660690c161451f864208b2d20919d | https://github.com/yii2lab/yii2-rbac/blob/e72ac0359af660690c161451f864208b2d20919d/src/domain/repositories/traits/AssignmentTrait.php#L151-L155 |
204,610 | cyberspectrum/i18n-contao | src/Mapping/Terminal42ChangeLanguage/MapBuilder.php | MapBuilder.getPageMap | private function getPageMap(string $sourceLanguage, string $targetLanguage): PageMap
{
if (!array_key_exists($key = $sourceLanguage . '->' . $targetLanguage, $this->pageMaps)) {
return $this->pageMaps[$key] = new PageMap(
$sourceLanguage,
$targetLanguage,
... | php | private function getPageMap(string $sourceLanguage, string $targetLanguage): PageMap
{
if (!array_key_exists($key = $sourceLanguage . '->' . $targetLanguage, $this->pageMaps)) {
return $this->pageMaps[$key] = new PageMap(
$sourceLanguage,
$targetLanguage,
... | [
"private",
"function",
"getPageMap",
"(",
"string",
"$",
"sourceLanguage",
",",
"string",
"$",
"targetLanguage",
")",
":",
"PageMap",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
"=",
"$",
"sourceLanguage",
".",
"'->'",
".",
"$",
"targetLanguage... | Retrieve pageMap.
@param string $sourceLanguage The source language.
@param string $targetLanguage The target language.
@return PageMap | [
"Retrieve",
"pageMap",
"."
] | 038cf6ea9c609a734d7476fba256bc4b0db236b7 | https://github.com/cyberspectrum/i18n-contao/blob/038cf6ea9c609a734d7476fba256bc4b0db236b7/src/Mapping/Terminal42ChangeLanguage/MapBuilder.php#L133-L145 |
204,611 | cyberspectrum/i18n-contao | src/Mapping/Terminal42ChangeLanguage/MapBuilder.php | MapBuilder.getArticleMap | private function getArticleMap(string $sourceLanguage, string $targetLanguage): ArticleMap
{
if (!array_key_exists($key = $sourceLanguage . '->' . $targetLanguage, $this->articleMaps)) {
return $this->articleMaps[$key] = new ArticleMap(
$this->getPageMap($sourceLanguage, $targetL... | php | private function getArticleMap(string $sourceLanguage, string $targetLanguage): ArticleMap
{
if (!array_key_exists($key = $sourceLanguage . '->' . $targetLanguage, $this->articleMaps)) {
return $this->articleMaps[$key] = new ArticleMap(
$this->getPageMap($sourceLanguage, $targetL... | [
"private",
"function",
"getArticleMap",
"(",
"string",
"$",
"sourceLanguage",
",",
"string",
"$",
"targetLanguage",
")",
":",
"ArticleMap",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
"=",
"$",
"sourceLanguage",
".",
"'->'",
".",
"$",
"targetLa... | Retrieve article map.
@param string $sourceLanguage The source language.
@param string $targetLanguage The target language.
@return ArticleMap | [
"Retrieve",
"article",
"map",
"."
] | 038cf6ea9c609a734d7476fba256bc4b0db236b7 | https://github.com/cyberspectrum/i18n-contao/blob/038cf6ea9c609a734d7476fba256bc4b0db236b7/src/Mapping/Terminal42ChangeLanguage/MapBuilder.php#L155-L165 |
204,612 | cyberspectrum/i18n-contao | src/Mapping/Terminal42ChangeLanguage/MapBuilder.php | MapBuilder.getArticleContentMap | private function getArticleContentMap(string $sourceLanguage, string $targetLanguage): ArticleContentMap
{
if (!array_key_exists($key = $sourceLanguage . '->' . $targetLanguage, $this->articleContentMaps)) {
return $this->articleContentMaps[$key] = new ArticleContentMap(
$this->g... | php | private function getArticleContentMap(string $sourceLanguage, string $targetLanguage): ArticleContentMap
{
if (!array_key_exists($key = $sourceLanguage . '->' . $targetLanguage, $this->articleContentMaps)) {
return $this->articleContentMaps[$key] = new ArticleContentMap(
$this->g... | [
"private",
"function",
"getArticleContentMap",
"(",
"string",
"$",
"sourceLanguage",
",",
"string",
"$",
"targetLanguage",
")",
":",
"ArticleContentMap",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
"=",
"$",
"sourceLanguage",
".",
"'->'",
".",
"$... | Retrieve article content map.
@param string $sourceLanguage The source language.
@param string $targetLanguage The target language.
@return ArticleContentMap | [
"Retrieve",
"article",
"content",
"map",
"."
] | 038cf6ea9c609a734d7476fba256bc4b0db236b7 | https://github.com/cyberspectrum/i18n-contao/blob/038cf6ea9c609a734d7476fba256bc4b0db236b7/src/Mapping/Terminal42ChangeLanguage/MapBuilder.php#L175-L185 |
204,613 | 3ev/wordpress-core | src/Tev/Field/Model/TaxonomyField.php | TaxonomyField.getValue | public function getValue()
{
$terms = $this->base['value'];
if (is_array($terms)) {
$ret = array();
foreach ($terms as $t) {
$ret[] = $this->termFactory->create($t, $this->taxonomy());
}
return $ret;
} elseif (is_object($term... | php | public function getValue()
{
$terms = $this->base['value'];
if (is_array($terms)) {
$ret = array();
foreach ($terms as $t) {
$ret[] = $this->termFactory->create($t, $this->taxonomy());
}
return $ret;
} elseif (is_object($term... | [
"public",
"function",
"getValue",
"(",
")",
"{",
"$",
"terms",
"=",
"$",
"this",
"->",
"base",
"[",
"'value'",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"terms",
")",
")",
"{",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"ter... | Get Term or array of Terms.
@return \Tev\Term\Model\Term|\Tev\Term\Model\Term[]|null | [
"Get",
"Term",
"or",
"array",
"of",
"Terms",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Field/Model/TaxonomyField.php#L59-L80 |
204,614 | 3ev/wordpress-core | src/Tev/Field/Model/TaxonomyField.php | TaxonomyField.taxonomy | public function taxonomy()
{
if ($this->_taxonomy === null) {
$this->_taxonomy = $this->taxonomyFactory->create($this->base['taxonomy']);
}
return $this->_taxonomy;
} | php | public function taxonomy()
{
if ($this->_taxonomy === null) {
$this->_taxonomy = $this->taxonomyFactory->create($this->base['taxonomy']);
}
return $this->_taxonomy;
} | [
"public",
"function",
"taxonomy",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_taxonomy",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_taxonomy",
"=",
"$",
"this",
"->",
"taxonomyFactory",
"->",
"create",
"(",
"$",
"this",
"->",
"base",
"[",
"'tax... | Get Term Taxonomy.
@return \Tev\Taxonomy\Model\Taxonomy | [
"Get",
"Term",
"Taxonomy",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Field/Model/TaxonomyField.php#L87-L94 |
204,615 | as3io/symfony-data-importer | src/Import/Persister.php | Persister.getWriteMode | final public function getWriteMode()
{
switch ($this->getDataMode()) {
case Configuration::DATA_MODE_WIPE:
case Configuration::DATA_MODE_PROGRESSIVE:
$this->setWriteMode(static::WRITE_MODE_INSERT);
break;
default:
$this->set... | php | final public function getWriteMode()
{
switch ($this->getDataMode()) {
case Configuration::DATA_MODE_WIPE:
case Configuration::DATA_MODE_PROGRESSIVE:
$this->setWriteMode(static::WRITE_MODE_INSERT);
break;
default:
$this->set... | [
"final",
"public",
"function",
"getWriteMode",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getDataMode",
"(",
")",
")",
"{",
"case",
"Configuration",
"::",
"DATA_MODE_WIPE",
":",
"case",
"Configuration",
"::",
"DATA_MODE_PROGRESSIVE",
":",
"$",
"this",
... | Returns the current write mode
@return string | [
"Returns",
"the",
"current",
"write",
"mode"
] | 33383e38f20f6b7a4b83da619bd028ac84ced579 | https://github.com/as3io/symfony-data-importer/blob/33383e38f20f6b7a4b83da619bd028ac84ced579/src/Import/Persister.php#L128-L139 |
204,616 | as3io/symfony-data-importer | src/Import/Persister.php | Persister.batchUpdate | final public function batchUpdate($scn, array $criteria, array $update)
{
return $this->getCollectionForModel($scn)->update($criteria, $update, ['multiple' => true]);
} | php | final public function batchUpdate($scn, array $criteria, array $update)
{
return $this->getCollectionForModel($scn)->update($criteria, $update, ['multiple' => true]);
} | [
"final",
"public",
"function",
"batchUpdate",
"(",
"$",
"scn",
",",
"array",
"$",
"criteria",
",",
"array",
"$",
"update",
")",
"{",
"return",
"$",
"this",
"->",
"getCollectionForModel",
"(",
"$",
"scn",
")",
"->",
"update",
"(",
"$",
"criteria",
",",
... | Performs a batch update
@param string $scn
@param array $criteria The targeting parameters
@param array $update The modifications to make to the targeted documents | [
"Performs",
"a",
"batch",
"update"
] | 33383e38f20f6b7a4b83da619bd028ac84ced579 | https://github.com/as3io/symfony-data-importer/blob/33383e38f20f6b7a4b83da619bd028ac84ced579/src/Import/Persister.php#L197-L200 |
204,617 | as3io/symfony-data-importer | src/Import/Persister.php | Persister.doUpsert | final protected function doUpsert($scn, array $kvs)
{
$upsertKey = isset($kvs['external']) ? 'external' : 'legacy';
$upsertNs = 'legacy' === $upsertKey ? 'source' : 'namespace';
$upsertId = 'legacy' === $upsertKey ? 'id' : 'identifier';
$update = ['$set' => $kvs];
if (!iss... | php | final protected function doUpsert($scn, array $kvs)
{
$upsertKey = isset($kvs['external']) ? 'external' : 'legacy';
$upsertNs = 'legacy' === $upsertKey ? 'source' : 'namespace';
$upsertId = 'legacy' === $upsertKey ? 'id' : 'identifier';
$update = ['$set' => $kvs];
if (!iss... | [
"final",
"protected",
"function",
"doUpsert",
"(",
"$",
"scn",
",",
"array",
"$",
"kvs",
")",
"{",
"$",
"upsertKey",
"=",
"isset",
"(",
"$",
"kvs",
"[",
"'external'",
"]",
")",
"?",
"'external'",
":",
"'legacy'",
";",
"$",
"upsertNs",
"=",
"'legacy'",
... | Handles a single document upsert
@param string $scn The model type
@param array $kvs The model's keyValues.
@return array The upserted modelValues | [
"Handles",
"a",
"single",
"document",
"upsert"
] | 33383e38f20f6b7a4b83da619bd028ac84ced579 | https://github.com/as3io/symfony-data-importer/blob/33383e38f20f6b7a4b83da619bd028ac84ced579/src/Import/Persister.php#L259-L293 |
204,618 | as3io/symfony-data-importer | src/Import/Persister.php | Persister.setWriteMode | final protected function setWriteMode($mode)
{
if (!in_array($mode, [static::WRITE_MODE_INSERT, static::WRITE_MODE_UPSERT, static::WRITE_MODE_UPDATE])) {
throw new \InvalidArgumentException(sprintf('Passed write mode "%s" is invalid!', $mode));
}
$this->writeMode = $mode;
} | php | final protected function setWriteMode($mode)
{
if (!in_array($mode, [static::WRITE_MODE_INSERT, static::WRITE_MODE_UPSERT, static::WRITE_MODE_UPDATE])) {
throw new \InvalidArgumentException(sprintf('Passed write mode "%s" is invalid!', $mode));
}
$this->writeMode = $mode;
} | [
"final",
"protected",
"function",
"setWriteMode",
"(",
"$",
"mode",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"mode",
",",
"[",
"static",
"::",
"WRITE_MODE_INSERT",
",",
"static",
"::",
"WRITE_MODE_UPSERT",
",",
"static",
"::",
"WRITE_MODE_UPDATE",
"]"... | Sets the current write mode
@param string $mode The write mode to use. | [
"Sets",
"the",
"current",
"write",
"mode"
] | 33383e38f20f6b7a4b83da619bd028ac84ced579 | https://github.com/as3io/symfony-data-importer/blob/33383e38f20f6b7a4b83da619bd028ac84ced579/src/Import/Persister.php#L311-L317 |
204,619 | Phpillip/phpillip | src/EventListener/ContentConverterListener.php | ContentConverterListener.onKernelController | public function onKernelController(FilterControllerEvent $event)
{
$request = $event->getRequest();
$route = $this->routes->get($request->attributes->get('_route'));
if ($route && $route->hasContent()) {
$this->populateContent($route, $request);
}
} | php | public function onKernelController(FilterControllerEvent $event)
{
$request = $event->getRequest();
$route = $this->routes->get($request->attributes->get('_route'));
if ($route && $route->hasContent()) {
$this->populateContent($route, $request);
}
} | [
"public",
"function",
"onKernelController",
"(",
"FilterControllerEvent",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"$",
"route",
"=",
"$",
"this",
"->",
"routes",
"->",
"get",
"(",
"$",
"request",
"->"... | Handler Kernel Controller events
@param FilterControllerEvent $event | [
"Handler",
"Kernel",
"Controller",
"events"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/EventListener/ContentConverterListener.php#L60-L68 |
204,620 | tarsana/syntax | src/ObjectSyntax.php | ObjectSyntax.fields | public function fields($value = null)
{
if (null === $value) {
return $this->fields;
}
$this->fields = $value;
return $this;
} | php | public function fields($value = null)
{
if (null === $value) {
return $this->fields;
}
$this->fields = $value;
return $this;
} | [
"public",
"function",
"fields",
"(",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"value",
")",
"{",
"return",
"$",
"this",
"->",
"fields",
";",
"}",
"$",
"this",
"->",
"fields",
"=",
"$",
"value",
";",
"return",
"$",
"this... | Fields getter and setter.
@param array $value
@return mixed | [
"Fields",
"getter",
"and",
"setter",
"."
] | fd3f8a25e3be0e391c8fd486ccfcffe913ade534 | https://github.com/tarsana/syntax/blob/fd3f8a25e3be0e391c8fd486ccfcffe913ade534/src/ObjectSyntax.php#L81-L88 |
204,621 | tarsana/syntax | src/ObjectSyntax.php | ObjectSyntax.field | public function field(string $name, Syntax $value = null)
{
if ($value === null) {
$names = explode('.', $name);
$syntax = $this;
foreach ($names as $field) {
while (method_exists($syntax, 'syntax')) {
$syntax = $syntax->syntax();
... | php | public function field(string $name, Syntax $value = null)
{
if ($value === null) {
$names = explode('.', $name);
$syntax = $this;
foreach ($names as $field) {
while (method_exists($syntax, 'syntax')) {
$syntax = $syntax->syntax();
... | [
"public",
"function",
"field",
"(",
"string",
"$",
"name",
",",
"Syntax",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"$",
"names",
"=",
"explode",
"(",
"'.'",
",",
"$",
"name",
")",
";",
"$",
"syntax",
... | Setter and getter of a specific field.
@param string $name
@param Tarsana\Syntax\Syntax|null $value
@return Tarsana\Syntax\Syntax|self
@throws InvalidArgumentException | [
"Setter",
"and",
"getter",
"of",
"a",
"specific",
"field",
"."
] | fd3f8a25e3be0e391c8fd486ccfcffe913ade534 | https://github.com/tarsana/syntax/blob/fd3f8a25e3be0e391c8fd486ccfcffe913ade534/src/ObjectSyntax.php#L99-L119 |
204,622 | tarsana/syntax | src/ObjectSyntax.php | ObjectSyntax.clearValues | protected function clearValues()
{
$this->values = [];
foreach ($this->fields as $name => $syntax) {
$this->values[$name] = (object) [
'value' => null,
'error' => static::MISSING_FIELD
];
}
} | php | protected function clearValues()
{
$this->values = [];
foreach ($this->fields as $name => $syntax) {
$this->values[$name] = (object) [
'value' => null,
'error' => static::MISSING_FIELD
];
}
} | [
"protected",
"function",
"clearValues",
"(",
")",
"{",
"$",
"this",
"->",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"name",
"=>",
"$",
"syntax",
")",
"{",
"$",
"this",
"->",
"values",
"[",
"$",
"name",
... | Clears the parsed values.
@return void | [
"Clears",
"the",
"parsed",
"values",
"."
] | fd3f8a25e3be0e391c8fd486ccfcffe913ade534 | https://github.com/tarsana/syntax/blob/fd3f8a25e3be0e391c8fd486ccfcffe913ade534/src/ObjectSyntax.php#L152-L161 |
204,623 | tarsana/syntax | src/ObjectSyntax.php | ObjectSyntax.dump | public function dump($value) : string
{
$value = (array) $value;
$result = [];
$current = '';
$missingField = false;
try {
foreach ($this->fields as $name => $syntax) {
$current = $name;
if (!array_key_exists($name, $value)) {
... | php | public function dump($value) : string
{
$value = (array) $value;
$result = [];
$current = '';
$missingField = false;
try {
foreach ($this->fields as $name => $syntax) {
$current = $name;
if (!array_key_exists($name, $value)) {
... | [
"public",
"function",
"dump",
"(",
"$",
"value",
")",
":",
"string",
"{",
"$",
"value",
"=",
"(",
"array",
")",
"$",
"value",
";",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"current",
"=",
"''",
";",
"$",
"missingField",
"=",
"false",
";",
"try",
... | Transforms an object to a string based
on the fields or throws a DumpException.
@param mixed $value
@return string
@throws Tarsana\Syntax\Exceptions\DumpException | [
"Transforms",
"an",
"object",
"to",
"a",
"string",
"based",
"on",
"the",
"fields",
"or",
"throws",
"a",
"DumpException",
"."
] | fd3f8a25e3be0e391c8fd486ccfcffe913ade534 | https://github.com/tarsana/syntax/blob/fd3f8a25e3be0e391c8fd486ccfcffe913ade534/src/ObjectSyntax.php#L250-L273 |
204,624 | valu-digital/valuso | src/ValuSo/Feature/OptionsTrait.php | OptionsTrait.setOptions | public function setOptions($options)
{
if (!is_array($options) && !$options instanceof \Traversable) {
throw new \InvalidArgumentException(sprintf(
'Parameter provided to %s must be an array or Traversable',
__METHOD__
));
}
... | php | public function setOptions($options)
{
if (!is_array($options) && !$options instanceof \Traversable) {
throw new \InvalidArgumentException(sprintf(
'Parameter provided to %s must be an array or Traversable',
__METHOD__
));
}
... | [
"public",
"function",
"setOptions",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
")",
"&&",
"!",
"$",
"options",
"instanceof",
"\\",
"Traversable",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf... | Set service options from array or traversable object
@param array|Traversable $options
@return \stdClass
@ValuSo\Exclude | [
"Set",
"service",
"options",
"from",
"array",
"or",
"traversable",
"object"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Feature/OptionsTrait.php#L22-L36 |
204,625 | valu-digital/valuso | src/ValuSo/Feature/OptionsTrait.php | OptionsTrait.getOptions | public function getOptions()
{
if(!$this->options){
if (isset($this->optionsClass)) {
$this->options = new $this->optionsClass(array());
} else {
$this->options = new Options(array());
}
}
return $this->options;
} | php | public function getOptions()
{
if(!$this->options){
if (isset($this->optionsClass)) {
$this->options = new $this->optionsClass(array());
} else {
$this->options = new Options(array());
}
}
return $this->options;
} | [
"public",
"function",
"getOptions",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"optionsClass",
")",
")",
"{",
"$",
"this",
"->",
"options",
"=",
"new",
"$",
"this",
"->",
"op... | Retrieve service options
@return \Zend\Stdlib\ParameterObjectInterface
@ValuSo\Exclude | [
"Retrieve",
"service",
"options"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Feature/OptionsTrait.php#L45-L56 |
204,626 | valu-digital/valuso | src/ValuSo/Feature/OptionsTrait.php | OptionsTrait.getOption | public function getOption($key, $default = null)
{
if ($this->hasOption($key)) {
return $this->getOptions()->__get($key);
}
return $default;
} | php | public function getOption($key, $default = null)
{
if ($this->hasOption($key)) {
return $this->getOptions()->__get($key);
}
return $default;
} | [
"public",
"function",
"getOption",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasOption",
"(",
"$",
"key",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getOptions",
"(",
")",
"->",
"__get",
"(",
"$... | Retrieve a single option
@param string $key
@return mixed
@ValuSo\Exclude | [
"Retrieve",
"a",
"single",
"option"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Feature/OptionsTrait.php#L94-L101 |
204,627 | valu-digital/valuso | src/ValuSo/Feature/OptionsTrait.php | OptionsTrait.setConfig | public function setConfig($config)
{
if(is_string($config)){
if (file_exists($config)) {
$config = \Zend\Config\Factory::fromFile($config);
} else {
throw new \InvalidArgumentException(
sprintf('Unable to read configurations from fi... | php | public function setConfig($config)
{
if(is_string($config)){
if (file_exists($config)) {
$config = \Zend\Config\Factory::fromFile($config);
} else {
throw new \InvalidArgumentException(
sprintf('Unable to read configurations from fi... | [
"public",
"function",
"setConfig",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"config",
")",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"config",
")",
")",
"{",
"$",
"config",
"=",
"\\",
"Zend",
"\\",
"Config",
"\\",
"Factor... | Set options as config file, array or traversable
object
@param string|array|\Traversable $config
@ValuSo\Exclude | [
"Set",
"options",
"as",
"config",
"file",
"array",
"or",
"traversable",
"object"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Feature/OptionsTrait.php#L124-L142 |
204,628 | JDGrimes/wp-filesystem-mock | src/wp-mock-filesystem.php | WP_Mock_Filesystem.normalize_path | protected function normalize_path( $path ) {
$path = str_replace( '\\', '/', $path );
$path = preg_replace( '|/+|','/', $path );
return rtrim( $path, '/' );
} | php | protected function normalize_path( $path ) {
$path = str_replace( '\\', '/', $path );
$path = preg_replace( '|/+|','/', $path );
return rtrim( $path, '/' );
} | [
"protected",
"function",
"normalize_path",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"str_replace",
"(",
"'\\\\'",
",",
"'/'",
",",
"$",
"path",
")",
";",
"$",
"path",
"=",
"preg_replace",
"(",
"'|/+|'",
",",
"'/'",
",",
"$",
"path",
")",
";",
... | Normalize a path.
@since 0.1.0
@param string $path The path to normalize.
@return string The normalized path. | [
"Normalize",
"a",
"path",
"."
] | 986df3bfeb1554ae19856537dfeb558037275c25 | https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L53-L59 |
204,629 | JDGrimes/wp-filesystem-mock | src/wp-mock-filesystem.php | WP_Mock_Filesystem.get_file | protected function get_file( $file ) {
$path_parts = $this->parse_path( $file );
if ( '' === $path_parts[0] ) {
$file = $this->root;
unset( $path_parts[0] );
} else {
$file = $this->cwd;
}
foreach ( $path_parts as $part ) {
if ( '' === $part ) {
continue;
}
if ( 'dir' !== $file->typ... | php | protected function get_file( $file ) {
$path_parts = $this->parse_path( $file );
if ( '' === $path_parts[0] ) {
$file = $this->root;
unset( $path_parts[0] );
} else {
$file = $this->cwd;
}
foreach ( $path_parts as $part ) {
if ( '' === $part ) {
continue;
}
if ( 'dir' !== $file->typ... | [
"protected",
"function",
"get_file",
"(",
"$",
"file",
")",
"{",
"$",
"path_parts",
"=",
"$",
"this",
"->",
"parse_path",
"(",
"$",
"file",
")",
";",
"if",
"(",
"''",
"===",
"$",
"path_parts",
"[",
"0",
"]",
")",
"{",
"$",
"file",
"=",
"$",
"this... | Get the data for a file.
@since 0.1.0
@param string $file The file to retrieve.
@return object|false The file data, or false if it does't exist. | [
"Get",
"the",
"data",
"for",
"a",
"file",
"."
] | 986df3bfeb1554ae19856537dfeb558037275c25 | https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L84-L109 |
204,630 | JDGrimes/wp-filesystem-mock | src/wp-mock-filesystem.php | WP_Mock_Filesystem.get_default_atts | protected function get_default_atts( $atts ) {
if ( false === isset( $atts['type'] ) ) {
$atts['type'] = 'file';
}
if ( 'file' === $atts['type'] ) {
$defaults = array( 'contents' => '', 'mode' => 0644, 'size' => 0, );
} elseif ( 'dir' === $atts['type'] ) {
$defaults = array( 'contents' => new stdClas... | php | protected function get_default_atts( $atts ) {
if ( false === isset( $atts['type'] ) ) {
$atts['type'] = 'file';
}
if ( 'file' === $atts['type'] ) {
$defaults = array( 'contents' => '', 'mode' => 0644, 'size' => 0, );
} elseif ( 'dir' === $atts['type'] ) {
$defaults = array( 'contents' => new stdClas... | [
"protected",
"function",
"get_default_atts",
"(",
"$",
"atts",
")",
"{",
"if",
"(",
"false",
"===",
"isset",
"(",
"$",
"atts",
"[",
"'type'",
"]",
")",
")",
"{",
"$",
"atts",
"[",
"'type'",
"]",
"=",
"'file'",
";",
"}",
"if",
"(",
"'file'",
"===",
... | Get the default attributes for a file.
@since 0.1.0
@param string $atts
@return object The attributes. | [
"Get",
"the",
"default",
"attributes",
"for",
"a",
"file",
"."
] | 986df3bfeb1554ae19856537dfeb558037275c25 | https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L120-L150 |
204,631 | JDGrimes/wp-filesystem-mock | src/wp-mock-filesystem.php | WP_Mock_Filesystem.add_file | public function add_file( $file, array $atts = array() ) {
$parent = $this->get_file( dirname( $file ) );
$filename = basename( $file );
if ( false === $parent || true === isset( $parent->contents->$filename ) ) {
return false;
}
$parent->contents->$filename = $this->get_default_atts( $atts );
return... | php | public function add_file( $file, array $atts = array() ) {
$parent = $this->get_file( dirname( $file ) );
$filename = basename( $file );
if ( false === $parent || true === isset( $parent->contents->$filename ) ) {
return false;
}
$parent->contents->$filename = $this->get_default_atts( $atts );
return... | [
"public",
"function",
"add_file",
"(",
"$",
"file",
",",
"array",
"$",
"atts",
"=",
"array",
"(",
")",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"get_file",
"(",
"dirname",
"(",
"$",
"file",
")",
")",
";",
"$",
"filename",
"=",
"basename",
... | Create a file or directory.
@since 0.1.0
@param string $file The path of the file/directory to create.
@param array $atts The attributes of the file/directory.
@return bool True if the file was added, false otherwise. | [
"Create",
"a",
"file",
"or",
"directory",
"."
] | 986df3bfeb1554ae19856537dfeb558037275c25 | https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L175-L187 |
204,632 | JDGrimes/wp-filesystem-mock | src/wp-mock-filesystem.php | WP_Mock_Filesystem.mkdir_p | public function mkdir_p( $file, array $atts = array() ) {
$dir_levels = $this->parse_path( $file );
$path = '';
$atts['type'] = 'dir';
foreach ( $dir_levels as $level ) {
$path .= '/' . $level;
if ( $this->exists( $path ) ) {
continue;
}
if ( ! $this->add_file( $path, $atts ) ) {
retur... | php | public function mkdir_p( $file, array $atts = array() ) {
$dir_levels = $this->parse_path( $file );
$path = '';
$atts['type'] = 'dir';
foreach ( $dir_levels as $level ) {
$path .= '/' . $level;
if ( $this->exists( $path ) ) {
continue;
}
if ( ! $this->add_file( $path, $atts ) ) {
retur... | [
"public",
"function",
"mkdir_p",
"(",
"$",
"file",
",",
"array",
"$",
"atts",
"=",
"array",
"(",
")",
")",
"{",
"$",
"dir_levels",
"=",
"$",
"this",
"->",
"parse_path",
"(",
"$",
"file",
")",
";",
"$",
"path",
"=",
"''",
";",
"$",
"atts",
"[",
... | Create a deep directory.
@since 0.1.0
@param string $file The path of the file/directory to create.
@param array $atts The attributes of the file/directory.
@return bool True if the file was added, false otherwise. | [
"Create",
"a",
"deep",
"directory",
"."
] | 986df3bfeb1554ae19856537dfeb558037275c25 | https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L199-L220 |
204,633 | JDGrimes/wp-filesystem-mock | src/wp-mock-filesystem.php | WP_Mock_Filesystem.get_file_attr | public function get_file_attr( $file, $attr, $type = null ) {
$file_atts = $this->get_file( $file );
if ( false === $file_atts || false === isset( $file_atts->$attr ) ) {
return false;
}
if ( isset( $type ) && $type !== $file_atts->type ) {
return false;
}
return $file_atts->$attr;
} | php | public function get_file_attr( $file, $attr, $type = null ) {
$file_atts = $this->get_file( $file );
if ( false === $file_atts || false === isset( $file_atts->$attr ) ) {
return false;
}
if ( isset( $type ) && $type !== $file_atts->type ) {
return false;
}
return $file_atts->$attr;
} | [
"public",
"function",
"get_file_attr",
"(",
"$",
"file",
",",
"$",
"attr",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"file_atts",
"=",
"$",
"this",
"->",
"get_file",
"(",
"$",
"file",
")",
";",
"if",
"(",
"false",
"===",
"$",
"file_atts",
"||",... | Get a piece of information about a file.
@since 0.1.0
@param string $file The path to the file/directory.
@param string $attr The file attribute to get.
@param string $type The type of file this is expected to be.
@return mixed The value of this attribute, or false on failure. | [
"Get",
"a",
"piece",
"of",
"information",
"about",
"a",
"file",
"."
] | 986df3bfeb1554ae19856537dfeb558037275c25 | https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L246-L259 |
204,634 | JDGrimes/wp-filesystem-mock | src/wp-mock-filesystem.php | WP_Mock_Filesystem.set_file_attr | public function set_file_attr( $file, $attr, $value, $recursive = false ) {
$file_atts = $this->get_file( $file );
if ( false === $file_atts ) {
return false;
}
if ( 'contents' === $attr ) {
if ( 'file' === $file_atts->type ) {
$file_atts->size = mb_strlen( $value, '8bit' );
} else {
return ... | php | public function set_file_attr( $file, $attr, $value, $recursive = false ) {
$file_atts = $this->get_file( $file );
if ( false === $file_atts ) {
return false;
}
if ( 'contents' === $attr ) {
if ( 'file' === $file_atts->type ) {
$file_atts->size = mb_strlen( $value, '8bit' );
} else {
return ... | [
"public",
"function",
"set_file_attr",
"(",
"$",
"file",
",",
"$",
"attr",
",",
"$",
"value",
",",
"$",
"recursive",
"=",
"false",
")",
"{",
"$",
"file_atts",
"=",
"$",
"this",
"->",
"get_file",
"(",
"$",
"file",
")",
";",
"if",
"(",
"false",
"==="... | Set the value of file attribute.
@since 0.1.0
@param string $file The path of the file/directory.
@param string $attr The attribute to set.
@param mixed $value The new value for this attribute.
@param bool $recursive Whether to set the value recursively.
@return bool True if the attribute value was ... | [
"Set",
"the",
"value",
"of",
"file",
"attribute",
"."
] | 986df3bfeb1554ae19856537dfeb558037275c25 | https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L273-L296 |
204,635 | JDGrimes/wp-filesystem-mock | src/wp-mock-filesystem.php | WP_Mock_Filesystem.set_file_attr_recursive | protected function set_file_attr_recursive( $file, $attr, $value ) {
if ( 'dir' === $file->type ) {
foreach ( $file->contents as $sub => $atts ) {
$this->set_file_attr_recursive( $atts, $attr, $value );
}
}
$file->$attr = $value;
} | php | protected function set_file_attr_recursive( $file, $attr, $value ) {
if ( 'dir' === $file->type ) {
foreach ( $file->contents as $sub => $atts ) {
$this->set_file_attr_recursive( $atts, $attr, $value );
}
}
$file->$attr = $value;
} | [
"protected",
"function",
"set_file_attr_recursive",
"(",
"$",
"file",
",",
"$",
"attr",
",",
"$",
"value",
")",
"{",
"if",
"(",
"'dir'",
"===",
"$",
"file",
"->",
"type",
")",
"{",
"foreach",
"(",
"$",
"file",
"->",
"contents",
"as",
"$",
"sub",
"=>"... | Set the value of file attribute recursively.
@since 0.1.0
@param object $file The file data.
@param string $attr The attribute to set.
@param mixed $value The new value for this attribute.
@return bool True if the attribute value was set, false otherwise. | [
"Set",
"the",
"value",
"of",
"file",
"attribute",
"recursively",
"."
] | 986df3bfeb1554ae19856537dfeb558037275c25 | https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L309-L319 |
204,636 | JDGrimes/wp-filesystem-mock | src/wp-mock-filesystem.php | WP_Mock_Filesystem.set_cwd | public function set_cwd( $cwd ) {
$file = $this->get_file( $cwd );
if ( false === $file || 'dir' !== $file->type ) {
return false;
}
$this->cwd = $this->normalize_path( $cwd );
if ( empty( $this->cwd ) ) {
$this->cwd = '/';
}
return true;
} | php | public function set_cwd( $cwd ) {
$file = $this->get_file( $cwd );
if ( false === $file || 'dir' !== $file->type ) {
return false;
}
$this->cwd = $this->normalize_path( $cwd );
if ( empty( $this->cwd ) ) {
$this->cwd = '/';
}
return true;
} | [
"public",
"function",
"set_cwd",
"(",
"$",
"cwd",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"get_file",
"(",
"$",
"cwd",
")",
";",
"if",
"(",
"false",
"===",
"$",
"file",
"||",
"'dir'",
"!==",
"$",
"file",
"->",
"type",
")",
"{",
"return",
... | Set the current working directory.
@since 0.1.0
@param string $cwd The path to the new working directory.
@return bool True if the current working directory was set, false otherwise. | [
"Set",
"the",
"current",
"working",
"directory",
"."
] | 986df3bfeb1554ae19856537dfeb558037275c25 | https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L341-L356 |
204,637 | JDGrimes/wp-filesystem-mock | src/wp-mock-filesystem.php | WP_Mock_Filesystem.copy | public function copy( $source, $destination ) {
$source = $this->get_file( $source );
if ( false === $source ) {
return false;
}
$destination_parent = $this->get_file( dirname( $destination ) );
$filename = basename( $destination );
if ( false === $destination_parent ) {
return false;
}
$dest... | php | public function copy( $source, $destination ) {
$source = $this->get_file( $source );
if ( false === $source ) {
return false;
}
$destination_parent = $this->get_file( dirname( $destination ) );
$filename = basename( $destination );
if ( false === $destination_parent ) {
return false;
}
$dest... | [
"public",
"function",
"copy",
"(",
"$",
"source",
",",
"$",
"destination",
")",
"{",
"$",
"source",
"=",
"$",
"this",
"->",
"get_file",
"(",
"$",
"source",
")",
";",
"if",
"(",
"false",
"===",
"$",
"source",
")",
"{",
"return",
"false",
";",
"}",
... | Copy a file or directory.
The destination will be overwritten if it already exists.
@since 0.1.0
@param string $source The source path.
@param string $destination The destination path.
@return bool True if the file was copied, false otherwise. | [
"Copy",
"a",
"file",
"or",
"directory",
"."
] | 986df3bfeb1554ae19856537dfeb558037275c25 | https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L370-L388 |
204,638 | JDGrimes/wp-filesystem-mock | src/wp-mock-filesystem.php | WP_Mock_Filesystem.move | public function move( $source, $destination ) {
if ( false === $this->copy( $source, $destination ) ) {
return false;
}
$this->delete( $source );
return true;
} | php | public function move( $source, $destination ) {
if ( false === $this->copy( $source, $destination ) ) {
return false;
}
$this->delete( $source );
return true;
} | [
"public",
"function",
"move",
"(",
"$",
"source",
",",
"$",
"destination",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"copy",
"(",
"$",
"source",
",",
"$",
"destination",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
... | Move a file or directory.
@since 0.1.0
@param string $source The source path.
@param string $destination The destination path.
@return bool True if the file was moved, false otherwise. | [
"Move",
"a",
"file",
"or",
"directory",
"."
] | 986df3bfeb1554ae19856537dfeb558037275c25 | https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L400-L409 |
204,639 | IftekherSunny/Planet-Framework | src/Sun/Application.php | Application.run | public function run()
{
$this->make('Sun\Bootstrap\Provider')->registerRoute();
$this->route->register();
$httpMethod = $this->make('Sun\Contracts\Http\Request')->method();
$uri = $this->make('Sun\Contracts\Routing\UrlGenerator')->getUri();
$data = $this->route-... | php | public function run()
{
$this->make('Sun\Bootstrap\Provider')->registerRoute();
$this->route->register();
$httpMethod = $this->make('Sun\Contracts\Http\Request')->method();
$uri = $this->make('Sun\Contracts\Routing\UrlGenerator')->getUri();
$data = $this->route-... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"make",
"(",
"'Sun\\Bootstrap\\Provider'",
")",
"->",
"registerRoute",
"(",
")",
";",
"$",
"this",
"->",
"route",
"->",
"register",
"(",
")",
";",
"$",
"httpMethod",
"=",
"$",
"this",
"->",... | To run application | [
"To",
"run",
"application"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Application.php#L233-L248 |
204,640 | IftekherSunny/Planet-Framework | src/Sun/Application.php | Application.base_path | public function base_path($path = null)
{
return empty($path) ? $this->path : $this->path . $path;
} | php | public function base_path($path = null)
{
return empty($path) ? $this->path : $this->path . $path;
} | [
"public",
"function",
"base_path",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"return",
"empty",
"(",
"$",
"path",
")",
"?",
"$",
"this",
"->",
"path",
":",
"$",
"this",
"->",
"path",
".",
"$",
"path",
";",
"}"
] | To get application base directory path
@param null $path
@return string | [
"To",
"get",
"application",
"base",
"directory",
"path"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Application.php#L257-L260 |
204,641 | IftekherSunny/Planet-Framework | src/Sun/Application.php | Application.app_path | public function app_path($path = null)
{
return empty($path) ? $this->base_path() . DIRECTORY_SEPARATOR . 'app' : $this->base_path() . 'app' . $path;
} | php | public function app_path($path = null)
{
return empty($path) ? $this->base_path() . DIRECTORY_SEPARATOR . 'app' : $this->base_path() . 'app' . $path;
} | [
"public",
"function",
"app_path",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"return",
"empty",
"(",
"$",
"path",
")",
"?",
"$",
"this",
"->",
"base_path",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"'app'",
":",
"$",
"this",
"->",
"base_path",
"(",
")... | To get application app directory path
@param null $path
@return string | [
"To",
"get",
"application",
"app",
"directory",
"path"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Application.php#L269-L272 |
204,642 | IftekherSunny/Planet-Framework | src/Sun/Application.php | Application.loadAlien | public function loadAlien()
{
$alien = $this->config->getAlien();
foreach ($alien as $alias => $namespace) {
class_alias($namespace, $alias);
}
} | php | public function loadAlien()
{
$alien = $this->config->getAlien();
foreach ($alien as $alias => $namespace) {
class_alias($namespace, $alias);
}
} | [
"public",
"function",
"loadAlien",
"(",
")",
"{",
"$",
"alien",
"=",
"$",
"this",
"->",
"config",
"->",
"getAlien",
"(",
")",
";",
"foreach",
"(",
"$",
"alien",
"as",
"$",
"alias",
"=>",
"$",
"namespace",
")",
"{",
"class_alias",
"(",
"$",
"namespace... | To load alien | [
"To",
"load",
"alien"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Application.php#L347-L354 |
204,643 | IftekherSunny/Planet-Framework | src/Sun/Application.php | Application.getNamespace | public function getNamespace()
{
if(!is_null($this->appNamespace)) {
return $this->appNamespace;
}
$composer = json_decode(file_get_contents(base_path().'/composer.json'));
foreach($composer->autoload->{"psr-4"} as $namespace => $path) {
if(realpath... | php | public function getNamespace()
{
if(!is_null($this->appNamespace)) {
return $this->appNamespace;
}
$composer = json_decode(file_get_contents(base_path().'/composer.json'));
foreach($composer->autoload->{"psr-4"} as $namespace => $path) {
if(realpath... | [
"public",
"function",
"getNamespace",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"appNamespace",
")",
")",
"{",
"return",
"$",
"this",
"->",
"appNamespace",
";",
"}",
"$",
"composer",
"=",
"json_decode",
"(",
"file_get_contents",
"... | To get application namespace
@return string
@throws Exception | [
"To",
"get",
"application",
"namespace"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Application.php#L400-L415 |
204,644 | IftekherSunny/Planet-Framework | src/Sun/Application.php | Application.bootstrap | protected function bootstrap()
{
$this->make('Sun\Bootstrap\Application')->bootstrap();
$this->make('Sun\Bootstrap\HandleExceptions')->bootstrap();
$this->make('Sun\Bootstrap\Route')->bootstrap();
$this->make('Sun\Bootstrap\Provider')->bootstrap();
$this->route ... | php | protected function bootstrap()
{
$this->make('Sun\Bootstrap\Application')->bootstrap();
$this->make('Sun\Bootstrap\HandleExceptions')->bootstrap();
$this->make('Sun\Bootstrap\Route')->bootstrap();
$this->make('Sun\Bootstrap\Provider')->bootstrap();
$this->route ... | [
"protected",
"function",
"bootstrap",
"(",
")",
"{",
"$",
"this",
"->",
"make",
"(",
"'Sun\\Bootstrap\\Application'",
")",
"->",
"bootstrap",
"(",
")",
";",
"$",
"this",
"->",
"make",
"(",
"'Sun\\Bootstrap\\HandleExceptions'",
")",
"->",
"bootstrap",
"(",
")",... | Bootstrap application required class | [
"Bootstrap",
"application",
"required",
"class"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Application.php#L434-L445 |
204,645 | IftekherSunny/Planet-Framework | src/Sun/Application.php | Application.registerBindings | protected function registerBindings()
{
$binding = config('binding')?: [];
foreach($binding as $contract => $implementation) {
$this->bind($contract, $implementation);
}
} | php | protected function registerBindings()
{
$binding = config('binding')?: [];
foreach($binding as $contract => $implementation) {
$this->bind($contract, $implementation);
}
} | [
"protected",
"function",
"registerBindings",
"(",
")",
"{",
"$",
"binding",
"=",
"config",
"(",
"'binding'",
")",
"?",
":",
"[",
"]",
";",
"foreach",
"(",
"$",
"binding",
"as",
"$",
"contract",
"=>",
"$",
"implementation",
")",
"{",
"$",
"this",
"->",
... | To register all bindings | [
"To",
"register",
"all",
"bindings"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Application.php#L450-L457 |
204,646 | IftekherSunny/Planet-Framework | src/Sun/Application.php | Application.config | public function config($location)
{
$keys = explode('.', $location);
$filename = 'get' . strtoupper(array_shift($keys));
$location = implode('.', $keys);
if(empty($location)) {
return $this->config->{$filename}();
}
return $this->config->{$... | php | public function config($location)
{
$keys = explode('.', $location);
$filename = 'get' . strtoupper(array_shift($keys));
$location = implode('.', $keys);
if(empty($location)) {
return $this->config->{$filename}();
}
return $this->config->{$... | [
"public",
"function",
"config",
"(",
"$",
"location",
")",
"{",
"$",
"keys",
"=",
"explode",
"(",
"'.'",
",",
"$",
"location",
")",
";",
"$",
"filename",
"=",
"'get'",
".",
"strtoupper",
"(",
"array_shift",
"(",
"$",
"keys",
")",
")",
";",
"$",
"lo... | To get configuration
@param string $location
@return mixed | [
"To",
"get",
"configuration"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Application.php#L466-L479 |
204,647 | stonedz/pff2 | src/Core/HookManager.php | HookManager.registerHook | public function registerHook(IHookProvider $prov, $moduleName, $loadBefore = null) {
$found = false;
if(is_a($prov, '\\pff\\Iface\\IBeforeHook')) {
$found = $this->addHook($this->_beforeController, $prov, $moduleName, $loadBefore);
}
if(is_a($prov, '\\pff\\Iface\\IAfterHook... | php | public function registerHook(IHookProvider $prov, $moduleName, $loadBefore = null) {
$found = false;
if(is_a($prov, '\\pff\\Iface\\IBeforeHook')) {
$found = $this->addHook($this->_beforeController, $prov, $moduleName, $loadBefore);
}
if(is_a($prov, '\\pff\\Iface\\IAfterHook... | [
"public",
"function",
"registerHook",
"(",
"IHookProvider",
"$",
"prov",
",",
"$",
"moduleName",
",",
"$",
"loadBefore",
"=",
"null",
")",
"{",
"$",
"found",
"=",
"false",
";",
"if",
"(",
"is_a",
"(",
"$",
"prov",
",",
"'\\\\pff\\\\Iface\\\\IBeforeHook'",
... | Registers a hook provider
@param IHookProvider $prov Hook provider (module)
@param string $moduleName Name of the module
@param string|null $loadBefore Hook must be run before specified module name
@throws HookException | [
"Registers",
"a",
"hook",
"provider"
] | ec3b087d4d4732816f61ac487f0cb25511e0da88 | https://github.com/stonedz/pff2/blob/ec3b087d4d4732816f61ac487f0cb25511e0da88/src/Core/HookManager.php#L72-L98 |
204,648 | ekyna/AdminBundle | Twig/AdminExtension.php | AdminExtension.renderResourceButton | public function renderResourceButton($resource, $action = 'view', array $options = [], array $attributes = [])
{
if ($this->helper->isGranted($resource, $action)) {
$options = array_merge($this->getButtonOptions($action), $options);
$label = null;
if (array_key_exists('l... | php | public function renderResourceButton($resource, $action = 'view', array $options = [], array $attributes = [])
{
if ($this->helper->isGranted($resource, $action)) {
$options = array_merge($this->getButtonOptions($action), $options);
$label = null;
if (array_key_exists('l... | [
"public",
"function",
"renderResourceButton",
"(",
"$",
"resource",
",",
"$",
"action",
"=",
"'view'",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"helper",
"->"... | Renders a resource action button.
@param mixed $resource
@param string $action
@param array $options
@param array $attributes
@return string | [
"Renders",
"a",
"resource",
"action",
"button",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/Twig/AdminExtension.php#L69-L104 |
204,649 | cityware/city-format | src/Rtf.php | Rtf.isPlainText | function isPlainText($s) {
$arrfailAt = array("*", "fonttbl", "colortbl", "datastore", "themedata");
for ($i = 0; $i < count($arrfailAt); $i++) {
if (!empty($s[$arrfailAt[$i]])) {
return false;
}
}
return true;
} | php | function isPlainText($s) {
$arrfailAt = array("*", "fonttbl", "colortbl", "datastore", "themedata");
for ($i = 0; $i < count($arrfailAt); $i++) {
if (!empty($s[$arrfailAt[$i]])) {
return false;
}
}
return true;
} | [
"function",
"isPlainText",
"(",
"$",
"s",
")",
"{",
"$",
"arrfailAt",
"=",
"array",
"(",
"\"*\"",
",",
"\"fonttbl\"",
",",
"\"colortbl\"",
",",
"\"datastore\"",
",",
"\"themedata\"",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"coun... | For example, there may be a description of font or color palette etc. | [
"For",
"example",
"there",
"may",
"be",
"a",
"description",
"of",
"font",
"or",
"color",
"palette",
"etc",
"."
] | 1e292670639a950ecf561b545462427512950c74 | https://github.com/cityware/city-format/blob/1e292670639a950ecf561b545462427512950c74/src/Rtf.php#L23-L31 |
204,650 | gintonicweb/admin-theme | src/View/Helper/IconsHelper.php | IconsHelper.actions | public function actions($actions)
{
$substitutes = $this->config('substitutes');
foreach ($actions as $name => $config) {
if (array_key_exists($name, $substitutes)) {
$actions[$name]['title'] = '<i class="' . $substitutes[$name] . '"></i>';
}
}
... | php | public function actions($actions)
{
$substitutes = $this->config('substitutes');
foreach ($actions as $name => $config) {
if (array_key_exists($name, $substitutes)) {
$actions[$name]['title'] = '<i class="' . $substitutes[$name] . '"></i>';
}
}
... | [
"public",
"function",
"actions",
"(",
"$",
"actions",
")",
"{",
"$",
"substitutes",
"=",
"$",
"this",
"->",
"config",
"(",
"'substitutes'",
")",
";",
"foreach",
"(",
"$",
"actions",
"as",
"$",
"name",
"=>",
"$",
"config",
")",
"{",
"if",
"(",
"array_... | This method replaces a string by an action icon. Mainly used for action
icons | [
"This",
"method",
"replaces",
"a",
"string",
"by",
"an",
"action",
"icon",
".",
"Mainly",
"used",
"for",
"action",
"icons"
] | 35a3c685c2d4e462ffea022d3d89c2c0ed7104a1 | https://github.com/gintonicweb/admin-theme/blob/35a3c685c2d4e462ffea022d3d89c2c0ed7104a1/src/View/Helper/IconsHelper.php#L24-L35 |
204,651 | leprephp/routing | src/Route.php | Route.allowMethod | public function allowMethod(string $method): Route
{
if (!in_array($method, self::$supportedMethods)) {
throw new UnsupportedMethodException($method);
}
$this->methods[] = $method;
return $this;
} | php | public function allowMethod(string $method): Route
{
if (!in_array($method, self::$supportedMethods)) {
throw new UnsupportedMethodException($method);
}
$this->methods[] = $method;
return $this;
} | [
"public",
"function",
"allowMethod",
"(",
"string",
"$",
"method",
")",
":",
"Route",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"method",
",",
"self",
"::",
"$",
"supportedMethods",
")",
")",
"{",
"throw",
"new",
"UnsupportedMethodException",
"(",
"$",
... | Allows an HTTP method.
@param string $method The HTTP method to allow
@return $this
@throws UnsupportedMethodException If the method is not supported | [
"Allows",
"an",
"HTTP",
"method",
"."
] | c76beb1d6629896be956f4e2ee76dc0e9a6ed0f1 | https://github.com/leprephp/routing/blob/c76beb1d6629896be956f4e2ee76dc0e9a6ed0f1/src/Route.php#L98-L107 |
204,652 | leprephp/routing | src/Route.php | Route.allowMethods | public function allowMethods(array $methods = []): Route
{
$this->methods = [];
foreach ($methods as $method) {
$this->allowMethod($method);
}
return $this;
} | php | public function allowMethods(array $methods = []): Route
{
$this->methods = [];
foreach ($methods as $method) {
$this->allowMethod($method);
}
return $this;
} | [
"public",
"function",
"allowMethods",
"(",
"array",
"$",
"methods",
"=",
"[",
"]",
")",
":",
"Route",
"{",
"$",
"this",
"->",
"methods",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"methods",
"as",
"$",
"method",
")",
"{",
"$",
"this",
"->",
"allowMet... | Allows a list of HTTP methods.
@param string[] $methods The HTTP methods list to allow
@return $this
@throws UnsupportedMethodException If at least one of the methods is not supported | [
"Allows",
"a",
"list",
"of",
"HTTP",
"methods",
"."
] | c76beb1d6629896be956f4e2ee76dc0e9a6ed0f1 | https://github.com/leprephp/routing/blob/c76beb1d6629896be956f4e2ee76dc0e9a6ed0f1/src/Route.php#L116-L124 |
204,653 | leprephp/routing | src/Route.php | Route.getName | public function getName(): string
{
if ($this->name === null) {
$this->name = $this->path;
}
return $this->name;
} | php | public function getName(): string
{
if ($this->name === null) {
$this->name = $this->path;
}
return $this->name;
} | [
"public",
"function",
"getName",
"(",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"name",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"this",
"->",
"path",
";",
"}",
"return",
"$",
"this",
"->",
"name",
";",
"}"
] | Returns the name of the route.
@return string | [
"Returns",
"the",
"name",
"of",
"the",
"route",
"."
] | c76beb1d6629896be956f4e2ee76dc0e9a6ed0f1 | https://github.com/leprephp/routing/blob/c76beb1d6629896be956f4e2ee76dc0e9a6ed0f1/src/Route.php#L154-L161 |
204,654 | keeko/framework | src/foundation/AbstractModule.php | AbstractModule.getFilesPath | public function getFilesPath() {
$repo = $this->getServiceContainer()->getResourceRepository();
if (!$repo->contains($this->getFilesPuliPath())) {
$dir = new Directory($repo->get('/files')->getFilesystemPath());
$path = $dir->toPath()->append('managed/' . $this->model->getName());
$dir = new Directory($pat... | php | public function getFilesPath() {
$repo = $this->getServiceContainer()->getResourceRepository();
if (!$repo->contains($this->getFilesPuliPath())) {
$dir = new Directory($repo->get('/files')->getFilesystemPath());
$path = $dir->toPath()->append('managed/' . $this->model->getName());
$dir = new Directory($pat... | [
"public",
"function",
"getFilesPath",
"(",
")",
"{",
"$",
"repo",
"=",
"$",
"this",
"->",
"getServiceContainer",
"(",
")",
"->",
"getResourceRepository",
"(",
")",
";",
"if",
"(",
"!",
"$",
"repo",
"->",
"contains",
"(",
"$",
"this",
"->",
"getFilesPuliP... | Returns the path for managed files for this module
@return Path | [
"Returns",
"the",
"path",
"for",
"managed",
"files",
"for",
"this",
"module"
] | a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac | https://github.com/keeko/framework/blob/a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac/src/foundation/AbstractModule.php#L111-L122 |
204,655 | keeko/framework | src/foundation/AbstractModule.php | AbstractModule.getFilesUrl | public function getFilesUrl($suffix = '') {
$generator = $this->getServiceContainer()->getUrlGenerator();
return $generator->generateUrl($this->getFilesPuliPath() . '/' . $suffix);
} | php | public function getFilesUrl($suffix = '') {
$generator = $this->getServiceContainer()->getUrlGenerator();
return $generator->generateUrl($this->getFilesPuliPath() . '/' . $suffix);
} | [
"public",
"function",
"getFilesUrl",
"(",
"$",
"suffix",
"=",
"''",
")",
"{",
"$",
"generator",
"=",
"$",
"this",
"->",
"getServiceContainer",
"(",
")",
"->",
"getUrlGenerator",
"(",
")",
";",
"return",
"$",
"generator",
"->",
"generateUrl",
"(",
"$",
"t... | Returns the url for a managed file
@param string $suffix
@return string | [
"Returns",
"the",
"url",
"for",
"a",
"managed",
"file"
] | a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac | https://github.com/keeko/framework/blob/a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac/src/foundation/AbstractModule.php#L130-L133 |
204,656 | keeko/framework | src/foundation/AbstractModule.php | AbstractModule.getPreferences | public function getPreferences() {
if ($this->preferences === null) {
$this->preferences = $this->service->getPreferenceLoader()->getModulePreferences($this->model->getId());
}
return $this->preferences;
} | php | public function getPreferences() {
if ($this->preferences === null) {
$this->preferences = $this->service->getPreferenceLoader()->getModulePreferences($this->model->getId());
}
return $this->preferences;
} | [
"public",
"function",
"getPreferences",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"preferences",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"preferences",
"=",
"$",
"this",
"->",
"service",
"->",
"getPreferenceLoader",
"(",
")",
"->",
"getModulePrefere... | Returns the module's preferences
@return Preferences | [
"Returns",
"the",
"module",
"s",
"preferences"
] | a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac | https://github.com/keeko/framework/blob/a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac/src/foundation/AbstractModule.php#L140-L146 |
204,657 | keeko/framework | src/foundation/AbstractModule.php | AbstractModule.getActionModel | public function getActionModel($actionName) {
if (isset($this->actions[$actionName])) {
return $this->actions[$actionName]['model'];
}
return mull;
} | php | public function getActionModel($actionName) {
if (isset($this->actions[$actionName])) {
return $this->actions[$actionName]['model'];
}
return mull;
} | [
"public",
"function",
"getActionModel",
"(",
"$",
"actionName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"actions",
"[",
"$",
"actionName",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"actions",
"[",
"$",
"actionName",
"]",
"[",
"'m... | Returns the model for the given action name
@param string $actionName
@return Action | [
"Returns",
"the",
"model",
"for",
"the",
"given",
"action",
"name"
] | a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac | https://github.com/keeko/framework/blob/a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac/src/foundation/AbstractModule.php#L175-L181 |
204,658 | keeko/framework | src/foundation/AbstractModule.php | AbstractModule.loadAction | public function loadAction($nameOrAction, $format = null) {
$model = null;
if ($nameOrAction instanceof Action) {
$model = $nameOrAction;
$actionName = $nameOrAction->getName();
} else {
$actionName = $nameOrAction;
}
if (!isset($this->actions[$actionName])) {
throw new ModuleException(sprintf('A... | php | public function loadAction($nameOrAction, $format = null) {
$model = null;
if ($nameOrAction instanceof Action) {
$model = $nameOrAction;
$actionName = $nameOrAction->getName();
} else {
$actionName = $nameOrAction;
}
if (!isset($this->actions[$actionName])) {
throw new ModuleException(sprintf('A... | [
"public",
"function",
"loadAction",
"(",
"$",
"nameOrAction",
",",
"$",
"format",
"=",
"null",
")",
"{",
"$",
"model",
"=",
"null",
";",
"if",
"(",
"$",
"nameOrAction",
"instanceof",
"Action",
")",
"{",
"$",
"model",
"=",
"$",
"nameOrAction",
";",
"$",... | Loads the given action
@param Action|string $actionName
@param string $format the response type (e.g. html, json, ...)
@return AbstractAction | [
"Loads",
"the",
"given",
"action"
] | a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac | https://github.com/keeko/framework/blob/a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac/src/foundation/AbstractModule.php#L190-L277 |
204,659 | keeko/framework | src/foundation/AbstractModule.php | AbstractModule.hasPermission | public function hasPermission($action, User $user = null) {
return $this->getServiceContainer()->getFirewall()->hasPermission($this->getName(), $action, $user);
} | php | public function hasPermission($action, User $user = null) {
return $this->getServiceContainer()->getFirewall()->hasPermission($this->getName(), $action, $user);
} | [
"public",
"function",
"hasPermission",
"(",
"$",
"action",
",",
"User",
"$",
"user",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getServiceContainer",
"(",
")",
"->",
"getFirewall",
"(",
")",
"->",
"hasPermission",
"(",
"$",
"this",
"->",
"getNa... | Shortcut for getting permission on the given action in this module
@param string $action
@param User $user | [
"Shortcut",
"for",
"getting",
"permission",
"on",
"the",
"given",
"action",
"in",
"this",
"module"
] | a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac | https://github.com/keeko/framework/blob/a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac/src/foundation/AbstractModule.php#L285-L287 |
204,660 | luoxiaojun1992/lb_framework | components/db/mysql/Connection.php | Connection.getMasterConnection | protected function getMasterConnection()
{
$db_config = $this->containers['config']->get('mysql');
$master_db_config = $db_config['master'];
$this->_master_db = isset($master_db_config['dbname']) ? $master_db_config['dbname'] : '';
$this->_master_host = isset($master_db_config['host'... | php | protected function getMasterConnection()
{
$db_config = $this->containers['config']->get('mysql');
$master_db_config = $db_config['master'];
$this->_master_db = isset($master_db_config['dbname']) ? $master_db_config['dbname'] : '';
$this->_master_host = isset($master_db_config['host'... | [
"protected",
"function",
"getMasterConnection",
"(",
")",
"{",
"$",
"db_config",
"=",
"$",
"this",
"->",
"containers",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'mysql'",
")",
";",
"$",
"master_db_config",
"=",
"$",
"db_config",
"[",
"'master'",
"]",
";",
... | Establish master node mysql connection | [
"Establish",
"master",
"node",
"mysql",
"connection"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/db/mysql/Connection.php#L92-L103 |
204,661 | luoxiaojun1992/lb_framework | components/db/mysql/Connection.php | Connection.getSlaveConnection | protected function getSlaveConnection($server_hosts = [])
{
$db_config = $this->containers['config']->get('mysql');
$slave_config = $db_config['slaves'];
if (!$server_hosts) {
foreach ($slave_config as $key => $config) {
$server_hosts[$key] = $config['host'];
... | php | protected function getSlaveConnection($server_hosts = [])
{
$db_config = $this->containers['config']->get('mysql');
$slave_config = $db_config['slaves'];
if (!$server_hosts) {
foreach ($slave_config as $key => $config) {
$server_hosts[$key] = $config['host'];
... | [
"protected",
"function",
"getSlaveConnection",
"(",
"$",
"server_hosts",
"=",
"[",
"]",
")",
"{",
"$",
"db_config",
"=",
"$",
"this",
"->",
"containers",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'mysql'",
")",
";",
"$",
"slave_config",
"=",
"$",
"db_conf... | Establish slave node mysql connection
@param array $server_hosts | [
"Establish",
"slave",
"node",
"mysql",
"connection"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/db/mysql/Connection.php#L110-L142 |
204,662 | luoxiaojun1992/lb_framework | components/db/mysql/Connection.php | Connection.getExtraConnection | protected function getExtraConnection($conn)
{
$dbConfigs = $this->containers['config']->get('mysql');
$dbConfig = $dbConfigs[$conn];
$this->extraConfigs[$conn]['_db'] = $dbConfig['dbname'] ?? '';
$this->extraConfigs[$conn]['_host'] = $dbConfig['host'] ?? '';
$this->extraConf... | php | protected function getExtraConnection($conn)
{
$dbConfigs = $this->containers['config']->get('mysql');
$dbConfig = $dbConfigs[$conn];
$this->extraConfigs[$conn]['_db'] = $dbConfig['dbname'] ?? '';
$this->extraConfigs[$conn]['_host'] = $dbConfig['host'] ?? '';
$this->extraConf... | [
"protected",
"function",
"getExtraConnection",
"(",
"$",
"conn",
")",
"{",
"$",
"dbConfigs",
"=",
"$",
"this",
"->",
"containers",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'mysql'",
")",
";",
"$",
"dbConfig",
"=",
"$",
"dbConfigs",
"[",
"$",
"conn",
"]... | Establish extra mysql connection
@param $conn | [
"Establish",
"extra",
"mysql",
"connection"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/db/mysql/Connection.php#L149-L160 |
204,663 | luoxiaojun1992/lb_framework | components/db/mysql/Connection.php | Connection.getConnection | protected function getConnection($node_type)
{
switch ($node_type) {
case self::CONN_TYPE_MASTER:
$this->write_conn = new \PDO($this->_master_dsn, $this->_master_username, $this->_master_password, $this->_master_options);
break;
case self::CONN_TYPE_SLAVE:
... | php | protected function getConnection($node_type)
{
switch ($node_type) {
case self::CONN_TYPE_MASTER:
$this->write_conn = new \PDO($this->_master_dsn, $this->_master_username, $this->_master_password, $this->_master_options);
break;
case self::CONN_TYPE_SLAVE:
... | [
"protected",
"function",
"getConnection",
"(",
"$",
"node_type",
")",
"{",
"switch",
"(",
"$",
"node_type",
")",
"{",
"case",
"self",
"::",
"CONN_TYPE_MASTER",
":",
"$",
"this",
"->",
"write_conn",
"=",
"new",
"\\",
"PDO",
"(",
"$",
"this",
"->",
"_maste... | Establish mysql connection
@param $node_type | [
"Establish",
"mysql",
"connection"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/db/mysql/Connection.php#L191-L208 |
204,664 | denkfabrik-neueMedien/silverstripe-siteinfo | src/extension/SiteInfoController.php | SiteInfoController.CountryNice | public function CountryNice() {
//
$config = SiteConfig::current_site_config();
return Zend_Locale::getTranslation($config->Country, "territory", i18n::get_locale());
} | php | public function CountryNice() {
//
$config = SiteConfig::current_site_config();
return Zend_Locale::getTranslation($config->Country, "territory", i18n::get_locale());
} | [
"public",
"function",
"CountryNice",
"(",
")",
"{",
"//",
"$",
"config",
"=",
"SiteConfig",
"::",
"current_site_config",
"(",
")",
";",
"return",
"Zend_Locale",
"::",
"getTranslation",
"(",
"$",
"config",
"->",
"Country",
",",
"\"territory\"",
",",
"i18n",
"... | Get the full translated country name
@return false|string | [
"Get",
"the",
"full",
"translated",
"country",
"name"
] | cd59ea0cf5c13678ff8efd93028d35c726670c25 | https://github.com/denkfabrik-neueMedien/silverstripe-siteinfo/blob/cd59ea0cf5c13678ff8efd93028d35c726670c25/src/extension/SiteInfoController.php#L49-L54 |
204,665 | borobudur-php/borobudur | src/Borobudur/Component/Mapper/ObjectMapper.php | ObjectMapper.fill | public function fill($data)
{
if (!$this->object) {
throw new InvalidArgumentException(
'There are no object to be mapped'
);
}
if (!is_object($data)) {
throw new InvalidArgumentException('Data should be an object');
}
$da... | php | public function fill($data)
{
if (!$this->object) {
throw new InvalidArgumentException(
'There are no object to be mapped'
);
}
if (!is_object($data)) {
throw new InvalidArgumentException('Data should be an object');
}
$da... | [
"public",
"function",
"fill",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"object",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'There are no object to be mapped'",
")",
";",
"}",
"if",
"(",
"!",
"is_object",
"(",
"$",
... | Fill object from object
@param object $data
@return object | [
"Fill",
"object",
"from",
"object"
] | 6ab0d97e1819ba0b96dc4c3bca3a7c9b1217bd44 | https://github.com/borobudur-php/borobudur/blob/6ab0d97e1819ba0b96dc4c3bca3a7c9b1217bd44/src/Borobudur/Component/Mapper/ObjectMapper.php#L71-L102 |
204,666 | borobudur-php/borobudur | src/Borobudur/Component/Mapper/ObjectMapper.php | ObjectMapper.extractAllowedAttributes | private function extractAllowedAttributes(ReflectionClass $reflection): array
{
$allowed = [];
foreach (
$reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method
) {
if (!$this->isGetMethod($method)) {
continue;
}
$name ... | php | private function extractAllowedAttributes(ReflectionClass $reflection): array
{
$allowed = [];
foreach (
$reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method
) {
if (!$this->isGetMethod($method)) {
continue;
}
$name ... | [
"private",
"function",
"extractAllowedAttributes",
"(",
"ReflectionClass",
"$",
"reflection",
")",
":",
"array",
"{",
"$",
"allowed",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"reflection",
"->",
"getMethods",
"(",
"ReflectionMethod",
"::",
"IS_PUBLIC",
")",
"a... | Extract allowed attributes.
@param ReflectionClass $reflection
@return array | [
"Extract",
"allowed",
"attributes",
"."
] | 6ab0d97e1819ba0b96dc4c3bca3a7c9b1217bd44 | https://github.com/borobudur-php/borobudur/blob/6ab0d97e1819ba0b96dc4c3bca3a7c9b1217bd44/src/Borobudur/Component/Mapper/ObjectMapper.php#L126-L145 |
204,667 | borobudur-php/borobudur | src/Borobudur/Component/Mapper/ObjectMapper.php | ObjectMapper.isExclude | private function isExclude(string $key): bool
{
if (!empty($this->excludes) && in_array($key, $this->excludes, true)) {
return true;
}
if (!empty($this->only) && !in_array($key, $this->only, true)) {
return true;
}
return false;
} | php | private function isExclude(string $key): bool
{
if (!empty($this->excludes) && in_array($key, $this->excludes, true)) {
return true;
}
if (!empty($this->only) && !in_array($key, $this->only, true)) {
return true;
}
return false;
} | [
"private",
"function",
"isExclude",
"(",
"string",
"$",
"key",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"excludes",
")",
"&&",
"in_array",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"excludes",
",",
"true",
")",
")",
... | Check whether current key is excluded.
@param string $key
@return bool | [
"Check",
"whether",
"current",
"key",
"is",
"excluded",
"."
] | 6ab0d97e1819ba0b96dc4c3bca3a7c9b1217bd44 | https://github.com/borobudur-php/borobudur/blob/6ab0d97e1819ba0b96dc4c3bca3a7c9b1217bd44/src/Borobudur/Component/Mapper/ObjectMapper.php#L154-L165 |
204,668 | borobudur-php/borobudur | src/Borobudur/Component/Mapper/ObjectMapper.php | ObjectMapper.extractData | private function extractData(object $data): array
{
if ($data instanceof \stdClass) {
return (array) $data;
}
$extracted = [];
$reflection = new \ReflectionObject($data);
foreach (
$reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method
... | php | private function extractData(object $data): array
{
if ($data instanceof \stdClass) {
return (array) $data;
}
$extracted = [];
$reflection = new \ReflectionObject($data);
foreach (
$reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method
... | [
"private",
"function",
"extractData",
"(",
"object",
"$",
"data",
")",
":",
"array",
"{",
"if",
"(",
"$",
"data",
"instanceof",
"\\",
"stdClass",
")",
"{",
"return",
"(",
"array",
")",
"$",
"data",
";",
"}",
"$",
"extracted",
"=",
"[",
"]",
";",
"$... | Extract the object data to array.
@param object $data
@return array | [
"Extract",
"the",
"object",
"data",
"to",
"array",
"."
] | 6ab0d97e1819ba0b96dc4c3bca3a7c9b1217bd44 | https://github.com/borobudur-php/borobudur/blob/6ab0d97e1819ba0b96dc4c3bca3a7c9b1217bd44/src/Borobudur/Component/Mapper/ObjectMapper.php#L174-L195 |
204,669 | borobudur-php/borobudur | src/Borobudur/Component/Mapper/ObjectMapper.php | ObjectMapper.getAttributeName | private function getAttributeName(ReflectionMethod $method): string
{
return lcfirst(
substr($method->name, 0 === strpos($method->name, 'is') ? 2 : 3)
);
} | php | private function getAttributeName(ReflectionMethod $method): string
{
return lcfirst(
substr($method->name, 0 === strpos($method->name, 'is') ? 2 : 3)
);
} | [
"private",
"function",
"getAttributeName",
"(",
"ReflectionMethod",
"$",
"method",
")",
":",
"string",
"{",
"return",
"lcfirst",
"(",
"substr",
"(",
"$",
"method",
"->",
"name",
",",
"0",
"===",
"strpos",
"(",
"$",
"method",
"->",
"name",
",",
"'is'",
")... | Get the attribute name from method.
@param ReflectionMethod $method
@return string | [
"Get",
"the",
"attribute",
"name",
"from",
"method",
"."
] | 6ab0d97e1819ba0b96dc4c3bca3a7c9b1217bd44 | https://github.com/borobudur-php/borobudur/blob/6ab0d97e1819ba0b96dc4c3bca3a7c9b1217bd44/src/Borobudur/Component/Mapper/ObjectMapper.php#L225-L230 |
204,670 | schpill/thin | src/Phonetic.php | Phonetic.setTolerance | public function setTolerance($tolerance = 0.20)
{
if ($tolerance < 0 || $tolerance > 1) {
return false;
}
$this->_tolerance = round($tolerance, 2);
return $this;
} | php | public function setTolerance($tolerance = 0.20)
{
if ($tolerance < 0 || $tolerance > 1) {
return false;
}
$this->_tolerance = round($tolerance, 2);
return $this;
} | [
"public",
"function",
"setTolerance",
"(",
"$",
"tolerance",
"=",
"0.20",
")",
"{",
"if",
"(",
"$",
"tolerance",
"<",
"0",
"||",
"$",
"tolerance",
">",
"1",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"_tolerance",
"=",
"round",
"(",
... | Set fault tolerance for what is considered 'similar'.
@param float $tol a percentage setting how close the strings need to be to be considered similar. | [
"Set",
"fault",
"tolerance",
"for",
"what",
"is",
"considered",
"similar",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Phonetic.php#L43-L52 |
204,671 | schpill/thin | src/Phonetic.php | Phonetic.similarity | public function similarity($string = null, $cmp = null, $language = 'french')
{
if (empty($string) || empty($cmp)) {
return false;
}
if (strlen($string) > 255 || strlen($cmp) > 255) {
return false;
}
$process... | php | public function similarity($string = null, $cmp = null, $language = 'french')
{
if (empty($string) || empty($cmp)) {
return false;
}
if (strlen($string) > 255 || strlen($cmp) > 255) {
return false;
}
$process... | [
"public",
"function",
"similarity",
"(",
"$",
"string",
"=",
"null",
",",
"$",
"cmp",
"=",
"null",
",",
"$",
"language",
"=",
"'french'",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"string",
")",
"||",
"empty",
"(",
"$",
"cmp",
")",
")",
"{",
"retur... | Compare 2 strings to see how similar they are.
@param string $string The first string to compare. Max length of 255 chars.
@param string $cmp The second string to comapre against the first. Max length of 255 chars.
@param string $language The language to make phonemes
@return mixed false if $string or $cmp is empty or... | [
"Compare",
"2",
"strings",
"to",
"see",
"how",
"similar",
"they",
"are",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Phonetic.php#L98-L157 |
204,672 | schpill/thin | src/Phonetic.php | Phonetic.phoneme | public function phoneme($string = '', $language = 'french')
{
$parts = explode(' ', $string);
$phonemes = array();
foreach ($parts as $p) {
$p = $this->partCases(Inflector::lower($p));
$phon = $this->$language($p);
... | php | public function phoneme($string = '', $language = 'french')
{
$parts = explode(' ', $string);
$phonemes = array();
foreach ($parts as $p) {
$p = $this->partCases(Inflector::lower($p));
$phon = $this->$language($p);
... | [
"public",
"function",
"phoneme",
"(",
"$",
"string",
"=",
"''",
",",
"$",
"language",
"=",
"'french'",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"' '",
",",
"$",
"string",
")",
";",
"$",
"phonemes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
... | Transform a given string into its phoneme equivalent.
@param string $string The string to be transformed in phonemes.
@param string $language The language to make phonemes
@return string Phoneme string. | [
"Transform",
"a",
"given",
"string",
"into",
"its",
"phoneme",
"equivalent",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Phonetic.php#L178-L199 |
204,673 | feelinc/laravel-api | src/Sule/Api/Resources/Collection.php | Collection.getEtags | public function getEtags()
{
$etag = '';
if ($this->data instanceof ArrayableInterface) {
$this->data = $this->data->toArray();
}
foreach ( $this->data as $item ) {
$item = new Resource($item);
$etag .= $item->getEtag();
unset($item);... | php | public function getEtags()
{
$etag = '';
if ($this->data instanceof ArrayableInterface) {
$this->data = $this->data->toArray();
}
foreach ( $this->data as $item ) {
$item = new Resource($item);
$etag .= $item->getEtag();
unset($item);... | [
"public",
"function",
"getEtags",
"(",
")",
"{",
"$",
"etag",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"data",
"instanceof",
"ArrayableInterface",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"$",
"this",
"->",
"data",
"->",
"toArray",
"(",
")",
... | Return ETag based on collection of items
@return string md5 of all ETags | [
"Return",
"ETag",
"based",
"on",
"collection",
"of",
"items"
] | 8b4abc4f1be255b441e09f5014e863a130c666d8 | https://github.com/feelinc/laravel-api/blob/8b4abc4f1be255b441e09f5014e863a130c666d8/src/Sule/Api/Resources/Collection.php#L37-L52 |
204,674 | courtney-miles/schnoop-schema | src/MySQL/Routine/AbstractRoutine.php | AbstractRoutine.makeCharacteristicsDDL | protected function makeCharacteristicsDDL()
{
return implode(
" ",
array_filter(
[
$this->deterministic ? 'DETERMINISTIC' : 'NOT DETERMINISTIC',
$this->dataAccess,
!empty($this->sqlSecurity) ? 'SQL SECURITY '... | php | protected function makeCharacteristicsDDL()
{
return implode(
" ",
array_filter(
[
$this->deterministic ? 'DETERMINISTIC' : 'NOT DETERMINISTIC',
$this->dataAccess,
!empty($this->sqlSecurity) ? 'SQL SECURITY '... | [
"protected",
"function",
"makeCharacteristicsDDL",
"(",
")",
"{",
"return",
"implode",
"(",
"\" \"",
",",
"array_filter",
"(",
"[",
"$",
"this",
"->",
"deterministic",
"?",
"'DETERMINISTIC'",
":",
"'NOT DETERMINISTIC'",
",",
"$",
"this",
"->",
"dataAccess",
",",... | Make the portion of the routine DDL statement that describes deterministic, sql security and comment.
@return string Characteristics DDL. | [
"Make",
"the",
"portion",
"of",
"the",
"routine",
"DDL",
"statement",
"that",
"describes",
"deterministic",
"sql",
"security",
"and",
"comment",
"."
] | f96e9922257860171ecdcdbb6b78182276e2f60d | https://github.com/courtney-miles/schnoop-schema/blob/f96e9922257860171ecdcdbb6b78182276e2f60d/src/MySQL/Routine/AbstractRoutine.php#L338-L351 |
204,675 | valu-digital/valuso | src/ValuSo/Service/BatchService.php | BatchService.createWorker | protected function createWorker($service)
{
return $this->getServiceBroker()
->service($service)
->context($this->command->getContext());
} | php | protected function createWorker($service)
{
return $this->getServiceBroker()
->service($service)
->context($this->command->getContext());
} | [
"protected",
"function",
"createWorker",
"(",
"$",
"service",
")",
"{",
"return",
"$",
"this",
"->",
"getServiceBroker",
"(",
")",
"->",
"service",
"(",
"$",
"service",
")",
"->",
"context",
"(",
"$",
"this",
"->",
"command",
"->",
"getContext",
"(",
")"... | Create service worker
@return \ValuSo\Broker\Worker | [
"Create",
"service",
"worker"
] | c96bed0f6bd21551822334fe6cfe913a7436dd17 | https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Service/BatchService.php#L159-L164 |
204,676 | silvercommerce/contact-admin | src/model/ContactLocation.php | ContactLocation.onAfterWrite | public function onAfterWrite()
{
parent::onAfterWrite();
if ($this->Default) {
foreach ($this->Contact()->Locations() as $location) {
if ($location->ID != $this->ID && $location->Default) {
$location->Default = false;
$location->wr... | php | public function onAfterWrite()
{
parent::onAfterWrite();
if ($this->Default) {
foreach ($this->Contact()->Locations() as $location) {
if ($location->ID != $this->ID && $location->Default) {
$location->Default = false;
$location->wr... | [
"public",
"function",
"onAfterWrite",
"(",
")",
"{",
"parent",
"::",
"onAfterWrite",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"Default",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"Contact",
"(",
")",
"->",
"Locations",
"(",
")",
"as",
"$",
"... | If we have assigned this as a default location, loop through
other locations and disable default.
@return void | [
"If",
"we",
"have",
"assigned",
"this",
"as",
"a",
"default",
"location",
"loop",
"through",
"other",
"locations",
"and",
"disable",
"default",
"."
] | 32cbc2ef2589f93f9dd1796e5db2f11ad15d888c | https://github.com/silvercommerce/contact-admin/blob/32cbc2ef2589f93f9dd1796e5db2f11ad15d888c/src/model/ContactLocation.php#L232-L244 |
204,677 | PhoxPHP/Glider | src/Connection/ConnectionLoader.php | ConnectionLoader.getConnectionsFromResource | public function getConnectionsFromResource() : Array
{
$baseDir = dirname(__DIR__);
$configLocation = $baseDir . '/config.php';
if (!file_exists($configLocation) && class_exists(Config::class)) {
$resourceConfig = Config::get('database');
}else{
$resourceConfig = include $configLocation;
}
if (ge... | php | public function getConnectionsFromResource() : Array
{
$baseDir = dirname(__DIR__);
$configLocation = $baseDir . '/config.php';
if (!file_exists($configLocation) && class_exists(Config::class)) {
$resourceConfig = Config::get('database');
}else{
$resourceConfig = include $configLocation;
}
if (ge... | [
"public",
"function",
"getConnectionsFromResource",
"(",
")",
":",
"Array",
"{",
"$",
"baseDir",
"=",
"dirname",
"(",
"__DIR__",
")",
";",
"$",
"configLocation",
"=",
"$",
"baseDir",
".",
"'/config.php'",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"conf... | Loads connection configuration.
@access public
@return <Array> | [
"Loads",
"connection",
"configuration",
"."
] | 17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042 | https://github.com/PhoxPHP/Glider/blob/17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042/src/Connection/ConnectionLoader.php#L37-L53 |
204,678 | zbox/UnifiedPush | src/Zbox/UnifiedPush/Dispatcher.php | Dispatcher.getConnection | public function getConnection($serviceName)
{
if (empty($this->connectionPool[$serviceName])) {
$this->initConnection($serviceName);
}
return $this->connectionPool[$serviceName];
} | php | public function getConnection($serviceName)
{
if (empty($this->connectionPool[$serviceName])) {
$this->initConnection($serviceName);
}
return $this->connectionPool[$serviceName];
} | [
"public",
"function",
"getConnection",
"(",
"$",
"serviceName",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"connectionPool",
"[",
"$",
"serviceName",
"]",
")",
")",
"{",
"$",
"this",
"->",
"initConnection",
"(",
"$",
"serviceName",
")",
";",
... | Gets a service client connection by service name
@param string $serviceName
@return ServiceClientInterface | [
"Gets",
"a",
"service",
"client",
"connection",
"by",
"service",
"name"
] | 47da2d0577b18ac709cd947c68541014001e1866 | https://github.com/zbox/UnifiedPush/blob/47da2d0577b18ac709cd947c68541014001e1866/src/Zbox/UnifiedPush/Dispatcher.php#L100-L107 |
204,679 | zbox/UnifiedPush | src/Zbox/UnifiedPush/Dispatcher.php | Dispatcher.initConnection | public function initConnection($serviceName)
{
$connection = $this->clientFactory->createServiceClient($serviceName);
$this->connectionPool[$serviceName] = $connection;
return $this;
} | php | public function initConnection($serviceName)
{
$connection = $this->clientFactory->createServiceClient($serviceName);
$this->connectionPool[$serviceName] = $connection;
return $this;
} | [
"public",
"function",
"initConnection",
"(",
"$",
"serviceName",
")",
"{",
"$",
"connection",
"=",
"$",
"this",
"->",
"clientFactory",
"->",
"createServiceClient",
"(",
"$",
"serviceName",
")",
";",
"$",
"this",
"->",
"connectionPool",
"[",
"$",
"serviceName",... | Initialize service client connection by service name
@param string $serviceName
@return $this | [
"Initialize",
"service",
"client",
"connection",
"by",
"service",
"name"
] | 47da2d0577b18ac709cd947c68541014001e1866 | https://github.com/zbox/UnifiedPush/blob/47da2d0577b18ac709cd947c68541014001e1866/src/Zbox/UnifiedPush/Dispatcher.php#L115-L121 |
204,680 | zbox/UnifiedPush | src/Zbox/UnifiedPush/Dispatcher.php | Dispatcher.dispatch | public function dispatch(MessageInterface $message)
{
$builder = $this->notificationBuilder;
$notifications = $builder->buildNotifications($message);
/** @var Notification $notification */
foreach ($notifications as $notification) {
$this->sendNotification($notification... | php | public function dispatch(MessageInterface $message)
{
$builder = $this->notificationBuilder;
$notifications = $builder->buildNotifications($message);
/** @var Notification $notification */
foreach ($notifications as $notification) {
$this->sendNotification($notification... | [
"public",
"function",
"dispatch",
"(",
"MessageInterface",
"$",
"message",
")",
"{",
"$",
"builder",
"=",
"$",
"this",
"->",
"notificationBuilder",
";",
"$",
"notifications",
"=",
"$",
"builder",
"->",
"buildNotifications",
"(",
"$",
"message",
")",
";",
"/*... | Build notification and send it to notification service
@param MessageInterface $message
@return $this | [
"Build",
"notification",
"and",
"send",
"it",
"to",
"notification",
"service"
] | 47da2d0577b18ac709cd947c68541014001e1866 | https://github.com/zbox/UnifiedPush/blob/47da2d0577b18ac709cd947c68541014001e1866/src/Zbox/UnifiedPush/Dispatcher.php#L148-L160 |
204,681 | zbox/UnifiedPush | src/Zbox/UnifiedPush/Dispatcher.php | Dispatcher.dispatchAll | public function dispatchAll(MessageCollection $messages)
{
$collection = $messages->getMessageCollection();
while ($collection->valid()) {
$message = $collection->current();
$this->dispatch($message);
$collection->next();
}
return $this;
} | php | public function dispatchAll(MessageCollection $messages)
{
$collection = $messages->getMessageCollection();
while ($collection->valid()) {
$message = $collection->current();
$this->dispatch($message);
$collection->next();
}
return $this;
} | [
"public",
"function",
"dispatchAll",
"(",
"MessageCollection",
"$",
"messages",
")",
"{",
"$",
"collection",
"=",
"$",
"messages",
"->",
"getMessageCollection",
"(",
")",
";",
"while",
"(",
"$",
"collection",
"->",
"valid",
"(",
")",
")",
"{",
"$",
"messag... | Tries to dispatch all messages to notification service
@param MessageCollection $messages
@return $this | [
"Tries",
"to",
"dispatch",
"all",
"messages",
"to",
"notification",
"service"
] | 47da2d0577b18ac709cd947c68541014001e1866 | https://github.com/zbox/UnifiedPush/blob/47da2d0577b18ac709cd947c68541014001e1866/src/Zbox/UnifiedPush/Dispatcher.php#L168-L179 |
204,682 | zbox/UnifiedPush | src/Zbox/UnifiedPush/Dispatcher.php | Dispatcher.sendNotification | public function sendNotification(Notification $notification)
{
try {
$connection = $this->getConnection($notification->getType());
$connection->setNotification($notification);
$this->logger->info(
sprintf(
"Dispatching notification id:... | php | public function sendNotification(Notification $notification)
{
try {
$connection = $this->getConnection($notification->getType());
$connection->setNotification($notification);
$this->logger->info(
sprintf(
"Dispatching notification id:... | [
"public",
"function",
"sendNotification",
"(",
"Notification",
"$",
"notification",
")",
"{",
"try",
"{",
"$",
"connection",
"=",
"$",
"this",
"->",
"getConnection",
"(",
"$",
"notification",
"->",
"getType",
"(",
")",
")",
";",
"$",
"connection",
"->",
"s... | Tries to connect and send a notification
@param Notification $notification
@return bool | [
"Tries",
"to",
"connect",
"and",
"send",
"a",
"notification"
] | 47da2d0577b18ac709cd947c68541014001e1866 | https://github.com/zbox/UnifiedPush/blob/47da2d0577b18ac709cd947c68541014001e1866/src/Zbox/UnifiedPush/Dispatcher.php#L187-L226 |
204,683 | zbox/UnifiedPush | src/Zbox/UnifiedPush/Dispatcher.php | Dispatcher.loadFeedback | public function loadFeedback()
{
$serviceName = NotificationServices::APPLE_PUSH_NOTIFICATIONS_SERVICE;
try {
$this->logger->info(sprintf("Querying the feedback service '%s'", $serviceName));
$connection = $this->initFeedbackConnection($serviceName);
$this
... | php | public function loadFeedback()
{
$serviceName = NotificationServices::APPLE_PUSH_NOTIFICATIONS_SERVICE;
try {
$this->logger->info(sprintf("Querying the feedback service '%s'", $serviceName));
$connection = $this->initFeedbackConnection($serviceName);
$this
... | [
"public",
"function",
"loadFeedback",
"(",
")",
"{",
"$",
"serviceName",
"=",
"NotificationServices",
"::",
"APPLE_PUSH_NOTIFICATIONS_SERVICE",
";",
"try",
"{",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"sprintf",
"(",
"\"Querying the feedback service '%s'\"",
... | Tries to connect and load feedback data
@return $this
@throws RuntimeException
@throws \Exception | [
"Tries",
"to",
"connect",
"and",
"load",
"feedback",
"data"
] | 47da2d0577b18ac709cd947c68541014001e1866 | https://github.com/zbox/UnifiedPush/blob/47da2d0577b18ac709cd947c68541014001e1866/src/Zbox/UnifiedPush/Dispatcher.php#L235-L262 |
204,684 | RadialCorp/magento-core | src/app/code/community/Radial/Amqp/controllers/Exchange/System/Config/ValidateController.php | Radial_Amqp_Exchange_System_Config_ValidateController.validateamqpAction | public function validateamqpAction()
{
$request = $this->getRequest();
$configMap = Mage::getModel('radial_amqp/config');
$hostname = $this->_validatorHelper->getParamOrFallbackValue(
$request,
self::HOSTNAME_PARAM,
self::HOSTNAME_USE_DEFAULT_PARAM,
... | php | public function validateamqpAction()
{
$request = $this->getRequest();
$configMap = Mage::getModel('radial_amqp/config');
$hostname = $this->_validatorHelper->getParamOrFallbackValue(
$request,
self::HOSTNAME_PARAM,
self::HOSTNAME_USE_DEFAULT_PARAM,
... | [
"public",
"function",
"validateamqpAction",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"$",
"configMap",
"=",
"Mage",
"::",
"getModel",
"(",
"'radial_amqp/config'",
")",
";",
"$",
"hostname",
"=",
"$",
"this",
"->... | Test connecting to the AMQP server
@return self | [
"Test",
"connecting",
"to",
"the",
"AMQP",
"server"
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Amqp/controllers/Exchange/System/Config/ValidateController.php#L75-L103 |
204,685 | RadialCorp/magento-core | src/app/code/community/Radial/Amqp/controllers/Exchange/System/Config/ValidateController.php | Radial_Amqp_Exchange_System_Config_ValidateController._getSourceStore | protected function _getSourceStore()
{
// this may return a Mage_Core_Model_Store or a Mage_Core_Model_Website
$configSource = $this->_validatorHelper->getConfigSource($this->getRequest());
// When given a website, get the default store for that website.
// AMQP config is only at glo... | php | protected function _getSourceStore()
{
// this may return a Mage_Core_Model_Store or a Mage_Core_Model_Website
$configSource = $this->_validatorHelper->getConfigSource($this->getRequest());
// When given a website, get the default store for that website.
// AMQP config is only at glo... | [
"protected",
"function",
"_getSourceStore",
"(",
")",
"{",
"// this may return a Mage_Core_Model_Store or a Mage_Core_Model_Website",
"$",
"configSource",
"=",
"$",
"this",
"->",
"_validatorHelper",
"->",
"getConfigSource",
"(",
"$",
"this",
"->",
"getRequest",
"(",
")",
... | Get a store context to use as the source of configuration.
@return Mage_Core_Model_Store | [
"Get",
"a",
"store",
"context",
"to",
"use",
"as",
"the",
"source",
"of",
"configuration",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Amqp/controllers/Exchange/System/Config/ValidateController.php#L108-L119 |
204,686 | romaricdrigon/OrchestraBundle | Core/Entity/Action/EntityActionBuilder.php | EntityActionBuilder.buildName | protected function buildName($name)
{
$name = preg_replace('/([A-Z]{1})/', ' $1', $name);
$name = ucfirst($name);
return trim($name);
} | php | protected function buildName($name)
{
$name = preg_replace('/([A-Z]{1})/', ' $1', $name);
$name = ucfirst($name);
return trim($name);
} | [
"protected",
"function",
"buildName",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"preg_replace",
"(",
"'/([A-Z]{1})/'",
",",
"' $1'",
",",
"$",
"name",
")",
";",
"$",
"name",
"=",
"ucfirst",
"(",
"$",
"name",
")",
";",
"return",
"trim",
"(",
"$",
... | Humanize name, adding a space before each capital
@param string $name
@return string | [
"Humanize",
"name",
"adding",
"a",
"space",
"before",
"each",
"capital"
] | 4abb9736fcb6b23ed08ebd14ab169867339a4785 | https://github.com/romaricdrigon/OrchestraBundle/blob/4abb9736fcb6b23ed08ebd14ab169867339a4785/Core/Entity/Action/EntityActionBuilder.php#L78-L85 |
204,687 | romaricdrigon/OrchestraBundle | Core/Entity/Action/EntityActionBuilder.php | EntityActionBuilder.findCommand | protected function findCommand(\ReflectionMethod $reflectionMethod)
{
$parameters = $reflectionMethod->getParameters();
/** @var \ReflectionParameter $parameter */
foreach ($parameters as $parameter) {
$class = $parameter->getClass();
if (null !== $class && true ===... | php | protected function findCommand(\ReflectionMethod $reflectionMethod)
{
$parameters = $reflectionMethod->getParameters();
/** @var \ReflectionParameter $parameter */
foreach ($parameters as $parameter) {
$class = $parameter->getClass();
if (null !== $class && true ===... | [
"protected",
"function",
"findCommand",
"(",
"\\",
"ReflectionMethod",
"$",
"reflectionMethod",
")",
"{",
"$",
"parameters",
"=",
"$",
"reflectionMethod",
"->",
"getParameters",
"(",
")",
";",
"/** @var \\ReflectionParameter $parameter */",
"foreach",
"(",
"$",
"param... | Look if we have a parameter of type "CommandInterface", and then return its precise class name
@param \ReflectionMethod $reflectionMethod
@return null|string | [
"Look",
"if",
"we",
"have",
"a",
"parameter",
"of",
"type",
"CommandInterface",
"and",
"then",
"return",
"its",
"precise",
"class",
"name"
] | 4abb9736fcb6b23ed08ebd14ab169867339a4785 | https://github.com/romaricdrigon/OrchestraBundle/blob/4abb9736fcb6b23ed08ebd14ab169867339a4785/Core/Entity/Action/EntityActionBuilder.php#L104-L118 |
204,688 | fxpio/fxp-doctrine-console | Exception/ValidationException.php | ValidationException.buildGlobalErrors | private function buildGlobalErrors(array $errors, $msg)
{
if (!empty($errors)) {
$msg .= sprintf('%s- errors:', PHP_EOL);
foreach ($errors as $error) {
$msg .= sprintf('%s - %s', PHP_EOL, $error);
}
}
return $msg;
} | php | private function buildGlobalErrors(array $errors, $msg)
{
if (!empty($errors)) {
$msg .= sprintf('%s- errors:', PHP_EOL);
foreach ($errors as $error) {
$msg .= sprintf('%s - %s', PHP_EOL, $error);
}
}
return $msg;
} | [
"private",
"function",
"buildGlobalErrors",
"(",
"array",
"$",
"errors",
",",
"$",
"msg",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"errors",
")",
")",
"{",
"$",
"msg",
".=",
"sprintf",
"(",
"'%s- errors:'",
",",
"PHP_EOL",
")",
";",
"foreach",
"(... | Build the global errors and returns the exception message.
@param string[] $errors The error messages
@param string $msg The exception message
@return string | [
"Build",
"the",
"global",
"errors",
"and",
"returns",
"the",
"exception",
"message",
"."
] | 2fc16d7a4eb0f247075c50de225ec2670ca5479a | https://github.com/fxpio/fxp-doctrine-console/blob/2fc16d7a4eb0f247075c50de225ec2670ca5479a/Exception/ValidationException.php#L73-L84 |
204,689 | fxpio/fxp-doctrine-console | Exception/ValidationException.php | ValidationException.buildChildrenErrors | private function buildChildrenErrors(array $childrenErrors, $msg)
{
if (!empty($childrenErrors)) {
$msg .= PHP_EOL.'- children:';
foreach ($childrenErrors as $child => $errors) {
$msg .= sprintf('%s - %s', PHP_EOL, $child);
$msg .= sprintf('%s - e... | php | private function buildChildrenErrors(array $childrenErrors, $msg)
{
if (!empty($childrenErrors)) {
$msg .= PHP_EOL.'- children:';
foreach ($childrenErrors as $child => $errors) {
$msg .= sprintf('%s - %s', PHP_EOL, $child);
$msg .= sprintf('%s - e... | [
"private",
"function",
"buildChildrenErrors",
"(",
"array",
"$",
"childrenErrors",
",",
"$",
"msg",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"childrenErrors",
")",
")",
"{",
"$",
"msg",
".=",
"PHP_EOL",
".",
"'- children:'",
";",
"foreach",
"(",
"$",... | Build the children errors and returns the exception message.
@param array $childrenErrors The children error messages
@param string $msg The exception message
@return string | [
"Build",
"the",
"children",
"errors",
"and",
"returns",
"the",
"exception",
"message",
"."
] | 2fc16d7a4eb0f247075c50de225ec2670ca5479a | https://github.com/fxpio/fxp-doctrine-console/blob/2fc16d7a4eb0f247075c50de225ec2670ca5479a/Exception/ValidationException.php#L94-L110 |
204,690 | chilimatic/chilimatic-framework | lib/database/sql/mysql/Simple.php | Simple.fetch_assoc | public function fetch_assoc($sql)
{
if (empty($sql)) return false;
$res = $this->query($sql);
$result = @mysql_fetch_assoc($res);
$this->free($res);
return $result;
} | php | public function fetch_assoc($sql)
{
if (empty($sql)) return false;
$res = $this->query($sql);
$result = @mysql_fetch_assoc($res);
$this->free($res);
return $result;
} | [
"public",
"function",
"fetch_assoc",
"(",
"$",
"sql",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"sql",
")",
")",
"return",
"false",
";",
"$",
"res",
"=",
"$",
"this",
"->",
"query",
"(",
"$",
"sql",
")",
";",
"$",
"result",
"=",
"@",
"mysql_fetch_a... | fetches an associative array
@param $sql string
@return bool array | [
"fetches",
"an",
"associative",
"array"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/database/sql/mysql/Simple.php#L80-L90 |
204,691 | chilimatic/chilimatic-framework | lib/database/sql/mysql/Simple.php | Simple.fetch_assoc_list | public function fetch_assoc_list($sql, $assign_by = null)
{
if (empty($sql)) return false;
$result = array();
// send the query
$res = $this->query($sql);
if (empty($res)) return false;
while (($row = @mysql_fetch_assoc($res)) !== false) {
if (!empty(... | php | public function fetch_assoc_list($sql, $assign_by = null)
{
if (empty($sql)) return false;
$result = array();
// send the query
$res = $this->query($sql);
if (empty($res)) return false;
while (($row = @mysql_fetch_assoc($res)) !== false) {
if (!empty(... | [
"public",
"function",
"fetch_assoc_list",
"(",
"$",
"sql",
",",
"$",
"assign_by",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"sql",
")",
")",
"return",
"false",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"// send the query",
"$",
"res... | simple wrapper for those lazy bastards who don't wanna
control their own ressources
@param $sql string
@param $assign_by string
@return array bool | [
"simple",
"wrapper",
"for",
"those",
"lazy",
"bastards",
"who",
"don",
"t",
"wanna",
"control",
"their",
"own",
"ressources"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/database/sql/mysql/Simple.php#L102-L135 |
204,692 | chilimatic/chilimatic-framework | lib/database/sql/mysql/Simple.php | Simple.fetch_object | public function fetch_object($sql)
{
if (empty($sql)) return false;
$res = $this->query($sql);
$result = @mysql_fetch_object($res);
$this->free($res);
return $result;
} | php | public function fetch_object($sql)
{
if (empty($sql)) return false;
$res = $this->query($sql);
$result = @mysql_fetch_object($res);
$this->free($res);
return $result;
} | [
"public",
"function",
"fetch_object",
"(",
"$",
"sql",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"sql",
")",
")",
"return",
"false",
";",
"$",
"res",
"=",
"$",
"this",
"->",
"query",
"(",
"$",
"sql",
")",
";",
"$",
"result",
"=",
"@",
"mysql_fetch_... | fetches an object of the current row
@param $sql string
@return bool object | [
"fetches",
"an",
"object",
"of",
"the",
"current",
"row"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/database/sql/mysql/Simple.php#L145-L155 |
204,693 | chilimatic/chilimatic-framework | lib/database/sql/mysql/Simple.php | Simple.fetch_string | public function fetch_string($sql)
{
if (empty($sql)) return false;
$res = $this->query($sql);
$row = @mysql_fetch_array($res);
return (string)$row[0];
} | php | public function fetch_string($sql)
{
if (empty($sql)) return false;
$res = $this->query($sql);
$row = @mysql_fetch_array($res);
return (string)$row[0];
} | [
"public",
"function",
"fetch_string",
"(",
"$",
"sql",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"sql",
")",
")",
"return",
"false",
";",
"$",
"res",
"=",
"$",
"this",
"->",
"query",
"(",
"$",
"sql",
")",
";",
"$",
"row",
"=",
"@",
"mysql_fetch_arr... | fetches a string wrapper for
easy use
@param $sql string
@return string | [
"fetches",
"a",
"string",
"wrapper",
"for",
"easy",
"use"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/database/sql/mysql/Simple.php#L207-L216 |
204,694 | takashiki/mis | src/App.php | App.map | public function map(array $methods, $pattern, $callable)
{
$callable = is_string($callable) ? $this->resolveCallable($callable) : $callable;
if ($callable instanceof Closure) {
$callable = $callable->bindTo($this);
}
$route = $this->container->get('router')->map($methods... | php | public function map(array $methods, $pattern, $callable)
{
$callable = is_string($callable) ? $this->resolveCallable($callable) : $callable;
if ($callable instanceof Closure) {
$callable = $callable->bindTo($this);
}
$route = $this->container->get('router')->map($methods... | [
"public",
"function",
"map",
"(",
"array",
"$",
"methods",
",",
"$",
"pattern",
",",
"$",
"callable",
")",
"{",
"$",
"callable",
"=",
"is_string",
"(",
"$",
"callable",
")",
"?",
"$",
"this",
"->",
"resolveCallable",
"(",
"$",
"callable",
")",
":",
"... | Add route with multiple methods.
@param string[] $methods Numeric array of HTTP method names
@param string $pattern The route URI pattern
@param mixed $callable The route callback routine
@return RouteInterface | [
"Add",
"route",
"with",
"multiple",
"methods",
"."
] | a40d228d868af4e77c6156d297086ca94b8fbac8 | https://github.com/takashiki/mis/blob/a40d228d868af4e77c6156d297086ca94b8fbac8/src/App.php#L170-L187 |
204,695 | takashiki/mis | src/App.php | App.group | public function group($pattern, $callable)
{
/** @var RouteGroup $group */
$group = $this->container->get('router')->pushGroup($pattern, $callable);
$group->setContainer($this->container);
$group($this);
$this->container->get('router')->popGroup();
return $group;
... | php | public function group($pattern, $callable)
{
/** @var RouteGroup $group */
$group = $this->container->get('router')->pushGroup($pattern, $callable);
$group->setContainer($this->container);
$group($this);
$this->container->get('router')->popGroup();
return $group;
... | [
"public",
"function",
"group",
"(",
"$",
"pattern",
",",
"$",
"callable",
")",
"{",
"/** @var RouteGroup $group */",
"$",
"group",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'router'",
")",
"->",
"pushGroup",
"(",
"$",
"pattern",
",",
"$",
"... | Route Groups.
This method accepts a route pattern and a callback. All route
declarations in the callback will be prepended by the group(s)
that it is in.
@param string $pattern
@param callable $callable
@return RouteGroupInterface | [
"Route",
"Groups",
"."
] | a40d228d868af4e77c6156d297086ca94b8fbac8 | https://github.com/takashiki/mis/blob/a40d228d868af4e77c6156d297086ca94b8fbac8/src/App.php#L201-L210 |
204,696 | ekyna/AdminBundle | Dashboard/Dashboard.php | Dashboard.hasWidget | public function hasWidget($nameOrWidget)
{
$name = $nameOrWidget instanceof WidgetInterface ? $nameOrWidget->getName() : $nameOrWidget;
return array_key_exists($name, $this->widgets);
} | php | public function hasWidget($nameOrWidget)
{
$name = $nameOrWidget instanceof WidgetInterface ? $nameOrWidget->getName() : $nameOrWidget;
return array_key_exists($name, $this->widgets);
} | [
"public",
"function",
"hasWidget",
"(",
"$",
"nameOrWidget",
")",
"{",
"$",
"name",
"=",
"$",
"nameOrWidget",
"instanceof",
"WidgetInterface",
"?",
"$",
"nameOrWidget",
"->",
"getName",
"(",
")",
":",
"$",
"nameOrWidget",
";",
"return",
"array_key_exists",
"("... | Returns whether the dashboard has the widget or not.
@param string|WidgetInterface $nameOrWidget
@return bool | [
"Returns",
"whether",
"the",
"dashboard",
"has",
"the",
"widget",
"or",
"not",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/Dashboard/Dashboard.php#L34-L39 |
204,697 | ekyna/AdminBundle | Dashboard/Dashboard.php | Dashboard.addWidget | public function addWidget(WidgetInterface $widget)
{
if ($this->hasWidget($widget)) {
throw new \InvalidArgumentException(sprintf('Widget "%s" is already registered.', $widget->getName()));
}
$this->widgets[$widget->getName()] = $widget;
return $this;
} | php | public function addWidget(WidgetInterface $widget)
{
if ($this->hasWidget($widget)) {
throw new \InvalidArgumentException(sprintf('Widget "%s" is already registered.', $widget->getName()));
}
$this->widgets[$widget->getName()] = $widget;
return $this;
} | [
"public",
"function",
"addWidget",
"(",
"WidgetInterface",
"$",
"widget",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasWidget",
"(",
"$",
"widget",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Widget \"%s\" is already ... | Adds the widget.
@param WidgetInterface $widget
@return Dashboard | [
"Adds",
"the",
"widget",
"."
] | 3f58e253ae9cf651add7f3d587caec80eaea459a | https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/Dashboard/Dashboard.php#L47-L56 |
204,698 | schpill/thin | src/OneModel.php | OneWrapper.filter | public function filter()
{
$args = func_get_args();
$filter_function = array_shift($args);
array_unshift($args, $this);
if (method_exists($this->_class_name, $filter_function)) {
return call_user_func_array([$this->_class_name, $filter_function], ... | php | public function filter()
{
$args = func_get_args();
$filter_function = array_shift($args);
array_unshift($args, $this);
if (method_exists($this->_class_name, $filter_function)) {
return call_user_func_array([$this->_class_name, $filter_function], ... | [
"public",
"function",
"filter",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"filter_function",
"=",
"array_shift",
"(",
"$",
"args",
")",
";",
"array_unshift",
"(",
"$",
"args",
",",
"$",
"this",
")",
";",
"if",
"(",
"method... | Add a custom filter to the method chain specified on the
model class. This allows custom queries to be added
to models. The filter should take an instance of the
One wrapper as its first argument and return an instance
of the One wrapper. Any arguments passed to this method
after the name of the filter will be passed t... | [
"Add",
"a",
"custom",
"filter",
"to",
"the",
"method",
"chain",
"specified",
"on",
"the",
"model",
"class",
".",
"This",
"allows",
"custom",
"queries",
"to",
"be",
"added",
"to",
"models",
".",
"The",
"filter",
"should",
"take",
"an",
"instance",
"of",
"... | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/OneModel.php#L35-L44 |
204,699 | schpill/thin | src/OneModel.php | OneWrapper.for_table | public static function for_table($table_name, $connection_name = parent::DEFAULT_CONNECTION)
{
self::_setupDb($connection_name);
return new self($table_name, [], $connection_name);
} | php | public static function for_table($table_name, $connection_name = parent::DEFAULT_CONNECTION)
{
self::_setupDb($connection_name);
return new self($table_name, [], $connection_name);
} | [
"public",
"static",
"function",
"for_table",
"(",
"$",
"table_name",
",",
"$",
"connection_name",
"=",
"parent",
"::",
"DEFAULT_CONNECTION",
")",
"{",
"self",
"::",
"_setupDb",
"(",
"$",
"connection_name",
")",
";",
"return",
"new",
"self",
"(",
"$",
"table_... | Factory method, return an instance of this
class bound to the supplied table name.
A repeat of content in parent::for_table, so that
created class is OneWrapper, not One
@param string $table_name
@param string $connection_name
@return OneWrapper | [
"Factory",
"method",
"return",
"an",
"instance",
"of",
"this",
"class",
"bound",
"to",
"the",
"supplied",
"table",
"name",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/OneModel.php#L57-L62 |
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.