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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
16,600 | contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.createDropdown | public static function createDropdown($label, array $attributes = array(), $fromFieldset = false)
{
$dropdown = new Dropdown();
$dropdown->setLabel($label);
static::applyAttributes($dropdown, $attributes, $fromFieldset);
return $dropdown;
} | php | public static function createDropdown($label, array $attributes = array(), $fromFieldset = false)
{
$dropdown = new Dropdown();
$dropdown->setLabel($label);
static::applyAttributes($dropdown, $attributes, $fromFieldset);
return $dropdown;
} | [
"public",
"static",
"function",
"createDropdown",
"(",
"$",
"label",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"fromFieldset",
"=",
"false",
")",
"{",
"$",
"dropdown",
"=",
"new",
"Dropdown",
"(",
")",
";",
"$",
"dropdown",
"->... | Create dropdown button.
@param string $label Dropdown button.
@param array $attributes Additional html attributes.
@param bool $fromFieldset Set true if attributes comes from fieldset definitions have to be transformed.
@return Dropdown | [
"Create",
"dropdown",
"button",
"."
] | f573a24c19ec059aae528a12ba46dfc993844201 | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L143-L151 |
16,601 | contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.createDropdownHeader | public static function createDropdownHeader($label, array $attributes = array(), $fromFieldset = false)
{
$dropdown = new Dropdown\Header();
$dropdown->setLabel($label);
static::applyAttributes($dropdown, $attributes, $fromFieldset);
return $dropdown;
} | php | public static function createDropdownHeader($label, array $attributes = array(), $fromFieldset = false)
{
$dropdown = new Dropdown\Header();
$dropdown->setLabel($label);
static::applyAttributes($dropdown, $attributes, $fromFieldset);
return $dropdown;
} | [
"public",
"static",
"function",
"createDropdownHeader",
"(",
"$",
"label",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"fromFieldset",
"=",
"false",
")",
"{",
"$",
"dropdown",
"=",
"new",
"Dropdown",
"\\",
"Header",
"(",
")",
";",
... | Create dropdown header.
@param string $label Dropdown button.
@param array $attributes Additional html attributes.
@param bool $fromFieldset Set true if attributes comes from fieldset definitions have to be transformed.
@return Dropdown\Header | [
"Create",
"dropdown",
"header",
"."
] | f573a24c19ec059aae528a12ba46dfc993844201 | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L162-L170 |
16,602 | contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.createDropdownDivider | public static function createDropdownDivider(array $attributes = array(), $fromFieldset = false)
{
$dropdown = new Dropdown\Divider();
static::applyAttributes($dropdown, $attributes, $fromFieldset);
return $dropdown;
} | php | public static function createDropdownDivider(array $attributes = array(), $fromFieldset = false)
{
$dropdown = new Dropdown\Divider();
static::applyAttributes($dropdown, $attributes, $fromFieldset);
return $dropdown;
} | [
"public",
"static",
"function",
"createDropdownDivider",
"(",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"fromFieldset",
"=",
"false",
")",
"{",
"$",
"dropdown",
"=",
"new",
"Dropdown",
"\\",
"Divider",
"(",
")",
";",
"static",
"::",
"... | Create dropdown divider.
@param array $attributes Additional html attributes.
@param bool $fromFieldset Set true if attributes comes from fieldset definitions have to be transformed.
@return Dropdown\Divider | [
"Create",
"dropdown",
"divider",
"."
] | f573a24c19ec059aae528a12ba46dfc993844201 | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L180-L186 |
16,603 | contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.createDropdownItem | public static function createDropdownItem($label, $url, array $attributes = array(), $fromFieldset = false)
{
$button = static::createButton($label, $url, $attributes, $fromFieldset);
$button->setAttribute('role', 'menuitem');
$dropdown = new Dropdown\Item($button);
return $dropdown... | php | public static function createDropdownItem($label, $url, array $attributes = array(), $fromFieldset = false)
{
$button = static::createButton($label, $url, $attributes, $fromFieldset);
$button->setAttribute('role', 'menuitem');
$dropdown = new Dropdown\Item($button);
return $dropdown... | [
"public",
"static",
"function",
"createDropdownItem",
"(",
"$",
"label",
",",
"$",
"url",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"fromFieldset",
"=",
"false",
")",
"{",
"$",
"button",
"=",
"static",
"::",
"createButton",
"(",
... | Create dropdown item.
@param string $label Dropdown label.
@param string $url Dropdown url.
@param array $attributes Additional html attributes.
@param bool $fromFieldset Set true if attributes comes from fieldset definitions have to be transformed.
@return Dropdown\Item | [
"Create",
"dropdown",
"item",
"."
] | f573a24c19ec059aae528a12ba46dfc993844201 | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L198-L205 |
16,604 | contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.applyAttributes | protected static function applyAttributes(Attributes $node, array $attributes, $fromFieldset = false)
{
if (empty($attributes)) {
return;
}
if ($fromFieldset) {
foreach ($attributes as $attribute) {
if ($attribute['name']) {
if ($a... | php | protected static function applyAttributes(Attributes $node, array $attributes, $fromFieldset = false)
{
if (empty($attributes)) {
return;
}
if ($fromFieldset) {
foreach ($attributes as $attribute) {
if ($attribute['name']) {
if ($a... | [
"protected",
"static",
"function",
"applyAttributes",
"(",
"Attributes",
"$",
"node",
",",
"array",
"$",
"attributes",
",",
"$",
"fromFieldset",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"attributes",
")",
")",
"{",
"return",
";",
"}",
"if",
... | Apply attributes.
@param Attributes $node Attrbiutes alement.
@param array $attributes Html attributes which being applied.
@param bool $fromFieldset Set true if attributes comes from fieldset definitions have to be transformed.
@return void | [
"Apply",
"attributes",
"."
] | f573a24c19ec059aae528a12ba46dfc993844201 | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L216-L242 |
16,605 | contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.enableToolbar | protected static function enableToolbar($root)
{
if (!$root instanceof Toolbar) {
$group = $root;
$root = static::createToolbar(array(), true);
if ($group instanceof Group && $group->getChildren()) {
$root->addChild($group);
}
}
... | php | protected static function enableToolbar($root)
{
if (!$root instanceof Toolbar) {
$group = $root;
$root = static::createToolbar(array(), true);
if ($group instanceof Group && $group->getChildren()) {
$root->addChild($group);
}
}
... | [
"protected",
"static",
"function",
"enableToolbar",
"(",
"$",
"root",
")",
"{",
"if",
"(",
"!",
"$",
"root",
"instanceof",
"Toolbar",
")",
"{",
"$",
"group",
"=",
"$",
"root",
";",
"$",
"root",
"=",
"static",
"::",
"createToolbar",
"(",
"array",
"(",
... | Enable the toolbar.
@param mixed $root Current root element.
@return Toolbar | [
"Enable",
"the",
"toolbar",
"."
] | f573a24c19ec059aae528a12ba46dfc993844201 | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L251-L263 |
16,606 | contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.parseDropdownChild | private static function parseDropdownChild($dropdown, $button)
{
if ($dropdown === false || !$dropdown instanceof Dropdown) {
// @codingStandardsIgnoreStart
// TODO throw exception?
// @codingStandardsIgnoreEnd
return;
}
if ($button['type'] ==... | php | private static function parseDropdownChild($dropdown, $button)
{
if ($dropdown === false || !$dropdown instanceof Dropdown) {
// @codingStandardsIgnoreStart
// TODO throw exception?
// @codingStandardsIgnoreEnd
return;
}
if ($button['type'] ==... | [
"private",
"static",
"function",
"parseDropdownChild",
"(",
"$",
"dropdown",
",",
"$",
"button",
")",
"{",
"if",
"(",
"$",
"dropdown",
"===",
"false",
"||",
"!",
"$",
"dropdown",
"instanceof",
"Dropdown",
")",
"{",
"// @codingStandardsIgnoreStart",
"// TODO thro... | Parse dropdown child.
@param Dropdown|bool $dropdown Current dropdown element.
@param array $button Button definition.
@return void | [
"Parse",
"dropdown",
"child",
"."
] | f573a24c19ec059aae528a12ba46dfc993844201 | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L273-L294 |
16,607 | contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.parseDefinition | protected static function parseDefinition($definition)
{
if (!is_array($definition)) {
$definition = deserialize($definition, true);
return $definition;
}
return $definition;
} | php | protected static function parseDefinition($definition)
{
if (!is_array($definition)) {
$definition = deserialize($definition, true);
return $definition;
}
return $definition;
} | [
"protected",
"static",
"function",
"parseDefinition",
"(",
"$",
"definition",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"definition",
")",
")",
"{",
"$",
"definition",
"=",
"deserialize",
"(",
"$",
"definition",
",",
"true",
")",
";",
"return",
"$"... | Parse button definition.
@param string|array $definition Button definition.
@return array | [
"Parse",
"button",
"definition",
"."
] | f573a24c19ec059aae528a12ba46dfc993844201 | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L303-L312 |
16,608 | contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.encodeValue | protected static function encodeValue($button)
{
if (isset($button['button']) && $button['button'] == 'link') {
if (substr($button['value'], 0, 7) == 'mailto:') {
if (version_compare(VERSION . '.' . BUILD, '3.5.5', '>=')) {
$button['value'] = \StringUtil::enco... | php | protected static function encodeValue($button)
{
if (isset($button['button']) && $button['button'] == 'link') {
if (substr($button['value'], 0, 7) == 'mailto:') {
if (version_compare(VERSION . '.' . BUILD, '3.5.5', '>=')) {
$button['value'] = \StringUtil::enco... | [
"protected",
"static",
"function",
"encodeValue",
"(",
"$",
"button",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"button",
"[",
"'button'",
"]",
")",
"&&",
"$",
"button",
"[",
"'button'",
"]",
"==",
"'link'",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"... | Encode button value.
@param array $button Button definition.
@return array | [
"Encode",
"button",
"value",
"."
] | f573a24c19ec059aae528a12ba46dfc993844201 | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L333-L348 |
16,609 | contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/Factory.php | Factory.createNewGroup | protected static function createNewGroup(&$root, $button, &$dropdown, $addToRoot = true)
{
if ($addToRoot) {
$root = self::enableToolbar($root);
}
if ($dropdown !== false) {
$dropdown = false;
}
$group = static::createGroup($button['attributes'], tru... | php | protected static function createNewGroup(&$root, $button, &$dropdown, $addToRoot = true)
{
if ($addToRoot) {
$root = self::enableToolbar($root);
}
if ($dropdown !== false) {
$dropdown = false;
}
$group = static::createGroup($button['attributes'], tru... | [
"protected",
"static",
"function",
"createNewGroup",
"(",
"&",
"$",
"root",
",",
"$",
"button",
",",
"&",
"$",
"dropdown",
",",
"$",
"addToRoot",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"addToRoot",
")",
"{",
"$",
"root",
"=",
"self",
"::",
"enableToo... | Create a new group element.
@param mixed $root Current root.
@param array $button Button definition.
@param Dropdown|bool $dropdown Dropdown element.
@param bool $addToRoot If rue the created group is added to the root.
@return Group | [
"Create",
"a",
"new",
"group",
"element",
"."
] | f573a24c19ec059aae528a12ba46dfc993844201 | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/Factory.php#L360-L379 |
16,610 | jan-dolata/crude-crud | src/Engine/CrudeInstance.php | CrudeInstance.get | public static function get($name)
{
$namespaces = config('crude.namespace');
if (! is_array($namespaces)) {
$fullName = $namespaces . $name;
return class_exists($fullName)
? new $fullName()
: null;
}
foreach ($namespaces as $... | php | public static function get($name)
{
$namespaces = config('crude.namespace');
if (! is_array($namespaces)) {
$fullName = $namespaces . $name;
return class_exists($fullName)
? new $fullName()
: null;
}
foreach ($namespaces as $... | [
"public",
"static",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"$",
"namespaces",
"=",
"config",
"(",
"'crude.namespace'",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"namespaces",
")",
")",
"{",
"$",
"fullName",
"=",
"$",
"namespaces",
".",
... | Create crude instance
@param string $name
@return Model|null | [
"Create",
"crude",
"instance"
] | 9129ea08278835cf5cecfd46a90369226ae6bdd7 | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeInstance.php#L13-L32 |
16,611 | blast-project/CoreBundle | src/Admin/Traits/PreEvents.php | PreEvents.prePersistOrUpdate | protected function prePersistOrUpdate($object, $method)
{
$analyzer = new ClassAnalyzer();
foreach ($analyzer->getTraits($this) as $traitname) {
$rc = new \ReflectionClass($traitname);
if (method_exists($this, $exec = $method . $rc->getShortName())) {
$this->$... | php | protected function prePersistOrUpdate($object, $method)
{
$analyzer = new ClassAnalyzer();
foreach ($analyzer->getTraits($this) as $traitname) {
$rc = new \ReflectionClass($traitname);
if (method_exists($this, $exec = $method . $rc->getShortName())) {
$this->$... | [
"protected",
"function",
"prePersistOrUpdate",
"(",
"$",
"object",
",",
"$",
"method",
")",
"{",
"$",
"analyzer",
"=",
"new",
"ClassAnalyzer",
"(",
")",
";",
"foreach",
"(",
"$",
"analyzer",
"->",
"getTraits",
"(",
"$",
"this",
")",
"as",
"$",
"traitname... | function prePersistOrUpdate.
Searches in every trait (as if they were kind of Doctrine Behaviors) some logical to be
executed during the self::prePersist() or self::preUpdate() calls
The logical is stored in the self::prePersist{TraitName}() method
@param object $object (Entity)
@param string $method (the current cal... | [
"function",
"prePersistOrUpdate",
"."
] | 7a0832758ca14e5bc5d65515532c1220df3930ae | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Admin/Traits/PreEvents.php#L51-L62 |
16,612 | comelyio/comely | src/Comely/IO/Yaml/Compiler.php | Compiler.setIndent | public function setIndent(int $indent = 2): self
{
if (!Number::Range($indent, 2, 8)) {
throw new CompilerException(sprintf('"%d" is an invalid indent value', $indent));
}
return $this;
} | php | public function setIndent(int $indent = 2): self
{
if (!Number::Range($indent, 2, 8)) {
throw new CompilerException(sprintf('"%d" is an invalid indent value', $indent));
}
return $this;
} | [
"public",
"function",
"setIndent",
"(",
"int",
"$",
"indent",
"=",
"2",
")",
":",
"self",
"{",
"if",
"(",
"!",
"Number",
"::",
"Range",
"(",
"$",
"indent",
",",
"2",
",",
"8",
")",
")",
"{",
"throw",
"new",
"CompilerException",
"(",
"sprintf",
"(",... | Set indent spacer
@param int $indent
@return Compiler
@throws CompilerException | [
"Set",
"indent",
"spacer"
] | 561ea7aef36fea347a1a79d3ee5597d4057ddf82 | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Yaml/Compiler.php#L66-L73 |
16,613 | axelitus/php-base | src/Comparison/IntComparer.php | IntComparer.setCallback | public function setCallback(Closure $callback = null)
{
if ($this->callback !== null || $callback === null) {
throw new \RuntimeException("Cannot redeclare this comparer callback.");
}
$this->callback = Closure::bind($callback, $this, get_called_class());
} | php | public function setCallback(Closure $callback = null)
{
if ($this->callback !== null || $callback === null) {
throw new \RuntimeException("Cannot redeclare this comparer callback.");
}
$this->callback = Closure::bind($callback, $this, get_called_class());
} | [
"public",
"function",
"setCallback",
"(",
"Closure",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"callback",
"!==",
"null",
"||",
"$",
"callback",
"===",
"null",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"Cannot... | This comparer does not allow to set the callback outside this class.
@param Closure $callback The new callback.
@throws \RuntimeException | [
"This",
"comparer",
"does",
"not",
"allow",
"to",
"set",
"the",
"callback",
"outside",
"this",
"class",
"."
] | c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075 | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Comparison/IntComparer.php#L52-L59 |
16,614 | ekyna/GlsUniBox | Api/AbstractData.php | AbstractData.get | protected function get($tag)
{
if (isset($this->data[$tag])) {
return $this->data[$tag];
}
return null;
} | php | protected function get($tag)
{
if (isset($this->data[$tag])) {
return $this->data[$tag];
}
return null;
} | [
"protected",
"function",
"get",
"(",
"$",
"tag",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"tag",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"data",
"[",
"$",
"tag",
"]",
";",
"}",
"return",
"null",
";",
"}... | Returns the value for the given tag.
@param string $tag
@return string|null | [
"Returns",
"the",
"value",
"for",
"the",
"given",
"tag",
"."
] | b474271ba355c3917074422306dc64abf09584d0 | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/AbstractData.php#L54-L61 |
16,615 | ekyna/GlsUniBox | Api/AbstractData.php | AbstractData.clean | public function clean()
{
foreach ($this->data as $key => $data) {
if (empty($data)) {
unset($this->data[$key]);
}
}
return $this;
} | php | public function clean()
{
foreach ($this->data as $key => $data) {
if (empty($data)) {
unset($this->data[$key]);
}
}
return $this;
} | [
"public",
"function",
"clean",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"key",
"=>",
"$",
"data",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"k... | Removes keys with empty value.
@return $this | [
"Removes",
"keys",
"with",
"empty",
"value",
"."
] | b474271ba355c3917074422306dc64abf09584d0 | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/AbstractData.php#L68-L77 |
16,616 | ray-di/Ray.WebFormModule | src/AbstractForm.php | AbstractForm.apply | public function apply(array $data)
{
if ($this->antiCsrf && ! $this->antiCsrf->isValid($data)) {
throw new CsrfViolationException;
}
$this->fill($data);
return $this->filter->apply($data);
} | php | public function apply(array $data)
{
if ($this->antiCsrf && ! $this->antiCsrf->isValid($data)) {
throw new CsrfViolationException;
}
$this->fill($data);
return $this->filter->apply($data);
} | [
"public",
"function",
"apply",
"(",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"antiCsrf",
"&&",
"!",
"$",
"this",
"->",
"antiCsrf",
"->",
"isValid",
"(",
"$",
"data",
")",
")",
"{",
"throw",
"new",
"CsrfViolationException",
";",
"... | Applies the filter to a subject.
@param array $data
@throws CsrfViolationException
@return bool | [
"Applies",
"the",
"filter",
"to",
"a",
"subject",
"."
] | 4b6d33adb4a5c285278a068f3e7a5afdc4e680d9 | https://github.com/ray-di/Ray.WebFormModule/blob/4b6d33adb4a5c285278a068f3e7a5afdc4e680d9/src/AbstractForm.php#L158-L166 |
16,617 | andyvenus/form | src/EntityProcessor/GetterSetterEntityProcessor.php | GetterSetterEntityProcessor.getFromEntity | public function getFromEntity($entity, array $formParameters, $limitFields = null)
{
$extracted_data = array();
foreach($formParameters as $field) {
$getter_name = "get".$this->dashesToCamelCase($field);
if (($limitFields === null || in_array($field, $limitFields)) && metho... | php | public function getFromEntity($entity, array $formParameters, $limitFields = null)
{
$extracted_data = array();
foreach($formParameters as $field) {
$getter_name = "get".$this->dashesToCamelCase($field);
if (($limitFields === null || in_array($field, $limitFields)) && metho... | [
"public",
"function",
"getFromEntity",
"(",
"$",
"entity",
",",
"array",
"$",
"formParameters",
",",
"$",
"limitFields",
"=",
"null",
")",
"{",
"$",
"extracted_data",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"formParameters",
"as",
"$",
"field",
... | Get data from an entity using getter methods
@param $entity
@param array $formParameters
@param null $limitFields
@return array | [
"Get",
"data",
"from",
"an",
"entity",
"using",
"getter",
"methods"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/EntityProcessor/GetterSetterEntityProcessor.php#L25-L38 |
16,618 | andyvenus/form | src/EntityProcessor/GetterSetterEntityProcessor.php | GetterSetterEntityProcessor.saveToEntity | public function saveToEntity($entity, $formData, $limitFields = null)
{
foreach($formData as $field => $value) {
$setter_name = "set".$this->dashesToCamelCase($field);
if (($limitFields === null || in_array($field, $limitFields)) && method_exists($entity, $setter_name)) {
... | php | public function saveToEntity($entity, $formData, $limitFields = null)
{
foreach($formData as $field => $value) {
$setter_name = "set".$this->dashesToCamelCase($field);
if (($limitFields === null || in_array($field, $limitFields)) && method_exists($entity, $setter_name)) {
... | [
"public",
"function",
"saveToEntity",
"(",
"$",
"entity",
",",
"$",
"formData",
",",
"$",
"limitFields",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"formData",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"$",
"setter_name",
"=",
"\"set\"",
".",
... | Save data to an entity using setter methods
@param $entity
@param $formData
@param null $limitFields
@return void | [
"Save",
"data",
"to",
"an",
"entity",
"using",
"setter",
"methods"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/EntityProcessor/GetterSetterEntityProcessor.php#L48-L57 |
16,619 | foothing/laravel-repository | src/Foothing/Repository/Eloquent/EloquentRepository.php | EloquentRepository.setModel | public function setModel(\Illuminate\Database\Eloquent\Model $model) {
$this->model = $model;
if ($this->model instanceof ResourceInterface) {
$this->enableAutoEagerLoading = true;
}
} | php | public function setModel(\Illuminate\Database\Eloquent\Model $model) {
$this->model = $model;
if ($this->model instanceof ResourceInterface) {
$this->enableAutoEagerLoading = true;
}
} | [
"public",
"function",
"setModel",
"(",
"\\",
"Illuminate",
"\\",
"Database",
"\\",
"Eloquent",
"\\",
"Model",
"$",
"model",
")",
"{",
"$",
"this",
"->",
"model",
"=",
"$",
"model",
";",
"if",
"(",
"$",
"this",
"->",
"model",
"instanceof",
"ResourceInterf... | Set the repository model.
@param \Illuminate\Database\Eloquent\Model $model | [
"Set",
"the",
"repository",
"model",
"."
] | a2e329acb26a08d9f260c66534b0d4f42e2adff5 | https://github.com/foothing/laravel-repository/blob/a2e329acb26a08d9f260c66534b0d4f42e2adff5/src/Foothing/Repository/Eloquent/EloquentRepository.php#L60-L65 |
16,620 | foothing/laravel-repository | src/Foothing/Repository/Eloquent/EloquentRepository.php | EloquentRepository.finalize | protected function finalize($result) {
$this->eagerLoad = [];
$this->criteria->reset();
$this->scope = null;
return $result;
} | php | protected function finalize($result) {
$this->eagerLoad = [];
$this->criteria->reset();
$this->scope = null;
return $result;
} | [
"protected",
"function",
"finalize",
"(",
"$",
"result",
")",
"{",
"$",
"this",
"->",
"eagerLoad",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"criteria",
"->",
"reset",
"(",
")",
";",
"$",
"this",
"->",
"scope",
"=",
"null",
";",
"return",
"$",
"result... | Utility method for flags reset. Always use this to return results.
@param $result
The result we want to return
@return mixed | [
"Utility",
"method",
"for",
"flags",
"reset",
".",
"Always",
"use",
"this",
"to",
"return",
"results",
"."
] | a2e329acb26a08d9f260c66534b0d4f42e2adff5 | https://github.com/foothing/laravel-repository/blob/a2e329acb26a08d9f260c66534b0d4f42e2adff5/src/Foothing/Repository/Eloquent/EloquentRepository.php#L75-L80 |
16,621 | foothing/laravel-repository | src/Foothing/Repository/Eloquent/EloquentRepository.php | EloquentRepository.applyAutoEagerLoading | protected function applyAutoEagerLoading($fetch = 'unit') {
if (! empty($this->eagerLoad)) {
return;
}
if ($this->enableAutoEagerLoading && $fetch == 'unit') {
$this->eagerLoad = $this->model->unitRelations();
}
elseif ($this->enableAutoEagerLoading && $... | php | protected function applyAutoEagerLoading($fetch = 'unit') {
if (! empty($this->eagerLoad)) {
return;
}
if ($this->enableAutoEagerLoading && $fetch == 'unit') {
$this->eagerLoad = $this->model->unitRelations();
}
elseif ($this->enableAutoEagerLoading && $... | [
"protected",
"function",
"applyAutoEagerLoading",
"(",
"$",
"fetch",
"=",
"'unit'",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"eagerLoad",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"enableAutoEagerLoading",
"&&",
... | Check whether the autoEagerLoading feature has to be applied.
@param string $fetch | [
"Check",
"whether",
"the",
"autoEagerLoading",
"feature",
"has",
"to",
"be",
"applied",
"."
] | a2e329acb26a08d9f260c66534b0d4f42e2adff5 | https://github.com/foothing/laravel-repository/blob/a2e329acb26a08d9f260c66534b0d4f42e2adff5/src/Foothing/Repository/Eloquent/EloquentRepository.php#L87-L99 |
16,622 | heyday/heystack | src/DependencyInjection/SilverStripe/SilverStripeServiceTrait.php | SilverStripeServiceTrait.getInjector | protected function getInjector()
{
if ($this->injector === null) {
$this->injector = \Injector::inst();
}
return $this->injector;
} | php | protected function getInjector()
{
if ($this->injector === null) {
$this->injector = \Injector::inst();
}
return $this->injector;
} | [
"protected",
"function",
"getInjector",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"injector",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"injector",
"=",
"\\",
"Injector",
"::",
"inst",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"injector",... | Retrieves the Injector instance
@return \Injector | [
"Retrieves",
"the",
"Injector",
"instance"
] | 2c051933f8c532d0a9a23be6ee1ff5c619e47dfe | https://github.com/heyday/heystack/blob/2c051933f8c532d0a9a23be6ee1ff5c619e47dfe/src/DependencyInjection/SilverStripe/SilverStripeServiceTrait.php#L34-L41 |
16,623 | activecollab/databasestructure | src/Builder/TriggersBuilder.php | TriggersBuilder.triggerExists | private function triggerExists($trigger_name)
{
if ($triggers = $this->getConnection()->execute('SHOW TRIGGERS', $trigger_name)) {
foreach ($triggers as $trigger) {
if ($trigger['Trigger'] == $trigger_name) {
return true;
}
}
... | php | private function triggerExists($trigger_name)
{
if ($triggers = $this->getConnection()->execute('SHOW TRIGGERS', $trigger_name)) {
foreach ($triggers as $trigger) {
if ($trigger['Trigger'] == $trigger_name) {
return true;
}
}
... | [
"private",
"function",
"triggerExists",
"(",
"$",
"trigger_name",
")",
"{",
"if",
"(",
"$",
"triggers",
"=",
"$",
"this",
"->",
"getConnection",
"(",
")",
"->",
"execute",
"(",
"'SHOW TRIGGERS'",
",",
"$",
"trigger_name",
")",
")",
"{",
"foreach",
"(",
"... | Check if trigger exists.
@param string $trigger_name
@return bool | [
"Check",
"if",
"trigger",
"exists",
"."
] | 4b2353c4422186bcfce63b3212da3e70e63eb5df | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Builder/TriggersBuilder.php#L134-L145 |
16,624 | jan-dolata/crude-crud | src/Engine/Traits/FromModelTraitPart/StoreUpdateDeleteTrait.php | StoreUpdateDeleteTrait.store | public function store($attributes)
{
$attributes = $this->formatStoreAttributes($attributes);
$model = $this->model->create($this->mapAttributesWithScope($attributes));
if ($this->canOrder()) {
if ($this->storeInLastPlace) {
$attr = $this->crudeSetup->getOrderAt... | php | public function store($attributes)
{
$attributes = $this->formatStoreAttributes($attributes);
$model = $this->model->create($this->mapAttributesWithScope($attributes));
if ($this->canOrder()) {
if ($this->storeInLastPlace) {
$attr = $this->crudeSetup->getOrderAt... | [
"public",
"function",
"store",
"(",
"$",
"attributes",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"formatStoreAttributes",
"(",
"$",
"attributes",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"model",
"->",
"create",
"(",
"$",
"this",
"->"... | Store new model
@param array $attributes
@return Model | [
"Store",
"new",
"model"
] | 9129ea08278835cf5cecfd46a90369226ae6bdd7 | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/FromModelTraitPart/StoreUpdateDeleteTrait.php#L47-L67 |
16,625 | jan-dolata/crude-crud | src/Engine/Traits/FromModelTraitPart/StoreUpdateDeleteTrait.php | StoreUpdateDeleteTrait.updateById | public function updateById($id, $attributes)
{
$attributes = $this->formatUpdateAttributes($attributes);
$model = $this->model->find($id);
if (empty($model))
return $this;
$model->update($this->mapAttributesWithScope($attributes));
$apiModel = $this->getById($... | php | public function updateById($id, $attributes)
{
$attributes = $this->formatUpdateAttributes($attributes);
$model = $this->model->find($id);
if (empty($model))
return $this;
$model->update($this->mapAttributesWithScope($attributes));
$apiModel = $this->getById($... | [
"public",
"function",
"updateById",
"(",
"$",
"id",
",",
"$",
"attributes",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"formatUpdateAttributes",
"(",
"$",
"attributes",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"model",
"->",
"find",
"(... | Update by id
@param integer $id
@param array $attributes
@return Model | [
"Update",
"by",
"id"
] | 9129ea08278835cf5cecfd46a90369226ae6bdd7 | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/FromModelTraitPart/StoreUpdateDeleteTrait.php#L75-L89 |
16,626 | jan-dolata/crude-crud | src/Engine/Traits/FromModelTraitPart/StoreUpdateDeleteTrait.php | StoreUpdateDeleteTrait.deleteById | public function deleteById($id)
{
$model = $this->getById($id);
if (empty($model))
return $this;
if ($this instanceof \JanDolata\CrudeCRUD\Engine\Interfaces\WithFileInterface) {
$fileAttrName = $this->fileAttrName;
$modelFiles = $model->$fileAttrName;
... | php | public function deleteById($id)
{
$model = $this->getById($id);
if (empty($model))
return $this;
if ($this instanceof \JanDolata\CrudeCRUD\Engine\Interfaces\WithFileInterface) {
$fileAttrName = $this->fileAttrName;
$modelFiles = $model->$fileAttrName;
... | [
"public",
"function",
"deleteById",
"(",
"$",
"id",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"getById",
"(",
"$",
"id",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"model",
")",
")",
"return",
"$",
"this",
";",
"if",
"(",
"$",
"this",
"insta... | Delete by id
@param integer $id
@return self | [
"Delete",
"by",
"id"
] | 9129ea08278835cf5cecfd46a90369226ae6bdd7 | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/FromModelTraitPart/StoreUpdateDeleteTrait.php#L124-L145 |
16,627 | JoffreyPoreeCoding/MongoDB-ODM | src/Hydrator.php | Hydrator.recursiveConvertInArray | public function recursiveConvertInArray($array)
{
$newArray = [];
foreach ($array as $key => $value) {
if ($value instanceof \MongoDB\Model\BSONDocument || $value instanceof \MongoDB\Model\BSONArray) {
$value = (array) $value;
}
if (is_array($valu... | php | public function recursiveConvertInArray($array)
{
$newArray = [];
foreach ($array as $key => $value) {
if ($value instanceof \MongoDB\Model\BSONDocument || $value instanceof \MongoDB\Model\BSONArray) {
$value = (array) $value;
}
if (is_array($valu... | [
"public",
"function",
"recursiveConvertInArray",
"(",
"$",
"array",
")",
"{",
"$",
"newArray",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"\\",
"MongoDB",
"... | Convert BSONDocument and BSONArray to array recursively
@param array $array Array to convert
@return array | [
"Convert",
"BSONDocument",
"and",
"BSONArray",
"to",
"array",
"recursively"
] | 56fd7ab28c22f276573a89d56bb93c8d74ad7f74 | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Hydrator.php#L302-L318 |
16,628 | JoffreyPoreeCoding/MongoDB-ODM | src/Hydrator.php | Hydrator.getHydrator | public function getHydrator($class)
{
$metadata = $this->classMetadataFactory->getMetadataForClass($class);
return new Hydrator($this->classMetadataFactory, $metadata, $this->documentManager, $this->repositoryFactory);
} | php | public function getHydrator($class)
{
$metadata = $this->classMetadataFactory->getMetadataForClass($class);
return new Hydrator($this->classMetadataFactory, $metadata, $this->documentManager, $this->repositoryFactory);
} | [
"public",
"function",
"getHydrator",
"(",
"$",
"class",
")",
"{",
"$",
"metadata",
"=",
"$",
"this",
"->",
"classMetadataFactory",
"->",
"getMetadataForClass",
"(",
"$",
"class",
")",
";",
"return",
"new",
"Hydrator",
"(",
"$",
"this",
"->",
"classMetadataFa... | Get hydrator for specified class
@param string $class Class which you will get hydrator
@return Hydrator Hydrator corresponding to specified class | [
"Get",
"hydrator",
"for",
"specified",
"class"
] | 56fd7ab28c22f276573a89d56bb93c8d74ad7f74 | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Hydrator.php#L326-L330 |
16,629 | WebDevTmas/date-repetition | src/DateRepetition/DateRepetitionCalculator.php | DateRepetitionCalculator.getNextOccurence | public function getNextOccurence(DateRepetition $dateRepetition, DateTime $datetime = null)
{
if(null === $datetime) {
$datetime = $this->timeProvider->now();
}
switch(true) {
case $dateRepetition instanceof WeeklyDateRepetition:
return $this->getNext... | php | public function getNextOccurence(DateRepetition $dateRepetition, DateTime $datetime = null)
{
if(null === $datetime) {
$datetime = $this->timeProvider->now();
}
switch(true) {
case $dateRepetition instanceof WeeklyDateRepetition:
return $this->getNext... | [
"public",
"function",
"getNextOccurence",
"(",
"DateRepetition",
"$",
"dateRepetition",
",",
"DateTime",
"$",
"datetime",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"datetime",
")",
"{",
"$",
"datetime",
"=",
"$",
"this",
"->",
"timeProvider",
"... | Find next occurence of date repetition
@param DateRepetition
@param DateTime next occurence from this date (null == now)
@return DateTime date/time of next occurence | [
"Find",
"next",
"occurence",
"of",
"date",
"repetition"
] | 3ebd59f4ab3aab4b7497ebd767a57fad08277c6d | https://github.com/WebDevTmas/date-repetition/blob/3ebd59f4ab3aab4b7497ebd767a57fad08277c6d/src/DateRepetition/DateRepetitionCalculator.php#L33-L49 |
16,630 | tonicospinelli/class-generation | src/ClassGeneration/MethodCollection.php | MethodCollection.add | public function add($method)
{
if (!$method instanceof MethodInterface) {
throw new \InvalidArgumentException('This Method must be a instance of \ClassGeneration\MethodInterface');
}
if ($method->getName() === null) {
$method->setName('method' . ($this->count() + 1));... | php | public function add($method)
{
if (!$method instanceof MethodInterface) {
throw new \InvalidArgumentException('This Method must be a instance of \ClassGeneration\MethodInterface');
}
if ($method->getName() === null) {
$method->setName('method' . ($this->count() + 1));... | [
"public",
"function",
"add",
"(",
"$",
"method",
")",
"{",
"if",
"(",
"!",
"$",
"method",
"instanceof",
"MethodInterface",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'This Method must be a instance of \\ClassGeneration\\MethodInterface'",
")",
"... | Adds a new Method on collection.
@param MethodInterface $method
@return bool
@throws \InvalidArgumentException | [
"Adds",
"a",
"new",
"Method",
"on",
"collection",
"."
] | eee63bdb68c066b25b885b57b23656e809381a76 | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/MethodCollection.php#L32-L43 |
16,631 | tonicospinelli/class-generation | src/ClassGeneration/MethodCollection.php | MethodCollection.toString | public function toString()
{
$string = '';
$methods = $this->getIterator();
foreach ($methods as $method) {
$string .= $method->toString();
}
return $string;
} | php | public function toString()
{
$string = '';
$methods = $this->getIterator();
foreach ($methods as $method) {
$string .= $method->toString();
}
return $string;
} | [
"public",
"function",
"toString",
"(",
")",
"{",
"$",
"string",
"=",
"''",
";",
"$",
"methods",
"=",
"$",
"this",
"->",
"getIterator",
"(",
")",
";",
"foreach",
"(",
"$",
"methods",
"as",
"$",
"method",
")",
"{",
"$",
"string",
".=",
"$",
"method",... | Parse the Method Collection to string.
@return string | [
"Parse",
"the",
"Method",
"Collection",
"to",
"string",
"."
] | eee63bdb68c066b25b885b57b23656e809381a76 | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/MethodCollection.php#L58-L67 |
16,632 | withfatpanda/illuminate-wordpress | src/Support/Concerns/Retriable.php | Retriable.fail | function fail($callback)
{
if (is_null($this->state)) {
$this->onError[] = $callback;
} else if (!$this->state) {
$callback($this->result);
}
return $this;
} | php | function fail($callback)
{
if (is_null($this->state)) {
$this->onError[] = $callback;
} else if (!$this->state) {
$callback($this->result);
}
return $this;
} | [
"function",
"fail",
"(",
"$",
"callback",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"state",
")",
")",
"{",
"$",
"this",
"->",
"onError",
"[",
"]",
"=",
"$",
"callback",
";",
"}",
"else",
"if",
"(",
"!",
"$",
"this",
"->",
"state"... | If the wrapped operation ultimately fails on all attempts,
invoke the given function. Many functions can be
added to the stack. If the attempted execution
of the wrapped operation has already failed, the the function
given here will be invoked instantly.
@param function
@return self | [
"If",
"the",
"wrapped",
"operation",
"ultimately",
"fails",
"on",
"all",
"attempts",
"invoke",
"the",
"given",
"function",
".",
"Many",
"functions",
"can",
"be",
"added",
"to",
"the",
"stack",
".",
"If",
"the",
"attempted",
"execution",
"of",
"the",
"wrapped... | b426ca81a55367459430c974932ee5a941d759d8 | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/Support/Concerns/Retriable.php#L143-L151 |
16,633 | withfatpanda/illuminate-wordpress | src/Support/Concerns/Retriable.php | Retriable.until | function until($limit)
{
$until = function() use ($limit) {
if (is_int($limit)) {
if ($this->attempts < $limit) {
return true;
} else {
return false;
}
} else {
if ($limit($this->lastException, $this->attempts)) {
return true;
} e... | php | function until($limit)
{
$until = function() use ($limit) {
if (is_int($limit)) {
if ($this->attempts < $limit) {
return true;
} else {
return false;
}
} else {
if ($limit($this->lastException, $this->attempts)) {
return true;
} e... | [
"function",
"until",
"(",
"$",
"limit",
")",
"{",
"$",
"until",
"=",
"function",
"(",
")",
"use",
"(",
"$",
"limit",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"limit",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"attempts",
"<",
"$",
"limit",
... | Start the loop with the given limit
@param mixed Can be an integer or a function of
the signature function(\Exception $e, $attempt),
where $e is the last Exception thrown and $attempt
is the count of attempts made to execute the wrapped
operation
@return The return result of the wrapped operation,
if and when it comple... | [
"Start",
"the",
"loop",
"with",
"the",
"given",
"limit"
] | b426ca81a55367459430c974932ee5a941d759d8 | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/Support/Concerns/Retriable.php#L237-L302 |
16,634 | EcomDev/phpspec-magento-di-adapter | src/ParameterValidator.php | ParameterValidator.generator | public function generator($className)
{
foreach ($this->generators as $generator) {
if ($generator->supports($className)) {
return $generator->createGenerator($className);
}
}
return false;
} | php | public function generator($className)
{
foreach ($this->generators as $generator) {
if ($generator->supports($className)) {
return $generator->createGenerator($className);
}
}
return false;
} | [
"public",
"function",
"generator",
"(",
"$",
"className",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"generators",
"as",
"$",
"generator",
")",
"{",
"if",
"(",
"$",
"generator",
"->",
"supports",
"(",
"$",
"className",
")",
")",
"{",
"return",
"$",
... | Generates a generator from class name rules
@param string $className
@return bool|\Magento\Framework\Code\Generator\EntityAbstract | [
"Generates",
"a",
"generator",
"from",
"class",
"name",
"rules"
] | b39f6f0afbb837dbf0eb4c71e6cdb318b8c9de37 | https://github.com/EcomDev/phpspec-magento-di-adapter/blob/b39f6f0afbb837dbf0eb4c71e6cdb318b8c9de37/src/ParameterValidator.php#L78-L87 |
16,635 | EcomDev/phpspec-magento-di-adapter | src/ParameterValidator.php | ParameterValidator.createGeneratorFactory | private function createGeneratorFactory($generatorClass, \Closure $factory = null)
{
return function ($sourceClass, $prefixClass) use ($factory, $generatorClass) {
if ($factory) {
return $factory($sourceClass, $prefixClass, $this->generationIo, $this->definedClasses, $generatorCl... | php | private function createGeneratorFactory($generatorClass, \Closure $factory = null)
{
return function ($sourceClass, $prefixClass) use ($factory, $generatorClass) {
if ($factory) {
return $factory($sourceClass, $prefixClass, $this->generationIo, $this->definedClasses, $generatorCl... | [
"private",
"function",
"createGeneratorFactory",
"(",
"$",
"generatorClass",
",",
"\\",
"Closure",
"$",
"factory",
"=",
"null",
")",
"{",
"return",
"function",
"(",
"$",
"sourceClass",
",",
"$",
"prefixClass",
")",
"use",
"(",
"$",
"factory",
",",
"$",
"ge... | Returns generator factory
@param string $generatorClass
@param \Closure|null $factory
@return \Closure | [
"Returns",
"generator",
"factory"
] | b39f6f0afbb837dbf0eb4c71e6cdb318b8c9de37 | https://github.com/EcomDev/phpspec-magento-di-adapter/blob/b39f6f0afbb837dbf0eb4c71e6cdb318b8c9de37/src/ParameterValidator.php#L97-L106 |
16,636 | EcomDev/phpspec-magento-di-adapter | src/ParameterValidator.php | ParameterValidator.validate | public function validate(\ReflectionFunctionAbstract $reflectionFunction)
{
foreach ($reflectionFunction->getParameters() as $parameter) {
$this->validateParameter($parameter);
}
return $this;
} | php | public function validate(\ReflectionFunctionAbstract $reflectionFunction)
{
foreach ($reflectionFunction->getParameters() as $parameter) {
$this->validateParameter($parameter);
}
return $this;
} | [
"public",
"function",
"validate",
"(",
"\\",
"ReflectionFunctionAbstract",
"$",
"reflectionFunction",
")",
"{",
"foreach",
"(",
"$",
"reflectionFunction",
"->",
"getParameters",
"(",
")",
"as",
"$",
"parameter",
")",
"{",
"$",
"this",
"->",
"validateParameter",
... | Validates method signature and tries to generate missing classes
@param \ReflectionFunctionAbstract $reflectionFunction
@return $this | [
"Validates",
"method",
"signature",
"and",
"tries",
"to",
"generate",
"missing",
"classes"
] | b39f6f0afbb837dbf0eb4c71e6cdb318b8c9de37 | https://github.com/EcomDev/phpspec-magento-di-adapter/blob/b39f6f0afbb837dbf0eb4c71e6cdb318b8c9de37/src/ParameterValidator.php#L115-L122 |
16,637 | phramework/jsonapi | src/Controller/GETById.php | GETById.handleGETById | protected static function handleGETById(
$parameters,
$id,
$modelClass,
$primaryDataParameters = [],
$relationshipParameters = []
) {
$filterValidationModel = $modelClass::getFilterValidationModel();
$idAttribute = $modelClass::getIdAttribute();
//Fi... | php | protected static function handleGETById(
$parameters,
$id,
$modelClass,
$primaryDataParameters = [],
$relationshipParameters = []
) {
$filterValidationModel = $modelClass::getFilterValidationModel();
$idAttribute = $modelClass::getIdAttribute();
//Fi... | [
"protected",
"static",
"function",
"handleGETById",
"(",
"$",
"parameters",
",",
"$",
"id",
",",
"$",
"modelClass",
",",
"$",
"primaryDataParameters",
"=",
"[",
"]",
",",
"$",
"relationshipParameters",
"=",
"[",
"]",
")",
"{",
"$",
"filterValidationModel",
"... | handles GETById requests
@param object $parameters Request parameters
@param integer|string $id Requested resource's id
@param string $modelClass Resource's primary model
to be used
@param array $primaryDataParameters [Optional] Array with... | [
"handles",
"GETById",
"requests"
] | af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726 | https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Controller/GETById.php#L46-L90 |
16,638 | phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Map/RolePermissionTableMap.php | RolePermissionTableMap.doInsert | public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(RolePermissionTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // ... | php | public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(RolePermissionTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // ... | [
"public",
"static",
"function",
"doInsert",
"(",
"$",
"criteria",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"con",
")",
"{",
"$",
"con",
"=",
"Propel",
"::",
"getServiceContainer",
"(",
")",
"->",
"ge... | Performs an INSERT on the database, given a RolePermission or Criteria object.
@param mixed $criteria Criteria or RolePermission object containing data that is used to create the INSERT statement.
@param ConnectionInterface $con the ConnectionInterface connection to use
@return mixed The new pr... | [
"Performs",
"an",
"INSERT",
"on",
"the",
"database",
"given",
"a",
"RolePermission",
"or",
"Criteria",
"object",
"."
] | 3424a360c9bded71eb5b570bc114a7759cb23ec6 | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Map/RolePermissionTableMap.php#L454-L475 |
16,639 | braincrafted/arrayquery | src/Braincrafted/ArrayQuery/Evaluation.php | Evaluation.evaluateFilter | protected function evaluateFilter($value, $filter)
{
$filter = explode(' ', $filter, 2);
if (1 === count($filter)) {
$args = [];
$filter = $filter[0];
} else {
$args = array_map('trim', explode(',', $filter[1]));
$filter = $filter[0];
... | php | protected function evaluateFilter($value, $filter)
{
$filter = explode(' ', $filter, 2);
if (1 === count($filter)) {
$args = [];
$filter = $filter[0];
} else {
$args = array_map('trim', explode(',', $filter[1]));
$filter = $filter[0];
... | [
"protected",
"function",
"evaluateFilter",
"(",
"$",
"value",
",",
"$",
"filter",
")",
"{",
"$",
"filter",
"=",
"explode",
"(",
"' '",
",",
"$",
"filter",
",",
"2",
")",
";",
"if",
"(",
"1",
"===",
"count",
"(",
"$",
"filter",
")",
")",
"{",
"$",... | Evaluates the given value with the given filter.
@param mixed $value
@param string|array $filter
@return mixed
@throws Braincrafted\ArrayQuery\Exception\UnkownFilterException if a filter does not exist. | [
"Evaluates",
"the",
"given",
"value",
"with",
"the",
"given",
"filter",
"."
] | 8b0c44ee76cea796589422f52e2f7130676b9bd1 | https://github.com/braincrafted/arrayquery/blob/8b0c44ee76cea796589422f52e2f7130676b9bd1/src/Braincrafted/ArrayQuery/Evaluation.php#L36-L52 |
16,640 | heyday/heystack | src/Processor/HandlerTrait.php | HandlerTrait.getProcessor | public function getProcessor($name)
{
return isset($this->processors[$name]) ? $this->processors[$name] : false;
} | php | public function getProcessor($name)
{
return isset($this->processors[$name]) ? $this->processors[$name] : false;
} | [
"public",
"function",
"getProcessor",
"(",
"$",
"name",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"processors",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"processors",
"[",
"$",
"name",
"]",
":",
"false",
";",
"}"
] | Return a processor by an identifier if it exists
@param string $name The processor identifier
@return mixed The processor if it exists | [
"Return",
"a",
"processor",
"by",
"an",
"identifier",
"if",
"it",
"exists"
] | 2c051933f8c532d0a9a23be6ee1ff5c619e47dfe | https://github.com/heyday/heystack/blob/2c051933f8c532d0a9a23be6ee1ff5c619e47dfe/src/Processor/HandlerTrait.php#L27-L30 |
16,641 | crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php | DocumentRule.setUrl | public function setUrl($url)
{
if (is_string($url)) {
$this->url = $url;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($url) . "' for argument 'url' given. String expected."
);
}
} | php | public function setUrl($url)
{
if (is_string($url)) {
$this->url = $url;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($url) . "' for argument 'url' given. String expected."
);
}
} | [
"public",
"function",
"setUrl",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"url",
")",
")",
"{",
"$",
"this",
"->",
"url",
"=",
"$",
"url",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Invalid typ... | Sets the document URL filter.
@param string $url | [
"Sets",
"the",
"document",
"URL",
"filter",
"."
] | 7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3 | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php#L52-L61 |
16,642 | crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php | DocumentRule.setUrlPrefix | public function setUrlPrefix($urlPrefix)
{
if (is_string($urlPrefix)) {
$this->urlPrefix = $urlPrefix;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($urlPrefix) . "' for argument 'urlPrefix' given. String expected."
);
... | php | public function setUrlPrefix($urlPrefix)
{
if (is_string($urlPrefix)) {
$this->urlPrefix = $urlPrefix;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($urlPrefix) . "' for argument 'urlPrefix' given. String expected."
);
... | [
"public",
"function",
"setUrlPrefix",
"(",
"$",
"urlPrefix",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"urlPrefix",
")",
")",
"{",
"$",
"this",
"->",
"urlPrefix",
"=",
"$",
"urlPrefix",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"InvalidArgumentExcep... | Sets the document URL prefix filter.
@param string $urlPrefix | [
"Sets",
"the",
"document",
"URL",
"prefix",
"filter",
"."
] | 7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3 | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php#L78-L87 |
16,643 | crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php | DocumentRule.setDomain | public function setDomain($domain)
{
if (is_string($domain)) {
$this->domain = $domain;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($domain) . "' for argument 'domain' given. String expected."
);
}
} | php | public function setDomain($domain)
{
if (is_string($domain)) {
$this->domain = $domain;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($domain) . "' for argument 'domain' given. String expected."
);
}
} | [
"public",
"function",
"setDomain",
"(",
"$",
"domain",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"domain",
")",
")",
"{",
"$",
"this",
"->",
"domain",
"=",
"$",
"domain",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
... | Sets the document domain filter.
@param string $domain | [
"Sets",
"the",
"document",
"domain",
"filter",
"."
] | 7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3 | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php#L104-L113 |
16,644 | crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php | DocumentRule.setRegexp | public function setRegexp($regexp)
{
if (is_string($regexp)) {
$this->regexp = $regexp;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($regexp) . "' for argument 'regexp' given. String expected."
);
}
} | php | public function setRegexp($regexp)
{
if (is_string($regexp)) {
$this->regexp = $regexp;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($regexp) . "' for argument 'regexp' given. String expected."
);
}
} | [
"public",
"function",
"setRegexp",
"(",
"$",
"regexp",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"regexp",
")",
")",
"{",
"$",
"this",
"->",
"regexp",
"=",
"$",
"regexp",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
... | Sets the document regular expression filter.
@param string $regexp | [
"Sets",
"the",
"document",
"regular",
"expression",
"filter",
"."
] | 7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3 | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtDocument/DocumentRule.php#L130-L139 |
16,645 | verschoof/bunq-api | src/Resource/UserResource.php | UserResource.getUser | public function getUser($id)
{
$response = $this->client->get($this->getResourceEndpoint() . '/' . (int)$id);
return $response['Response'][0]['UserCompany'];
} | php | public function getUser($id)
{
$response = $this->client->get($this->getResourceEndpoint() . '/' . (int)$id);
return $response['Response'][0]['UserCompany'];
} | [
"public",
"function",
"getUser",
"(",
"$",
"id",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"$",
"this",
"->",
"getResourceEndpoint",
"(",
")",
".",
"'/'",
".",
"(",
"int",
")",
"$",
"id",
")",
";",
"return",
"... | Gets a user its information.
@param integer $id
@return array | [
"Gets",
"a",
"user",
"its",
"information",
"."
] | df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd | https://github.com/verschoof/bunq-api/blob/df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd/src/Resource/UserResource.php#L39-L44 |
16,646 | andyvenus/form | src/FormView.php | FormView.getSectionFields | public function getSectionFields($section, $flatten = true)
{
if ($flatten === false) {
$fields = $this->fields;
} else {
$fields = $this->getFlattenedFields();
}
$matchedFields = array();
foreach ($fields as $fieldName => $field) {
if (is... | php | public function getSectionFields($section, $flatten = true)
{
if ($flatten === false) {
$fields = $this->fields;
} else {
$fields = $this->getFlattenedFields();
}
$matchedFields = array();
foreach ($fields as $fieldName => $field) {
if (is... | [
"public",
"function",
"getSectionFields",
"(",
"$",
"section",
",",
"$",
"flatten",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"flatten",
"===",
"false",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"fields",
";",
"}",
"else",
"{",
"$",
"fields",
"... | Get fields for a certain section
@param $section
@param bool $flatten
@return array | [
"Get",
"fields",
"for",
"a",
"certain",
"section"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormView.php#L188-L204 |
16,647 | andyvenus/form | src/FormView.php | FormView.getFlattenedFields | public function getFlattenedFields()
{
if (!isset($this->flatFields)) {
$this->flatFields = [];
foreach ($this->fields as $field) {
if (isset($field['fields']) && is_array($field['fields'])) {
$this->flatFields += $this->flattenCollection($field);... | php | public function getFlattenedFields()
{
if (!isset($this->flatFields)) {
$this->flatFields = [];
foreach ($this->fields as $field) {
if (isset($field['fields']) && is_array($field['fields'])) {
$this->flatFields += $this->flattenCollection($field);... | [
"public",
"function",
"getFlattenedFields",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"flatFields",
")",
")",
"{",
"$",
"this",
"->",
"flatFields",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"f... | Flatten all fields by moving collections into the main array
@return array | [
"Flatten",
"all",
"fields",
"by",
"moving",
"collections",
"into",
"the",
"main",
"array"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormView.php#L211-L226 |
16,648 | andyvenus/form | src/FormView.php | FormView.flattenCollection | protected function flattenCollection($field)
{
if (!isset($field['fields']) || !is_array($field['fields'])) {
return [];
}
$fields = [];
foreach ($field['fields'] as $field) {
if (isset($field['fields']) && is_array($field['fields'])) {
$fiel... | php | protected function flattenCollection($field)
{
if (!isset($field['fields']) || !is_array($field['fields'])) {
return [];
}
$fields = [];
foreach ($field['fields'] as $field) {
if (isset($field['fields']) && is_array($field['fields'])) {
$fiel... | [
"protected",
"function",
"flattenCollection",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"field",
"[",
"'fields'",
"]",
")",
"||",
"!",
"is_array",
"(",
"$",
"field",
"[",
"'fields'",
"]",
")",
")",
"{",
"return",
"[",
"]",
";"... | Flatten the fields in a collection
@param $field
@return array | [
"Flatten",
"the",
"fields",
"in",
"a",
"collection"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormView.php#L234-L251 |
16,649 | andyvenus/form | src/FormView.php | FormView.getFieldsWithoutSection | public function getFieldsWithoutSection()
{
$matchedFields = array();
foreach ($this->fields as $fieldName => $field) {
if (!isset($field['options']['section']) || $field['options']['section'] === null || $field['options']['section'] === '') {
$matchedFields[$fieldName] =... | php | public function getFieldsWithoutSection()
{
$matchedFields = array();
foreach ($this->fields as $fieldName => $field) {
if (!isset($field['options']['section']) || $field['options']['section'] === null || $field['options']['section'] === '') {
$matchedFields[$fieldName] =... | [
"public",
"function",
"getFieldsWithoutSection",
"(",
")",
"{",
"$",
"matchedFields",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"fieldName",
"=>",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"... | Get any fields that don't have a section set
@return array | [
"Get",
"any",
"fields",
"that",
"don",
"t",
"have",
"a",
"section",
"set"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormView.php#L258-L268 |
16,650 | andyvenus/form | src/FormView.php | FormView.translate | protected function translate($str, $params = array())
{
if (isset($this->translator)) {
return $this->translator->trans($str, $params);
}
else {
$finalParams = array();
foreach ($params as $placeholder => $value) {
$finalParams['{'.$placeho... | php | protected function translate($str, $params = array())
{
if (isset($this->translator)) {
return $this->translator->trans($str, $params);
}
else {
$finalParams = array();
foreach ($params as $placeholder => $value) {
$finalParams['{'.$placeho... | [
"protected",
"function",
"translate",
"(",
"$",
"str",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"translator",
")",
")",
"{",
"return",
"$",
"this",
"->",
"translator",
"->",
"trans",
"(",
"$"... | Translate a string if the translator has been injected
@param $str string The string that will be translated
@param array $params
@return string | [
"Translate",
"a",
"string",
"if",
"the",
"translator",
"has",
"been",
"injected"
] | fde9d7e1741a707028aec4fd55c3568802df3708 | https://github.com/andyvenus/form/blob/fde9d7e1741a707028aec4fd55c3568802df3708/src/FormView.php#L377-L389 |
16,651 | jelix/ldapdao-module | ldapdao/plugins/auth/ldapdao/ldapdao.auth.php | ldapdaoAuthDriver._getLinkId | protected function _getLinkId()
{
if ($connect = ldap_connect($this->_params['hostname'], $this->_params['port'])) {
ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, $this->_params['protocolVersion']);
ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
return $connect;... | php | protected function _getLinkId()
{
if ($connect = ldap_connect($this->_params['hostname'], $this->_params['port'])) {
ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, $this->_params['protocolVersion']);
ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
return $connect;... | [
"protected",
"function",
"_getLinkId",
"(",
")",
"{",
"if",
"(",
"$",
"connect",
"=",
"ldap_connect",
"(",
"$",
"this",
"->",
"_params",
"[",
"'hostname'",
"]",
",",
"$",
"this",
"->",
"_params",
"[",
"'port'",
"]",
")",
")",
"{",
"ldap_set_option",
"(... | open the connection to the ldap server | [
"open",
"the",
"connection",
"to",
"the",
"ldap",
"server"
] | 8261aadf643e95c98fcb96f5d65fa007977418cd | https://github.com/jelix/ldapdao-module/blob/8261aadf643e95c98fcb96f5d65fa007977418cd/ldapdao/plugins/auth/ldapdao/ldapdao.auth.php#L467-L475 |
16,652 | jelix/ldapdao-module | ldapdao/plugins/auth/ldapdao/ldapdao.auth.php | ldapdaoAuthDriver._bindLdapAdminUser | protected function _bindLdapAdminUser()
{
$connect = $this->_getLinkId();
if (!$connect) {
jLog::log('ldapdao: impossible to connect to ldap', 'auth');
return false;
}
if ($this->_params['adminUserDn'] == '') {
$bind = ldap_bind($connect);
... | php | protected function _bindLdapAdminUser()
{
$connect = $this->_getLinkId();
if (!$connect) {
jLog::log('ldapdao: impossible to connect to ldap', 'auth');
return false;
}
if ($this->_params['adminUserDn'] == '') {
$bind = ldap_bind($connect);
... | [
"protected",
"function",
"_bindLdapAdminUser",
"(",
")",
"{",
"$",
"connect",
"=",
"$",
"this",
"->",
"_getLinkId",
"(",
")",
";",
"if",
"(",
"!",
"$",
"connect",
")",
"{",
"jLog",
"::",
"log",
"(",
"'ldapdao: impossible to connect to ldap'",
",",
"'auth'",
... | open the connection to the ldap server
and bind to the admin user
@return resource|false the ldap connection | [
"open",
"the",
"connection",
"to",
"the",
"ldap",
"server",
"and",
"bind",
"to",
"the",
"admin",
"user"
] | 8261aadf643e95c98fcb96f5d65fa007977418cd | https://github.com/jelix/ldapdao-module/blob/8261aadf643e95c98fcb96f5d65fa007977418cd/ldapdao/plugins/auth/ldapdao/ldapdao.auth.php#L482-L505 |
16,653 | ftrrtf/FtrrtfRollbarBundle | Rollbar/Environment.php | Environment.getRequestData | public function getRequestData()
{
parent::getRequestData();
if ($this->getRequest() instanceof Request) {
if (in_array($this->getRequest()->getMethod(), array('PUT', 'DELETE'))) {
$this->requestData[$this->getRequest()->getMethod()] = $this->getRequest()->request->all()... | php | public function getRequestData()
{
parent::getRequestData();
if ($this->getRequest() instanceof Request) {
if (in_array($this->getRequest()->getMethod(), array('PUT', 'DELETE'))) {
$this->requestData[$this->getRequest()->getMethod()] = $this->getRequest()->request->all()... | [
"public",
"function",
"getRequestData",
"(",
")",
"{",
"parent",
"::",
"getRequestData",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getRequest",
"(",
")",
"instanceof",
"Request",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"this",
"->",
"getRequest",
... | Cached values for request.
@return array|null | [
"Cached",
"values",
"for",
"request",
"."
] | 64c75862b80a4a1ed9e98c0d217003e84df40dd7 | https://github.com/ftrrtf/FtrrtfRollbarBundle/blob/64c75862b80a4a1ed9e98c0d217003e84df40dd7/Rollbar/Environment.php#L25-L36 |
16,654 | puli/discovery | src/Api/Type/BindingType.php | BindingType.hasParameterValues | public function hasParameterValues()
{
foreach ($this->parameters as $name => $parameter) {
if (!$parameter->isRequired()) {
return true;
}
}
return false;
} | php | public function hasParameterValues()
{
foreach ($this->parameters as $name => $parameter) {
if (!$parameter->isRequired()) {
return true;
}
}
return false;
} | [
"public",
"function",
"hasParameterValues",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"parameters",
"as",
"$",
"name",
"=>",
"$",
"parameter",
")",
"{",
"if",
"(",
"!",
"$",
"parameter",
"->",
"isRequired",
"(",
")",
")",
"{",
"return",
"true",... | Returns whether the type has parameters with default values.
@return bool Returns `true` if at least one parameter has a default value
and `false` otherwise. | [
"Returns",
"whether",
"the",
"type",
"has",
"parameters",
"with",
"default",
"values",
"."
] | 975f5e099563f1096bfabc17fbe4d1816408ad98 | https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/Api/Type/BindingType.php#L199-L208 |
16,655 | puli/discovery | src/Api/Type/BindingType.php | BindingType.acceptsBinding | public function acceptsBinding($binding)
{
return $binding instanceof $this->acceptedBindingClass
|| $binding === $this->acceptedBindingClass
|| is_subclass_of($binding, $this->acceptedBindingClass);
} | php | public function acceptsBinding($binding)
{
return $binding instanceof $this->acceptedBindingClass
|| $binding === $this->acceptedBindingClass
|| is_subclass_of($binding, $this->acceptedBindingClass);
} | [
"public",
"function",
"acceptsBinding",
"(",
"$",
"binding",
")",
"{",
"return",
"$",
"binding",
"instanceof",
"$",
"this",
"->",
"acceptedBindingClass",
"||",
"$",
"binding",
"===",
"$",
"this",
"->",
"acceptedBindingClass",
"||",
"is_subclass_of",
"(",
"$",
... | Returns whether the type accepts a binding class.
@param Binding|string $binding The binding or the fully-qualified name of
the binding class.
@return bool Returns `true` if the binding can be bound to this type and
`false` otherwise. | [
"Returns",
"whether",
"the",
"type",
"accepts",
"a",
"binding",
"class",
"."
] | 975f5e099563f1096bfabc17fbe4d1816408ad98 | https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/Api/Type/BindingType.php#L248-L253 |
16,656 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php | OrderManager.updateApiEntity | public function updateApiEntity(Order $apiOrder, $locale)
{
$items = $apiOrder->getItems();
// perform price calucaltion
$prices = $supplierItems = null;
$totalPrice = $this->priceCalculator->calculate($items, $prices, $supplierItems);
if ($supplierItems) {
$sup... | php | public function updateApiEntity(Order $apiOrder, $locale)
{
$items = $apiOrder->getItems();
// perform price calucaltion
$prices = $supplierItems = null;
$totalPrice = $this->priceCalculator->calculate($items, $prices, $supplierItems);
if ($supplierItems) {
$sup... | [
"public",
"function",
"updateApiEntity",
"(",
"Order",
"$",
"apiOrder",
",",
"$",
"locale",
")",
"{",
"$",
"items",
"=",
"$",
"apiOrder",
"->",
"getItems",
"(",
")",
";",
"// perform price calucaltion",
"$",
"prices",
"=",
"$",
"supplierItems",
"=",
"null",
... | Function updates the api-entity, like price-calculations
@param Order $apiOrder | [
"Function",
"updates",
"the",
"api",
"-",
"entity",
"like",
"price",
"-",
"calculations"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L362-L392 |
16,657 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php | OrderManager.getContactData | public function getContactData($addressData, $contact)
{
$result = array();
// if account is set, take account's name
if ($addressData && isset($addressData['firstName']) && isset($addressData['lastName'])) {
$result['firstName'] = $addressData['firstName'];
$result['... | php | public function getContactData($addressData, $contact)
{
$result = array();
// if account is set, take account's name
if ($addressData && isset($addressData['firstName']) && isset($addressData['lastName'])) {
$result['firstName'] = $addressData['firstName'];
$result['... | [
"public",
"function",
"getContactData",
"(",
"$",
"addressData",
",",
"$",
"contact",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"// if account is set, take account's name",
"if",
"(",
"$",
"addressData",
"&&",
"isset",
"(",
"$",
"addressData",
"[",... | Returns contact data as an array. Either by provided address or contact
@param array $addressData
@param Contact $contact
@throws MissingOrderAttributeException
@return array | [
"Returns",
"contact",
"data",
"as",
"an",
"array",
".",
"Either",
"by",
"provided",
"address",
"or",
"contact"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L404-L433 |
16,658 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php | OrderManager.convertStatus | public function convertStatus($order, $statusId, $flush = false, $persist = true)
{
if ($order instanceof Order) {
$order = $order->getEntity();
}
// get current status
$currentStatus = $order->getStatus();
if ($currentStatus) {
if ($currentStatus ins... | php | public function convertStatus($order, $statusId, $flush = false, $persist = true)
{
if ($order instanceof Order) {
$order = $order->getEntity();
}
// get current status
$currentStatus = $order->getStatus();
if ($currentStatus) {
if ($currentStatus ins... | [
"public",
"function",
"convertStatus",
"(",
"$",
"order",
",",
"$",
"statusId",
",",
"$",
"flush",
"=",
"false",
",",
"$",
"persist",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"order",
"instanceof",
"Order",
")",
"{",
"$",
"order",
"=",
"$",
"order",
... | Converts the status of an order
@param ApiOrderInterface|OrderInterface $order
@param int $statusId
@param bool $flush
@param bool $persist
@throws \Sulu\Component\Rest\Exception\EntityNotFoundException | [
"Converts",
"the",
"status",
"of",
"an",
"order"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L485-L544 |
16,659 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php | OrderManager.findOrderEntityById | public function findOrderEntityById($id)
{
try {
return $this->em
->getRepository(static::$orderEntityName)
->find($id);
} catch (NoResultException $nre) {
throw new EntityNotFoundException(static::$orderEntityName, $id);
}
} | php | public function findOrderEntityById($id)
{
try {
return $this->em
->getRepository(static::$orderEntityName)
->find($id);
} catch (NoResultException $nre) {
throw new EntityNotFoundException(static::$orderEntityName, $id);
}
} | [
"public",
"function",
"findOrderEntityById",
"(",
"$",
"id",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"em",
"->",
"getRepository",
"(",
"static",
"::",
"$",
"orderEntityName",
")",
"->",
"find",
"(",
"$",
"id",
")",
";",
"}",
"catch",
"(",
... | Find order entity by id
@param $id
@throws \Sulu\Component\Rest\Exception\EntityNotFoundException
@return OrderInterface | [
"Find",
"order",
"entity",
"by",
"id"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L575-L584 |
16,660 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php | OrderManager.findOrderEntityForItemWithId | public function findOrderEntityForItemWithId($id, $returnMultipleResults = false)
{
try {
return $this->em
->getRepository(static::$orderEntityName)
->findOrderForItemWithId($id, $returnMultipleResults);
} catch (NoResultException $nre) {
throw... | php | public function findOrderEntityForItemWithId($id, $returnMultipleResults = false)
{
try {
return $this->em
->getRepository(static::$orderEntityName)
->findOrderForItemWithId($id, $returnMultipleResults);
} catch (NoResultException $nre) {
throw... | [
"public",
"function",
"findOrderEntityForItemWithId",
"(",
"$",
"id",
",",
"$",
"returnMultipleResults",
"=",
"false",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"em",
"->",
"getRepository",
"(",
"static",
"::",
"$",
"orderEntityName",
")",
"->",
"fi... | Find order for item with id
@param int $id
@throws \Sulu\Component\Rest\Exception\EntityNotFoundException
@return OrderInterface | [
"Find",
"order",
"for",
"item",
"with",
"id"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L595-L604 |
16,661 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php | OrderManager.createMediaForSupplierItems | protected function createMediaForSupplierItems($items, $locale)
{
foreach ($items as $item) {
if (isset($item['items']) && count($item['items'] > 0)) {
$this->createMediaForItems($item['items'], $locale);
}
}
} | php | protected function createMediaForSupplierItems($items, $locale)
{
foreach ($items as $item) {
if (isset($item['items']) && count($item['items'] > 0)) {
$this->createMediaForItems($item['items'], $locale);
}
}
} | [
"protected",
"function",
"createMediaForSupplierItems",
"(",
"$",
"items",
",",
"$",
"locale",
")",
"{",
"foreach",
"(",
"$",
"items",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"item",
"[",
"'items'",
"]",
")",
"&&",
"count",
"(",
"$... | Creates correct media-api for supplier-items array
@param array $items
@param string $locale | [
"Creates",
"correct",
"media",
"-",
"api",
"for",
"supplier",
"-",
"items",
"array"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L790-L797 |
16,662 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php | OrderManager.createMediaForItems | protected function createMediaForItems($items, $locale)
{
foreach ($items as $item) {
$product = $item->getProduct();
if ($product) {
$this->productManager->createProductMedia($product, $locale);
}
// Set api product for returning media-urls
... | php | protected function createMediaForItems($items, $locale)
{
foreach ($items as $item) {
$product = $item->getProduct();
if ($product) {
$this->productManager->createProductMedia($product, $locale);
}
// Set api product for returning media-urls
... | [
"protected",
"function",
"createMediaForItems",
"(",
"$",
"items",
",",
"$",
"locale",
")",
"{",
"foreach",
"(",
"$",
"items",
"as",
"$",
"item",
")",
"{",
"$",
"product",
"=",
"$",
"item",
"->",
"getProduct",
"(",
")",
";",
"if",
"(",
"$",
"product"... | Creates correct media-api for items array
@param array $items
@param string $locale | [
"Creates",
"correct",
"media",
"-",
"api",
"for",
"items",
"array"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L805-L815 |
16,663 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php | OrderManager.setOrderType | private function setOrderType($data, ApiOrderInterface $order, $patch = false)
{
// get OrderType
$type = $this->getProperty($data, 'type', $order->getType());
// set order type
if (isset($data['type'])) {
if (is_array($type) && isset($type['id'])) {
// if... | php | private function setOrderType($data, ApiOrderInterface $order, $patch = false)
{
// get OrderType
$type = $this->getProperty($data, 'type', $order->getType());
// set order type
if (isset($data['type'])) {
if (is_array($type) && isset($type['id'])) {
// if... | [
"private",
"function",
"setOrderType",
"(",
"$",
"data",
",",
"ApiOrderInterface",
"$",
"order",
",",
"$",
"patch",
"=",
"false",
")",
"{",
"// get OrderType",
"$",
"type",
"=",
"$",
"this",
"->",
"getProperty",
"(",
"$",
"data",
",",
"'type'",
",",
"$",... | Sets OrderType on an order
@param array $data
@param ApiOrderInterface $order
@throws EntityNotFoundException
@throws OrderException | [
"Sets",
"OrderType",
"on",
"an",
"order"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L888-L919 |
16,664 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php | OrderManager.addContactRelation | private function addContactRelation(array $data, $key, $addCallback)
{
$contact = null;
if (array_key_exists($key, $data) &&
is_array($data[$key]) &&
array_key_exists('id', $data[$key])
) {
/** @var Contact $contact */
$contactId = $data[$key][... | php | private function addContactRelation(array $data, $key, $addCallback)
{
$contact = null;
if (array_key_exists($key, $data) &&
is_array($data[$key]) &&
array_key_exists('id', $data[$key])
) {
/** @var Contact $contact */
$contactId = $data[$key][... | [
"private",
"function",
"addContactRelation",
"(",
"array",
"$",
"data",
",",
"$",
"key",
",",
"$",
"addCallback",
")",
"{",
"$",
"contact",
"=",
"null",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"data",
")",
"&&",
"is_array",
"(",
... | Searches for contact in specified data and calls callback function
@param array $data
@param string $key
@param callable $addCallback
@throws Exception\MissingOrderAttributeException
@throws Exception\OrderDependencyNotFoundException
@return Contact|null | [
"Searches",
"for",
"contact",
"in",
"specified",
"data",
"and",
"calls",
"callback",
"function"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L1145-L1162 |
16,665 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php | OrderManager.setCustomerAccount | private function setCustomerAccount($data, Order $order, $patch = false)
{
$accountData = $this->getProperty($data, 'customerAccount');
if ($accountData) {
if (!array_key_exists('id', $accountData)) {
throw new MissingOrderAttributeException('account.id');
}
... | php | private function setCustomerAccount($data, Order $order, $patch = false)
{
$accountData = $this->getProperty($data, 'customerAccount');
if ($accountData) {
if (!array_key_exists('id', $accountData)) {
throw new MissingOrderAttributeException('account.id');
}
... | [
"private",
"function",
"setCustomerAccount",
"(",
"$",
"data",
",",
"Order",
"$",
"order",
",",
"$",
"patch",
"=",
"false",
")",
"{",
"$",
"accountData",
"=",
"$",
"this",
"->",
"getProperty",
"(",
"$",
"data",
",",
"'customerAccount'",
")",
";",
"if",
... | Sets the customer account of an order
@param array $data
@param Order $order
@param bool $patch
@return null|object
@throws MissingOrderAttributeException
@throws OrderDependencyNotFoundException | [
"Sets",
"the",
"customer",
"account",
"of",
"an",
"order"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L1259-L1278 |
16,666 | sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php | OrderManager.processItems | private function processItems($data, Order $order, $locale, $userId = null)
{
$result = true;
try {
if ($this->checkIfSet('items', $data)) {
// items has to be an array
if (!is_array($data['items'])) {
throw new MissingOrderAttributeExc... | php | private function processItems($data, Order $order, $locale, $userId = null)
{
$result = true;
try {
if ($this->checkIfSet('items', $data)) {
// items has to be an array
if (!is_array($data['items'])) {
throw new MissingOrderAttributeExc... | [
"private",
"function",
"processItems",
"(",
"$",
"data",
",",
"Order",
"$",
"order",
",",
"$",
"locale",
",",
"$",
"userId",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"true",
";",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"checkIfSet",
"(",
"'item... | Processes items defined in an order and creates item entities
@param array $data
@param Order $order
@param string $locale
@param int $userId
@throws Exception\OrderException
@return bool | [
"Processes",
"items",
"defined",
"in",
"an",
"order",
"and",
"creates",
"item",
"entities"
] | 0d39de262d58579e5679db99a77dbf717d600b5e | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderManager.php#L1292-L1337 |
16,667 | phpthinktank/blast-facades | src/FacadeFactory.php | FacadeFactory.create | public static function create($accessor, $name, array $arguments = [])
{
$container = static::getContainer();
$object = $container->get($accessor);
return call_user_func_array([$object, $name], $arguments);
} | php | public static function create($accessor, $name, array $arguments = [])
{
$container = static::getContainer();
$object = $container->get($accessor);
return call_user_func_array([$object, $name], $arguments);
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"accessor",
",",
"$",
"name",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"$",
"container",
"=",
"static",
"::",
"getContainer",
"(",
")",
";",
"$",
"object",
"=",
"$",
"container",
"->... | Get provided accessor from container and call method
@param $accessor
@param $name
@param $arguments
@return mixed | [
"Get",
"provided",
"accessor",
"from",
"container",
"and",
"call",
"method"
] | 859fd8352f63febf3e1189ea3142afa5d6d8b9af | https://github.com/phpthinktank/blast-facades/blob/859fd8352f63febf3e1189ea3142afa5d6d8b9af/src/FacadeFactory.php#L48-L54 |
16,668 | alanpich/slender | src/Core/Autoloader/ClassLoader.php | ClassLoader.registerNamespace | public function registerNamespace($namespace, $paths, $type = 'psr-0')
{
switch ($type) {
case 'psr-0':
parent::registerNamespace($namespace, $paths);
break;
case 'psr-4':
$this->psr4Loader->addNamespace($namespace,$paths);
... | php | public function registerNamespace($namespace, $paths, $type = 'psr-0')
{
switch ($type) {
case 'psr-0':
parent::registerNamespace($namespace, $paths);
break;
case 'psr-4':
$this->psr4Loader->addNamespace($namespace,$paths);
... | [
"public",
"function",
"registerNamespace",
"(",
"$",
"namespace",
",",
"$",
"paths",
",",
"$",
"type",
"=",
"'psr-0'",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"'psr-0'",
":",
"parent",
"::",
"registerNamespace",
"(",
"$",
"namespace",
","... | Overridden to allow injecting psr-4 into the mix.
Also opens up doors for alternative formats to be used
later. Either way, it's a mess here right now
@param string $namespace
@param array|string $paths
@param string $type Eith... | [
"Overridden",
"to",
"allow",
"injecting",
"psr",
"-",
"4",
"into",
"the",
"mix",
".",
"Also",
"opens",
"up",
"doors",
"for",
"alternative",
"formats",
"to",
"be",
"used",
"later",
".",
"Either",
"way",
"it",
"s",
"a",
"mess",
"here",
"right",
"now"
] | 247f5c08af20cda95b116eb5d9f6f623d61e8a8a | https://github.com/alanpich/slender/blob/247f5c08af20cda95b116eb5d9f6f623d61e8a8a/src/Core/Autoloader/ClassLoader.php#L56-L68 |
16,669 | tigris-php/telegram-bot-api | src/Types/Message.php | Message.detectType | protected static function detectType(array $data)
{
foreach ([
self::TYPE_TEXT,
self::TYPE_AUDIO,
self::TYPE_DOCUMENT,
self::TYPE_GAME,
self::TYPE_PHOTO,
self::TYPE_STICKER,
... | php | protected static function detectType(array $data)
{
foreach ([
self::TYPE_TEXT,
self::TYPE_AUDIO,
self::TYPE_DOCUMENT,
self::TYPE_GAME,
self::TYPE_PHOTO,
self::TYPE_STICKER,
... | [
"protected",
"static",
"function",
"detectType",
"(",
"array",
"$",
"data",
")",
"{",
"foreach",
"(",
"[",
"self",
"::",
"TYPE_TEXT",
",",
"self",
"::",
"TYPE_AUDIO",
",",
"self",
"::",
"TYPE_DOCUMENT",
",",
"self",
"::",
"TYPE_GAME",
",",
"self",
"::",
... | Detects message type
@param $data
@return string | [
"Detects",
"message",
"type"
] | 7350c81d571387005d58079d8c654ee44504cdcf | https://github.com/tigris-php/telegram-bot-api/blob/7350c81d571387005d58079d8c654ee44504cdcf/src/Types/Message.php#L114-L146 |
16,670 | tbreuss/pvc | src/Middleware/MiddlewarePipe.php | MiddlewarePipe.add | public function add(MiddlewareInterface $middleware): self
{
$pipe = clone $this;
array_push($pipe->middlewares, $middleware);
return $pipe;
} | php | public function add(MiddlewareInterface $middleware): self
{
$pipe = clone $this;
array_push($pipe->middlewares, $middleware);
return $pipe;
} | [
"public",
"function",
"add",
"(",
"MiddlewareInterface",
"$",
"middleware",
")",
":",
"self",
"{",
"$",
"pipe",
"=",
"clone",
"$",
"this",
";",
"array_push",
"(",
"$",
"pipe",
"->",
"middlewares",
",",
"$",
"middleware",
")",
";",
"return",
"$",
"pipe",
... | Creates a new pipe with the given middleware connected.
@param MiddlewareInterface $middleware
@return self | [
"Creates",
"a",
"new",
"pipe",
"with",
"the",
"given",
"middleware",
"connected",
"."
] | ae100351010a8c9f645ccb918f70a26e167de7a7 | https://github.com/tbreuss/pvc/blob/ae100351010a8c9f645ccb918f70a26e167de7a7/src/Middleware/MiddlewarePipe.php#L56-L61 |
16,671 | yuncms/framework | src/helpers/NumberHelper.php | NumberHelper.word | public static function word(int $num): string
{
$numberWordMap = [
1 => Yii::t('yuncms', 'One'),
2 => Yii::t('yuncms', 'Two'),
3 => Yii::t('yuncms', 'Three'),
4 => Yii::t('yuncms', 'Four'),
5 => Yii::t('yuncms', 'Five'),
6 => Yii::t('yu... | php | public static function word(int $num): string
{
$numberWordMap = [
1 => Yii::t('yuncms', 'One'),
2 => Yii::t('yuncms', 'Two'),
3 => Yii::t('yuncms', 'Three'),
4 => Yii::t('yuncms', 'Four'),
5 => Yii::t('yuncms', 'Five'),
6 => Yii::t('yu... | [
"public",
"static",
"function",
"word",
"(",
"int",
"$",
"num",
")",
":",
"string",
"{",
"$",
"numberWordMap",
"=",
"[",
"1",
"=>",
"Yii",
"::",
"t",
"(",
"'yuncms'",
",",
"'One'",
")",
",",
"2",
"=>",
"Yii",
"::",
"t",
"(",
"'yuncms'",
",",
"'Tw... | Returns the "word" version of a number
@param int $num The number
@return string The number word, or the original number if it's >= 10 | [
"Returns",
"the",
"word",
"version",
"of",
"a",
"number"
] | af42e28ea4ae15ab8eead3f6d119f93863b94154 | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/helpers/NumberHelper.php#L22-L41 |
16,672 | nodes-php/database | src/Eloquent/Repository.php | Repository.get | public function get($columns = ['*'])
{
$result = $this->getBuilder()->get($columns);
// Reset query builder
$this->resetBuilder();
return $result;
} | php | public function get($columns = ['*'])
{
$result = $this->getBuilder()->get($columns);
// Reset query builder
$this->resetBuilder();
return $result;
} | [
"public",
"function",
"get",
"(",
"$",
"columns",
"=",
"[",
"'*'",
"]",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getBuilder",
"(",
")",
"->",
"get",
"(",
"$",
"columns",
")",
";",
"// Reset query builder",
"$",
"this",
"->",
"resetBuilder",
... | Execute the query and retrieve result.
@author Morten Rugaard <[email protected]>
@param array $columns
@return \Illuminate\Database\Eloquent\Collection | [
"Execute",
"the",
"query",
"and",
"retrieve",
"result",
"."
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L220-L228 |
16,673 | nodes-php/database | src/Eloquent/Repository.php | Repository.count | public function count($columns = '*')
{
$result = $this->getBuilder()->count($columns);
// Reset query builder
$this->resetBuilder();
return (int) $result;
} | php | public function count($columns = '*')
{
$result = $this->getBuilder()->count($columns);
// Reset query builder
$this->resetBuilder();
return (int) $result;
} | [
"public",
"function",
"count",
"(",
"$",
"columns",
"=",
"'*'",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getBuilder",
"(",
")",
"->",
"count",
"(",
"$",
"columns",
")",
";",
"// Reset query builder",
"$",
"this",
"->",
"resetBuilder",
"(",
")"... | Execute query as a count statement.
@author Morten Rugaard <[email protected]>
@param string $columns
@return int | [
"Execute",
"query",
"as",
"a",
"count",
"statement",
"."
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L425-L433 |
16,674 | nodes-php/database | src/Eloquent/Repository.php | Repository.max | public function max($column)
{
$result = $this->getBuilder()->max($column);
// Reset query builder
$this->resetBuilder();
return $result;
} | php | public function max($column)
{
$result = $this->getBuilder()->max($column);
// Reset query builder
$this->resetBuilder();
return $result;
} | [
"public",
"function",
"max",
"(",
"$",
"column",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getBuilder",
"(",
")",
"->",
"max",
"(",
"$",
"column",
")",
";",
"// Reset query builder",
"$",
"this",
"->",
"resetBuilder",
"(",
")",
";",
"return",
... | Retrieve the maximum value of a given column.
@author Morten Rugaard <[email protected]>
@param string $column
@return float|int | [
"Retrieve",
"the",
"maximum",
"value",
"of",
"a",
"given",
"column",
"."
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L461-L469 |
16,675 | nodes-php/database | src/Eloquent/Repository.php | Repository.update | public function update(array $values)
{
$result = $this->getBuilder()->update($values);
// Reset query builder
$this->resetBuilder();
return (int) $result;
} | php | public function update(array $values)
{
$result = $this->getBuilder()->update($values);
// Reset query builder
$this->resetBuilder();
return (int) $result;
} | [
"public",
"function",
"update",
"(",
"array",
"$",
"values",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getBuilder",
"(",
")",
"->",
"update",
"(",
"$",
"values",
")",
";",
"// Reset query builder",
"$",
"this",
"->",
"resetBuilder",
"(",
")",
"... | Execute query as an update statement.
@author Morten Rugaard <[email protected]>
@param array $values
@return int | [
"Execute",
"query",
"as",
"an",
"update",
"statement",
"."
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L584-L592 |
16,676 | nodes-php/database | src/Eloquent/Repository.php | Repository.raw | public function raw($value)
{
$result = $this->getBuilder()->raw($value);
// Reset query builder
$this->resetBuilder();
return $result;
} | php | public function raw($value)
{
$result = $this->getBuilder()->raw($value);
// Reset query builder
$this->resetBuilder();
return $result;
} | [
"public",
"function",
"raw",
"(",
"$",
"value",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getBuilder",
"(",
")",
"->",
"raw",
"(",
"$",
"value",
")",
";",
"// Reset query builder",
"$",
"this",
"->",
"resetBuilder",
"(",
")",
";",
"return",
"... | Create a raw database expression.
@author Morten Rugaard <[email protected]>
@param mixed $value
@return \Illuminate\Database\Query\Expression | [
"Create",
"a",
"raw",
"database",
"expression",
"."
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L691-L699 |
16,677 | nodes-php/database | src/Eloquent/Repository.php | Repository.renderSql | public function renderSql()
{
$result = vsprintf(
$this->getBuilder()->getQuery()->toSql(),
$this->getBuilder()->getQuery()->getBindings()
);
// Reset query builder
$this->resetBuilder();
return $result;
} | php | public function renderSql()
{
$result = vsprintf(
$this->getBuilder()->getQuery()->toSql(),
$this->getBuilder()->getQuery()->getBindings()
);
// Reset query builder
$this->resetBuilder();
return $result;
} | [
"public",
"function",
"renderSql",
"(",
")",
"{",
"$",
"result",
"=",
"vsprintf",
"(",
"$",
"this",
"->",
"getBuilder",
"(",
")",
"->",
"getQuery",
"(",
")",
"->",
"toSql",
"(",
")",
",",
"$",
"this",
"->",
"getBuilder",
"(",
")",
"->",
"getQuery",
... | Render repository's query SQL string.
@author Morten Rugaard <[email protected]>
@return string | [
"Render",
"repository",
"s",
"query",
"SQL",
"string",
"."
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L725-L736 |
16,678 | nodes-php/database | src/Eloquent/Repository.php | Repository.withTrashed | public function withTrashed()
{
// Validate model is soft deletable
if (! in_array(IlluminateEloquentSoftDeletes::class, class_uses($this->getModel()))) {
throw new ModelNotSoftDeletable('Model [%s] is not using the Soft Delete trait');
}
// Set repository builder to inc... | php | public function withTrashed()
{
// Validate model is soft deletable
if (! in_array(IlluminateEloquentSoftDeletes::class, class_uses($this->getModel()))) {
throw new ModelNotSoftDeletable('Model [%s] is not using the Soft Delete trait');
}
// Set repository builder to inc... | [
"public",
"function",
"withTrashed",
"(",
")",
"{",
"// Validate model is soft deletable",
"if",
"(",
"!",
"in_array",
"(",
"IlluminateEloquentSoftDeletes",
"::",
"class",
",",
"class_uses",
"(",
"$",
"this",
"->",
"getModel",
"(",
")",
")",
")",
")",
"{",
"th... | Include soft deleted entries in query.
Note this will reset the build
@author Morten Rugaard <[email protected]>
@throws \Nodes\Database\Exceptions\ModelNotSoftDeletable | [
"Include",
"soft",
"deleted",
"entries",
"in",
"query",
".",
"Note",
"this",
"will",
"reset",
"the",
"build"
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L746-L757 |
16,679 | nodes-php/database | src/Eloquent/Repository.php | Repository.onlyTrashed | public function onlyTrashed()
{
// Validate model is soft deletable
if (! in_array(IlluminateEloquentSoftDeletes::class, class_uses($this->getModel()))) {
throw new ModelNotSoftDeletable('Model [%s] is not using the Soft Delete trait');
}
// Set repository builder to inc... | php | public function onlyTrashed()
{
// Validate model is soft deletable
if (! in_array(IlluminateEloquentSoftDeletes::class, class_uses($this->getModel()))) {
throw new ModelNotSoftDeletable('Model [%s] is not using the Soft Delete trait');
}
// Set repository builder to inc... | [
"public",
"function",
"onlyTrashed",
"(",
")",
"{",
"// Validate model is soft deletable",
"if",
"(",
"!",
"in_array",
"(",
"IlluminateEloquentSoftDeletes",
"::",
"class",
",",
"class_uses",
"(",
"$",
"this",
"->",
"getModel",
"(",
")",
")",
")",
")",
"{",
"th... | Only include soft deleted entries in query.
Note this will reset the build
@author Morten Rugaard <[email protected]>
@return $this
@throws \Nodes\Database\Exceptions\ModelNotSoftDeletable | [
"Only",
"include",
"soft",
"deleted",
"entries",
"in",
"query",
".",
"Note",
"this",
"will",
"reset",
"the",
"build"
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L768-L779 |
16,680 | nodes-php/database | src/Eloquent/Repository.php | Repository.getByContinuously | public function getByContinuously($column, $value, array $columns = ['*'], $retries = 10, $delayMs = 100, $maxDelay = 2000, $maxRetries = 100)
{
// Hard limits
$maxDelay = ($maxDelay > 2000) ? 2000 : $maxDelay;
$maxRetries = ($maxRetries > 100) ? 100 : $maxRetries;
// Validate delay... | php | public function getByContinuously($column, $value, array $columns = ['*'], $retries = 10, $delayMs = 100, $maxDelay = 2000, $maxRetries = 100)
{
// Hard limits
$maxDelay = ($maxDelay > 2000) ? 2000 : $maxDelay;
$maxRetries = ($maxRetries > 100) ? 100 : $maxRetries;
// Validate delay... | [
"public",
"function",
"getByContinuously",
"(",
"$",
"column",
",",
"$",
"value",
",",
"array",
"$",
"columns",
"=",
"[",
"'*'",
"]",
",",
"$",
"retries",
"=",
"10",
",",
"$",
"delayMs",
"=",
"100",
",",
"$",
"maxDelay",
"=",
"2000",
",",
"$",
"max... | Retrieve entity by a specific column and value. Will retry with a delay until found.
Should only be used in queues, where databases are in a cluster
and there's a chance it's not always in sync
@author Casper Rasmussen <[email protected]>
@param string $column
@param string $value
@param array $columns
@param int ... | [
"Retrieve",
"entity",
"by",
"a",
"specific",
"column",
"and",
"value",
".",
"Will",
"retry",
"with",
"a",
"delay",
"until",
"found",
"."
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L975-L1003 |
16,681 | nodes-php/database | src/Eloquent/Repository.php | Repository.getByIdContinuously | public function getByIdContinuously($id, array $columns = ['*'], $retries = 10, $delayMs = 100)
{
return $this->getByContinuously('id', $id, $columns, $retries, $delayMs);
} | php | public function getByIdContinuously($id, array $columns = ['*'], $retries = 10, $delayMs = 100)
{
return $this->getByContinuously('id', $id, $columns, $retries, $delayMs);
} | [
"public",
"function",
"getByIdContinuously",
"(",
"$",
"id",
",",
"array",
"$",
"columns",
"=",
"[",
"'*'",
"]",
",",
"$",
"retries",
"=",
"10",
",",
"$",
"delayMs",
"=",
"100",
")",
"{",
"return",
"$",
"this",
"->",
"getByContinuously",
"(",
"'id'",
... | Retrieve entity by ID. Will retry with a delay until found.
Should only be used in queues, where databases are in a cluster
and there's a chance it's not always in sync
@author Casper Rasmussen <[email protected]>
@param int $id
@param array $columns
@param int $retries
@param int $delayMs
@return \Illuminate\Databa... | [
"Retrieve",
"entity",
"by",
"ID",
".",
"Will",
"retry",
"with",
"a",
"delay",
"until",
"found",
"."
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L1020-L1023 |
16,682 | nodes-php/database | src/Eloquent/Repository.php | Repository.getByIdContinuouslyOrFail | public function getByIdContinuouslyOrFail($id, array $columns = ['*'], $retries = 10, $delayMs = 100)
{
$result = $this->getByContinuously('id', $id, $columns, $retries, $delayMs);
if (empty($result)) {
throw new EntityNotFoundException(sprintf('%s not found continuously by Id with value... | php | public function getByIdContinuouslyOrFail($id, array $columns = ['*'], $retries = 10, $delayMs = 100)
{
$result = $this->getByContinuously('id', $id, $columns, $retries, $delayMs);
if (empty($result)) {
throw new EntityNotFoundException(sprintf('%s not found continuously by Id with value... | [
"public",
"function",
"getByIdContinuouslyOrFail",
"(",
"$",
"id",
",",
"array",
"$",
"columns",
"=",
"[",
"'*'",
"]",
",",
"$",
"retries",
"=",
"10",
",",
"$",
"delayMs",
"=",
"100",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getByContinuously"... | Retrieve entity by ID. Will retry with a delay until found or throw an exception.
Should only be used in queues, where databases are in a cluster
and there's a chance it's not always in sync
@author Rasmus Ebbesen <[email protected]>
@param int $id
@param array $columns
@param int $retries
@param int $delayMs
@retur... | [
"Retrieve",
"entity",
"by",
"ID",
".",
"Will",
"retry",
"with",
"a",
"delay",
"until",
"found",
"or",
"throw",
"an",
"exception",
"."
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L1040-L1049 |
16,683 | nodes-php/database | src/Eloquent/Repository.php | Repository.deleteMorphsByEntity | public function deleteMorphsByEntity(IlluminateEloquentModel $entity, $relationName, $forceDelete = false)
{
// Retrieve all records by entity type and entity ID
$entities = $this->getBuilder()
->select(['id'])
->where(function ($query) use ($entity,... | php | public function deleteMorphsByEntity(IlluminateEloquentModel $entity, $relationName, $forceDelete = false)
{
// Retrieve all records by entity type and entity ID
$entities = $this->getBuilder()
->select(['id'])
->where(function ($query) use ($entity,... | [
"public",
"function",
"deleteMorphsByEntity",
"(",
"IlluminateEloquentModel",
"$",
"entity",
",",
"$",
"relationName",
",",
"$",
"forceDelete",
"=",
"false",
")",
"{",
"// Retrieve all records by entity type and entity ID",
"$",
"entities",
"=",
"$",
"this",
"->",
"ge... | Delete morphed relations by entity.
Note: This should only be used with morphed relations
@author Morten Rugaard <[email protected]>
@param \Illuminate\Database\Eloquent\Model $entity
@param string $relationName
@param bool $forceDelete
@return int | [
"Delete",
"morphed",
"relations",
"by",
"entity",
"."
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L1063-L1090 |
16,684 | nodes-php/database | src/Eloquent/Repository.php | Repository.restoreMorphsByEntity | public function restoreMorphsByEntity(IlluminateEloquentModel $entity, $relationName)
{
// Validate model is soft deletable
if (! in_array(IlluminateEloquentSoftDeletes::class, class_uses($this->getModel()))) {
throw new ModelNotSoftDeletable('Model [%s] is not using the Soft Delete trai... | php | public function restoreMorphsByEntity(IlluminateEloquentModel $entity, $relationName)
{
// Validate model is soft deletable
if (! in_array(IlluminateEloquentSoftDeletes::class, class_uses($this->getModel()))) {
throw new ModelNotSoftDeletable('Model [%s] is not using the Soft Delete trai... | [
"public",
"function",
"restoreMorphsByEntity",
"(",
"IlluminateEloquentModel",
"$",
"entity",
",",
"$",
"relationName",
")",
"{",
"// Validate model is soft deletable",
"if",
"(",
"!",
"in_array",
"(",
"IlluminateEloquentSoftDeletes",
"::",
"class",
",",
"class_uses",
"... | Restore morphed relations by entity.
Note: This should only be used with morphed relations
@author Morten Rugaard <[email protected]>
@param \Illuminate\Database\Eloquent\Model $entity
@param string $relationName
@return int
@throws \Nodes\Database\Exceptions\ModelNotSoftDeletable | [
"Restore",
"morphed",
"relations",
"by",
"entity",
"."
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L1104-L1136 |
16,685 | nodes-php/database | src/Eloquent/Repository.php | Repository.setModel | public function setModel(IlluminateEloquentModel $model)
{
// Set repository model
$this->model = $model;
// Set repository builder from model
$this->setBuilder($model->newQuery());
return $this;
} | php | public function setModel(IlluminateEloquentModel $model)
{
// Set repository model
$this->model = $model;
// Set repository builder from model
$this->setBuilder($model->newQuery());
return $this;
} | [
"public",
"function",
"setModel",
"(",
"IlluminateEloquentModel",
"$",
"model",
")",
"{",
"// Set repository model",
"$",
"this",
"->",
"model",
"=",
"$",
"model",
";",
"// Set repository builder from model",
"$",
"this",
"->",
"setBuilder",
"(",
"$",
"model",
"->... | Set repository model.
@author Morten Rugaard <[email protected]>
@param \Illuminate\Database\Eloquent\Model $model
@return $this | [
"Set",
"repository",
"model",
"."
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L1182-L1191 |
16,686 | nodes-php/database | src/Eloquent/Repository.php | Repository.setBuilder | public function setBuilder(IlluminateEloquentBuilder $builder = null)
{
// If no builder was provided,
// we'll use the one from this repositorys model
if (empty($builder)) {
$builder = $this->getModel()->newQuery();
}
// Set repository builder
$this->bui... | php | public function setBuilder(IlluminateEloquentBuilder $builder = null)
{
// If no builder was provided,
// we'll use the one from this repositorys model
if (empty($builder)) {
$builder = $this->getModel()->newQuery();
}
// Set repository builder
$this->bui... | [
"public",
"function",
"setBuilder",
"(",
"IlluminateEloquentBuilder",
"$",
"builder",
"=",
"null",
")",
"{",
"// If no builder was provided,",
"// we'll use the one from this repositorys model",
"if",
"(",
"empty",
"(",
"$",
"builder",
")",
")",
"{",
"$",
"builder",
"... | Set repository builder.
@author Morten Rugaard <[email protected]>
@acecss public
@param \Illuminate\Database\Eloquent\Builder $builder
@return $this | [
"Set",
"repository",
"builder",
"."
] | ec58a01a2b966f89efeac58ac9ac633919c04a52 | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Eloquent/Repository.php#L1214-L1226 |
16,687 | askupasoftware/amarkal | Assets/Script.php | Script.register | public function register()
{
wp_register_script(
$this->handle,
$this->url,
$this->dependencies,
$this->version,
$this->footer
);
// Localize the script as needed
if( !empty( $this->localize['data'] ) && !empty( $this->loca... | php | public function register()
{
wp_register_script(
$this->handle,
$this->url,
$this->dependencies,
$this->version,
$this->footer
);
// Localize the script as needed
if( !empty( $this->localize['data'] ) && !empty( $this->loca... | [
"public",
"function",
"register",
"(",
")",
"{",
"wp_register_script",
"(",
"$",
"this",
"->",
"handle",
",",
"$",
"this",
"->",
"url",
",",
"$",
"this",
"->",
"dependencies",
",",
"$",
"this",
"->",
"version",
",",
"$",
"this",
"->",
"footer",
")",
... | Enqueue the script and localize the data as needed | [
"Enqueue",
"the",
"script",
"and",
"localize",
"the",
"data",
"as",
"needed"
] | fe8283e2d6847ef697abec832da7ee741a85058c | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Assets/Script.php#L39-L58 |
16,688 | comodojo/cookies | src/Comodojo/Cookies/AbstractCookie.php | AbstractCookie.erase | public static function erase($name) {
try {
$class = get_called_class();
$cookie = new $class($name);
return $cookie->delete();
} catch (CookieException $ce) {
throw $ce;
}
} | php | public static function erase($name) {
try {
$class = get_called_class();
$cookie = new $class($name);
return $cookie->delete();
} catch (CookieException $ce) {
throw $ce;
}
} | [
"public",
"static",
"function",
"erase",
"(",
"$",
"name",
")",
"{",
"try",
"{",
"$",
"class",
"=",
"get_called_class",
"(",
")",
";",
"$",
"cookie",
"=",
"new",
"$",
"class",
"(",
"$",
"name",
")",
";",
"return",
"$",
"cookie",
"->",
"delete",
"("... | Static method to quickly delete a cookie
@param string $name
The cookie name
@return boolean
@throws CookieException | [
"Static",
"method",
"to",
"quickly",
"delete",
"a",
"cookie"
] | a81c7dff37d52c1a75462c0ad30db75d0c3b0081 | https://github.com/comodojo/cookies/blob/a81c7dff37d52c1a75462c0ad30db75d0c3b0081/src/Comodojo/Cookies/AbstractCookie.php#L275-L291 |
16,689 | ammarfaizi2/Brainly | src/Brainly.php | Brainly.isPerfectCache | private function isPerfectCache()
{
if ($this->cacheMap[$this->hash] + 0x93a80 > time()) {
$this->cacheData = json_decode(
file_get_contents(
$this->cacheFile
),
true
);
return is_array($this->cacheData);
}
return false;
} | php | private function isPerfectCache()
{
if ($this->cacheMap[$this->hash] + 0x93a80 > time()) {
$this->cacheData = json_decode(
file_get_contents(
$this->cacheFile
),
true
);
return is_array($this->cacheData);
}
return false;
} | [
"private",
"function",
"isPerfectCache",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cacheMap",
"[",
"$",
"this",
"->",
"hash",
"]",
"+",
"0x93a80",
">",
"time",
"(",
")",
")",
"{",
"$",
"this",
"->",
"cacheData",
"=",
"json_decode",
"(",
"file_get... | Check the current cache is perfect or not.
@return bool | [
"Check",
"the",
"current",
"cache",
"is",
"perfect",
"or",
"not",
"."
] | fe543a58563ed4ff4294a6c8c21ff719dd487b89 | https://github.com/ammarfaizi2/Brainly/blob/fe543a58563ed4ff4294a6c8c21ff719dd487b89/src/Brainly.php#L107-L119 |
16,690 | ammarfaizi2/Brainly | src/Brainly.php | Brainly._exec | private function _exec()
{
if ($this->isCached() && $this->isPerfectCache()) {
return $this->getCache();
} else {
return $this->fixer(
$this->search(
$this->query,
$this->limit
)
);
}
} | php | private function _exec()
{
if ($this->isCached() && $this->isPerfectCache()) {
return $this->getCache();
} else {
return $this->fixer(
$this->search(
$this->query,
$this->limit
)
);
}
} | [
"private",
"function",
"_exec",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isCached",
"(",
")",
"&&",
"$",
"this",
"->",
"isPerfectCache",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getCache",
"(",
")",
";",
"}",
"else",
"{",
"return",
... | Search data. | [
"Search",
"data",
"."
] | fe543a58563ed4ff4294a6c8c21ff719dd487b89 | https://github.com/ammarfaizi2/Brainly/blob/fe543a58563ed4ff4294a6c8c21ff719dd487b89/src/Brainly.php#L137-L149 |
16,691 | ammarfaizi2/Brainly | src/Brainly.php | Brainly.fixer | private function fixer($data, $noWrite = false)
{
if (
$noWrite or $this->writeCache($data)
) {
$data = $noWrite ? $data : json_decode($data, true);
if ($data['success'] === true) {
if (isset($data['data']['tasks']['items'])) {
$r = [];
foreach ($data['data']['tasks']['items'] as $k => $v) {... | php | private function fixer($data, $noWrite = false)
{
if (
$noWrite or $this->writeCache($data)
) {
$data = $noWrite ? $data : json_decode($data, true);
if ($data['success'] === true) {
if (isset($data['data']['tasks']['items'])) {
$r = [];
foreach ($data['data']['tasks']['items'] as $k => $v) {... | [
"private",
"function",
"fixer",
"(",
"$",
"data",
",",
"$",
"noWrite",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"noWrite",
"or",
"$",
"this",
"->",
"writeCache",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=",
"$",
"noWrite",
"?",
"$",
"data",
... | Fix raw data.
@param string $data
@return array | [
"Fix",
"raw",
"data",
"."
] | fe543a58563ed4ff4294a6c8c21ff719dd487b89 | https://github.com/ammarfaizi2/Brainly/blob/fe543a58563ed4ff4294a6c8c21ff719dd487b89/src/Brainly.php#L189-L215 |
16,692 | ammarfaizi2/Brainly | src/Brainly.php | Brainly.writeCache | private function writeCache($data)
{
$this->cacheMap[$this->hash] = time();
$handle = fopen($this->cacheMapFile, "w");
flock($handle, LOCK_EX);
$write1 = fwrite($handle,
json_encode(
$this->cacheMap,
JSON_UNESCAPED_SLASHES
)
);
fclose($handle);
$handle = fopen($this->cacheFile, "w");
fl... | php | private function writeCache($data)
{
$this->cacheMap[$this->hash] = time();
$handle = fopen($this->cacheMapFile, "w");
flock($handle, LOCK_EX);
$write1 = fwrite($handle,
json_encode(
$this->cacheMap,
JSON_UNESCAPED_SLASHES
)
);
fclose($handle);
$handle = fopen($this->cacheFile, "w");
fl... | [
"private",
"function",
"writeCache",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"cacheMap",
"[",
"$",
"this",
"->",
"hash",
"]",
"=",
"time",
"(",
")",
";",
"$",
"handle",
"=",
"fopen",
"(",
"$",
"this",
"->",
"cacheMapFile",
",",
"\"w\"",
")",... | Write cache.
@param string $data
@return bool | [
"Write",
"cache",
"."
] | fe543a58563ed4ff4294a6c8c21ff719dd487b89 | https://github.com/ammarfaizi2/Brainly/blob/fe543a58563ed4ff4294a6c8c21ff719dd487b89/src/Brainly.php#L223-L242 |
16,693 | SAREhub/PHP_Commons | src/SAREhub/Commons/Zmq/RequestReply/RequestReceiver.php | RequestReceiver.unbind | public function unbind()
{
if ($this->isBinded()) {
$this->getSocket()->unbind($this->dsn);
$this->dsn = null;
}
return $this;
} | php | public function unbind()
{
if ($this->isBinded()) {
$this->getSocket()->unbind($this->dsn);
$this->dsn = null;
}
return $this;
} | [
"public",
"function",
"unbind",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isBinded",
"(",
")",
")",
"{",
"$",
"this",
"->",
"getSocket",
"(",
")",
"->",
"unbind",
"(",
"$",
"this",
"->",
"dsn",
")",
";",
"$",
"this",
"->",
"dsn",
"=",
"null... | Unbinds socket from current binded dsn
@return $this | [
"Unbinds",
"socket",
"from",
"current",
"binded",
"dsn"
] | 4e1769ab6411a584112df1151dcc90e6b82fe2bb | https://github.com/SAREhub/PHP_Commons/blob/4e1769ab6411a584112df1151dcc90e6b82fe2bb/src/SAREhub/Commons/Zmq/RequestReply/RequestReceiver.php#L68-L76 |
16,694 | SAREhub/PHP_Commons | src/SAREhub/Commons/Zmq/RequestReply/RequestReceiver.php | RequestReceiver.receiveRequest | public function receiveRequest($wait = self::WAIT)
{
return $this->getSocket()->recv(($wait ? 0 : \ZMQ::MODE_DONTWAIT));
} | php | public function receiveRequest($wait = self::WAIT)
{
return $this->getSocket()->recv(($wait ? 0 : \ZMQ::MODE_DONTWAIT));
} | [
"public",
"function",
"receiveRequest",
"(",
"$",
"wait",
"=",
"self",
"::",
"WAIT",
")",
"{",
"return",
"$",
"this",
"->",
"getSocket",
"(",
")",
"->",
"recv",
"(",
"(",
"$",
"wait",
"?",
"0",
":",
"\\",
"ZMQ",
"::",
"MODE_DONTWAIT",
")",
")",
";"... | Getting next request from socket.
@param bool $wait If true call will waits for next request.
@return string
@throws \ZMQSocketException | [
"Getting",
"next",
"request",
"from",
"socket",
"."
] | 4e1769ab6411a584112df1151dcc90e6b82fe2bb | https://github.com/SAREhub/PHP_Commons/blob/4e1769ab6411a584112df1151dcc90e6b82fe2bb/src/SAREhub/Commons/Zmq/RequestReply/RequestReceiver.php#L84-L87 |
16,695 | SAREhub/PHP_Commons | src/SAREhub/Commons/Zmq/RequestReply/RequestReceiver.php | RequestReceiver.sendReply | public function sendReply($reply, $wait = self::WAIT)
{
$this->getSocket()->send($reply, ($wait ? 0 : \ZMQ::MODE_DONTWAIT));
return $this;
} | php | public function sendReply($reply, $wait = self::WAIT)
{
$this->getSocket()->send($reply, ($wait ? 0 : \ZMQ::MODE_DONTWAIT));
return $this;
} | [
"public",
"function",
"sendReply",
"(",
"$",
"reply",
",",
"$",
"wait",
"=",
"self",
"::",
"WAIT",
")",
"{",
"$",
"this",
"->",
"getSocket",
"(",
")",
"->",
"send",
"(",
"$",
"reply",
",",
"(",
"$",
"wait",
"?",
"0",
":",
"\\",
"ZMQ",
"::",
"MO... | Sending reply to ZMQ socket.
@param string $reply
@param bool $wait If true call will be waits for reply send done.
@return $this
@throws \ZMQSocketException | [
"Sending",
"reply",
"to",
"ZMQ",
"socket",
"."
] | 4e1769ab6411a584112df1151dcc90e6b82fe2bb | https://github.com/SAREhub/PHP_Commons/blob/4e1769ab6411a584112df1151dcc90e6b82fe2bb/src/SAREhub/Commons/Zmq/RequestReply/RequestReceiver.php#L96-L100 |
16,696 | daithi-coombes/bluemix-personality-insights-php | lib/RestAPI.php | RestAPI.analyzeBlob | public function analyzeBlob($text)
{
$config = Config::getInstance();
$url = $config->getParams()['credentials']['url']
. '/v2/profile';
return $this->_worker->post(
$url,
array(
'body' => $text,
'headers' => array('Conte... | php | public function analyzeBlob($text)
{
$config = Config::getInstance();
$url = $config->getParams()['credentials']['url']
. '/v2/profile';
return $this->_worker->post(
$url,
array(
'body' => $text,
'headers' => array('Conte... | [
"public",
"function",
"analyzeBlob",
"(",
"$",
"text",
")",
"{",
"$",
"config",
"=",
"Config",
"::",
"getInstance",
"(",
")",
";",
"$",
"url",
"=",
"$",
"config",
"->",
"getParams",
"(",
")",
"[",
"'credentials'",
"]",
"[",
"'url'",
"]",
".",
"'/v2/p... | Analayze a blob of text.
@param string $text The text to analyze
@return object Returns the response object of the Client library used. | [
"Analayze",
"a",
"blob",
"of",
"text",
"."
] | 171bd0a6deb3e1e9a7b38fc61c2a7ae601d76a9a | https://github.com/daithi-coombes/bluemix-personality-insights-php/blob/171bd0a6deb3e1e9a7b38fc61c2a7ae601d76a9a/lib/RestAPI.php#L42-L56 |
16,697 | daithi-coombes/bluemix-personality-insights-php | lib/RestAPI.php | RestAPI.getWorker | public function getWorker()
{
if ($this->_worker===null) {
$config = Config::getInstance();
$this->setupWorker($config);
}
return $this->_worker;
} | php | public function getWorker()
{
if ($this->_worker===null) {
$config = Config::getInstance();
$this->setupWorker($config);
}
return $this->_worker;
} | [
"public",
"function",
"getWorker",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_worker",
"===",
"null",
")",
"{",
"$",
"config",
"=",
"Config",
"::",
"getInstance",
"(",
")",
";",
"$",
"this",
"->",
"setupWorker",
"(",
"$",
"config",
")",
";",
"}... | Get the current worker.
@return object | [
"Get",
"the",
"current",
"worker",
"."
] | 171bd0a6deb3e1e9a7b38fc61c2a7ae601d76a9a | https://github.com/daithi-coombes/bluemix-personality-insights-php/blob/171bd0a6deb3e1e9a7b38fc61c2a7ae601d76a9a/lib/RestAPI.php#L62-L70 |
16,698 | daithi-coombes/bluemix-personality-insights-php | lib/RestAPI.php | RestAPI.setupWorker | public function setupWorker(Config $config)
{
$credentials = $config->getParams()['credentials'];
$this->_worker = new \GuzzleHttp\Client(array(
'defaults' => array(
'auth' => array($credentials['username'], $credentials['password']),
),
));
} | php | public function setupWorker(Config $config)
{
$credentials = $config->getParams()['credentials'];
$this->_worker = new \GuzzleHttp\Client(array(
'defaults' => array(
'auth' => array($credentials['username'], $credentials['password']),
),
));
} | [
"public",
"function",
"setupWorker",
"(",
"Config",
"$",
"config",
")",
"{",
"$",
"credentials",
"=",
"$",
"config",
"->",
"getParams",
"(",
")",
"[",
"'credentials'",
"]",
";",
"$",
"this",
"->",
"_worker",
"=",
"new",
"\\",
"GuzzleHttp",
"\\",
"Client"... | Constructs the middleware REST client library.
@param Config $config The configuration singleton. | [
"Constructs",
"the",
"middleware",
"REST",
"client",
"library",
"."
] | 171bd0a6deb3e1e9a7b38fc61c2a7ae601d76a9a | https://github.com/daithi-coombes/bluemix-personality-insights-php/blob/171bd0a6deb3e1e9a7b38fc61c2a7ae601d76a9a/lib/RestAPI.php#L76-L86 |
16,699 | helthe/Chronos | CronExpression.php | CronExpression.setExpression | public function setExpression($expression)
{
$definitions = array(
'@yearly' => '0 0 1 1 *',
'@annually' => '0 0 1 1 *',
'@monthly' => '0 0 1 * *',
'@weekly' => '0 0 * * 0',
'@daily' => '0 0 * * *',
'@hourly' => '0 * * * *'
);
... | php | public function setExpression($expression)
{
$definitions = array(
'@yearly' => '0 0 1 1 *',
'@annually' => '0 0 1 1 *',
'@monthly' => '0 0 1 * *',
'@weekly' => '0 0 * * 0',
'@daily' => '0 0 * * *',
'@hourly' => '0 * * * *'
);
... | [
"public",
"function",
"setExpression",
"(",
"$",
"expression",
")",
"{",
"$",
"definitions",
"=",
"array",
"(",
"'@yearly'",
"=>",
"'0 0 1 1 *'",
",",
"'@annually'",
"=>",
"'0 0 1 1 *'",
",",
"'@monthly'",
"=>",
"'0 0 1 * *'",
",",
"'@weekly'",
"=>",
"'0 0 * * 0... | Set CRON expression.
@param string $expression
@throws \InvalidArgumentException | [
"Set",
"CRON",
"expression",
"."
] | 6c783c55c32b323550fc6f21cd644c2be82720b0 | https://github.com/helthe/Chronos/blob/6c783c55c32b323550fc6f21cd644c2be82720b0/CronExpression.php#L63-L90 |
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.