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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
linpax/microphp-framework | src/web/html/HeadTagTrait.php | HeadTagTrait.script | public static function script($text, array $attributes = [], $type = 'text/javascript')
{
return static::openTag('script',
array_merge($attributes, ['type' => $type])).
' /*<![CDATA[*/ '.$text.' /*]]>*/ '.
static::closeTag('script');
} | php | public static function script($text, array $attributes = [], $type = 'text/javascript')
{
return static::openTag('script',
array_merge($attributes, ['type' => $type])).
' /*<![CDATA[*/ '.$text.' /*]]>*/ '.
static::closeTag('script');
} | [
"public",
"static",
"function",
"script",
"(",
"$",
"text",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
",",
"$",
"type",
"=",
"'text/javascript'",
")",
"{",
"return",
"static",
"::",
"openTag",
"(",
"'script'",
",",
"array_merge",
"(",
"$",
"attribu... | Render script source
@access public
@param string $text script
@param array $attributes attributes tag
@param string $type type of script
@return string
@static | [
"Render",
"script",
"source"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/web/html/HeadTagTrait.php#L152-L158 | train |
hiqdev/minii-caching | src/TagDependency.php | TagDependency.generateDependencyData | protected function generateDependencyData($cache)
{
$timestamps = $this->getTimestamps($cache, (array) $this->tags);
$newKeys = [];
foreach ($timestamps as $key => $timestamp) {
if ($timestamp === false) {
$newKeys[] = $key;
}
}
if (!e... | php | protected function generateDependencyData($cache)
{
$timestamps = $this->getTimestamps($cache, (array) $this->tags);
$newKeys = [];
foreach ($timestamps as $key => $timestamp) {
if ($timestamp === false) {
$newKeys[] = $key;
}
}
if (!e... | [
"protected",
"function",
"generateDependencyData",
"(",
"$",
"cache",
")",
"{",
"$",
"timestamps",
"=",
"$",
"this",
"->",
"getTimestamps",
"(",
"$",
"cache",
",",
"(",
"array",
")",
"$",
"this",
"->",
"tags",
")",
";",
"$",
"newKeys",
"=",
"[",
"]",
... | Generates the data needed to determine if dependency has been changed.
This method does nothing in this class.
@param Cache $cache the cache component that is currently evaluating this dependency
@return mixed the data needed to determine if dependency has been changed. | [
"Generates",
"the",
"data",
"needed",
"to",
"determine",
"if",
"dependency",
"has",
"been",
"changed",
".",
"This",
"method",
"does",
"nothing",
"in",
"this",
"class",
"."
] | 04c3f810a4af43b53855ee9c5e3ef6455080b538 | https://github.com/hiqdev/minii-caching/blob/04c3f810a4af43b53855ee9c5e3ef6455080b538/src/TagDependency.php#L32-L47 | train |
hiqdev/minii-caching | src/TagDependency.php | TagDependency.getHasChanged | public function getHasChanged($cache)
{
$timestamps = $this->getTimestamps($cache, (array) $this->tags);
return $timestamps !== $this->data;
} | php | public function getHasChanged($cache)
{
$timestamps = $this->getTimestamps($cache, (array) $this->tags);
return $timestamps !== $this->data;
} | [
"public",
"function",
"getHasChanged",
"(",
"$",
"cache",
")",
"{",
"$",
"timestamps",
"=",
"$",
"this",
"->",
"getTimestamps",
"(",
"$",
"cache",
",",
"(",
"array",
")",
"$",
"this",
"->",
"tags",
")",
";",
"return",
"$",
"timestamps",
"!==",
"$",
"... | Performs the actual dependency checking.
@param Cache $cache the cache component that is currently evaluating this dependency
@return boolean whether the dependency is changed or not. | [
"Performs",
"the",
"actual",
"dependency",
"checking",
"."
] | 04c3f810a4af43b53855ee9c5e3ef6455080b538 | https://github.com/hiqdev/minii-caching/blob/04c3f810a4af43b53855ee9c5e3ef6455080b538/src/TagDependency.php#L54-L58 | train |
agentmedia/phine-builtin | src/BuiltIn/Modules/Frontend/Navigation.php | Navigation.CreateSubLevel | protected function CreateSubLevel(NavigationItem $parent)
{
$navigation = new self();
$navigation->isSubLevel = true;
$navigation->naviParent = $parent;
$navigation->SetTreeItem($this->tree, $this->item);
return $navigation;
} | php | protected function CreateSubLevel(NavigationItem $parent)
{
$navigation = new self();
$navigation->isSubLevel = true;
$navigation->naviParent = $parent;
$navigation->SetTreeItem($this->tree, $this->item);
return $navigation;
} | [
"protected",
"function",
"CreateSubLevel",
"(",
"NavigationItem",
"$",
"parent",
")",
"{",
"$",
"navigation",
"=",
"new",
"self",
"(",
")",
";",
"$",
"navigation",
"->",
"isSubLevel",
"=",
"true",
";",
"$",
"navigation",
"->",
"naviParent",
"=",
"$",
"pare... | Creates a navigation renderer for a sub level
@param NavigationItem $parent
@return Navigation | [
"Creates",
"a",
"navigation",
"renderer",
"for",
"a",
"sub",
"level"
] | 4dd05bc406a71e997bd4eaa16b12e23dbe62a456 | https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Modules/Frontend/Navigation.php#L97-L104 | train |
agentmedia/phine-builtin | src/BuiltIn/Modules/Frontend/Navigation.php | Navigation.IsActive | private function IsActive()
{
$pageItem = $this->naviItem->GetPageItem();
if (!$pageItem)
{
return false;
}
return $pageItem->GetPage()->Equals(PageRenderer::Page());
} | php | private function IsActive()
{
$pageItem = $this->naviItem->GetPageItem();
if (!$pageItem)
{
return false;
}
return $pageItem->GetPage()->Equals(PageRenderer::Page());
} | [
"private",
"function",
"IsActive",
"(",
")",
"{",
"$",
"pageItem",
"=",
"$",
"this",
"->",
"naviItem",
"->",
"GetPageItem",
"(",
")",
";",
"if",
"(",
"!",
"$",
"pageItem",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"pageItem",
"->",
"GetPa... | Returns true if the current item points to the current page
@return boolean | [
"Returns",
"true",
"if",
"the",
"current",
"item",
"points",
"to",
"the",
"current",
"page"
] | 4dd05bc406a71e997bd4eaa16b12e23dbe62a456 | https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Modules/Frontend/Navigation.php#L149-L157 | train |
agentmedia/phine-builtin | src/BuiltIn/Modules/Frontend/Navigation.php | Navigation.IsTrail | private function IsTrail()
{
$pageItem = $this->naviItem->GetPageItem();
if (!$pageItem)
{
return false;
}
$parent = PageRenderer::Page()->GetParent();
$itemPage = $pageItem->GetPage();
while ($parent)
{
if ($itemPage->Equals($p... | php | private function IsTrail()
{
$pageItem = $this->naviItem->GetPageItem();
if (!$pageItem)
{
return false;
}
$parent = PageRenderer::Page()->GetParent();
$itemPage = $pageItem->GetPage();
while ($parent)
{
if ($itemPage->Equals($p... | [
"private",
"function",
"IsTrail",
"(",
")",
"{",
"$",
"pageItem",
"=",
"$",
"this",
"->",
"naviItem",
"->",
"GetPageItem",
"(",
")",
";",
"if",
"(",
"!",
"$",
"pageItem",
")",
"{",
"return",
"false",
";",
"}",
"$",
"parent",
"=",
"PageRenderer",
"::"... | Checks if the current navigation item points to a parent of the current page
@return boolean Returns true if the current page is a child of the current item | [
"Checks",
"if",
"the",
"current",
"navigation",
"item",
"points",
"to",
"a",
"parent",
"of",
"the",
"current",
"page"
] | 4dd05bc406a71e997bd4eaa16b12e23dbe62a456 | https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Modules/Frontend/Navigation.php#L163-L181 | train |
nirou8/php-multiple-saml | lib/Saml2/Response.php | OneLogin_Saml2_Response.validateTimestamps | public function validateTimestamps()
{
if ($this->encrypted) {
$document = $this->decryptedDocument;
} else {
$document = $this->document;
}
$timestampNodes = $document->getElementsByTagName('Conditions');
for ($i = 0; $i < $timestampNodes->length; $i... | php | public function validateTimestamps()
{
if ($this->encrypted) {
$document = $this->decryptedDocument;
} else {
$document = $this->document;
}
$timestampNodes = $document->getElementsByTagName('Conditions');
for ($i = 0; $i < $timestampNodes->length; $i... | [
"public",
"function",
"validateTimestamps",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"encrypted",
")",
"{",
"$",
"document",
"=",
"$",
"this",
"->",
"decryptedDocument",
";",
"}",
"else",
"{",
"$",
"document",
"=",
"$",
"this",
"->",
"document",
";... | Verifies that the document is still valid according Conditions Element.
@return bool | [
"Verifies",
"that",
"the",
"document",
"is",
"still",
"valid",
"according",
"Conditions",
"Element",
"."
] | 7eb5786e678db7d45459ce3441fa187946ae9a3b | https://github.com/nirou8/php-multiple-saml/blob/7eb5786e678db7d45459ce3441fa187946ae9a3b/lib/Saml2/Response.php#L875-L901 | train |
rawphp/RawMigrator | lib/commands/MigrateCommand.php | MigrateCommand.execute | public function execute( )
{
$this->doAction( self::ON_BEFORE_MIGRATE_CMD_EXECUTE_ACTION );
if ( NULL === $this->migrator )
{
throw new MigrationException( 'You must set the migrator before executing this command.' );
}
$verbose = self::getOpti... | php | public function execute( )
{
$this->doAction( self::ON_BEFORE_MIGRATE_CMD_EXECUTE_ACTION );
if ( NULL === $this->migrator )
{
throw new MigrationException( 'You must set the migrator before executing this command.' );
}
$verbose = self::getOpti... | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"this",
"->",
"doAction",
"(",
"self",
"::",
"ON_BEFORE_MIGRATE_CMD_EXECUTE_ACTION",
")",
";",
"if",
"(",
"NULL",
"===",
"$",
"this",
"->",
"migrator",
")",
"{",
"throw",
"new",
"MigrationException",
"(",
... | Executes the command action.
@action ON_BEFORE_MIGRATE_CMD_EXECUTE_ACTION
@action ON_AFTER_MIGRATE_CMD_EXECUTE_ACTION
@throws MigrationException if the migrator hasn't been set | [
"Executes",
"the",
"command",
"action",
"."
] | bbf5e354d7ff532552fd6865b38e4c1a3b6f3757 | https://github.com/rawphp/RawMigrator/blob/bbf5e354d7ff532552fd6865b38e4c1a3b6f3757/lib/commands/MigrateCommand.php#L111-L143 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/pclasses/storage.intf.php | PCStorage.addPClass | public function addPClass($pclass)
{
if (! $pclass instanceof KlarnaPClass) {
throw new Klarna_InvalidTypeException('pclass', 'KlarnaPClass');
}
if (!isset($this->pclasses) || !is_array($this->pclasses)) {
$this->pclasses = array();
}
if ($pclass->ge... | php | public function addPClass($pclass)
{
if (! $pclass instanceof KlarnaPClass) {
throw new Klarna_InvalidTypeException('pclass', 'KlarnaPClass');
}
if (!isset($this->pclasses) || !is_array($this->pclasses)) {
$this->pclasses = array();
}
if ($pclass->ge... | [
"public",
"function",
"addPClass",
"(",
"$",
"pclass",
")",
"{",
"if",
"(",
"!",
"$",
"pclass",
"instanceof",
"KlarnaPClass",
")",
"{",
"throw",
"new",
"Klarna_InvalidTypeException",
"(",
"'pclass'",
",",
"'KlarnaPClass'",
")",
";",
"}",
"if",
"(",
"!",
"i... | Adds a PClass to the storage.
@param KlarnaPClass $pclass PClass object.
@throws KlarnaException
@return void | [
"Adds",
"a",
"PClass",
"to",
"the",
"storage",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/pclasses/storage.intf.php#L53-L72 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/pclasses/storage.intf.php | PCStorage.getPClass | public function getPClass($id, $eid, $country)
{
if (!is_int($id)) {
throw new InvalidArgumentException('Supplied ID is not an integer!');
}
if (!is_array($this->pclasses)) {
throw new Klarna_PClassException('No match for that eid!');
}
if (!isset($t... | php | public function getPClass($id, $eid, $country)
{
if (!is_int($id)) {
throw new InvalidArgumentException('Supplied ID is not an integer!');
}
if (!is_array($this->pclasses)) {
throw new Klarna_PClassException('No match for that eid!');
}
if (!isset($t... | [
"public",
"function",
"getPClass",
"(",
"$",
"id",
",",
"$",
"eid",
",",
"$",
"country",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"id",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Supplied ID is not an integer!'",
")",
";",
"}"... | Gets the PClass by ID.
@param int $id PClass ID.
@param int $eid Merchant ID.
@param int $country {@link KlarnaCountry Country} constant.
@throws KlarnaException
@return KlarnaPClass | [
"Gets",
"the",
"PClass",
"by",
"ID",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/pclasses/storage.intf.php#L84-L111 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/pclasses/storage.intf.php | PCStorage.getPClasses | public function getPClasses($eid, $country, $type = null)
{
if (!is_int($country)) {
throw new Klarna_ArgumentNotSetException('country');
}
$tmp = false;
if (!is_array($this->pclasses)) {
return;
}
$tmp = array();
foreach ($this->pcla... | php | public function getPClasses($eid, $country, $type = null)
{
if (!is_int($country)) {
throw new Klarna_ArgumentNotSetException('country');
}
$tmp = false;
if (!is_array($this->pclasses)) {
return;
}
$tmp = array();
foreach ($this->pcla... | [
"public",
"function",
"getPClasses",
"(",
"$",
"eid",
",",
"$",
"country",
",",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"country",
")",
")",
"{",
"throw",
"new",
"Klarna_ArgumentNotSetException",
"(",
"'country'",
")",
"... | Returns an array of KlarnaPClasses, keyed with pclass ID.
If type is specified, only that type will be returned.
<b>Types available</b>:<br>
{@link KlarnaPClass::ACCOUNT}<br>
{@link KlarnaPClass::CAMPAIGN}<br>
{@link KlarnaPClass::SPECIAL}<br>
{@link KlarnaPClass::DELAY}<br>
{@link KlarnaPClass::MOBILE}<br>
@param in... | [
"Returns",
"an",
"array",
"of",
"KlarnaPClasses",
"keyed",
"with",
"pclass",
"ID",
".",
"If",
"type",
"is",
"specified",
"only",
"that",
"type",
"will",
"be",
"returned",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/pclasses/storage.intf.php#L131-L160 | train |
Raphhh/puppy-application | src/Controller/AppController.php | AppController.render | public function render($templateFile, array $vars = [])
{
$this->getService('retriever')->setLocalVars($vars);
return $this->getService('template')->render($templateFile, $vars);
} | php | public function render($templateFile, array $vars = [])
{
$this->getService('retriever')->setLocalVars($vars);
return $this->getService('template')->render($templateFile, $vars);
} | [
"public",
"function",
"render",
"(",
"$",
"templateFile",
",",
"array",
"$",
"vars",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"getService",
"(",
"'retriever'",
")",
"->",
"setLocalVars",
"(",
"$",
"vars",
")",
";",
"return",
"$",
"this",
"->",
"ge... | renders a template.
uses template service.
@param string $templateFile
@param array $vars
@return mixed | [
"renders",
"a",
"template",
".",
"uses",
"template",
"service",
"."
] | 9291543cd28e19a2986abd7fb146898ca5f5f5da | https://github.com/Raphhh/puppy-application/blob/9291543cd28e19a2986abd7fb146898ca5f5f5da/src/Controller/AppController.php#L39-L43 | train |
Raphhh/puppy-application | src/Controller/AppController.php | AppController.retrieve | public function retrieve($key, $default = '')
{
$retriever = $this->getService('retriever');
if($retriever->has($key)){
return $retriever->get($key);
}
return $default;
} | php | public function retrieve($key, $default = '')
{
$retriever = $this->getService('retriever');
if($retriever->has($key)){
return $retriever->get($key);
}
return $default;
} | [
"public",
"function",
"retrieve",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"''",
")",
"{",
"$",
"retriever",
"=",
"$",
"this",
"->",
"getService",
"(",
"'retriever'",
")",
";",
"if",
"(",
"$",
"retriever",
"->",
"has",
"(",
"$",
"key",
")",
")",
... | retrieves a param from
- the matches of the uri
- the request
- the flash
@param string $key
@param string $default
@return string | [
"retrieves",
"a",
"param",
"from",
"-",
"the",
"matches",
"of",
"the",
"uri",
"-",
"the",
"request",
"-",
"the",
"flash"
] | 9291543cd28e19a2986abd7fb146898ca5f5f5da | https://github.com/Raphhh/puppy-application/blob/9291543cd28e19a2986abd7fb146898ca5f5f5da/src/Controller/AppController.php#L132-L139 | train |
agentmedia/phine-core | src/Core/Logic/Util/ClassFinder.php | ClassFinder.ModuleClass | static function ModuleClass($type, ModuleLocation $location)
{
$parts = \explode(self::$bundleModuleSeparator, $type);
if (count($parts) != 2)
{
throw new \InvalidArgumentException('Module type string must be in the format <bundle>-<module>');
}
$bundle = $parts[0... | php | static function ModuleClass($type, ModuleLocation $location)
{
$parts = \explode(self::$bundleModuleSeparator, $type);
if (count($parts) != 2)
{
throw new \InvalidArgumentException('Module type string must be in the format <bundle>-<module>');
}
$bundle = $parts[0... | [
"static",
"function",
"ModuleClass",
"(",
"$",
"type",
",",
"ModuleLocation",
"$",
"location",
")",
"{",
"$",
"parts",
"=",
"\\",
"explode",
"(",
"self",
"::",
"$",
"bundleModuleSeparator",
",",
"$",
"type",
")",
";",
"if",
"(",
"count",
"(",
"$",
"par... | Gets the class name by type string and module loation
@param string $type The (simplified) type string
@param ModuleLocation $location The location; either Backend or Frontend
@return string Returns the class name associated with the type string
@throws \InvalidArgumentException Raises exception if type has incorrect f... | [
"Gets",
"the",
"class",
"name",
"by",
"type",
"string",
"and",
"module",
"loation"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/ClassFinder.php#L50-L61 | train |
agentmedia/phine-core | src/Core/Logic/Util/ClassFinder.php | ClassFinder.CreateModule | static function CreateModule($type, ModuleLocation $location)
{
$class = self::ModuleClass($type, $location);
if (!class_exists($class))
{
return null;
}
return new $class();
} | php | static function CreateModule($type, ModuleLocation $location)
{
$class = self::ModuleClass($type, $location);
if (!class_exists($class))
{
return null;
}
return new $class();
} | [
"static",
"function",
"CreateModule",
"(",
"$",
"type",
",",
"ModuleLocation",
"$",
"location",
")",
"{",
"$",
"class",
"=",
"self",
"::",
"ModuleClass",
"(",
"$",
"type",
",",
"$",
"location",
")",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"class... | Finds the module associated with the given type and returns an instance
@param string $type The module type
@param ModuleLocation $location The location; either backend or frontend
@return ModuleBase | [
"Finds",
"the",
"module",
"associated",
"with",
"the",
"given",
"type",
"and",
"returns",
"an",
"instance"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/ClassFinder.php#L69-L77 | train |
agentmedia/phine-core | src/Core/Logic/Util/ClassFinder.php | ClassFinder.BackendNavModules | static function BackendNavModules()
{
$result = array();
$allBundles = PathUtil::Bundles();
//force Core to appear first
$coreKey = array_search('Core', $allBundles);
unset($allBundles[$coreKey]);
array_unshift($allBundles, 'Core');
$bundles = array_values($al... | php | static function BackendNavModules()
{
$result = array();
$allBundles = PathUtil::Bundles();
//force Core to appear first
$coreKey = array_search('Core', $allBundles);
unset($allBundles[$coreKey]);
array_unshift($allBundles, 'Core');
$bundles = array_values($al... | [
"static",
"function",
"BackendNavModules",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"allBundles",
"=",
"PathUtil",
"::",
"Bundles",
"(",
")",
";",
"//force Core to appear first",
"$",
"coreKey",
"=",
"array_search",
"(",
"'Core'",
",",... | The modules for the backend navigation
@return Returns an array with bundle names as keys and backend modules as list | [
"The",
"modules",
"for",
"the",
"backend",
"navigation"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/ClassFinder.php#L135-L167 | train |
agentmedia/phine-core | src/Core/Logic/Util/ClassFinder.php | ClassFinder.SortByNavIndex | private static function SortByNavIndex(array &$result)
{
$sorted = array();
foreach ($result as $bundle=>$modules)
{
ksort($modules);
$sorted[$bundle] = $modules;
}
return $sorted;
} | php | private static function SortByNavIndex(array &$result)
{
$sorted = array();
foreach ($result as $bundle=>$modules)
{
ksort($modules);
$sorted[$bundle] = $modules;
}
return $sorted;
} | [
"private",
"static",
"function",
"SortByNavIndex",
"(",
"array",
"&",
"$",
"result",
")",
"{",
"$",
"sorted",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"result",
"as",
"$",
"bundle",
"=>",
"$",
"modules",
")",
"{",
"ksort",
"(",
"$",
"modules... | Sorts the the navigation items by index | [
"Sorts",
"the",
"the",
"navigation",
"items",
"by",
"index"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/ClassFinder.php#L172-L181 | train |
agentmedia/phine-core | src/Core/Logic/Util/ClassFinder.php | ClassFinder.AddBackendNavModule | private static function AddBackendNavModule(array &$result, BackendModule $module)
{
$bundle = $module->MyBundle();
if (!isset($result[$bundle]))
{
$result[$bundle] = array();
}
$result[$bundle][$module->SideNavIndex()] = $module;
} | php | private static function AddBackendNavModule(array &$result, BackendModule $module)
{
$bundle = $module->MyBundle();
if (!isset($result[$bundle]))
{
$result[$bundle] = array();
}
$result[$bundle][$module->SideNavIndex()] = $module;
} | [
"private",
"static",
"function",
"AddBackendNavModule",
"(",
"array",
"&",
"$",
"result",
",",
"BackendModule",
"$",
"module",
")",
"{",
"$",
"bundle",
"=",
"$",
"module",
"->",
"MyBundle",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"result",
"[... | Adds the module to the side navigation
@param array &$result The resulting array
@param BackendModule $module The backend module | [
"Adds",
"the",
"module",
"to",
"the",
"side",
"navigation"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Util/ClassFinder.php#L188-L196 | train |
Kris-Kuiper/sFire-Framework | src/Schedule/Schedule.php | Schedule.run | public function run() {
//Check if the function exec is enabled
if(false === function_exists('exec')) {
return trigger_error('Function "exec" is not enabled', E_USER_ERROR);
}
//Check if schedules folder is readable
if(false === is_readable(Path :: get('schedule'))) {
return trigger_erro... | php | public function run() {
//Check if the function exec is enabled
if(false === function_exists('exec')) {
return trigger_error('Function "exec" is not enabled', E_USER_ERROR);
}
//Check if schedules folder is readable
if(false === is_readable(Path :: get('schedule'))) {
return trigger_erro... | [
"public",
"function",
"run",
"(",
")",
"{",
"//Check if the function exec is enabled\r",
"if",
"(",
"false",
"===",
"function_exists",
"(",
"'exec'",
")",
")",
"{",
"return",
"trigger_error",
"(",
"'Function \"exec\" is not enabled'",
",",
"E_USER_ERROR",
")",
";",
... | Iterate over all schedule files and execute tasks | [
"Iterate",
"over",
"all",
"schedule",
"files",
"and",
"execute",
"tasks"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Schedule/Schedule.php#L53-L88 | train |
Kris-Kuiper/sFire-Framework | src/Schedule/Schedule.php | Schedule.task | public function task($script) {
if(false === is_string($script)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($script)), E_USER_ERROR);
}
$script = sprintf('%s%s%s.php', Path :: get('schedule'), Application :: get(['prefix', 'sch... | php | public function task($script) {
if(false === is_string($script)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($script)), E_USER_ERROR);
}
$script = sprintf('%s%s%s.php', Path :: get('schedule'), Application :: get(['prefix', 'sch... | [
"public",
"function",
"task",
"(",
"$",
"script",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"script",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
",",
"__M... | Execute individual task of schedule file
@param
@return | [
"Execute",
"individual",
"task",
"of",
"schedule",
"file"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Schedule/Schedule.php#L96-L157 | train |
Kris-Kuiper/sFire-Framework | src/Schedule/Schedule.php | Schedule.exec | private function exec($command, $background = false) {
exec(escapeshellcmd($command) . ($background === true ? ' > /dev/null &' : ''), $output);
return $output;
} | php | private function exec($command, $background = false) {
exec(escapeshellcmd($command) . ($background === true ? ' > /dev/null &' : ''), $output);
return $output;
} | [
"private",
"function",
"exec",
"(",
"$",
"command",
",",
"$",
"background",
"=",
"false",
")",
"{",
"exec",
"(",
"escapeshellcmd",
"(",
"$",
"command",
")",
".",
"(",
"$",
"background",
"===",
"true",
"?",
"' > /dev/null &'",
":",
"''",
")",
",",
"$",
... | Runs system command
@param string $command
@param boolean $background
@return string | [
"Runs",
"system",
"command"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Schedule/Schedule.php#L166-L171 | train |
Kris-Kuiper/sFire-Framework | src/Schedule/Schedule.php | Schedule.checkRun | private function checkRun($crontab) {
$time = explode(' ', date('i G j n w'));
$crontab = explode(' ', $crontab);
foreach($crontab as $k => &$v) {
$time[$k] = preg_replace('/^0+(?=\d)/', '', $time[$k]);
$v = explode(',', $v);
foreach ($v as &$v1) {
... | php | private function checkRun($crontab) {
$time = explode(' ', date('i G j n w'));
$crontab = explode(' ', $crontab);
foreach($crontab as $k => &$v) {
$time[$k] = preg_replace('/^0+(?=\d)/', '', $time[$k]);
$v = explode(',', $v);
foreach ($v as &$v1) {
... | [
"private",
"function",
"checkRun",
"(",
"$",
"crontab",
")",
"{",
"$",
"time",
"=",
"explode",
"(",
"' '",
",",
"date",
"(",
"'i G j n w'",
")",
")",
";",
"$",
"crontab",
"=",
"explode",
"(",
"' '",
",",
"$",
"crontab",
")",
";",
"foreach",
"(",
"$... | Checks if script should run
@param string $crontab
@return boolean | [
"Checks",
"if",
"script",
"should",
"run"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Schedule/Schedule.php#L179-L200 | train |
Kris-Kuiper/sFire-Framework | src/Schedule/Schedule.php | Schedule.bootstrap | private function bootstrap() {
include(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . DIRECTORY_SEPARATOR . 'bootstrap.php');
new \Bootstrap(false);
} | php | private function bootstrap() {
include(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . DIRECTORY_SEPARATOR . 'bootstrap.php');
new \Bootstrap(false);
} | [
"private",
"function",
"bootstrap",
"(",
")",
"{",
"include",
"(",
"dirname",
"(",
"dirname",
"(",
"dirname",
"(",
"dirname",
"(",
"dirname",
"(",
"dirname",
"(",
"__FILE__",
")",
")",
")",
")",
")",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"'bootstrap.php'",... | Load the bootstrap | [
"Load",
"the",
"bootstrap"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Schedule/Schedule.php#L206-L210 | train |
shrink0r/php-schema | src/Schema.php | Schema.verifySchema | protected function verifySchema(array $schema)
{
$customTypes = isset($schema['customTypes']) ? $schema['customTypes'] : [];
if (!is_array($customTypes)) {
throw new Exception("Given value for key 'customTypes' is not an array.");
}
$properties = isset($schema['propertie... | php | protected function verifySchema(array $schema)
{
$customTypes = isset($schema['customTypes']) ? $schema['customTypes'] : [];
if (!is_array($customTypes)) {
throw new Exception("Given value for key 'customTypes' is not an array.");
}
$properties = isset($schema['propertie... | [
"protected",
"function",
"verifySchema",
"(",
"array",
"$",
"schema",
")",
"{",
"$",
"customTypes",
"=",
"isset",
"(",
"$",
"schema",
"[",
"'customTypes'",
"]",
")",
"?",
"$",
"schema",
"[",
"'customTypes'",
"]",
":",
"[",
"]",
";",
"if",
"(",
"!",
"... | Ensures that the given schema has valid values. Will yield defaults where available.
@param mixed[] $schema
@return mixed[] Returns the given schema plus defaults where applicable. | [
"Ensures",
"that",
"the",
"given",
"schema",
"has",
"valid",
"values",
".",
"Will",
"yield",
"defaults",
"where",
"available",
"."
] | 94293fe897af376dd9d05962e2c516079409dd29 | https://github.com/shrink0r/php-schema/blob/94293fe897af376dd9d05962e2c516079409dd29/src/Schema.php#L127-L140 | train |
shrink0r/php-schema | src/Schema.php | Schema.validateMappedValues | protected function validateMappedValues(array $data)
{
$errors = [];
foreach (array_diff_key($this->properties, [ ':any_name:' => 1 ]) as $key => $property) {
$result = $this->selectValue($property, $data);
if ($result instanceof Ok) {
$value = $result->unwra... | php | protected function validateMappedValues(array $data)
{
$errors = [];
foreach (array_diff_key($this->properties, [ ':any_name:' => 1 ]) as $key => $property) {
$result = $this->selectValue($property, $data);
if ($result instanceof Ok) {
$value = $result->unwra... | [
"protected",
"function",
"validateMappedValues",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"errors",
"=",
"[",
"]",
";",
"foreach",
"(",
"array_diff_key",
"(",
"$",
"this",
"->",
"properties",
",",
"[",
"':any_name:'",
"=>",
"1",
"]",
")",
"as",
"$",
"... | Validates the values of all explicitly defined schema properties.
@param array $data
@return ResultInterface | [
"Validates",
"the",
"values",
"of",
"all",
"explicitly",
"defined",
"schema",
"properties",
"."
] | 94293fe897af376dd9d05962e2c516079409dd29 | https://github.com/shrink0r/php-schema/blob/94293fe897af376dd9d05962e2c516079409dd29/src/Schema.php#L149-L168 | train |
shrink0r/php-schema | src/Schema.php | Schema.selectValue | protected function selectValue(PropertyInterface $property, array $data)
{
$errors = [];
$key = $property->getName();
$value = array_key_exists($key, $data) ? $data[$key] : null;
if ($value === null && $property->isRequired()) {
if (!array_key_exists($key, $data)) {
... | php | protected function selectValue(PropertyInterface $property, array $data)
{
$errors = [];
$key = $property->getName();
$value = array_key_exists($key, $data) ? $data[$key] : null;
if ($value === null && $property->isRequired()) {
if (!array_key_exists($key, $data)) {
... | [
"protected",
"function",
"selectValue",
"(",
"PropertyInterface",
"$",
"property",
",",
"array",
"$",
"data",
")",
"{",
"$",
"errors",
"=",
"[",
"]",
";",
"$",
"key",
"=",
"$",
"property",
"->",
"getName",
"(",
")",
";",
"$",
"value",
"=",
"array_key_e... | Returns the property's corresponding value from the given data array.
@param PropertyInterface $property
@param array $data
@return ResultInterface If the value does not exist an error is returned; otherwise Ok is returned. | [
"Returns",
"the",
"property",
"s",
"corresponding",
"value",
"from",
"the",
"given",
"data",
"array",
"."
] | 94293fe897af376dd9d05962e2c516079409dd29 | https://github.com/shrink0r/php-schema/blob/94293fe897af376dd9d05962e2c516079409dd29/src/Schema.php#L178-L192 | train |
Mandarin-Medien/MMCmfContentBundle | Twig/NodeTreeRenderExtension.php | NodeTreeRenderExtension.renderNodeTreeFunction | public function renderNodeTreeFunction(\Twig_Environment $twig, NodeInterface $node, array $options=array())
{
return $twig->render('MMCmfContentBundle:Form/NodeTree:list.html.twig', array('node' => $node, 'icon' => $this->getIcon(get_class($node)), 'options' => $options));
} | php | public function renderNodeTreeFunction(\Twig_Environment $twig, NodeInterface $node, array $options=array())
{
return $twig->render('MMCmfContentBundle:Form/NodeTree:list.html.twig', array('node' => $node, 'icon' => $this->getIcon(get_class($node)), 'options' => $options));
} | [
"public",
"function",
"renderNodeTreeFunction",
"(",
"\\",
"Twig_Environment",
"$",
"twig",
",",
"NodeInterface",
"$",
"node",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"twig",
"->",
"render",
"(",
"'MMCmfContentBundle:Form... | renders the menu
@param \Twig_Environment $twig
@param NodeInterface $node
@param array $options
@return string | [
"renders",
"the",
"menu"
] | 503ab31cef3ce068f767de5b72f833526355b726 | https://github.com/Mandarin-Medien/MMCmfContentBundle/blob/503ab31cef3ce068f767de5b72f833526355b726/Twig/NodeTreeRenderExtension.php#L46-L49 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/XmlFilterer.php | XmlFilterer.pretty | protected function pretty()
{
$xml = $this->getParameter('value');
$level = $this->getParameter('level') != null ? intval($this->getParameter('level')) : 6;
// get an array containing each XML element
$xml = explode("\n", preg_replace('/>\s*</', ">\n<", $xml));
// hold curr... | php | protected function pretty()
{
$xml = $this->getParameter('value');
$level = $this->getParameter('level') != null ? intval($this->getParameter('level')) : 6;
// get an array containing each XML element
$xml = explode("\n", preg_replace('/>\s*</', ">\n<", $xml));
// hold curr... | [
"protected",
"function",
"pretty",
"(",
")",
"{",
"$",
"xml",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
";",
"$",
"level",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'level'",
")",
"!=",
"null",
"?",
"intval",
"(",
"$",
"this",
... | Formats an XML string
Expected Param:
value string XML snippet
@return string | [
"Formats",
"an",
"XML",
"string"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/XmlFilterer.php#L43-L78 | train |
wb-crowdfusion/crowdfusion | system/core/classes/systemdb/plugins/PluginService.php | PluginService.getAllActive | public function getAllActive()
{
$dto = new DTO();
$dto->setParameter("Status", "enabled");
$dto->setParameter("Installed", "1");
$dto->setOrderBy("Priority");
$dto = $this->findAll($dto);
return $dto->getResults();
} | php | public function getAllActive()
{
$dto = new DTO();
$dto->setParameter("Status", "enabled");
$dto->setParameter("Installed", "1");
$dto->setOrderBy("Priority");
$dto = $this->findAll($dto);
return $dto->getResults();
} | [
"public",
"function",
"getAllActive",
"(",
")",
"{",
"$",
"dto",
"=",
"new",
"DTO",
"(",
")",
";",
"$",
"dto",
"->",
"setParameter",
"(",
"\"Status\"",
",",
"\"enabled\"",
")",
";",
"$",
"dto",
"->",
"setParameter",
"(",
"\"Installed\"",
",",
"\"1\"",
... | Returns an array of all active plugins
@return array | [
"Returns",
"an",
"array",
"of",
"all",
"active",
"plugins"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/systemdb/plugins/PluginService.php#L44-L55 | train |
SergioMadness/pwf-helpers | src/HttpHelper.php | HttpHelper.isAbsoluteUrl | public static function isAbsoluteUrl($_path)
{
$url = parse_url($_path);
return $url !== false && isset($url['scheme']) && $url['scheme'] != '';
} | php | public static function isAbsoluteUrl($_path)
{
$url = parse_url($_path);
return $url !== false && isset($url['scheme']) && $url['scheme'] != '';
} | [
"public",
"static",
"function",
"isAbsoluteUrl",
"(",
"$",
"_path",
")",
"{",
"$",
"url",
"=",
"parse_url",
"(",
"$",
"_path",
")",
";",
"return",
"$",
"url",
"!==",
"false",
"&&",
"isset",
"(",
"$",
"url",
"[",
"'scheme'",
"]",
")",
"&&",
"$",
"ur... | Check is url absolute
@param string $_path
@return bool | [
"Check",
"is",
"url",
"absolute"
] | d6cd44807c120356d60618cb08f237841c35e293 | https://github.com/SergioMadness/pwf-helpers/blob/d6cd44807c120356d60618cb08f237841c35e293/src/HttpHelper.php#L63-L68 | train |
SergioMadness/pwf-helpers | src/HttpHelper.php | HttpHelper.invokeSoap | public static function invokeSoap($wsdlURL, $method,
array $params = array(),
array $options = array())
{
try {
$soapClient = new \SoapClient($wsdlURL, $options);
$result = $soapClient->$method($params);
... | php | public static function invokeSoap($wsdlURL, $method,
array $params = array(),
array $options = array())
{
try {
$soapClient = new \SoapClient($wsdlURL, $options);
$result = $soapClient->$method($params);
... | [
"public",
"static",
"function",
"invokeSoap",
"(",
"$",
"wsdlURL",
",",
"$",
"method",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"$",
"soapClient",
"=",
"new",
"... | Invoke SOAP method
@param string $wsdlURL
@param string $method
@param array $params
@param array $options
@return mixed | [
"Invoke",
"SOAP",
"method"
] | d6cd44807c120356d60618cb08f237841c35e293 | https://github.com/SergioMadness/pwf-helpers/blob/d6cd44807c120356d60618cb08f237841c35e293/src/HttpHelper.php#L79-L90 | train |
cultuurnet/udb3-udb2-bridge | src/Media/ImageCollectionFactory.php | ImageCollectionFactory.fromUdb2Item | public function fromUdb2Item(CultureFeed_Cdb_Item_Base $item)
{
$dutch = new Language('nl');
$dutchDetail = $item
->getDetails()
->getDetailByLanguage('nl');
$title = $dutchDetail->getTitle();
return $this->fromUdb2Media(
$dutchDetail->getMedia(),... | php | public function fromUdb2Item(CultureFeed_Cdb_Item_Base $item)
{
$dutch = new Language('nl');
$dutchDetail = $item
->getDetails()
->getDetailByLanguage('nl');
$title = $dutchDetail->getTitle();
return $this->fromUdb2Media(
$dutchDetail->getMedia(),... | [
"public",
"function",
"fromUdb2Item",
"(",
"CultureFeed_Cdb_Item_Base",
"$",
"item",
")",
"{",
"$",
"dutch",
"=",
"new",
"Language",
"(",
"'nl'",
")",
";",
"$",
"dutchDetail",
"=",
"$",
"item",
"->",
"getDetails",
"(",
")",
"->",
"getDetailByLanguage",
"(",
... | Create an ImageCollection from the media in the Dutch details of on an UDB2 item.
@param CultureFeed_Cdb_Item_Base $item
@return ImageCollection | [
"Create",
"an",
"ImageCollection",
"from",
"the",
"media",
"in",
"the",
"Dutch",
"details",
"of",
"on",
"an",
"UDB2",
"item",
"."
] | 2d5922af555ddd4802bc1805a31900d86e038c6a | https://github.com/cultuurnet/udb3-udb2-bridge/blob/2d5922af555ddd4802bc1805a31900d86e038c6a/src/Media/ImageCollectionFactory.php#L58-L72 | train |
gplcart/cli | controllers/Command.php | Command.outputFormat | protected function outputFormat($data, $default = null)
{
switch ($this->getParam(array('f'), $default)) {
case 'print-r':
$this->line(print_r($data, true));
break;
case 'var-export':
$this->line(var_export($data, true));
... | php | protected function outputFormat($data, $default = null)
{
switch ($this->getParam(array('f'), $default)) {
case 'print-r':
$this->line(print_r($data, true));
break;
case 'var-export':
$this->line(var_export($data, true));
... | [
"protected",
"function",
"outputFormat",
"(",
"$",
"data",
",",
"$",
"default",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"getParam",
"(",
"array",
"(",
"'f'",
")",
",",
"$",
"default",
")",
")",
"{",
"case",
"'print-r'",
":",
"$",
"... | Output formatted data
@param mixed $data
@param null|string $default
@return null | [
"Output",
"formatted",
"data"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/Command.php#L30-L52 | train |
gplcart/cli | controllers/Command.php | Command.getLimit | protected function getLimit(array $default_limit = array())
{
if (empty($default_limit)) {
$default_limit = $this->config->get('module_cli_limit', array(0, 100));
}
$limit = $this->getParam('l');
if (!isset($limit) || !is_numeric($limit)) {
return $default_l... | php | protected function getLimit(array $default_limit = array())
{
if (empty($default_limit)) {
$default_limit = $this->config->get('module_cli_limit', array(0, 100));
}
$limit = $this->getParam('l');
if (!isset($limit) || !is_numeric($limit)) {
return $default_l... | [
"protected",
"function",
"getLimit",
"(",
"array",
"$",
"default_limit",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"default_limit",
")",
")",
"{",
"$",
"default_limit",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'module_... | Returns an array of limits form the limit option or a default value
@param array $default_limit
@return array | [
"Returns",
"an",
"array",
"of",
"limits",
"form",
"the",
"limit",
"option",
"or",
"a",
"default",
"value"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/Command.php#L96-L115 | train |
gplcart/cli | controllers/Command.php | Command.explodeList | protected function explodeList($value, $separator = null)
{
if (is_array($value)) {
return $value;
}
if ($value === '' || !is_string($value)) {
return array();
}
if (!isset($separator)) {
$separator = $this->config->get('module_cli_list_s... | php | protected function explodeList($value, $separator = null)
{
if (is_array($value)) {
return $value;
}
if ($value === '' || !is_string($value)) {
return array();
}
if (!isset($separator)) {
$separator = $this->config->get('module_cli_list_s... | [
"protected",
"function",
"explodeList",
"(",
"$",
"value",
",",
"$",
"separator",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"if",
"(",
"$",
"value",
"===",
"''",
"||",
"!",
"... | Explode a string using a separator character
@param string $value
@param string|null $separator
@return array | [
"Explode",
"a",
"string",
"using",
"a",
"separator",
"character"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/Command.php#L135-L150 | train |
gplcart/cli | controllers/Command.php | Command.setSubmittedJson | protected function setSubmittedJson($field)
{
$json = $this->getSubmitted($field);
if (isset($json)) {
$decoded = json_decode($json, true);
if (json_last_error() === JSON_ERROR_NONE) {
$this->setSubmitted($field, $decoded);
} else {
... | php | protected function setSubmittedJson($field)
{
$json = $this->getSubmitted($field);
if (isset($json)) {
$decoded = json_decode($json, true);
if (json_last_error() === JSON_ERROR_NONE) {
$this->setSubmitted($field, $decoded);
} else {
... | [
"protected",
"function",
"setSubmittedJson",
"(",
"$",
"field",
")",
"{",
"$",
"json",
"=",
"$",
"this",
"->",
"getSubmitted",
"(",
"$",
"field",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"json",
")",
")",
"{",
"$",
"decoded",
"=",
"json_decode",
"(",
... | Convert a submitted JSON string into an array or FALSE on error
@param string $field | [
"Convert",
"a",
"submitted",
"JSON",
"string",
"into",
"an",
"array",
"or",
"FALSE",
"on",
"error"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/Command.php#L156-L172 | train |
gplcart/cli | controllers/Command.php | Command.setSubmittedList | protected function setSubmittedList($field)
{
$value = $this->getSubmitted($field);
if (isset($value)) {
$this->setSubmitted($field, $this->explodeList($value));
}
} | php | protected function setSubmittedList($field)
{
$value = $this->getSubmitted($field);
if (isset($value)) {
$this->setSubmitted($field, $this->explodeList($value));
}
} | [
"protected",
"function",
"setSubmittedList",
"(",
"$",
"field",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getSubmitted",
"(",
"$",
"field",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"value",
")",
")",
"{",
"$",
"this",
"->",
"setSubmitted",
"(",... | Converts a submitted string into an array using a character as an separator
@param $field | [
"Converts",
"a",
"submitted",
"string",
"into",
"an",
"array",
"using",
"a",
"character",
"as",
"an",
"separator"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/Command.php#L178-L185 | train |
gplcart/cli | controllers/Command.php | Command.validatePromptList | protected function validatePromptList($field, $label, $validator, $default = null)
{
$input = $this->prompt($label, $default);
if ($this->isValidInput($this->explodeList($input), $field, $validator)) {
$this->setSubmitted($field, $input);
} else {
$this->errors();
... | php | protected function validatePromptList($field, $label, $validator, $default = null)
{
$input = $this->prompt($label, $default);
if ($this->isValidInput($this->explodeList($input), $field, $validator)) {
$this->setSubmitted($field, $input);
} else {
$this->errors();
... | [
"protected",
"function",
"validatePromptList",
"(",
"$",
"field",
",",
"$",
"label",
",",
"$",
"validator",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"input",
"=",
"$",
"this",
"->",
"prompt",
"(",
"$",
"label",
",",
"$",
"default",
")",
";",
... | Validate prompt input when dealing with multiple values separated by a list character
@param string $field
@param string $label
@param string $validator
@param null|string $default | [
"Validate",
"prompt",
"input",
"when",
"dealing",
"with",
"multiple",
"values",
"separated",
"by",
"a",
"list",
"character"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/Command.php#L194-L204 | train |
proem-components/service | Asset.php | Asset.fetch | public function fetch(array $params = [], AssetManagerInterface $assetManager = null)
{
$asset = $this->asset;
$this->set($params);
return $this->validate($asset($this, $assetManager));
} | php | public function fetch(array $params = [], AssetManagerInterface $assetManager = null)
{
$asset = $this->asset;
$this->set($params);
return $this->validate($asset($this, $assetManager));
} | [
"public",
"function",
"fetch",
"(",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"AssetManagerInterface",
"$",
"assetManager",
"=",
"null",
")",
"{",
"$",
"asset",
"=",
"$",
"this",
"->",
"asset",
";",
"$",
"this",
"->",
"set",
"(",
"$",
"params",
")"... | Validate and retrieve an instantiated asset.
Here the closure is passed this asset container and optionally a
Proem\Service\AssetManagerInterface implementation.
This provides the closure with the ability to use any required parameters
and also be able to call upon any other assets stored in the service manager.
@pa... | [
"Validate",
"and",
"retrieve",
"an",
"instantiated",
"asset",
"."
] | 8c8e9547f16ecaa2789482f34947618f96e453cc | https://github.com/proem-components/service/blob/8c8e9547f16ecaa2789482f34947618f96e453cc/Asset.php#L140-L147 | train |
sndsgd/form | src/Form.php | Form.merge | public function merge(\sndsgd\Form ...$forms): Form
{
foreach ($forms as $form) {
$fields = array_values($form->getFields());
$this->addFields(...$fields);
}
return $this;
} | php | public function merge(\sndsgd\Form ...$forms): Form
{
foreach ($forms as $form) {
$fields = array_values($form->getFields());
$this->addFields(...$fields);
}
return $this;
} | [
"public",
"function",
"merge",
"(",
"\\",
"sndsgd",
"\\",
"Form",
"...",
"$",
"forms",
")",
":",
"Form",
"{",
"foreach",
"(",
"$",
"forms",
"as",
"$",
"form",
")",
"{",
"$",
"fields",
"=",
"array_values",
"(",
"$",
"form",
"->",
"getFields",
"(",
"... | Merge the fields of one or more forms into this one
@param \sndsgd\Form $forms The forms to merge
@return \sndsgd\Form | [
"Merge",
"the",
"fields",
"of",
"one",
"or",
"more",
"forms",
"into",
"this",
"one"
] | 56b5b9572a8942aea34c97c7c838b871e198e34f | https://github.com/sndsgd/form/blob/56b5b9572a8942aea34c97c7c838b871e198e34f/src/Form.php#L29-L37 | train |
ekyna/Table | Util/Config.php | Config.isValidSelectionMode | static public function isValidSelectionMode($mode, $throw = false)
{
$valid = in_array($mode, [
static::SELECTION_SINGLE,
static::SELECTION_MULTIPLE,
], true);
if (!$valid && $throw) {
throw new Exception\InvalidArgumentException("Invalid selection mode '... | php | static public function isValidSelectionMode($mode, $throw = false)
{
$valid = in_array($mode, [
static::SELECTION_SINGLE,
static::SELECTION_MULTIPLE,
], true);
if (!$valid && $throw) {
throw new Exception\InvalidArgumentException("Invalid selection mode '... | [
"static",
"public",
"function",
"isValidSelectionMode",
"(",
"$",
"mode",
",",
"$",
"throw",
"=",
"false",
")",
"{",
"$",
"valid",
"=",
"in_array",
"(",
"$",
"mode",
",",
"[",
"static",
"::",
"SELECTION_SINGLE",
",",
"static",
"::",
"SELECTION_MULTIPLE",
"... | Returns whether the given selection mode is valid or not.
@param string $mode The selection mode.
@param bool $throw Whether to throw an exception if the given mode is not valid.
@return bool | [
"Returns",
"whether",
"the",
"given",
"selection",
"mode",
"is",
"valid",
"or",
"not",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Util/Config.php#L26-L38 | train |
ekyna/Table | Util/Config.php | Config.validateName | static public function validateName($name)
{
if (null !== $name && !is_string($name)) {
throw new Exception\UnexpectedTypeException($name, 'string, integer or null');
}
if (!preg_match('/^[a-zA-Z0-9_]+$/', $name)) {
throw new Exception\InvalidArgumentException(sprint... | php | static public function validateName($name)
{
if (null !== $name && !is_string($name)) {
throw new Exception\UnexpectedTypeException($name, 'string, integer or null');
}
if (!preg_match('/^[a-zA-Z0-9_]+$/', $name)) {
throw new Exception\InvalidArgumentException(sprint... | [
"static",
"public",
"function",
"validateName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"name",
"&&",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"UnexpectedTypeException",
"(",
"$",
"name",
... | Validates whether the given variable is a valid name.
@param string $name The tested name
@throws Exception\UnexpectedTypeException If the name is not a string.
@throws Exception\InvalidArgumentException If the name contains invalid characters. | [
"Validates",
"whether",
"the",
"given",
"variable",
"is",
"a",
"valid",
"name",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Util/Config.php#L48-L60 | train |
DreadLabs/VantomasWebsite | src/ThreatDefense/ReCaptcha.php | ReCaptcha.isThreat | public function isThreat(DataInterface $data)
{
$response = $this->client->post(
self::API_ENDPOINT,
[
'secret' => $this->secret,
'response' => $data->getValue(),
]
);
if (!$response->isSuccess()) {
return true;... | php | public function isThreat(DataInterface $data)
{
$response = $this->client->post(
self::API_ENDPOINT,
[
'secret' => $this->secret,
'response' => $data->getValue(),
]
);
if (!$response->isSuccess()) {
return true;... | [
"public",
"function",
"isThreat",
"(",
"DataInterface",
"$",
"data",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"self",
"::",
"API_ENDPOINT",
",",
"[",
"'secret'",
"=>",
"$",
"this",
"->",
"secret",
",",
"'response'",... | Flags if the used Control impl detected a threat
@param DataInterface $data The incoming data to investigate
@return bool | [
"Flags",
"if",
"the",
"used",
"Control",
"impl",
"detected",
"a",
"threat"
] | 7f85f2b45bdf5ed9fa9d320c805c416bf99cd668 | https://github.com/DreadLabs/VantomasWebsite/blob/7f85f2b45bdf5ed9fa9d320c805c416bf99cd668/src/ThreatDefense/ReCaptcha.php#L64-L85 | train |
Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Loader/LazyLoaderTrait.php | LazyLoaderTrait.loadDelegates | private function loadDelegates($entity)
{
if (!$this instanceof LazyLoaderInterface) {
return $entity;
}
if (!$entity instanceof LazyPropertiesInterface) {
throw new \InvalidArgumentException(sprintf('%s objects cannot be hydrated with properties loading delegates wit... | php | private function loadDelegates($entity)
{
if (!$this instanceof LazyLoaderInterface) {
return $entity;
}
if (!$entity instanceof LazyPropertiesInterface) {
throw new \InvalidArgumentException(sprintf('%s objects cannot be hydrated with properties loading delegates wit... | [
"private",
"function",
"loadDelegates",
"(",
"$",
"entity",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"instanceof",
"LazyLoaderInterface",
")",
"{",
"return",
"$",
"entity",
";",
"}",
"if",
"(",
"!",
"$",
"entity",
"instanceof",
"LazyPropertiesInterface",
")",
... | Hydrate lazy loads delegate into given Collectionnable, if enabled and if
entity supports it.
@param LazyPropertiesInterface $object (not hinted to help notation and custom exception)
@return LazyPropertiesInterface | [
"Hydrate",
"lazy",
"loads",
"delegate",
"into",
"given",
"Collectionnable",
"if",
"enabled",
"and",
"if",
"entity",
"supports",
"it",
"."
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Loader/LazyLoaderTrait.php#L20-L55 | train |
mundschenk-at/wp-data-storage | src/class-transients.php | Transients.get_large_object | public function get_large_object( $key ) {
$encoded = $this->get( $key );
if ( false === $encoded ) {
return false;
}
$uncompressed = @\gzdecode( \base64_decode( $encoded ) ); // @codingStandardsIgnoreLine
if ( false === $uncompressed ) {
return false;
}
return $this->maybe_fix_object( \unserializ... | php | public function get_large_object( $key ) {
$encoded = $this->get( $key );
if ( false === $encoded ) {
return false;
}
$uncompressed = @\gzdecode( \base64_decode( $encoded ) ); // @codingStandardsIgnoreLine
if ( false === $uncompressed ) {
return false;
}
return $this->maybe_fix_object( \unserializ... | [
"public",
"function",
"get_large_object",
"(",
"$",
"key",
")",
"{",
"$",
"encoded",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"key",
")",
";",
"if",
"(",
"false",
"===",
"$",
"encoded",
")",
"{",
"return",
"false",
";",
"}",
"$",
"uncompressed",
"=... | Retrieves a cached large object.
@param string $key The cache key.
@return mixed | [
"Retrieves",
"a",
"cached",
"large",
"object",
"."
] | f06bba365c4a5ebc57f841b17afc5d6b0e6b48d0 | https://github.com/mundschenk-at/wp-data-storage/blob/f06bba365c4a5ebc57f841b17afc5d6b0e6b48d0/src/class-transients.php#L117-L129 | train |
mundschenk-at/wp-data-storage | src/class-transients.php | Transients.set_large_object | public function set_large_object( $key, $value, $duration = 0 ) {
$compressed = \gzencode( \serialize( $value ) ); // @codingStandardsIgnoreLine
if ( false === $compressed ) {
return false; // @codeCoverageIgnore
}
// base64_encode() is used to safely store the gzipped serialized object
// in the WordPre... | php | public function set_large_object( $key, $value, $duration = 0 ) {
$compressed = \gzencode( \serialize( $value ) ); // @codingStandardsIgnoreLine
if ( false === $compressed ) {
return false; // @codeCoverageIgnore
}
// base64_encode() is used to safely store the gzipped serialized object
// in the WordPre... | [
"public",
"function",
"set_large_object",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"duration",
"=",
"0",
")",
"{",
"$",
"compressed",
"=",
"\\",
"gzencode",
"(",
"\\",
"serialize",
"(",
"$",
"value",
")",
")",
";",
"// @codingStandardsIgnoreLine",
"... | Sets a transient for a large PHP object. The object will be stored in
serialized and gzip encoded form using Base64 encoding to ensure binary safety.
@param string $key The cache key.
@param mixed $value The value to store.
@param int $duration Optional. The duration in seconds. Default 0 (no expiration... | [
"Sets",
"a",
"transient",
"for",
"a",
"large",
"PHP",
"object",
".",
"The",
"object",
"will",
"be",
"stored",
"in",
"serialized",
"and",
"gzip",
"encoded",
"form",
"using",
"Base64",
"encoding",
"to",
"ensure",
"binary",
"safety",
"."
] | f06bba365c4a5ebc57f841b17afc5d6b0e6b48d0 | https://github.com/mundschenk-at/wp-data-storage/blob/f06bba365c4a5ebc57f841b17afc5d6b0e6b48d0/src/class-transients.php#L155-L165 | train |
mwyatt/core | src/Request.php | Request.setFiles | protected function setFiles(array $files)
{
foreach ($files as $associativeName => $details) {
foreach ($details as $fileKey => $detail) {
$this->files[$fileKey][$associativeName] = $detail;
}
}
} | php | protected function setFiles(array $files)
{
foreach ($files as $associativeName => $details) {
foreach ($details as $fileKey => $detail) {
$this->files[$fileKey][$associativeName] = $detail;
}
}
} | [
"protected",
"function",
"setFiles",
"(",
"array",
"$",
"files",
")",
"{",
"foreach",
"(",
"$",
"files",
"as",
"$",
"associativeName",
"=>",
"$",
"details",
")",
"{",
"foreach",
"(",
"$",
"details",
"as",
"$",
"fileKey",
"=>",
"$",
"detail",
")",
"{",
... | store the request files in a nice way
@param array $files | [
"store",
"the",
"request",
"files",
"in",
"a",
"nice",
"way"
] | 8ea9d67cc84fe6aff17a469c703d5492dbcd93ed | https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/Request.php#L35-L42 | train |
linpax/microphp-framework | src/mvc/controllers/Controller.php | Controller.getActionClassByName | public function getActionClassByName($name)
{
if (method_exists($this, 'actions')) {
$actions = $this->actions();
if (
!empty($actions[$name]) &&
class_exists($actions[$name]) &&
is_subclass_of($actions[$name], '\Micro\Mvc\Action')
... | php | public function getActionClassByName($name)
{
if (method_exists($this, 'actions')) {
$actions = $this->actions();
if (
!empty($actions[$name]) &&
class_exists($actions[$name]) &&
is_subclass_of($actions[$name], '\Micro\Mvc\Action')
... | [
"public",
"function",
"getActionClassByName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"'actions'",
")",
")",
"{",
"$",
"actions",
"=",
"$",
"this",
"->",
"actions",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
... | Get action class by name
@access public
@param string $name action name
@return bool | [
"Get",
"action",
"class",
"by",
"name"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/mvc/controllers/Controller.php#L114-L129 | train |
lasallecms/lasallecms-l5-formhandling-pkg | src/AdminFormHandling/AdminFormBaseController.php | AdminFormBaseController.confirmDeletionMultipleRows | public function confirmDeletionMultipleRows(Request $request) {
$checkboxes = $request->input('checkbox');
if (!$checkboxes) {
// flash message with redirect
Session::flash('status_code', 400 );
$message = 'You have not selected any rows for deletion.';
... | php | public function confirmDeletionMultipleRows(Request $request) {
$checkboxes = $request->input('checkbox');
if (!$checkboxes) {
// flash message with redirect
Session::flash('status_code', 400 );
$message = 'You have not selected any rows for deletion.';
... | [
"public",
"function",
"confirmDeletionMultipleRows",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"checkboxes",
"=",
"$",
"request",
"->",
"input",
"(",
"'checkbox'",
")",
";",
"if",
"(",
"!",
"$",
"checkboxes",
")",
"{",
"// flash message with redirect",
"S... | Confirm multiple row deletions
@return Response | [
"Confirm",
"multiple",
"row",
"deletions"
] | 5f8c1e0515d24de097dc7d1e85a4bc5eebdd47c1 | https://github.com/lasallecms/lasallecms-l5-formhandling-pkg/blob/5f8c1e0515d24de097dc7d1e85a4bc5eebdd47c1/src/AdminFormHandling/AdminFormBaseController.php#L562-L597 | train |
lasallecms/lasallecms-l5-formhandling-pkg | src/AdminFormHandling/AdminFormBaseController.php | AdminFormBaseController.getFieldLIst | public function getFieldLIst()
{
if (!isset($this->model->field_list)) {
return $this->model->getFieldList();
}
return $this->model->field_list;
} | php | public function getFieldLIst()
{
if (!isset($this->model->field_list)) {
return $this->model->getFieldList();
}
return $this->model->field_list;
} | [
"public",
"function",
"getFieldLIst",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"model",
"->",
"field_list",
")",
")",
"{",
"return",
"$",
"this",
"->",
"model",
"->",
"getFieldList",
"(",
")",
";",
"}",
"return",
"$",
"this",
... | get the Model's Field List
@return array | [
"get",
"the",
"Model",
"s",
"Field",
"List"
] | 5f8c1e0515d24de097dc7d1e85a4bc5eebdd47c1 | https://github.com/lasallecms/lasallecms-l5-formhandling-pkg/blob/5f8c1e0515d24de097dc7d1e85a4bc5eebdd47c1/src/AdminFormHandling/AdminFormBaseController.php#L811-L819 | train |
phossa/phossa-di | src/Phossa/Di/Definition/Loader/LoadableTrait.php | LoadableTrait.loadDefinitionFromFile | protected function loadDefinitionFromFile(/*# string */ $file)/*# : array */
{
// check first
$this->checkFileExistence($file);
// get definition type and loader class base on suffix
list($type, $class) = $this->getFileTypeClass($file);
// load into an array
$data =... | php | protected function loadDefinitionFromFile(/*# string */ $file)/*# : array */
{
// check first
$this->checkFileExistence($file);
// get definition type and loader class base on suffix
list($type, $class) = $this->getFileTypeClass($file);
// load into an array
$data =... | [
"protected",
"function",
"loadDefinitionFromFile",
"(",
"/*# string */",
"$",
"file",
")",
"/*# : array */",
"{",
"// check first",
"$",
"this",
"->",
"checkFileExistence",
"(",
"$",
"file",
")",
";",
"// get definition type and loader class base on suffix",
"list",
"(",
... | Load definitions from a file
@param string $file definition file name
@return array
@throws NotFoundException if file not found
@throws LogicException if something goes wrong
@access protected | [
"Load",
"definitions",
"from",
"a",
"file"
] | bbe1e95b081068e2bc49c6cd465f38aab0374be5 | https://github.com/phossa/phossa-di/blob/bbe1e95b081068e2bc49c6cd465f38aab0374be5/src/Phossa/Di/Definition/Loader/LoadableTrait.php#L42-L55 | train |
phossa/phossa-di | src/Phossa/Di/Definition/Loader/LoadableTrait.php | LoadableTrait.getFileTypeClass | protected function getFileTypeClass(/*# string */ $filename)
{
$parts = explode('.', strtolower(basename($filename)));
$count = count($parts);
$suffix = $count > 1 ? $parts[$count - 1] : 'php';
$type = $count > 2 ? $parts[$count - 2][0] : '_';
// valid types
$typ... | php | protected function getFileTypeClass(/*# string */ $filename)
{
$parts = explode('.', strtolower(basename($filename)));
$count = count($parts);
$suffix = $count > 1 ? $parts[$count - 1] : 'php';
$type = $count > 2 ? $parts[$count - 2][0] : '_';
// valid types
$typ... | [
"protected",
"function",
"getFileTypeClass",
"(",
"/*# string */",
"$",
"filename",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'.'",
",",
"strtolower",
"(",
"basename",
"(",
"$",
"filename",
")",
")",
")",
";",
"$",
"count",
"=",
"count",
"(",
"$",
... | Get definition type and loader class
*.[php|json|xml] : all definitions
*.s*.[php|json|xml] : service definitions
*.p*.[php|json|xml] : parameter definitions
*.m*.[php|json|xml] : mappings definitions
@param string $filename definition file name
@return string[]
@throws LogicException if something goes wrong
@acc... | [
"Get",
"definition",
"type",
"and",
"loader",
"class"
] | bbe1e95b081068e2bc49c6cd465f38aab0374be5 | https://github.com/phossa/phossa-di/blob/bbe1e95b081068e2bc49c6cd465f38aab0374be5/src/Phossa/Di/Definition/Loader/LoadableTrait.php#L70-L84 | train |
phossa/phossa-di | src/Phossa/Di/Definition/Loader/LoadableTrait.php | LoadableTrait.checkFileExistence | protected function checkFileExistence(/*# string */ $file)
{
if (!file_exists($file) || !is_readable($file)) {
throw new NotFoundException(
Message::get(Message::DEFINITION_NOT_FOUND, $file),
Message::DEFINITION_NOT_FOUND
);
}
} | php | protected function checkFileExistence(/*# string */ $file)
{
if (!file_exists($file) || !is_readable($file)) {
throw new NotFoundException(
Message::get(Message::DEFINITION_NOT_FOUND, $file),
Message::DEFINITION_NOT_FOUND
);
}
} | [
"protected",
"function",
"checkFileExistence",
"(",
"/*# string */",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"file",
")",
"||",
"!",
"is_readable",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"new",
"NotFoundException",
"(",
"Message"... | Check file exists and readable
@param string $file definition file name
@return void
@throws NotFoundException if not exist or readable
@access protected | [
"Check",
"file",
"exists",
"and",
"readable"
] | bbe1e95b081068e2bc49c6cd465f38aab0374be5 | https://github.com/phossa/phossa-di/blob/bbe1e95b081068e2bc49c6cd465f38aab0374be5/src/Phossa/Di/Definition/Loader/LoadableTrait.php#L94-L102 | train |
phossa/phossa-di | src/Phossa/Di/Definition/Loader/LoadableTrait.php | LoadableTrait.getLoaderClass | protected function getLoaderClass(
/*# string */ $suffix,
/*# string */ $filename
) {
$class = __NAMESPACE__ . '\\Loader' . ucfirst($suffix);
if (!class_exists($class)) {
throw new LogicException(
Message::get(Message::FILE_SUFFIX_UNKNOWN, $filename),
... | php | protected function getLoaderClass(
/*# string */ $suffix,
/*# string */ $filename
) {
$class = __NAMESPACE__ . '\\Loader' . ucfirst($suffix);
if (!class_exists($class)) {
throw new LogicException(
Message::get(Message::FILE_SUFFIX_UNKNOWN, $filename),
... | [
"protected",
"function",
"getLoaderClass",
"(",
"/*# string */",
"$",
"suffix",
",",
"/*# string */",
"$",
"filename",
")",
"{",
"$",
"class",
"=",
"__NAMESPACE__",
".",
"'\\\\Loader'",
".",
"ucfirst",
"(",
"$",
"suffix",
")",
";",
"if",
"(",
"!",
"class_exi... | Get loader class name base on suffix
@param string $suffix
@param string $filename
@return string classname
@throws LogicException if not class not found
@access protected | [
"Get",
"loader",
"class",
"name",
"base",
"on",
"suffix"
] | bbe1e95b081068e2bc49c6cd465f38aab0374be5 | https://github.com/phossa/phossa-di/blob/bbe1e95b081068e2bc49c6cd465f38aab0374be5/src/Phossa/Di/Definition/Loader/LoadableTrait.php#L113-L125 | train |
azhai/code-refactor | src/CodeRefactor/Mixin/CodeMixin.php | CodeMixin.setName | public function setName($name)
{
$this->name = $name;
if ($this->node) {
$this->node->name = $name;
}
} | php | public function setName($name)
{
$this->name = $name;
if ($this->node) {
$this->node->name = $name;
}
} | [
"public",
"function",
"setName",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"name",
";",
"if",
"(",
"$",
"this",
"->",
"node",
")",
"{",
"$",
"this",
"->",
"node",
"->",
"name",
"=",
"$",
"name",
";",
"}",
"}"
] | Set the node name. | [
"Set",
"the",
"node",
"name",
"."
] | cddb437d72f8239957daeba8211dda5e9366d6ca | https://github.com/azhai/code-refactor/blob/cddb437d72f8239957daeba8211dda5e9366d6ca/src/CodeRefactor/Mixin/CodeMixin.php#L39-L45 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/svn/SubversionTools.php | SubversionTools.getInfo | public function getInfo($path = '.')
{
if(!$this->svnEnabled)
return false;
$user = escapeshellarg($this->svnUsername);
$pw = escapeshellarg($this->svnPassword);
$creds = !empty($this->svnUsername) && !empty($this->svnPassword) ? "--username {$user} --password {$pw}" : ... | php | public function getInfo($path = '.')
{
if(!$this->svnEnabled)
return false;
$user = escapeshellarg($this->svnUsername);
$pw = escapeshellarg($this->svnPassword);
$creds = !empty($this->svnUsername) && !empty($this->svnPassword) ? "--username {$user} --password {$pw}" : ... | [
"public",
"function",
"getInfo",
"(",
"$",
"path",
"=",
"'.'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"svnEnabled",
")",
"return",
"false",
";",
"$",
"user",
"=",
"escapeshellarg",
"(",
"$",
"this",
"->",
"svnUsername",
")",
";",
"$",
"pw",
"... | Performs an svn info on the provided path.
Returns an array of SVN commit data, or false on failure.
@param string $path
@return array|bool | [
"Performs",
"an",
"svn",
"info",
"on",
"the",
"provided",
"path",
".",
"Returns",
"an",
"array",
"of",
"SVN",
"commit",
"data",
"or",
"false",
"on",
"failure",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/svn/SubversionTools.php#L77-L129 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/svn/SubversionTools.php | SubversionTools.update | public function update($path = '.')
{
if(!$this->svnEnabled)
return false;
$user = escapeshellarg($this->svnUsername);
$pw = escapeshellarg($this->svnPassword);
$creds = !empty($this->svnUsername) && !empty($this->svnPassword) ? "--username {$user} --password {$pw}" : ... | php | public function update($path = '.')
{
if(!$this->svnEnabled)
return false;
$user = escapeshellarg($this->svnUsername);
$pw = escapeshellarg($this->svnPassword);
$creds = !empty($this->svnUsername) && !empty($this->svnPassword) ? "--username {$user} --password {$pw}" : ... | [
"public",
"function",
"update",
"(",
"$",
"path",
"=",
"'.'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"svnEnabled",
")",
"return",
"false",
";",
"$",
"user",
"=",
"escapeshellarg",
"(",
"$",
"this",
"->",
"svnUsername",
")",
";",
"$",
"pw",
"=... | performs an svn update of the path provided
@param string $path
@return bool status of update | [
"performs",
"an",
"svn",
"update",
"of",
"the",
"path",
"provided"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/svn/SubversionTools.php#L137-L159 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/svn/SubversionTools.php | SubversionTools.copyPath | public function copyPath($fromPath, $toPath, $commitMessage)
{
$this->_validateSvnConfig();
$user = escapeshellarg($this->svnUsername);
$pw = escapeshellarg($this->svnPassword);
$fromPath = trim($fromPath, '/');
$toPath = trim($toPath, '/');
$fromPath = "{$this->svn... | php | public function copyPath($fromPath, $toPath, $commitMessage)
{
$this->_validateSvnConfig();
$user = escapeshellarg($this->svnUsername);
$pw = escapeshellarg($this->svnPassword);
$fromPath = trim($fromPath, '/');
$toPath = trim($toPath, '/');
$fromPath = "{$this->svn... | [
"public",
"function",
"copyPath",
"(",
"$",
"fromPath",
",",
"$",
"toPath",
",",
"$",
"commitMessage",
")",
"{",
"$",
"this",
"->",
"_validateSvnConfig",
"(",
")",
";",
"$",
"user",
"=",
"escapeshellarg",
"(",
"$",
"this",
"->",
"svnUsername",
")",
";",
... | Performs an svn copy of a repository path to another svn path in the same repository
fromPath and toPath should contain only the most specific portion of the
SVN repository URL needed to make the copy.
For example, a from path could be 'trunk' and to path 'tags'. Another example
would be copying from trunk to a branc... | [
"Performs",
"an",
"svn",
"copy",
"of",
"a",
"repository",
"path",
"to",
"another",
"svn",
"path",
"in",
"the",
"same",
"repository"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/svn/SubversionTools.php#L179-L204 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/svn/SubversionTools.php | SubversionTools._validateSvnConfig | protected function _validateSvnConfig()
{
if(!$this->svnEnabled)
throw new SubversionToolsException("Subversion support must be enabled for this action!");
if(empty($this->svnUsername))
throw new SubversionToolsException("Property svn.username is required");
if(empt... | php | protected function _validateSvnConfig()
{
if(!$this->svnEnabled)
throw new SubversionToolsException("Subversion support must be enabled for this action!");
if(empty($this->svnUsername))
throw new SubversionToolsException("Property svn.username is required");
if(empt... | [
"protected",
"function",
"_validateSvnConfig",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"svnEnabled",
")",
"throw",
"new",
"SubversionToolsException",
"(",
"\"Subversion support must be enabled for this action!\"",
")",
";",
"if",
"(",
"empty",
"(",
"$",
... | validates that all properties needed to work with the svn repository are populated
@throws SubversionToolsException
@return bool | [
"validates",
"that",
"all",
"properties",
"needed",
"to",
"work",
"with",
"the",
"svn",
"repository",
"are",
"populated"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/svn/SubversionTools.php#L348-L363 | train |
shgysk8zer0/core_api | traits/socket_client.php | Socket_Client.socketAccept | final public function socketAccept($socket = null)
{
if (is_resource($socket)) {
$this->socket = socket_accept($socket);
return $this->socket;
} else {
throw new InvalidArgumentException(__METHOD__ . ' expects $socket to be an instance of resource. ' . gettype($resource) . ' given instead');
}
} | php | final public function socketAccept($socket = null)
{
if (is_resource($socket)) {
$this->socket = socket_accept($socket);
return $this->socket;
} else {
throw new InvalidArgumentException(__METHOD__ . ' expects $socket to be an instance of resource. ' . gettype($resource) . ' given instead');
}
} | [
"final",
"public",
"function",
"socketAccept",
"(",
"$",
"socket",
"=",
"null",
")",
"{",
"if",
"(",
"is_resource",
"(",
"$",
"socket",
")",
")",
"{",
"$",
"this",
"->",
"socket",
"=",
"socket_accept",
"(",
"$",
"socket",
")",
";",
"return",
"$",
"th... | Creates a client side sockets from a server side one
@param resource $socket Socket created through socket_create
@return resource | [
"Creates",
"a",
"client",
"side",
"sockets",
"from",
"a",
"server",
"side",
"one"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/socket_client.php#L42-L50 | train |
shgysk8zer0/core_api | traits/socket_client.php | Socket_Client.socketWrite | final public function socketWrite($message = '', $length = null)
{
return @socket_write(
$this->socket,
"{$message}",
is_int($length) ? $length : strlen($message)
);
} | php | final public function socketWrite($message = '', $length = null)
{
return @socket_write(
$this->socket,
"{$message}",
is_int($length) ? $length : strlen($message)
);
} | [
"final",
"public",
"function",
"socketWrite",
"(",
"$",
"message",
"=",
"''",
",",
"$",
"length",
"=",
"null",
")",
"{",
"return",
"@",
"socket_write",
"(",
"$",
"this",
"->",
"socket",
",",
"\"{$message}\"",
",",
"is_int",
"(",
"$",
"length",
")",
"?"... | Write to client socket
@param string $message The message to send
@param int $length Optional lenght (defaults to length of $message)
@return int The number of bytes successfully written to the socket or FALSE on failure | [
"Write",
"to",
"client",
"socket"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/socket_client.php#L71-L78 | train |
Wedeto/DB | src/Query/SubQuery.php | SubQuery.toSQL | public function toSQL(Parameters $params, bool $inner_clause)
{
$scope = $params->getSubScope($this->scope_id);
$this->scope_id = $scope->getScopeID();
$q = $this->getQuery();
return '(' . $params->getDriver()->toSQL($scope, $q, false) . ')';
} | php | public function toSQL(Parameters $params, bool $inner_clause)
{
$scope = $params->getSubScope($this->scope_id);
$this->scope_id = $scope->getScopeID();
$q = $this->getQuery();
return '(' . $params->getDriver()->toSQL($scope, $q, false) . ')';
} | [
"public",
"function",
"toSQL",
"(",
"Parameters",
"$",
"params",
",",
"bool",
"$",
"inner_clause",
")",
"{",
"$",
"scope",
"=",
"$",
"params",
"->",
"getSubScope",
"(",
"$",
"this",
"->",
"scope_id",
")",
";",
"$",
"this",
"->",
"scope_id",
"=",
"$",
... | Write a sub query as SQL query syntax
@param Parameters $params The query parameters: tables and placeholder values
@param SubQuery $query The query to write
@return string The generated SQL | [
"Write",
"a",
"sub",
"query",
"as",
"SQL",
"query",
"syntax"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/SubQuery.php#L59-L66 | train |
TuumPHP/Web | src/View/ViewProviders.php | ViewProviders.getViewEngine | public function getViewEngine()
{
if($this->app->exists(ViewEngineInterface::class)) {
return $this->app->get(ViewEngineInterface::class);
}
$view = View::forge($this->web->view_dir);
$this->app->set(ViewEngineInterface::class, $view, true);
return $view;
} | php | public function getViewEngine()
{
if($this->app->exists(ViewEngineInterface::class)) {
return $this->app->get(ViewEngineInterface::class);
}
$view = View::forge($this->web->view_dir);
$this->app->set(ViewEngineInterface::class, $view, true);
return $view;
} | [
"public",
"function",
"getViewEngine",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"app",
"->",
"exists",
"(",
"ViewEngineInterface",
"::",
"class",
")",
")",
"{",
"return",
"$",
"this",
"->",
"app",
"->",
"get",
"(",
"ViewEngineInterface",
"::",
"class... | get shared view engine, Renderer as default.
@return ViewEngineInterface|View | [
"get",
"shared",
"view",
"engine",
"Renderer",
"as",
"default",
"."
] | 8f296b6358aa93226ce08d6cc54a309f5b0a9820 | https://github.com/TuumPHP/Web/blob/8f296b6358aa93226ce08d6cc54a309f5b0a9820/src/View/ViewProviders.php#L43-L51 | train |
TuumPHP/Web | src/View/ViewProviders.php | ViewProviders.getErrorView | public function getErrorView()
{
if($this->app->exists(ErrorView::class)) {
return $this->app->get(ErrorView::class);
}
$error_files = (array)$this->app->get(Web::ERROR_VIEWS);
if (empty($error_files)) {
$this->app->set(ErrorView::class, null, true);
... | php | public function getErrorView()
{
if($this->app->exists(ErrorView::class)) {
return $this->app->get(ErrorView::class);
}
$error_files = (array)$this->app->get(Web::ERROR_VIEWS);
if (empty($error_files)) {
$this->app->set(ErrorView::class, null, true);
... | [
"public",
"function",
"getErrorView",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"app",
"->",
"exists",
"(",
"ErrorView",
"::",
"class",
")",
")",
"{",
"return",
"$",
"this",
"->",
"app",
"->",
"get",
"(",
"ErrorView",
"::",
"class",
")",
";",
"}... | get error view render, ErrorView,
@return ErrorView|null | [
"get",
"error",
"view",
"render",
"ErrorView"
] | 8f296b6358aa93226ce08d6cc54a309f5b0a9820 | https://github.com/TuumPHP/Web/blob/8f296b6358aa93226ce08d6cc54a309f5b0a9820/src/View/ViewProviders.php#L58-L78 | train |
afroware/jwtauth | src/Providers/AbstractServiceProvider.php | AbstractServiceProvider.registerManager | protected function registerManager()
{
$this->app->singleton('afroware.jwT.manager', function ($app) {
$instance = new Manager(
$app['afroware.jwT.provider.jwT'],
$app['afroware.jwT.blacklist'],
$app['afroware.jwT.payload.factory']
);
... | php | protected function registerManager()
{
$this->app->singleton('afroware.jwT.manager', function ($app) {
$instance = new Manager(
$app['afroware.jwT.provider.jwT'],
$app['afroware.jwT.blacklist'],
$app['afroware.jwT.payload.factory']
);
... | [
"protected",
"function",
"registerManager",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'afroware.jwT.manager'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"instance",
"=",
"new",
"Manager",
"(",
"$",
"app",
"[",
"'afroware.jwT.... | Register the bindings for the JwT Manager.
@return void | [
"Register",
"the",
"bindings",
"for",
"the",
"JwT",
"Manager",
"."
] | 54a0aebd811d87bfdd2b3668696fd53f50490cc1 | https://github.com/afroware/jwtauth/blob/54a0aebd811d87bfdd2b3668696fd53f50490cc1/src/Providers/AbstractServiceProvider.php#L171-L183 | train |
afroware/jwtauth | src/Providers/AbstractServiceProvider.php | AbstractServiceProvider.registerClaimFactory | protected function registerClaimFactory()
{
$this->app->singleton('afroware.jwT.claim.factory', function ($app) {
$factory = new ClaimFactory($app['request']);
$app->refresh('request', $factory, 'setRequest');
return $factory->setTTL($this->config('ttl'));
});
... | php | protected function registerClaimFactory()
{
$this->app->singleton('afroware.jwT.claim.factory', function ($app) {
$factory = new ClaimFactory($app['request']);
$app->refresh('request', $factory, 'setRequest');
return $factory->setTTL($this->config('ttl'));
});
... | [
"protected",
"function",
"registerClaimFactory",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'afroware.jwT.claim.factory'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"factory",
"=",
"new",
"ClaimFactory",
"(",
"$",
"app",
"[",
... | Register the bindings for the Claim Factory.
@return void | [
"Register",
"the",
"bindings",
"for",
"the",
"Claim",
"Factory",
"."
] | 54a0aebd811d87bfdd2b3668696fd53f50490cc1 | https://github.com/afroware/jwtauth/blob/54a0aebd811d87bfdd2b3668696fd53f50490cc1/src/Providers/AbstractServiceProvider.php#L275-L283 | train |
Vectrex/vxPHP | src/Webpage/MenuEntry/MenuEntry.php | MenuEntry.isAuthenticatedByRole | public function isAuthenticatedByRole(Role $role) {
return !isset($this->auth) || $this->auth === $role->getRoleName();
} | php | public function isAuthenticatedByRole(Role $role) {
return !isset($this->auth) || $this->auth === $role->getRoleName();
} | [
"public",
"function",
"isAuthenticatedByRole",
"(",
"Role",
"$",
"role",
")",
"{",
"return",
"!",
"isset",
"(",
"$",
"this",
"->",
"auth",
")",
"||",
"$",
"this",
"->",
"auth",
"===",
"$",
"role",
"->",
"getRoleName",
"(",
")",
";",
"}"
] | check whether a role matches the auth attribute of the menu entry
@param Role $role
@return boolean | [
"check",
"whether",
"a",
"role",
"matches",
"the",
"auth",
"attribute",
"of",
"the",
"menu",
"entry"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/MenuEntry/MenuEntry.php#L147-L151 | train |
Vectrex/vxPHP | src/Webpage/MenuEntry/MenuEntry.php | MenuEntry.getHref | public function getHref() {
if(is_null($this->href)) {
if($this->localPage) {
$pathSegments = [];
$e = $this;
do {
$pathSegments[] = $e->path;
} while ($e = $e->menu->getParentEntry());
if(Application::getInstance()->getRouter()->getServerSideRewrite()) {
if(($script = basename(... | php | public function getHref() {
if(is_null($this->href)) {
if($this->localPage) {
$pathSegments = [];
$e = $this;
do {
$pathSegments[] = $e->path;
} while ($e = $e->menu->getParentEntry());
if(Application::getInstance()->getRouter()->getServerSideRewrite()) {
if(($script = basename(... | [
"public",
"function",
"getHref",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"href",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"localPage",
")",
"{",
"$",
"pathSegments",
"=",
"[",
"]",
";",
"$",
"e",
"=",
"$",
"this",
";",
... | get href attribute value of menu entry | [
"get",
"href",
"attribute",
"value",
"of",
"menu",
"entry"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/MenuEntry/MenuEntry.php#L172-L212 | train |
judus/minimal-http | src/Response.php | Response.arrayToJson | public function arrayToJson($content = null)
{
if ($this->getJsonEncodeArray() && is_array($content)) {
$this->header('Content-Type: application/json');
return json_encode($content);
}
return $content;
} | php | public function arrayToJson($content = null)
{
if ($this->getJsonEncodeArray() && is_array($content)) {
$this->header('Content-Type: application/json');
return json_encode($content);
}
return $content;
} | [
"public",
"function",
"arrayToJson",
"(",
"$",
"content",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getJsonEncodeArray",
"(",
")",
"&&",
"is_array",
"(",
"$",
"content",
")",
")",
"{",
"$",
"this",
"->",
"header",
"(",
"'Content-Type: applica... | Encode array to json if configured
@param $content
@return string | [
"Encode",
"array",
"to",
"json",
"if",
"configured"
] | 13c49e1350488acea8acf44ab5ed7796a39a9f1a | https://github.com/judus/minimal-http/blob/13c49e1350488acea8acf44ab5ed7796a39a9f1a/src/Response.php#L165-L173 | train |
judus/minimal-http | src/Response.php | Response.objectToJson | public function objectToJson($content = null)
{
if ($this->getJsonEncodeObject() && is_object($content)) {
if (method_exists($content, '__toString')) {
return (string)$content;
}
if (method_exists($content, 'toJson')) {
$this->header('Con... | php | public function objectToJson($content = null)
{
if ($this->getJsonEncodeObject() && is_object($content)) {
if (method_exists($content, '__toString')) {
return (string)$content;
}
if (method_exists($content, 'toJson')) {
$this->header('Con... | [
"public",
"function",
"objectToJson",
"(",
"$",
"content",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getJsonEncodeObject",
"(",
")",
"&&",
"is_object",
"(",
"$",
"content",
")",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"content",
","... | Encode object to json if configured
@param $content
@return string | [
"Encode",
"object",
"to",
"json",
"if",
"configured"
] | 13c49e1350488acea8acf44ab5ed7796a39a9f1a | https://github.com/judus/minimal-http/blob/13c49e1350488acea8acf44ab5ed7796a39a9f1a/src/Response.php#L182-L204 | train |
judus/minimal-http | src/Response.php | Response.printRecursiveNonAlphaNum | public function printRecursiveNonAlphaNum($content = null)
{
if (is_array($content) || is_object($content)) {
ob_start();
/** @noinspection PhpUndefinedFunctionInspection */
if (php_sapi_name() != 'cli' && !defined('STDIN')) {
d($content);
} ... | php | public function printRecursiveNonAlphaNum($content = null)
{
if (is_array($content) || is_object($content)) {
ob_start();
/** @noinspection PhpUndefinedFunctionInspection */
if (php_sapi_name() != 'cli' && !defined('STDIN')) {
d($content);
} ... | [
"public",
"function",
"printRecursiveNonAlphaNum",
"(",
"$",
"content",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"content",
")",
"||",
"is_object",
"(",
"$",
"content",
")",
")",
"{",
"ob_start",
"(",
")",
";",
"/** @noinspection PhpUndefinedF... | Does a print_r with objects and array recursive
@param $content
@return string | [
"Does",
"a",
"print_r",
"with",
"objects",
"and",
"array",
"recursive"
] | 13c49e1350488acea8acf44ab5ed7796a39a9f1a | https://github.com/judus/minimal-http/blob/13c49e1350488acea8acf44ab5ed7796a39a9f1a/src/Response.php#L213-L231 | train |
ZendExperts/phpids | lib/IDS/Monitor.php | IDS_Monitor.getReport | public function getReport()
{
if (isset($this->centrifuge) && $this->centrifuge) {
$this->report->setCentrifuge($this->centrifuge);
}
return $this->report;
} | php | public function getReport()
{
if (isset($this->centrifuge) && $this->centrifuge) {
$this->report->setCentrifuge($this->centrifuge);
}
return $this->report;
} | [
"public",
"function",
"getReport",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"centrifuge",
")",
"&&",
"$",
"this",
"->",
"centrifuge",
")",
"{",
"$",
"this",
"->",
"report",
"->",
"setCentrifuge",
"(",
"$",
"this",
"->",
"centrifuge",
... | Returns report object providing various functions to work with
detected results. Also the centrifuge data is being set as property
of the report object.
@return object IDS_Report | [
"Returns",
"report",
"object",
"providing",
"various",
"functions",
"to",
"work",
"with",
"detected",
"results",
".",
"Also",
"the",
"centrifuge",
"data",
"is",
"being",
"set",
"as",
"property",
"of",
"the",
"report",
"object",
"."
] | f30df04eea47b94d056e2ae9ec8fea1c626f1c03 | https://github.com/ZendExperts/phpids/blob/f30df04eea47b94d056e2ae9ec8fea1c626f1c03/lib/IDS/Monitor.php#L761-L768 | train |
ptlis/grep-db | src/Replace/Result/RowReplaceResult.php | RowReplaceResult.getReplacedCount | public function getReplacedCount(): int
{
return intval(array_reduce(
$this->fieldResultList,
function (int $count, FieldReplaceResult $fieldResult) {
return $count + $fieldResult->getReplacedCount();
},
0
));
} | php | public function getReplacedCount(): int
{
return intval(array_reduce(
$this->fieldResultList,
function (int $count, FieldReplaceResult $fieldResult) {
return $count + $fieldResult->getReplacedCount();
},
0
));
} | [
"public",
"function",
"getReplacedCount",
"(",
")",
":",
"int",
"{",
"return",
"intval",
"(",
"array_reduce",
"(",
"$",
"this",
"->",
"fieldResultList",
",",
"function",
"(",
"int",
"$",
"count",
",",
"FieldReplaceResult",
"$",
"fieldResult",
")",
"{",
"retu... | Get the number of replacements in all fields in this row. | [
"Get",
"the",
"number",
"of",
"replacements",
"in",
"all",
"fields",
"in",
"this",
"row",
"."
] | 7abff68982d426690d0515ccd7adc7a2e3d72a3f | https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Replace/Result/RowReplaceResult.php#L45-L54 | train |
ptlis/grep-db | src/Replace/Result/RowReplaceResult.php | RowReplaceResult.getErrorList | public function getErrorList(): array
{
$errorList = $this->errorList;
foreach ($this->fieldResultList as $fieldResult) {
foreach ($fieldResult->getErrorList() as $error) {
$errorList[] = $error;
}
}
return $errorList;
} | php | public function getErrorList(): array
{
$errorList = $this->errorList;
foreach ($this->fieldResultList as $fieldResult) {
foreach ($fieldResult->getErrorList() as $error) {
$errorList[] = $error;
}
}
return $errorList;
} | [
"public",
"function",
"getErrorList",
"(",
")",
":",
"array",
"{",
"$",
"errorList",
"=",
"$",
"this",
"->",
"errorList",
";",
"foreach",
"(",
"$",
"this",
"->",
"fieldResultList",
"as",
"$",
"fieldResult",
")",
"{",
"foreach",
"(",
"$",
"fieldResult",
"... | Get any replacement errors.
@return string[] | [
"Get",
"any",
"replacement",
"errors",
"."
] | 7abff68982d426690d0515ccd7adc7a2e3d72a3f | https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Replace/Result/RowReplaceResult.php#L61-L71 | train |
ScaraMVC/Framework | src/Scara/Foundation/Environment.php | Environment.get | public function get($key, $default = '')
{
if (!is_null($this->_env)) {
$item = ($this->has($key)) ? getenv($key) : $default;
if (is_numeric($item)) {
if (strrpos($item, '.') !== false) {
return floatval($item);
} else {
... | php | public function get($key, $default = '')
{
if (!is_null($this->_env)) {
$item = ($this->has($key)) ? getenv($key) : $default;
if (is_numeric($item)) {
if (strrpos($item, '.') !== false) {
return floatval($item);
} else {
... | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"_env",
")",
")",
"{",
"$",
"item",
"=",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"?... | Gets an environment variable.
@param string $key
@param string $default
@return string | [
"Gets",
"an",
"environment",
"variable",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Foundation/Environment.php#L45-L71 | train |
phossa/phossa-cache | src/Phossa/Cache/Driver/FilesystemDriver.php | FilesystemDriver.getPath | protected function getPath(/*# string */ $key)/*# : string */
{
// get directory first
if (($pos = strrpos($key, '/')) !== false) {
$dir = $this->dir_root . DIRECTORY_SEPARATOR .
substr($key, 0, $pos) . DIRECTORY_SEPARATOR;
$key = substr($key, $pos + 1);... | php | protected function getPath(/*# string */ $key)/*# : string */
{
// get directory first
if (($pos = strrpos($key, '/')) !== false) {
$dir = $this->dir_root . DIRECTORY_SEPARATOR .
substr($key, 0, $pos) . DIRECTORY_SEPARATOR;
$key = substr($key, $pos + 1);... | [
"protected",
"function",
"getPath",
"(",
"/*# string */",
"$",
"key",
")",
"/*# : string */",
"{",
"// get directory first",
"if",
"(",
"(",
"$",
"pos",
"=",
"strrpos",
"(",
"$",
"key",
",",
"'/'",
")",
")",
"!==",
"false",
")",
"{",
"$",
"dir",
"=",
"... | Get path base on key.
$key may contain '/' to signal a path
@param string $key item key
@return string
@access protected | [
"Get",
"path",
"base",
"on",
"key",
"."
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/FilesystemDriver.php#L255-L277 | train |
phossa/phossa-cache | src/Phossa/Cache/Driver/FilesystemDriver.php | FilesystemDriver.hashIt | protected function hashIt(/*# string */ $key)/*# : string */
{
$md5 = md5($key);
$hash = $this->file_pref . $md5 . $this->file_suff;
// no hash
if (!$this->hash_level) {
return $hash;
}
// hash
$pref = '';
for ($i = 0; $i < $this->hash_l... | php | protected function hashIt(/*# string */ $key)/*# : string */
{
$md5 = md5($key);
$hash = $this->file_pref . $md5 . $this->file_suff;
// no hash
if (!$this->hash_level) {
return $hash;
}
// hash
$pref = '';
for ($i = 0; $i < $this->hash_l... | [
"protected",
"function",
"hashIt",
"(",
"/*# string */",
"$",
"key",
")",
"/*# : string */",
"{",
"$",
"md5",
"=",
"md5",
"(",
"$",
"key",
")",
";",
"$",
"hash",
"=",
"$",
"this",
"->",
"file_pref",
".",
"$",
"md5",
".",
"$",
"this",
"->",
"file_suff... | Get hashed filename
@param string $key the key
@return string
@access protected | [
"Get",
"hashed",
"filename"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/FilesystemDriver.php#L286-L302 | train |
phossa/phossa-cache | src/Phossa/Cache/Driver/FilesystemDriver.php | FilesystemDriver.deleteFromDir | protected function deleteFromDir(
/*# string */ $dir,
/*# int */ $maxlife = 0,
/*# bool */ $removeDir = false
)/*# : bool */ {
$now = time();
if (is_dir($dir)) {
$files = scandir($dir);
foreach ($files as $file) {
if ($file == "." || $f... | php | protected function deleteFromDir(
/*# string */ $dir,
/*# int */ $maxlife = 0,
/*# bool */ $removeDir = false
)/*# : bool */ {
$now = time();
if (is_dir($dir)) {
$files = scandir($dir);
foreach ($files as $file) {
if ($file == "." || $f... | [
"protected",
"function",
"deleteFromDir",
"(",
"/*# string */",
"$",
"dir",
",",
"/*# int */",
"$",
"maxlife",
"=",
"0",
",",
"/*# bool */",
"$",
"removeDir",
"=",
"false",
")",
"/*# : bool */",
"{",
"$",
"now",
"=",
"time",
"(",
")",
";",
"if",
"(",
"is... | Remove all contents under one directory
@param string $dir directory
@param int $maxlife delete those older than $maxlife seconds
@param bool $removeDir remove the directory also
@return bool
@access protected | [
"Remove",
"all",
"contents",
"under",
"one",
"directory"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/FilesystemDriver.php#L313-L349 | train |
railken/amethyst-authentication | src/Providers/AuthenticationServiceProvider.php | AuthenticationServiceProvider.register | public function register()
{
$this->app->register(\Laravel\Passport\PassportServiceProvider::class);
$this->app->register(\Railken\Amethyst\Providers\ApiServiceProvider::class);
$this->app->register(\Railken\Amethyst\Providers\UserServiceProvider::class);
$this->mergeConfigFrom(__DIR... | php | public function register()
{
$this->app->register(\Laravel\Passport\PassportServiceProvider::class);
$this->app->register(\Railken\Amethyst\Providers\ApiServiceProvider::class);
$this->app->register(\Railken\Amethyst\Providers\UserServiceProvider::class);
$this->mergeConfigFrom(__DIR... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"register",
"(",
"\\",
"Laravel",
"\\",
"Passport",
"\\",
"PassportServiceProvider",
"::",
"class",
")",
";",
"$",
"this",
"->",
"app",
"->",
"register",
"(",
"\\",
"Railken... | Register any application services.so. | [
"Register",
"any",
"application",
"services",
".",
"so",
"."
] | 59f28ddffa41a5f7fae4d5504eacf7c664e54b46 | https://github.com/railken/amethyst-authentication/blob/59f28ddffa41a5f7fae4d5504eacf7c664e54b46/src/Providers/AuthenticationServiceProvider.php#L37-L43 | train |
AdamB7586/UK_Counties | src/Counties.php | Counties.getCountyID | public static function getCountyID($county){
if(in_array($county, self::$counties)){
$names = array_keys(self::$counties, $county);
return $names[0];
}
return false;
} | php | public static function getCountyID($county){
if(in_array($county, self::$counties)){
$names = array_keys(self::$counties, $county);
return $names[0];
}
return false;
} | [
"public",
"static",
"function",
"getCountyID",
"(",
"$",
"county",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"county",
",",
"self",
"::",
"$",
"counties",
")",
")",
"{",
"$",
"names",
"=",
"array_keys",
"(",
"self",
"::",
"$",
"counties",
",",
"$",
... | Returns the id of a given county name
@param string $county This should be the county name you wish to find the id for
@return int|false Returns the id of the given county name if it exists else returns false | [
"Returns",
"the",
"id",
"of",
"a",
"given",
"county",
"name"
] | 8e9d34048acde404fce545506750f77b8f8d7275 | https://github.com/AdamB7586/UK_Counties/blob/8e9d34048acde404fce545506750f77b8f8d7275/src/Counties.php#L160-L166 | train |
AdamB7586/UK_Counties | src/Counties.php | Counties.getCountyName | public static function getCountyName($id){
if(is_numeric($id) && array_key_exists(intval($id), self::$counties)){
return self::$counties[intval($id)];
}
return false;
} | php | public static function getCountyName($id){
if(is_numeric($id) && array_key_exists(intval($id), self::$counties)){
return self::$counties[intval($id)];
}
return false;
} | [
"public",
"static",
"function",
"getCountyName",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"id",
")",
"&&",
"array_key_exists",
"(",
"intval",
"(",
"$",
"id",
")",
",",
"self",
"::",
"$",
"counties",
")",
")",
"{",
"return",
"self"... | Returns the county name of a given county id
@param int $id This should be the id of the county you wish to know the name of
@return string|false Will return the county name of the id if it exists else will return false | [
"Returns",
"the",
"county",
"name",
"of",
"a",
"given",
"county",
"id"
] | 8e9d34048acde404fce545506750f77b8f8d7275 | https://github.com/AdamB7586/UK_Counties/blob/8e9d34048acde404fce545506750f77b8f8d7275/src/Counties.php#L173-L178 | train |
GrottoPress/form-field | src/Field.php | Field.metaString | protected function metaString(): string
{
if (!$this->meta) {
return '';
}
return \join(' ', \array_map(function (string $key, $value): string {
return $this->slugify($key).'="'.$this->escape->attr($value).'"';
}, \array_keys($this->meta), \array_values($this... | php | protected function metaString(): string
{
if (!$this->meta) {
return '';
}
return \join(' ', \array_map(function (string $key, $value): string {
return $this->slugify($key).'="'.$this->escape->attr($value).'"';
}, \array_keys($this->meta), \array_values($this... | [
"protected",
"function",
"metaString",
"(",
")",
":",
"string",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"meta",
")",
"{",
"return",
"''",
";",
"}",
"return",
"\\",
"join",
"(",
"' '",
",",
"\\",
"array_map",
"(",
"function",
"(",
"string",
"$",
"ke... | Convert meta to string | [
"Convert",
"meta",
"to",
"string"
] | 6566ee2e0d1bab2176c74dedae3f01f86048ac11 | https://github.com/GrottoPress/form-field/blob/6566ee2e0d1bab2176c74dedae3f01f86048ac11/src/Field.php#L369-L378 | train |
GrottoPress/form-field | src/Field.php | Field.equiv | protected function equiv($a, $b): bool
{
if (\is_array($a) && \is_scalar($b)) {
return \in_array($b, $a);
}
if (\is_array($b) && \is_scalar($a)) {
return \in_array($a, $b);
}
return ($a == $b);
} | php | protected function equiv($a, $b): bool
{
if (\is_array($a) && \is_scalar($b)) {
return \in_array($b, $a);
}
if (\is_array($b) && \is_scalar($a)) {
return \in_array($a, $b);
}
return ($a == $b);
} | [
"protected",
"function",
"equiv",
"(",
"$",
"a",
",",
"$",
"b",
")",
":",
"bool",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"a",
")",
"&&",
"\\",
"is_scalar",
"(",
"$",
"b",
")",
")",
"{",
"return",
"\\",
"in_array",
"(",
"$",
"b",
",",
"$"... | Are two values equivalent.
For the purposes of this class, equivalence is defined as:
- When the two variables have equal values;
- When the two variables have identical values;
- When one variable's value is contained in the other variable's value,
where any one of the variables is a set/array.
@param mixed $a
@para... | [
"Are",
"two",
"values",
"equivalent",
"."
] | 6566ee2e0d1bab2176c74dedae3f01f86048ac11 | https://github.com/GrottoPress/form-field/blob/6566ee2e0d1bab2176c74dedae3f01f86048ac11/src/Field.php#L419-L430 | train |
Gendoria/command-queue | src/Gendoria/CommandQueue/Worker/WorkerRunnerManager.php | WorkerRunnerManager.addRunner | public function addRunner($name, WorkerRunnerInterface $runner, array $options = array())
{
$this->runners[$name] = array(
'runner' => $runner,
'options' => $options,
);
} | php | public function addRunner($name, WorkerRunnerInterface $runner, array $options = array())
{
$this->runners[$name] = array(
'runner' => $runner,
'options' => $options,
);
} | [
"public",
"function",
"addRunner",
"(",
"$",
"name",
",",
"WorkerRunnerInterface",
"$",
"runner",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"runners",
"[",
"$",
"name",
"]",
"=",
"array",
"(",
"'runner'",
"=>",
... | Register runner.
@param string $name Worker name.
@param WorkerRunnerInterface $runner Worker runner.
@param array $options Worker options. | [
"Register",
"runner",
"."
] | 4e1094570705942f2ce3b2c976b5b251c3c84b40 | https://github.com/Gendoria/command-queue/blob/4e1094570705942f2ce3b2c976b5b251c3c84b40/src/Gendoria/CommandQueue/Worker/WorkerRunnerManager.php#L30-L36 | train |
Gendoria/command-queue | src/Gendoria/CommandQueue/Worker/WorkerRunnerManager.php | WorkerRunnerManager.run | public function run($name, OutputInterface $output = null)
{
if (!$this->has($name)) {
throw new InvalidArgumentException("No runner service registered for provided name.");
}
/* @var $runner WorkerRunnerInterface */
$runner = $this->runners[$name]['runner'];
$run... | php | public function run($name, OutputInterface $output = null)
{
if (!$this->has($name)) {
throw new InvalidArgumentException("No runner service registered for provided name.");
}
/* @var $runner WorkerRunnerInterface */
$runner = $this->runners[$name]['runner'];
$run... | [
"public",
"function",
"run",
"(",
"$",
"name",
",",
"OutputInterface",
"$",
"output",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"No runner service ... | Run worker.
@param string $name
@param OutputInterface $output
@return void
@throws InvalidArgumentException Thrown, if worker cannto be found for provided name.
@throws Exception Can be thrown, if runner resulted with an error. | [
"Run",
"worker",
"."
] | 4e1094570705942f2ce3b2c976b5b251c3c84b40 | https://github.com/Gendoria/command-queue/blob/4e1094570705942f2ce3b2c976b5b251c3c84b40/src/Gendoria/CommandQueue/Worker/WorkerRunnerManager.php#L58-L66 | train |
wb-crowdfusion/crowdfusion | system/core/classes/systemdb/config/ConfigService.php | ConfigService.insertSnippet | public function insertSnippet(Plugin $plugin, $text, &$log = '')
{
$snippetProperties = $this->readProperties($text);
$configContents = file_get_contents($this->configFileLocation);
if (stripos($configContents, "BEGIN PLUGIN CONFIG: {$plugin->Slug}") === false) {
/* foreach(... | php | public function insertSnippet(Plugin $plugin, $text, &$log = '')
{
$snippetProperties = $this->readProperties($text);
$configContents = file_get_contents($this->configFileLocation);
if (stripos($configContents, "BEGIN PLUGIN CONFIG: {$plugin->Slug}") === false) {
/* foreach(... | [
"public",
"function",
"insertSnippet",
"(",
"Plugin",
"$",
"plugin",
",",
"$",
"text",
",",
"&",
"$",
"log",
"=",
"''",
")",
"{",
"$",
"snippetProperties",
"=",
"$",
"this",
"->",
"readProperties",
"(",
"$",
"text",
")",
";",
"$",
"configContents",
"="... | Write the specified text to the config file
@param Plugin $plugin The plugin that requested the addition
@param string $text The text to add
@param string &$log Holds a log of the changes made
@return true | [
"Write",
"the",
"specified",
"text",
"to",
"the",
"config",
"file"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/systemdb/config/ConfigService.php#L84-L128 | train |
wb-crowdfusion/crowdfusion | system/core/classes/systemdb/config/ConfigService.php | ConfigService.readProperties | public function readProperties($config = null, $filter = null)
{
if(is_null($config))
$config = file_get_contents($this->configFileLocation);
$props = preg_match_all('/\s*\$properties\[[\'\"]([^\"^\']+)[\'\"]\]\s*=\s*(.*?);[\n\r\t]?/s', $config, $m);
$config = array();
... | php | public function readProperties($config = null, $filter = null)
{
if(is_null($config))
$config = file_get_contents($this->configFileLocation);
$props = preg_match_all('/\s*\$properties\[[\'\"]([^\"^\']+)[\'\"]\]\s*=\s*(.*?);[\n\r\t]?/s', $config, $m);
$config = array();
... | [
"public",
"function",
"readProperties",
"(",
"$",
"config",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"config",
")",
")",
"$",
"config",
"=",
"file_get_contents",
"(",
"$",
"this",
"->",
"configFileLocation",... | Parses the properties file.
NOTE: Even though the properties file looks like php, and ends in a .php extension,
we just parse it out all by hand here.
@param string $config The contents of the config file to parse.
If not specified, it will use the config file from $this->configFileLocation
@param string $filter If s... | [
"Parses",
"the",
"properties",
"file",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/systemdb/config/ConfigService.php#L142-L157 | train |
wb-crowdfusion/crowdfusion | system/core/classes/systemdb/config/ConfigService.php | ConfigService.saveContents | public function saveContents($contents)
{
$path = pathinfo($this->configFileLocation);
//BACKUP CURRENT config.php
$backup = $this->backupPath.'/pluginconfig.'.date('Y_m_d_His').'.php';
FileSystemUtils::safeCopy($this->configFileLocation, $backup);
//OVERWRITE config.php W... | php | public function saveContents($contents)
{
$path = pathinfo($this->configFileLocation);
//BACKUP CURRENT config.php
$backup = $this->backupPath.'/pluginconfig.'.date('Y_m_d_His').'.php';
FileSystemUtils::safeCopy($this->configFileLocation, $backup);
//OVERWRITE config.php W... | [
"public",
"function",
"saveContents",
"(",
"$",
"contents",
")",
"{",
"$",
"path",
"=",
"pathinfo",
"(",
"$",
"this",
"->",
"configFileLocation",
")",
";",
"//BACKUP CURRENT config.php",
"$",
"backup",
"=",
"$",
"this",
"->",
"backupPath",
".",
"'/pluginconfig... | Writes the contents to the config file, after first
backing up the current config
@param string $contents The contents to write to the config file
@return void | [
"Writes",
"the",
"contents",
"to",
"the",
"config",
"file",
"after",
"first",
"backing",
"up",
"the",
"current",
"config"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/systemdb/config/ConfigService.php#L167-L181 | train |
Blipfoto/php-sdk | src/Blipfoto/Api/Request.php | Request.header | public function header() {
$args = func_get_args();
$name = $args[0];
if (count($args) == 2) {
$this->headers[$name] = $args[1];
}
return $this->headers[$name];
} | php | public function header() {
$args = func_get_args();
$name = $args[0];
if (count($args) == 2) {
$this->headers[$name] = $args[1];
}
return $this->headers[$name];
} | [
"public",
"function",
"header",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"name",
"=",
"$",
"args",
"[",
"0",
"]",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"==",
"2",
")",
"{",
"$",
"this",
"->",
"headers",
... | Get and optionally set a header.
@param string $name
@param mixed $value (optional)
@return mixed | [
"Get",
"and",
"optionally",
"set",
"a",
"header",
"."
] | 04f770ac7427e79d15f97b993c787651079cdeb4 | https://github.com/Blipfoto/php-sdk/blob/04f770ac7427e79d15f97b993c787651079cdeb4/src/Blipfoto/Api/Request.php#L88-L95 | train |
Blipfoto/php-sdk | src/Blipfoto/Api/Request.php | Request.url | public function url() {
$url = $this->client->endpoint() . $this->resource . '.json';
if (in_array($this->method, ['GET', 'DELETE']) && $this->params !== null) {
$url .= '?' . http_build_query($this->params);
}
return $url;
} | php | public function url() {
$url = $this->client->endpoint() . $this->resource . '.json';
if (in_array($this->method, ['GET', 'DELETE']) && $this->params !== null) {
$url .= '?' . http_build_query($this->params);
}
return $url;
} | [
"public",
"function",
"url",
"(",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"client",
"->",
"endpoint",
"(",
")",
".",
"$",
"this",
"->",
"resource",
".",
"'.json'",
";",
"if",
"(",
"in_array",
"(",
"$",
"this",
"->",
"method",
",",
"[",
"'GE... | Return the request url.
@return string | [
"Return",
"the",
"request",
"url",
"."
] | 04f770ac7427e79d15f97b993c787651079cdeb4 | https://github.com/Blipfoto/php-sdk/blob/04f770ac7427e79d15f97b993c787651079cdeb4/src/Blipfoto/Api/Request.php#L111-L117 | train |
Blipfoto/php-sdk | src/Blipfoto/Api/Request.php | Request.send | public function send() {
$url = $this->url();
// Set fields for post or put requests.
$this->curl = curl_init();
curl_setopt($this->curl, CURLOPT_CUSTOMREQUEST, $this->method);
if (in_array($this->method, ['POST', 'PUT'])) {
$this->buildBody();
} else {
$this->header('Content-Type', null);
}
c... | php | public function send() {
$url = $this->url();
// Set fields for post or put requests.
$this->curl = curl_init();
curl_setopt($this->curl, CURLOPT_CUSTOMREQUEST, $this->method);
if (in_array($this->method, ['POST', 'PUT'])) {
$this->buildBody();
} else {
$this->header('Content-Type', null);
}
c... | [
"public",
"function",
"send",
"(",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"url",
"(",
")",
";",
"// Set fields for post or put requests.",
"$",
"this",
"->",
"curl",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"this",
"->",
"curl",
... | Make a request and return the response data if successful.
@return Response
@throws NetworkException | [
"Make",
"a",
"request",
"and",
"return",
"the",
"response",
"data",
"if",
"successful",
"."
] | 04f770ac7427e79d15f97b993c787651079cdeb4 | https://github.com/Blipfoto/php-sdk/blob/04f770ac7427e79d15f97b993c787651079cdeb4/src/Blipfoto/Api/Request.php#L125-L194 | train |
Blipfoto/php-sdk | src/Blipfoto/Api/Request.php | Request.buildBody | protected function buildBody() {
// If we are uploading files, we have to build the request body manually since the stupid syntax for file uploads
// will break non-file values beginning with '@'. When we no longer support PHP 5.4 we can just turn this syntax off
// and use CurlFile.
if (count($this->files(... | php | protected function buildBody() {
// If we are uploading files, we have to build the request body manually since the stupid syntax for file uploads
// will break non-file values beginning with '@'. When we no longer support PHP 5.4 we can just turn this syntax off
// and use CurlFile.
if (count($this->files(... | [
"protected",
"function",
"buildBody",
"(",
")",
"{",
"// If we are uploading files, we have to build the request body manually since the stupid syntax for file uploads",
"// will break non-file values beginning with '@'. When we no longer support PHP 5.4 we can just turn this syntax off",
"// and us... | Build the request body. | [
"Build",
"the",
"request",
"body",
"."
] | 04f770ac7427e79d15f97b993c787651079cdeb4 | https://github.com/Blipfoto/php-sdk/blob/04f770ac7427e79d15f97b993c787651079cdeb4/src/Blipfoto/Api/Request.php#L208-L239 | train |
gplcart/cli | controllers/commands/Trigger.php | Trigger.cmdGetTrigger | public function cmdGetTrigger()
{
$result = $this->getListTrigger();
$this->outputFormat($result);
$this->outputFormatTableTrigger($result);
$this->output();
} | php | public function cmdGetTrigger()
{
$result = $this->getListTrigger();
$this->outputFormat($result);
$this->outputFormatTableTrigger($result);
$this->output();
} | [
"public",
"function",
"cmdGetTrigger",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getListTrigger",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTableTrigger",
"(",
"$",
"resul... | Callback for "trigger-get" command | [
"Callback",
"for",
"trigger",
"-",
"get",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Trigger.php#L40-L46 | train |
gplcart/cli | controllers/commands/Trigger.php | Trigger.cmdUpdateTrigger | public function cmdUpdateTrigger()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'));
... | php | public function cmdUpdateTrigger()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'));
... | [
"public",
"function",
"cmdUpdateTrigger",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getParam",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"params",
"[",
"0",
"]",
")",
"||",
"count",
"(",
"$",
"params",
")",
"<",
"2",
")",
"{",
"... | Callback for "trigger-update" command | [
"Callback",
"for",
"trigger",
"-",
"update",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Trigger.php#L96-L117 | train |
gplcart/cli | controllers/commands/Trigger.php | Trigger.addTrigger | protected function addTrigger()
{
if (!$this->isError()) {
$state_id = $this->trigger->add($this->getSubmitted());
if (empty($state_id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($state_id);
}
} | php | protected function addTrigger()
{
if (!$this->isError()) {
$state_id = $this->trigger->add($this->getSubmitted());
if (empty($state_id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($state_id);
}
} | [
"protected",
"function",
"addTrigger",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isError",
"(",
")",
")",
"{",
"$",
"state_id",
"=",
"$",
"this",
"->",
"trigger",
"->",
"add",
"(",
"$",
"this",
"->",
"getSubmitted",
"(",
")",
")",
";",
"... | Add a new trigger | [
"Add",
"a",
"new",
"trigger"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Trigger.php#L180-L189 | train |
gplcart/cli | controllers/commands/Trigger.php | Trigger.submitAddTrigger | protected function submitAddTrigger()
{
$this->setSubmitted(null, $this->getParam());
$this->setSubmitted('data.conditions', $this->getSubmitted('conditions'));
$this->setSubmittedList('data.conditions');
$this->validateComponent('trigger');
$this->addTrigger();
} | php | protected function submitAddTrigger()
{
$this->setSubmitted(null, $this->getParam());
$this->setSubmitted('data.conditions', $this->getSubmitted('conditions'));
$this->setSubmittedList('data.conditions');
$this->validateComponent('trigger');
$this->addTrigger();
} | [
"protected",
"function",
"submitAddTrigger",
"(",
")",
"{",
"$",
"this",
"->",
"setSubmitted",
"(",
"null",
",",
"$",
"this",
"->",
"getParam",
"(",
")",
")",
";",
"$",
"this",
"->",
"setSubmitted",
"(",
"'data.conditions'",
",",
"$",
"this",
"->",
"getS... | Add a new trigger at once | [
"Add",
"a",
"new",
"trigger",
"at",
"once"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Trigger.php#L205-L213 | train |
gplcart/cli | controllers/commands/Trigger.php | Trigger.wizardAddTrigger | protected function wizardAddTrigger()
{
$this->validatePrompt('name', $this->text('Name'), 'trigger');
$this->validatePrompt('store_id', $this->text('Store'), 'trigger');
$this->validatePromptList('data.conditions', $this->text('Conditions'), 'trigger');
$this->validatePrompt('status... | php | protected function wizardAddTrigger()
{
$this->validatePrompt('name', $this->text('Name'), 'trigger');
$this->validatePrompt('store_id', $this->text('Store'), 'trigger');
$this->validatePromptList('data.conditions', $this->text('Conditions'), 'trigger');
$this->validatePrompt('status... | [
"protected",
"function",
"wizardAddTrigger",
"(",
")",
"{",
"$",
"this",
"->",
"validatePrompt",
"(",
"'name'",
",",
"$",
"this",
"->",
"text",
"(",
"'Name'",
")",
",",
"'trigger'",
")",
";",
"$",
"this",
"->",
"validatePrompt",
"(",
"'store_id'",
",",
"... | Add a trigger step by step | [
"Add",
"a",
"trigger",
"step",
"by",
"step"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Trigger.php#L218-L229 | train |
valu-digital/valusetup | src/ValuSetup/Service/AuthService.php | AuthService.getIdentity | public function getIdentity()
{
if($this->hasIdentity()){
if($this->identity === null){
$identity = $this->authenticationService->getIdentity();
$identity = array_merge(
$identity,
$this->getOption('identity... | php | public function getIdentity()
{
if($this->hasIdentity()){
if($this->identity === null){
$identity = $this->authenticationService->getIdentity();
$identity = array_merge(
$identity,
$this->getOption('identity... | [
"public",
"function",
"getIdentity",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasIdentity",
"(",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"identity",
"===",
"null",
")",
"{",
"$",
"identity",
"=",
"$",
"this",
"->",
"authenticationService",
... | Returns the identity or null if no identity is available
@return mixed|null | [
"Returns",
"the",
"identity",
"or",
"null",
"if",
"no",
"identity",
"is",
"available"
] | db1a0bfe1262d555eb11cd0d99625b9ee43d6744 | https://github.com/valu-digital/valusetup/blob/db1a0bfe1262d555eb11cd0d99625b9ee43d6744/src/ValuSetup/Service/AuthService.php#L95-L131 | train |
valu-digital/valusetup | src/ValuSetup/Service/AuthService.php | AuthService.getStorage | public function getStorage()
{
if(!$this->storage && $this->getServiceLocator()->has(self::STORAGE_LOCATOR_KEY)){
$this->setStorage($this->getServiceLocator()->get(self::STORAGE_LOCATOR_KEY));
}
return $this->storage;
} | php | public function getStorage()
{
if(!$this->storage && $this->getServiceLocator()->has(self::STORAGE_LOCATOR_KEY)){
$this->setStorage($this->getServiceLocator()->get(self::STORAGE_LOCATOR_KEY));
}
return $this->storage;
} | [
"public",
"function",
"getStorage",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"storage",
"&&",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"has",
"(",
"self",
"::",
"STORAGE_LOCATOR_KEY",
")",
")",
"{",
"$",
"this",
"->",
"setStorag... | Retrieve storage instance
@return \Zend\Authentication\Storage\StorageInterface
@ValuService\Exclude | [
"Retrieve",
"storage",
"instance"
] | db1a0bfe1262d555eb11cd0d99625b9ee43d6744 | https://github.com/valu-digital/valusetup/blob/db1a0bfe1262d555eb11cd0d99625b9ee43d6744/src/ValuSetup/Service/AuthService.php#L172-L179 | train |
valu-digital/valusetup | src/ValuSetup/Service/AuthService.php | AuthService.getAuthenticationService | protected function getAuthenticationService()
{
if ($this->authenticationService === null) {
$this->authenticationService = new AuthenticationService($this->getStorage());
}
return $this->authenticationService;
} | php | protected function getAuthenticationService()
{
if ($this->authenticationService === null) {
$this->authenticationService = new AuthenticationService($this->getStorage());
}
return $this->authenticationService;
} | [
"protected",
"function",
"getAuthenticationService",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"authenticationService",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"authenticationService",
"=",
"new",
"AuthenticationService",
"(",
"$",
"this",
"->",
"getStora... | Retrieve AuthenticationService instance
@return \Zend\Authentication\AuthenticationService | [
"Retrieve",
"AuthenticationService",
"instance"
] | db1a0bfe1262d555eb11cd0d99625b9ee43d6744 | https://github.com/valu-digital/valusetup/blob/db1a0bfe1262d555eb11cd0d99625b9ee43d6744/src/ValuSetup/Service/AuthService.php#L206-L213 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.