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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
199,500 | ekyna/Resource | Serializer/AbstractTranslatableNormalizer.php | AbstractTranslatableNormalizer.normalizeTranslations | protected function normalizeTranslations(Model\TranslatableInterface $translatable, $format, array $context = [])
{
$data = [];
$groups = isset($context['groups']) ? (array)$context['groups'] : [];
/*if (in_array('Default', $groups)) {
if ($translatable instanceof Model\Transla... | php | protected function normalizeTranslations(Model\TranslatableInterface $translatable, $format, array $context = [])
{
$data = [];
$groups = isset($context['groups']) ? (array)$context['groups'] : [];
/*if (in_array('Default', $groups)) {
if ($translatable instanceof Model\Transla... | [
"protected",
"function",
"normalizeTranslations",
"(",
"Model",
"\\",
"TranslatableInterface",
"$",
"translatable",
",",
"$",
"format",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"groups",
"=",
"isset",
"... | Normalizes the translatable's translations.
@param Model\TranslatableInterface $translatable
@param string $format
@param array $context
@return array | [
"Normalizes",
"the",
"translatable",
"s",
"translations",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Serializer/AbstractTranslatableNormalizer.php#L39-L61 |
199,501 | agentmedia/phine-core | src/Core/Logic/Access/Frontend/MemberGuard.php | MemberGuard.Groups | private function Groups()
{
if ($this->groups === null)
{
$this->groups = array();
if ($this->GetMember())
{
$this->groups = MembergroupUtil::MemberMembergroups($this->GetMember());
}
}
return $this->groups;
} | php | private function Groups()
{
if ($this->groups === null)
{
$this->groups = array();
if ($this->GetMember())
{
$this->groups = MembergroupUtil::MemberMembergroups($this->GetMember());
}
}
return $this->groups;
} | [
"private",
"function",
"Groups",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"groups",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"groups",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"GetMember",
"(",
")",
")",
"{",
"$",
"this... | The groups of the current member
@return Membergroup[] Returns the groups of the current member | [
"The",
"groups",
"of",
"the",
"current",
"member"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Frontend/MemberGuard.php#L53-L64 |
199,502 | agentmedia/phine-core | src/Core/Logic/Access/Frontend/MemberGuard.php | MemberGuard.Grant | public function Grant(Action $action, $onObject)
{
if ($onObject instanceof Page)
{
return $this->GrantOnPage($onObject);
}
if ($onObject instanceof Content)
{
return $this->GrantOnContent($onObject, $action);
}
else
{
... | php | public function Grant(Action $action, $onObject)
{
if ($onObject instanceof Page)
{
return $this->GrantOnPage($onObject);
}
if ($onObject instanceof Content)
{
return $this->GrantOnContent($onObject, $action);
}
else
{
... | [
"public",
"function",
"Grant",
"(",
"Action",
"$",
"action",
",",
"$",
"onObject",
")",
"{",
"if",
"(",
"$",
"onObject",
"instanceof",
"Page",
")",
"{",
"return",
"$",
"this",
"->",
"GrantOnPage",
"(",
"$",
"onObject",
")",
";",
"}",
"if",
"(",
"$",
... | Check access to an object in the frontend
@param Action $action The action taken on the object
@param mixed $onObject The object; page and contents are currently supported
@return GrantResult Returns the check result | [
"Check",
"access",
"to",
"an",
"object",
"in",
"the",
"frontend"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Frontend/MemberGuard.php#L72-L87 |
199,503 | agentmedia/phine-core | src/Core/Logic/Access/Frontend/MemberGuard.php | MemberGuard.GrantByProperties | private function GrantByProperties($guestsOnly, $publish, Date $from = null, Date $to = null, array $groups = array())
{
if (!PublishDateUtil::IsPublishedNow($publish, $from, $to))
{
return GrantResult::NoAccess();
}
if ($this->GetMember() && $guestsOnly)
{
... | php | private function GrantByProperties($guestsOnly, $publish, Date $from = null, Date $to = null, array $groups = array())
{
if (!PublishDateUtil::IsPublishedNow($publish, $from, $to))
{
return GrantResult::NoAccess();
}
if ($this->GetMember() && $guestsOnly)
{
... | [
"private",
"function",
"GrantByProperties",
"(",
"$",
"guestsOnly",
",",
"$",
"publish",
",",
"Date",
"$",
"from",
"=",
"null",
",",
"Date",
"$",
"to",
"=",
"null",
",",
"array",
"$",
"groups",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"Pub... | Checks access to an item by its properties and assigned groups
@param boolean $guestsOnly True if guests only see the item
@param boolean $publish True if item is generally published
@param Date $from The start date of publishing
@param Date $to The end date of publishing
@param Membergroup[] $groups Groups assigned to... | [
"Checks",
"access",
"to",
"an",
"item",
"by",
"its",
"properties",
"and",
"assigned",
"groups"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Frontend/MemberGuard.php#L99-L121 |
199,504 | agentmedia/phine-core | src/Core/Logic/Access/Frontend/MemberGuard.php | MemberGuard.GrantOnPage | private function GrantOnPage(Page $page)
{
$groups = MembergroupUtil::PageMembergroups($page);
return $this->GrantByProperties($page->GetGuestsOnly(), $page->GetPublish(),
$page->GetPublishFrom(), $page->GetPublishTo(), $groups);
} | php | private function GrantOnPage(Page $page)
{
$groups = MembergroupUtil::PageMembergroups($page);
return $this->GrantByProperties($page->GetGuestsOnly(), $page->GetPublish(),
$page->GetPublishFrom(), $page->GetPublishTo(), $groups);
} | [
"private",
"function",
"GrantOnPage",
"(",
"Page",
"$",
"page",
")",
"{",
"$",
"groups",
"=",
"MembergroupUtil",
"::",
"PageMembergroups",
"(",
"$",
"page",
")",
";",
"return",
"$",
"this",
"->",
"GrantByProperties",
"(",
"$",
"page",
"->",
"GetGuestsOnly",
... | Checks a page for access rights
@param Page $page The page for the access check
@return GrantResult Returns the check result | [
"Checks",
"a",
"page",
"for",
"access",
"rights"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Frontend/MemberGuard.php#L128-L134 |
199,505 | agentmedia/phine-core | src/Core/Logic/Access/Frontend/MemberGuard.php | MemberGuard.GrantOnContent | private function GrantOnContent(Content $content)
{
$groups = MembergroupUtil::ContentMembergroups($content);
return $this->GrantByProperties($content->GetGuestsOnly(), $content->GetPublish(),
$content->GetPublishFrom(), $content->GetPublishTo(), $groups);
} | php | private function GrantOnContent(Content $content)
{
$groups = MembergroupUtil::ContentMembergroups($content);
return $this->GrantByProperties($content->GetGuestsOnly(), $content->GetPublish(),
$content->GetPublishFrom(), $content->GetPublishTo(), $groups);
} | [
"private",
"function",
"GrantOnContent",
"(",
"Content",
"$",
"content",
")",
"{",
"$",
"groups",
"=",
"MembergroupUtil",
"::",
"ContentMembergroups",
"(",
"$",
"content",
")",
";",
"return",
"$",
"this",
"->",
"GrantByProperties",
"(",
"$",
"content",
"->",
... | Checks access to a content
@param Content $content The content
@return GrantResult The result of the check | [
"Checks",
"access",
"to",
"a",
"content"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Frontend/MemberGuard.php#L141-L146 |
199,506 | pixelpolishers/resolver-php-server | src/PixelPolishers/Resolver/Server/Server.php | Server.run | public function run()
{
$url = parse_url($_SERVER['REQUEST_URI']);
$controller = $this->router->find($url['path']);
if (!$controller instanceof ControllerInterface) {
throw new \RuntimeException('No valid controller found.');
}
$controller->setServer($this);
... | php | public function run()
{
$url = parse_url($_SERVER['REQUEST_URI']);
$controller = $this->router->find($url['path']);
if (!$controller instanceof ControllerInterface) {
throw new \RuntimeException('No valid controller found.');
}
$controller->setServer($this);
... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"url",
"=",
"parse_url",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
")",
";",
"$",
"controller",
"=",
"$",
"this",
"->",
"router",
"->",
"find",
"(",
"$",
"url",
"[",
"'path'",
"]",
")",
";",
... | Runs the listener.
@throws \RuntimeException | [
"Runs",
"the",
"listener",
"."
] | c07505a768b32b30c7c300b3fb7e41d1776cb6e9 | https://github.com/pixelpolishers/resolver-php-server/blob/c07505a768b32b30c7c300b3fb7e41d1776cb6e9/src/PixelPolishers/Resolver/Server/Server.php#L71-L91 |
199,507 | dann95/ts3-php | TeamSpeak3/Node/Server.php | Server.channelGroupList | public function channelGroupList(array $filter = array())
{
if ($this->cgroupList === null) {
$this->cgroupList = $this->request("channelgrouplist")->toAssocArray("cgid");
foreach ($this->cgroupList as $cgid => $group) {
$this->cgroupList[$cgid] = new Channelgroug($t... | php | public function channelGroupList(array $filter = array())
{
if ($this->cgroupList === null) {
$this->cgroupList = $this->request("channelgrouplist")->toAssocArray("cgid");
foreach ($this->cgroupList as $cgid => $group) {
$this->cgroupList[$cgid] = new Channelgroug($t... | [
"public",
"function",
"channelGroupList",
"(",
"array",
"$",
"filter",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cgroupList",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"cgroupList",
"=",
"$",
"this",
"->",
"request",
"(",
"\"... | Returns a list of channel groups available.
@param array $filter
@return array | [
"Returns",
"a",
"list",
"of",
"channel",
"groups",
"available",
"."
] | d4693d78b54be0177a2b5fab316c0ff9d036238d | https://github.com/dann95/ts3-php/blob/d4693d78b54be0177a2b5fab316c0ff9d036238d/TeamSpeak3/Node/Server.php#L1389-L1402 |
199,508 | flextype-components/session | Session.php | Session.delete | public static function delete()
{
// Loop all arguments
foreach (func_get_args() as $argument) {
// Array element
if (is_array($argument)) {
// Loop the keys
foreach ($argument as $key) {
// Unset session key
... | php | public static function delete()
{
// Loop all arguments
foreach (func_get_args() as $argument) {
// Array element
if (is_array($argument)) {
// Loop the keys
foreach ($argument as $key) {
// Unset session key
... | [
"public",
"static",
"function",
"delete",
"(",
")",
"{",
"// Loop all arguments",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"argument",
")",
"{",
"// Array element",
"if",
"(",
"is_array",
"(",
"$",
"argument",
")",
")",
"{",
"// Loop the keys",
... | Deletes one or more session variables.
Session::delete('user'); | [
"Deletes",
"one",
"or",
"more",
"session",
"variables",
"."
] | 9c0ae15c1be39d64164e5abc609ec3bd090edc59 | https://github.com/flextype-components/session/blob/9c0ae15c1be39d64164e5abc609ec3bd090edc59/Session.php#L40-L60 |
199,509 | flextype-components/session | Session.php | Session.exists | public static function exists() : bool
{
// Start session if needed
if (! session_id()) {
Session::start();
}
// Loop all arguments
foreach (func_get_args() as $argument) {
// Array element
if (is_array($argument)) {
// L... | php | public static function exists() : bool
{
// Start session if needed
if (! session_id()) {
Session::start();
}
// Loop all arguments
foreach (func_get_args() as $argument) {
// Array element
if (is_array($argument)) {
// L... | [
"public",
"static",
"function",
"exists",
"(",
")",
":",
"bool",
"{",
"// Start session if needed",
"if",
"(",
"!",
"session_id",
"(",
")",
")",
"{",
"Session",
"::",
"start",
"(",
")",
";",
"}",
"// Loop all arguments",
"foreach",
"(",
"func_get_args",
"(",... | Checks if a session variable exists.
if (Session::exists('user')) {
// Do something...
}
@return bool | [
"Checks",
"if",
"a",
"session",
"variable",
"exists",
"."
] | 9c0ae15c1be39d64164e5abc609ec3bd090edc59 | https://github.com/flextype-components/session/blob/9c0ae15c1be39d64164e5abc609ec3bd090edc59/Session.php#L86-L117 |
199,510 | flextype-components/session | Session.php | Session.get | public static function get(string $key)
{
// Start session if needed
if (! session_id()) {
self::start();
}
// Fetch key
if (Session::exists((string) $key)) {
return $_SESSION[(string) $key];
}
// Key doesn't exist
return null... | php | public static function get(string $key)
{
// Start session if needed
if (! session_id()) {
self::start();
}
// Fetch key
if (Session::exists((string) $key)) {
return $_SESSION[(string) $key];
}
// Key doesn't exist
return null... | [
"public",
"static",
"function",
"get",
"(",
"string",
"$",
"key",
")",
"{",
"// Start session if needed",
"if",
"(",
"!",
"session_id",
"(",
")",
")",
"{",
"self",
"::",
"start",
"(",
")",
";",
"}",
"// Fetch key",
"if",
"(",
"Session",
"::",
"exists",
... | Gets a variable that was stored in the session.
echo Session::get('user');
@param string $key The key of the variable to get.
@return mixed | [
"Gets",
"a",
"variable",
"that",
"was",
"stored",
"in",
"the",
"session",
"."
] | 9c0ae15c1be39d64164e5abc609ec3bd090edc59 | https://github.com/flextype-components/session/blob/9c0ae15c1be39d64164e5abc609ec3bd090edc59/Session.php#L127-L141 |
199,511 | flextype-components/session | Session.php | Session.set | public static function set(string $key, $value)
{
// Start session if needed
if (! session_id()) {
self::start();
}
// Set key
$_SESSION[(string) $key] = $value;
} | php | public static function set(string $key, $value)
{
// Start session if needed
if (! session_id()) {
self::start();
}
// Set key
$_SESSION[(string) $key] = $value;
} | [
"public",
"static",
"function",
"set",
"(",
"string",
"$",
"key",
",",
"$",
"value",
")",
"{",
"// Start session if needed",
"if",
"(",
"!",
"session_id",
"(",
")",
")",
"{",
"self",
"::",
"start",
"(",
")",
";",
"}",
"// Set key",
"$",
"_SESSION",
"["... | Stores a variable in the session.
Session::set('user', 'Awilum');
@param string $key The key for the variable.
@param mixed $value The value to store. | [
"Stores",
"a",
"variable",
"in",
"the",
"session",
"."
] | 9c0ae15c1be39d64164e5abc609ec3bd090edc59 | https://github.com/flextype-components/session/blob/9c0ae15c1be39d64164e5abc609ec3bd090edc59/Session.php#L169-L178 |
199,512 | fxpio/fxp-doctrine-extensions | Validator/Constraints/Util.php | Util.getFormattedIdentifier | public static function getFormattedIdentifier(ClassMetadata $relatedClass, array $criteria, $fieldName, $value)
{
$isObject = \is_object($criteria[$fieldName]);
return $isObject && null === $value
? self::formatEmptyIdentifier($relatedClass)
: $value;
} | php | public static function getFormattedIdentifier(ClassMetadata $relatedClass, array $criteria, $fieldName, $value)
{
$isObject = \is_object($criteria[$fieldName]);
return $isObject && null === $value
? self::formatEmptyIdentifier($relatedClass)
: $value;
} | [
"public",
"static",
"function",
"getFormattedIdentifier",
"(",
"ClassMetadata",
"$",
"relatedClass",
",",
"array",
"$",
"criteria",
",",
"$",
"fieldName",
",",
"$",
"value",
")",
"{",
"$",
"isObject",
"=",
"\\",
"is_object",
"(",
"$",
"criteria",
"[",
"$",
... | Get the formatted identifier.
@param ClassMetadata $relatedClass The metadata of related class
@param array $criteria The validator criteria
@param string $fieldName The field name
@param null|int|string $value The identifier value
@return int|string | [
"Get",
"the",
"formatted",
"identifier",
"."
] | 82942f51d47cdd79a20a5725ee1b3ecfc69e9d77 | https://github.com/fxpio/fxp-doctrine-extensions/blob/82942f51d47cdd79a20a5725ee1b3ecfc69e9d77/Validator/Constraints/Util.php#L38-L45 |
199,513 | fxpio/fxp-doctrine-extensions | Validator/Constraints/Util.php | Util.formatEmptyIdentifier | public static function formatEmptyIdentifier(ClassMetadata $meta)
{
$type = $meta->getTypeOfField(current($meta->getIdentifier()));
switch ($type) {
case 'bigint':
case 'decimal':
case 'integer':
case 'smallint':
case 'float':
... | php | public static function formatEmptyIdentifier(ClassMetadata $meta)
{
$type = $meta->getTypeOfField(current($meta->getIdentifier()));
switch ($type) {
case 'bigint':
case 'decimal':
case 'integer':
case 'smallint':
case 'float':
... | [
"public",
"static",
"function",
"formatEmptyIdentifier",
"(",
"ClassMetadata",
"$",
"meta",
")",
"{",
"$",
"type",
"=",
"$",
"meta",
"->",
"getTypeOfField",
"(",
"current",
"(",
"$",
"meta",
"->",
"getIdentifier",
"(",
")",
")",
")",
";",
"switch",
"(",
... | Format the empty identifier value for entity with relation.
@param ClassMetadata $meta The class metadata of entity relation
@return int|string | [
"Format",
"the",
"empty",
"identifier",
"value",
"for",
"entity",
"with",
"relation",
"."
] | 82942f51d47cdd79a20a5725ee1b3ecfc69e9d77 | https://github.com/fxpio/fxp-doctrine-extensions/blob/82942f51d47cdd79a20a5725ee1b3ecfc69e9d77/Validator/Constraints/Util.php#L54-L70 |
199,514 | fxpio/fxp-doctrine-extensions | Validator/Constraints/Util.php | Util.getObjectManager | public static function getObjectManager(ManagerRegistry $registry, $entity, Constraint $constraint)
{
self::validateConstraint($constraint);
/* @var UniqueEntity $constraint */
return self::findObjectManager($registry, $entity, $constraint);
} | php | public static function getObjectManager(ManagerRegistry $registry, $entity, Constraint $constraint)
{
self::validateConstraint($constraint);
/* @var UniqueEntity $constraint */
return self::findObjectManager($registry, $entity, $constraint);
} | [
"public",
"static",
"function",
"getObjectManager",
"(",
"ManagerRegistry",
"$",
"registry",
",",
"$",
"entity",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"self",
"::",
"validateConstraint",
"(",
"$",
"constraint",
")",
";",
"/* @var UniqueEntity $constraint *... | Pre validate entity.
@param ManagerRegistry $registry
@param object $entity
@param Constraint $constraint
@throws UnexpectedTypeException
@throws ConstraintDefinitionException
@return ObjectManager | [
"Pre",
"validate",
"entity",
"."
] | 82942f51d47cdd79a20a5725ee1b3ecfc69e9d77 | https://github.com/fxpio/fxp-doctrine-extensions/blob/82942f51d47cdd79a20a5725ee1b3ecfc69e9d77/Validator/Constraints/Util.php#L84-L90 |
199,515 | field-interactive/cito-bundle | Composer/ScriptHandler.php | ScriptHandler.updateCito | public static function updateCito(Event $event)
{
$options = static::getOptions($event);
$configDir = $options['symfony-config-dir'];
$templateDir = $options['symfony-template-dir'];
$fs = new Filesystem();
/*
* Update config/packages/cito.yaml
*/
$... | php | public static function updateCito(Event $event)
{
$options = static::getOptions($event);
$configDir = $options['symfony-config-dir'];
$templateDir = $options['symfony-template-dir'];
$fs = new Filesystem();
/*
* Update config/packages/cito.yaml
*/
$... | [
"public",
"static",
"function",
"updateCito",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"options",
"=",
"static",
"::",
"getOptions",
"(",
"$",
"event",
")",
";",
"$",
"configDir",
"=",
"$",
"options",
"[",
"'symfony-config-dir'",
"]",
";",
"$",
"templa... | Update the Cito files without delete user changes
@param Event $event | [
"Update",
"the",
"Cito",
"files",
"without",
"delete",
"user",
"changes"
] | 41cab570f960d964916e278c616720b17de258c1 | https://github.com/field-interactive/cito-bundle/blob/41cab570f960d964916e278c616720b17de258c1/Composer/ScriptHandler.php#L183-L218 |
199,516 | cubicmushroom/valueobjects | src/DateTime/TimeZone.php | TimeZone.sameValueAs | public function sameValueAs(ValueObjectInterface $timezone)
{
if (false === Util::classEquals($this, $timezone)) {
return false;
}
return $this->getName()->sameValueAs($timezone->getName());
} | php | public function sameValueAs(ValueObjectInterface $timezone)
{
if (false === Util::classEquals($this, $timezone)) {
return false;
}
return $this->getName()->sameValueAs($timezone->getName());
} | [
"public",
"function",
"sameValueAs",
"(",
"ValueObjectInterface",
"$",
"timezone",
")",
"{",
"if",
"(",
"false",
"===",
"Util",
"::",
"classEquals",
"(",
"$",
"this",
",",
"$",
"timezone",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this"... | Tells whether two DateTimeZone are equal by comparing their names
@param ValueObjectInterface $timezone
@return bool | [
"Tells",
"whether",
"two",
"DateTimeZone",
"are",
"equal",
"by",
"comparing",
"their",
"names"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/DateTime/TimeZone.php#L82-L89 |
199,517 | realboard/DBInstance | src/Realboard/Component/Database/DBInstance/Query.php | Query.setQuery | public function setQuery($query)
{
$raw = SqlFormatter::removeComments($query);
if ($this->noSplit) {
$queries = array($raw);
} else {
$queries = SqlFormatter::splitQuery($raw);
}
foreach ($queries as $index => $q) {
$this->addOrReplace($i... | php | public function setQuery($query)
{
$raw = SqlFormatter::removeComments($query);
if ($this->noSplit) {
$queries = array($raw);
} else {
$queries = SqlFormatter::splitQuery($raw);
}
foreach ($queries as $index => $q) {
$this->addOrReplace($i... | [
"public",
"function",
"setQuery",
"(",
"$",
"query",
")",
"{",
"$",
"raw",
"=",
"SqlFormatter",
"::",
"removeComments",
"(",
"$",
"query",
")",
";",
"if",
"(",
"$",
"this",
"->",
"noSplit",
")",
"{",
"$",
"queries",
"=",
"array",
"(",
"$",
"raw",
"... | Set SQL Query.
@param string $query | [
"Set",
"SQL",
"Query",
"."
] | f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35 | https://github.com/realboard/DBInstance/blob/f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35/src/Realboard/Component/Database/DBInstance/Query.php#L138-L152 |
199,518 | realboard/DBInstance | src/Realboard/Component/Database/DBInstance/Query.php | Query.setResultDataType | public function setResultDataType($resultDataType)
{
if (is_string($resultDataType) && class_exists($resultDataType)) {
$resultDataType = new $resultDataType();
}
if ($resultDataType instanceof DataInterface) {
$this->resultDataType = $resultDataType;
}
... | php | public function setResultDataType($resultDataType)
{
if (is_string($resultDataType) && class_exists($resultDataType)) {
$resultDataType = new $resultDataType();
}
if ($resultDataType instanceof DataInterface) {
$this->resultDataType = $resultDataType;
}
... | [
"public",
"function",
"setResultDataType",
"(",
"$",
"resultDataType",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"resultDataType",
")",
"&&",
"class_exists",
"(",
"$",
"resultDataType",
")",
")",
"{",
"$",
"resultDataType",
"=",
"new",
"$",
"resultDataType",... | Set Result Data Type.
@param srting|\Realboard\Component\Database\DBInstance\DBInterface\DataInterface $resultDataType | [
"Set",
"Result",
"Data",
"Type",
"."
] | f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35 | https://github.com/realboard/DBInstance/blob/f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35/src/Realboard/Component/Database/DBInstance/Query.php#L159-L177 |
199,519 | realboard/DBInstance | src/Realboard/Component/Database/DBInstance/Query.php | Query.setInitializer | public function setInitializer(QueryInitializer $initial)
{
$this->initial = $initial;
for ($i = 0; $i < $this->length(); ++$i) {
if ($this->offsetExists($i)) {
$this->offsetGet($i)->setInitializer($this->initial);
}
}
} | php | public function setInitializer(QueryInitializer $initial)
{
$this->initial = $initial;
for ($i = 0; $i < $this->length(); ++$i) {
if ($this->offsetExists($i)) {
$this->offsetGet($i)->setInitializer($this->initial);
}
}
} | [
"public",
"function",
"setInitializer",
"(",
"QueryInitializer",
"$",
"initial",
")",
"{",
"$",
"this",
"->",
"initial",
"=",
"$",
"initial",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"this",
"->",
"length",
"(",
")",
";",
"++",... | Set Initializer Class.
@param \Realboard\Component\Database\DBInstance\QueryInitializer $initial | [
"Set",
"Initializer",
"Class",
"."
] | f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35 | https://github.com/realboard/DBInstance/blob/f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35/src/Realboard/Component/Database/DBInstance/Query.php#L194-L202 |
199,520 | realboard/DBInstance | src/Realboard/Component/Database/DBInstance/Query.php | Query.add | public function add(SQLInterface $sql)
{
$this->raw[] = $sql->toString();
if (!$sql->getId()) {
$sql->setId($this->count() + 1);
}
$sql->setInitializer($this->initial);
$this->append($sql);
} | php | public function add(SQLInterface $sql)
{
$this->raw[] = $sql->toString();
if (!$sql->getId()) {
$sql->setId($this->count() + 1);
}
$sql->setInitializer($this->initial);
$this->append($sql);
} | [
"public",
"function",
"add",
"(",
"SQLInterface",
"$",
"sql",
")",
"{",
"$",
"this",
"->",
"raw",
"[",
"]",
"=",
"$",
"sql",
"->",
"toString",
"(",
")",
";",
"if",
"(",
"!",
"$",
"sql",
"->",
"getId",
"(",
")",
")",
"{",
"$",
"sql",
"->",
"se... | Append SQL Object.
@param \Realboard\Component\Database\DBInstance\DBInterface\SQLInterface $sql | [
"Append",
"SQL",
"Object",
"."
] | f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35 | https://github.com/realboard/DBInstance/blob/f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35/src/Realboard/Component/Database/DBInstance/Query.php#L219-L228 |
199,521 | realboard/DBInstance | src/Realboard/Component/Database/DBInstance/Query.php | Query.toArray | public function toArray()
{
$arrayResult = array();
for ($i = 0; $i < $this->length(); ++$i) {
if ($this->offsetExists($i)) {
$arrayResult[] = $this->offsetGet($i)->toArray();
}
}
return $arrayResult;
} | php | public function toArray()
{
$arrayResult = array();
for ($i = 0; $i < $this->length(); ++$i) {
if ($this->offsetExists($i)) {
$arrayResult[] = $this->offsetGet($i)->toArray();
}
}
return $arrayResult;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"arrayResult",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"this",
"->",
"length",
"(",
")",
";",
"++",
"$",
"i",
")",
"{",
"if",
"(",
"$",
"this... | Get All SQL Query as an array.
@return array | [
"Get",
"All",
"SQL",
"Query",
"as",
"an",
"array",
"."
] | f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35 | https://github.com/realboard/DBInstance/blob/f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35/src/Realboard/Component/Database/DBInstance/Query.php#L255-L265 |
199,522 | realboard/DBInstance | src/Realboard/Component/Database/DBInstance/Query.php | Query.clear | public function clear()
{
for ($i = 0; $i < $this->length(); ++$i) {
if ($this->offsetExists($i)) {
$this->offsetUnset($i);
}
}
} | php | public function clear()
{
for ($i = 0; $i < $this->length(); ++$i) {
if ($this->offsetExists($i)) {
$this->offsetUnset($i);
}
}
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"this",
"->",
"length",
"(",
")",
";",
"++",
"$",
"i",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"offsetExists",
"(",
"$",
"i",
")",
")",
... | Clear all sql queries. | [
"Clear",
"all",
"sql",
"queries",
"."
] | f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35 | https://github.com/realboard/DBInstance/blob/f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35/src/Realboard/Component/Database/DBInstance/Query.php#L270-L277 |
199,523 | realboard/DBInstance | src/Realboard/Component/Database/DBInstance/Query.php | Query.last | public function last()
{
$lastIndex = $this->count() - 1;
if ($this->offsetExists($lastIndex)) {
return $this->offsetGet($lastIndex);
}
} | php | public function last()
{
$lastIndex = $this->count() - 1;
if ($this->offsetExists($lastIndex)) {
return $this->offsetGet($lastIndex);
}
} | [
"public",
"function",
"last",
"(",
")",
"{",
"$",
"lastIndex",
"=",
"$",
"this",
"->",
"count",
"(",
")",
"-",
"1",
";",
"if",
"(",
"$",
"this",
"->",
"offsetExists",
"(",
"$",
"lastIndex",
")",
")",
"{",
"return",
"$",
"this",
"->",
"offsetGet",
... | Get last sql query if single query will return first query.
@return \Realboard\Component\Database\DBInstance\Sql | [
"Get",
"last",
"sql",
"query",
"if",
"single",
"query",
"will",
"return",
"first",
"query",
"."
] | f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35 | https://github.com/realboard/DBInstance/blob/f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35/src/Realboard/Component/Database/DBInstance/Query.php#L296-L302 |
199,524 | realboard/DBInstance | src/Realboard/Component/Database/DBInstance/Query.php | Query.addOrReplace | public function addOrReplace($index, $stringSql)
{
if (!$stringSql) {
return;
}
$sql = null;
if ($this->offsetExists($index)) {
$sql = $this->offsetGet($index);
$sql->setSql($stringSql);
} else {
$sql = new Sql($stringSql);
... | php | public function addOrReplace($index, $stringSql)
{
if (!$stringSql) {
return;
}
$sql = null;
if ($this->offsetExists($index)) {
$sql = $this->offsetGet($index);
$sql->setSql($stringSql);
} else {
$sql = new Sql($stringSql);
... | [
"public",
"function",
"addOrReplace",
"(",
"$",
"index",
",",
"$",
"stringSql",
")",
"{",
"if",
"(",
"!",
"$",
"stringSql",
")",
"{",
"return",
";",
"}",
"$",
"sql",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"offsetExists",
"(",
"$",
"index",... | Add Or Replace old query.
@param int $index
@param string $stringSql | [
"Add",
"Or",
"Replace",
"old",
"query",
"."
] | f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35 | https://github.com/realboard/DBInstance/blob/f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35/src/Realboard/Component/Database/DBInstance/Query.php#L360-L375 |
199,525 | fuelphp-storage/session | src/Driver.php | Driver.regenerate | public function regenerate()
{
// generate a new random session id
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$sessionId = '';
for ($i=0; $i < 32; $i++)
{
$sessionId .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
}
// store the new session id
$this->setSessionI... | php | public function regenerate()
{
// generate a new random session id
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$sessionId = '';
for ($i=0; $i < 32; $i++)
{
$sessionId .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
}
// store the new session id
$this->setSessionI... | [
"public",
"function",
"regenerate",
"(",
")",
"{",
"// generate a new random session id",
"$",
"pool",
"=",
"'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'",
";",
"$",
"sessionId",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<... | Regenerates the session id | [
"Regenerates",
"the",
"session",
"id"
] | 948fd2b45286e65e7fababf65de89ca6aaca3c4a | https://github.com/fuelphp-storage/session/blob/948fd2b45286e65e7fababf65de89ca6aaca3c4a/src/Driver.php#L152-L164 |
199,526 | fuelphp-storage/session | src/Driver.php | Driver.setInstances | public function setInstances(Manager $manager, DataContainer $data, FlashContainer $flash)
{
$this->manager = $manager;
$this->data = $data;
$this->flash = $flash;
} | php | public function setInstances(Manager $manager, DataContainer $data, FlashContainer $flash)
{
$this->manager = $manager;
$this->data = $data;
$this->flash = $flash;
} | [
"public",
"function",
"setInstances",
"(",
"Manager",
"$",
"manager",
",",
"DataContainer",
"$",
"data",
",",
"FlashContainer",
"$",
"flash",
")",
"{",
"$",
"this",
"->",
"manager",
"=",
"$",
"manager",
";",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
... | Sets the manager that manages this driver and container instances for this session
@param Manager $manager
@param DataContainer $data
@param FlashContainer $data | [
"Sets",
"the",
"manager",
"that",
"manages",
"this",
"driver",
"and",
"container",
"instances",
"for",
"this",
"session"
] | 948fd2b45286e65e7fababf65de89ca6aaca3c4a | https://github.com/fuelphp-storage/session/blob/948fd2b45286e65e7fababf65de89ca6aaca3c4a/src/Driver.php#L173-L178 |
199,527 | fuelphp-storage/session | src/Driver.php | Driver.findSessionId | protected function findSessionId()
{
// check for a posted session id
if ( ! empty($this->config['post_cookie_name']) and isset($_POST[$this->config['post_cookie_name']]))
{
$this->sessionId = $_POST[$this->config['post_cookie_name']];
}
// else check for a regular cookie
elseif ( ! empty($this->config... | php | protected function findSessionId()
{
// check for a posted session id
if ( ! empty($this->config['post_cookie_name']) and isset($_POST[$this->config['post_cookie_name']]))
{
$this->sessionId = $_POST[$this->config['post_cookie_name']];
}
// else check for a regular cookie
elseif ( ! empty($this->config... | [
"protected",
"function",
"findSessionId",
"(",
")",
"{",
"// check for a posted session id",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"config",
"[",
"'post_cookie_name'",
"]",
")",
"and",
"isset",
"(",
"$",
"_POST",
"[",
"$",
"this",
"->",
"config",
... | Finds the current session id | [
"Finds",
"the",
"current",
"session",
"id"
] | 948fd2b45286e65e7fababf65de89ca6aaca3c4a | https://github.com/fuelphp-storage/session/blob/948fd2b45286e65e7fababf65de89ca6aaca3c4a/src/Driver.php#L243-L266 |
199,528 | fuelphp-storage/session | src/Driver.php | Driver.setCookie | protected function setCookie($name, $value)
{
// add the current time so we have an offset
$expiration = $this->expiration > 0 ? $this->expiration + time() : 0;
return setcookie($name, $value, $expiration, $this->config['cookie_path'], $this->config['cookie_domain'], $this->config['cookie_secure'], $this->confi... | php | protected function setCookie($name, $value)
{
// add the current time so we have an offset
$expiration = $this->expiration > 0 ? $this->expiration + time() : 0;
return setcookie($name, $value, $expiration, $this->config['cookie_path'], $this->config['cookie_domain'], $this->config['cookie_secure'], $this->confi... | [
"protected",
"function",
"setCookie",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"// add the current time so we have an offset",
"$",
"expiration",
"=",
"$",
"this",
"->",
"expiration",
">",
"0",
"?",
"$",
"this",
"->",
"expiration",
"+",
"time",
"(",
")... | Sets a cookie. Note that all cookie values must be strings and no
automatic serialization will be performed!
@param string $name
@param string $value
@return boolean | [
"Sets",
"a",
"cookie",
".",
"Note",
"that",
"all",
"cookie",
"values",
"must",
"be",
"strings",
"and",
"no",
"automatic",
"serialization",
"will",
"be",
"performed!"
] | 948fd2b45286e65e7fababf65de89ca6aaca3c4a | https://github.com/fuelphp-storage/session/blob/948fd2b45286e65e7fababf65de89ca6aaca3c4a/src/Driver.php#L342-L348 |
199,529 | fuelphp-storage/session | src/Driver.php | Driver.deleteCookie | protected function deleteCookie($name)
{
// Remove the cookie
unset($_COOKIE[$name]);
// Nullify the cookie and make it expire
return setcookie($name, null, -86400, $this->config['cookie_path'], $this->config['cookie_domain'], $this->config['cookie_secure'], $this->config['cookie_http_only']);
} | php | protected function deleteCookie($name)
{
// Remove the cookie
unset($_COOKIE[$name]);
// Nullify the cookie and make it expire
return setcookie($name, null, -86400, $this->config['cookie_path'], $this->config['cookie_domain'], $this->config['cookie_secure'], $this->config['cookie_http_only']);
} | [
"protected",
"function",
"deleteCookie",
"(",
"$",
"name",
")",
"{",
"// Remove the cookie",
"unset",
"(",
"$",
"_COOKIE",
"[",
"$",
"name",
"]",
")",
";",
"// Nullify the cookie and make it expire",
"return",
"setcookie",
"(",
"$",
"name",
",",
"null",
",",
"... | Deletes a cookie by making the value null and expiring it
@param string $na,e
@return boolean | [
"Deletes",
"a",
"cookie",
"by",
"making",
"the",
"value",
"null",
"and",
"expiring",
"it"
] | 948fd2b45286e65e7fababf65de89ca6aaca3c4a | https://github.com/fuelphp-storage/session/blob/948fd2b45286e65e7fababf65de89ca6aaca3c4a/src/Driver.php#L357-L364 |
199,530 | Subscribo/klarna-invoice-sdk-wrapped | src/pclasses/xmlstorage.class.php | XMLStorage.createFields | protected function createFields($pclass)
{
$fields = array();
//This is to prevent HTMLEntities to be converted to the real character.
$fields[] = $this->dom->createElement('description');
end($fields)->appendChild(
$this->dom->createTextNode($pclass->getDescription())
... | php | protected function createFields($pclass)
{
$fields = array();
//This is to prevent HTMLEntities to be converted to the real character.
$fields[] = $this->dom->createElement('description');
end($fields)->appendChild(
$this->dom->createTextNode($pclass->getDescription())
... | [
"protected",
"function",
"createFields",
"(",
"$",
"pclass",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
")",
";",
"//This is to prevent HTMLEntities to be converted to the real character.",
"$",
"fields",
"[",
"]",
"=",
"$",
"this",
"->",
"dom",
"->",
"createElem... | Creates DOMElement for all fields for specified PClass.
@param KlarnaPClass $pclass pclass object
@return array Array of DOMElements. | [
"Creates",
"DOMElement",
"for",
"all",
"fields",
"for",
"specified",
"PClass",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/pclasses/xmlstorage.class.php#L170-L202 |
199,531 | n2n/n2n-io | src/app/n2n/io/img/ImageResource.php | ImageResource.watermark | public function watermark(ImageResource $watermark, $watermarkPos = 4, $watermarkMargin = 10) {
switch($watermarkPos) {
// center
case 0:
$watermarkdestX = $this->width/2 - $watermark->getWidth()/2;
$watermarkdestY = $this->height/2 - $watermark->getHeight()/2;
break;
// top left
case... | php | public function watermark(ImageResource $watermark, $watermarkPos = 4, $watermarkMargin = 10) {
switch($watermarkPos) {
// center
case 0:
$watermarkdestX = $this->width/2 - $watermark->getWidth()/2;
$watermarkdestY = $this->height/2 - $watermark->getHeight()/2;
break;
// top left
case... | [
"public",
"function",
"watermark",
"(",
"ImageResource",
"$",
"watermark",
",",
"$",
"watermarkPos",
"=",
"4",
",",
"$",
"watermarkMargin",
"=",
"10",
")",
"{",
"switch",
"(",
"$",
"watermarkPos",
")",
"{",
"// center\r",
"case",
"0",
":",
"$",
"watermarkd... | adds a watermark to the image
@param ImageResource $watermark
@param int $watermarkPos
@param int $watermarkMargin | [
"adds",
"a",
"watermark",
"to",
"the",
"image"
] | ff642e195f0c0db1273b6c067eff1192cf2cd987 | https://github.com/n2n/n2n-io/blob/ff642e195f0c0db1273b6c067eff1192cf2cd987/src/app/n2n/io/img/ImageResource.php#L87-L122 |
199,532 | WellCommerce/PaymentBundle | Client/Przelewy24.php | Przelewy24.trnRegister | public function trnRegister($redirect = false)
{
$crc = md5($this->postData["p24_session_id"]."|".$this->posId."|".$this->postData["p24_amount"]."|".$this->postData["p24_currency"]."|".$this->salt);
$this->addValue("p24_sign", $crc);
$RES = $this->callUrl("trnRegister", $th... | php | public function trnRegister($redirect = false)
{
$crc = md5($this->postData["p24_session_id"]."|".$this->posId."|".$this->postData["p24_amount"]."|".$this->postData["p24_currency"]."|".$this->salt);
$this->addValue("p24_sign", $crc);
$RES = $this->callUrl("trnRegister", $th... | [
"public",
"function",
"trnRegister",
"(",
"$",
"redirect",
"=",
"false",
")",
"{",
"$",
"crc",
"=",
"md5",
"(",
"$",
"this",
"->",
"postData",
"[",
"\"p24_session_id\"",
"]",
".",
"\"|\"",
".",
"$",
"this",
"->",
"posId",
".",
"\"|\"",
".",
"$",
"thi... | Prepare a transaction request
@param bool $redirect Set true to redirect to Przelewy24 after transaction registration
@return array array(INT Error code, STRING Token) | [
"Prepare",
"a",
"transaction",
"request"
] | 7fdeb0b5155646f2b638082d2135bec05eb8be98 | https://github.com/WellCommerce/PaymentBundle/blob/7fdeb0b5155646f2b638082d2135bec05eb8be98/Client/Przelewy24.php#L144-L168 |
199,533 | WellCommerce/PaymentBundle | Client/Przelewy24.php | Przelewy24.trnRequest | public function trnRequest($token, $redirect = true)
{
if ($redirect) {
header("Location:".$this->hostLive."trnRequest/".$token);
return "";
} else {
return $this->hostLive."trnRequest/".$token;
}
} | php | public function trnRequest($token, $redirect = true)
{
if ($redirect) {
header("Location:".$this->hostLive."trnRequest/".$token);
return "";
} else {
return $this->hostLive."trnRequest/".$token;
}
} | [
"public",
"function",
"trnRequest",
"(",
"$",
"token",
",",
"$",
"redirect",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"redirect",
")",
"{",
"header",
"(",
"\"Location:\"",
".",
"$",
"this",
"->",
"hostLive",
".",
"\"trnRequest/\"",
".",
"$",
"token",
")"... | Redirects or returns URL to a P24 payment screen
@param string $token Token
@param bool $redirect If set to true redirects to P24 payment screen. If set to false function returns URL to redirect to P24 payment screen
@return string URL to P24 payment screen | [
"Redirects",
"or",
"returns",
"URL",
"to",
"a",
"P24",
"payment",
"screen"
] | 7fdeb0b5155646f2b638082d2135bec05eb8be98 | https://github.com/WellCommerce/PaymentBundle/blob/7fdeb0b5155646f2b638082d2135bec05eb8be98/Client/Przelewy24.php#L178-L189 |
199,534 | Saritasa/php-eloquent-custom | src/Scopes/SortByName.php | SortByName.apply | public function apply(Builder $builder, Model $model): void
{
$builder->orderBy(self::NAME_ATTRIBUTE);
} | php | public function apply(Builder $builder, Model $model): void
{
$builder->orderBy(self::NAME_ATTRIBUTE);
} | [
"public",
"function",
"apply",
"(",
"Builder",
"$",
"builder",
",",
"Model",
"$",
"model",
")",
":",
"void",
"{",
"$",
"builder",
"->",
"orderBy",
"(",
"self",
"::",
"NAME_ATTRIBUTE",
")",
";",
"}"
] | Apply the sort by name scope to a given Eloquent query builder.
@param Builder $builder Builder to attach query scope to
@param Model $model Queried model
@return void | [
"Apply",
"the",
"sort",
"by",
"name",
"scope",
"to",
"a",
"given",
"Eloquent",
"query",
"builder",
"."
] | 54a2479f1d6e9cddac14dd8e473ab6a99dc6a82a | https://github.com/Saritasa/php-eloquent-custom/blob/54a2479f1d6e9cddac14dd8e473ab6a99dc6a82a/src/Scopes/SortByName.php#L24-L27 |
199,535 | OxfordInfoLabs/kinikit-core | src/Util/HTTP/HttpSession.php | HttpSession.setValue | public function setValue($key, $value) {
$this->startSession();
$_SESSION [$key] = $value;
$this->sessionData = null;
session_write_close();
} | php | public function setValue($key, $value) {
$this->startSession();
$_SESSION [$key] = $value;
$this->sessionData = null;
session_write_close();
} | [
"public",
"function",
"setValue",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"startSession",
"(",
")",
";",
"$",
"_SESSION",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"$",
"this",
"->",
"sessionData",
"=",
"null",
";",
"... | Set a session value by key and invalidate the session data
@param string $key
@param mixed $value | [
"Set",
"a",
"session",
"value",
"by",
"key",
"and",
"invalidate",
"the",
"session",
"data"
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/HTTP/HttpSession.php#L30-L35 |
199,536 | OxfordInfoLabs/kinikit-core | src/Util/HTTP/HttpSession.php | HttpSession.getValue | public function getValue($key, $lockSession = false) {
$allValues = $this->getAllValues($lockSession);
if (isset($allValues[$key])) {
return $allValues[$key];
} else {
return null;
}
} | php | public function getValue($key, $lockSession = false) {
$allValues = $this->getAllValues($lockSession);
if (isset($allValues[$key])) {
return $allValues[$key];
} else {
return null;
}
} | [
"public",
"function",
"getValue",
"(",
"$",
"key",
",",
"$",
"lockSession",
"=",
"false",
")",
"{",
"$",
"allValues",
"=",
"$",
"this",
"->",
"getAllValues",
"(",
"$",
"lockSession",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"allValues",
"[",
"$",
"key... | Get a session value by key
@param unknown_type $key | [
"Get",
"a",
"session",
"value",
"by",
"key"
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/HTTP/HttpSession.php#L42-L49 |
199,537 | OxfordInfoLabs/kinikit-core | src/Util/HTTP/HttpSession.php | HttpSession.getAllValues | public function getAllValues($lockSession = false) {
if (!$this->sessionData || $lockSession) {
$this->startSession();
$this->sessionData = isset($_SESSION) ? $_SESSION : array();
if (!$lockSession)
session_write_close();
}
return $this->sess... | php | public function getAllValues($lockSession = false) {
if (!$this->sessionData || $lockSession) {
$this->startSession();
$this->sessionData = isset($_SESSION) ? $_SESSION : array();
if (!$lockSession)
session_write_close();
}
return $this->sess... | [
"public",
"function",
"getAllValues",
"(",
"$",
"lockSession",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"sessionData",
"||",
"$",
"lockSession",
")",
"{",
"$",
"this",
"->",
"startSession",
"(",
")",
";",
"$",
"this",
"->",
"sessionDa... | Get all values - return as array and close session to prevent threading locks. | [
"Get",
"all",
"values",
"-",
"return",
"as",
"array",
"and",
"close",
"session",
"to",
"prevent",
"threading",
"locks",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/HTTP/HttpSession.php#L54-L64 |
199,538 | rollerworks/search-core | SearchCondition.php | SearchCondition.assertFieldSetName | public function assertFieldSetName(string ...$name)
{
if (!\in_array($providedName = $this->fieldSet->getSetName(), $name, true)) {
throw new UnsupportedFieldSetException($name, $providedName);
}
} | php | public function assertFieldSetName(string ...$name)
{
if (!\in_array($providedName = $this->fieldSet->getSetName(), $name, true)) {
throw new UnsupportedFieldSetException($name, $providedName);
}
} | [
"public",
"function",
"assertFieldSetName",
"(",
"string",
"...",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"\\",
"in_array",
"(",
"$",
"providedName",
"=",
"$",
"this",
"->",
"fieldSet",
"->",
"getSetName",
"(",
")",
",",
"$",
"name",
",",
"true",
")",
... | Checks that the FieldSet of this condition is supported
by the contexts it's used in.
@param string ...$name One or more FieldSet names to check for | [
"Checks",
"that",
"the",
"FieldSet",
"of",
"this",
"condition",
"is",
"supported",
"by",
"the",
"contexts",
"it",
"s",
"used",
"in",
"."
] | 6b5671b8c4d6298906ded768261b0a59845140fb | https://github.com/rollerworks/search-core/blob/6b5671b8c4d6298906ded768261b0a59845140fb/SearchCondition.php#L78-L83 |
199,539 | locomotivemtl/charcoal-factory | src/Charcoal/Factory/AbstractFactory.php | AbstractFactory.create | final public function create($type, array $args = null, callable $cb = null)
{
if (!is_string($type)) {
throw new InvalidArgumentException(
sprintf(
'%s: Type must be a string.',
get_called_class()
)
);
}... | php | final public function create($type, array $args = null, callable $cb = null)
{
if (!is_string($type)) {
throw new InvalidArgumentException(
sprintf(
'%s: Type must be a string.',
get_called_class()
)
);
}... | [
"final",
"public",
"function",
"create",
"(",
"$",
"type",
",",
"array",
"$",
"args",
"=",
"null",
",",
"callable",
"$",
"cb",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentExcept... | Create a new instance of a class, by type.
Unlike `get()`, this method *always* return a new instance of the requested class.
## Object callback
It is possible to pass a callback method that will be executed upon object instanciation.
The callable should have a signature: `function($obj);` where $obj is the newly cre... | [
"Create",
"a",
"new",
"instance",
"of",
"a",
"class",
"by",
"type",
"."
] | c64d40e1e39ef987a0bd0ad0e22379f55acf8f92 | https://github.com/locomotivemtl/charcoal-factory/blob/c64d40e1e39ef987a0bd0ad0e22379f55acf8f92/src/Charcoal/Factory/AbstractFactory.php#L121-L181 |
199,540 | locomotivemtl/charcoal-factory | src/Charcoal/Factory/AbstractFactory.php | AbstractFactory.setBaseClass | public function setBaseClass($type)
{
if (!is_string($type) || empty($type)) {
throw new InvalidArgumentException(
'Class name or type must be a non-empty string.'
);
}
$exists = (class_exists($type) || interface_exists($type));
if ($exists) {... | php | public function setBaseClass($type)
{
if (!is_string($type) || empty($type)) {
throw new InvalidArgumentException(
'Class name or type must be a non-empty string.'
);
}
$exists = (class_exists($type) || interface_exists($type));
if ($exists) {... | [
"public",
"function",
"setBaseClass",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"type",
")",
"||",
"empty",
"(",
"$",
"type",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Class name or type must be a non-empty stri... | If a base class is set, then it must be ensured that the created objects
are `instanceof` this base class.
@param string $type The FQN of the class, or "type" of object, to set as base class.
@throws InvalidArgumentException If the class is not a string or is not an existing class / interface.
@return self | [
"If",
"a",
"base",
"class",
"is",
"set",
"then",
"it",
"must",
"be",
"ensured",
"that",
"the",
"created",
"objects",
"are",
"instanceof",
"this",
"base",
"class",
"."
] | c64d40e1e39ef987a0bd0ad0e22379f55acf8f92 | https://github.com/locomotivemtl/charcoal-factory/blob/c64d40e1e39ef987a0bd0ad0e22379f55acf8f92/src/Charcoal/Factory/AbstractFactory.php#L217-L242 |
199,541 | locomotivemtl/charcoal-factory | src/Charcoal/Factory/AbstractFactory.php | AbstractFactory.resolve | public function resolve($type)
{
if (!is_string($type)) {
throw new InvalidArgumentException(
'Can not resolve class ident: type must be a string'
);
}
$map = $this->map();
if (isset($map[$type])) {
$type = $map[$type];
}
... | php | public function resolve($type)
{
if (!is_string($type)) {
throw new InvalidArgumentException(
'Can not resolve class ident: type must be a string'
);
}
$map = $this->map();
if (isset($map[$type])) {
$type = $map[$type];
}
... | [
"public",
"function",
"resolve",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Can not resolve class ident: type must be a string'",
")",
";",
"}",
"$",
"map",
"=",
... | The Generic factory resolves the class name from an exact FQN.
@param string $type The "type" of object to resolve (the object ident).
@throws InvalidArgumentException If the type parameter is not a string.
@return string The resolved class name (FQN). | [
"The",
"Generic",
"factory",
"resolves",
"the",
"class",
"name",
"from",
"an",
"exact",
"FQN",
"."
] | c64d40e1e39ef987a0bd0ad0e22379f55acf8f92 | https://github.com/locomotivemtl/charcoal-factory/blob/c64d40e1e39ef987a0bd0ad0e22379f55acf8f92/src/Charcoal/Factory/AbstractFactory.php#L336-L356 |
199,542 | locomotivemtl/charcoal-factory | src/Charcoal/Factory/AbstractFactory.php | AbstractFactory.isResolvable | public function isResolvable($type)
{
if (!is_string($type)) {
throw new InvalidArgumentException(
'Can not check resolvable: type must be a string'
);
}
$map = $this->map();
if (isset($map[$type])) {
$type = $map[$type];
}... | php | public function isResolvable($type)
{
if (!is_string($type)) {
throw new InvalidArgumentException(
'Can not check resolvable: type must be a string'
);
}
$map = $this->map();
if (isset($map[$type])) {
$type = $map[$type];
}... | [
"public",
"function",
"isResolvable",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Can not check resolvable: type must be a string'",
")",
";",
"}",
"$",
"map",
"="... | Whether a `type` is resolvable. The Generic Factory simply checks if the _FQN_ `type` class exists.
@param string $type The "type" of object to resolve (the object ident).
@throws InvalidArgumentException If the type parameter is not a string.
@return boolean | [
"Whether",
"a",
"type",
"is",
"resolvable",
".",
"The",
"Generic",
"Factory",
"simply",
"checks",
"if",
"the",
"_FQN_",
"type",
"class",
"exists",
"."
] | c64d40e1e39ef987a0bd0ad0e22379f55acf8f92 | https://github.com/locomotivemtl/charcoal-factory/blob/c64d40e1e39ef987a0bd0ad0e22379f55acf8f92/src/Charcoal/Factory/AbstractFactory.php#L365-L389 |
199,543 | locomotivemtl/charcoal-factory | src/Charcoal/Factory/AbstractFactory.php | AbstractFactory.createClass | protected function createClass($className, $args)
{
if ($args === null) {
return new $className;
}
if (!is_array($args)) {
return new $className($args);
}
if (count(array_filter(array_keys($args), 'is_string')) > 0) {
return new $className(... | php | protected function createClass($className, $args)
{
if ($args === null) {
return new $className;
}
if (!is_array($args)) {
return new $className($args);
}
if (count(array_filter(array_keys($args), 'is_string')) > 0) {
return new $className(... | [
"protected",
"function",
"createClass",
"(",
"$",
"className",
",",
"$",
"args",
")",
"{",
"if",
"(",
"$",
"args",
"===",
"null",
")",
"{",
"return",
"new",
"$",
"className",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"args",
")",
")",
"{",
... | Create a class instance with given arguments.
How the constructor arguments are passed depends on its type:
- if null, no arguments are passed at all.
- if it's not an array, it's passed as a single argument.
- if it's an associative array, it's passed as a sing argument.
- if it's a sequential (numeric keys) array, ... | [
"Create",
"a",
"class",
"instance",
"with",
"given",
"arguments",
"."
] | c64d40e1e39ef987a0bd0ad0e22379f55acf8f92 | https://github.com/locomotivemtl/charcoal-factory/blob/c64d40e1e39ef987a0bd0ad0e22379f55acf8f92/src/Charcoal/Factory/AbstractFactory.php#L406-L424 |
199,544 | locomotivemtl/charcoal-factory | src/Charcoal/Factory/AbstractFactory.php | AbstractFactory.addClassToMap | protected function addClassToMap($type, $className)
{
if (!is_string($type)) {
throw new InvalidArgumentException(
'Type (class key) must be a string'
);
}
$this->map[$type] = $className;
return $this;
} | php | protected function addClassToMap($type, $className)
{
if (!is_string($type)) {
throw new InvalidArgumentException(
'Type (class key) must be a string'
);
}
$this->map[$type] = $className;
return $this;
} | [
"protected",
"function",
"addClassToMap",
"(",
"$",
"type",
",",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Type (class key) must be a string'",
")",
";",
"}",
... | Add a class name to the available types _map_.
@param string $type The type (class ident).
@param string $className The FQN of the class.
@throws InvalidArgumentException If the $type parameter is not a striing or the $className class does not exist.
@return self | [
"Add",
"a",
"class",
"name",
"to",
"the",
"available",
"types",
"_map_",
"."
] | c64d40e1e39ef987a0bd0ad0e22379f55acf8f92 | https://github.com/locomotivemtl/charcoal-factory/blob/c64d40e1e39ef987a0bd0ad0e22379f55acf8f92/src/Charcoal/Factory/AbstractFactory.php#L452-L462 |
199,545 | locomotivemtl/charcoal-factory | src/Charcoal/Factory/AbstractFactory.php | AbstractFactory.setMap | private function setMap(array $map)
{
// Resets (overwrites) map.
$this->map = [];
foreach ($map as $type => $className) {
$this->addClassToMap($type, $className);
}
return $this;
} | php | private function setMap(array $map)
{
// Resets (overwrites) map.
$this->map = [];
foreach ($map as $type => $className) {
$this->addClassToMap($type, $className);
}
return $this;
} | [
"private",
"function",
"setMap",
"(",
"array",
"$",
"map",
")",
"{",
"// Resets (overwrites) map.",
"$",
"this",
"->",
"map",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"map",
"as",
"$",
"type",
"=>",
"$",
"className",
")",
"{",
"$",
"this",
"->",
"add... | Add multiple types, in a an array of `type` => `className`.
@param string[] $map The map (key=>classname) to use.
@return self | [
"Add",
"multiple",
"types",
"in",
"a",
"an",
"array",
"of",
"type",
"=",
">",
"className",
"."
] | c64d40e1e39ef987a0bd0ad0e22379f55acf8f92 | https://github.com/locomotivemtl/charcoal-factory/blob/c64d40e1e39ef987a0bd0ad0e22379f55acf8f92/src/Charcoal/Factory/AbstractFactory.php#L480-L488 |
199,546 | shrink0r/php-schema | src/Property/AssocProperty.php | AssocProperty.validate | public function validate($value)
{
return is_array($value) ? $this->valueSchema->validate($value) : Error::unit([ Error::NON_ARRAY ]);
} | php | public function validate($value)
{
return is_array($value) ? $this->valueSchema->validate($value) : Error::unit([ Error::NON_ARRAY ]);
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"return",
"is_array",
"(",
"$",
"value",
")",
"?",
"$",
"this",
"->",
"valueSchema",
"->",
"validate",
"(",
"$",
"value",
")",
":",
"Error",
"::",
"unit",
"(",
"[",
"Error",
"::",
"NON_AR... | Tells if a given value adhere's to the property's value schema.
@param mixed $value
@return ResultInterface Returns Ok if the value is valid, otherwise an Error is returned. | [
"Tells",
"if",
"a",
"given",
"value",
"adhere",
"s",
"to",
"the",
"property",
"s",
"value",
"schema",
"."
] | 94293fe897af376dd9d05962e2c516079409dd29 | https://github.com/shrink0r/php-schema/blob/94293fe897af376dd9d05962e2c516079409dd29/src/Property/AssocProperty.php#L39-L42 |
199,547 | shrink0r/php-schema | src/Property/AssocProperty.php | AssocProperty.createValueSchema | protected function createValueSchema(array $definition)
{
if (!isset($definition['properties'])) {
throw new Exception("Missing required key 'properties' within assoc definition.");
}
return $this->getSchema()->getFactory()->createSchema(
$this->getName().'_type',
... | php | protected function createValueSchema(array $definition)
{
if (!isset($definition['properties'])) {
throw new Exception("Missing required key 'properties' within assoc definition.");
}
return $this->getSchema()->getFactory()->createSchema(
$this->getName().'_type',
... | [
"protected",
"function",
"createValueSchema",
"(",
"array",
"$",
"definition",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"definition",
"[",
"'properties'",
"]",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Missing required key 'properties' within assoc d... | Creates a schema instance that will be used to proxy the property's validation to.
@param mixed[] $definition
@return SchemaInterface | [
"Creates",
"a",
"schema",
"instance",
"that",
"will",
"be",
"used",
"to",
"proxy",
"the",
"property",
"s",
"validation",
"to",
"."
] | 94293fe897af376dd9d05962e2c516079409dd29 | https://github.com/shrink0r/php-schema/blob/94293fe897af376dd9d05962e2c516079409dd29/src/Property/AssocProperty.php#L51-L61 |
199,548 | CalderaWP/caldera-interop | src/Traits/ConvertsInteropModelToArray.php | ConvertsInteropModelToArray.toArray | public function toArray(): array
{
$array = [
'id' => $this->getId(),
];
foreach (get_object_vars($this) as $prop => $value) {
$array[$prop] = is_callable([$this->$prop,'toArray'])? $this->$prop->toArray() : $this->$prop;
}
return $array;
} | php | public function toArray(): array
{
$array = [
'id' => $this->getId(),
];
foreach (get_object_vars($this) as $prop => $value) {
$array[$prop] = is_callable([$this->$prop,'toArray'])? $this->$prop->toArray() : $this->$prop;
}
return $array;
} | [
"public",
"function",
"toArray",
"(",
")",
":",
"array",
"{",
"$",
"array",
"=",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"getId",
"(",
")",
",",
"]",
";",
"foreach",
"(",
"get_object_vars",
"(",
"$",
"this",
")",
"as",
"$",
"prop",
"=>",
"$",
"valu... | Convert Interoperable Model to an array
@return array | [
"Convert",
"Interoperable",
"Model",
"to",
"an",
"array"
] | d25c4bc930200b314fbd42d084080b5d85261c94 | https://github.com/CalderaWP/caldera-interop/blob/d25c4bc930200b314fbd42d084080b5d85261c94/src/Traits/ConvertsInteropModelToArray.php#L18-L28 |
199,549 | flipbox/spark | src/services/traits/ObjectByString.php | ObjectByString.findCacheByString | public function findCacheByString(string $string)
{
// Check if already in cache
if (!$this->isCachedByString($string)) {
return null;
}
return $this->cacheByString[$string];
} | php | public function findCacheByString(string $string)
{
// Check if already in cache
if (!$this->isCachedByString($string)) {
return null;
}
return $this->cacheByString[$string];
} | [
"public",
"function",
"findCacheByString",
"(",
"string",
"$",
"string",
")",
"{",
"// Check if already in cache",
"if",
"(",
"!",
"$",
"this",
"->",
"isCachedByString",
"(",
"$",
"string",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
... | Find an existing cache by string
@param string $string
@return null | [
"Find",
"an",
"existing",
"cache",
"by",
"string"
] | 9d75fd3d95744b9c9187921c4f3b9eea42c035d4 | https://github.com/flipbox/spark/blob/9d75fd3d95744b9c9187921c4f3b9eea42c035d4/src/services/traits/ObjectByString.php#L147-L156 |
199,550 | Topolis/FunctionLibrary | src/Path.php | Path.real | public static function real($input, $separator = self::SEPARATOR_BOTH){
$parsed = self::parse($input, $separator);
if(!self::validate($parsed["path"]))
throw new \Exception("Path is invalid");
$elements_in = self::explode($parsed["path"], $separator);
$elements_out = array(... | php | public static function real($input, $separator = self::SEPARATOR_BOTH){
$parsed = self::parse($input, $separator);
if(!self::validate($parsed["path"]))
throw new \Exception("Path is invalid");
$elements_in = self::explode($parsed["path"], $separator);
$elements_out = array(... | [
"public",
"static",
"function",
"real",
"(",
"$",
"input",
",",
"$",
"separator",
"=",
"self",
"::",
"SEPARATOR_BOTH",
")",
"{",
"$",
"parsed",
"=",
"self",
"::",
"parse",
"(",
"$",
"input",
",",
"$",
"separator",
")",
";",
"if",
"(",
"!",
"self",
... | Resolve a path and return a cleaned real path without checking physical files on any device
@static
@param $input
@param string $separator
@return string
@throws \Exception | [
"Resolve",
"a",
"path",
"and",
"return",
"a",
"cleaned",
"real",
"path",
"without",
"checking",
"physical",
"files",
"on",
"any",
"device"
] | bc57f465932fbf297927c2a32765255131b907eb | https://github.com/Topolis/FunctionLibrary/blob/bc57f465932fbf297927c2a32765255131b907eb/src/Path.php#L22-L53 |
199,551 | Topolis/FunctionLibrary | src/Path.php | Path.validate | public static function validate($input, $separator = self::SEPARATOR_BOTH){
$pattern = addcslashes(self::ALLOWED_CHARS . $separator, "[].-_/\\");
$invalid = preg_match("/[^".$pattern."]+/", $input);
return $invalid ? false : true;
} | php | public static function validate($input, $separator = self::SEPARATOR_BOTH){
$pattern = addcslashes(self::ALLOWED_CHARS . $separator, "[].-_/\\");
$invalid = preg_match("/[^".$pattern."]+/", $input);
return $invalid ? false : true;
} | [
"public",
"static",
"function",
"validate",
"(",
"$",
"input",
",",
"$",
"separator",
"=",
"self",
"::",
"SEPARATOR_BOTH",
")",
"{",
"$",
"pattern",
"=",
"addcslashes",
"(",
"self",
"::",
"ALLOWED_CHARS",
".",
"$",
"separator",
",",
"\"[].-_/\\\\\"",
")",
... | Check if a path contains valid characters
@static
@param $input
@param string $separator
@return bool | [
"Check",
"if",
"a",
"path",
"contains",
"valid",
"characters"
] | bc57f465932fbf297927c2a32765255131b907eb | https://github.com/Topolis/FunctionLibrary/blob/bc57f465932fbf297927c2a32765255131b907eb/src/Path.php#L67-L73 |
199,552 | Topolis/FunctionLibrary | src/Path.php | Path.extension | public static function extension($file, $separator = self::SEPARATOR_BOTH){
return self::validate($file, $separator) ? substr($file, strrpos($file, '.') + 1) : false;
} | php | public static function extension($file, $separator = self::SEPARATOR_BOTH){
return self::validate($file, $separator) ? substr($file, strrpos($file, '.') + 1) : false;
} | [
"public",
"static",
"function",
"extension",
"(",
"$",
"file",
",",
"$",
"separator",
"=",
"self",
"::",
"SEPARATOR_BOTH",
")",
"{",
"return",
"self",
"::",
"validate",
"(",
"$",
"file",
",",
"$",
"separator",
")",
"?",
"substr",
"(",
"$",
"file",
",",... | Return the extension of a file or false on invalid filenames
@static
@param string $file
@param string $separator
@return bool|string | [
"Return",
"the",
"extension",
"of",
"a",
"file",
"or",
"false",
"on",
"invalid",
"filenames"
] | bc57f465932fbf297927c2a32765255131b907eb | https://github.com/Topolis/FunctionLibrary/blob/bc57f465932fbf297927c2a32765255131b907eb/src/Path.php#L146-L148 |
199,553 | subjective-php/spl-datastructures | src/ImmutableArrayObject.php | ImmutableArrayObject.createFromMutable | public static function createFromMutable(\ArrayObject $arrayObject) : ImmutableArrayObject
{
return new static($arrayObject->getArrayCopy(), $arrayObject->getFlags(), $arrayObject->getIteratorClass());
} | php | public static function createFromMutable(\ArrayObject $arrayObject) : ImmutableArrayObject
{
return new static($arrayObject->getArrayCopy(), $arrayObject->getFlags(), $arrayObject->getIteratorClass());
} | [
"public",
"static",
"function",
"createFromMutable",
"(",
"\\",
"ArrayObject",
"$",
"arrayObject",
")",
":",
"ImmutableArrayObject",
"{",
"return",
"new",
"static",
"(",
"$",
"arrayObject",
"->",
"getArrayCopy",
"(",
")",
",",
"$",
"arrayObject",
"->",
"getFlags... | Creates a new ImmutableArrayObject from the given mutable ArrayObject instance.
@param \ArrayObject $arrayObject The mutable array object.
@return ImmutableArrayObject | [
"Creates",
"a",
"new",
"ImmutableArrayObject",
"from",
"the",
"given",
"mutable",
"ArrayObject",
"instance",
"."
] | 621b0c47be9449299cfd22686d11ef9750f9841d | https://github.com/subjective-php/spl-datastructures/blob/621b0c47be9449299cfd22686d11ef9750f9841d/src/ImmutableArrayObject.php#L74-L77 |
199,554 | eureka-framework/component-cache | src/Cache/CacheWrapperMemcache.php | CacheWrapperMemcache.connect | public function connect($host = '127.0.0.1', $port = 11211)
{
if (!isset($this->servers[$host . ':' . $port])) {
$this->server = new \Memcache();
$this->server->connect($host, $port);
$this->servers[$host . ':' . $port] = $this->server;
} else {
$this... | php | public function connect($host = '127.0.0.1', $port = 11211)
{
if (!isset($this->servers[$host . ':' . $port])) {
$this->server = new \Memcache();
$this->server->connect($host, $port);
$this->servers[$host . ':' . $port] = $this->server;
} else {
$this... | [
"public",
"function",
"connect",
"(",
"$",
"host",
"=",
"'127.0.0.1'",
",",
"$",
"port",
"=",
"11211",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"servers",
"[",
"$",
"host",
".",
"':'",
".",
"$",
"port",
"]",
")",
")",
"{",
"$"... | Connect and use specified server.
@param string $host
@param int $port
@return bool | [
"Connect",
"and",
"use",
"specified",
"server",
"."
] | c110441ac7bb20edd2ecd8162f4302596d875785 | https://github.com/eureka-framework/component-cache/blob/c110441ac7bb20edd2ecd8162f4302596d875785/src/Cache/CacheWrapperMemcache.php#L36-L48 |
199,555 | byjg/authuser | src/UsersBase.php | UsersBase.addUser | public function addUser($name, $userName, $email, $password)
{
$model = $this->getUserDefinition()->modelInstance();
$model->setName($name);
$model->setEmail($email);
$model->setUsername($userName);
$model->setPassword($password);
$this->save($model);
} | php | public function addUser($name, $userName, $email, $password)
{
$model = $this->getUserDefinition()->modelInstance();
$model->setName($name);
$model->setEmail($email);
$model->setUsername($userName);
$model->setPassword($password);
$this->save($model);
} | [
"public",
"function",
"addUser",
"(",
"$",
"name",
",",
"$",
"userName",
",",
"$",
"email",
",",
"$",
"password",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"getUserDefinition",
"(",
")",
"->",
"modelInstance",
"(",
")",
";",
"$",
"model",
"->",... | Add new user in database
@param string $name
@param string $userName
@param string $email
@param string $password
@return void
@throws \ByJG\Serializer\Exception\InvalidArgumentException | [
"Add",
"new",
"user",
"in",
"database"
] | 2ca520e921e559257d14dd933c746a1df28eaf9f | https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L73-L82 |
199,556 | byjg/authuser | src/UsersBase.php | UsersBase.getByEmail | public function getByEmail($email)
{
$filter = new IteratorFilter();
$filter->addRelation($this->getUserDefinition()->getEmail(), Relation::EQUAL, strtolower($email));
return $this->getUser($filter);
} | php | public function getByEmail($email)
{
$filter = new IteratorFilter();
$filter->addRelation($this->getUserDefinition()->getEmail(), Relation::EQUAL, strtolower($email));
return $this->getUser($filter);
} | [
"public",
"function",
"getByEmail",
"(",
"$",
"email",
")",
"{",
"$",
"filter",
"=",
"new",
"IteratorFilter",
"(",
")",
";",
"$",
"filter",
"->",
"addRelation",
"(",
"$",
"this",
"->",
"getUserDefinition",
"(",
")",
"->",
"getEmail",
"(",
")",
",",
"Re... | Get the user based on his email.
Return Row if user was found; null, otherwise
@param string $email
@return UserModel
@throws \ByJG\Serializer\Exception\InvalidArgumentException | [
"Get",
"the",
"user",
"based",
"on",
"his",
"email",
".",
"Return",
"Row",
"if",
"user",
"was",
"found",
";",
"null",
"otherwise"
] | 2ca520e921e559257d14dd933c746a1df28eaf9f | https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L121-L126 |
199,557 | byjg/authuser | src/UsersBase.php | UsersBase.getByUsername | public function getByUsername($username)
{
$filter = new IteratorFilter();
$filter->addRelation($this->getUserDefinition()->getUsername(), Relation::EQUAL, $username);
return $this->getUser($filter);
} | php | public function getByUsername($username)
{
$filter = new IteratorFilter();
$filter->addRelation($this->getUserDefinition()->getUsername(), Relation::EQUAL, $username);
return $this->getUser($filter);
} | [
"public",
"function",
"getByUsername",
"(",
"$",
"username",
")",
"{",
"$",
"filter",
"=",
"new",
"IteratorFilter",
"(",
")",
";",
"$",
"filter",
"->",
"addRelation",
"(",
"$",
"this",
"->",
"getUserDefinition",
"(",
")",
"->",
"getUsername",
"(",
")",
"... | Get the user based on his username.
Return Row if user was found; null, otherwise
@param $username
@return UserModel
@throws \ByJG\Serializer\Exception\InvalidArgumentException | [
"Get",
"the",
"user",
"based",
"on",
"his",
"username",
".",
"Return",
"Row",
"if",
"user",
"was",
"found",
";",
"null",
"otherwise"
] | 2ca520e921e559257d14dd933c746a1df28eaf9f | https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L136-L141 |
199,558 | byjg/authuser | src/UsersBase.php | UsersBase.getById | public function getById($userid)
{
$filter = new IteratorFilter();
$filter->addRelation($this->getUserDefinition()->getUserid(), Relation::EQUAL, $userid);
return $this->getUser($filter);
} | php | public function getById($userid)
{
$filter = new IteratorFilter();
$filter->addRelation($this->getUserDefinition()->getUserid(), Relation::EQUAL, $userid);
return $this->getUser($filter);
} | [
"public",
"function",
"getById",
"(",
"$",
"userid",
")",
"{",
"$",
"filter",
"=",
"new",
"IteratorFilter",
"(",
")",
";",
"$",
"filter",
"->",
"addRelation",
"(",
"$",
"this",
"->",
"getUserDefinition",
"(",
")",
"->",
"getUserid",
"(",
")",
",",
"Rel... | Get the user based on his id.
Return Row if user was found; null, otherwise
@param string $userid
@return UserModel
@throws \ByJG\Serializer\Exception\InvalidArgumentException | [
"Get",
"the",
"user",
"based",
"on",
"his",
"id",
".",
"Return",
"Row",
"if",
"user",
"was",
"found",
";",
"null",
"otherwise"
] | 2ca520e921e559257d14dd933c746a1df28eaf9f | https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L167-L172 |
199,559 | byjg/authuser | src/UsersBase.php | UsersBase.isValidUser | public function isValidUser($userName, $password)
{
$filter = new IteratorFilter();
$passwordGenerator = $this->getUserDefinition()->getClosureForUpdate('password');
$filter->addRelation($this->getUserDefinition()->loginField(), Relation::EQUAL, strtolower($userName));
$filter->addRe... | php | public function isValidUser($userName, $password)
{
$filter = new IteratorFilter();
$passwordGenerator = $this->getUserDefinition()->getClosureForUpdate('password');
$filter->addRelation($this->getUserDefinition()->loginField(), Relation::EQUAL, strtolower($userName));
$filter->addRe... | [
"public",
"function",
"isValidUser",
"(",
"$",
"userName",
",",
"$",
"password",
")",
"{",
"$",
"filter",
"=",
"new",
"IteratorFilter",
"(",
")",
";",
"$",
"passwordGenerator",
"=",
"$",
"this",
"->",
"getUserDefinition",
"(",
")",
"->",
"getClosureForUpdate... | Validate if the user and password exists in the file
Return Row if user exists; null, otherwise
@param string $userName User login
@param string $password Plain text password
@return UserModel
@throws \ByJG\Serializer\Exception\InvalidArgumentException | [
"Validate",
"if",
"the",
"user",
"and",
"password",
"exists",
"in",
"the",
"file",
"Return",
"Row",
"if",
"user",
"exists",
";",
"null",
"otherwise"
] | 2ca520e921e559257d14dd933c746a1df28eaf9f | https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L191-L202 |
199,560 | byjg/authuser | src/UsersBase.php | UsersBase.hasProperty | public function hasProperty($userId, $propertyName, $value = null)
{
//anydataset.Row
$user = $this->getById($userId);
if (empty($user)) {
return false;
}
if ($this->isAdmin($userId)) {
return true;
}
$values = $user->get($propertyNa... | php | public function hasProperty($userId, $propertyName, $value = null)
{
//anydataset.Row
$user = $this->getById($userId);
if (empty($user)) {
return false;
}
if ($this->isAdmin($userId)) {
return true;
}
$values = $user->get($propertyNa... | [
"public",
"function",
"hasProperty",
"(",
"$",
"userId",
",",
"$",
"propertyName",
",",
"$",
"value",
"=",
"null",
")",
"{",
"//anydataset.Row",
"$",
"user",
"=",
"$",
"this",
"->",
"getById",
"(",
"$",
"userId",
")",
";",
"if",
"(",
"empty",
"(",
"$... | Check if the user have a property and it have a specific value.
Return True if have rights; false, otherwise
@param mixed $userId User identification
@param string $propertyName
@param string $value Property value
@return bool
@throws \ByJG\Authenticate\Exception\UserNotFoundException
@throws \ByJG\Serializer\Exceptio... | [
"Check",
"if",
"the",
"user",
"have",
"a",
"property",
"and",
"it",
"have",
"a",
"specific",
"value",
".",
"Return",
"True",
"if",
"have",
"rights",
";",
"false",
"otherwise"
] | 2ca520e921e559257d14dd933c746a1df28eaf9f | https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L215-L230 |
199,561 | byjg/authuser | src/UsersBase.php | UsersBase.getProperty | public function getProperty($userId, $propertyName)
{
//anydataset.Row
$user = $this->getById($userId);
if ($user !== null) {
$values = $user->get($propertyName);
if ($this->isAdmin($userId)) {
return array("admin" => "admin");
}
... | php | public function getProperty($userId, $propertyName)
{
//anydataset.Row
$user = $this->getById($userId);
if ($user !== null) {
$values = $user->get($propertyName);
if ($this->isAdmin($userId)) {
return array("admin" => "admin");
}
... | [
"public",
"function",
"getProperty",
"(",
"$",
"userId",
",",
"$",
"propertyName",
")",
"{",
"//anydataset.Row",
"$",
"user",
"=",
"$",
"this",
"->",
"getById",
"(",
"$",
"userId",
")",
";",
"if",
"(",
"$",
"user",
"!==",
"null",
")",
"{",
"$",
"valu... | Return all sites from a specific user
Return String vector with all sites
@param string $userId User ID
@param string $propertyName Property name
@return array
@throws \ByJG\Authenticate\Exception\UserNotFoundException
@throws \ByJG\Serializer\Exception\InvalidArgumentException | [
"Return",
"all",
"sites",
"from",
"a",
"specific",
"user",
"Return",
"String",
"vector",
"with",
"all",
"sites"
] | 2ca520e921e559257d14dd933c746a1df28eaf9f | https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L242-L257 |
199,562 | byjg/authuser | src/UsersBase.php | UsersBase.createAuthToken | public function createAuthToken(
$login,
$password,
$jwtWrapper,
$expires = 1200,
$updateUserInfo = [],
$updateTokenInfo = []
) {
if (!isset($login) || !isset($password)) {
throw new InvalidArgumentException('Neither username or password can be emp... | php | public function createAuthToken(
$login,
$password,
$jwtWrapper,
$expires = 1200,
$updateUserInfo = [],
$updateTokenInfo = []
) {
if (!isset($login) || !isset($password)) {
throw new InvalidArgumentException('Neither username or password can be emp... | [
"public",
"function",
"createAuthToken",
"(",
"$",
"login",
",",
"$",
"password",
",",
"$",
"jwtWrapper",
",",
"$",
"expires",
"=",
"1200",
",",
"$",
"updateUserInfo",
"=",
"[",
"]",
",",
"$",
"updateTokenInfo",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!... | Authenticate a user and create a token if it is valid
@param string $login
@param string $password
@param JwtWrapper $jwtWrapper
@param int $expires
@param array $updateUserInfo
@param array $updateTokenInfo
@return string the TOKEN or false if dont.
@throws UserNotFoundException
@throws \ByJG\Serializer\Exception\Inv... | [
"Authenticate",
"a",
"user",
"and",
"create",
"a",
"token",
"if",
"it",
"is",
"valid"
] | 2ca520e921e559257d14dd933c746a1df28eaf9f | https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L320-L354 |
199,563 | byjg/authuser | src/UsersBase.php | UsersBase.isValidToken | public function isValidToken($login, $jwtWrapper, $token)
{
$user = $this->getByLoginField($login);
if (is_null($user)) {
throw new UserNotFoundException('User not found!');
}
if ($user->get('TOKEN_HASH') !== sha1($token)) {
throw new NotAuthenticatedExcepti... | php | public function isValidToken($login, $jwtWrapper, $token)
{
$user = $this->getByLoginField($login);
if (is_null($user)) {
throw new UserNotFoundException('User not found!');
}
if ($user->get('TOKEN_HASH') !== sha1($token)) {
throw new NotAuthenticatedExcepti... | [
"public",
"function",
"isValidToken",
"(",
"$",
"login",
",",
"$",
"jwtWrapper",
",",
"$",
"token",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getByLoginField",
"(",
"$",
"login",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"user",
")",
")",
"{"... | Check if the Auth Token is valid
@param string $login
@param JwtWrapper $jwtWrapper
@param string $token
@return array
@throws NotAuthenticatedException
@throws UserNotFoundException
@throws \ByJG\Serializer\Exception\InvalidArgumentException
@throws \ByJG\Util\JwtWrapperException | [
"Check",
"if",
"the",
"Auth",
"Token",
"is",
"valid"
] | 2ca520e921e559257d14dd933c746a1df28eaf9f | https://github.com/byjg/authuser/blob/2ca520e921e559257d14dd933c746a1df28eaf9f/src/UsersBase.php#L368-L388 |
199,564 | samsonos/cms_app_user | src/Application.php | Application.__async_save | public function __async_save()
{
// If form has been sent
if (isset($_POST)) {
// Create or find user depending on UserID passed
/** @var \samson\activerecord\user $db_user */
$db_user = null;
if (!dbQuery('user')->UserID($_POST['UserID'])->Active(1)-... | php | public function __async_save()
{
// If form has been sent
if (isset($_POST)) {
// Create or find user depending on UserID passed
/** @var \samson\activerecord\user $db_user */
$db_user = null;
if (!dbQuery('user')->UserID($_POST['UserID'])->Active(1)-... | [
"public",
"function",
"__async_save",
"(",
")",
"{",
"// If form has been sent",
"if",
"(",
"isset",
"(",
"$",
"_POST",
")",
")",
"{",
"// Create or find user depending on UserID passed",
"/** @var \\samson\\activerecord\\user $db_user */",
"$",
"db_user",
"=",
"null",
";... | Save user data | [
"Save",
"user",
"data"
] | 48b9de772a7443de7cc1a64e7d01ffddcb3e7a52 | https://github.com/samsonos/cms_app_user/blob/48b9de772a7443de7cc1a64e7d01ffddcb3e7a52/src/Application.php#L39-L69 |
199,565 | samsonos/cms_app_user | src/Application.php | Application.__async_table | public function __async_table()
{
// Create query to get users
$query = dbQuery('user')->Active(1)->order_by('UserID');
// Create generic table for users
$table = new Table($query);
return array ('status'=>1, 'table'=>$table->render());
} | php | public function __async_table()
{
// Create query to get users
$query = dbQuery('user')->Active(1)->order_by('UserID');
// Create generic table for users
$table = new Table($query);
return array ('status'=>1, 'table'=>$table->render());
} | [
"public",
"function",
"__async_table",
"(",
")",
"{",
"// Create query to get users",
"$",
"query",
"=",
"dbQuery",
"(",
"'user'",
")",
"->",
"Active",
"(",
"1",
")",
"->",
"order_by",
"(",
"'UserID'",
")",
";",
"// Create generic table for users",
"$",
"table",... | Method for rendering table
@return array - AJAX Response | [
"Method",
"for",
"rendering",
"table"
] | 48b9de772a7443de7cc1a64e7d01ffddcb3e7a52 | https://github.com/samsonos/cms_app_user/blob/48b9de772a7443de7cc1a64e7d01ffddcb3e7a52/src/Application.php#L102-L111 |
199,566 | RhubarbPHP/Module.Leaf.Table | src/Leaves/Columns/ModelColumn.php | ModelColumn.createTableColumnForSchemaColumn | public static function createTableColumnForSchemaColumn(Column $column, $label)
{
if ($column instanceof TimeColumn) {
new \Rhubarb\Leaf\Table\Leaves\Columns\TimeColumn($column->columnName, $label);
}
if ($column instanceof DateColumn || $column instanceof MySqlDateTimeColumn) {... | php | public static function createTableColumnForSchemaColumn(Column $column, $label)
{
if ($column instanceof TimeColumn) {
new \Rhubarb\Leaf\Table\Leaves\Columns\TimeColumn($column->columnName, $label);
}
if ($column instanceof DateColumn || $column instanceof MySqlDateTimeColumn) {... | [
"public",
"static",
"function",
"createTableColumnForSchemaColumn",
"(",
"Column",
"$",
"column",
",",
"$",
"label",
")",
"{",
"if",
"(",
"$",
"column",
"instanceof",
"TimeColumn",
")",
"{",
"new",
"\\",
"Rhubarb",
"\\",
"Leaf",
"\\",
"Table",
"\\",
"Leaves"... | Creates the correct type of table column for the supplied model column.
@param \Rhubarb\Stem\Schema\Columns\Column $column
@param $label
@return DateColumn|ModelColumn | [
"Creates",
"the",
"correct",
"type",
"of",
"table",
"column",
"for",
"the",
"supplied",
"model",
"column",
"."
] | 1de09307177cc809ca6b2a50093ccad06ab49e45 | https://github.com/RhubarbPHP/Module.Leaf.Table/blob/1de09307177cc809ca6b2a50093ccad06ab49e45/src/Leaves/Columns/ModelColumn.php#L87-L119 |
199,567 | SagittariusX/Beluga.Translation | src/Beluga/Translation/Source/AbstractSource.php | AbstractSource.getOption | function getOption( string $name, $defaultValue = false )
{
if ( ! $this->hasOption( $name ) )
{
if ( \is_null( $defaultValue ) )
{
return $defaultValue;
}
$this->_options[ $name ] = $defaultValue;
}
return $this->_options[ $name ];
} | php | function getOption( string $name, $defaultValue = false )
{
if ( ! $this->hasOption( $name ) )
{
if ( \is_null( $defaultValue ) )
{
return $defaultValue;
}
$this->_options[ $name ] = $defaultValue;
}
return $this->_options[ $name ];
} | [
"function",
"getOption",
"(",
"string",
"$",
"name",
",",
"$",
"defaultValue",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasOption",
"(",
"$",
"name",
")",
")",
"{",
"if",
"(",
"\\",
"is_null",
"(",
"$",
"defaultValue",
")",
")",
... | Gets the option value of option with defined name or FALSE if the option is unknown.
@param string $name The name of the option.
@param mixed $defaultValue This value is remembered and returned if the option not exists. If the value is NULL
the value is not set, it is only returned in this case.
@return mixed | [
"Gets",
"the",
"option",
"value",
"of",
"option",
"with",
"defined",
"name",
"or",
"FALSE",
"if",
"the",
"option",
"is",
"unknown",
"."
] | 8f66c4fef6fa4494413972ca56bd8e13f5a7e444 | https://github.com/SagittariusX/Beluga.Translation/blob/8f66c4fef6fa4494413972ca56bd8e13f5a7e444/src/Beluga/Translation/Source/AbstractSource.php#L95-L109 |
199,568 | koolkode/http | src/HttpRequest.php | HttpRequest.getMethod | public function getMethod($allowOverride = true)
{
if($allowOverride && $this->methodOverride !== NULL && $this->method == Http::METHOD_POST)
{
return $this->methodOverride;
}
return $this->method;
} | php | public function getMethod($allowOverride = true)
{
if($allowOverride && $this->methodOverride !== NULL && $this->method == Http::METHOD_POST)
{
return $this->methodOverride;
}
return $this->method;
} | [
"public",
"function",
"getMethod",
"(",
"$",
"allowOverride",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"allowOverride",
"&&",
"$",
"this",
"->",
"methodOverride",
"!==",
"NULL",
"&&",
"$",
"this",
"->",
"method",
"==",
"Http",
"::",
"METHOD_POST",
")",
"{"... | Get the HTTP request method.
@param boolean $allowOverride Allow method override in POST request?
@return string The name of the HTTP request method being used. | [
"Get",
"the",
"HTTP",
"request",
"method",
"."
] | 3c1626d409d5ce5d71d26f0e8f31ae3683a2a966 | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/HttpRequest.php#L109-L117 |
199,569 | koolkode/http | src/HttpRequest.php | HttpRequest.setMethod | public function setMethod($method)
{
$method = strtoupper($method);
if(!preg_match("'^[A-Z]{2,}$'", $method))
{
throw new \InvalidArgumentException(sprintf('Invalid HTTP request method: "%s"', $method));
}
$this->method = $method;
return $this;
} | php | public function setMethod($method)
{
$method = strtoupper($method);
if(!preg_match("'^[A-Z]{2,}$'", $method))
{
throw new \InvalidArgumentException(sprintf('Invalid HTTP request method: "%s"', $method));
}
$this->method = $method;
return $this;
} | [
"public",
"function",
"setMethod",
"(",
"$",
"method",
")",
"{",
"$",
"method",
"=",
"strtoupper",
"(",
"$",
"method",
")",
";",
"if",
"(",
"!",
"preg_match",
"(",
"\"'^[A-Z]{2,}$'\"",
",",
"$",
"method",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidAr... | Set the HTTP request method.
@param string $method The name of the HTTP method (uppercase).
@return HttpRequest
@throws \InvalidArgumentException When the given HTTP method is invalid. | [
"Set",
"the",
"HTTP",
"request",
"method",
"."
] | 3c1626d409d5ce5d71d26f0e8f31ae3683a2a966 | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/HttpRequest.php#L127-L139 |
199,570 | koolkode/http | src/HttpRequest.php | HttpRequest.setMethodOverride | public function setMethodOverride($method = NULL)
{
if($method === NULL)
{
$this->methodOverride = NULL;
}
else
{
$method = strtoupper($method);
if(!preg_match("'^[A-Z]{2,}$'", $method))
{
throw new \InvalidArgumentException(sprintf('Invalid HTTP request method: "%s"', $method));
}
... | php | public function setMethodOverride($method = NULL)
{
if($method === NULL)
{
$this->methodOverride = NULL;
}
else
{
$method = strtoupper($method);
if(!preg_match("'^[A-Z]{2,}$'", $method))
{
throw new \InvalidArgumentException(sprintf('Invalid HTTP request method: "%s"', $method));
}
... | [
"public",
"function",
"setMethodOverride",
"(",
"$",
"method",
"=",
"NULL",
")",
"{",
"if",
"(",
"$",
"method",
"===",
"NULL",
")",
"{",
"$",
"this",
"->",
"methodOverride",
"=",
"NULL",
";",
"}",
"else",
"{",
"$",
"method",
"=",
"strtoupper",
"(",
"... | Set method override for a POST request.
@param string $method The method to be used.
@return HttpRequest
@throws \InvalidArgumentException When the given HTTP method is invalid. | [
"Set",
"method",
"override",
"for",
"a",
"POST",
"request",
"."
] | 3c1626d409d5ce5d71d26f0e8f31ae3683a2a966 | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/HttpRequest.php#L149-L168 |
199,571 | koolkode/http | src/HttpRequest.php | HttpRequest.setCookie | public function setCookie($name, $value)
{
if(!preg_match("'^[a-z_0-9\-\.]+$'i", $name))
{
throw new \InvalidArgumentException(sprintf('Invalid cookie name: "%s"', $name));
}
$this->cookies[$name] = $value;
return $this;
} | php | public function setCookie($name, $value)
{
if(!preg_match("'^[a-z_0-9\-\.]+$'i", $name))
{
throw new \InvalidArgumentException(sprintf('Invalid cookie name: "%s"', $name));
}
$this->cookies[$name] = $value;
return $this;
} | [
"public",
"function",
"setCookie",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"\"'^[a-z_0-9\\-\\.]+$'i\"",
",",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Inva... | Set a cookie value in the request.
@param string $name
@param mixed $value
@return HttpRequest
@throws \InvalidArgumentException When an invalid cookie name is passed. | [
"Set",
"a",
"cookie",
"value",
"in",
"the",
"request",
"."
] | 3c1626d409d5ce5d71d26f0e8f31ae3683a2a966 | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/HttpRequest.php#L406-L416 |
199,572 | koolkode/http | src/HttpRequest.php | HttpRequest.setCookies | public function setCookies(array $cookies)
{
$this->cookies = [];
foreach($cookies as $name => $value)
{
$this->setCookie($name, $value);
}
return $this;
} | php | public function setCookies(array $cookies)
{
$this->cookies = [];
foreach($cookies as $name => $value)
{
$this->setCookie($name, $value);
}
return $this;
} | [
"public",
"function",
"setCookies",
"(",
"array",
"$",
"cookies",
")",
"{",
"$",
"this",
"->",
"cookies",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"cookies",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"setCookie",
"(",
"$",... | Set all cookies found in the given array.
@param array<string, mixed> $cookies
@return HttpRequest | [
"Set",
"all",
"cookies",
"found",
"in",
"the",
"given",
"array",
"."
] | 3c1626d409d5ce5d71d26f0e8f31ae3683a2a966 | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/HttpRequest.php#L447-L457 |
199,573 | MinyFramework/Miny-Core | src/Utils/ArrayUtils.php | ArrayUtils.merge | public static function merge(array $array1, array $array2, $overwrite = true)
{
foreach ($array2 as $key => $value) {
if (isset($array1[$key])) {
if (self::isArray($array1[$key]) && self::isArray($value)) {
$array1[$key] = self::merge($array1[$key], $value, $o... | php | public static function merge(array $array1, array $array2, $overwrite = true)
{
foreach ($array2 as $key => $value) {
if (isset($array1[$key])) {
if (self::isArray($array1[$key]) && self::isArray($value)) {
$array1[$key] = self::merge($array1[$key], $value, $o... | [
"public",
"static",
"function",
"merge",
"(",
"array",
"$",
"array1",
",",
"array",
"$",
"array2",
",",
"$",
"overwrite",
"=",
"true",
")",
"{",
"foreach",
"(",
"$",
"array2",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",... | Merge two arrays recursively.
@param array $array1
@param array $array2
@param bool $overwrite Overwrite value if it exists in $array1.
@return array The merged array | [
"Merge",
"two",
"arrays",
"recursively",
"."
] | a1bfe801a44a49cf01f16411cb4663473e9c827c | https://github.com/MinyFramework/Miny-Core/blob/a1bfe801a44a49cf01f16411cb4663473e9c827c/src/Utils/ArrayUtils.php#L177-L192 |
199,574 | gplcart/cli | controllers/commands/Order.php | Order.cmdGetOrder | public function cmdGetOrder()
{
$result = $this->getListOrder();
$this->outputFormat($result);
$this->outputFormatTableOrder($result);
$this->output();
} | php | public function cmdGetOrder()
{
$result = $this->getListOrder();
$this->outputFormat($result);
$this->outputFormatTableOrder($result);
$this->output();
} | [
"public",
"function",
"cmdGetOrder",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getListOrder",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTableOrder",
"(",
"$",
"result",
... | Callback for "order-get" command | [
"Callback",
"for",
"order",
"-",
"get",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Order.php#L40-L46 |
199,575 | gplcart/cli | controllers/commands/Order.php | Order.cmdAddOrder | public function cmdAddOrder()
{
$submitted = $this->getParam();
$this->setSubmitted(null, $submitted);
$this->setSubmittedJson('data');
$this->validateComponent('order');
if ($this->isError()) {
$this->output();
}
$id = $this->order->add($this-... | php | public function cmdAddOrder()
{
$submitted = $this->getParam();
$this->setSubmitted(null, $submitted);
$this->setSubmittedJson('data');
$this->validateComponent('order');
if ($this->isError()) {
$this->output();
}
$id = $this->order->add($this-... | [
"public",
"function",
"cmdAddOrder",
"(",
")",
"{",
"$",
"submitted",
"=",
"$",
"this",
"->",
"getParam",
"(",
")",
";",
"$",
"this",
"->",
"setSubmitted",
"(",
"null",
",",
"$",
"submitted",
")",
";",
"$",
"this",
"->",
"setSubmittedJson",
"(",
"'data... | Callback for "order-add" command | [
"Callback",
"for",
"order",
"-",
"add",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Order.php#L105-L126 |
199,576 | gplcart/cli | controllers/commands/Order.php | Order.cmdUpdateOrder | public function cmdUpdateOrder()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'));
... | php | public function cmdUpdateOrder()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'));
... | [
"public",
"function",
"cmdUpdateOrder",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getParam",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"params",
"[",
"0",
"]",
")",
"||",
"count",
"(",
"$",
"params",
")",
"<",
"2",
")",
"{",
"$"... | Callback for "order-update" command | [
"Callback",
"for",
"order",
"-",
"update",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Order.php#L131-L158 |
199,577 | dubhunter/talon | src/Mvc/View/Template.php | Template.set | public function set($key, $value) {
$this->validateValue($value);
$this->variables[$key] = $value;
} | php | public function set($key, $value) {
$this->validateValue($value);
$this->variables[$key] = $value;
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"validateValue",
"(",
"$",
"value",
")",
";",
"$",
"this",
"->",
"variables",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}"
] | Set a given key to a view value
@param string $key The key to set
@param string $value The value to set
@return void | [
"Set",
"a",
"given",
"key",
"to",
"a",
"view",
"value"
] | 308b7284556dfaff0d9ac4c7739dc6a46930ef36 | https://github.com/dubhunter/talon/blob/308b7284556dfaff0d9ac4c7739dc6a46930ef36/src/Mvc/View/Template.php#L44-L47 |
199,578 | dubhunter/talon | src/Mvc/View/Template.php | Template.add | public function add($key, $value) {
$this->validateValue($value);
if (!isset($this->variables[$key])) {
$this->variables[$key] = [];
}
if (!is_array($this->variables[$key])) {
$this->variables[$key] = [$this->variables[$key]];
}
$this->variables[$key][] = $value;
} | php | public function add($key, $value) {
$this->validateValue($value);
if (!isset($this->variables[$key])) {
$this->variables[$key] = [];
}
if (!is_array($this->variables[$key])) {
$this->variables[$key] = [$this->variables[$key]];
}
$this->variables[$key][] = $value;
} | [
"public",
"function",
"add",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"validateValue",
"(",
"$",
"value",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"variables",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
... | Adds a value to a collection, collection will be created if it does not already exist
@param string $key The collection key
@param $value | [
"Adds",
"a",
"value",
"to",
"a",
"collection",
"collection",
"will",
"be",
"created",
"if",
"it",
"does",
"not",
"already",
"exist"
] | 308b7284556dfaff0d9ac4c7739dc6a46930ef36 | https://github.com/dubhunter/talon/blob/308b7284556dfaff0d9ac4c7739dc6a46930ef36/src/Mvc/View/Template.php#L54-L65 |
199,579 | OxfordInfoLabs/kinikit-core | src/Util/Annotation/ClassAnnotations.php | ClassAnnotations.getMethodAnnotationsForMatchingTag | public function getMethodAnnotationsForMatchingTag($tag, $methodName = null) {
if ($methodName) {
return isset($this->methodAnnotations[$methodName][$tag]) ? $this->methodAnnotations[$methodName][$tag] : array();
} else {
$matchingAnnotations = array();
foreach ($this... | php | public function getMethodAnnotationsForMatchingTag($tag, $methodName = null) {
if ($methodName) {
return isset($this->methodAnnotations[$methodName][$tag]) ? $this->methodAnnotations[$methodName][$tag] : array();
} else {
$matchingAnnotations = array();
foreach ($this... | [
"public",
"function",
"getMethodAnnotationsForMatchingTag",
"(",
"$",
"tag",
",",
"$",
"methodName",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"methodName",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"methodAnnotations",
"[",
"$",
"methodName",
"]",
... | Get any method annotations with a matching tag. Return these indexed by field name.
@param $tag
@param $methodName
@return null | [
"Get",
"any",
"method",
"annotations",
"with",
"a",
"matching",
"tag",
".",
"Return",
"these",
"indexed",
"by",
"field",
"name",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Annotation/ClassAnnotations.php#L110-L123 |
199,580 | OxfordInfoLabs/kinikit-core | src/Util/Annotation/ClassAnnotations.php | ClassAnnotations.getFieldAnnotationsForMatchingTag | public function getFieldAnnotationsForMatchingTag($tag, $fieldName = null) {
if ($fieldName) {
return isset($this->fieldAnnotations[$fieldName][$tag]) ? $this->fieldAnnotations[$fieldName][$tag] : array();
} else {
$matchingAnnotations = array();
foreach ($this->get... | php | public function getFieldAnnotationsForMatchingTag($tag, $fieldName = null) {
if ($fieldName) {
return isset($this->fieldAnnotations[$fieldName][$tag]) ? $this->fieldAnnotations[$fieldName][$tag] : array();
} else {
$matchingAnnotations = array();
foreach ($this->get... | [
"public",
"function",
"getFieldAnnotationsForMatchingTag",
"(",
"$",
"tag",
",",
"$",
"fieldName",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"fieldName",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"fieldAnnotations",
"[",
"$",
"fieldName",
"]",
"[",... | Get any field annotations with a matching tag. Return these indexed by field name.
@param $string | [
"Get",
"any",
"field",
"annotations",
"with",
"a",
"matching",
"tag",
".",
"Return",
"these",
"indexed",
"by",
"field",
"name",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Annotation/ClassAnnotations.php#L131-L147 |
199,581 | OxfordInfoLabs/kinikit-core | src/Util/Annotation/ClassAnnotations.php | ClassAnnotations.getFieldAnnotationsContainingMatchingTag | public function getFieldAnnotationsContainingMatchingTag($tag) {
$matchingAnnotations = array();
foreach ($this->getFieldAnnotations() as $field => $fieldAnnotations) {
if (isset($fieldAnnotations[$tag])) {
$matchingAnnotations[$field] = $fieldAnnotations;
}
... | php | public function getFieldAnnotationsContainingMatchingTag($tag) {
$matchingAnnotations = array();
foreach ($this->getFieldAnnotations() as $field => $fieldAnnotations) {
if (isset($fieldAnnotations[$tag])) {
$matchingAnnotations[$field] = $fieldAnnotations;
}
... | [
"public",
"function",
"getFieldAnnotationsContainingMatchingTag",
"(",
"$",
"tag",
")",
"{",
"$",
"matchingAnnotations",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getFieldAnnotations",
"(",
")",
"as",
"$",
"field",
"=>",
"$",
"fieldAnnot... | Get the full set of field annotations for any fields containing a tag.
@param $tag | [
"Get",
"the",
"full",
"set",
"of",
"field",
"annotations",
"for",
"any",
"fields",
"containing",
"a",
"tag",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Annotation/ClassAnnotations.php#L155-L165 |
199,582 | OxfordInfoLabs/kinikit-core | src/Util/Annotation/ClassAnnotations.php | ClassAnnotations.getFieldAnnotationsNotContainingTags | public function getFieldAnnotationsNotContainingTags($tags = array()) {
$matchingAnnotations = array();
foreach ($this->getFieldAnnotations() as $field => $fieldAnnotations) {
$fieldAnnotationKeys = array_keys($fieldAnnotations);
if (!array_intersect($fieldAnnotationKeys, $tags)... | php | public function getFieldAnnotationsNotContainingTags($tags = array()) {
$matchingAnnotations = array();
foreach ($this->getFieldAnnotations() as $field => $fieldAnnotations) {
$fieldAnnotationKeys = array_keys($fieldAnnotations);
if (!array_intersect($fieldAnnotationKeys, $tags)... | [
"public",
"function",
"getFieldAnnotationsNotContainingTags",
"(",
"$",
"tags",
"=",
"array",
"(",
")",
")",
"{",
"$",
"matchingAnnotations",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getFieldAnnotations",
"(",
")",
"as",
"$",
"field",... | Get all field annotations not containing passed tags.
@param array $tags
@return array | [
"Get",
"all",
"field",
"annotations",
"not",
"containing",
"passed",
"tags",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Annotation/ClassAnnotations.php#L174-L185 |
199,583 | SCLInternet/SclZfGenericMapper | src/SclZfGenericMapper/Exception/InvalidArgumentException.php | InvalidArgumentException.invalidEntityType | public static function invalidEntityType($expected, $actual)
{
return new self(sprintf(
'Entity must be an instance of "%s"; got "%s".',
$expected,
is_object($actual) ? get_class($actual) : gettype($actual)
));
} | php | public static function invalidEntityType($expected, $actual)
{
return new self(sprintf(
'Entity must be an instance of "%s"; got "%s".',
$expected,
is_object($actual) ? get_class($actual) : gettype($actual)
));
} | [
"public",
"static",
"function",
"invalidEntityType",
"(",
"$",
"expected",
",",
"$",
"actual",
")",
"{",
"return",
"new",
"self",
"(",
"sprintf",
"(",
"'Entity must be an instance of \"%s\"; got \"%s\".'",
",",
"$",
"expected",
",",
"is_object",
"(",
"$",
"actual"... | 'Entity must be an instance of "%s"; got "%s".'
@param string $expected
@param object $actual
@return InvalidArgumentException | [
"Entity",
"must",
"be",
"an",
"instance",
"of",
"%s",
";",
"got",
"%s",
"."
] | c61c61546bfbc07e9c9a4b425e8e02fd7182d80b | https://github.com/SCLInternet/SclZfGenericMapper/blob/c61c61546bfbc07e9c9a4b425e8e02fd7182d80b/src/SclZfGenericMapper/Exception/InvalidArgumentException.php#L26-L33 |
199,584 | jenskooij/cloudcontrol | src/storage/factories/DocumentFolderFactory.php | DocumentFolderFactory.createDocumentFolderFromPostValues | public static function createDocumentFolderFromPostValues($postValues)
{
if (isset($postValues['title'], $postValues['path'], $postValues['content'])) {
$documentFolderObject = new Document();
$documentFolderObject->title = $postValues['title'];
$documentFolderObject->slu... | php | public static function createDocumentFolderFromPostValues($postValues)
{
if (isset($postValues['title'], $postValues['path'], $postValues['content'])) {
$documentFolderObject = new Document();
$documentFolderObject->title = $postValues['title'];
$documentFolderObject->slu... | [
"public",
"static",
"function",
"createDocumentFolderFromPostValues",
"(",
"$",
"postValues",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"postValues",
"[",
"'title'",
"]",
",",
"$",
"postValues",
"[",
"'path'",
"]",
",",
"$",
"postValues",
"[",
"'content'",
"]"... | Create folder from post values
@param $postValues
@return Document
@throws \Exception | [
"Create",
"folder",
"from",
"post",
"values"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/factories/DocumentFolderFactory.php#L24-L37 |
199,585 | zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/PropertyTrait.php | PropertyTrait.property | final public function property($name, $value)
{
$this->definition->setProperty($name, static::processValue($value, true));
return $this;
} | php | final public function property($name, $value)
{
$this->definition->setProperty($name, static::processValue($value, true));
return $this;
} | [
"final",
"public",
"function",
"property",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"definition",
"->",
"setProperty",
"(",
"$",
"name",
",",
"static",
"::",
"processValue",
"(",
"$",
"value",
",",
"true",
")",
")",
";",
"ret... | Sets a specific property.
@param string $name
@param mixed $value
@return $this | [
"Sets",
"a",
"specific",
"property",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/PropertyTrait.php#L24-L29 |
199,586 | mossphp/moss-storage | Moss/Storage/Query/InsertQuery.php | InsertQuery.assignValue | protected function assignValue(FieldInterface $field)
{
$value = $this->accessor->getPropertyValue($this->instance, $field->name());
if ($value === null && $field->attribute('autoincrement')) {
return;
}
if ($value === null) {
$this->getValueFromReferencedEn... | php | protected function assignValue(FieldInterface $field)
{
$value = $this->accessor->getPropertyValue($this->instance, $field->name());
if ($value === null && $field->attribute('autoincrement')) {
return;
}
if ($value === null) {
$this->getValueFromReferencedEn... | [
"protected",
"function",
"assignValue",
"(",
"FieldInterface",
"$",
"field",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"accessor",
"->",
"getPropertyValue",
"(",
"$",
"this",
"->",
"instance",
",",
"$",
"field",
"->",
"name",
"(",
")",
")",
";",
... | Assigns value to query
@param FieldInterface $field | [
"Assigns",
"value",
"to",
"query"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/InsertQuery.php#L69-L85 |
199,587 | ZendExperts/phpids | lib/IDS/Log/Composite.php | IDS_Log_Composite.execute | public function execute(IDS_Report $data)
{
// make sure request uri is set right on IIS
if (!isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1);
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) {
$_SERVE... | php | public function execute(IDS_Report $data)
{
// make sure request uri is set right on IIS
if (!isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1);
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) {
$_SERVE... | [
"public",
"function",
"execute",
"(",
"IDS_Report",
"$",
"data",
")",
"{",
"// make sure request uri is set right on IIS",
"if",
"(",
"!",
"isset",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
")",
")",
"{",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
"=",
... | Iterates through registered loggers and executes them
@param object $data IDS_Report object
@return void | [
"Iterates",
"through",
"registered",
"loggers",
"and",
"executes",
"them"
] | f30df04eea47b94d056e2ae9ec8fea1c626f1c03 | https://github.com/ZendExperts/phpids/blob/f30df04eea47b94d056e2ae9ec8fea1c626f1c03/lib/IDS/Log/Composite.php#L69-L87 |
199,588 | ZendExperts/phpids | lib/IDS/Log/Composite.php | IDS_Log_Composite.addLogger | public function addLogger()
{
$args = func_get_args();
foreach ($args as $class) {
if (!in_array($class, $this->loggers) &&
($class instanceof IDS_Log_Interface)) {
$this->loggers[] = $class;
}
}
} | php | public function addLogger()
{
$args = func_get_args();
foreach ($args as $class) {
if (!in_array($class, $this->loggers) &&
($class instanceof IDS_Log_Interface)) {
$this->loggers[] = $class;
}
}
} | [
"public",
"function",
"addLogger",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"class",
",",
"$",
"this",
"->",
"loggers",
")",
... | Registers a new logging wrapper
Only valid IDS_Log_Interface instances passed to this function will be
registered
@return void | [
"Registers",
"a",
"new",
"logging",
"wrapper"
] | f30df04eea47b94d056e2ae9ec8fea1c626f1c03 | https://github.com/ZendExperts/phpids/blob/f30df04eea47b94d056e2ae9ec8fea1c626f1c03/lib/IDS/Log/Composite.php#L97-L108 |
199,589 | ZendExperts/phpids | lib/IDS/Log/Composite.php | IDS_Log_Composite.removeLogger | public function removeLogger(IDS_Log_Interface $logger)
{
$key = array_search($logger, $this->loggers);
if (isset($this->loggers[$key])) {
unset($this->loggers[$key]);
return true;
}
return false;
} | php | public function removeLogger(IDS_Log_Interface $logger)
{
$key = array_search($logger, $this->loggers);
if (isset($this->loggers[$key])) {
unset($this->loggers[$key]);
return true;
}
return false;
} | [
"public",
"function",
"removeLogger",
"(",
"IDS_Log_Interface",
"$",
"logger",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"$",
"logger",
",",
"$",
"this",
"->",
"loggers",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"loggers",
"[",
"$",
... | Removes a logger
@param object $logger IDS_Log_Interface object
@return boolean | [
"Removes",
"a",
"logger"
] | f30df04eea47b94d056e2ae9ec8fea1c626f1c03 | https://github.com/ZendExperts/phpids/blob/f30df04eea47b94d056e2ae9ec8fea1c626f1c03/lib/IDS/Log/Composite.php#L117-L127 |
199,590 | libreworks/caridea-validate | src/Parser.php | Parser.parse | public function parse($rules): Rule\Set
{
$isArray = is_array($rules);
$isAssoc = $isArray && self::isAssociative($rules);
$set = null;
if (is_string($rules) || is_object($rules) || $isAssoc) {
$set = $this->getRule($rules);
} elseif ($isArray) {
forea... | php | public function parse($rules): Rule\Set
{
$isArray = is_array($rules);
$isAssoc = $isArray && self::isAssociative($rules);
$set = null;
if (is_string($rules) || is_object($rules) || $isAssoc) {
$set = $this->getRule($rules);
} elseif ($isArray) {
forea... | [
"public",
"function",
"parse",
"(",
"$",
"rules",
")",
":",
"Rule",
"\\",
"Set",
"{",
"$",
"isArray",
"=",
"is_array",
"(",
"$",
"rules",
")",
";",
"$",
"isAssoc",
"=",
"$",
"isArray",
"&&",
"self",
"::",
"isAssociative",
"(",
"$",
"rules",
")",
";... | Turns a number of rule definitions into an actual Rule Set.
@param string|object|array $rules The rules to parse
@return \Caridea\Validate\Rule\Set The set of Rules | [
"Turns",
"a",
"number",
"of",
"rule",
"definitions",
"into",
"an",
"actual",
"Rule",
"Set",
"."
] | 625835694d34591bfb1e3b2ce60c2cc28a28d006 | https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Parser.php#L62-L76 |
199,591 | libreworks/caridea-validate | src/Parser.php | Parser.getRule | public function getRule($rule, $arg = null): Rule\Set
{
$rules = new Rule\Set();
if (is_string($rule)) {
$vrule = $this->registry->factory($rule, $arg);
if ($vrule instanceof Draft) {
$vrule = $vrule->finish($this->registry);
}
$rules->... | php | public function getRule($rule, $arg = null): Rule\Set
{
$rules = new Rule\Set();
if (is_string($rule)) {
$vrule = $this->registry->factory($rule, $arg);
if ($vrule instanceof Draft) {
$vrule = $vrule->finish($this->registry);
}
$rules->... | [
"public",
"function",
"getRule",
"(",
"$",
"rule",
",",
"$",
"arg",
"=",
"null",
")",
":",
"Rule",
"\\",
"Set",
"{",
"$",
"rules",
"=",
"new",
"Rule",
"\\",
"Set",
"(",
")",
";",
"if",
"(",
"is_string",
"(",
"$",
"rule",
")",
")",
"{",
"$",
"... | Parses rule definitions.
@param string|object|array $rule Either a string name, an associative
array, or an object with name → arguments
@param mixed $arg Optional constructor argument, or an array of arguments
@return \Caridea\Validate\Rule\Set An set of instantiated rules | [
"Parses",
"rule",
"definitions",
"."
] | 625835694d34591bfb1e3b2ce60c2cc28a28d006 | https://github.com/libreworks/caridea-validate/blob/625835694d34591bfb1e3b2ce60c2cc28a28d006/src/Parser.php#L86-L101 |
199,592 | OxfordInfoLabs/kinikit-core | src/Template/Parser/PHPTemplateParser.php | PHPTemplateParser.parseTemplateText | public function parseTemplateText($viewText, &$model) {
// Extract all template parameters into scope.
extract($model);
// Store defined variables before we evaluate
$preVariables = get_defined_vars() ? get_defined_vars() : array();
unset($preVariables["model"]);
// No... | php | public function parseTemplateText($viewText, &$model) {
// Extract all template parameters into scope.
extract($model);
// Store defined variables before we evaluate
$preVariables = get_defined_vars() ? get_defined_vars() : array();
unset($preVariables["model"]);
// No... | [
"public",
"function",
"parseTemplateText",
"(",
"$",
"viewText",
",",
"&",
"$",
"model",
")",
"{",
"// Extract all template parameters into scope.",
"extract",
"(",
"$",
"model",
")",
";",
"// Store defined variables before we evaluate",
"$",
"preVariables",
"=",
"get_d... | Parse the view as PHP. This also allows for new variables to be defined within a view and as such these will be merged into the model
for use in a parent view if required.
@param $viewText
@param $model | [
"Parse",
"the",
"view",
"as",
"PHP",
".",
"This",
"also",
"allows",
"for",
"new",
"variables",
"to",
"be",
"defined",
"within",
"a",
"view",
"and",
"as",
"such",
"these",
"will",
"be",
"merged",
"into",
"the",
"model",
"for",
"use",
"in",
"a",
"parent"... | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Template/Parser/PHPTemplateParser.php#L22-L48 |
199,593 | modulusphp/security | Hash.php | Hash.random | public static function random(int $length = 10, string $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') : string
{
$pieces = [];
$max = mb_strlen($keyspace, '8bit') - 1;
for ($i = 0; $i < $length; ++$i) {
$pieces[] = $keyspace[random_int(0, $max)];
}
return implo... | php | public static function random(int $length = 10, string $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') : string
{
$pieces = [];
$max = mb_strlen($keyspace, '8bit') - 1;
for ($i = 0; $i < $length; ++$i) {
$pieces[] = $keyspace[random_int(0, $max)];
}
return implo... | [
"public",
"static",
"function",
"random",
"(",
"int",
"$",
"length",
"=",
"10",
",",
"string",
"$",
"keyspace",
"=",
"'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'",
")",
":",
"string",
"{",
"$",
"pieces",
"=",
"[",
"]",
";",
"$",
"max",
"="... | Creating a random string
@param int $length
@param string $keyspace
@return string | [
"Creating",
"a",
"random",
"string"
] | 7a0b7f7a23f682588a3582b810d61266f7c14567 | https://github.com/modulusphp/security/blob/7a0b7f7a23f682588a3582b810d61266f7c14567/Hash.php#L35-L43 |
199,594 | modulusphp/security | Hash.php | Hash.safe | public static function safe(string $string) : string
{
$split = str_split($string);
foreach($split as $k => $char) {
if (str_contains('~!@#$%^&*()_-=+<>/\?;:{}[]|,.', $char)) {
unset($split[$k]);
}
}
return implode('', $split);
} | php | public static function safe(string $string) : string
{
$split = str_split($string);
foreach($split as $k => $char) {
if (str_contains('~!@#$%^&*()_-=+<>/\?;:{}[]|,.', $char)) {
unset($split[$k]);
}
}
return implode('', $split);
} | [
"public",
"static",
"function",
"safe",
"(",
"string",
"$",
"string",
")",
":",
"string",
"{",
"$",
"split",
"=",
"str_split",
"(",
"$",
"string",
")",
";",
"foreach",
"(",
"$",
"split",
"as",
"$",
"k",
"=>",
"$",
"char",
")",
"{",
"if",
"(",
"st... | Remove special char's from string
@param string $string
@return string | [
"Remove",
"special",
"char",
"s",
"from",
"string"
] | 7a0b7f7a23f682588a3582b810d61266f7c14567 | https://github.com/modulusphp/security/blob/7a0b7f7a23f682588a3582b810d61266f7c14567/Hash.php#L69-L80 |
199,595 | rzajac/phptools | src/Helper/Arr.php | Arr.range | public static function range($max, $start = 1, $step = 1)
{
if ($step < 1) {
return [];
}
$array = [];
for ($i = $start; $i <= $max; $i += $step) {
$array[] = $i;
}
return $array;
} | php | public static function range($max, $start = 1, $step = 1)
{
if ($step < 1) {
return [];
}
$array = [];
for ($i = $start; $i <= $max; $i += $step) {
$array[] = $i;
}
return $array;
} | [
"public",
"static",
"function",
"range",
"(",
"$",
"max",
",",
"$",
"start",
"=",
"1",
",",
"$",
"step",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"step",
"<",
"1",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"array",
"=",
"[",
"]",
";",
"for",
... | Fill an array with a range of numbers.
@param int $max The maximum ending number
@param int $start The start number
@param int $step The stepping
@return array | [
"Fill",
"an",
"array",
"with",
"a",
"range",
"of",
"numbers",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Helper/Arr.php#L92-L104 |
199,596 | rzajac/phptools | src/Helper/Arr.php | Arr.fetch | public static function fetch($array, $path, $default = null)
{
// $array must be an array
if (!is_array($array)) {
return $default;
}
if ($path === '') {
return $array;
}
$path = is_array($path) ? $path : explode('.', $path);
$levels ... | php | public static function fetch($array, $path, $default = null)
{
// $array must be an array
if (!is_array($array)) {
return $default;
}
if ($path === '') {
return $array;
}
$path = is_array($path) ? $path : explode('.', $path);
$levels ... | [
"public",
"static",
"function",
"fetch",
"(",
"$",
"array",
",",
"$",
"path",
",",
"$",
"default",
"=",
"null",
")",
"{",
"// $array must be an array",
"if",
"(",
"!",
"is_array",
"(",
"$",
"array",
")",
")",
"{",
"return",
"$",
"default",
";",
"}",
... | Fetch nested array value by dot notation path.
Arr::fetch('key1.key2', $arr);
@param array $array The array to get value from.
@param string|array $path The key in dot notation. You can also pass array with keys.
@param mixed $default The default value if key does not exist.
@return mixed | [
"Fetch",
"nested",
"array",
"value",
"by",
"dot",
"notation",
"path",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Helper/Arr.php#L135-L167 |
199,597 | ekyna/Resource | Model/TranslationTrait.php | TranslationTrait.setTranslatable | public function setTranslatable(TranslatableInterface $translatable = null)
{
if ($translatable === $this->translatable) {
return $this;
}
$previousTranslatable = $this->translatable;
$this->translatable = $translatable;
/** @var TranslationInterface $this */
... | php | public function setTranslatable(TranslatableInterface $translatable = null)
{
if ($translatable === $this->translatable) {
return $this;
}
$previousTranslatable = $this->translatable;
$this->translatable = $translatable;
/** @var TranslationInterface $this */
... | [
"public",
"function",
"setTranslatable",
"(",
"TranslatableInterface",
"$",
"translatable",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"translatable",
"===",
"$",
"this",
"->",
"translatable",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"previousTranslatable",... | Sets the translatable.
@param TranslatableInterface $translatable
@return TranslationInterface|$this | [
"Sets",
"the",
"translatable",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Model/TranslationTrait.php#L29-L48 |
199,598 | MetaModels/phpunit-contao-database | src/Contao/Database/FakeQuery.php | FakeQuery.escapeParameters | protected function escapeParameters()
{
$parameters = $this->parameters;
foreach ($parameters as $k => $v) {
switch (gettype($v)) {
case 'string':
$parameters[$k] = $this->stringEscape($v);
break;
case 'boolean':
... | php | protected function escapeParameters()
{
$parameters = $this->parameters;
foreach ($parameters as $k => $v) {
switch (gettype($v)) {
case 'string':
$parameters[$k] = $this->stringEscape($v);
break;
case 'boolean':
... | [
"protected",
"function",
"escapeParameters",
"(",
")",
"{",
"$",
"parameters",
"=",
"$",
"this",
"->",
"parameters",
";",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"switch",
"(",
"gettype",
"(",
"$",
"v",
")",
")",
... | Escape the parameters and return them.
@return array | [
"Escape",
"the",
"parameters",
"and",
"return",
"them",
"."
] | aeb2ee10dac532fa73e2deb6457b6a167a1c01c7 | https://github.com/MetaModels/phpunit-contao-database/blob/aeb2ee10dac532fa73e2deb6457b6a167a1c01c7/src/Contao/Database/FakeQuery.php#L164-L192 |
199,599 | MetaModels/phpunit-contao-database | src/Contao/Database/FakeQuery.php | FakeQuery.compileQuery | protected function compileQuery()
{
$query = $this->sql;
// Auto-generate the SET/VALUES subpart
if (strncasecmp($query, 'INSERT', 6) === 0 || strncasecmp($query, 'UPDATE', 6) === 0) {
$query = str_replace('%s', '%p', $query);
}
// Replace wildcards
$chu... | php | protected function compileQuery()
{
$query = $this->sql;
// Auto-generate the SET/VALUES subpart
if (strncasecmp($query, 'INSERT', 6) === 0 || strncasecmp($query, 'UPDATE', 6) === 0) {
$query = str_replace('%s', '%p', $query);
}
// Replace wildcards
$chu... | [
"protected",
"function",
"compileQuery",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"sql",
";",
"// Auto-generate the SET/VALUES subpart",
"if",
"(",
"strncasecmp",
"(",
"$",
"query",
",",
"'INSERT'",
",",
"6",
")",
"===",
"0",
"||",
"strncasecmp",... | Compile the query into a string.
@return void
@throws \Exception When the arguments do not match the query. | [
"Compile",
"the",
"query",
"into",
"a",
"string",
"."
] | aeb2ee10dac532fa73e2deb6457b6a167a1c01c7 | https://github.com/MetaModels/phpunit-contao-database/blob/aeb2ee10dac532fa73e2deb6457b6a167a1c01c7/src/Contao/Database/FakeQuery.php#L201-L232 |
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.