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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
ezra-obiwale/dSCore | src/Core/AInjector.php | AInjector.checkInjections | final public function checkInjections($className) {
if (is_array($this->inject())) {
foreach ($this->inject() as $classArray) {
if (!is_array($classArray) ||
(is_array($classArray) && !isset($classArray['class'])) ||
(is_array($classArr... | php | final public function checkInjections($className) {
if (is_array($this->inject())) {
foreach ($this->inject() as $classArray) {
if (!is_array($classArray) ||
(is_array($classArray) && !isset($classArray['class'])) ||
(is_array($classArr... | [
"final",
"public",
"function",
"checkInjections",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"inject",
"(",
")",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"inject",
"(",
")",
"as",
"$",
"classArray",
")",
... | Checks the injection for cyclic dependencies
@param string $className
@return boolean | [
"Checks",
"the",
"injection",
"for",
"cyclic",
"dependencies"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/AInjector.php#L77-L94 | train |
ezra-obiwale/dSCore | src/Core/AInjector.php | AInjector.canInject | private function canInject(array $classArray, $className = null) {
$className = ($className === null) ? $this->getClass() : $className;
if (!self::addInjecting($className)) {
return false;
}
$refClass = new \ReflectionClass($classArray['class']);
if ($refClass->isS... | php | private function canInject(array $classArray, $className = null) {
$className = ($className === null) ? $this->getClass() : $className;
if (!self::addInjecting($className)) {
return false;
}
$refClass = new \ReflectionClass($classArray['class']);
if ($refClass->isS... | [
"private",
"function",
"canInject",
"(",
"array",
"$",
"classArray",
",",
"$",
"className",
"=",
"null",
")",
"{",
"$",
"className",
"=",
"(",
"$",
"className",
"===",
"null",
")",
"?",
"$",
"this",
"->",
"getClass",
"(",
")",
":",
"$",
"className",
... | Checks if the class can be injected
@param array $classArray
@param string|null $className
@return boolean | [
"Checks",
"if",
"the",
"class",
"can",
"be",
"injected"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/AInjector.php#L114-L134 | train |
ezra-obiwale/dSCore | src/Core/AInjector.php | AInjector.doInject | private function doInject() {
foreach ($this->prepareInject() as $alias => $classArray) {
if (!is_array($classArray)) {
throw new \Exception('Injection failed. Values of injection array in class "' .
$this->getClass() . '" must be an array');
}
... | php | private function doInject() {
foreach ($this->prepareInject() as $alias => $classArray) {
if (!is_array($classArray)) {
throw new \Exception('Injection failed. Values of injection array in class "' .
$this->getClass() . '" must be an array');
}
... | [
"private",
"function",
"doInject",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"prepareInject",
"(",
")",
"as",
"$",
"alias",
"=>",
"$",
"classArray",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"classArray",
")",
")",
"{",
"throw",
"new",
... | Performs the actual injection
@throws \Exception | [
"Performs",
"the",
"actual",
"injection"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/AInjector.php#L140-L168 | train |
Danack/Weaver | src/Weaver/CompositeWeaveGenerator.php | CompositeWeaveGenerator.addPropertiesAndConstantsForContainer | private function addPropertiesAndConstantsForContainer() {
$this->addPropertiesAndConstantsFromReflection($this->containerClassReflection);
foreach ($this->compositeClassReflectionArray as $compositeClassReflection) {
$paramName = $this->getComponentName($compositeClassReflection);
... | php | private function addPropertiesAndConstantsForContainer() {
$this->addPropertiesAndConstantsFromReflection($this->containerClassReflection);
foreach ($this->compositeClassReflectionArray as $compositeClassReflection) {
$paramName = $this->getComponentName($compositeClassReflection);
... | [
"private",
"function",
"addPropertiesAndConstantsForContainer",
"(",
")",
"{",
"$",
"this",
"->",
"addPropertiesAndConstantsFromReflection",
"(",
"$",
"this",
"->",
"containerClassReflection",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"compositeClassReflectionArray",
... | Adds the properties and constants from the decorating class to the
class being weaved.
@internal param $originalSourceClass | [
"Adds",
"the",
"properties",
"and",
"constants",
"from",
"the",
"decorating",
"class",
"to",
"the",
"class",
"being",
"weaved",
"."
] | 414894cd397daff22d2c71e4988784a1f71b702e | https://github.com/Danack/Weaver/blob/414894cd397daff22d2c71e4988784a1f71b702e/src/Weaver/CompositeWeaveGenerator.php#L263-L271 | train |
AdamB7586/menu-builder | src/Builder/Link.php | Link.title | public static function title($link) {
if(isset($link['title']) || isset($link['label'])){
return ' title="'.trim(isset($link['title']) && !empty(trim($link['title'])) ? $link['title'] : $link['label']).'"';
}
return false;
} | php | public static function title($link) {
if(isset($link['title']) || isset($link['label'])){
return ' title="'.trim(isset($link['title']) && !empty(trim($link['title'])) ? $link['title'] : $link['label']).'"';
}
return false;
} | [
"public",
"static",
"function",
"title",
"(",
"$",
"link",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"link",
"[",
"'title'",
"]",
")",
"||",
"isset",
"(",
"$",
"link",
"[",
"'label'",
"]",
")",
")",
"{",
"return",
"' title=\"'",
".",
"trim",
"(",
"... | Returns the HTML title element
@param array $link This should be an array containing all of the set link values
@return string | [
"Returns",
"the",
"HTML",
"title",
"element"
] | dbc192bca7d59475068c19d1a07a039e5f997ee4 | https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Builder/Link.php#L32-L37 | train |
AdamB7586/menu-builder | src/Builder/Link.php | Link.label | public static function label($link) {
if(isset($link['label']) && !empty(trim($link['label']))) {
return trim($link['label']);
}
elseif(isset($link['title']) && !empty(trim($link['title']))) {
return trim($link['title']);
}
return false;
} | php | public static function label($link) {
if(isset($link['label']) && !empty(trim($link['label']))) {
return trim($link['label']);
}
elseif(isset($link['title']) && !empty(trim($link['title']))) {
return trim($link['title']);
}
return false;
} | [
"public",
"static",
"function",
"label",
"(",
"$",
"link",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"link",
"[",
"'label'",
"]",
")",
"&&",
"!",
"empty",
"(",
"trim",
"(",
"$",
"link",
"[",
"'label'",
"]",
")",
")",
")",
"{",
"return",
"trim",
"... | Returns the link label element
@param array $link This should be an array containing all of the set link values
@return string Returns a valid string from the link label | [
"Returns",
"the",
"link",
"label",
"element"
] | dbc192bca7d59475068c19d1a07a039e5f997ee4 | https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Builder/Link.php#L68-L76 | train |
AdamB7586/menu-builder | src/Builder/Link.php | Link.href | public static function href($link) {
if(isset($link['uri']) || isset($link['fragment'])) {
return ' href="'.URI::getHref($link).'"';
}
return false;
} | php | public static function href($link) {
if(isset($link['uri']) || isset($link['fragment'])) {
return ' href="'.URI::getHref($link).'"';
}
return false;
} | [
"public",
"static",
"function",
"href",
"(",
"$",
"link",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"link",
"[",
"'uri'",
"]",
")",
"||",
"isset",
"(",
"$",
"link",
"[",
"'fragment'",
"]",
")",
")",
"{",
"return",
"' href=\"'",
".",
"URI",
"::",
"g... | Returns the link href element
@param array $link This should be an array containing all of the set link values
@return string|false Returns the HTML href element if the uri or fragment information is set | [
"Returns",
"the",
"link",
"href",
"element"
] | dbc192bca7d59475068c19d1a07a039e5f997ee4 | https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Builder/Link.php#L83-L88 | train |
AdamB7586/menu-builder | src/Builder/Link.php | Link.htmlClass | public static function htmlClass($class, $activeClass) {
if((isset($class) && is_string($class) && !empty(trim($class))) || (is_string($activeClass) && !empty(trim($activeClass)))) {
return ' class="'.trim(trim($class).' '.$activeClass).'"';
}
return false;
} | php | public static function htmlClass($class, $activeClass) {
if((isset($class) && is_string($class) && !empty(trim($class))) || (is_string($activeClass) && !empty(trim($activeClass)))) {
return ' class="'.trim(trim($class).' '.$activeClass).'"';
}
return false;
} | [
"public",
"static",
"function",
"htmlClass",
"(",
"$",
"class",
",",
"$",
"activeClass",
")",
"{",
"if",
"(",
"(",
"isset",
"(",
"$",
"class",
")",
"&&",
"is_string",
"(",
"$",
"class",
")",
"&&",
"!",
"empty",
"(",
"trim",
"(",
"$",
"class",
")",
... | Returns the HTML class element
@param string $class Should be a string containing the classes to add
@param string $activeClass If the link is active the active class will be set else will be empty
@return string|false If element is set and is valid will return the HTML element else return false | [
"Returns",
"the",
"HTML",
"class",
"element"
] | dbc192bca7d59475068c19d1a07a039e5f997ee4 | https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Builder/Link.php#L96-L101 | train |
AdamB7586/menu-builder | src/Builder/Link.php | Link.htmlID | public static function htmlID($link) {
if(isset($link['id']) && is_string($link['id']) && !empty(trim($link['id']))) {
return ' id="'.trim($link['id']).'"';
}
return false;
} | php | public static function htmlID($link) {
if(isset($link['id']) && is_string($link['id']) && !empty(trim($link['id']))) {
return ' id="'.trim($link['id']).'"';
}
return false;
} | [
"public",
"static",
"function",
"htmlID",
"(",
"$",
"link",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"link",
"[",
"'id'",
"]",
")",
"&&",
"is_string",
"(",
"$",
"link",
"[",
"'id'",
"]",
")",
"&&",
"!",
"empty",
"(",
"trim",
"(",
"$",
"link",
"[... | Returns the HTML id element
@param array $link This should be an array containing all of the set link values
@return string|false If element is set and is valid will return the HTML element else return false | [
"Returns",
"the",
"HTML",
"id",
"element"
] | dbc192bca7d59475068c19d1a07a039e5f997ee4 | https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Builder/Link.php#L108-L113 | train |
AdamB7586/menu-builder | src/Builder/Link.php | Link.fontIcon | public static function fontIcon($link){
if(isset($link['font-icon']) && is_string($link['font-icon']) && !empty(trim($link['font-icon']))){
return '<span class="'.trim($link['font-icon']).'"></span> ';
}
return false;
} | php | public static function fontIcon($link){
if(isset($link['font-icon']) && is_string($link['font-icon']) && !empty(trim($link['font-icon']))){
return '<span class="'.trim($link['font-icon']).'"></span> ';
}
return false;
} | [
"public",
"static",
"function",
"fontIcon",
"(",
"$",
"link",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"link",
"[",
"'font-icon'",
"]",
")",
"&&",
"is_string",
"(",
"$",
"link",
"[",
"'font-icon'",
"]",
")",
"&&",
"!",
"empty",
"(",
"trim",
"(",
"$"... | Inserts a given font ion in a span class
@param array $link This should be an array containing all of the set link values
@return string|boolean If the font icon is set will return a string else will return false | [
"Inserts",
"a",
"given",
"font",
"ion",
"in",
"a",
"span",
"class"
] | dbc192bca7d59475068c19d1a07a039e5f997ee4 | https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Builder/Link.php#L120-L125 | train |
AdamB7586/menu-builder | src/Builder/Link.php | Link.formatLink | public static function formatLink($link, $activeClass, $hasChild = false, $breadcrumbLink = false) {
return "<a".self::href($link).self::title($link).self::htmlClass(($breadcrumbLink ? '' : self::$linkDefaults['a_default'].' ').(isset($link['class']) ? $link['class'] : ''), $activeClass).self::target($link).sel... | php | public static function formatLink($link, $activeClass, $hasChild = false, $breadcrumbLink = false) {
return "<a".self::href($link).self::title($link).self::htmlClass(($breadcrumbLink ? '' : self::$linkDefaults['a_default'].' ').(isset($link['class']) ? $link['class'] : ''), $activeClass).self::target($link).sel... | [
"public",
"static",
"function",
"formatLink",
"(",
"$",
"link",
",",
"$",
"activeClass",
",",
"$",
"hasChild",
"=",
"false",
",",
"$",
"breadcrumbLink",
"=",
"false",
")",
"{",
"return",
"\"<a\"",
".",
"self",
"::",
"href",
"(",
"$",
"link",
")",
".",
... | Returns a formatted link with all of the attributes
@param array $link This should be an array containing all of the set link values
@param string $activeClass If the link is active should have the active class string set else should be empty
@param boolean If the element has any child elements set to true else set to ... | [
"Returns",
"a",
"formatted",
"link",
"with",
"all",
"of",
"the",
"attributes"
] | dbc192bca7d59475068c19d1a07a039e5f997ee4 | https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Builder/Link.php#L134-L136 | train |
Innmind/Colour | src/HSLA.php | HSLA.hueToPoint | private function hueToPoint(float $p, float $q, float $t): float
{
if ($t < 0) {
$t += 1;
}
if ($t > 1) {
$t -= 1;
}
switch (true) {
case $t < 1 / 6:
return $p + ($q - $p) * 6 * $t;
case $t < 1 / 2:
... | php | private function hueToPoint(float $p, float $q, float $t): float
{
if ($t < 0) {
$t += 1;
}
if ($t > 1) {
$t -= 1;
}
switch (true) {
case $t < 1 / 6:
return $p + ($q - $p) * 6 * $t;
case $t < 1 / 2:
... | [
"private",
"function",
"hueToPoint",
"(",
"float",
"$",
"p",
",",
"float",
"$",
"q",
",",
"float",
"$",
"t",
")",
":",
"float",
"{",
"if",
"(",
"$",
"t",
"<",
"0",
")",
"{",
"$",
"t",
"+=",
"1",
";",
"}",
"if",
"(",
"$",
"t",
">",
"1",
")... | Formula taken from the internet, don't know what it means
@param float $p Don't know what it represents
@param float $q Don't know what it represents
@param float $t Don't know what it represents
@return float | [
"Formula",
"taken",
"from",
"the",
"internet",
"don",
"t",
"know",
"what",
"it",
"means"
] | 7fcddde00d74aba6bce6af4e4d70f323b9267f70 | https://github.com/Innmind/Colour/blob/7fcddde00d74aba6bce6af4e4d70f323b9267f70/src/HSLA.php#L246-L268 | train |
WellCommerce/LocaleBundle | Doctrine/ORM/Filter/LocaleFilter.php | LocaleFilter.addFilterConstraint | public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
{
if (!$targetEntity->reflClass->implementsInterface(\WellCommerce\Bundle\LocaleBundle\Entity\LocaleAwareInterface::class)) {
return "";
}
return $targetTableAlias . '.locale = ' . $this->getPara... | php | public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
{
if (!$targetEntity->reflClass->implementsInterface(\WellCommerce\Bundle\LocaleBundle\Entity\LocaleAwareInterface::class)) {
return "";
}
return $targetTableAlias . '.locale = ' . $this->getPara... | [
"public",
"function",
"addFilterConstraint",
"(",
"ClassMetadata",
"$",
"targetEntity",
",",
"$",
"targetTableAlias",
")",
"{",
"if",
"(",
"!",
"$",
"targetEntity",
"->",
"reflClass",
"->",
"implementsInterface",
"(",
"\\",
"WellCommerce",
"\\",
"Bundle",
"\\",
... | Adds locale filter to query
@param ClassMetadata $targetEntity
@param string $targetTableAlias
@return string | [
"Adds",
"locale",
"filter",
"to",
"query"
] | da61e059b789ccc748fd3cb0e881780fe6e6d3c6 | https://github.com/WellCommerce/LocaleBundle/blob/da61e059b789ccc748fd3cb0e881780fe6e6d3c6/Doctrine/ORM/Filter/LocaleFilter.php#L33-L40 | train |
bseddon/XPath20 | Iterator/FollowingNodeIterator.php | FollowingNodeIterator.fromFollowingNodeIteratorParts | protected function fromFollowingNodeIteratorParts()
{
if ( is_null( $this->typeTest ) )
{
if ( is_null( $this->nameTest ) )
$this->kind = XPathNodeType::All;
else
$this->kind = XPathNodeType::Element;
}
else
$this->kind = $this->typeTest->GetNodeKind();
} | php | protected function fromFollowingNodeIteratorParts()
{
if ( is_null( $this->typeTest ) )
{
if ( is_null( $this->nameTest ) )
$this->kind = XPathNodeType::All;
else
$this->kind = XPathNodeType::Element;
}
else
$this->kind = $this->typeTest->GetNodeKind();
} | [
"protected",
"function",
"fromFollowingNodeIteratorParts",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"typeTest",
")",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"nameTest",
")",
")",
"$",
"this",
"->",
"kind",
"=",
"XPat... | Supports constructing an instance | [
"Supports",
"constructing",
"an",
"instance"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Iterator/FollowingNodeIterator.php#L70-L81 | train |
FlexModel/FlexModelBundle | DependencyInjection/FlexModelFactory.php | FlexModelFactory.createFlexModel | public static function createFlexModel($identifier, $resource, $cachePath)
{
$domDocument = new DOMDocument('1.0', 'UTF-8');
$domDocument->load($resource);
$domDocument->xinclude();
$flexModel = new FlexModel($identifier);
$flexModel->load($domDocument, $cachePath);
... | php | public static function createFlexModel($identifier, $resource, $cachePath)
{
$domDocument = new DOMDocument('1.0', 'UTF-8');
$domDocument->load($resource);
$domDocument->xinclude();
$flexModel = new FlexModel($identifier);
$flexModel->load($domDocument, $cachePath);
... | [
"public",
"static",
"function",
"createFlexModel",
"(",
"$",
"identifier",
",",
"$",
"resource",
",",
"$",
"cachePath",
")",
"{",
"$",
"domDocument",
"=",
"new",
"DOMDocument",
"(",
"'1.0'",
",",
"'UTF-8'",
")",
";",
"$",
"domDocument",
"->",
"load",
"(",
... | Creates a new FlexModel instance.
@param string $identifier
@param string $resource
@param string $cachePath
@return FlexModel | [
"Creates",
"a",
"new",
"FlexModel",
"instance",
"."
] | 7b4720d25b0dc6baf29b1da8ad7c67dfb2686460 | https://github.com/FlexModel/FlexModelBundle/blob/7b4720d25b0dc6baf29b1da8ad7c67dfb2686460/DependencyInjection/FlexModelFactory.php#L24-L34 | train |
ComPHPPuebla/restful-extensions | src/ComPHPPuebla/Slim/Middleware/JsonpMiddleware.php | JsonpMiddleware.call | public function call()
{
if ('application/json' !== $this->app->request()->headers('Accept')) {
$this->next->call();
return; //Only JSON can be turned into JSONP
}
$callback = $this->app->request()->get('callback');
$this->next->call();
if (empty(... | php | public function call()
{
if ('application/json' !== $this->app->request()->headers('Accept')) {
$this->next->call();
return; //Only JSON can be turned into JSONP
}
$callback = $this->app->request()->get('callback');
$this->next->call();
if (empty(... | [
"public",
"function",
"call",
"(",
")",
"{",
"if",
"(",
"'application/json'",
"!==",
"$",
"this",
"->",
"app",
"->",
"request",
"(",
")",
"->",
"headers",
"(",
"'Accept'",
")",
")",
"{",
"$",
"this",
"->",
"next",
"->",
"call",
"(",
")",
";",
"retu... | Adjust the content type accordingly and add the given callback name to the response for
JSONP requests
@see \Slim\Middleware::call() | [
"Adjust",
"the",
"content",
"type",
"accordingly",
"and",
"add",
"the",
"given",
"callback",
"name",
"to",
"the",
"response",
"for",
"JSONP",
"requests"
] | 3dc5e554d7ebe1305eed4cd4ec71a6944316199c | https://github.com/ComPHPPuebla/restful-extensions/blob/3dc5e554d7ebe1305eed4cd4ec71a6944316199c/src/ComPHPPuebla/Slim/Middleware/JsonpMiddleware.php#L14-L35 | train |
itcreator/custom-cmf | Module/System/src/Cmf/System/Controller/RedirectController.php | RedirectController.defaultAction | public function defaultAction()
{
$lng = \Cmf\Language\Factory::get($this);
HelperFactory::getMeta()->clear();
HelperFactory::getJS()->clear();
HelperFactory::getStyle()->clear();
HelperFactory::getTitle()->setTitle('Redirect');
if ($path = urldecode(Application::getR... | php | public function defaultAction()
{
$lng = \Cmf\Language\Factory::get($this);
HelperFactory::getMeta()->clear();
HelperFactory::getJS()->clear();
HelperFactory::getStyle()->clear();
HelperFactory::getTitle()->setTitle('Redirect');
if ($path = urldecode(Application::getR... | [
"public",
"function",
"defaultAction",
"(",
")",
"{",
"$",
"lng",
"=",
"\\",
"Cmf",
"\\",
"Language",
"\\",
"Factory",
"::",
"get",
"(",
"$",
"this",
")",
";",
"HelperFactory",
"::",
"getMeta",
"(",
")",
"->",
"clear",
"(",
")",
";",
"HelperFactory",
... | This method display redirect page
@return array | [
"This",
"method",
"display",
"redirect",
"page"
] | 42fc0535dfa0f641856f06673f6ab596b2020c40 | https://github.com/itcreator/custom-cmf/blob/42fc0535dfa0f641856f06673f6ab596b2020c40/Module/System/src/Cmf/System/Controller/RedirectController.php#L26-L41 | train |
stubbles/stubbles-dbal | src/main/php/config/DatabaseConfiguration.php | DatabaseConfiguration.fromArray | public static function fromArray(string $id, string $dsn, array $properties): DatabaseConfiguration
{
$self = new self($id, $dsn);
if (isset($properties['username'])) {
$self->userName = $properties['username'];
unset($properties['username']);
}
if (isset($pr... | php | public static function fromArray(string $id, string $dsn, array $properties): DatabaseConfiguration
{
$self = new self($id, $dsn);
if (isset($properties['username'])) {
$self->userName = $properties['username'];
unset($properties['username']);
}
if (isset($pr... | [
"public",
"static",
"function",
"fromArray",
"(",
"string",
"$",
"id",
",",
"string",
"$",
"dsn",
",",
"array",
"$",
"properties",
")",
":",
"DatabaseConfiguration",
"{",
"$",
"self",
"=",
"new",
"self",
"(",
"$",
"id",
",",
"$",
"dsn",
")",
";",
"if... | create connection data instance from an array
Please note that this method does not support driver options. Driver
options must be set separately.
@param string $id
@param string $dsn
@param array $properties
@return \stubbles\db\config\DatabaseConfiguration | [
"create",
"connection",
"data",
"instance",
"from",
"an",
"array"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/config/DatabaseConfiguration.php#L82-L107 | train |
aztech-digital/phinject | src/ObjectContainer.php | ObjectContainer.lateBind | public function lateBind($key, & $item)
{
if (is_array($item)) {
return $this->classes[$key] = $item;
}
return $this->registry->rset($key, $item);
} | php | public function lateBind($key, & $item)
{
if (is_array($item)) {
return $this->classes[$key] = $item;
}
return $this->registry->rset($key, $item);
} | [
"public",
"function",
"lateBind",
"(",
"$",
"key",
",",
"&",
"$",
"item",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"item",
")",
")",
"{",
"return",
"$",
"this",
"->",
"classes",
"[",
"$",
"key",
"]",
"=",
"$",
"item",
";",
"}",
"return",
"$",... | Binds by reference an existing object or an object definition to a key in the container.
@param string $key The key to which the new object/definition should be bound.
@param mixed $item An array or an object to bind.
If $item is an object, it will be registered as a singleton in the
object registry. Otherwise, $item ... | [
"Binds",
"by",
"reference",
"an",
"existing",
"object",
"or",
"an",
"object",
"definition",
"to",
"a",
"key",
"in",
"the",
"container",
"."
] | 1bb2fb3b5ef44e62f168af71134c613c48b58d95 | https://github.com/aztech-digital/phinject/blob/1bb2fb3b5ef44e62f168af71134c613c48b58d95/src/ObjectContainer.php#L133-L140 | train |
jbouzekri/SculpinTagCloudBundle | Model/TagCloud.php | TagCloud.current | public function current()
{
$keys = array_keys($this->tags);
return $this->tags[$keys[$this->position]];
} | php | public function current()
{
$keys = array_keys($this->tags);
return $this->tags[$keys[$this->position]];
} | [
"public",
"function",
"current",
"(",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"tags",
")",
";",
"return",
"$",
"this",
"->",
"tags",
"[",
"$",
"keys",
"[",
"$",
"this",
"->",
"position",
"]",
"]",
";",
"}"
] | Iterator current item
@return \Jb\Bundle\TagCloudBundle\Model\Tag | [
"Iterator",
"current",
"item"
] | 936cf34ce60cb8fb4774931b1841fc775a3e9208 | https://github.com/jbouzekri/SculpinTagCloudBundle/blob/936cf34ce60cb8fb4774931b1841fc775a3e9208/Model/TagCloud.php#L125-L129 | train |
jbouzekri/SculpinTagCloudBundle | Model/TagCloud.php | TagCloud.valid | public function valid()
{
$keys = array_keys($this->tags);
return isset($keys[$this->position]) && isset($this->tags[$keys[$this->position]]);
} | php | public function valid()
{
$keys = array_keys($this->tags);
return isset($keys[$this->position]) && isset($this->tags[$keys[$this->position]]);
} | [
"public",
"function",
"valid",
"(",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"tags",
")",
";",
"return",
"isset",
"(",
"$",
"keys",
"[",
"$",
"this",
"->",
"position",
"]",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"tag... | Iterator item exists
@return boolean | [
"Iterator",
"item",
"exists"
] | 936cf34ce60cb8fb4774931b1841fc775a3e9208 | https://github.com/jbouzekri/SculpinTagCloudBundle/blob/936cf34ce60cb8fb4774931b1841fc775a3e9208/Model/TagCloud.php#L156-L160 | train |
jbouzekri/SculpinTagCloudBundle | Model/TagCloud.php | TagCloud.slice | public function slice($offset, $length = null)
{
$this->tags = array_slice($this->tags, $offset, $length, true);
return $this;
} | php | public function slice($offset, $length = null)
{
$this->tags = array_slice($this->tags, $offset, $length, true);
return $this;
} | [
"public",
"function",
"slice",
"(",
"$",
"offset",
",",
"$",
"length",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"tags",
"=",
"array_slice",
"(",
"$",
"this",
"->",
"tags",
",",
"$",
"offset",
",",
"$",
"length",
",",
"true",
")",
";",
"return",
... | Slice the tag cloud
@param int $offset
@param int $length
@return \Jb\Bundle\TagCloudBundle\Model\TagCloud | [
"Slice",
"the",
"tag",
"cloud"
] | 936cf34ce60cb8fb4774931b1841fc775a3e9208 | https://github.com/jbouzekri/SculpinTagCloudBundle/blob/936cf34ce60cb8fb4774931b1841fc775a3e9208/Model/TagCloud.php#L170-L175 | train |
PenoaksDev/Milky-Framework | src/Milky/Binding/Globals.php | Globals.getByClass | public static function getByClass( $class )
{
$results = [];
foreach ( static::$globals as $k => $v )
if ( $v instanceof $class )
$results[$k] = $v;
return $results;
} | php | public static function getByClass( $class )
{
$results = [];
foreach ( static::$globals as $k => $v )
if ( $v instanceof $class )
$results[$k] = $v;
return $results;
} | [
"public",
"static",
"function",
"getByClass",
"(",
"$",
"class",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"static",
"::",
"$",
"globals",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"if",
"(",
"$",
"v",
"instanceof",
"$",
"class",
"... | Gets globals by their final class
@param string $class
@return array | [
"Gets",
"globals",
"by",
"their",
"final",
"class"
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Binding/Globals.php#L88-L95 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/benchmark/Benchmark.php | Benchmark.start | public function start($name, $preset = null, $isGlobalStart = false)
{
if(!$this->isEnabled()) return;
// if(empty($name))
// throw new BenchmarkException("Empty timer name!");
//
// $name = $this->uniqueTimerName($name);
$t = $this->getTime();
$this->t... | php | public function start($name, $preset = null, $isGlobalStart = false)
{
if(!$this->isEnabled()) return;
// if(empty($name))
// throw new BenchmarkException("Empty timer name!");
//
// $name = $this->uniqueTimerName($name);
$t = $this->getTime();
$this->t... | [
"public",
"function",
"start",
"(",
"$",
"name",
",",
"$",
"preset",
"=",
"null",
",",
"$",
"isGlobalStart",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isEnabled",
"(",
")",
")",
"return",
";",
"// if(empty($name))",
"// throw new Be... | Starts a timer with the given name
The {@link $preset} parameter is useful for starting a timer for a
process that begin before the Benchmark instance was available, ex.
at the start of the entire request
The {@link $isGlobalStart} parameter is required if you'd like
{@link getTotals()} to return aggregate times for ... | [
"Starts",
"a",
"timer",
"with",
"the",
"given",
"name"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/benchmark/Benchmark.php#L95-L121 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/benchmark/Benchmark.php | Benchmark.end | public function end($name)
{
if(!$this->isEnabled()) return;
$aggregate = 0;
// if (empty($name))
// throw new BenchmarkException("Empty timer name!");
//
// if (array_key_exists($name, $this->timers) && !empty($this->timers[$name]['end'])) {
// $inc... | php | public function end($name)
{
if(!$this->isEnabled()) return;
$aggregate = 0;
// if (empty($name))
// throw new BenchmarkException("Empty timer name!");
//
// if (array_key_exists($name, $this->timers) && !empty($this->timers[$name]['end'])) {
// $inc... | [
"public",
"function",
"end",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isEnabled",
"(",
")",
")",
"return",
";",
"$",
"aggregate",
"=",
"0",
";",
"// if (empty($name))",
"// throw new BenchmarkException(\"Empty timer name!\");",
"//",
... | Ends and stores the elapsed time for the timer with the given name
If is in aggregation mode, also stores the aggregate time for this timer.
This is useful for tracing a request and noticing large lapses in
processing that may not have a timer implemented.
If a timer by the same name has already been stored, this fun... | [
"Ends",
"and",
"stores",
"the",
"elapsed",
"time",
"for",
"the",
"timer",
"with",
"the",
"given",
"name"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/benchmark/Benchmark.php#L139-L175 | train |
jacksleight/coast | library/Config.php | Config.fromArray | public function fromArray(array $opts)
{
$this->_opts = \Coast\array_merge_smart(
$this->_opts,
$opts
);
return $this;
} | php | public function fromArray(array $opts)
{
$this->_opts = \Coast\array_merge_smart(
$this->_opts,
$opts
);
return $this;
} | [
"public",
"function",
"fromArray",
"(",
"array",
"$",
"opts",
")",
"{",
"$",
"this",
"->",
"_opts",
"=",
"\\",
"Coast",
"\\",
"array_merge_smart",
"(",
"$",
"this",
"->",
"_opts",
",",
"$",
"opts",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Import from an array.
@param string $name
@return mixed | [
"Import",
"from",
"an",
"array",
"."
] | cd6cd41e8304adce41f59f799d4183adcaf666f9 | https://github.com/jacksleight/coast/blob/cd6cd41e8304adce41f59f799d4183adcaf666f9/library/Config.php#L61-L68 | train |
shgysk8zer0/core_api | traits/errors.php | Errors.errorToException | protected static function errorToException(
$level,
$message,
$file,
$line
)
{
try {
throw new \ErrorException($message, 0, $level, $file, $line);
} catch(\ErrorException $e) {
return $e;
}
} | php | protected static function errorToException(
$level,
$message,
$file,
$line
)
{
try {
throw new \ErrorException($message, 0, $level, $file, $line);
} catch(\ErrorException $e) {
return $e;
}
} | [
"protected",
"static",
"function",
"errorToException",
"(",
"$",
"level",
",",
"$",
"message",
",",
"$",
"file",
",",
"$",
"line",
")",
"{",
"try",
"{",
"throw",
"new",
"\\",
"ErrorException",
"(",
"$",
"message",
",",
"0",
",",
"$",
"level",
",",
"$... | Throws, catches, and returns an \ErrorException created from error args
@param int $level Any of the error levels (E_*)
@param string $message Message given with the error
@param string $file File generating the error
@param int $line Line on which the error occured
@return \ErrorException
@see http://ph... | [
"Throws",
"catches",
"and",
"returns",
"an",
"\\",
"ErrorException",
"created",
"from",
"error",
"args"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/errors.php#L39-L51 | train |
jayalfredprufrock/codeigniter-messages | libraries/messages.php | Messages.add | public function add($type, $message, $data = FALSE, $title = FALSE)
{
$messages = $this->_session_get();
if (!is_array($messages)) {
$messages = array();
}
if (is_a($message, 'Exception')) {
$title = 'Exception Thrown!';
$message = $message->getMessage();
... | php | public function add($type, $message, $data = FALSE, $title = FALSE)
{
$messages = $this->_session_get();
if (!is_array($messages)) {
$messages = array();
}
if (is_a($message, 'Exception')) {
$title = 'Exception Thrown!';
$message = $message->getMessage();
... | [
"public",
"function",
"add",
"(",
"$",
"type",
",",
"$",
"message",
",",
"$",
"data",
"=",
"FALSE",
",",
"$",
"title",
"=",
"FALSE",
")",
"{",
"$",
"messages",
"=",
"$",
"this",
"->",
"_session_get",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"("... | Adds a message to the a list.
The optional parameter $data may be a primitive value or an array.
If the $data parameter is present, $message must be a
{@link http://www.php.net/manual/en/function.sprintf.php printf()}-style
template string that includes formatting for the value(s) in $data.
The $message formatting str... | [
"Adds",
"a",
"message",
"to",
"the",
"a",
"list",
"."
] | d1891b0439c08b2df902effde171d25e4dbc6c79 | https://github.com/jayalfredprufrock/codeigniter-messages/blob/d1891b0439c08b2df902effde171d25e4dbc6c79/libraries/messages.php#L48-L75 | train |
jayalfredprufrock/codeigniter-messages | libraries/messages.php | Messages.clear | public function clear($type = FALSE)
{
if ($type === FALSE){
$this->_session_unset();
}
else {
$messages = $this->_session_get();
if (is_array($messages))
{
foreach($messages as $i=>$message){
if ($message->type == $type){
unset($messages[$i]);
}
... | php | public function clear($type = FALSE)
{
if ($type === FALSE){
$this->_session_unset();
}
else {
$messages = $this->_session_get();
if (is_array($messages))
{
foreach($messages as $i=>$message){
if ($message->type == $type){
unset($messages[$i]);
}
... | [
"public",
"function",
"clear",
"(",
"$",
"type",
"=",
"FALSE",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"FALSE",
")",
"{",
"$",
"this",
"->",
"_session_unset",
"(",
")",
";",
"}",
"else",
"{",
"$",
"messages",
"=",
"$",
"this",
"->",
"_session_get"... | Removes messages from the list.
If $type is given, clears only messages of that type
If $type is not given, clears all messages
@param string $type type of messages to remove
@return $this | [
"Removes",
"messages",
"from",
"the",
"list",
"."
] | d1891b0439c08b2df902effde171d25e4dbc6c79 | https://github.com/jayalfredprufrock/codeigniter-messages/blob/d1891b0439c08b2df902effde171d25e4dbc6c79/libraries/messages.php#L86-L119 | train |
jayalfredprufrock/codeigniter-messages | libraries/messages.php | Messages.peek | public function peek($type = FALSE)
{
$messages = $this->_session_get();
if (!is_array($messages)){
return array();
}
if ($type === FALSE)
{
return $messages;
}
else
{
$tmessages = array();
foreach($messages as $message){
if ($message->type == $t... | php | public function peek($type = FALSE)
{
$messages = $this->_session_get();
if (!is_array($messages)){
return array();
}
if ($type === FALSE)
{
return $messages;
}
else
{
$tmessages = array();
foreach($messages as $message){
if ($message->type == $t... | [
"public",
"function",
"peek",
"(",
"$",
"type",
"=",
"FALSE",
")",
"{",
"$",
"messages",
"=",
"$",
"this",
"->",
"_session_get",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"messages",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}"... | Returns an array of messages to be displayed without removing them from the session
If $type is given, returns an array of messages of that type
If $type is not given, returns an array of all messages objects,
in the order they were added. Each message object contains two
properties, type and text.
@param string $typ... | [
"Returns",
"an",
"array",
"of",
"messages",
"to",
"be",
"displayed",
"without",
"removing",
"them",
"from",
"the",
"session"
] | d1891b0439c08b2df902effde171d25e4dbc6c79 | https://github.com/jayalfredprufrock/codeigniter-messages/blob/d1891b0439c08b2df902effde171d25e4dbc6c79/libraries/messages.php#L183-L212 | train |
shgysk8zer0/core_api | traits/fileuploads.php | FileUploads._hasFileKeys | final private static function _hasFileKeys(Array $file): Bool
{
$valid = true;
foreach(['error', 'tmp_name', 'type', 'size', 'name'] as $key) {
if (! array_key_exists($key, $file)) {
$valid = false;
break;
}
}
return $valid;
} | php | final private static function _hasFileKeys(Array $file): Bool
{
$valid = true;
foreach(['error', 'tmp_name', 'type', 'size', 'name'] as $key) {
if (! array_key_exists($key, $file)) {
$valid = false;
break;
}
}
return $valid;
} | [
"final",
"private",
"static",
"function",
"_hasFileKeys",
"(",
"Array",
"$",
"file",
")",
":",
"Bool",
"{",
"$",
"valid",
"=",
"true",
";",
"foreach",
"(",
"[",
"'error'",
",",
"'tmp_name'",
",",
"'type'",
",",
"'size'",
",",
"'name'",
"]",
"as",
"$",
... | Verifies that an array has all keys expected of a file upload
@param Array $file Array, such as from `$_FILES` to validate
@return Bool If $file has all array keys expected of an upload | [
"Verifies",
"that",
"an",
"array",
"has",
"all",
"keys",
"expected",
"of",
"a",
"file",
"upload"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/fileuploads.php#L136-L146 | train |
gplcart/cli | controllers/commands/Cart.php | Cart.cmdGetCart | public function cmdGetCart()
{
$result = $this->getListCart();
$this->outputFormat($result);
$this->outputFormatTableCart($result);
$this->output();
} | php | public function cmdGetCart()
{
$result = $this->getListCart();
$this->outputFormat($result);
$this->outputFormatTableCart($result);
$this->output();
} | [
"public",
"function",
"cmdGetCart",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getListCart",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTableCart",
"(",
"$",
"result",
")"... | Callback for "cart-get" command | [
"Callback",
"for",
"cart",
"-",
"get",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Cart.php#L40-L46 | train |
gplcart/cli | controllers/commands/Cart.php | Cart.cmdDeleteCart | public function cmdDeleteCart()
{
$id = $this->getParam(0);
$options = null;
if ($this->getParam('user')) {
$options = array('user_id' => $id);
} else if ($this->getParam('sku')) {
$options = array('sku' => $id);
} else if ($this->getParam('order')) ... | php | public function cmdDeleteCart()
{
$id = $this->getParam(0);
$options = null;
if ($this->getParam('user')) {
$options = array('user_id' => $id);
} else if ($this->getParam('sku')) {
$options = array('sku' => $id);
} else if ($this->getParam('order')) ... | [
"public",
"function",
"cmdDeleteCart",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"$",
"options",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"getParam",
"(",
"'user'",
")",
")",
"{",
"$",
"options",
"="... | Callback for "cart-delete" command | [
"Callback",
"for",
"cart",
"-",
"delete",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Cart.php#L51-L94 | train |
gplcart/cli | controllers/commands/Cart.php | Cart.getListCart | protected function getListCart()
{
$id = $this->getParam(0);
if (!isset($id)) {
return $this->cart->getList(array('limit' => $this->getLimit()));
}
if ($this->getParam('user')) {
return $this->cart->getList(array('user_id' => $id, 'limit' => $this->getLimit(... | php | protected function getListCart()
{
$id = $this->getParam(0);
if (!isset($id)) {
return $this->cart->getList(array('limit' => $this->getLimit()));
}
if ($this->getParam('user')) {
return $this->cart->getList(array('user_id' => $id, 'limit' => $this->getLimit(... | [
"protected",
"function",
"getListCart",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"id",
")",
")",
"{",
"return",
"$",
"this",
"->",
"cart",
"->",
"getList",
"(",
"array",
... | Returns an array of cart items
@return array | [
"Returns",
"an",
"array",
"of",
"cart",
"items"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Cart.php#L114-L149 | train |
gplcart/cli | controllers/commands/Cart.php | Cart.submitAddCart | protected function submitAddCart()
{
$this->setSubmitted(null, $this->getParam());
$this->setSubmittedJson('data');
$this->validateComponent('cart');
$this->addAddCart();
} | php | protected function submitAddCart()
{
$this->setSubmitted(null, $this->getParam());
$this->setSubmittedJson('data');
$this->validateComponent('cart');
$this->addAddCart();
} | [
"protected",
"function",
"submitAddCart",
"(",
")",
"{",
"$",
"this",
"->",
"setSubmitted",
"(",
"null",
",",
"$",
"this",
"->",
"getParam",
"(",
")",
")",
";",
"$",
"this",
"->",
"setSubmittedJson",
"(",
"'data'",
")",
";",
"$",
"this",
"->",
"validat... | Add a new cart item at once | [
"Add",
"a",
"new",
"cart",
"item",
"at",
"once"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Cart.php#L187-L193 | train |
gplcart/cli | controllers/commands/Cart.php | Cart.wizardAddCart | protected function wizardAddCart()
{
// Required
$this->validatePrompt('user_id', $this->text('User ID'), 'cart');
$this->validatePrompt('product_id', $this->text('Product ID'), 'cart');
$this->validatePrompt('sku', $this->text('Product SKU'), 'cart');
$this->validatePrompt('... | php | protected function wizardAddCart()
{
// Required
$this->validatePrompt('user_id', $this->text('User ID'), 'cart');
$this->validatePrompt('product_id', $this->text('Product ID'), 'cart');
$this->validatePrompt('sku', $this->text('Product SKU'), 'cart');
$this->validatePrompt('... | [
"protected",
"function",
"wizardAddCart",
"(",
")",
"{",
"// Required",
"$",
"this",
"->",
"validatePrompt",
"(",
"'user_id'",
",",
"$",
"this",
"->",
"text",
"(",
"'User ID'",
")",
",",
"'cart'",
")",
";",
"$",
"this",
"->",
"validatePrompt",
"(",
"'produ... | Add a new cart item step by step | [
"Add",
"a",
"new",
"cart",
"item",
"step",
"by",
"step"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Cart.php#L198-L214 | train |
gplcart/cli | controllers/commands/Cart.php | Cart.addAddCart | protected function addAddCart()
{
if (!$this->isError()) {
$id = $this->cart->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | php | protected function addAddCart()
{
if (!$this->isError()) {
$id = $this->cart->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | [
"protected",
"function",
"addAddCart",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isError",
"(",
")",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"cart",
"->",
"add",
"(",
"$",
"this",
"->",
"getSubmitted",
"(",
")",
")",
";",
"if",
"(... | Add a new cart item | [
"Add",
"a",
"new",
"cart",
"item"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Cart.php#L219-L228 | train |
koolkode/context | src/Scope/AbstractScopeManager.php | AbstractScopeManager.bindContext | protected function bindContext($object = NULL)
{
if($object !== NULL && !is_object($object))
{
throw new \InvalidArgumentException(sprintf('Expecting an object, given %s', gettype($object)));
}
$previous = $this->context;
$this->context = $object;
if($object === NULL)
{
$this->proxies = new \Sp... | php | protected function bindContext($object = NULL)
{
if($object !== NULL && !is_object($object))
{
throw new \InvalidArgumentException(sprintf('Expecting an object, given %s', gettype($object)));
}
$previous = $this->context;
$this->context = $object;
if($object === NULL)
{
$this->proxies = new \Sp... | [
"protected",
"function",
"bindContext",
"(",
"$",
"object",
"=",
"NULL",
")",
"{",
"if",
"(",
"$",
"object",
"!==",
"NULL",
"&&",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
... | Bind the scope to the given object.
@param object $object
@return object The previous context or NULL when the scope was not active. | [
"Bind",
"the",
"scope",
"to",
"the",
"given",
"object",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Scope/AbstractScopeManager.php#L226-L254 | train |
koolkode/context | src/Scope/AbstractScopeManager.php | AbstractScopeManager.unbindContext | protected function unbindContext($object, $terminate = true)
{
if(!is_object($object))
{
throw new \InvalidArgumentException(sprintf('Expecting an object, given %s', gettype($object)));
}
if($this->context === $object)
{
$this->context = NULL;
$this->proxies = new \SplObjectStorage();
}
if(... | php | protected function unbindContext($object, $terminate = true)
{
if(!is_object($object))
{
throw new \InvalidArgumentException(sprintf('Expecting an object, given %s', gettype($object)));
}
if($this->context === $object)
{
$this->context = NULL;
$this->proxies = new \SplObjectStorage();
}
if(... | [
"protected",
"function",
"unbindContext",
"(",
"$",
"object",
",",
"$",
"terminate",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Expecting a... | Unbind scope from the given object, will optionally destroy all contextual instances bound to the object.
@param object $object
@param boolean $terminate Clear all contextual instances?
@throws \InvalidArgumentException | [
"Unbind",
"scope",
"from",
"the",
"given",
"object",
"will",
"optionally",
"destroy",
"all",
"contextual",
"instances",
"bound",
"to",
"the",
"object",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Scope/AbstractScopeManager.php#L264-L281 | train |
koolkode/context | src/Scope/AbstractScopeManager.php | AbstractScopeManager.initializeProxy | protected function initializeProxy($typeName, callable $factory = NULL)
{
$proxyName = $this->container->loadScopedProxy($typeName);
if($factory === NULL)
{
$factory = function() {
throw new ScopeNotActiveException(sprintf('Scope "%s" is not active', $this->getScope()));
};
}
return new $prox... | php | protected function initializeProxy($typeName, callable $factory = NULL)
{
$proxyName = $this->container->loadScopedProxy($typeName);
if($factory === NULL)
{
$factory = function() {
throw new ScopeNotActiveException(sprintf('Scope "%s" is not active', $this->getScope()));
};
}
return new $prox... | [
"protected",
"function",
"initializeProxy",
"(",
"$",
"typeName",
",",
"callable",
"$",
"factory",
"=",
"NULL",
")",
"{",
"$",
"proxyName",
"=",
"$",
"this",
"->",
"container",
"->",
"loadScopedProxy",
"(",
"$",
"typeName",
")",
";",
"if",
"(",
"$",
"fac... | Create a scoped proxy for the given type.
@param string $typeName
@param callable $factory Will be called when the proxy is activated.
@return ScopedProxyInterface | [
"Create",
"a",
"scoped",
"proxy",
"for",
"the",
"given",
"type",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Scope/AbstractScopeManager.php#L290-L302 | train |
koolkode/context | src/Scope/AbstractScopeManager.php | AbstractScopeManager.bindFactoryProxy | protected function bindFactoryProxy($typeName, callable $factory)
{
$proxy = $this->initializeProxy($typeName, $factory);
$this->scopedProxies[$proxy->K2GetProxyBinding()] = $proxy;
$this->container->bindInstance($typeName, $proxy, true);
return $proxy;
} | php | protected function bindFactoryProxy($typeName, callable $factory)
{
$proxy = $this->initializeProxy($typeName, $factory);
$this->scopedProxies[$proxy->K2GetProxyBinding()] = $proxy;
$this->container->bindInstance($typeName, $proxy, true);
return $proxy;
} | [
"protected",
"function",
"bindFactoryProxy",
"(",
"$",
"typeName",
",",
"callable",
"$",
"factory",
")",
"{",
"$",
"proxy",
"=",
"$",
"this",
"->",
"initializeProxy",
"(",
"$",
"typeName",
",",
"$",
"factory",
")",
";",
"$",
"this",
"->",
"scopedProxies",
... | Creates a factory-based proxy for the target type and binds it to the DI container.
@param string $typeName
@param callable $factory
@return ScopedProxyInterface | [
"Creates",
"a",
"factory",
"-",
"based",
"proxy",
"for",
"the",
"target",
"type",
"and",
"binds",
"it",
"to",
"the",
"DI",
"container",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Scope/AbstractScopeManager.php#L311-L319 | train |
Xsaven/laravel-intelect-admin | src/Console/UninstallCommand.php | UninstallCommand.removeFilesAndDirectories | protected function removeFilesAndDirectories()
{
$this->laravel['files']->deleteDirectory(config('lia.directory'));
$this->laravel['files']->deleteDirectory(public_path('vendor/lia/'));
$this->laravel['files']->delete(config_path('lia.php'));
$this->laravel['files']->delete(config_pa... | php | protected function removeFilesAndDirectories()
{
$this->laravel['files']->deleteDirectory(config('lia.directory'));
$this->laravel['files']->deleteDirectory(public_path('vendor/lia/'));
$this->laravel['files']->delete(config_path('lia.php'));
$this->laravel['files']->delete(config_pa... | [
"protected",
"function",
"removeFilesAndDirectories",
"(",
")",
"{",
"$",
"this",
"->",
"laravel",
"[",
"'files'",
"]",
"->",
"deleteDirectory",
"(",
"config",
"(",
"'lia.directory'",
")",
")",
";",
"$",
"this",
"->",
"laravel",
"[",
"'files'",
"]",
"->",
... | Remove files and directories.
@return void | [
"Remove",
"files",
"and",
"directories",
"."
] | 592574633d12c74cf25b43dd6694fee496abefcb | https://github.com/Xsaven/laravel-intelect-admin/blob/592574633d12c74cf25b43dd6694fee496abefcb/src/Console/UninstallCommand.php#L44-L50 | train |
bkstg/schedule-bundle | EventSubscriber/ProductionMenuSubscriber.php | ProductionMenuSubscriber.addScheduleItem | public function addScheduleItem(ProductionMenuCollectionEvent $event): void
{
$menu = $event->getMenu();
$group = $event->getGroup();
// Create overview menu item.
$schedule = $this->factory->createItem('menu_item.schedule', [
'route' => 'bkstg_calendar_production',
... | php | public function addScheduleItem(ProductionMenuCollectionEvent $event): void
{
$menu = $event->getMenu();
$group = $event->getGroup();
// Create overview menu item.
$schedule = $this->factory->createItem('menu_item.schedule', [
'route' => 'bkstg_calendar_production',
... | [
"public",
"function",
"addScheduleItem",
"(",
"ProductionMenuCollectionEvent",
"$",
"event",
")",
":",
"void",
"{",
"$",
"menu",
"=",
"$",
"event",
"->",
"getMenu",
"(",
")",
";",
"$",
"group",
"=",
"$",
"event",
"->",
"getGroup",
"(",
")",
";",
"// Crea... | Add the schedule menu item.
@param ProductionMenuCollectionEvent $event The menu collection event.
@return void | [
"Add",
"the",
"schedule",
"menu",
"item",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/EventSubscriber/ProductionMenuSubscriber.php#L60-L92 | train |
inwendo/iw_client_latex_php | lib/Api/DocumentApi.php | DocumentApi.setApiClient | public function setApiClient(\Inwendo\Latex\Common\ApiClient $apiClient)
{
$this->apiClient = $apiClient;
return $this;
} | php | public function setApiClient(\Inwendo\Latex\Common\ApiClient $apiClient)
{
$this->apiClient = $apiClient;
return $this;
} | [
"public",
"function",
"setApiClient",
"(",
"\\",
"Inwendo",
"\\",
"Latex",
"\\",
"Common",
"\\",
"ApiClient",
"$",
"apiClient",
")",
"{",
"$",
"this",
"->",
"apiClient",
"=",
"$",
"apiClient",
";",
"return",
"$",
"this",
";",
"}"
] | Set the API client
@param \Inwendo\Latex\Common\ApiClient $apiClient set the API client
@return DocumentApi | [
"Set",
"the",
"API",
"client"
] | 6f24b2cf473a4981845666f20fa906994bada5c2 | https://github.com/inwendo/iw_client_latex_php/blob/6f24b2cf473a4981845666f20fa906994bada5c2/lib/Api/DocumentApi.php#L99-L103 | train |
sndsgd/sndsgd-field | src/Field.php | Field.addAliases | public function addAliases($alias)
{
foreach (func_get_args() as $alias) {
$this->aliases[$alias] = true;
}
return $this;
} | php | public function addAliases($alias)
{
foreach (func_get_args() as $alias) {
$this->aliases[$alias] = true;
}
return $this;
} | [
"public",
"function",
"addAliases",
"(",
"$",
"alias",
")",
"{",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"alias",
")",
"{",
"$",
"this",
"->",
"aliases",
"[",
"$",
"alias",
"]",
"=",
"true",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Add one or more aliases to the field
@param string $alias,...
@return \sndsgd\Field | [
"Add",
"one",
"or",
"more",
"aliases",
"to",
"the",
"field"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/Field.php#L140-L146 | train |
sndsgd/sndsgd-field | src/Field.php | Field.setExportHandler | public function setExportHandler($type)
{
if (
$type === self::EXPORT_NORMAL ||
$type === self::EXPORT_ARRAY ||
$type === self::EXPORT_SKIP ||
is_callable($type)
) {
$this->exportHandler = $type;
return $this;
}
... | php | public function setExportHandler($type)
{
if (
$type === self::EXPORT_NORMAL ||
$type === self::EXPORT_ARRAY ||
$type === self::EXPORT_SKIP ||
is_callable($type)
) {
$this->exportHandler = $type;
return $this;
}
... | [
"public",
"function",
"setExportHandler",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"self",
"::",
"EXPORT_NORMAL",
"||",
"$",
"type",
"===",
"self",
"::",
"EXPORT_ARRAY",
"||",
"$",
"type",
"===",
"self",
"::",
"EXPORT_SKIP",
"||",
"is_c... | Set the method by which to export the value
@param integer|callable $type
@return \sndsgd\Field
@throws InvalidArgumentException If $type is not valid | [
"Set",
"the",
"method",
"by",
"which",
"to",
"export",
"the",
"value"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/Field.php#L232-L250 | train |
sndsgd/sndsgd-field | src/Field.php | Field.addValue | public function addValue($value, $index = null)
{
if ($this->value === null) {
$this->value = [];
}
if ($index === null) {
$this->value[] = $value;
}
else {
$this->value[$index] = $value;
}
return $this;
} | php | public function addValue($value, $index = null)
{
if ($this->value === null) {
$this->value = [];
}
if ($index === null) {
$this->value[] = $value;
}
else {
$this->value[$index] = $value;
}
return $this;
} | [
"public",
"function",
"addValue",
"(",
"$",
"value",
",",
"$",
"index",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"value",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"[",
"]",
";",
"}",
"if",
"(",
"$",
"index",
"===",
... | Add a value
@param string|number $value The value to add
@param string|integer|null $index The value key in the values array
@return \sndsgd\Field | [
"Add",
"a",
"value"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/Field.php#L267-L281 | train |
sndsgd/sndsgd-field | src/Field.php | Field.setValue | public function setValue($value, $index = null)
{
if ($index === null) {
$this->value = Arr::cast($value);
}
else {
$this->value[$index] = $value;
}
return $this;
} | php | public function setValue($value, $index = null)
{
if ($index === null) {
$this->value = Arr::cast($value);
}
else {
$this->value[$index] = $value;
}
return $this;
} | [
"public",
"function",
"setValue",
"(",
"$",
"value",
",",
"$",
"index",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"index",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"Arr",
"::",
"cast",
"(",
"$",
"value",
")",
";",
"}",
"else",
"{"... | Set one or all values
@param string|integer|float|array<string|integer|float> $value
@param integer|null $index
@return \sndsgd\Field | [
"Set",
"one",
"or",
"all",
"values"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/Field.php#L290-L299 | train |
sndsgd/sndsgd-field | src/Field.php | Field.getValue | public function getValue($index = 0)
{
if ($index === 0 && $this->value === null) {
return $this->defaultValue;
}
return (is_array($this->value) && array_key_exists($index, $this->value))
? $this->value[$index]
: null;
} | php | public function getValue($index = 0)
{
if ($index === 0 && $this->value === null) {
return $this->defaultValue;
}
return (is_array($this->value) && array_key_exists($index, $this->value))
? $this->value[$index]
: null;
} | [
"public",
"function",
"getValue",
"(",
"$",
"index",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"index",
"===",
"0",
"&&",
"$",
"this",
"->",
"value",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"defaultValue",
";",
"}",
"return",
"(",
"is_array... | Get a single value
@param integer $index
@return number|string|null | [
"Get",
"a",
"single",
"value"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/Field.php#L318-L327 | train |
sndsgd/sndsgd-field | src/Field.php | Field.getValuesAsArray | private function getValuesAsArray()
{
if ($this->value === null) {
return is_array($this->defaultValue)
? $this->defaultValue
: [ $this->defaultValue ];
}
return $this->value;
} | php | private function getValuesAsArray()
{
if ($this->value === null) {
return is_array($this->defaultValue)
? $this->defaultValue
: [ $this->defaultValue ];
}
return $this->value;
} | [
"private",
"function",
"getValuesAsArray",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"value",
"===",
"null",
")",
"{",
"return",
"is_array",
"(",
"$",
"this",
"->",
"defaultValue",
")",
"?",
"$",
"this",
"->",
"defaultValue",
":",
"[",
"$",
"this",
... | Get all of the current values as an array of values
If no value is currently set, the default value will be returned
@return array<string|integer|float|boolean|null> | [
"Get",
"all",
"of",
"the",
"current",
"values",
"as",
"an",
"array",
"of",
"values"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/Field.php#L335-L343 | train |
sndsgd/sndsgd-field | src/Field.php | Field.addRule | public function addRule(Rule $rule)
{
$classname = $rule->getClass();
if ($this->hasRule($classname) === true) {
throw new Exception(
"failed to add rule; the field {$this->name} already has an ".
"instance of '$classname'"
);
}
... | php | public function addRule(Rule $rule)
{
$classname = $rule->getClass();
if ($this->hasRule($classname) === true) {
throw new Exception(
"failed to add rule; the field {$this->name} already has an ".
"instance of '$classname'"
);
}
... | [
"public",
"function",
"addRule",
"(",
"Rule",
"$",
"rule",
")",
"{",
"$",
"classname",
"=",
"$",
"rule",
"->",
"getClass",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasRule",
"(",
"$",
"classname",
")",
"===",
"true",
")",
"{",
"throw",
"new",
... | Add a validation rule to the field
@param \sndsgd\field\Rule $rule
@return \sndsgd\Field The field instance | [
"Add",
"a",
"validation",
"rule",
"to",
"the",
"field"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/Field.php#L381-L397 | train |
sndsgd/sndsgd-field | src/Field.php | Field.validate | public function validate(Collection $collection = null)
{
$this->errors = [];
foreach ($this->getValuesAsArray() as $index => $value) {
# skip fields with a null value if they are not required
if ($value === null && $this->hasRule(Rule::REQUIRED) === false) {
... | php | public function validate(Collection $collection = null)
{
$this->errors = [];
foreach ($this->getValuesAsArray() as $index => $value) {
# skip fields with a null value if they are not required
if ($value === null && $this->hasRule(Rule::REQUIRED) === false) {
... | [
"public",
"function",
"validate",
"(",
"Collection",
"$",
"collection",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getValuesAsArray",
"(",
")",
"as",
"$",
"index",
"=>",
"$",
"value",
"... | Validate all the values in the field
@param \sndsgd\field\Collection|null $collection A field collection
@return boolean True if all values are | [
"Validate",
"all",
"the",
"values",
"in",
"the",
"field"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/Field.php#L440-L467 | train |
TuumPHP/Web | src/Middleware/MatchRootTrait.php | MatchRootTrait.matchRoot | public function matchRoot(&$request)
{
// empty means match always.
if (empty($this->_patterns)) {
return true;
}
$path = $request->getPathToMatch();
$method = $request->getMethod();
foreach ($this->_patterns as $pattern) {
if ($matched = Mat... | php | public function matchRoot(&$request)
{
// empty means match always.
if (empty($this->_patterns)) {
return true;
}
$path = $request->getPathToMatch();
$method = $request->getMethod();
foreach ($this->_patterns as $pattern) {
if ($matched = Mat... | [
"public",
"function",
"matchRoot",
"(",
"&",
"$",
"request",
")",
"{",
"// empty means match always.",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_patterns",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"path",
"=",
"$",
"request",
"->",
"getPathToM... | check if the requested path matches with the root.
returns $request if matches, or return false if not matched
(i.e. execute the next middleware).
@param Request $request
@return bool | [
"check",
"if",
"the",
"requested",
"path",
"matches",
"with",
"the",
"root",
"."
] | 8f296b6358aa93226ce08d6cc54a309f5b0a9820 | https://github.com/TuumPHP/Web/blob/8f296b6358aa93226ce08d6cc54a309f5b0a9820/src/Middleware/MatchRootTrait.php#L42-L59 | train |
jmfeurprier/perf-caching | lib/perf/Caching/FileSystemStorage.php | FileSystemStorage.flushAll | public function flushAll()
{
$mask = '*' . self::CACHE_FILE_SUFFIX;
foreach (glob($this->basePath . $mask) as $cacheFilePath) {
if (!unlink($cacheFilePath)) {
throw new \RuntimeException("Failed to delete cache file '{$cacheFilePath}'.");
}
}
} | php | public function flushAll()
{
$mask = '*' . self::CACHE_FILE_SUFFIX;
foreach (glob($this->basePath . $mask) as $cacheFilePath) {
if (!unlink($cacheFilePath)) {
throw new \RuntimeException("Failed to delete cache file '{$cacheFilePath}'.");
}
}
} | [
"public",
"function",
"flushAll",
"(",
")",
"{",
"$",
"mask",
"=",
"'*'",
".",
"self",
"::",
"CACHE_FILE_SUFFIX",
";",
"foreach",
"(",
"glob",
"(",
"$",
"this",
"->",
"basePath",
".",
"$",
"mask",
")",
"as",
"$",
"cacheFilePath",
")",
"{",
"if",
"(",... | Deletes every cache file.
@return void
@throws \RuntimeException | [
"Deletes",
"every",
"cache",
"file",
"."
] | 16cf61dae3aa4d6dcb8722e14760934457087173 | https://github.com/jmfeurprier/perf-caching/blob/16cf61dae3aa4d6dcb8722e14760934457087173/lib/perf/Caching/FileSystemStorage.php#L114-L123 | train |
itkg/core | src/Itkg/Core/Legacy/Kernel.php | Kernel.loadRouting | protected function loadRouting()
{
$parser = new YamlParser();
$routes = array();
foreach ($this->getRoutingFiles() as $file) {
$routes = array_merge($routes, $parser->parse(file_get_contents($file)));
}
foreach ($routes as $name => $routeInfos) {
$th... | php | protected function loadRouting()
{
$parser = new YamlParser();
$routes = array();
foreach ($this->getRoutingFiles() as $file) {
$routes = array_merge($routes, $parser->parse(file_get_contents($file)));
}
foreach ($routes as $name => $routeInfos) {
$th... | [
"protected",
"function",
"loadRouting",
"(",
")",
"{",
"$",
"parser",
"=",
"new",
"YamlParser",
"(",
")",
";",
"$",
"routes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getRoutingFiles",
"(",
")",
"as",
"$",
"file",
")",
"{",
... | Load routing from routing files
@return $this | [
"Load",
"routing",
"from",
"routing",
"files"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Legacy/Kernel.php#L62-L75 | train |
itkg/core | src/Itkg/Core/Legacy/Kernel.php | Kernel.processRouteInfos | private function processRouteInfos($name, array $routeInfos)
{
$className = null;
if (isset($routeInfos['sequence'])) {
$className = $routeInfos['sequence'];
$this->container['core']['router']->addRouteSequence($className);
}
if (isset($routeInfos['pattern'])... | php | private function processRouteInfos($name, array $routeInfos)
{
$className = null;
if (isset($routeInfos['sequence'])) {
$className = $routeInfos['sequence'];
$this->container['core']['router']->addRouteSequence($className);
}
if (isset($routeInfos['pattern'])... | [
"private",
"function",
"processRouteInfos",
"(",
"$",
"name",
",",
"array",
"$",
"routeInfos",
")",
"{",
"$",
"className",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"routeInfos",
"[",
"'sequence'",
"]",
")",
")",
"{",
"$",
"className",
"=",
"$",
... | Process route infos
@param string $name
@param array $routeInfos | [
"Process",
"route",
"infos"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Legacy/Kernel.php#L83-L106 | train |
VTacius/ldapPM | src/Controlador/ldapOperations.php | ldapOperations.iterarEntradas | private function iterarEntradas($busquedaLdap, array $atributos){
$datos = array();
if (($entrada = ldap_first_entry($this->conexionLdap, $busquedaLdap))) {
do {
// Ejecutamos al menos una vez el mapeo de entradas con sus atributos, a menos
// que no haya nad... | php | private function iterarEntradas($busquedaLdap, array $atributos){
$datos = array();
if (($entrada = ldap_first_entry($this->conexionLdap, $busquedaLdap))) {
do {
// Ejecutamos al menos una vez el mapeo de entradas con sus atributos, a menos
// que no haya nad... | [
"private",
"function",
"iterarEntradas",
"(",
"$",
"busquedaLdap",
",",
"array",
"$",
"atributos",
")",
"{",
"$",
"datos",
"=",
"array",
"(",
")",
";",
"if",
"(",
"(",
"$",
"entrada",
"=",
"ldap_first_entry",
"(",
"$",
"this",
"->",
"conexionLdap",
",",
... | Auxiliar directo de busqueda. Dado un ldap result, itera por el para conseguir sus datos
@param ldap result $busquedaLdap
@param array $atributos
@return boolean | [
"Auxiliar",
"directo",
"de",
"busqueda",
".",
"Dado",
"un",
"ldap",
"result",
"itera",
"por",
"el",
"para",
"conseguir",
"sus",
"datos"
] | 728af24cd0a5ca4fbed76ffb52aa4800b118879f | https://github.com/VTacius/ldapPM/blob/728af24cd0a5ca4fbed76ffb52aa4800b118879f/src/Controlador/ldapOperations.php#L46-L58 | train |
hiqdev/minii-helpers | src/BaseInflector.php | BaseInflector.ordinalize | public static function ordinalize($number)
{
if (in_array(($number % 100), range(11, 13))) {
return $number . 'th';
}
switch ($number % 10) {
case 1:
return $number . 'st';
case 2:
return $number . 'nd';
case 3:
... | php | public static function ordinalize($number)
{
if (in_array(($number % 100), range(11, 13))) {
return $number . 'th';
}
switch ($number % 10) {
case 1:
return $number . 'st';
case 2:
return $number . 'nd';
case 3:
... | [
"public",
"static",
"function",
"ordinalize",
"(",
"$",
"number",
")",
"{",
"if",
"(",
"in_array",
"(",
"(",
"$",
"number",
"%",
"100",
")",
",",
"range",
"(",
"11",
",",
"13",
")",
")",
")",
"{",
"return",
"$",
"number",
".",
"'th'",
";",
"}",
... | Converts number to its ordinal English form. For example, converts 13 to 13th, 2 to 2nd ...
@param integer $number the number to get its ordinal value
@return string | [
"Converts",
"number",
"to",
"its",
"ordinal",
"English",
"form",
".",
"For",
"example",
"converts",
"13",
"to",
"13th",
"2",
"to",
"2nd",
"..."
] | 001b7a56a6ebdc432c4683fe47c00a913f8e57d7 | https://github.com/hiqdev/minii-helpers/blob/001b7a56a6ebdc432c4683fe47c00a913f8e57d7/src/BaseInflector.php#L475-L490 | train |
Kris-Kuiper/sFire-Framework | src/Image/Driver/GD.php | GD.pixelate | public function pixelate($blocksize = 5, $effect = 50) {
$this -> filter(IMG_FILTER_PIXELATE, $blocksize, $effect);
return $this -> image;
} | php | public function pixelate($blocksize = 5, $effect = 50) {
$this -> filter(IMG_FILTER_PIXELATE, $blocksize, $effect);
return $this -> image;
} | [
"public",
"function",
"pixelate",
"(",
"$",
"blocksize",
"=",
"5",
",",
"$",
"effect",
"=",
"50",
")",
"{",
"$",
"this",
"->",
"filter",
"(",
"IMG_FILTER_PIXELATE",
",",
"$",
"blocksize",
",",
"$",
"effect",
")",
";",
"return",
"$",
"this",
"->",
"im... | Give current image a pixelate filter
@param int $blocksize
@param int $effect
@return resource | [
"Give",
"current",
"image",
"a",
"pixelate",
"filter"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Image/Driver/GD.php#L274-L278 | train |
Kris-Kuiper/sFire-Framework | src/Image/Driver/GD.php | GD.createImage | private function createImage($x, $y, $width, $height, $new_width, $new_height, $interlace = false) {
$resource = imagecreatetruecolor($new_width, $new_height);
if(false === imagesavealpha($resource, true)) {
trigger_error('Could not set the flag to save full alpha channel', E_USER_ERROR);
}
if(fal... | php | private function createImage($x, $y, $width, $height, $new_width, $new_height, $interlace = false) {
$resource = imagecreatetruecolor($new_width, $new_height);
if(false === imagesavealpha($resource, true)) {
trigger_error('Could not set the flag to save full alpha channel', E_USER_ERROR);
}
if(fal... | [
"private",
"function",
"createImage",
"(",
"$",
"x",
",",
"$",
"y",
",",
"$",
"width",
",",
"$",
"height",
",",
"$",
"new_width",
",",
"$",
"new_height",
",",
"$",
"interlace",
"=",
"false",
")",
"{",
"$",
"resource",
"=",
"imagecreatetruecolor",
"(",
... | Creates new image resource. Returns false if failed.
@param int $x
@param int $y
@param int $width
@param int $height
@param int $new_width
@param int $new_height
@param boolean $interlace
@return resource|boolean | [
"Creates",
"new",
"image",
"resource",
".",
"Returns",
"false",
"if",
"failed",
"."
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Image/Driver/GD.php#L385-L412 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.substring | public function substring ()
{
$start = $this->getParameter('start');
$length = $this->getParameter('length');
if (empty($start))
$start = 0;
if (empty($length))
$length = strlen($this->getParameter('value')) - (int)$start;
$str = substr($this->get... | php | public function substring ()
{
$start = $this->getParameter('start');
$length = $this->getParameter('length');
if (empty($start))
$start = 0;
if (empty($length))
$length = strlen($this->getParameter('value')) - (int)$start;
$str = substr($this->get... | [
"public",
"function",
"substring",
"(",
")",
"{",
"$",
"start",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'start'",
")",
";",
"$",
"length",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'length'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"start",... | Returns a substring from param 'value'. Returns the 1st letter if only 'value' is specified
Expected Params:
value string the string to operate upon
start integer (optional) the starting point for our substring, default 0
length integer (optional) the length of the substring. default 1
@return string | [
"Returns",
"a",
"substring",
"from",
"param",
"value",
".",
"Returns",
"the",
"1st",
"letter",
"if",
"only",
"value",
"is",
"specified"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L110-L124 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.showVars | public function showVars()
{
$what = $this->getParameter('scope');
switch ( $what ) {
case 'global':
case 'globals':
case 'system':
case 'systems':
$debug = $this->getGlobals();
break;
default:
... | php | public function showVars()
{
$what = $this->getParameter('scope');
switch ( $what ) {
case 'global':
case 'globals':
case 'system':
case 'systems':
$debug = $this->getGlobals();
break;
default:
... | [
"public",
"function",
"showVars",
"(",
")",
"{",
"$",
"what",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'scope'",
")",
";",
"switch",
"(",
"$",
"what",
")",
"{",
"case",
"'global'",
":",
"case",
"'globals'",
":",
"case",
"'system'",
":",
"case",
... | Returns debuggging information about the current vars
Expected Params:
scope string (optional) If set to 'globals', then dump the globals. Otherwise dump the locals.
@return string | [
"Returns",
"debuggging",
"information",
"about",
"the",
"current",
"vars"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L134-L151 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.htmlEscape | public function htmlEscape()
{
if ($this->getParameter('value') == null)
return;
return str_replace('%', '%', htmlentities($this->getParameter('value'), ENT_QUOTES, 'UTF-8', false));
} | php | public function htmlEscape()
{
if ($this->getParameter('value') == null)
return;
return str_replace('%', '%', htmlentities($this->getParameter('value'), ENT_QUOTES, 'UTF-8', false));
} | [
"public",
"function",
"htmlEscape",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
"==",
"null",
")",
"return",
";",
"return",
"str_replace",
"(",
"'%'",
",",
"'%'",
",",
"htmlentities",
"(",
"$",
"this",
"->",
"g... | HTML-Escapes the specified parameter.
Converts all html chars into their entities equivalent
Expected Param:
value string
@return string | [
"HTML",
"-",
"Escapes",
"the",
"specified",
"parameter",
".",
"Converts",
"all",
"html",
"chars",
"into",
"their",
"entities",
"equivalent"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L213-L219 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.strReplace | function strReplace()
{
if (($this->getParameter('needle') == null) || ($this->getParameter('haystack') == null))
return $this->getParameter('haystack');
$needle = $this->getParameter('needle');
if($needle == '\n')
$needle = "\n";
return str_replace($needle,... | php | function strReplace()
{
if (($this->getParameter('needle') == null) || ($this->getParameter('haystack') == null))
return $this->getParameter('haystack');
$needle = $this->getParameter('needle');
if($needle == '\n')
$needle = "\n";
return str_replace($needle,... | [
"function",
"strReplace",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'needle'",
")",
"==",
"null",
")",
"||",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'haystack'",
")",
"==",
"null",
")",
")",
"return",
"$",
"this",
... | Performs a string replace on the specified param
Expected Params:
needle string The item to search for
haystack string The string to look in
replace string The string to replace the found text with
@return string | [
"Performs",
"a",
"string",
"replace",
"on",
"the",
"specified",
"param"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L247-L257 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.pregReplace | public function pregReplace()
{
if ($this->getParameter('pattern') == null)
return $this->getParameter('subject');
return preg_replace($this->getParameter('pattern'), $this->getParameter('replace'), $this->getParameter('subject'));
} | php | public function pregReplace()
{
if ($this->getParameter('pattern') == null)
return $this->getParameter('subject');
return preg_replace($this->getParameter('pattern'), $this->getParameter('replace'), $this->getParameter('subject'));
} | [
"public",
"function",
"pregReplace",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'pattern'",
")",
"==",
"null",
")",
"return",
"$",
"this",
"->",
"getParameter",
"(",
"'subject'",
")",
";",
"return",
"preg_replace",
"(",
"$",
"this... | Performs a regular expression search and replace
Expected Params:
pattern regex The regular expression used to locate the text to replace
subject string The string to look at
replace string The text to replace the found items with
@return string | [
"Performs",
"a",
"regular",
"expression",
"search",
"and",
"replace"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L269-L274 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.firstLetter | protected function firstLetter()
{
$string = trim((string) $this->getParameter('string'));
$lower = (boolean) $this->getParameter('lower');
return StringUtils::firstLetter($string, $lower);
} | php | protected function firstLetter()
{
$string = trim((string) $this->getParameter('string'));
$lower = (boolean) $this->getParameter('lower');
return StringUtils::firstLetter($string, $lower);
} | [
"protected",
"function",
"firstLetter",
"(",
")",
"{",
"$",
"string",
"=",
"trim",
"(",
"(",
"string",
")",
"$",
"this",
"->",
"getParameter",
"(",
"'string'",
")",
")",
";",
"$",
"lower",
"=",
"(",
"boolean",
")",
"$",
"this",
"->",
"getParameter",
... | Return the first character from a string.
Expected Params:
string string
lower boolean return string in lower case. defaults to false
@return string | [
"Return",
"the",
"first",
"character",
"from",
"a",
"string",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L285-L290 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.trim | public function trim()
{
return StringUtils::trim(
$this->getParameter('value'),
$this->getParameter('len'),
$this->getParameter('keeptags'),
$this->getParameter('decodehtml'),
$this->getParameter('stripurls'));
} | php | public function trim()
{
return StringUtils::trim(
$this->getParameter('value'),
$this->getParameter('len'),
$this->getParameter('keeptags'),
$this->getParameter('decodehtml'),
$this->getParameter('stripurls'));
} | [
"public",
"function",
"trim",
"(",
")",
"{",
"return",
"StringUtils",
"::",
"trim",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
",",
"$",
"this",
"->",
"getParameter",
"(",
"'len'",
")",
",",
"$",
"this",
"->",
"getParameter",
"(",
"'k... | Trims a string to a specified length.
It will allow tags listed in 'KeepTags' to remain and will intelligently
append the trimmed text with '...' or '-' depending on if the trim ends on a word or a space.
Expected Params:
len integer The length to trim the string to
value string The string to trim
KeepTags st... | [
"Trims",
"a",
"string",
"to",
"a",
"specified",
"length",
".",
"It",
"will",
"allow",
"tags",
"listed",
"in",
"KeepTags",
"to",
"remain",
"and",
"will",
"intelligently",
"append",
"the",
"trimmed",
"text",
"with",
"...",
"or",
"-",
"depending",
"on",
"if",... | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L319-L327 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.wordCount | public function wordCount()
{
$count = 0;
foreach ($this->getParameters() as $value)
$count += str_word_count(strip_tags($value));
return $count;
} | php | public function wordCount()
{
$count = 0;
foreach ($this->getParameters() as $value)
$count += str_word_count(strip_tags($value));
return $count;
} | [
"public",
"function",
"wordCount",
"(",
")",
"{",
"$",
"count",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"getParameters",
"(",
")",
"as",
"$",
"value",
")",
"$",
"count",
"+=",
"str_word_count",
"(",
"strip_tags",
"(",
"$",
"value",
")",
")"... | Returns the total count of all words in all params passed
@return integer | [
"Returns",
"the",
"total",
"count",
"of",
"all",
"words",
"in",
"all",
"params",
"passed"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L373-L381 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.charCount | public function charCount()
{
$count = 0;
foreach ($this->getParameters() as $value)
$count += strlen(strip_tags($value));
return $count;
} | php | public function charCount()
{
$count = 0;
foreach ($this->getParameters() as $value)
$count += strlen(strip_tags($value));
return $count;
} | [
"public",
"function",
"charCount",
"(",
")",
"{",
"$",
"count",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"getParameters",
"(",
")",
"as",
"$",
"value",
")",
"$",
"count",
"+=",
"strlen",
"(",
"strip_tags",
"(",
"$",
"value",
")",
")",
";",... | Returns the total count of all characters in all params passed
@return integer | [
"Returns",
"the",
"total",
"count",
"of",
"all",
"characters",
"in",
"all",
"params",
"passed"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L388-L396 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.pluralize | public function pluralize()
{
if($this->getParameter('upperCaseFirst') == 'true')
return ucfirst(StringUtils::pluralize($this->getParameter('value')));
return StringUtils::pluralize($this->getParameter('value'));
} | php | public function pluralize()
{
if($this->getParameter('upperCaseFirst') == 'true')
return ucfirst(StringUtils::pluralize($this->getParameter('value')));
return StringUtils::pluralize($this->getParameter('value'));
} | [
"public",
"function",
"pluralize",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'upperCaseFirst'",
")",
"==",
"'true'",
")",
"return",
"ucfirst",
"(",
"StringUtils",
"::",
"pluralize",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'va... | Returns the plural version of the parameter in 'value'
Expected Params:
value string the string to pluralize
upperCaseFirst string if set to 'true' then the result string will be Capitalized
@return string | [
"Returns",
"the",
"plural",
"version",
"of",
"the",
"parameter",
"in",
"value"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L457-L463 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.repeat | public function repeat()
{
if ($this->getParameter('value') == null)
return;
$value = $this->getParameter('value');
$multiplier = $this->getParameter('multiplier');
$offset = $this->getParameter('offset');
return str_repeat($value, (int)$multiplier + (int)$offset... | php | public function repeat()
{
if ($this->getParameter('value') == null)
return;
$value = $this->getParameter('value');
$multiplier = $this->getParameter('multiplier');
$offset = $this->getParameter('offset');
return str_repeat($value, (int)$multiplier + (int)$offset... | [
"public",
"function",
"repeat",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
"==",
"null",
")",
"return",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
";",
"$",
"multiplier",
"="... | Returns the supplied snippet repeated X times
Expected Params:
value string the string to repeat
multiplier int the number of times to repeat the value
@return string | [
"Returns",
"the",
"supplied",
"snippet",
"repeated",
"X",
"times"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L483-L492 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.implode | public function implode()
{
if (!is_array($this->getParameter('value'))) {
return $this->getParameter('value');
}
$glue = $this->getParameter('glue');
if ($glue === null) {
$glue = ' ';
}
return implode($glue, $this->getParameter('value'... | php | public function implode()
{
if (!is_array($this->getParameter('value'))) {
return $this->getParameter('value');
}
$glue = $this->getParameter('glue');
if ($glue === null) {
$glue = ' ';
}
return implode($glue, $this->getParameter('value'... | [
"public",
"function",
"implode",
"(",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
";",
"}",
"$",
"glue",
"=",
"$... | Implode Array to String
@return string | [
"Implode",
"Array",
"to",
"String"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L528-L541 | train |
Vectrex/vxPHP | src/Orm/Query.php | Query.sortBy | public function sortBy($columnName, $asc = TRUE) {
$sort = new \stdClass();
$sort->column = $columnName;
$sort->asc = !!$asc;
$this->columnSorts[] = $sort;
return $this;
} | php | public function sortBy($columnName, $asc = TRUE) {
$sort = new \stdClass();
$sort->column = $columnName;
$sort->asc = !!$asc;
$this->columnSorts[] = $sort;
return $this;
} | [
"public",
"function",
"sortBy",
"(",
"$",
"columnName",
",",
"$",
"asc",
"=",
"TRUE",
")",
"{",
"$",
"sort",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"sort",
"->",
"column",
"=",
"$",
"columnName",
";",
"$",
"sort",
"->",
"asc",
"=",
"!"... | add ORDER BY clause
@param string $columnName
@param boolean $asc
@return \vxPHP\Orm\Query | [
"add",
"ORDER",
"BY",
"clause"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Orm/Query.php#L128-L139 | train |
Vectrex/vxPHP | src/Orm/Query.php | Query.buildQueryString | protected function buildQueryString() {
$w = [];
$s = [];
$qc = $this->quoteChar;
// start SQL statement
$this->sql = 'SELECT ';
// add columns
if(!$this->columns || !count($this->columns)) {
$this->sql .= '*';
}
else {
$this->sql .= $qc . str_replace('.', $qc . '.' . $qc, implode($qc ... | php | protected function buildQueryString() {
$w = [];
$s = [];
$qc = $this->quoteChar;
// start SQL statement
$this->sql = 'SELECT ';
// add columns
if(!$this->columns || !count($this->columns)) {
$this->sql .= '*';
}
else {
$this->sql .= $qc . str_replace('.', $qc . '.' . $qc, implode($qc ... | [
"protected",
"function",
"buildQueryString",
"(",
")",
"{",
"$",
"w",
"=",
"[",
"]",
";",
"$",
"s",
"=",
"[",
"]",
";",
"$",
"qc",
"=",
"$",
"this",
"->",
"quoteChar",
";",
"// start SQL statement",
"$",
"this",
"->",
"sql",
"=",
"'SELECT '",
";",
... | builds query string by parsing WHERE and ORDER BY clauses
@todo column names are currently masked in MySQL style
@todo incomplete masking (e.g. ON clauses) | [
"builds",
"query",
"string",
"by",
"parsing",
"WHERE",
"and",
"ORDER",
"BY",
"clauses"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Orm/Query.php#L225-L308 | train |
Vectrex/vxPHP | src/Orm/Query.php | Query.buildValuesArray | protected function buildValuesArray() {
foreach($this->whereClauses as $where) {
if(is_null($where->value)) {
continue;
}
if(is_array($where->value)) {
$this->valuesToBind = array_merge($this->valuesToBind, $where->value);
}
else {
$this->valuesToBind[] = $where->value;
}
}
} | php | protected function buildValuesArray() {
foreach($this->whereClauses as $where) {
if(is_null($where->value)) {
continue;
}
if(is_array($where->value)) {
$this->valuesToBind = array_merge($this->valuesToBind, $where->value);
}
else {
$this->valuesToBind[] = $where->value;
}
}
} | [
"protected",
"function",
"buildValuesArray",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"whereClauses",
"as",
"$",
"where",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"where",
"->",
"value",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"is_a... | prepares array containing values which must be bound to prepared statement | [
"prepares",
"array",
"containing",
"values",
"which",
"must",
"be",
"bound",
"to",
"prepared",
"statement"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Orm/Query.php#L313-L329 | train |
Vectrex/vxPHP | src/Orm/Query.php | Query.executeQuery | protected function executeQuery() {
$this->lastQuerySql = $this->sql;
return $this->dbConnection->doPreparedQuery($this->sql, $this->valuesToBind);
} | php | protected function executeQuery() {
$this->lastQuerySql = $this->sql;
return $this->dbConnection->doPreparedQuery($this->sql, $this->valuesToBind);
} | [
"protected",
"function",
"executeQuery",
"(",
")",
"{",
"$",
"this",
"->",
"lastQuerySql",
"=",
"$",
"this",
"->",
"sql",
";",
"return",
"$",
"this",
"->",
"dbConnection",
"->",
"doPreparedQuery",
"(",
"$",
"this",
"->",
"sql",
",",
"$",
"this",
"->",
... | bind values and execute the SQL statement
returns array of records
@todo caching/do not prepare statement again, if query hasn't changed
@return array | [
"bind",
"values",
"and",
"execute",
"the",
"SQL",
"statement",
"returns",
"array",
"of",
"records"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Orm/Query.php#L339-L344 | train |
moaction/jsonrpc-common | src/Moaction/Jsonrpc/Common/Error.php | Error.fromArray | public static function fromArray(array $data)
{
return new self(
!empty($data['code']) ? $data['code'] : null,
!empty($data['message']) ? $data['message'] : null,
!empty($data['data']) ? $data['data'] : null
);
} | php | public static function fromArray(array $data)
{
return new self(
!empty($data['code']) ? $data['code'] : null,
!empty($data['message']) ? $data['message'] : null,
!empty($data['data']) ? $data['data'] : null
);
} | [
"public",
"static",
"function",
"fromArray",
"(",
"array",
"$",
"data",
")",
"{",
"return",
"new",
"self",
"(",
"!",
"empty",
"(",
"$",
"data",
"[",
"'code'",
"]",
")",
"?",
"$",
"data",
"[",
"'code'",
"]",
":",
"null",
",",
"!",
"empty",
"(",
"$... | Create object from array
@param array $data
@return self | [
"Create",
"object",
"from",
"array"
] | 05692a2c58d647f20f11b6f7b9568c8fff2d5f8c | https://github.com/moaction/jsonrpc-common/blob/05692a2c58d647f20f11b6f7b9568c8fff2d5f8c/src/Moaction/Jsonrpc/Common/Error.php#L97-L104 | train |
moaction/jsonrpc-common | src/Moaction/Jsonrpc/Common/Error.php | Error.toArray | public function toArray()
{
$error = array(
'code' => $this->getCode(),
'message' => $this->getMessage(),
);
if ($this->getData()) {
$error['data'] = $this->getData();
}
return $error;
} | php | public function toArray()
{
$error = array(
'code' => $this->getCode(),
'message' => $this->getMessage(),
);
if ($this->getData()) {
$error['data'] = $this->getData();
}
return $error;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"error",
"=",
"array",
"(",
"'code'",
"=>",
"$",
"this",
"->",
"getCode",
"(",
")",
",",
"'message'",
"=>",
"$",
"this",
"->",
"getMessage",
"(",
")",
",",
")",
";",
"if",
"(",
"$",
"this",
"->... | Transform object to array
@return array | [
"Transform",
"object",
"to",
"array"
] | 05692a2c58d647f20f11b6f7b9568c8fff2d5f8c | https://github.com/moaction/jsonrpc-common/blob/05692a2c58d647f20f11b6f7b9568c8fff2d5f8c/src/Moaction/Jsonrpc/Common/Error.php#L111-L123 | train |
moaction/jsonrpc-common | src/Moaction/Jsonrpc/Common/Error.php | Error.getMessageString | public function getMessageString($errorCode)
{
return isset($this->errorMessages[$errorCode]) ? $this->errorMessages[$errorCode] : null;
} | php | public function getMessageString($errorCode)
{
return isset($this->errorMessages[$errorCode]) ? $this->errorMessages[$errorCode] : null;
} | [
"public",
"function",
"getMessageString",
"(",
"$",
"errorCode",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"errorMessages",
"[",
"$",
"errorCode",
"]",
")",
"?",
"$",
"this",
"->",
"errorMessages",
"[",
"$",
"errorCode",
"]",
":",
"null",
";",... | Return message string by code
@param $errorCode
@return string|null | [
"Return",
"message",
"string",
"by",
"code"
] | 05692a2c58d647f20f11b6f7b9568c8fff2d5f8c | https://github.com/moaction/jsonrpc-common/blob/05692a2c58d647f20f11b6f7b9568c8fff2d5f8c/src/Moaction/Jsonrpc/Common/Error.php#L131-L134 | train |
squareproton/Bond | src/Bond/BackTrace.php | BackTrace.getSane | public function getSane( $shift = 1, $limitOrFilter = null )
{
$backtrace = $this->trace;
while( $shift-- > 0 ) {
array_shift( $backtrace );
}
if( is_numeric( $limitOrFilter ) ){
$backtrace = array_slice( $backtrace, 0, (int) $limitOrFilter );
... | php | public function getSane( $shift = 1, $limitOrFilter = null )
{
$backtrace = $this->trace;
while( $shift-- > 0 ) {
array_shift( $backtrace );
}
if( is_numeric( $limitOrFilter ) ){
$backtrace = array_slice( $backtrace, 0, (int) $limitOrFilter );
... | [
"public",
"function",
"getSane",
"(",
"$",
"shift",
"=",
"1",
",",
"$",
"limitOrFilter",
"=",
"null",
")",
"{",
"$",
"backtrace",
"=",
"$",
"this",
"->",
"trace",
";",
"while",
"(",
"$",
"shift",
"--",
">",
"0",
")",
"{",
"array_shift",
"(",
"$",
... | Shift trace, filter as required and fix the arguments object
@return array | [
"Shift",
"trace",
"filter",
"as",
"required",
"and",
"fix",
"the",
"arguments",
"object"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/BackTrace.php#L76-L112 | train |
squareproton/Bond | src/Bond/BackTrace.php | BackTrace.traceComponentMakeSane | private function traceComponentMakeSane( $trace )
{
// debugging wondering why some traces's don't have a args object set
if( isset( $trace['args'] ) ) {
$trace['args'] = array_map(
function($arg){
switch(true) {
case is_object(... | php | private function traceComponentMakeSane( $trace )
{
// debugging wondering why some traces's don't have a args object set
if( isset( $trace['args'] ) ) {
$trace['args'] = array_map(
function($arg){
switch(true) {
case is_object(... | [
"private",
"function",
"traceComponentMakeSane",
"(",
"$",
"trace",
")",
"{",
"// debugging wondering why some traces's don't have a args object set",
"if",
"(",
"isset",
"(",
"$",
"trace",
"[",
"'args'",
"]",
")",
")",
"{",
"$",
"trace",
"[",
"'args'",
"]",
"=",
... | Format a trace into a more managable output when massive objects are involved
@param array $trace
@return array | [
"Format",
"a",
"trace",
"into",
"a",
"more",
"managable",
"output",
"when",
"massive",
"objects",
"are",
"involved"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/BackTrace.php#L119-L167 | train |
net-tools/core | src/Containers/Pool.php | Pool.release | public function release($item)
{
// search the item in the used items array
$k = array_search($item, $this->_inUseItems);
if ( $k === FALSE )
return;
// remove it from the used items and adding it to the pool
unset($this->_inUseItems[$k]);
$this->_poolItems[] = $item;
} | php | public function release($item)
{
// search the item in the used items array
$k = array_search($item, $this->_inUseItems);
if ( $k === FALSE )
return;
// remove it from the used items and adding it to the pool
unset($this->_inUseItems[$k]);
$this->_poolItems[] = $item;
} | [
"public",
"function",
"release",
"(",
"$",
"item",
")",
"{",
"// search the item in the used items array",
"$",
"k",
"=",
"array_search",
"(",
"$",
"item",
",",
"$",
"this",
"->",
"_inUseItems",
")",
";",
"if",
"(",
"$",
"k",
"===",
"FALSE",
")",
"return",... | Free an item, and replace it in the pool
@param object $item Item to release and replace in the pool | [
"Free",
"an",
"item",
"and",
"replace",
"it",
"in",
"the",
"pool"
] | 51446641cee22c0cf53d2b409c76cc8bd1a187e7 | https://github.com/net-tools/core/blob/51446641cee22c0cf53d2b409c76cc8bd1a187e7/src/Containers/Pool.php#L98-L108 | train |
phossa/phossa-logger | src/Phossa/Logger/LogLevel.php | LogLevel.getLevelCode | public static function getLevelCode(
/*# string */ $level
)/*# : int */ {
if (is_string($level) &&
isset(self::$levels[$level])) {
return self::$levels[$level];
}
throw new Exception\InvalidArgumentException(
Message::get(
Message:... | php | public static function getLevelCode(
/*# string */ $level
)/*# : int */ {
if (is_string($level) &&
isset(self::$levels[$level])) {
return self::$levels[$level];
}
throw new Exception\InvalidArgumentException(
Message::get(
Message:... | [
"public",
"static",
"function",
"getLevelCode",
"(",
"/*# string */",
"$",
"level",
")",
"/*# : int */",
"{",
"if",
"(",
"is_string",
"(",
"$",
"level",
")",
"&&",
"isset",
"(",
"self",
"::",
"$",
"levels",
"[",
"$",
"level",
"]",
")",
")",
"{",
"retur... | Get level code by name
@param string $level level name
@return int
@access public
@throws Exception\InvalidArgumentException
if $throwException and not the right level name
@static
@api | [
"Get",
"level",
"code",
"by",
"name"
] | dfec8a1e6015c66d2aa77134077902fd3d49e41d | https://github.com/phossa/phossa-logger/blob/dfec8a1e6015c66d2aa77134077902fd3d49e41d/src/Phossa/Logger/LogLevel.php#L63-L78 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/klarnacalc.php | KlarnaCalc._irr | private static function _irr($pval, $payarray, $fromdayone)
{
$low = 0.0;
$high = 100.0;
$lowval = self::_npv($pval, $payarray, $low, $fromdayone);
$highval = self::_npv($pval, $payarray, $high, $fromdayone);
// The sum of $payarray is smaller than $pval, impossible!
... | php | private static function _irr($pval, $payarray, $fromdayone)
{
$low = 0.0;
$high = 100.0;
$lowval = self::_npv($pval, $payarray, $low, $fromdayone);
$highval = self::_npv($pval, $payarray, $high, $fromdayone);
// The sum of $payarray is smaller than $pval, impossible!
... | [
"private",
"static",
"function",
"_irr",
"(",
"$",
"pval",
",",
"$",
"payarray",
",",
"$",
"fromdayone",
")",
"{",
"$",
"low",
"=",
"0.0",
";",
"$",
"high",
"=",
"100.0",
";",
"$",
"lowval",
"=",
"self",
"::",
"_npv",
"(",
"$",
"pval",
",",
"$",
... | This function uses divide and conquer to numerically find the IRR,
Internal Rate of Return. It starts of by trying a low of 0% and a
high of 100%. If this isn't enough it will double the interval up
to 1000000%. Note that this is insanely high, and if you try to convert
an IRR that high to an APR you will get even more... | [
"This",
"function",
"uses",
"divide",
"and",
"conquer",
"to",
"numerically",
"find",
"the",
"IRR",
"Internal",
"Rate",
"of",
"Return",
".",
"It",
"starts",
"of",
"by",
"trying",
"a",
"low",
"of",
"0%",
"and",
"a",
"high",
"of",
"100%",
".",
"If",
"this... | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/klarnacalc.php#L114-L153 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/klarnacalc.php | KlarnaCalc._fulpacc | private static function _fulpacc(
$pval, $rate, $fee, $minpay, $payment, $months, $base
) {
$bal = $pval;
$payarray = array();
while (($months != 0) && ($bal > self::$accuracy)) {
$interest = $bal * $rate / (100.0 * 12);
$newbal = $bal + $interest + $fee;
... | php | private static function _fulpacc(
$pval, $rate, $fee, $minpay, $payment, $months, $base
) {
$bal = $pval;
$payarray = array();
while (($months != 0) && ($bal > self::$accuracy)) {
$interest = $bal * $rate / (100.0 * 12);
$newbal = $bal + $interest + $fee;
... | [
"private",
"static",
"function",
"_fulpacc",
"(",
"$",
"pval",
",",
"$",
"rate",
",",
"$",
"fee",
",",
"$",
"minpay",
",",
"$",
"payment",
",",
"$",
"months",
",",
"$",
"base",
")",
"{",
"$",
"bal",
"=",
"$",
"pval",
";",
"$",
"payarray",
"=",
... | This is a simplified model of how our paccengine works if
a client always pays their bills. It adds interest and fees
and checks minimum payments. It will run until the value
of the account reaches 0, and return an array of all the
individual payments. Months is the amount of months to run
the simulation. Important! Do... | [
"This",
"is",
"a",
"simplified",
"model",
"of",
"how",
"our",
"paccengine",
"works",
"if",
"a",
"client",
"always",
"pays",
"their",
"bills",
".",
"It",
"adds",
"interest",
"and",
"fees",
"and",
"checks",
"minimum",
"payments",
".",
"It",
"will",
"run",
... | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/klarnacalc.php#L209-L234 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/klarnacalc.php | KlarnaCalc._aprAnnuity | private static function _aprAnnuity($pval, $months, $rate, $fee, $minpay)
{
$payment = self::_annuity($pval, $months, $rate) + $fee;
if ($payment < 0) {
return $payment;
}
$payarray = self::_fulpacc(
$pval, $rate, $fee, $minpay, $payment, $months, false
... | php | private static function _aprAnnuity($pval, $months, $rate, $fee, $minpay)
{
$payment = self::_annuity($pval, $months, $rate) + $fee;
if ($payment < 0) {
return $payment;
}
$payarray = self::_fulpacc(
$pval, $rate, $fee, $minpay, $payment, $months, false
... | [
"private",
"static",
"function",
"_aprAnnuity",
"(",
"$",
"pval",
",",
"$",
"months",
",",
"$",
"rate",
",",
"$",
"fee",
",",
"$",
"minpay",
")",
"{",
"$",
"payment",
"=",
"self",
"::",
"_annuity",
"(",
"$",
"pval",
",",
"$",
"months",
",",
"$",
... | Calculate the APR for an annuity given the following inputs.
If you give it bad inputs, it will return negative values.
@param float $pval principal value
@param int $months months to pay off in
@param float $rate interest rate in % as before
@param float $fee monthly fee
@param float $minpay minimum payment... | [
"Calculate",
"the",
"APR",
"for",
"an",
"annuity",
"given",
"the",
"following",
"inputs",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/klarnacalc.php#L278-L290 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/klarnacalc.php | KlarnaCalc._getPayArray | private static function _getPayArray($sum, $pclass, $flags)
{
$monthsfee = 0;
if ($flags === KlarnaFlags::CHECKOUT_PAGE) {
$monthsfee = $pclass->getInvoiceFee();
}
$startfee = 0;
if ($flags === KlarnaFlags::CHECKOUT_PAGE) {
$startfee = $pclass->getStar... | php | private static function _getPayArray($sum, $pclass, $flags)
{
$monthsfee = 0;
if ($flags === KlarnaFlags::CHECKOUT_PAGE) {
$monthsfee = $pclass->getInvoiceFee();
}
$startfee = 0;
if ($flags === KlarnaFlags::CHECKOUT_PAGE) {
$startfee = $pclass->getStar... | [
"private",
"static",
"function",
"_getPayArray",
"(",
"$",
"sum",
",",
"$",
"pclass",
",",
"$",
"flags",
")",
"{",
"$",
"monthsfee",
"=",
"0",
";",
"if",
"(",
"$",
"flags",
"===",
"KlarnaFlags",
"::",
"CHECKOUT_PAGE",
")",
"{",
"$",
"monthsfee",
"=",
... | Grabs the array of all monthly payments for specified PClass.
<b>Flags can be either</b>:<br>
{@link KlarnaFlags::CHECKOUT_PAGE}<br>
{@link KlarnaFlags::PRODUCT_PAGE}<br>
@param float $sum The sum for the order/product.
@param KlarnaPClass $pclass KlarnaPClass used to calculate the APR.
@param int ... | [
"Grabs",
"the",
"array",
"of",
"all",
"monthly",
"payments",
"for",
"specified",
"PClass",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/klarnacalc.php#L306-L347 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/klarnacalc.php | KlarnaCalc.pRound | public static function pRound($value, $country)
{
$multiply = 1; //Round to closest integer
$country = KlarnaCountry::getCode($country);
switch($country) {
case "FI":
case "DE":
case "NL":
case "AT":
$multiply = 10; //Round to closest decimal
... | php | public static function pRound($value, $country)
{
$multiply = 1; //Round to closest integer
$country = KlarnaCountry::getCode($country);
switch($country) {
case "FI":
case "DE":
case "NL":
case "AT":
$multiply = 10; //Round to closest decimal
... | [
"public",
"static",
"function",
"pRound",
"(",
"$",
"value",
",",
"$",
"country",
")",
"{",
"$",
"multiply",
"=",
"1",
";",
"//Round to closest integer",
"$",
"country",
"=",
"KlarnaCountry",
"::",
"getCode",
"(",
"$",
"country",
")",
";",
"switch",
"(",
... | Rounds a value depending on the specified country.
@param int|float $value The value to be rounded.
@param int $country KlarnaCountry constant.
@return float|int | [
"Rounds",
"a",
"value",
"depending",
"on",
"the",
"specified",
"country",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/klarnacalc.php#L638-L652 | train |
mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.where | public function where($field, $value, $comparison = '==', $logical = 'and')
{
$this->conditions[] = [$field, $value, $comparison, $logical];
return $this;
} | php | public function where($field, $value, $comparison = '==', $logical = 'and')
{
$this->conditions[] = [$field, $value, $comparison, $logical];
return $this;
} | [
"public",
"function",
"where",
"(",
"$",
"field",
",",
"$",
"value",
",",
"$",
"comparison",
"=",
"'=='",
",",
"$",
"logical",
"=",
"'and'",
")",
"{",
"$",
"this",
"->",
"conditions",
"[",
"]",
"=",
"[",
"$",
"field",
",",
"$",
"value",
",",
"$",... | Adds where condition to relation
@param mixed $field
@param mixed $value
@param string $comparison
@param string $logical
@return $this | [
"Adds",
"where",
"condition",
"to",
"relation"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L116-L121 | train |
mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.buildLocalKey | protected function buildLocalKey($entity, array $pairs)
{
$keys = array_keys($pairs);
return $this->buildKey($entity, array_combine($keys, $keys));
} | php | protected function buildLocalKey($entity, array $pairs)
{
$keys = array_keys($pairs);
return $this->buildKey($entity, array_combine($keys, $keys));
} | [
"protected",
"function",
"buildLocalKey",
"(",
"$",
"entity",
",",
"array",
"$",
"pairs",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"pairs",
")",
";",
"return",
"$",
"this",
"->",
"buildKey",
"(",
"$",
"entity",
",",
"array_combine",
"(",
"$"... | Builds local key from field property pairs
@param mixed $entity
@param array $pairs
@return string | [
"Builds",
"local",
"key",
"from",
"field",
"property",
"pairs"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L162-L167 | train |
mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.buildKey | protected function buildKey($entity, array $pairs)
{
$key = [];
foreach ($pairs as $local => $refer) {
$key[] = $local . ':' . $this->accessor->getPropertyValue($entity, $refer);
}
return implode('-', $key);
} | php | protected function buildKey($entity, array $pairs)
{
$key = [];
foreach ($pairs as $local => $refer) {
$key[] = $local . ':' . $this->accessor->getPropertyValue($entity, $refer);
}
return implode('-', $key);
} | [
"protected",
"function",
"buildKey",
"(",
"$",
"entity",
",",
"array",
"$",
"pairs",
")",
"{",
"$",
"key",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"pairs",
"as",
"$",
"local",
"=>",
"$",
"refer",
")",
"{",
"$",
"key",
"[",
"]",
"=",
"$",
"loca... | Builds key from key-value pairs
@param mixed $entity
@param array $pairs
@return string | [
"Builds",
"key",
"from",
"key",
"-",
"value",
"pairs"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L190-L198 | train |
mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.fetch | protected function fetch($entityName, array $conditions, $result = false)
{
$query = $this->storage->read($entityName);
foreach ($conditions as $field => $values) {
$query->where($field, $values);
}
if (!$result) {
return $query->execute();
}
... | php | protected function fetch($entityName, array $conditions, $result = false)
{
$query = $this->storage->read($entityName);
foreach ($conditions as $field => $values) {
$query->where($field, $values);
}
if (!$result) {
return $query->execute();
}
... | [
"protected",
"function",
"fetch",
"(",
"$",
"entityName",
",",
"array",
"$",
"conditions",
",",
"$",
"result",
"=",
"false",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"storage",
"->",
"read",
"(",
"$",
"entityName",
")",
";",
"foreach",
"(",
"$... | Fetches collection of entities matching set conditions
Optionally sorts it and limits it
@param string $entityName
@param array $conditions
@param bool $result
@return array | [
"Fetches",
"collection",
"of",
"entities",
"matching",
"set",
"conditions",
"Optionally",
"sorts",
"it",
"and",
"limits",
"it"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L210-L239 | train |
mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.assertInstance | protected function assertInstance($entity)
{
$entityClass = $this->definition->entity();
if (!$entity instanceof $entityClass) {
throw new RelationException(sprintf('Relation entity must be instance of %s, got %s', $entityClass, $this->getType($entity)));
}
return true;
... | php | protected function assertInstance($entity)
{
$entityClass = $this->definition->entity();
if (!$entity instanceof $entityClass) {
throw new RelationException(sprintf('Relation entity must be instance of %s, got %s', $entityClass, $this->getType($entity)));
}
return true;
... | [
"protected",
"function",
"assertInstance",
"(",
"$",
"entity",
")",
"{",
"$",
"entityClass",
"=",
"$",
"this",
"->",
"definition",
"->",
"entity",
"(",
")",
";",
"if",
"(",
"!",
"$",
"entity",
"instanceof",
"$",
"entityClass",
")",
"{",
"throw",
"new",
... | Throws exception when entity is not required instance
@param mixed $entity
@return bool
@throws RelationException | [
"Throws",
"exception",
"when",
"entity",
"is",
"not",
"required",
"instance"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L249-L257 | train |
mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.cleanup | protected function cleanup($entityName, array $collection, array $conditions)
{
if (!$existing = $this->isCleanupNecessary($entityName, $conditions)) {
return;
}
$identifiers = [];
foreach ($collection as $instance) {
$identifiers[] = $this->identifyEntity($i... | php | protected function cleanup($entityName, array $collection, array $conditions)
{
if (!$existing = $this->isCleanupNecessary($entityName, $conditions)) {
return;
}
$identifiers = [];
foreach ($collection as $instance) {
$identifiers[] = $this->identifyEntity($i... | [
"protected",
"function",
"cleanup",
"(",
"$",
"entityName",
",",
"array",
"$",
"collection",
",",
"array",
"$",
"conditions",
")",
"{",
"if",
"(",
"!",
"$",
"existing",
"=",
"$",
"this",
"->",
"isCleanupNecessary",
"(",
"$",
"entityName",
",",
"$",
"cond... | Removes obsolete entities that match conditions but don't exist in collection
@param string $entityName
@param array $collection
@param array $conditions | [
"Removes",
"obsolete",
"entities",
"that",
"match",
"conditions",
"but",
"don",
"t",
"exist",
"in",
"collection"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L266-L286 | train |
mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.isCleanupNecessary | private function isCleanupNecessary($entityName, $conditions)
{
if (empty($conditions)) {
return false;
}
$existing = $this->fetch($entityName, $conditions);
if (empty($existing)) {
return false;
}
return $existing;
} | php | private function isCleanupNecessary($entityName, $conditions)
{
if (empty($conditions)) {
return false;
}
$existing = $this->fetch($entityName, $conditions);
if (empty($existing)) {
return false;
}
return $existing;
} | [
"private",
"function",
"isCleanupNecessary",
"(",
"$",
"entityName",
",",
"$",
"conditions",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"conditions",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"existing",
"=",
"$",
"this",
"->",
"fetch",
"(",
"$",
... | Returns array with entities that should be deleted or false otherwise
@param string $entityName
@param array $conditions
@return array|bool | [
"Returns",
"array",
"with",
"entities",
"that",
"should",
"be",
"deleted",
"or",
"false",
"otherwise"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L296-L309 | train |
mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.identifyEntity | protected function identifyEntity($instance, $entityName)
{
$fields = $this->models->get($entityName)->primaryFields();
$id = [];
foreach ($fields as $field) {
$id[] = $this->accessor->getPropertyValue($instance, $field->name());
}
return implode(':', $id);
... | php | protected function identifyEntity($instance, $entityName)
{
$fields = $this->models->get($entityName)->primaryFields();
$id = [];
foreach ($fields as $field) {
$id[] = $this->accessor->getPropertyValue($instance, $field->name());
}
return implode(':', $id);
... | [
"protected",
"function",
"identifyEntity",
"(",
"$",
"instance",
",",
"$",
"entityName",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"models",
"->",
"get",
"(",
"$",
"entityName",
")",
"->",
"primaryFields",
"(",
")",
";",
"$",
"id",
"=",
"[",
"... | Returns entity identifier
If more than one primary keys, entity will not be identified
@param object $instance
@param string $entityName
@return string | [
"Returns",
"entity",
"identifier",
"If",
"more",
"than",
"one",
"primary",
"keys",
"entity",
"will",
"not",
"be",
"identified"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L320-L330 | train |
mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.assertArrayAccess | protected function assertArrayAccess($container)
{
if (!$container instanceof \Traversable && !is_array($container)) {
throw new RelationException(sprintf('Relation container must be array or instance of ArrayAccess, got %s', $this->getType($container)));
}
} | php | protected function assertArrayAccess($container)
{
if (!$container instanceof \Traversable && !is_array($container)) {
throw new RelationException(sprintf('Relation container must be array or instance of ArrayAccess, got %s', $this->getType($container)));
}
} | [
"protected",
"function",
"assertArrayAccess",
"(",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"$",
"container",
"instanceof",
"\\",
"Traversable",
"&&",
"!",
"is_array",
"(",
"$",
"container",
")",
")",
"{",
"throw",
"new",
"RelationException",
"(",
"sprint... | Checks if container has array access
@param $container
@throws RelationException | [
"Checks",
"if",
"container",
"has",
"array",
"access"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L339-L344 | train |
SlaxWeb/Database | src/BaseModelResult.php | BaseModelResult.row | public function row(int $row): bool
{
$this->resultExists();
return $this->result->row($row);
} | php | public function row(int $row): bool
{
$this->resultExists();
return $this->result->row($row);
} | [
"public",
"function",
"row",
"(",
"int",
"$",
"row",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"resultExists",
"(",
")",
";",
"return",
"$",
"this",
"->",
"result",
"->",
"row",
"(",
"$",
"row",
")",
";",
"}"
] | Jump to row
Check if the Result object has been set and forwards the call to the 'row'
method in the Result object.
@param int $row Row number
@return bool | [
"Jump",
"to",
"row"
] | 75fb701cda426eccb99e7604f6c7ddb0eb81a572 | https://github.com/SlaxWeb/Database/blob/75fb701cda426eccb99e7604f6c7ddb0eb81a572/src/BaseModelResult.php#L80-L84 | train |
Torann/skosh-generator | src/AssetManifest.php | AssetManifest.load | public function load()
{
$file = BASE_PATH . '/rev-manifest.json';
if (file_exists($file)) {
$this->manifest = json_decode(file_get_contents($file), true);
}
} | php | public function load()
{
$file = BASE_PATH . '/rev-manifest.json';
if (file_exists($file)) {
$this->manifest = json_decode(file_get_contents($file), true);
}
} | [
"public",
"function",
"load",
"(",
")",
"{",
"$",
"file",
"=",
"BASE_PATH",
".",
"'/rev-manifest.json'",
";",
"if",
"(",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
"$",
"this",
"->",
"manifest",
"=",
"json_decode",
"(",
"file_get_contents",
"(",
"$"... | Load manifest file | [
"Load",
"manifest",
"file"
] | ea60e037d92398d7c146eb2349735d5692e3c48c | https://github.com/Torann/skosh-generator/blob/ea60e037d92398d7c146eb2349735d5692e3c48c/src/AssetManifest.php#L38-L45 | train |
balintsera/evista-perform | src/ValueObject/UploadedFile.php | UploadedFile.findRealType | public function findRealType()
{
$finfo = new \finfo();
// Move file to the upload folder for checking
$fileName = md5(microtime());
$destination = $this->uploadDir;
move_uploaded_file($this->tmpName, $destination.'/'.$fileName);
$this->realType = $finfo->file($destin... | php | public function findRealType()
{
$finfo = new \finfo();
// Move file to the upload folder for checking
$fileName = md5(microtime());
$destination = $this->uploadDir;
move_uploaded_file($this->tmpName, $destination.'/'.$fileName);
$this->realType = $finfo->file($destin... | [
"public",
"function",
"findRealType",
"(",
")",
"{",
"$",
"finfo",
"=",
"new",
"\\",
"finfo",
"(",
")",
";",
"// Move file to the upload folder for checking",
"$",
"fileName",
"=",
"md5",
"(",
"microtime",
"(",
")",
")",
";",
"$",
"destination",
"=",
"$",
... | adds real file type
@return [type] [description] | [
"adds",
"real",
"file",
"type"
] | 2b8723852ebe824ed721f30293e1e0d2c14f4b21 | https://github.com/balintsera/evista-perform/blob/2b8723852ebe824ed721f30293e1e0d2c14f4b21/src/ValueObject/UploadedFile.php#L121-L133 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.