repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
withfatpanda/illuminate-wordpress | src/WordPress/Plugin.php | Plugin.registerArtisanCommand | protected function registerArtisanCommand()
{
if (!class_exists('WP_CLI')) {
return false;
}
/**
* Run Laravel Artisan for this plugin
*/
\WP_CLI::add_command($this->getCLICommandName(), function() {
$args = [];
// rebuild args, because WP_CLI does stuff to it...
... | php | protected function registerArtisanCommand()
{
if (!class_exists('WP_CLI')) {
return false;
}
/**
* Run Laravel Artisan for this plugin
*/
\WP_CLI::add_command($this->getCLICommandName(), function() {
$args = [];
// rebuild args, because WP_CLI does stuff to it...
... | [
"protected",
"function",
"registerArtisanCommand",
"(",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"'WP_CLI'",
")",
")",
"{",
"return",
"false",
";",
"}",
"/**\n * Run Laravel Artisan for this plugin\n */",
"\\",
"WP_CLI",
"::",
"add_command",
"(",
"$",
... | Create a WP-CLI command for running Artisan. | [
"Create",
"a",
"WP",
"-",
"CLI",
"command",
"for",
"running",
"Artisan",
"."
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Plugin.php#L1083-L1106 |
withfatpanda/illuminate-wordpress | src/WordPress/Plugin.php | Plugin.registerRestRouter | protected function registerRestRouter()
{
$this->singleton('FatPanda\Illuminate\WordPress\Http\Router', function() {
// create the router
$router = new Router($this);
$router->setNamespace($this->getRestNamespace());
$router->setVersion($this->getRestVersion());
$router->setControlle... | php | protected function registerRestRouter()
{
$this->singleton('FatPanda\Illuminate\WordPress\Http\Router', function() {
// create the router
$router = new Router($this);
$router->setNamespace($this->getRestNamespace());
$router->setVersion($this->getRestVersion());
$router->setControlle... | [
"protected",
"function",
"registerRestRouter",
"(",
")",
"{",
"$",
"this",
"->",
"singleton",
"(",
"'FatPanda\\Illuminate\\WordPress\\Http\\Router'",
",",
"function",
"(",
")",
"{",
"// create the router",
"$",
"router",
"=",
"new",
"Router",
"(",
"$",
"this",
")"... | Create router instance and load routes | [
"Create",
"router",
"instance",
"and",
"load",
"routes"
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Plugin.php#L1156-L1170 |
tequila/mongodb-php-lib | src/Write/Model/Update.php | Update.writeToBulk | public function writeToBulk(BulkWrite $bulk)
{
$bulk->update($this->filter, $this->update, $this->options);
} | php | public function writeToBulk(BulkWrite $bulk)
{
$bulk->update($this->filter, $this->update, $this->options);
} | [
"public",
"function",
"writeToBulk",
"(",
"BulkWrite",
"$",
"bulk",
")",
"{",
"$",
"bulk",
"->",
"update",
"(",
"$",
"this",
"->",
"filter",
",",
"$",
"this",
"->",
"update",
",",
"$",
"this",
"->",
"options",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/tequila/mongodb-php-lib/blob/49a25f45268df358f5ceb40a655d9a7ddc6db4f7/src/Write/Model/Update.php#L41-L44 |
FrenchFrogs/framework | src/Table/Table/Export.php | Export.toCsv | public function toCsv($filename = null)
{
// on set le nom du fichier
if (!is_null($filename)) {
$this->setFilename($filename);
}
// si pas de nom de fichier setté, on met celui par default
if (!$this->hasFilename()) {
$this->setFilename($this->filen... | php | public function toCsv($filename = null)
{
// on set le nom du fichier
if (!is_null($filename)) {
$this->setFilename($filename);
}
// si pas de nom de fichier setté, on met celui par default
if (!$this->hasFilename()) {
$this->setFilename($this->filen... | [
"public",
"function",
"toCsv",
"(",
"$",
"filename",
"=",
"null",
")",
"{",
"// on set le nom du fichier",
"if",
"(",
"!",
"is_null",
"(",
"$",
"filename",
")",
")",
"{",
"$",
"this",
"->",
"setFilename",
"(",
"$",
"filename",
")",
";",
"}",
"// si pas d... | Export dans un fichier CSV
@param $filename
@param bool $download
@return $this | [
"Export",
"dans",
"un",
"fichier",
"CSV"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Table/Export.php#L119-L150 |
remialvado/RiakBundle | DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('riak');
$rootNode
->children()
->arrayNode("clusters")
->useAttributeAsKey('name')
->prototype("array")
... | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('riak');
$rootNode
->children()
->arrayNode("clusters")
->useAttributeAsKey('name')
->prototype("array")
... | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"rootNode",
"=",
"$",
"treeBuilder",
"->",
"root",
"(",
"'riak'",
")",
";",
"$",
"rootNode",
"->",
"children",
"(",
")",
"->",... | {@inheritDoc} | [
"{"
] | train | https://github.com/remialvado/RiakBundle/blob/089ae818738e512a90b2fa93de6c4991242f5b7b/DependencyInjection/Configuration.php#L20-L58 |
Graphiques-Digitale/silverstripe-seo-metadata | code/SEO_Metadata_SiteTree_DataExtension.php | SEO_Metadata_SiteTree_DataExtension.getSEOFields | public function getSEOFields()
{
// Variables
$config = SiteConfig::current_site_config();
$SEO = [];
// Canonical
if ($config->CanonicalEnabled()) {
$SEO[] = ReadonlyField::create('ReadonlyMetaCanonical', 'link rel="canonical"', $this->owner->AbsoluteLink());
... | php | public function getSEOFields()
{
// Variables
$config = SiteConfig::current_site_config();
$SEO = [];
// Canonical
if ($config->CanonicalEnabled()) {
$SEO[] = ReadonlyField::create('ReadonlyMetaCanonical', 'link rel="canonical"', $this->owner->AbsoluteLink());
... | [
"public",
"function",
"getSEOFields",
"(",
")",
"{",
"// Variables",
"$",
"config",
"=",
"SiteConfig",
"::",
"current_site_config",
"(",
")",
";",
"$",
"SEO",
"=",
"[",
"]",
";",
"// Canonical",
"if",
"(",
"$",
"config",
"->",
"CanonicalEnabled",
"(",
")",... | Gets SEO fields.
@return array | [
"Gets",
"SEO",
"fields",
"."
] | train | https://github.com/Graphiques-Digitale/silverstripe-seo-metadata/blob/f92128688a60b6c6b514b6efb1486ac60f4a8e03/code/SEO_Metadata_SiteTree_DataExtension.php#L51-L73 |
Graphiques-Digitale/silverstripe-seo-metadata | code/SEO_Metadata_SiteTree_DataExtension.php | SEO_Metadata_SiteTree_DataExtension.getFullOutput | public function getFullOutput()
{
return array(
LiteralField::create('HeaderMetadata', '<pre class="bold">$Metadata()</pre>'),
LiteralField::create('LiteralMetadata', '<pre>' . nl2br(htmlentities(trim($this->owner->Metadata()), ENT_QUOTES)) . '</pre>')
);
} | php | public function getFullOutput()
{
return array(
LiteralField::create('HeaderMetadata', '<pre class="bold">$Metadata()</pre>'),
LiteralField::create('LiteralMetadata', '<pre>' . nl2br(htmlentities(trim($this->owner->Metadata()), ENT_QUOTES)) . '</pre>')
);
} | [
"public",
"function",
"getFullOutput",
"(",
")",
"{",
"return",
"array",
"(",
"LiteralField",
"::",
"create",
"(",
"'HeaderMetadata'",
",",
"'<pre class=\"bold\">$Metadata()</pre>'",
")",
",",
"LiteralField",
"::",
"create",
"(",
"'LiteralMetadata'",
",",
"'<pre>'",
... | Gets the full output.
@return array | [
"Gets",
"the",
"full",
"output",
"."
] | train | https://github.com/Graphiques-Digitale/silverstripe-seo-metadata/blob/f92128688a60b6c6b514b6efb1486ac60f4a8e03/code/SEO_Metadata_SiteTree_DataExtension.php#L80-L86 |
Graphiques-Digitale/silverstripe-seo-metadata | code/SEO_Metadata_SiteTree_DataExtension.php | SEO_Metadata_SiteTree_DataExtension.Metadata | public function Metadata()
{
// variables
$config = SiteConfig::current_site_config();
// begin SEO
$metadata = PHP_EOL . $this->owner->MarkupComment('SEO');
// register extension update hook
$this->owner->extend('updateMetadata', $config, $this->owner, $metadata);
... | php | public function Metadata()
{
// variables
$config = SiteConfig::current_site_config();
// begin SEO
$metadata = PHP_EOL . $this->owner->MarkupComment('SEO');
// register extension update hook
$this->owner->extend('updateMetadata', $config, $this->owner, $metadata);
... | [
"public",
"function",
"Metadata",
"(",
")",
"{",
"// variables",
"$",
"config",
"=",
"SiteConfig",
"::",
"current_site_config",
"(",
")",
";",
"// begin SEO",
"$",
"metadata",
"=",
"PHP_EOL",
".",
"$",
"this",
"->",
"owner",
"->",
"MarkupComment",
"(",
"'SEO... | Main function to format & output metadata as an HTML string.
Use the `updateMetadata($config, $owner, $metadata)` update hook when extending `DataExtension`s.
@return string | [
"Main",
"function",
"to",
"format",
"&",
"output",
"metadata",
"as",
"an",
"HTML",
"string",
"."
] | train | https://github.com/Graphiques-Digitale/silverstripe-seo-metadata/blob/f92128688a60b6c6b514b6efb1486ac60f4a8e03/code/SEO_Metadata_SiteTree_DataExtension.php#L95-L107 |
Graphiques-Digitale/silverstripe-seo-metadata | code/SEO_Metadata_SiteTree_DataExtension.php | SEO_Metadata_SiteTree_DataExtension.updateMetadata | public function updateMetadata(SiteConfig $config, SiteTree $owner, &$metadata)
{
// metadata
$metadata .= $owner->MarkupComment('Metadata');
// charset
if ($config->CharsetEnabled()) {
$metadata .= '<meta charset="' . $config->Charset() . '" />' . PHP_EOL;
}
... | php | public function updateMetadata(SiteConfig $config, SiteTree $owner, &$metadata)
{
// metadata
$metadata .= $owner->MarkupComment('Metadata');
// charset
if ($config->CharsetEnabled()) {
$metadata .= '<meta charset="' . $config->Charset() . '" />' . PHP_EOL;
}
... | [
"public",
"function",
"updateMetadata",
"(",
"SiteConfig",
"$",
"config",
",",
"SiteTree",
"$",
"owner",
",",
"&",
"$",
"metadata",
")",
"{",
"// metadata",
"$",
"metadata",
".=",
"$",
"owner",
"->",
"MarkupComment",
"(",
"'Metadata'",
")",
";",
"// charset"... | Updates metadata fields.
@param SiteConfig $config
@param SiteTree $owner
@param string $metadata
@return void | [
"Updates",
"metadata",
"fields",
"."
] | train | https://github.com/Graphiques-Digitale/silverstripe-seo-metadata/blob/f92128688a60b6c6b514b6efb1486ac60f4a8e03/code/SEO_Metadata_SiteTree_DataExtension.php#L122-L147 |
Graphiques-Digitale/silverstripe-seo-metadata | code/SEO_Metadata_SiteTree_DataExtension.php | SEO_Metadata_SiteTree_DataExtension.MarkupMeta | public function MarkupMeta($name, $content, $encode = null)
{
if ($encode !== null) {
return '<meta name="' . $name . '" content="' . $this->encodeContent($content, $encode) . '" />' . PHP_EOL;
} else {
return '<meta name="' . $name . '" content="' . $content . '" />' . PHP_E... | php | public function MarkupMeta($name, $content, $encode = null)
{
if ($encode !== null) {
return '<meta name="' . $name . '" content="' . $this->encodeContent($content, $encode) . '" />' . PHP_EOL;
} else {
return '<meta name="' . $name . '" content="' . $content . '" />' . PHP_E... | [
"public",
"function",
"MarkupMeta",
"(",
"$",
"name",
",",
"$",
"content",
",",
"$",
"encode",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"encode",
"!==",
"null",
")",
"{",
"return",
"'<meta name=\"'",
".",
"$",
"name",
".",
"'\" content=\"'",
".",
"$",
... | Returns markup for a HTML meta element. Can be flagged for encoding.
@param string $name
@param string $content
@param string|null $encode
@return string | [
"Returns",
"markup",
"for",
"a",
"HTML",
"meta",
"element",
".",
"Can",
"be",
"flagged",
"for",
"encoding",
"."
] | train | https://github.com/Graphiques-Digitale/silverstripe-seo-metadata/blob/f92128688a60b6c6b514b6efb1486ac60f4a8e03/code/SEO_Metadata_SiteTree_DataExtension.php#L174-L181 |
Graphiques-Digitale/silverstripe-seo-metadata | code/SEO_Metadata_SiteTree_DataExtension.php | SEO_Metadata_SiteTree_DataExtension.MarkupLink | public function MarkupLink($rel, $href, $type = null, $sizes = null)
{
// start fragment
$return = '<link rel="' . $rel . '" href="' . $href . '"';
// if type
if ($type !== null) {
$return .= ' type="' . $type . '"';
}
// if sizes
if ($sizes !== nu... | php | public function MarkupLink($rel, $href, $type = null, $sizes = null)
{
// start fragment
$return = '<link rel="' . $rel . '" href="' . $href . '"';
// if type
if ($type !== null) {
$return .= ' type="' . $type . '"';
}
// if sizes
if ($sizes !== nu... | [
"public",
"function",
"MarkupLink",
"(",
"$",
"rel",
",",
"$",
"href",
",",
"$",
"type",
"=",
"null",
",",
"$",
"sizes",
"=",
"null",
")",
"{",
"// start fragment",
"$",
"return",
"=",
"'<link rel=\"'",
".",
"$",
"rel",
".",
"'\" href=\"'",
".",
"$",
... | Returns markup for a HTML link element.
@param string $rel
@param string $href
@param string|null $type
@param string|null $sizes
@return string | [
"Returns",
"markup",
"for",
"a",
"HTML",
"link",
"element",
"."
] | train | https://github.com/Graphiques-Digitale/silverstripe-seo-metadata/blob/f92128688a60b6c6b514b6efb1486ac60f4a8e03/code/SEO_Metadata_SiteTree_DataExtension.php#L193-L209 |
Graphiques-Digitale/silverstripe-seo-metadata | code/SEO_Metadata_SiteTree_DataExtension.php | SEO_Metadata_SiteTree_DataExtension.GenerateTitle | public function GenerateTitle()
{
if ($this->owner->MetaTitle) {
return $this->owner->MetaTitle;
} else {
return SiteConfig::current_site_config()->GenerateTitle($this->owner->Title);
}
} | php | public function GenerateTitle()
{
if ($this->owner->MetaTitle) {
return $this->owner->MetaTitle;
} else {
return SiteConfig::current_site_config()->GenerateTitle($this->owner->Title);
}
} | [
"public",
"function",
"GenerateTitle",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"MetaTitle",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"MetaTitle",
";",
"}",
"else",
"{",
"return",
"SiteConfig",
"::",
"current_site_config",
... | Generates HTML title based on configuration settings.
@return string|null | [
"Generates",
"HTML",
"title",
"based",
"on",
"configuration",
"settings",
"."
] | train | https://github.com/Graphiques-Digitale/silverstripe-seo-metadata/blob/f92128688a60b6c6b514b6efb1486ac60f4a8e03/code/SEO_Metadata_SiteTree_DataExtension.php#L220-L227 |
Graphiques-Digitale/silverstripe-seo-metadata | code/SEO_Metadata_SiteTree_DataExtension.php | SEO_Metadata_SiteTree_DataExtension.GenerateDescription | public function GenerateDescription()
{
if ($this->owner->MetaDescription) {
return $this->owner->MetaDescription;
} else {
return $this->owner->GenerateDescriptionFromContent();
}
} | php | public function GenerateDescription()
{
if ($this->owner->MetaDescription) {
return $this->owner->MetaDescription;
} else {
return $this->owner->GenerateDescriptionFromContent();
}
} | [
"public",
"function",
"GenerateDescription",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"MetaDescription",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"MetaDescription",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
"owne... | Generates description from the page `MetaDescription`, or the first paragraph of the `Content` attribute.
@return string|null | [
"Generates",
"description",
"from",
"the",
"page",
"MetaDescription",
"or",
"the",
"first",
"paragraph",
"of",
"the",
"Content",
"attribute",
"."
] | train | https://github.com/Graphiques-Digitale/silverstripe-seo-metadata/blob/f92128688a60b6c6b514b6efb1486ac60f4a8e03/code/SEO_Metadata_SiteTree_DataExtension.php#L234-L241 |
Graphiques-Digitale/silverstripe-seo-metadata | code/SEO_Metadata_SiteTree_DataExtension.php | SEO_Metadata_SiteTree_DataExtension.GenerateDescriptionFromContent | public function GenerateDescriptionFromContent()
{
// check for content
if ($content = trim($this->owner->Content)) {
// pillage first paragraph from page content
if (preg_match('/<p>(.*?)<\/p>/i', $content, $match)) {
// is HTML
$content = $ma... | php | public function GenerateDescriptionFromContent()
{
// check for content
if ($content = trim($this->owner->Content)) {
// pillage first paragraph from page content
if (preg_match('/<p>(.*?)<\/p>/i', $content, $match)) {
// is HTML
$content = $ma... | [
"public",
"function",
"GenerateDescriptionFromContent",
"(",
")",
"{",
"// check for content",
"if",
"(",
"$",
"content",
"=",
"trim",
"(",
"$",
"this",
"->",
"owner",
"->",
"Content",
")",
")",
"{",
"// pillage first paragraph from page content",
"if",
"(",
"preg... | Generates description from the first paragraph of the `Content` attribute.
@return string|null | [
"Generates",
"description",
"from",
"the",
"first",
"paragraph",
"of",
"the",
"Content",
"attribute",
"."
] | train | https://github.com/Graphiques-Digitale/silverstripe-seo-metadata/blob/f92128688a60b6c6b514b6efb1486ac60f4a8e03/code/SEO_Metadata_SiteTree_DataExtension.php#L248-L266 |
Graphiques-Digitale/silverstripe-seo-metadata | code/SEO_Metadata_SiteTree_DataExtension.php | SEO_Metadata_SiteTree_DataExtension.GenerateExtraMeta | public function GenerateExtraMeta()
{
if ($this->owner->ExtraMeta) {
return $this->owner->ExtraMeta . PHP_EOL;
} else {
return $this->owner->MarkupComment('none');
}
} | php | public function GenerateExtraMeta()
{
if ($this->owner->ExtraMeta) {
return $this->owner->ExtraMeta . PHP_EOL;
} else {
return $this->owner->MarkupComment('none');
}
} | [
"public",
"function",
"GenerateExtraMeta",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"ExtraMeta",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"ExtraMeta",
".",
"PHP_EOL",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
... | Generates extra metadata.
@return string | [
"Generates",
"extra",
"metadata",
"."
] | train | https://github.com/Graphiques-Digitale/silverstripe-seo-metadata/blob/f92128688a60b6c6b514b6efb1486ac60f4a8e03/code/SEO_Metadata_SiteTree_DataExtension.php#L273-L280 |
phossa2/middleware | src/Middleware/Middleware/Phossa2RouteMiddleware.php | Phossa2RouteMiddleware.before | protected function before(
RequestInterface $request,
ResponseInterface $response
)/* : ResponseInterface */ {
$this->dispatcher->dispatch(
$request->getMethod(),
$request->getUri()->getPath(),
['request' => $request, 'response' => $response]
);
... | php | protected function before(
RequestInterface $request,
ResponseInterface $response
)/* : ResponseInterface */ {
$this->dispatcher->dispatch(
$request->getMethod(),
$request->getUri()->getPath(),
['request' => $request, 'response' => $response]
);
... | [
"protected",
"function",
"before",
"(",
"RequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
")",
"/* : ResponseInterface */",
"{",
"$",
"this",
"->",
"dispatcher",
"->",
"dispatch",
"(",
"$",
"request",
"->",
"getMethod",
"(",
")",
","... | {@inheritDoc} | [
"{"
] | train | https://github.com/phossa2/middleware/blob/518e97ae48077f2c11adcd3c2393830ed7ab7ce7/src/Middleware/Middleware/Phossa2RouteMiddleware.php#L52-L64 |
o2system/filesystem | src/System.php | System.getMacAddress | public function getMacAddress()
{
switch (PHP_OS) {
default:
case 'Darwin':
case 'FreeBSD':
$cmd = '/sbin/ifconfig';
break;
case 'Windows':
$cmd = "ipconfig /all ";
break;
}
$stri... | php | public function getMacAddress()
{
switch (PHP_OS) {
default:
case 'Darwin':
case 'FreeBSD':
$cmd = '/sbin/ifconfig';
break;
case 'Windows':
$cmd = "ipconfig /all ";
break;
}
$stri... | [
"public",
"function",
"getMacAddress",
"(",
")",
"{",
"switch",
"(",
"PHP_OS",
")",
"{",
"default",
":",
"case",
"'Darwin'",
":",
"case",
"'FreeBSD'",
":",
"$",
"cmd",
"=",
"'/sbin/ifconfig'",
";",
"break",
";",
"case",
"'Windows'",
":",
"$",
"cmd",
"=",... | System::getMacAddress
Gets system mac address.
@return string | [
"System",
"::",
"getMacAddress"
] | train | https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/System.php#L242-L264 |
o2system/filesystem | src/System.php | System.getLoadAvg | public function getLoadAvg($interval = 1)
{
$rs = sys_getloadavg();
$interval = $interval >= 1 && 3 <= $interval ? $interval : 1;
$load = $rs[ $interval ];
return round(($load * 100) / $this->getCpuCores(), 2);
} | php | public function getLoadAvg($interval = 1)
{
$rs = sys_getloadavg();
$interval = $interval >= 1 && 3 <= $interval ? $interval : 1;
$load = $rs[ $interval ];
return round(($load * 100) / $this->getCpuCores(), 2);
} | [
"public",
"function",
"getLoadAvg",
"(",
"$",
"interval",
"=",
"1",
")",
"{",
"$",
"rs",
"=",
"sys_getloadavg",
"(",
")",
";",
"$",
"interval",
"=",
"$",
"interval",
">=",
"1",
"&&",
"3",
"<=",
"$",
"interval",
"?",
"$",
"interval",
":",
"1",
";",
... | System::getLoadAvg
Gets system load averages.
@param int $interval
@return float | [
"System",
"::",
"getLoadAvg"
] | train | https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/System.php#L277-L284 |
yoanm/php-jsonrpc-http-server-openapi-doc-sdk | features/bootstrap/DocNormalizerContext.php | DocNormalizerContext.extractPath | private function extractPath($httpMethod, $pathName)
{
return $this->lastNormalizedOutput[self::PATHS_KEY][$pathName][strtolower($httpMethod)];
} | php | private function extractPath($httpMethod, $pathName)
{
return $this->lastNormalizedOutput[self::PATHS_KEY][$pathName][strtolower($httpMethod)];
} | [
"private",
"function",
"extractPath",
"(",
"$",
"httpMethod",
",",
"$",
"pathName",
")",
"{",
"return",
"$",
"this",
"->",
"lastNormalizedOutput",
"[",
"self",
"::",
"PATHS_KEY",
"]",
"[",
"$",
"pathName",
"]",
"[",
"strtolower",
"(",
"$",
"httpMethod",
")... | @param $httpMethod
@param $pathName
@return mixed | [
"@param",
"$httpMethod",
"@param",
"$pathName"
] | train | https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/features/bootstrap/DocNormalizerContext.php#L461-L464 |
bdunogier/xmlrpcbundle | XmlRpc/Handler/Custom/ResponseGenerator.php | ResponseGenerator.fromXmlRpcResponse | public function fromXmlRpcResponse( Response $xmlRpcResponse )
{
$response = new HttpResponse();
$response->setStatusCode( 200 );
$response->headers->set( 'Content-Type', 'text/xml' );
$response->setContent( $this->generateXml( $xmlRpcResponse->return ) );
return $response;
... | php | public function fromXmlRpcResponse( Response $xmlRpcResponse )
{
$response = new HttpResponse();
$response->setStatusCode( 200 );
$response->headers->set( 'Content-Type', 'text/xml' );
$response->setContent( $this->generateXml( $xmlRpcResponse->return ) );
return $response;
... | [
"public",
"function",
"fromXmlRpcResponse",
"(",
"Response",
"$",
"xmlRpcResponse",
")",
"{",
"$",
"response",
"=",
"new",
"HttpResponse",
"(",
")",
";",
"$",
"response",
"->",
"setStatusCode",
"(",
"200",
")",
";",
"$",
"response",
"->",
"headers",
"->",
... | Generates an XML-RPC HTTP response for $xmlRpcResponse
@param \BD\Bundle\XmlRpcBundle\XmlRpc\Response
@return \Symfony\Component\HttpFoundation\Response | [
"Generates",
"an",
"XML",
"-",
"RPC",
"HTTP",
"response",
"for",
"$xmlRpcResponse"
] | train | https://github.com/bdunogier/xmlrpcbundle/blob/9a3d59609131d438d259b3ae2c113bb4b813a16b/XmlRpc/Handler/Custom/ResponseGenerator.php#L24-L31 |
bdunogier/xmlrpcbundle | XmlRpc/Handler/Custom/ResponseGenerator.php | ResponseGenerator.fromException | public function fromException( Exception $exception )
{
$response = new HttpResponse();
$response->setStatusCode( 200 );
$response->headers->set( 'Content-Type', 'text/xml' );
$response->setContent( $this->generateXmlFromException( $exception ) );
return $response;
} | php | public function fromException( Exception $exception )
{
$response = new HttpResponse();
$response->setStatusCode( 200 );
$response->headers->set( 'Content-Type', 'text/xml' );
$response->setContent( $this->generateXmlFromException( $exception ) );
return $response;
} | [
"public",
"function",
"fromException",
"(",
"Exception",
"$",
"exception",
")",
"{",
"$",
"response",
"=",
"new",
"HttpResponse",
"(",
")",
";",
"$",
"response",
"->",
"setStatusCode",
"(",
"200",
")",
";",
"$",
"response",
"->",
"headers",
"->",
"set",
... | Generates an XMLRPC HTTP response for the Exception $e
@param \Exception $e
@return \Symfony\Component\HttpFoundation\Response | [
"Generates",
"an",
"XMLRPC",
"HTTP",
"response",
"for",
"the",
"Exception",
"$e"
] | train | https://github.com/bdunogier/xmlrpcbundle/blob/9a3d59609131d438d259b3ae2c113bb4b813a16b/XmlRpc/Handler/Custom/ResponseGenerator.php#L38-L45 |
bdunogier/xmlrpcbundle | XmlRpc/Handler/Custom/ResponseGenerator.php | ResponseGenerator.handleValue | private function handleValue( $value, DOMDocument $domDocument )
{
switch ( gettype( $value ) )
{
case 'integer':
$node = $domDocument->createElement( 'int', $value );
break;
case 'boolean':
$node = $domDocument->createElement(... | php | private function handleValue( $value, DOMDocument $domDocument )
{
switch ( gettype( $value ) )
{
case 'integer':
$node = $domDocument->createElement( 'int', $value );
break;
case 'boolean':
$node = $domDocument->createElement(... | [
"private",
"function",
"handleValue",
"(",
"$",
"value",
",",
"DOMDocument",
"$",
"domDocument",
")",
"{",
"switch",
"(",
"gettype",
"(",
"$",
"value",
")",
")",
"{",
"case",
"'integer'",
":",
"$",
"node",
"=",
"$",
"domDocument",
"->",
"createElement",
... | @param mixed $value
@param \DomDocument $domDocument
@throws \UnexpectedValueException
@return \DOMElement | [
"@param",
"mixed",
"$value",
"@param",
"\\",
"DomDocument",
"$domDocument"
] | train | https://github.com/bdunogier/xmlrpcbundle/blob/9a3d59609131d438d259b3ae2c113bb4b813a16b/XmlRpc/Handler/Custom/ResponseGenerator.php#L117-L192 |
FrenchFrogs/framework | src/Ruler/Page/Page.php | Page.hasChild | public function hasChild($index, $is_recursive = true)
{
$recursive = function(Page $page) use ($index, &$recursive) {
foreach ($page->getChildren() as $k => $p ) {
/**@var Page $p*/
if ($index == $k) {
return true;
}
... | php | public function hasChild($index, $is_recursive = true)
{
$recursive = function(Page $page) use ($index, &$recursive) {
foreach ($page->getChildren() as $k => $p ) {
/**@var Page $p*/
if ($index == $k) {
return true;
}
... | [
"public",
"function",
"hasChild",
"(",
"$",
"index",
",",
"$",
"is_recursive",
"=",
"true",
")",
"{",
"$",
"recursive",
"=",
"function",
"(",
"Page",
"$",
"page",
")",
"use",
"(",
"$",
"index",
",",
"&",
"$",
"recursive",
")",
"{",
"foreach",
"(",
... | Return TRUE id $index page exist in $children container
@param $index
@return bool | [
"Return",
"TRUE",
"id",
"$index",
"page",
"exist",
"in",
"$children",
"container"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Ruler/Page/Page.php#L260-L280 |
FrenchFrogs/framework | src/Ruler/Page/Page.php | Page.getChild | public function getChild($index, $is_recursive = true)
{
if (!$this->hasChild($index, $is_recursive)) {
throw new InvalidArgumentException('Child doesn\'t exist : ' . $index);
}
$recursive = function(Page $page) use ($index, &$recursive) {
foreach ($page->getChildr... | php | public function getChild($index, $is_recursive = true)
{
if (!$this->hasChild($index, $is_recursive)) {
throw new InvalidArgumentException('Child doesn\'t exist : ' . $index);
}
$recursive = function(Page $page) use ($index, &$recursive) {
foreach ($page->getChildr... | [
"public",
"function",
"getChild",
"(",
"$",
"index",
",",
"$",
"is_recursive",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasChild",
"(",
"$",
"index",
",",
"$",
"is_recursive",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
... | Return $index page from $children container
@param $index
@return mixed | [
"Return",
"$index",
"page",
"from",
"$children",
"container"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Ruler/Page/Page.php#L288-L313 |
FrenchFrogs/framework | src/Ruler/Page/Page.php | Page.removeChild | public function removeChild($index)
{
if (!$this->hasChild($index)) {
throw new InvalidArgumentException('Child doesn\'t exist : ' . $index);
}
unset($this->children[$index]);
return $this;
} | php | public function removeChild($index)
{
if (!$this->hasChild($index)) {
throw new InvalidArgumentException('Child doesn\'t exist : ' . $index);
}
unset($this->children[$index]);
return $this;
} | [
"public",
"function",
"removeChild",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasChild",
"(",
"$",
"index",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Child doesn\\'t exist : '",
".",
"$",
"index",
")",
";",
... | Remove $index child from $children container
@param $index
@return $this | [
"Remove",
"$index",
"child",
"from",
"$children",
"container"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Ruler/Page/Page.php#L322-L331 |
FrenchFrogs/framework | src/Ruler/Page/Page.php | Page.isCurrent | public function isCurrent()
{
$link = $this->getLink();
if ($link{0} == '/') {
$link = substr($link, 1);
}
return request()->is($link);
} | php | public function isCurrent()
{
$link = $this->getLink();
if ($link{0} == '/') {
$link = substr($link, 1);
}
return request()->is($link);
} | [
"public",
"function",
"isCurrent",
"(",
")",
"{",
"$",
"link",
"=",
"$",
"this",
"->",
"getLink",
"(",
")",
";",
"if",
"(",
"$",
"link",
"{",
"0",
"}",
"==",
"'/'",
")",
"{",
"$",
"link",
"=",
"substr",
"(",
"$",
"link",
",",
"1",
")",
";",
... | Return TRUE if the current page is this page
@return bool | [
"Return",
"TRUE",
"if",
"the",
"current",
"page",
"is",
"this",
"page"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Ruler/Page/Page.php#L338-L346 |
readdle/fqdb | src/Readdle/Database/FQDBQueryAPI.php | FQDBQueryAPI._runQuery | private function _runQuery($query, $options)
{
$this->_testQueryStarts($query, '[select|show]');
$statement = $this->_executeQuery($query, $options);
if (is_object($statement) && $statement instanceof \PDOStatement) {
return $statement;
}
else {
$this-... | php | private function _runQuery($query, $options)
{
$this->_testQueryStarts($query, '[select|show]');
$statement = $this->_executeQuery($query, $options);
if (is_object($statement) && $statement instanceof \PDOStatement) {
return $statement;
}
else {
$this-... | [
"private",
"function",
"_runQuery",
"(",
"$",
"query",
",",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"_testQueryStarts",
"(",
"$",
"query",
",",
"'[select|show]'",
")",
";",
"$",
"statement",
"=",
"$",
"this",
"->",
"_executeQuery",
"(",
"$",
"query"... | executes prepared \PDO query
@param string $query
@param array $options
@return \PDOStatement PDO statement from query | [
"executes",
"prepared",
"\\",
"PDO",
"query"
] | train | https://github.com/readdle/fqdb/blob/4ef2e8f3343a7c8fbb309c243be502a160c42083/src/Readdle/Database/FQDBQueryAPI.php#L14-L24 |
readdle/fqdb | src/Readdle/Database/FQDBQueryAPI.php | FQDBQueryAPI.queryArray | private function queryArray($query, $options, $fetcher)
{
$statement = $this->_runQuery($query, $options);
$result = call_user_func($fetcher, $statement);
return is_array($result) ? $result : [];
} | php | private function queryArray($query, $options, $fetcher)
{
$statement = $this->_runQuery($query, $options);
$result = call_user_func($fetcher, $statement);
return is_array($result) ? $result : [];
} | [
"private",
"function",
"queryArray",
"(",
"$",
"query",
",",
"$",
"options",
",",
"$",
"fetcher",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"_runQuery",
"(",
"$",
"query",
",",
"$",
"options",
")",
";",
"$",
"result",
"=",
"call_user_func",
... | executes SELECT or SHOW query and returns result array
@param string $query
@param array $options
@param callable $fetcher
@return array | [
"executes",
"SELECT",
"or",
"SHOW",
"query",
"and",
"returns",
"result",
"array"
] | train | https://github.com/readdle/fqdb/blob/4ef2e8f3343a7c8fbb309c243be502a160c42083/src/Readdle/Database/FQDBQueryAPI.php#L34-L39 |
readdle/fqdb | src/Readdle/Database/FQDBQueryAPI.php | FQDBQueryAPI.queryValue | public function queryValue($query, $options = array())
{
$statement = $this->_runQuery($query, $options);
return $statement->fetch(\PDO::FETCH_COLUMN);
} | php | public function queryValue($query, $options = array())
{
$statement = $this->_runQuery($query, $options);
return $statement->fetch(\PDO::FETCH_COLUMN);
} | [
"public",
"function",
"queryValue",
"(",
"$",
"query",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"_runQuery",
"(",
"$",
"query",
",",
"$",
"options",
")",
";",
"return",
"$",
"statement",
"->",
... | executes SELECT or SHOW query and returns 1st returned element
@param string $query
@param array $options
@return string|false | [
"executes",
"SELECT",
"or",
"SHOW",
"query",
"and",
"returns",
"1st",
"returned",
"element"
] | train | https://github.com/readdle/fqdb/blob/4ef2e8f3343a7c8fbb309c243be502a160c42083/src/Readdle/Database/FQDBQueryAPI.php#L47-L51 |
readdle/fqdb | src/Readdle/Database/FQDBQueryAPI.php | FQDBQueryAPI.queryAssoc | public function queryAssoc($query, $options = array())
{
$statement = $this->_runQuery($query, $options);
return $statement->fetch(\PDO::FETCH_ASSOC);
} | php | public function queryAssoc($query, $options = array())
{
$statement = $this->_runQuery($query, $options);
return $statement->fetch(\PDO::FETCH_ASSOC);
} | [
"public",
"function",
"queryAssoc",
"(",
"$",
"query",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"_runQuery",
"(",
"$",
"query",
",",
"$",
"options",
")",
";",
"return",
"$",
"statement",
"->",
... | executes SELECT or SHOW query and returns 1st row as assoc array
@param string $query
@param array $options
@return array|false | [
"executes",
"SELECT",
"or",
"SHOW",
"query",
"and",
"returns",
"1st",
"row",
"as",
"assoc",
"array"
] | train | https://github.com/readdle/fqdb/blob/4ef2e8f3343a7c8fbb309c243be502a160c42083/src/Readdle/Database/FQDBQueryAPI.php#L59-L63 |
readdle/fqdb | src/Readdle/Database/FQDBQueryAPI.php | FQDBQueryAPI.queryList | public function queryList($query, $options = array())
{
$statement = $this->_runQuery($query, $options);
return $statement->fetch(\PDO::FETCH_NUM);
} | php | public function queryList($query, $options = array())
{
$statement = $this->_runQuery($query, $options);
return $statement->fetch(\PDO::FETCH_NUM);
} | [
"public",
"function",
"queryList",
"(",
"$",
"query",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"_runQuery",
"(",
"$",
"query",
",",
"$",
"options",
")",
";",
"return",
"$",
"statement",
"->",
... | executes SELECT or SHOW query and returns as array
@param string $query
@param array $options
@return array|false | [
"executes",
"SELECT",
"or",
"SHOW",
"query",
"and",
"returns",
"as",
"array"
] | train | https://github.com/readdle/fqdb/blob/4ef2e8f3343a7c8fbb309c243be502a160c42083/src/Readdle/Database/FQDBQueryAPI.php#L71-L75 |
readdle/fqdb | src/Readdle/Database/FQDBQueryAPI.php | FQDBQueryAPI.queryVector | public function queryVector($query, $options = array())
{
return $this->queryArray($query, $options,
function(\PDOStatement $statement) { return $statement->fetchAll(\PDO::FETCH_COLUMN, 0); });
} | php | public function queryVector($query, $options = array())
{
return $this->queryArray($query, $options,
function(\PDOStatement $statement) { return $statement->fetchAll(\PDO::FETCH_COLUMN, 0); });
} | [
"public",
"function",
"queryVector",
"(",
"$",
"query",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"queryArray",
"(",
"$",
"query",
",",
"$",
"options",
",",
"function",
"(",
"\\",
"PDOStatement",
"$",
"statemen... | executes SELECT or SHOW query and returns result as array
@param string $query
@param array $options
@return array | [
"executes",
"SELECT",
"or",
"SHOW",
"query",
"and",
"returns",
"result",
"as",
"array"
] | train | https://github.com/readdle/fqdb/blob/4ef2e8f3343a7c8fbb309c243be502a160c42083/src/Readdle/Database/FQDBQueryAPI.php#L85-L90 |
readdle/fqdb | src/Readdle/Database/FQDBQueryAPI.php | FQDBQueryAPI.queryTable | public function queryTable($query, $options = array())
{
return $this->queryArray($query, $options,
function(\PDOStatement $statement) { return $statement->fetchAll(\PDO::FETCH_ASSOC); }
);
} | php | public function queryTable($query, $options = array())
{
return $this->queryArray($query, $options,
function(\PDOStatement $statement) { return $statement->fetchAll(\PDO::FETCH_ASSOC); }
);
} | [
"public",
"function",
"queryTable",
"(",
"$",
"query",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"queryArray",
"(",
"$",
"query",
",",
"$",
"options",
",",
"function",
"(",
"\\",
"PDOStatement",
"$",
"statement... | executes SELECT or SHOW query and returns result as assoc array
@param string $query
@param array $options
@return array | [
"executes",
"SELECT",
"or",
"SHOW",
"query",
"and",
"returns",
"result",
"as",
"assoc",
"array"
] | train | https://github.com/readdle/fqdb/blob/4ef2e8f3343a7c8fbb309c243be502a160c42083/src/Readdle/Database/FQDBQueryAPI.php#L98-L103 |
readdle/fqdb | src/Readdle/Database/FQDBQueryAPI.php | FQDBQueryAPI.queryObjArray | public function queryObjArray($query, $className, $options = array(), $classConstructorArguments = NULL)
{
if (!class_exists($className)) {
$this->_error(FQDBException::CLASS_NOT_EXIST, FQDBException::FQDB_CODE);
}
return $this->queryArray($query, $options,
function(... | php | public function queryObjArray($query, $className, $options = array(), $classConstructorArguments = NULL)
{
if (!class_exists($className)) {
$this->_error(FQDBException::CLASS_NOT_EXIST, FQDBException::FQDB_CODE);
}
return $this->queryArray($query, $options,
function(... | [
"public",
"function",
"queryObjArray",
"(",
"$",
"query",
",",
"$",
"className",
",",
"$",
"options",
"=",
"array",
"(",
")",
",",
"$",
"classConstructorArguments",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"className",
")",
")",
... | executes SELECT or SHOW query and returns result as array of objects of given class
@param string $query
@param string $className
@param array $options
@param array $classConstructorArguments
@return array | [
"executes",
"SELECT",
"or",
"SHOW",
"query",
"and",
"returns",
"result",
"as",
"array",
"of",
"objects",
"of",
"given",
"class"
] | train | https://github.com/readdle/fqdb/blob/4ef2e8f3343a7c8fbb309c243be502a160c42083/src/Readdle/Database/FQDBQueryAPI.php#L113-L125 |
readdle/fqdb | src/Readdle/Database/FQDBQueryAPI.php | FQDBQueryAPI.queryObj | public function queryObj($query, $className, $options = array(), $classConstructorArguments = NULL)
{
if (!class_exists($className)) {
$this->_error(FQDBException::CLASS_NOT_EXIST, FQDBException::FQDB_CODE);
}
$statement = $this->_runQuery($query, $options);
$statement->... | php | public function queryObj($query, $className, $options = array(), $classConstructorArguments = NULL)
{
if (!class_exists($className)) {
$this->_error(FQDBException::CLASS_NOT_EXIST, FQDBException::FQDB_CODE);
}
$statement = $this->_runQuery($query, $options);
$statement->... | [
"public",
"function",
"queryObj",
"(",
"$",
"query",
",",
"$",
"className",
",",
"$",
"options",
"=",
"array",
"(",
")",
",",
"$",
"classConstructorArguments",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"className",
")",
")",
"{",... | executes SELECT or SHOW query and returns object of given class
@param string $query
@param string $className
@param array $options
@param array $classConstructorArguments
@return object|false | [
"executes",
"SELECT",
"or",
"SHOW",
"query",
"and",
"returns",
"object",
"of",
"given",
"class"
] | train | https://github.com/readdle/fqdb/blob/4ef2e8f3343a7c8fbb309c243be502a160c42083/src/Readdle/Database/FQDBQueryAPI.php#L136-L146 |
readdle/fqdb | src/Readdle/Database/FQDBQueryAPI.php | FQDBQueryAPI.queryTableCallback | public function queryTableCallback($query, $options = [], $callback)
{
if(!is_callable($callback)) {
$this->_error(FQDBException::NOT_CALLABLE_ERROR, FQDBException::FQDB_CODE);
}
$statement = $this->_runQuery($query, $options);
while ($row = $statement->fetch(\PDO::FETCH_... | php | public function queryTableCallback($query, $options = [], $callback)
{
if(!is_callable($callback)) {
$this->_error(FQDBException::NOT_CALLABLE_ERROR, FQDBException::FQDB_CODE);
}
$statement = $this->_runQuery($query, $options);
while ($row = $statement->fetch(\PDO::FETCH_... | [
"public",
"function",
"queryTableCallback",
"(",
"$",
"query",
",",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"$",
"this",
"->",
"_error",
"(",
"FQDBException",
... | Execute query and apply a callback function to each row
@param string $query
@param array $options
@param callable $callback
@return boolean | [
"Execute",
"query",
"and",
"apply",
"a",
"callback",
"function",
"to",
"each",
"row"
] | train | https://github.com/readdle/fqdb/blob/4ef2e8f3343a7c8fbb309c243be502a160c42083/src/Readdle/Database/FQDBQueryAPI.php#L156-L166 |
readdle/fqdb | src/Readdle/Database/FQDBQueryAPI.php | FQDBQueryAPI.queryTableGenerator | public function queryTableGenerator($query, $options = [])
{
$statement = $this->_runQuery($query, $options);
while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
yield $row;
}
} | php | public function queryTableGenerator($query, $options = [])
{
$statement = $this->_runQuery($query, $options);
while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
yield $row;
}
} | [
"public",
"function",
"queryTableGenerator",
"(",
"$",
"query",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"_runQuery",
"(",
"$",
"query",
",",
"$",
"options",
")",
";",
"while",
"(",
"$",
"row",
"=",
"$... | Execute a query and makes generator from the result
@param $query
@param array $options
@return \Generator | [
"Execute",
"a",
"query",
"and",
"makes",
"generator",
"from",
"the",
"result"
] | train | https://github.com/readdle/fqdb/blob/4ef2e8f3343a7c8fbb309c243be502a160c42083/src/Readdle/Database/FQDBQueryAPI.php#L175-L181 |
readdle/fqdb | src/Readdle/Database/FQDBQueryAPI.php | FQDBQueryAPI.queryHash | public function queryHash($query, $options = array())
{
return $this->queryArray(
$query,
$options,
function(\PDOStatement $statement) {
return $statement->fetchAll(\PDO::FETCH_KEY_PAIR);
}
);
} | php | public function queryHash($query, $options = array())
{
return $this->queryArray(
$query,
$options,
function(\PDOStatement $statement) {
return $statement->fetchAll(\PDO::FETCH_KEY_PAIR);
}
);
} | [
"public",
"function",
"queryHash",
"(",
"$",
"query",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"queryArray",
"(",
"$",
"query",
",",
"$",
"options",
",",
"function",
"(",
"\\",
"PDOStatement",
"$",
"statement"... | executes SELECT or SHOW query and returns an assoc array made of two-columns
where the first column is a key and the second column is the value
@param $query
@param array $options
@return array | [
"executes",
"SELECT",
"or",
"SHOW",
"query",
"and",
"returns",
"an",
"assoc",
"array",
"made",
"of",
"two",
"-",
"columns",
"where",
"the",
"first",
"column",
"is",
"a",
"key",
"and",
"the",
"second",
"column",
"is",
"the",
"value"
] | train | https://github.com/readdle/fqdb/blob/4ef2e8f3343a7c8fbb309c243be502a160c42083/src/Readdle/Database/FQDBQueryAPI.php#L190-L199 |
comodojo/dispatcher.framework | src/Comodojo/Dispatcher/Router/Parser.php | Parser.read | public function read($folders = array(), Route $value = null, $regex = '') {
if (is_null($value)) {
$value = new Route();
}
// if the first 'folder' is empty is removed
while (!empty($folders) && empty($folders[0])) {
array_shift($folders);
}
... | php | public function read($folders = array(), Route $value = null, $regex = '') {
if (is_null($value)) {
$value = new Route();
}
// if the first 'folder' is empty is removed
while (!empty($folders) && empty($folders[0])) {
array_shift($folders);
}
... | [
"public",
"function",
"read",
"(",
"$",
"folders",
"=",
"array",
"(",
")",
",",
"Route",
"$",
"value",
"=",
"null",
",",
"$",
"regex",
"=",
"''",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"new",
"Route... | the global regular expression against which all the request URI will be compared | [
"the",
"global",
"regular",
"expression",
"against",
"which",
"all",
"the",
"request",
"URI",
"will",
"be",
"compared"
] | train | https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Router/Parser.php#L37-L122 |
comodojo/dispatcher.framework | src/Comodojo/Dispatcher/Router/Parser.php | Parser.param | private function param($key, $string, $value) {
$field_required = false;
// If the field name ends with a '*', the parameter is considered as required
if (preg_match('/^(.+)\*$/', $key, $bits)) {
$key = $bits[1];
$field_required = true;
}
// The $valu... | php | private function param($key, $string, $value) {
$field_required = false;
// If the field name ends with a '*', the parameter is considered as required
if (preg_match('/^(.+)\*$/', $key, $bits)) {
$key = $bits[1];
$field_required = true;
}
// The $valu... | [
"private",
"function",
"param",
"(",
"$",
"key",
",",
"$",
"string",
",",
"$",
"value",
")",
"{",
"$",
"field_required",
"=",
"false",
";",
"// If the field name ends with a '*', the parameter is considered as required",
"if",
"(",
"preg_match",
"(",
"'/^(.+)\\*$/'",
... | This method read a single parameter and build the regular expression | [
"This",
"method",
"read",
"a",
"single",
"parameter",
"and",
"build",
"the",
"regular",
"expression"
] | train | https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Router/Parser.php#L125-L163 |
Elendev/ElendevRoxyFilemanBundle | DependencyInjection/ElendevRoxyFilemanExtension.php | ElendevRoxyFilemanExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
foreach ($config['conf'] as $key => $value) {
$container->setParameter('elendev_roxyfileman.conf.' . $key, $... | php | public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
foreach ($config['conf'] as $key => $value) {
$container->setParameter('elendev_roxyfileman.conf.' . $key, $... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"configuration",
"=",
"new",
"Configuration",
"(",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"processConfiguration",
"(",
"$",
"con... | {@inheritdoc} | [
"{"
] | train | https://github.com/Elendev/ElendevRoxyFilemanBundle/blob/2173ce00e4f1d22960eec70b437a5908f4681dc1/DependencyInjection/ElendevRoxyFilemanExtension.php#L30-L96 |
baleen/cli | src/CommandBus/Timeline/MigrateHandler.php | MigrateHandler.handle | public function handle(MigrateMessage $command)
{
$input = $command->getInput();
$output = $command->getOutput();
$this->command = $command;
$targetArg = (string) $input->getArgument(MigrateMessage::ARG_TARGET);
$strategy = (string) $this->getStrategyOption($input);
... | php | public function handle(MigrateMessage $command)
{
$input = $command->getInput();
$output = $command->getOutput();
$this->command = $command;
$targetArg = (string) $input->getArgument(MigrateMessage::ARG_TARGET);
$strategy = (string) $this->getStrategyOption($input);
... | [
"public",
"function",
"handle",
"(",
"MigrateMessage",
"$",
"command",
")",
"{",
"$",
"input",
"=",
"$",
"command",
"->",
"getInput",
"(",
")",
";",
"$",
"output",
"=",
"$",
"command",
"->",
"getOutput",
"(",
")",
";",
"$",
"this",
"->",
"command",
"... | handle.
@param MigrateMessage $command
@throws CliException | [
"handle",
"."
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/CommandBus/Timeline/MigrateHandler.php#L69-L91 |
baleen/cli | src/CommandBus/Timeline/MigrateHandler.php | MigrateHandler.saveVersionListener | public function saveVersionListener(MigrationEvent $event)
{
$version = $event->getVersion();
$this->command->getStorage()->update($version);
} | php | public function saveVersionListener(MigrationEvent $event)
{
$version = $event->getVersion();
$this->command->getStorage()->update($version);
} | [
"public",
"function",
"saveVersionListener",
"(",
"MigrationEvent",
"$",
"event",
")",
"{",
"$",
"version",
"=",
"$",
"event",
"->",
"getVersion",
"(",
")",
";",
"$",
"this",
"->",
"command",
"->",
"getStorage",
"(",
")",
"->",
"update",
"(",
"$",
"versi... | saveVersionListener.
@param MigrationEvent $event | [
"saveVersionListener",
"."
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/CommandBus/Timeline/MigrateHandler.php#L117-L121 |
baleen/cli | src/CommandBus/Timeline/MigrateHandler.php | MigrateHandler.onMigrationAfter | public function onMigrationAfter(MigrationEvent $event)
{
if ($this->progress) {
$runProgress = $event->getProgress();
$this->progress->setProgress($runProgress->getCurrent());
}
} | php | public function onMigrationAfter(MigrationEvent $event)
{
if ($this->progress) {
$runProgress = $event->getProgress();
$this->progress->setProgress($runProgress->getCurrent());
}
} | [
"public",
"function",
"onMigrationAfter",
"(",
"MigrationEvent",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"progress",
")",
"{",
"$",
"runProgress",
"=",
"$",
"event",
"->",
"getProgress",
"(",
")",
";",
"$",
"this",
"->",
"progress",
"->",
... | onMigrationAfter.
@param MigrationEvent $event | [
"onMigrationAfter",
"."
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/CommandBus/Timeline/MigrateHandler.php#L143-L149 |
baleen/cli | src/CommandBus/Timeline/MigrateHandler.php | MigrateHandler.onCollectionBefore | public function onCollectionBefore(CollectionEvent $event)
{
$target = $event->getTarget();
$this->output->writeln(sprintf(
'<info>[START]</info> Migrating %s to <comment>%s</comment>:',
$event->getOptions()->isDirectionUp() ? 'up' : 'down',
$target->getId()
... | php | public function onCollectionBefore(CollectionEvent $event)
{
$target = $event->getTarget();
$this->output->writeln(sprintf(
'<info>[START]</info> Migrating %s to <comment>%s</comment>:',
$event->getOptions()->isDirectionUp() ? 'up' : 'down',
$target->getId()
... | [
"public",
"function",
"onCollectionBefore",
"(",
"CollectionEvent",
"$",
"event",
")",
"{",
"$",
"target",
"=",
"$",
"event",
"->",
"getTarget",
"(",
")",
";",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"sprintf",
"(",
"'<info>[START]</info> Migrating ... | onCollectionBefore.
@param CollectionEvent $event | [
"onCollectionBefore",
"."
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/CommandBus/Timeline/MigrateHandler.php#L156-L170 |
baleen/cli | src/CommandBus/Timeline/MigrateHandler.php | MigrateHandler.onCollectionAfter | public function onCollectionAfter()
{
if ($this->progress) {
$this->progress->finish();
$this->output->writeln(''); // new line after progress bar
}
$this->output->writeln('<info>[END]</info>');
} | php | public function onCollectionAfter()
{
if ($this->progress) {
$this->progress->finish();
$this->output->writeln(''); // new line after progress bar
}
$this->output->writeln('<info>[END]</info>');
} | [
"public",
"function",
"onCollectionAfter",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"progress",
")",
"{",
"$",
"this",
"->",
"progress",
"->",
"finish",
"(",
")",
";",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"''",
")",
";",
"// new lin... | onCollectionAfter. | [
"onCollectionAfter",
"."
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/CommandBus/Timeline/MigrateHandler.php#L175-L182 |
baleen/cli | src/CommandBus/Timeline/MigrateHandler.php | MigrateHandler.getStrategyOption | protected function getStrategyOption(InputInterface $input)
{
$strategy = strtolower($input->getOption(MigrateMessage::OPT_STRATEGY));
if (!isset($this->strategies[$strategy])) {
throw new CliException(sprintf(
'Unknown strategy "%s". Must be one of: %s',
... | php | protected function getStrategyOption(InputInterface $input)
{
$strategy = strtolower($input->getOption(MigrateMessage::OPT_STRATEGY));
if (!isset($this->strategies[$strategy])) {
throw new CliException(sprintf(
'Unknown strategy "%s". Must be one of: %s',
... | [
"protected",
"function",
"getStrategyOption",
"(",
"InputInterface",
"$",
"input",
")",
"{",
"$",
"strategy",
"=",
"strtolower",
"(",
"$",
"input",
"->",
"getOption",
"(",
"MigrateMessage",
"::",
"OPT_STRATEGY",
")",
")",
";",
"if",
"(",
"!",
"isset",
"(",
... | @param InputInterface $input
@return string
@throws CliException | [
"@param",
"InputInterface",
"$input"
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/CommandBus/Timeline/MigrateHandler.php#L191-L203 |
fsi-open/datasource-bundle | Twig/TokenParser/DataSourceRouteTokenParser.php | DataSourceRouteTokenParser.parse | public function parse(\Twig_Token $token)
{
$stream = $this->parser->getStream();
$dataSource = $this->parser->getExpressionParser()->parseExpression();
$route = $this->parser->getExpressionParser()->parseExpression();
$additional_parameters = new \Twig_Node_Expression_Array([], $str... | php | public function parse(\Twig_Token $token)
{
$stream = $this->parser->getStream();
$dataSource = $this->parser->getExpressionParser()->parseExpression();
$route = $this->parser->getExpressionParser()->parseExpression();
$additional_parameters = new \Twig_Node_Expression_Array([], $str... | [
"public",
"function",
"parse",
"(",
"\\",
"Twig_Token",
"$",
"token",
")",
"{",
"$",
"stream",
"=",
"$",
"this",
"->",
"parser",
"->",
"getStream",
"(",
")",
";",
"$",
"dataSource",
"=",
"$",
"this",
"->",
"parser",
"->",
"getExpressionParser",
"(",
")... | {@inheritDoc} | [
"{"
] | train | https://github.com/fsi-open/datasource-bundle/blob/06964672c838af9f4125065e3a90b2df4e8aa077/Twig/TokenParser/DataSourceRouteTokenParser.php#L19-L37 |
bfitech/zapcore | dev/RouterDev.php | RouterDev.reset | public static function reset() {
$_SERVER['REQUEST_URI'] = '/';
$_SERVER['REQUEST_METHOD'] = 'GET';
$_GET = $_POST = $_FILES = $_REQUEST = [];
self::$code = 200;
self::$head = [];
self::$body_raw = null;
self::$body = null;
self::$errno = 0;
self::$data = [];
} | php | public static function reset() {
$_SERVER['REQUEST_URI'] = '/';
$_SERVER['REQUEST_METHOD'] = 'GET';
$_GET = $_POST = $_FILES = $_REQUEST = [];
self::$code = 200;
self::$head = [];
self::$body_raw = null;
self::$body = null;
self::$errno = 0;
self::$data = [];
} | [
"public",
"static",
"function",
"reset",
"(",
")",
"{",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
"=",
"'/'",
";",
"$",
"_SERVER",
"[",
"'REQUEST_METHOD'",
"]",
"=",
"'GET'",
";",
"$",
"_GET",
"=",
"$",
"_POST",
"=",
"$",
"_FILES",
"=",
"$",
"_REQUE... | Reset fake HTTP variables and properties. | [
"Reset",
"fake",
"HTTP",
"variables",
"and",
"properties",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/dev/RouterDev.php#L35-L45 |
bfitech/zapcore | dev/RouterDev.php | RouterDev.header | public static function header(
string $header_string, bool $replace=false
) {
if (strpos($header_string, 'HTTP/1') !== false) {
self::$code = explode(' ', $header_string)[1];
} else {
self::$head[] = $header_string;
}
} | php | public static function header(
string $header_string, bool $replace=false
) {
if (strpos($header_string, 'HTTP/1') !== false) {
self::$code = explode(' ', $header_string)[1];
} else {
self::$head[] = $header_string;
}
} | [
"public",
"static",
"function",
"header",
"(",
"string",
"$",
"header_string",
",",
"bool",
"$",
"replace",
"=",
"false",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"header_string",
",",
"'HTTP/1'",
")",
"!==",
"false",
")",
"{",
"self",
"::",
"$",
"code... | Patched Header::header().
@param string $header_string Header string.
@param bool $replace The 'replace' option for standard
header() function.
@cond
@SuppressWarnings(PHPMD.UnusedFormalParameter)
@endcond | [
"Patched",
"Header",
"::",
"header",
"()",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/dev/RouterDev.php#L58-L66 |
bfitech/zapcore | dev/RouterDev.php | RouterDev.send_cookie | public static function send_cookie(
$name, $value='', $expire=0, $path='', $domain='',
$secure=false, $httponly=false
) {
if (!isset($_COOKIE))
$_COOKIE = [];
if ($expire > 0) {
$_COOKIE[$name] = $value;
return;
}
if (isset($_COOKIE[$name]))
unset($_COOKIE[$name]);
} | php | public static function send_cookie(
$name, $value='', $expire=0, $path='', $domain='',
$secure=false, $httponly=false
) {
if (!isset($_COOKIE))
$_COOKIE = [];
if ($expire > 0) {
$_COOKIE[$name] = $value;
return;
}
if (isset($_COOKIE[$name]))
unset($_COOKIE[$name]);
} | [
"public",
"static",
"function",
"send_cookie",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"''",
",",
"$",
"expire",
"=",
"0",
",",
"$",
"path",
"=",
"''",
",",
"$",
"domain",
"=",
"''",
",",
"$",
"secure",
"=",
"false",
",",
"$",
"httponly",
"=",
... | Patched Header::send_cookie().
@cond
@SuppressWarnings(PHPMD.UnusedFormalParameter)
@endcond | [
"Patched",
"Header",
"::",
"send_cookie",
"()",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/dev/RouterDev.php#L75-L87 |
bfitech/zapcore | dev/RouterDev.php | RouterDev.wrap_callback | public function wrap_callback(callable $callback, array $args=[]) {
ob_start();
foreach (self::$override_args as $key => $val)
$args[$key] = $val;
$callback($args);
self::$body_raw = ob_get_clean();
self::$body = json_decode(self::$body_raw, true);
if (self::$body) {
self::$errno = self::$body['errno'... | php | public function wrap_callback(callable $callback, array $args=[]) {
ob_start();
foreach (self::$override_args as $key => $val)
$args[$key] = $val;
$callback($args);
self::$body_raw = ob_get_clean();
self::$body = json_decode(self::$body_raw, true);
if (self::$body) {
self::$errno = self::$body['errno'... | [
"public",
"function",
"wrap_callback",
"(",
"callable",
"$",
"callback",
",",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"ob_start",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"override_args",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"$",
... | Patched Router::wrap_callback().
@param callable $callback Callback method.
@param array $args HTTP variables collected by router. | [
"Patched",
"Router",
"::",
"wrap_callback",
"()",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/dev/RouterDev.php#L106-L120 |
bfitech/zapcore | dev/RouterDev.php | RouterDev.override_callback_args | public function override_callback_args(array $args=[]) {
foreach ($args as $key => $val) {
if (!in_array($key, [
'get', 'post', 'files', 'put', 'patch', 'delete',
]))
continue;
self::$override_args[$key] = $val;
}
} | php | public function override_callback_args(array $args=[]) {
foreach ($args as $key => $val) {
if (!in_array($key, [
'get', 'post', 'files', 'put', 'patch', 'delete',
]))
continue;
self::$override_args[$key] = $val;
}
} | [
"public",
"function",
"override_callback_args",
"(",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"args",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"key",
",",
"[",
"'get'",
",",
"'... | Overrides callback args.
Use this in case you want to manipulate collected HTTP
variables without actually changing the entire route.
@param array $args Dict of HTTP variables for overriding
existing args. Key must be one or more of: 'get',
'post', 'files', 'put', 'patch', 'delete'. Invalid
keys are ignored. | [
"Overrides",
"callback",
"args",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/dev/RouterDev.php#L133-L141 |
bfitech/zapcore | dev/RouterDev.php | RouterDev.abort_custom | public function abort_custom(int $code) {
self::$code = $code;
static::$body_raw = "ERROR: $code";
self::$body = "ERROR: $code";
self::$errno = $code;
self::$data = [];
} | php | public function abort_custom(int $code) {
self::$code = $code;
static::$body_raw = "ERROR: $code";
self::$body = "ERROR: $code";
self::$errno = $code;
self::$data = [];
} | [
"public",
"function",
"abort_custom",
"(",
"int",
"$",
"code",
")",
"{",
"self",
"::",
"$",
"code",
"=",
"$",
"code",
";",
"static",
"::",
"$",
"body_raw",
"=",
"\"ERROR: $code\"",
";",
"self",
"::",
"$",
"body",
"=",
"\"ERROR: $code\"",
";",
"self",
"... | Custom abort for testing.
@param int $code HTTP error code. | [
"Custom",
"abort",
"for",
"testing",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/dev/RouterDev.php#L148-L154 |
bfitech/zapcore | dev/RouterDev.php | RouterDev.redirect_custom | public function redirect_custom(string $url) {
self::$code = 301;
self::$head = ["Location: $url"];
self::$body_raw = self::$body = "Location: $url";
self::$errno = 0;
self::$data = [$url];
} | php | public function redirect_custom(string $url) {
self::$code = 301;
self::$head = ["Location: $url"];
self::$body_raw = self::$body = "Location: $url";
self::$errno = 0;
self::$data = [$url];
} | [
"public",
"function",
"redirect_custom",
"(",
"string",
"$",
"url",
")",
"{",
"self",
"::",
"$",
"code",
"=",
"301",
";",
"self",
"::",
"$",
"head",
"=",
"[",
"\"Location: $url\"",
"]",
";",
"self",
"::",
"$",
"body_raw",
"=",
"self",
"::",
"$",
"bod... | Custom redirect for testing.
@param string $url Destination URL. | [
"Custom",
"redirect",
"for",
"testing",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/dev/RouterDev.php#L161-L167 |
bfitech/zapcore | dev/RouterDev.php | RouterDev.static_file_custom | public function static_file_custom(
string $path, int $cache=0, $disposition=null
) {
self::reset();
if (file_exists($path)) {
self::$code = 200;
self::$body_raw = file_get_contents($path);
self::$body = "Path: $path";
self::$errno = 0;
self::$data = [$path];
} else {
self::$code = 404;
}
... | php | public function static_file_custom(
string $path, int $cache=0, $disposition=null
) {
self::reset();
if (file_exists($path)) {
self::$code = 200;
self::$body_raw = file_get_contents($path);
self::$body = "Path: $path";
self::$errno = 0;
self::$data = [$path];
} else {
self::$code = 404;
}
... | [
"public",
"function",
"static_file_custom",
"(",
"string",
"$",
"path",
",",
"int",
"$",
"cache",
"=",
"0",
",",
"$",
"disposition",
"=",
"null",
")",
"{",
"self",
"::",
"reset",
"(",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
")",
... | Custom static file serving for testing.
@param string $path Absolute path to file.
@param int $cache Cache age in seconds.
@param mixed $disposition If string, use it as
content-disposition in header. If true, infer from basename.
If null, no content-disposition header is sent.
@cond
@SuppressWarnings(PHPMD.UnusedFor... | [
"Custom",
"static",
"file",
"serving",
"for",
"testing",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/dev/RouterDev.php#L182-L195 |
drupol/valuewrapper | src/ValueWrapper.php | ValueWrapper.make | public function make($value): ValueInterface
{
$type = $this->getType($value);
switch ($type) {
case 'object':
if ($value instanceof ValueInterface) {
return $value;
}
$mappings = self::$objectMappingRegistry;
... | php | public function make($value): ValueInterface
{
$type = $this->getType($value);
switch ($type) {
case 'object':
if ($value instanceof ValueInterface) {
return $value;
}
$mappings = self::$objectMappingRegistry;
... | [
"public",
"function",
"make",
"(",
"$",
"value",
")",
":",
"ValueInterface",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"getType",
"(",
"$",
"value",
")",
";",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"'object'",
":",
"if",
"(",
"$",
"value",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/drupol/valuewrapper/blob/49cc07e4d0284718c24ba6e9cf524c1f4226694e/src/ValueWrapper.php#L83-L121 |
Stampie/stampie-bundle | Command/SendEmailCommand.php | SendEmailCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$to = $input->getArgument('to');
$from = $input->getArgument('from');
$mailerClass = new \ReflectionClass($this->mailer);
$output->writeln(sprintf('Sending message from <info>%s</info> to <info>%s</info> u... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$to = $input->getArgument('to');
$from = $input->getArgument('from');
$mailerClass = new \ReflectionClass($this->mailer);
$output->writeln(sprintf('Sending message from <info>%s</info> to <info>%s</info> u... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"to",
"=",
"$",
"input",
"->",
"getArgument",
"(",
"'to'",
")",
";",
"$",
"from",
"=",
"$",
"input",
"->",
"getArgument",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/Stampie/stampie-bundle/blob/a996d355a9d24ff667096315cc70b92f426b45f1/Command/SendEmailCommand.php#L50-L65 |
ftrrtf/FtrrtfRollbarBundle | Twig/RollbarExtension.php | RollbarExtension.getInitRollbarCode | public function getInitRollbarCode(array $context)
{
$accessToken = $this->notifierOptions['access_token'];
$config = array(
'accessToken' => $accessToken,
'captureUncaught' => true,
'payload' => array(
'environment' => $this->environmentOptions['... | php | public function getInitRollbarCode(array $context)
{
$accessToken = $this->notifierOptions['access_token'];
$config = array(
'accessToken' => $accessToken,
'captureUncaught' => true,
'payload' => array(
'environment' => $this->environmentOptions['... | [
"public",
"function",
"getInitRollbarCode",
"(",
"array",
"$",
"context",
")",
"{",
"$",
"accessToken",
"=",
"$",
"this",
"->",
"notifierOptions",
"[",
"'access_token'",
"]",
";",
"$",
"config",
"=",
"array",
"(",
"'accessToken'",
"=>",
"$",
"accessToken",
"... | @param array $context
@return string | [
"@param",
"array",
"$context"
] | train | https://github.com/ftrrtf/FtrrtfRollbarBundle/blob/64c75862b80a4a1ed9e98c0d217003e84df40dd7/Twig/RollbarExtension.php#L84-L129 |
comodojo/dispatcher.framework | src/Comodojo/Dispatcher/Router/Table.php | Table.registerRoute | private function registerRoute($folders, $type, $class = null, array $parameters = []) {
// The values associated with a route are as follows:
// $route = new Route($this->router);
$route = new Route();
$this->updateRoute($route, $type, $class, $parameters);
// $route->setType... | php | private function registerRoute($folders, $type, $class = null, array $parameters = []) {
// The values associated with a route are as follows:
// $route = new Route($this->router);
$route = new Route();
$this->updateRoute($route, $type, $class, $parameters);
// $route->setType... | [
"private",
"function",
"registerRoute",
"(",
"$",
"folders",
",",
"$",
"type",
",",
"$",
"class",
"=",
"null",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"// The values associated with a route are as follows:",
"// $route = new Route($this->router);",
... | This method add a route to the supported list | [
"This",
"method",
"add",
"a",
"route",
"to",
"the",
"supported",
"list"
] | train | https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Router/Table.php#L206-L227 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.onKernelRequest | public function onKernelRequest(GetResponseEvent $event)
{
// Nothing to do here, if it's not the Master request.
if (!$event->isMasterRequest()) {
return;
}
$request = $event->getRequest();
$route = $request->get('_route');
// Only do these 'expensive' ... | php | public function onKernelRequest(GetResponseEvent $event)
{
// Nothing to do here, if it's not the Master request.
if (!$event->isMasterRequest()) {
return;
}
$request = $event->getRequest();
$route = $request->get('_route');
// Only do these 'expensive' ... | [
"public",
"function",
"onKernelRequest",
"(",
"GetResponseEvent",
"$",
"event",
")",
"{",
"// Nothing to do here, if it's not the Master request.",
"if",
"(",
"!",
"$",
"event",
"->",
"isMasterRequest",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"request",
"=",
... | Kernel request listener callback.
@param GetResponseEvent $event | [
"Kernel",
"request",
"listener",
"callback",
"."
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L45-L85 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.mailConfigCheck | protected function mailConfigCheck()
{
if (!$this->app['config']->get('general/mailoptions') && $this->app['users']->getCurrentuser() && $this->app['users']->isAllowed('files:config')) {
$notice = json_encode([
'severity' => 1,
'notice' => 'The <strong>mail conf... | php | protected function mailConfigCheck()
{
if (!$this->app['config']->get('general/mailoptions') && $this->app['users']->getCurrentuser() && $this->app['users']->isAllowed('files:config')) {
$notice = json_encode([
'severity' => 1,
'notice' => 'The <strong>mail conf... | [
"protected",
"function",
"mailConfigCheck",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'general/mailoptions'",
")",
"&&",
"$",
"this",
"->",
"app",
"[",
"'users'",
"]",
"->",
"getCurrentuser",
"(",
... | No mail transport has been set. We should gently nudge the user to set
the mail configuration.
@see https://github.com/bolt/bolt/issues/2908 | [
"No",
"mail",
"transport",
"has",
"been",
"set",
".",
"We",
"should",
"gently",
"nudge",
"the",
"user",
"to",
"set",
"the",
"mail",
"configuration",
"."
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L93-L102 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.liveCheck | protected function liveCheck(Request $request)
{
if (!$this->app['debug']) {
return;
}
$host = parse_url($request->getSchemeAndHttpHost());
// If we have an IP-address, we assume it's "dev"
if (filter_var($host['host'], FILTER_VALIDATE_IP) !== false) {
... | php | protected function liveCheck(Request $request)
{
if (!$this->app['debug']) {
return;
}
$host = parse_url($request->getSchemeAndHttpHost());
// If we have an IP-address, we assume it's "dev"
if (filter_var($host['host'], FILTER_VALIDATE_IP) !== false) {
... | [
"protected",
"function",
"liveCheck",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"app",
"[",
"'debug'",
"]",
")",
"{",
"return",
";",
"}",
"$",
"host",
"=",
"parse_url",
"(",
"$",
"request",
"->",
"getSchemeAndHttpHost... | Check whether the site is live or not. | [
"Check",
"whether",
"the",
"site",
"is",
"live",
"or",
"not",
"."
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L121-L154 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.singleHostnameCheck | protected function singleHostnameCheck(Request $request)
{
$hostname = $request->getHttpHost();
if (strpos($hostname, '.') === false) {
$message = "You are using <code>$hostname</code> as host name. Some browsers have problems with sessions on hostnames that do not have a <code>.tld</co... | php | protected function singleHostnameCheck(Request $request)
{
$hostname = $request->getHttpHost();
if (strpos($hostname, '.') === false) {
$message = "You are using <code>$hostname</code> as host name. Some browsers have problems with sessions on hostnames that do not have a <code>.tld</co... | [
"protected",
"function",
"singleHostnameCheck",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"hostname",
"=",
"$",
"request",
"->",
"getHttpHost",
"(",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"hostname",
",",
"'.'",
")",
"===",
"false",
")",
"{",
"$... | Check whether or not we're running on a hostname without TLD, like 'http://localhost'. | [
"Check",
"whether",
"or",
"not",
"we",
"re",
"running",
"on",
"a",
"hostname",
"without",
"TLD",
"like",
"http",
":",
"//",
"localhost",
"."
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L174-L193 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.ipAddressCheck | protected function ipAddressCheck(Request $request)
{
$hostname = $request->getHttpHost();
if (filter_var($hostname, FILTER_VALIDATE_IP)) {
$message = "You are using the <strong>IP address</strong> <code>$hostname</code> as host name. This is known to cause problems with sessions.";
... | php | protected function ipAddressCheck(Request $request)
{
$hostname = $request->getHttpHost();
if (filter_var($hostname, FILTER_VALIDATE_IP)) {
$message = "You are using the <strong>IP address</strong> <code>$hostname</code> as host name. This is known to cause problems with sessions.";
... | [
"protected",
"function",
"ipAddressCheck",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"hostname",
"=",
"$",
"request",
"->",
"getHttpHost",
"(",
")",
";",
"if",
"(",
"filter_var",
"(",
"$",
"hostname",
",",
"FILTER_VALIDATE_IP",
")",
")",
"{",
"$",
"... | Check whether or not we're running on a hostname without TLD, like 'http://localhost'. | [
"Check",
"whether",
"or",
"not",
"we",
"re",
"running",
"on",
"a",
"hostname",
"without",
"TLD",
"like",
"http",
":",
"//",
"localhost",
"."
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L198-L217 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.topLevelCheck | protected function topLevelCheck(Request $request)
{
$base = $request->getBaseUrl();
if (!empty($base)) {
$notice = json_encode([
'severity' => 1,
'notice' => 'You are using Bolt in a subfolder, <strong>instead of the webroot</strong>.',
... | php | protected function topLevelCheck(Request $request)
{
$base = $request->getBaseUrl();
if (!empty($base)) {
$notice = json_encode([
'severity' => 1,
'notice' => 'You are using Bolt in a subfolder, <strong>instead of the webroot</strong>.',
... | [
"protected",
"function",
"topLevelCheck",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"base",
"=",
"$",
"request",
"->",
"getBaseUrl",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"base",
")",
")",
"{",
"$",
"notice",
"=",
"json_encode",
"(",... | Check whether or not we're running on a hostname without TLD, like 'http://localhost'.
@param Request $request | [
"Check",
"whether",
"or",
"not",
"we",
"re",
"running",
"on",
"a",
"hostname",
"without",
"TLD",
"like",
"http",
":",
"//",
"localhost",
"."
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L224-L237 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.writableFolderCheck | protected function writableFolderCheck()
{
$fileName = '/configtester_' . date('Y-m-d-h-i-s') . '.txt';
$fileSystems = [
['name' => 'files', 'folder' => '', 'label' => '<code>files/</code> in the webroot'],
['name' => 'extensions', 'folder' => '', 'label' => '<code>extension... | php | protected function writableFolderCheck()
{
$fileName = '/configtester_' . date('Y-m-d-h-i-s') . '.txt';
$fileSystems = [
['name' => 'files', 'folder' => '', 'label' => '<code>files/</code> in the webroot'],
['name' => 'extensions', 'folder' => '', 'label' => '<code>extension... | [
"protected",
"function",
"writableFolderCheck",
"(",
")",
"{",
"$",
"fileName",
"=",
"'/configtester_'",
".",
"date",
"(",
"'Y-m-d-h-i-s'",
")",
".",
"'.txt'",
";",
"$",
"fileSystems",
"=",
"[",
"[",
"'name'",
"=>",
"'files'",
",",
"'folder'",
"=>",
"''",
... | Check if some common file locations are writable. | [
"Check",
"if",
"some",
"common",
"file",
"locations",
"are",
"writable",
"."
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L242-L269 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.thumbsFolderCheck | protected function thumbsFolderCheck()
{
if (!$this->app['config']->get('general/thumbnails/save_files')) {
return;
}
$filePath = 'configtester_' . date('Y-m-d-h-i-s') . '.txt';
$contents = $this->isWritable(Bag::from(['name' => 'web', 'folder' => 'thumbs']), $filePath);... | php | protected function thumbsFolderCheck()
{
if (!$this->app['config']->get('general/thumbnails/save_files')) {
return;
}
$filePath = 'configtester_' . date('Y-m-d-h-i-s') . '.txt';
$contents = $this->isWritable(Bag::from(['name' => 'web', 'folder' => 'thumbs']), $filePath);... | [
"protected",
"function",
"thumbsFolderCheck",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'general/thumbnails/save_files'",
")",
")",
"{",
"return",
";",
"}",
"$",
"filePath",
"=",
"'configtester_'",
".... | Check if the thumbs/ folder is writable, if `save_files: true` | [
"Check",
"if",
"the",
"thumbs",
"/",
"folder",
"is",
"writable",
"if",
"save_files",
":",
"true"
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L274-L290 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.canonicalCheck | protected function canonicalCheck(Request $request)
{
$hostname = strtok($request->getUri(), '?');
$canonical = strtok($this->app['canonical']->getUrl());
if (!empty($canonical) && ($hostname != $canonical)) {
$notice = json_encode([
'severity' => 1,
... | php | protected function canonicalCheck(Request $request)
{
$hostname = strtok($request->getUri(), '?');
$canonical = strtok($this->app['canonical']->getUrl());
if (!empty($canonical) && ($hostname != $canonical)) {
$notice = json_encode([
'severity' => 1,
... | [
"protected",
"function",
"canonicalCheck",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"hostname",
"=",
"strtok",
"(",
"$",
"request",
"->",
"getUri",
"(",
")",
",",
"'?'",
")",
";",
"$",
"canonical",
"=",
"strtok",
"(",
"$",
"this",
"->",
"app",
... | Check if the current url matches the canonical.
@param Request $request | [
"Check",
"if",
"the",
"current",
"url",
"matches",
"the",
"canonical",
"."
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L297-L314 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.imageFunctionsCheck | protected function imageFunctionsCheck()
{
if (!extension_loaded('exif') || !function_exists('exif_read_data')) {
$notice = json_encode([
'severity' => 1,
'notice' => 'The function <code>exif_read_data</code> does not exist, which means that Bolt can not create ... | php | protected function imageFunctionsCheck()
{
if (!extension_loaded('exif') || !function_exists('exif_read_data')) {
$notice = json_encode([
'severity' => 1,
'notice' => 'The function <code>exif_read_data</code> does not exist, which means that Bolt can not create ... | [
"protected",
"function",
"imageFunctionsCheck",
"(",
")",
"{",
"if",
"(",
"!",
"extension_loaded",
"(",
"'exif'",
")",
"||",
"!",
"function_exists",
"(",
"'exif_read_data'",
")",
")",
"{",
"$",
"notice",
"=",
"json_encode",
"(",
"[",
"'severity'",
"=>",
"1",... | Check if the exif, fileinfo and gd extensions are enabled / compiled into PHP. | [
"Check",
"if",
"the",
"exif",
"fileinfo",
"and",
"gd",
"extensions",
"are",
"enabled",
"/",
"compiled",
"into",
"PHP",
"."
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L319-L347 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.maintenanceCheck | protected function maintenanceCheck()
{
if ($this->app['config']->get('general/maintenance_mode', false)) {
$notice = json_encode([
'severity' => 1,
'notice' => "Bolt's <strong>maintenance mode</strong> is enabled. This means that non-authenticated users will no... | php | protected function maintenanceCheck()
{
if ($this->app['config']->get('general/maintenance_mode', false)) {
$notice = json_encode([
'severity' => 1,
'notice' => "Bolt's <strong>maintenance mode</strong> is enabled. This means that non-authenticated users will no... | [
"protected",
"function",
"maintenanceCheck",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'general/maintenance_mode'",
",",
"false",
")",
")",
"{",
"$",
"notice",
"=",
"json_encode",
"(",
"[",
"'severity'",
... | If the site is in maintenance mode, show this on the dashboard. | [
"If",
"the",
"site",
"is",
"in",
"maintenance",
"mode",
"show",
"this",
"on",
"the",
"dashboard",
"."
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L352-L362 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.changelogCheck | protected function changelogCheck()
{
if (!$this->app['config']->get('general/changelog/enabled', false)) {
return;
}
// Get the number of items in the changelog
$count = $this->app['storage']->getRepository(LogChange::class)->count();
if ($count > $this->logThr... | php | protected function changelogCheck()
{
if (!$this->app['config']->get('general/changelog/enabled', false)) {
return;
}
// Get the number of items in the changelog
$count = $this->app['storage']->getRepository(LogChange::class)->count();
if ($count > $this->logThr... | [
"protected",
"function",
"changelogCheck",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'general/changelog/enabled'",
",",
"false",
")",
")",
"{",
"return",
";",
"}",
"// Get the number of items in the chang... | Check if Changelog is enabled, and if doesn't contain too many rows. | [
"Check",
"if",
"Changelog",
"is",
"enabled",
"and",
"if",
"doesn",
"t",
"contain",
"too",
"many",
"rows",
"."
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L367-L392 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.systemlogCheck | protected function systemlogCheck()
{
// Get the number of items in the changelog
$count = $this->app['storage']->getRepository(LogSystem::class)->count();
if ($count > $this->logThreshold) {
$message = sprintf(
"Bolt's <strong>systemlog</strong> is enabled, and ... | php | protected function systemlogCheck()
{
// Get the number of items in the changelog
$count = $this->app['storage']->getRepository(LogSystem::class)->count();
if ($count > $this->logThreshold) {
$message = sprintf(
"Bolt's <strong>systemlog</strong> is enabled, and ... | [
"protected",
"function",
"systemlogCheck",
"(",
")",
"{",
"// Get the number of items in the changelog",
"$",
"count",
"=",
"$",
"this",
"->",
"app",
"[",
"'storage'",
"]",
"->",
"getRepository",
"(",
"LogSystem",
"::",
"class",
")",
"->",
"count",
"(",
")",
"... | Check if systemlog doesn't contain too many rows. | [
"Check",
"if",
"systemlog",
"doesn",
"t",
"contain",
"too",
"many",
"rows",
"."
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L397-L418 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.thumbnailConfigCheck | protected function thumbnailConfigCheck()
{
$thumbConfig = $this->app['config']->get('general/thumbnails');
if ((strpos($thumbConfig['notfound_image'] . $thumbConfig['error_image'], '://') === false)) {
$notice = json_encode([
'severity' => 1,
'notice' ... | php | protected function thumbnailConfigCheck()
{
$thumbConfig = $this->app['config']->get('general/thumbnails');
if ((strpos($thumbConfig['notfound_image'] . $thumbConfig['error_image'], '://') === false)) {
$notice = json_encode([
'severity' => 1,
'notice' ... | [
"protected",
"function",
"thumbnailConfigCheck",
"(",
")",
"{",
"$",
"thumbConfig",
"=",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'general/thumbnails'",
")",
";",
"if",
"(",
"(",
"strpos",
"(",
"$",
"thumbConfig",
"[",
"'notfound_... | Check if the thumbnail config has been updated for 3.3+ . | [
"Check",
"if",
"the",
"thumbnail",
"config",
"has",
"been",
"updated",
"for",
"3",
".",
"3",
"+",
"."
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L423-L435 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.isWritable | private function isWritable(Bag $fileSystem, $filePath)
{
/** @var \Bolt\Filesystem\FilesystemInterface $fs */
$fs = $this->app['filesystem']->getFilesystem($fileSystem->get('name'));
$filePath = $fileSystem->get('folder') . '/' . $filePath;
try {
$fs->put($filePath, 'o... | php | private function isWritable(Bag $fileSystem, $filePath)
{
/** @var \Bolt\Filesystem\FilesystemInterface $fs */
$fs = $this->app['filesystem']->getFilesystem($fileSystem->get('name'));
$filePath = $fileSystem->get('folder') . '/' . $filePath;
try {
$fs->put($filePath, 'o... | [
"private",
"function",
"isWritable",
"(",
"Bag",
"$",
"fileSystem",
",",
"$",
"filePath",
")",
"{",
"/** @var \\Bolt\\Filesystem\\FilesystemInterface $fs */",
"$",
"fs",
"=",
"$",
"this",
"->",
"app",
"[",
"'filesystem'",
"]",
"->",
"getFilesystem",
"(",
"$",
"f... | @param Bag $fileSystem
@param string $filePath
@return bool|string | [
"@param",
"Bag",
"$fileSystem",
"@param",
"string",
"$filePath"
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L443-L459 |
bolt/configuration-notices | src/EventListener/ConfigurationNoticesListener.php | ConfigurationNoticesListener.getFolderName | private function getFolderName(Bag $fileSystem)
{
if ($fileSystem->has('label')) {
return $fileSystem->get('label');
}
return sprintf('%s://%s', $fileSystem->get('name'), $fileSystem->get('folder'));
} | php | private function getFolderName(Bag $fileSystem)
{
if ($fileSystem->has('label')) {
return $fileSystem->get('label');
}
return sprintf('%s://%s', $fileSystem->get('name'), $fileSystem->get('folder'));
} | [
"private",
"function",
"getFolderName",
"(",
"Bag",
"$",
"fileSystem",
")",
"{",
"if",
"(",
"$",
"fileSystem",
"->",
"has",
"(",
"'label'",
")",
")",
"{",
"return",
"$",
"fileSystem",
"->",
"get",
"(",
"'label'",
")",
";",
"}",
"return",
"sprintf",
"("... | @param Bag $fileSystem
@return string | [
"@param",
"Bag",
"$fileSystem"
] | train | https://github.com/bolt/configuration-notices/blob/0e6439f69bf3099bd6ea30288207a3fd2351e404/src/EventListener/ConfigurationNoticesListener.php#L466-L473 |
FrenchFrogs/framework | src/Table/Column/Strainer/Strainer.php | Strainer.call | public function call(\FrenchFrogs\Table\Table\Table $table, ...$params)
{
if ($this->hasCallable()) {
array_unshift($params, $this);
array_unshift($params, $table);
call_user_func_array($this->callable, $params);
} else {
// verify that source is a q... | php | public function call(\FrenchFrogs\Table\Table\Table $table, ...$params)
{
if ($this->hasCallable()) {
array_unshift($params, $this);
array_unshift($params, $table);
call_user_func_array($this->callable, $params);
} else {
// verify that source is a q... | [
"public",
"function",
"call",
"(",
"\\",
"FrenchFrogs",
"\\",
"Table",
"\\",
"Table",
"\\",
"Table",
"$",
"table",
",",
"...",
"$",
"params",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasCallable",
"(",
")",
")",
"{",
"array_unshift",
"(",
"$",
"param... | Execute strainer
@param \FrenchFrogs\Table\Table\Table $table
@param array ...$params
@return $this
@throws \Exception | [
"Execute",
"strainer"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Column/Strainer/Strainer.php#L120-L139 |
FrenchFrogs/framework | src/Table/Column/Strainer/Strainer.php | Strainer.setValue | public function setValue($value)
{
if (isset($this->element)) {
$this->element->setValue($value);
}
return $this;
} | php | public function setValue($value)
{
if (isset($this->element)) {
$this->element->setValue($value);
}
return $this;
} | [
"public",
"function",
"setValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"element",
")",
")",
"{",
"$",
"this",
"->",
"element",
"->",
"setValue",
"(",
"$",
"value",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"... | Set value to strainer element
@param $value
@return $this | [
"Set",
"value",
"to",
"strainer",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Column/Strainer/Strainer.php#L148-L156 |
acasademont/wurfl | WURFL/Storage/Factory.php | WURFL_Storage_Factory.create | public static function create($configuration)
{
$currentConfiguration = is_array($configuration) ?
array_merge(self::$defaultConfiguration, $configuration)
: self::$defaultConfiguration;
$class = self::className($currentConfiguration);
return new $class($curre... | php | public static function create($configuration)
{
$currentConfiguration = is_array($configuration) ?
array_merge(self::$defaultConfiguration, $configuration)
: self::$defaultConfiguration;
$class = self::className($currentConfiguration);
return new $class($curre... | [
"public",
"static",
"function",
"create",
"(",
"$",
"configuration",
")",
"{",
"$",
"currentConfiguration",
"=",
"is_array",
"(",
"$",
"configuration",
")",
"?",
"array_merge",
"(",
"self",
"::",
"$",
"defaultConfiguration",
",",
"$",
"configuration",
")",
":"... | Create a configuration based on the default configuration with the differences from $configuration
@param array $configuration
@return WURFL_Storage_Base Storage object, initialized with the given $configuration | [
"Create",
"a",
"configuration",
"based",
"on",
"the",
"default",
"configuration",
"with",
"the",
"differences",
"from",
"$configuration"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Storage/Factory.php#L38-L45 |
PandawanTechnology/neo4j-data-fixtures | src/Loader.php | Loader.loadFromDirectory | public function loadFromDirectory($dir)
{
if (!is_dir($dir)) {
throw new \InvalidArgumentException(sprintf('"%s" does not exist', $dir));
}
$iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS),
... | php | public function loadFromDirectory($dir)
{
if (!is_dir($dir)) {
throw new \InvalidArgumentException(sprintf('"%s" does not exist', $dir));
}
$iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS),
... | [
"public",
"function",
"loadFromDirectory",
"(",
"$",
"dir",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"dir",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'\"%s\" does not exist'",
",",
"$",
"dir",
")",
")",
"... | Find fixtures classes in a given directory and load them.
@param string $dir Directory to find fixture classes in.
@return array $fixtures Array of loaded fixture object instances. | [
"Find",
"fixtures",
"classes",
"in",
"a",
"given",
"directory",
"and",
"load",
"them",
"."
] | train | https://github.com/PandawanTechnology/neo4j-data-fixtures/blob/58701f30f3de9c848308623c5e773aada106a2aa/src/Loader.php#L36-L48 |
PandawanTechnology/neo4j-data-fixtures | src/Loader.php | Loader.addFixture | public function addFixture(Neo4jFixtureInterface $fixture)
{
$fixtureClass = get_class($fixture);
if (isset($this->fixtures[$fixtureClass])) {
return;
}
$this->fixtures[$fixtureClass] = $fixture;
if ($fixture instanceof Neo4jDependentFixtureInterface) {
... | php | public function addFixture(Neo4jFixtureInterface $fixture)
{
$fixtureClass = get_class($fixture);
if (isset($this->fixtures[$fixtureClass])) {
return;
}
$this->fixtures[$fixtureClass] = $fixture;
if ($fixture instanceof Neo4jDependentFixtureInterface) {
... | [
"public",
"function",
"addFixture",
"(",
"Neo4jFixtureInterface",
"$",
"fixture",
")",
"{",
"$",
"fixtureClass",
"=",
"get_class",
"(",
"$",
"fixture",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"fixtures",
"[",
"$",
"fixtureClass",
"]",
")",
... | Add a fixture object instance to the loader.
@param Neo4jFixtureInterface $fixture | [
"Add",
"a",
"fixture",
"object",
"instance",
"to",
"the",
"loader",
"."
] | train | https://github.com/PandawanTechnology/neo4j-data-fixtures/blob/58701f30f3de9c848308623c5e773aada106a2aa/src/Loader.php#L85-L104 |
PandawanTechnology/neo4j-data-fixtures | src/Loader.php | Loader.isTransient | public function isTransient($className)
{
$rc = new \ReflectionClass($className);
if ($rc->isAbstract()) {
return true;
}
$interfaces = class_implements($className);
return !in_array('PandawanTechnology\Neo4jDataFixtures\Neo4jFixtureInterface', $interfaces);
... | php | public function isTransient($className)
{
$rc = new \ReflectionClass($className);
if ($rc->isAbstract()) {
return true;
}
$interfaces = class_implements($className);
return !in_array('PandawanTechnology\Neo4jDataFixtures\Neo4jFixtureInterface', $interfaces);
... | [
"public",
"function",
"isTransient",
"(",
"$",
"className",
")",
"{",
"$",
"rc",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"className",
")",
";",
"if",
"(",
"$",
"rc",
"->",
"isAbstract",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"i... | Check if a given fixture is transient and should not be considered a data fixtures
class.
@param string $className
@return bool | [
"Check",
"if",
"a",
"given",
"fixture",
"is",
"transient",
"and",
"should",
"not",
"be",
"considered",
"a",
"data",
"fixtures",
"class",
"."
] | train | https://github.com/PandawanTechnology/neo4j-data-fixtures/blob/58701f30f3de9c848308623c5e773aada106a2aa/src/Loader.php#L134-L145 |
PandawanTechnology/neo4j-data-fixtures | src/Loader.php | Loader.loadFromIterator | private function loadFromIterator(\Iterator $iterator)
{
$includedFiles = [];
foreach ($iterator as $file) {
if (($fileName = $file->getBasename($this->fileExtension)) == $file->getBasename()) {
continue;
}
$sourceFile = realpath($file->getPathNa... | php | private function loadFromIterator(\Iterator $iterator)
{
$includedFiles = [];
foreach ($iterator as $file) {
if (($fileName = $file->getBasename($this->fileExtension)) == $file->getBasename()) {
continue;
}
$sourceFile = realpath($file->getPathNa... | [
"private",
"function",
"loadFromIterator",
"(",
"\\",
"Iterator",
"$",
"iterator",
")",
"{",
"$",
"includedFiles",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"iterator",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"(",
"$",
"fileName",
"=",
"$",
"file",
"-... | Load fixtures from files contained in iterator.
@param \Iterator $iterator Iterator over files from which fixtures should be loaded.
@return Neo4jFixtureInterface[] $fixtures Array of loaded fixture object instances. | [
"Load",
"fixtures",
"from",
"files",
"contained",
"in",
"iterator",
"."
] | train | https://github.com/PandawanTechnology/neo4j-data-fixtures/blob/58701f30f3de9c848308623c5e773aada106a2aa/src/Loader.php#L274-L303 |
jan-dolata/crude-crud | src/Http/Requests/ExportRequest.php | ExportRequest.authorize | public function authorize()
{
$crude = CrudeInstance::get($this->crudeName);
if ($crude == null)
return false;
if ($crude->cannotExport())
return false;
$this->crude = $crude;
return true;
} | php | public function authorize()
{
$crude = CrudeInstance::get($this->crudeName);
if ($crude == null)
return false;
if ($crude->cannotExport())
return false;
$this->crude = $crude;
return true;
} | [
"public",
"function",
"authorize",
"(",
")",
"{",
"$",
"crude",
"=",
"CrudeInstance",
"::",
"get",
"(",
"$",
"this",
"->",
"crudeName",
")",
";",
"if",
"(",
"$",
"crude",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"$",
"crude",
"->",
"ca... | Determine if the user is authorized to make this request.
@return bool | [
"Determine",
"if",
"the",
"user",
"is",
"authorized",
"to",
"make",
"this",
"request",
"."
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Http/Requests/ExportRequest.php#L16-L29 |
jkribeiro/composer-hydration | src/Composer/ComposerHydrationHandler.php | ComposerHydrationHandler.toUpperCamelCase | public function toUpperCamelCase($string)
{
$string = str_replace(array('-', '_'), ' ', $string);
$string = ucwords(strtolower($string));
$string = str_replace(' ', '', $string);
return $string;
} | php | public function toUpperCamelCase($string)
{
$string = str_replace(array('-', '_'), ' ', $string);
$string = ucwords(strtolower($string));
$string = str_replace(' ', '', $string);
return $string;
} | [
"public",
"function",
"toUpperCamelCase",
"(",
"$",
"string",
")",
"{",
"$",
"string",
"=",
"str_replace",
"(",
"array",
"(",
"'-'",
",",
"'_'",
")",
",",
"' '",
",",
"$",
"string",
")",
";",
"$",
"string",
"=",
"ucwords",
"(",
"strtolower",
"(",
"$"... | Converts a string to upper camel case.
@param string $string
The string to be converted.
@return string
An upper camel case string. | [
"Converts",
"a",
"string",
"to",
"upper",
"camel",
"case",
"."
] | train | https://github.com/jkribeiro/composer-hydration/blob/b0dd7e9c4a966f664c2df08b3067c1b6f263e226/src/Composer/ComposerHydrationHandler.php#L99-L106 |
jkribeiro/composer-hydration | src/Composer/ComposerHydrationHandler.php | ComposerHydrationHandler.getMagicVariableValue | public function getMagicVariableValue($variable)
{
$base_path_name = basename(realpath("."));
switch ($variable) {
case self::MAGIC_VAR_BASENAME:
return $base_path_name;
break;
case self::MAGIC_VAR_UCFIRST_BASENAME:
return ucf... | php | public function getMagicVariableValue($variable)
{
$base_path_name = basename(realpath("."));
switch ($variable) {
case self::MAGIC_VAR_BASENAME:
return $base_path_name;
break;
case self::MAGIC_VAR_UCFIRST_BASENAME:
return ucf... | [
"public",
"function",
"getMagicVariableValue",
"(",
"$",
"variable",
")",
"{",
"$",
"base_path_name",
"=",
"basename",
"(",
"realpath",
"(",
"\".\"",
")",
")",
";",
"switch",
"(",
"$",
"variable",
")",
"{",
"case",
"self",
"::",
"MAGIC_VAR_BASENAME",
":",
... | Returns the magic value of a magic variable.
@return string
The magic value. | [
"Returns",
"the",
"magic",
"value",
"of",
"a",
"magic",
"variable",
"."
] | train | https://github.com/jkribeiro/composer-hydration/blob/b0dd7e9c4a966f664c2df08b3067c1b6f263e226/src/Composer/ComposerHydrationHandler.php#L130-L153 |
jkribeiro/composer-hydration | src/Composer/ComposerHydrationHandler.php | ComposerHydrationHandler.getReplaceValuesFromArgument | public function getReplaceValuesFromArgument($argValues)
{
$replaceValues = array();
$argValues = explode(',', $argValues);
foreach ($argValues as $argValue) {
$argValue = explode(':', $argValue);
if (count($argValue) != 2) {
$msg = 'Command argument ... | php | public function getReplaceValuesFromArgument($argValues)
{
$replaceValues = array();
$argValues = explode(',', $argValues);
foreach ($argValues as $argValue) {
$argValue = explode(':', $argValue);
if (count($argValue) != 2) {
$msg = 'Command argument ... | [
"public",
"function",
"getReplaceValuesFromArgument",
"(",
"$",
"argValues",
")",
"{",
"$",
"replaceValues",
"=",
"array",
"(",
")",
";",
"$",
"argValues",
"=",
"explode",
"(",
"','",
",",
"$",
"argValues",
")",
";",
"foreach",
"(",
"$",
"argValues",
"as",... | Returns an array containing the replace values from command argument.
@param string $argValues
Command argument replace value.
@return array
An array, following the format: SEARCH => REPLACE. | [
"Returns",
"an",
"array",
"containing",
"the",
"replace",
"values",
"from",
"command",
"argument",
"."
] | train | https://github.com/jkribeiro/composer-hydration/blob/b0dd7e9c4a966f664c2df08b3067c1b6f263e226/src/Composer/ComposerHydrationHandler.php#L164-L187 |
jkribeiro/composer-hydration | src/Composer/ComposerHydrationHandler.php | ComposerHydrationHandler.getArguments | public function getArguments()
{
// Checks if script received command arguments.
$cmdArguments = $this->event->getArguments();
if (!$cmdArguments) {
throw new \ErrorException('Hydrate command expects arguments.');
}
// Treats arguments.
$returnArguments =... | php | public function getArguments()
{
// Checks if script received command arguments.
$cmdArguments = $this->event->getArguments();
if (!$cmdArguments) {
throw new \ErrorException('Hydrate command expects arguments.');
}
// Treats arguments.
$returnArguments =... | [
"public",
"function",
"getArguments",
"(",
")",
"{",
"// Checks if script received command arguments.",
"$",
"cmdArguments",
"=",
"$",
"this",
"->",
"event",
"->",
"getArguments",
"(",
")",
";",
"if",
"(",
"!",
"$",
"cmdArguments",
")",
"{",
"throw",
"new",
"\... | Returns an array containing the command arguments values.
@return array
An array containing the script command arguments. | [
"Returns",
"an",
"array",
"containing",
"the",
"command",
"arguments",
"values",
"."
] | train | https://github.com/jkribeiro/composer-hydration/blob/b0dd7e9c4a966f664c2df08b3067c1b6f263e226/src/Composer/ComposerHydrationHandler.php#L195-L227 |
jkribeiro/composer-hydration | src/Composer/ComposerHydrationHandler.php | ComposerHydrationHandler.hydrateFileContents | public function hydrateFileContents($replaceMap)
{
$io = $this->event->getIO();
$finder = new Finder();
$finder->in($this->basePath);
$finder->ignoreDotFiles(false);
$finder->notPath('vendor');
$finder->notName('composer.json');
// Find files.
foreac... | php | public function hydrateFileContents($replaceMap)
{
$io = $this->event->getIO();
$finder = new Finder();
$finder->in($this->basePath);
$finder->ignoreDotFiles(false);
$finder->notPath('vendor');
$finder->notName('composer.json');
// Find files.
foreac... | [
"public",
"function",
"hydrateFileContents",
"(",
"$",
"replaceMap",
")",
"{",
"$",
"io",
"=",
"$",
"this",
"->",
"event",
"->",
"getIO",
"(",
")",
";",
"$",
"finder",
"=",
"new",
"Finder",
"(",
")",
";",
"$",
"finder",
"->",
"in",
"(",
"$",
"this"... | Process hydration to File contents.
@param string $replaceMap
An array containing the replacement map following the format:
[{SEARCH} => {REPLACE},
{SEARCH} => {REPLACE},
...] | [
"Process",
"hydration",
"to",
"File",
"contents",
"."
] | train | https://github.com/jkribeiro/composer-hydration/blob/b0dd7e9c4a966f664c2df08b3067c1b6f263e226/src/Composer/ComposerHydrationHandler.php#L238-L279 |
jkribeiro/composer-hydration | src/Composer/ComposerHydrationHandler.php | ComposerHydrationHandler.hydrateRenameFilesAndFolders | public function hydrateRenameFilesAndFolders($replaceMap)
{
$io = $this->event->getIO();
$finder = new Finder();
$finder->in($this->basePath);
$finder->ignoreDotFiles(false);
$finder->exclude('vendor');
foreach ($replaceMap as $search => $replace) {
// R... | php | public function hydrateRenameFilesAndFolders($replaceMap)
{
$io = $this->event->getIO();
$finder = new Finder();
$finder->in($this->basePath);
$finder->ignoreDotFiles(false);
$finder->exclude('vendor');
foreach ($replaceMap as $search => $replace) {
// R... | [
"public",
"function",
"hydrateRenameFilesAndFolders",
"(",
"$",
"replaceMap",
")",
"{",
"$",
"io",
"=",
"$",
"this",
"->",
"event",
"->",
"getIO",
"(",
")",
";",
"$",
"finder",
"=",
"new",
"Finder",
"(",
")",
";",
"$",
"finder",
"->",
"in",
"(",
"$",... | Process hydration renaming files and folders.
@param string $replaceMap
An array containing the replacement map following the format:
[{SEARCH} => {REPLACE},
{SEARCH} => {REPLACE},
...] | [
"Process",
"hydration",
"renaming",
"files",
"and",
"folders",
"."
] | train | https://github.com/jkribeiro/composer-hydration/blob/b0dd7e9c4a966f664c2df08b3067c1b6f263e226/src/Composer/ComposerHydrationHandler.php#L290-L328 |
jkribeiro/composer-hydration | src/Composer/ComposerHydrationHandler.php | ComposerHydrationHandler.hydrate | public function hydrate()
{
$arguments = $this->getArguments();
$replaceMap = $arguments[self::REPLACE_ARG];
// Rename Files and Folders.
$this->hydrateRenameFilesAndFolders($replaceMap);
// Hydrate file contents.
$this->hydrateFileContents($replaceMap);
} | php | public function hydrate()
{
$arguments = $this->getArguments();
$replaceMap = $arguments[self::REPLACE_ARG];
// Rename Files and Folders.
$this->hydrateRenameFilesAndFolders($replaceMap);
// Hydrate file contents.
$this->hydrateFileContents($replaceMap);
} | [
"public",
"function",
"hydrate",
"(",
")",
"{",
"$",
"arguments",
"=",
"$",
"this",
"->",
"getArguments",
"(",
")",
";",
"$",
"replaceMap",
"=",
"$",
"arguments",
"[",
"self",
"::",
"REPLACE_ARG",
"]",
";",
"// Rename Files and Folders.",
"$",
"this",
"->"... | Performs Hydration process. | [
"Performs",
"Hydration",
"process",
"."
] | train | https://github.com/jkribeiro/composer-hydration/blob/b0dd7e9c4a966f664c2df08b3067c1b6f263e226/src/Composer/ComposerHydrationHandler.php#L333-L343 |
acasademont/wurfl | WURFL/DeviceRepositoryBuilder.php | WURFL_DeviceRepositoryBuilder.build | public function build($wurflFile, $wurflPatches = array(), $capabilityFilter = array())
{
if (!$this->isRepositoryBuilt()) {
// If acquireLock() is false, the WURFL is being reloaded in another thread
if ($this->acquireLock()) {
set_time_limit(600);
$i... | php | public function build($wurflFile, $wurflPatches = array(), $capabilityFilter = array())
{
if (!$this->isRepositoryBuilt()) {
// If acquireLock() is false, the WURFL is being reloaded in another thread
if ($this->acquireLock()) {
set_time_limit(600);
$i... | [
"public",
"function",
"build",
"(",
"$",
"wurflFile",
",",
"$",
"wurflPatches",
"=",
"array",
"(",
")",
",",
"$",
"capabilityFilter",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isRepositoryBuilt",
"(",
")",
")",
"{",
"// If... | Builds DeviceRepository in PersistenceProvider from $wurflFile and $wurflPatches using $capabilityFilter
@param string $wurflFile Filename of wurfl.xml or other complete WURFL file
@param array $wurflPatches Array of WURFL patch files
@param array $capabilityFilter Array of capabilities to be included in the DeviceRepo... | [
"Builds",
"DeviceRepository",
"in",
"PersistenceProvider",
"from",
"$wurflFile",
"and",
"$wurflPatches",
"using",
"$capabilityFilter"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/DeviceRepositoryBuilder.php#L76-L94 |
acasademont/wurfl | WURFL/DeviceRepositoryBuilder.php | WURFL_DeviceRepositoryBuilder.acquireLock | private function acquireLock()
{
if (file_exists($this->lockFile)) {
$stale_after = filemtime($this->lockFile) + $this->maxLockAge;
if (time() > $stale_after) {
// The lockfile is stale, delete it and reacquire a lock
@rmdir($this->lockFile);
... | php | private function acquireLock()
{
if (file_exists($this->lockFile)) {
$stale_after = filemtime($this->lockFile) + $this->maxLockAge;
if (time() > $stale_after) {
// The lockfile is stale, delete it and reacquire a lock
@rmdir($this->lockFile);
... | [
"private",
"function",
"acquireLock",
"(",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
"lockFile",
")",
")",
"{",
"$",
"stale_after",
"=",
"filemtime",
"(",
"$",
"this",
"->",
"lockFile",
")",
"+",
"$",
"this",
"->",
"maxLockAge",
";",
... | Acquires a lock so only this thread reloads the WURFL data, returns false if it cannot be acquired
@return boolean | [
"Acquires",
"a",
"lock",
"so",
"only",
"this",
"thread",
"reloads",
"the",
"WURFL",
"data",
"returns",
"false",
"if",
"it",
"cannot",
"be",
"acquired"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/DeviceRepositoryBuilder.php#L147-L163 |
acasademont/wurfl | WURFL/DeviceRepositoryBuilder.php | WURFL_DeviceRepositoryBuilder.buildRepository | private function buildRepository($wurflInfoIterator, $deviceIterator, $patchDeviceIterators = null)
{
$this->persistWurflInfo($wurflInfoIterator);
$patchingDevices = $this->toListOfPatchingDevices($patchDeviceIterators);
try {
$this->process($deviceIterator, $patchingDevices);
... | php | private function buildRepository($wurflInfoIterator, $deviceIterator, $patchDeviceIterators = null)
{
$this->persistWurflInfo($wurflInfoIterator);
$patchingDevices = $this->toListOfPatchingDevices($patchDeviceIterators);
try {
$this->process($deviceIterator, $patchingDevices);
... | [
"private",
"function",
"buildRepository",
"(",
"$",
"wurflInfoIterator",
",",
"$",
"deviceIterator",
",",
"$",
"patchDeviceIterators",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"persistWurflInfo",
"(",
"$",
"wurflInfoIterator",
")",
";",
"$",
"patchingDevices",
... | Iterates over XML files and pulls relevent data
@param WURFL_Xml_VersionIterator $wurflInfoIterator
@param WURFL_Xml_DeviceIterator $deviceIterator
@param array $patchDeviceIterators arrray of WURFL_Xml_DeviceIterator objects for patch files
@throws Exception | [
"Iterates",
"over",
"XML",
"files",
"and",
"pulls",
"relevent",
"data"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/DeviceRepositoryBuilder.php#L185-L195 |
acasademont/wurfl | WURFL/DeviceRepositoryBuilder.php | WURFL_DeviceRepositoryBuilder.toPatchIterators | private function toPatchIterators($wurflPatches, $capabilityFilter)
{
$patchIterators = array();
if (is_array($wurflPatches)) {
foreach ($wurflPatches as $wurflPatch) {
$patchIterators[] = new WURFL_Xml_DeviceIterator($wurflPatch, $capabilityFilter);
}
... | php | private function toPatchIterators($wurflPatches, $capabilityFilter)
{
$patchIterators = array();
if (is_array($wurflPatches)) {
foreach ($wurflPatches as $wurflPatch) {
$patchIterators[] = new WURFL_Xml_DeviceIterator($wurflPatch, $capabilityFilter);
}
... | [
"private",
"function",
"toPatchIterators",
"(",
"$",
"wurflPatches",
",",
"$",
"capabilityFilter",
")",
"{",
"$",
"patchIterators",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"wurflPatches",
")",
")",
"{",
"foreach",
"(",
"$",
"wurflPatc... | Returns an array of WURFL_Xml_DeviceIterator for the given $wurflPatches and $capabilityFilter
@param array $wurflPatches Array of (string)filenames
@param array $capabilityFilter Array of (string) WURFL capabilities
@return array Array of WURFL_Xml_DeviceIterator objects | [
"Returns",
"an",
"array",
"of",
"WURFL_Xml_DeviceIterator",
"for",
"the",
"given",
"$wurflPatches",
"and",
"$capabilityFilter"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/DeviceRepositoryBuilder.php#L203-L212 |
acasademont/wurfl | WURFL/DeviceRepositoryBuilder.php | WURFL_DeviceRepositoryBuilder.persistWurflInfo | private function persistWurflInfo($wurflInfoIterator)
{
foreach ($wurflInfoIterator as $info) {
$this->persistenceProvider->save(WURFL_Xml_Info::PERSISTENCE_KEY, $info);
return;
}
} | php | private function persistWurflInfo($wurflInfoIterator)
{
foreach ($wurflInfoIterator as $info) {
$this->persistenceProvider->save(WURFL_Xml_Info::PERSISTENCE_KEY, $info);
return;
}
} | [
"private",
"function",
"persistWurflInfo",
"(",
"$",
"wurflInfoIterator",
")",
"{",
"foreach",
"(",
"$",
"wurflInfoIterator",
"as",
"$",
"info",
")",
"{",
"$",
"this",
"->",
"persistenceProvider",
"->",
"save",
"(",
"WURFL_Xml_Info",
"::",
"PERSISTENCE_KEY",
","... | Save Loaded WURFL info in the persistence provider
@param WURFL_Xml_VersionIterator $wurflInfoIterator | [
"Save",
"Loaded",
"WURFL",
"info",
"in",
"the",
"persistence",
"provider"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/DeviceRepositoryBuilder.php#L257-L263 |
acasademont/wurfl | WURFL/DeviceRepositoryBuilder.php | WURFL_DeviceRepositoryBuilder.classifyAndPersistDevice | private function classifyAndPersistDevice($device)
{
if ($this->validateDevice($device) === false) {
return;
}
array_push($this->devices, $device->id);
if ($device->fallBack != 'root') {
$this->fallbacks[$device->fallBack]= $device->id;
}
$th... | php | private function classifyAndPersistDevice($device)
{
if ($this->validateDevice($device) === false) {
return;
}
array_push($this->devices, $device->id);
if ($device->fallBack != 'root') {
$this->fallbacks[$device->fallBack]= $device->id;
}
$th... | [
"private",
"function",
"classifyAndPersistDevice",
"(",
"$",
"device",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validateDevice",
"(",
"$",
"device",
")",
"===",
"false",
")",
"{",
"return",
";",
"}",
"array_push",
"(",
"$",
"this",
"->",
"devices",
",",
... | Save given $device in the persistence provider. This is called when loading the WURFL XML
data, directly after reading the complete device node.
@param WURFL_Xml_ModelDevice $device
@see WURFL_UserAgentHandlerChain::filter(), WURFL_Storage_Base::save() | [
"Save",
"given",
"$device",
"in",
"the",
"persistence",
"provider",
".",
"This",
"is",
"called",
"when",
"loading",
"the",
"WURFL",
"XML",
"data",
"directly",
"after",
"reading",
"the",
"complete",
"device",
"node",
"."
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/DeviceRepositoryBuilder.php#L320-L333 |
marmelab/phpcr-api | src/PHPCRAPI/PHPCR/Node.php | Node.getReducedTree | public function getReducedTree()
{
$parseTree = function (Node $node, Node $target) use ( &$parseTree ) {
if (substr($target->getPath(),0, strlen($node->getPath())) != $node->getPath()) {
return array();
}
$tree = array();
foreach ($node->getN... | php | public function getReducedTree()
{
$parseTree = function (Node $node, Node $target) use ( &$parseTree ) {
if (substr($target->getPath(),0, strlen($node->getPath())) != $node->getPath()) {
return array();
}
$tree = array();
foreach ($node->getN... | [
"public",
"function",
"getReducedTree",
"(",
")",
"{",
"$",
"parseTree",
"=",
"function",
"(",
"Node",
"$",
"node",
",",
"Node",
"$",
"target",
")",
"use",
"(",
"&",
"$",
"parseTree",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"target",
"->",
"getPath"... | Return a the minimum tree to display for a node
@return array The tree
@api | [
"Return",
"a",
"the",
"minimum",
"tree",
"to",
"display",
"for",
"a",
"node"
] | train | https://github.com/marmelab/phpcr-api/blob/372149e27d45babe142d0546894362fce987729b/src/PHPCRAPI/PHPCR/Node.php#L88-L127 |
marmelab/phpcr-api | src/PHPCRAPI/PHPCR/Node.php | Node.getPropertiesAsArray | public function getPropertiesAsArray()
{
$array = array();
foreach ($this->getProperties() as $property) {
$array[$property->getName()] = [ 'value' => $property->getValue(), 'type' => $property->getType() ];
}
return $array;
} | php | public function getPropertiesAsArray()
{
$array = array();
foreach ($this->getProperties() as $property) {
$array[$property->getName()] = [ 'value' => $property->getValue(), 'type' => $property->getType() ];
}
return $array;
} | [
"public",
"function",
"getPropertiesAsArray",
"(",
")",
"{",
"$",
"array",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getProperties",
"(",
")",
"as",
"$",
"property",
")",
"{",
"$",
"array",
"[",
"$",
"property",
"->",
"getName",
... | Convert node's properties to array
@return array Properties
@api | [
"Convert",
"node",
"s",
"properties",
"to",
"array"
] | train | https://github.com/marmelab/phpcr-api/blob/372149e27d45babe142d0546894362fce987729b/src/PHPCRAPI/PHPCR/Node.php#L136-L145 |
jan-dolata/crude-crud | src/Engine/CrudeSetupTrait/Filters.php | Filters.setFilters | public function setFilters($filters)
{
if (! is_array($filters))
$filters = [$filters];
$this->filters = array_unique(array_merge($this->filters, $filters));
return $this;
} | php | public function setFilters($filters)
{
if (! is_array($filters))
$filters = [$filters];
$this->filters = array_unique(array_merge($this->filters, $filters));
return $this;
} | [
"public",
"function",
"setFilters",
"(",
"$",
"filters",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"filters",
")",
")",
"$",
"filters",
"=",
"[",
"$",
"filters",
"]",
";",
"$",
"this",
"->",
"filters",
"=",
"array_unique",
"(",
"array_merge",
"... | Sets the Filters.
@param array|sting $filters the filters
@return self | [
"Sets",
"the",
"Filters",
"."
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeSetupTrait/Filters.php#L33-L41 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.