repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
koolkode/http | src/HttpMessage.php | HttpMessage.determineHeaderTypeName | protected function determineHeaderTypeName(callable $callback)
{
if(is_array($callback))
{
$ref = new \ReflectionMethod(is_object($callback[0]) ? get_class($callback[0]) : $callback[0], $callback[1]);
}
elseif(is_object($callback) && !$callback instanceof \Closure)
{
$ref = new \ReflectionMethod(get_cl... | php | protected function determineHeaderTypeName(callable $callback)
{
if(is_array($callback))
{
$ref = new \ReflectionMethod(is_object($callback[0]) ? get_class($callback[0]) : $callback[0], $callback[1]);
}
elseif(is_object($callback) && !$callback instanceof \Closure)
{
$ref = new \ReflectionMethod(get_cl... | [
"protected",
"function",
"determineHeaderTypeName",
"(",
"callable",
"$",
"callback",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"callback",
")",
")",
"{",
"$",
"ref",
"=",
"new",
"\\",
"ReflectionMethod",
"(",
"is_object",
"(",
"$",
"callback",
"[",
"0",
... | Extract meta info of the first argument to the given callback and determine an HTTP header
implementation to be used.
@param callable $callback
@return string
@throws \InvalidArgumentException when the given callback does not specify a valid HTTP header argument. | [
"Extract",
"meta",
"info",
"of",
"the",
"first",
"argument",
"to",
"the",
"given",
"callback",
"and",
"determine",
"an",
"HTTP",
"header",
"implementation",
"to",
"be",
"used",
"."
] | 3c1626d409d5ce5d71d26f0e8f31ae3683a2a966 | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/HttpMessage.php#L307-L342 | train |
koolkode/http | src/HttpMessage.php | HttpMessage.setEntity | public function setEntity($entity, $prepare = true)
{
if($entity instanceof EntityInterface)
{
$this->entity = $entity;
}
elseif(is_resource($entity) || $entity instanceof StreamInterface)
{
$this->entity = new StreamEntity($entity);
}
elseif((is_array($entity) || is_object($entity)) && is_calla... | php | public function setEntity($entity, $prepare = true)
{
if($entity instanceof EntityInterface)
{
$this->entity = $entity;
}
elseif(is_resource($entity) || $entity instanceof StreamInterface)
{
$this->entity = new StreamEntity($entity);
}
elseif((is_array($entity) || is_object($entity)) && is_calla... | [
"public",
"function",
"setEntity",
"(",
"$",
"entity",
",",
"$",
"prepare",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"entity",
"instanceof",
"EntityInterface",
")",
"{",
"$",
"this",
"->",
"entity",
"=",
"$",
"entity",
";",
"}",
"elseif",
"(",
"is_resour... | Convert the given argument into an HTTP entity and put it in the nessage.
@param mixed $entity
@param boolean $prepare Have the entity inject Content-Type etc. into the HTTP message?
@return HttpMessage | [
"Convert",
"the",
"given",
"argument",
"into",
"an",
"HTTP",
"entity",
"and",
"put",
"it",
"in",
"the",
"nessage",
"."
] | 3c1626d409d5ce5d71d26f0e8f31ae3683a2a966 | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/HttpMessage.php#L411-L436 | train |
bkstg/schedule-bundle | Timeline/Spread/InvitedSpread.php | InvitedSpread.resolveClass | private function resolveClass($object)
{
if (!$object instanceof Proxy) {
return get_class($object);
}
// If this is a proxy resolve using class metadata.
return $this
->em
->getClassMetadata(get_class($object))
->getReflectionClass()
... | php | private function resolveClass($object)
{
if (!$object instanceof Proxy) {
return get_class($object);
}
// If this is a proxy resolve using class metadata.
return $this
->em
->getClassMetadata(get_class($object))
->getReflectionClass()
... | [
"private",
"function",
"resolveClass",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"Proxy",
")",
"{",
"return",
"get_class",
"(",
"$",
"object",
")",
";",
"}",
"// If this is a proxy resolve using class metadata.",
"return",
"$",
... | Figure out the real class for this object.
@param mixed $object The object.
@return string | [
"Figure",
"out",
"the",
"real",
"class",
"for",
"this",
"object",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Timeline/Spread/InvitedSpread.php#L73-L85 | train |
gplcart/cli | controllers/commands/Module.php | Module.cmdUninstallModule | public function cmdUninstallModule()
{
$result = $this->module_model->uninstall($this->getParam(0));
if ($result !== true) {
$this->errorAndExit($result);
}
$this->output();
} | php | public function cmdUninstallModule()
{
$result = $this->module_model->uninstall($this->getParam(0));
if ($result !== true) {
$this->errorAndExit($result);
}
$this->output();
} | [
"public",
"function",
"cmdUninstallModule",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"module_model",
"->",
"uninstall",
"(",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
")",
";",
"if",
"(",
"$",
"result",
"!==",
"true",
")",
"{",
"$",
... | Callback for "module-uninstall" command | [
"Callback",
"for",
"module",
"-",
"uninstall",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Module.php#L49-L58 | train |
gplcart/cli | controllers/commands/Module.php | Module.cmdInstallModule | public function cmdInstallModule()
{
$result = $this->module_model->install($this->getParam(0));
if ($result !== true) {
$this->errorAndExit($result);
}
$this->output();
} | php | public function cmdInstallModule()
{
$result = $this->module_model->install($this->getParam(0));
if ($result !== true) {
$this->errorAndExit($result);
}
$this->output();
} | [
"public",
"function",
"cmdInstallModule",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"module_model",
"->",
"install",
"(",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
")",
";",
"if",
"(",
"$",
"result",
"!==",
"true",
")",
"{",
"$",
"t... | Callback for "module-install" command | [
"Callback",
"for",
"module",
"-",
"install",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Module.php#L63-L72 | train |
gplcart/cli | controllers/commands/Module.php | Module.cmdOffModule | public function cmdOffModule()
{
$id = $this->getParam(0);
if (empty($id)) {
$this->errorAndExit($this->text('Invalid argument'));
}
$result = $this->module_model->disable($id);
if ($result !== true) {
$this->errorAndExit($result);
}
... | php | public function cmdOffModule()
{
$id = $this->getParam(0);
if (empty($id)) {
$this->errorAndExit($this->text('Invalid argument'));
}
$result = $this->module_model->disable($id);
if ($result !== true) {
$this->errorAndExit($result);
}
... | [
"public",
"function",
"cmdOffModule",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"errorAndExit",
"(",
"$",
"this",
"->",
"text",
"(",
"... | Callback for "module-off" command | [
"Callback",
"for",
"module",
"-",
"off",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Module.php#L77-L92 | train |
gplcart/cli | controllers/commands/Module.php | Module.cmdOnModule | public function cmdOnModule()
{
$id = $this->getParam(0);
if (empty($id)) {
$this->errorAndExit($this->text('Invalid argument'));
}
$result = $this->module_model->enable($id);
if ($result !== true) {
$this->errorAndExit($result);
}
... | php | public function cmdOnModule()
{
$id = $this->getParam(0);
if (empty($id)) {
$this->errorAndExit($this->text('Invalid argument'));
}
$result = $this->module_model->enable($id);
if ($result !== true) {
$this->errorAndExit($result);
}
... | [
"public",
"function",
"cmdOnModule",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"errorAndExit",
"(",
"$",
"this",
"->",
"text",
"(",
"'... | Callback for "module-on" command | [
"Callback",
"for",
"module",
"-",
"on",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Module.php#L97-L112 | train |
gplcart/cli | controllers/commands/Module.php | Module.cmdGetModule | public function cmdGetModule()
{
$result = $this->getListModule();
$this->outputFormat($result);
$this->outputFormatTableModule($result);
$this->output();
} | php | public function cmdGetModule()
{
$result = $this->getListModule();
$this->outputFormat($result);
$this->outputFormatTableModule($result);
$this->output();
} | [
"public",
"function",
"cmdGetModule",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getListModule",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTableModule",
"(",
"$",
"result",... | Callback for "module-get" command | [
"Callback",
"for",
"module",
"-",
"get",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Module.php#L117-L123 | train |
OxfordInfoLabs/kinikit-core | src/Util/HTTP/HttpRemoteRequest.php | HttpRemoteRequest.dispatch | public function dispatch($ignoreErrors = true, $timeout = null) {
if (!isset($this->headers)) {
$this->headers = array();
}
if (!isset($this->headers["Content-Type"]))
$this->headers["Content-Type"] = "application/json";
// If we have an auth username and pass... | php | public function dispatch($ignoreErrors = true, $timeout = null) {
if (!isset($this->headers)) {
$this->headers = array();
}
if (!isset($this->headers["Content-Type"]))
$this->headers["Content-Type"] = "application/json";
// If we have an auth username and pass... | [
"public",
"function",
"dispatch",
"(",
"$",
"ignoreErrors",
"=",
"true",
",",
"$",
"timeout",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"headers",
")",
")",
"{",
"$",
"this",
"->",
"headers",
"=",
"array",
"(",
")",
... | Dispatch the request and collect the result.
@return string | [
"Dispatch",
"the",
"request",
"and",
"collect",
"the",
"result",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/HTTP/HttpRemoteRequest.php#L50-L106 | train |
koolkode/xml | src/XmlStreamReader.php | XmlStreamReader.getNamespaceMappings | public function getNamespaceMappings()
{
$dom = (new XmlDocumentBuilder())->buildDocument($this);
$xpath = new \DOMXPath($dom);
$namespaces = [];
foreach($xpath->query('namespace::*', $dom->documentElement) as $result)
{
$namespaces[(string)$result->prefix] = (string)$result->nodeValue;
}
ret... | php | public function getNamespaceMappings()
{
$dom = (new XmlDocumentBuilder())->buildDocument($this);
$xpath = new \DOMXPath($dom);
$namespaces = [];
foreach($xpath->query('namespace::*', $dom->documentElement) as $result)
{
$namespaces[(string)$result->prefix] = (string)$result->nodeValue;
}
ret... | [
"public",
"function",
"getNamespaceMappings",
"(",
")",
"{",
"$",
"dom",
"=",
"(",
"new",
"XmlDocumentBuilder",
"(",
")",
")",
"->",
"buildDocument",
"(",
"$",
"this",
")",
";",
"$",
"xpath",
"=",
"new",
"\\",
"DOMXPath",
"(",
"$",
"dom",
")",
";",
"... | Get a map of namespaces prefix - URI mappings of the current node, prefixes are keys.
@return array<string, string> | [
"Get",
"a",
"map",
"of",
"namespaces",
"prefix",
"-",
"URI",
"mappings",
"of",
"the",
"current",
"node",
"prefixes",
"are",
"keys",
"."
] | 0ce43b8f56c692dee9f05bb740c2b5f4f419176a | https://github.com/koolkode/xml/blob/0ce43b8f56c692dee9f05bb740c2b5f4f419176a/src/XmlStreamReader.php#L162-L175 | train |
Dhii/placeholder-template | src/AbstractBasePlaceholderTemplateFactory.php | AbstractBasePlaceholderTemplateFactory._make | protected function _make($config = null)
{
$productClassname = $this->_normalizeString($this->_getProductClassname());
if (!$this->_classExists($productClassname)) {
throw $this->_createOutOfRangeException($this->__('Class "%1$s" does not exist', [$productClassname]), null, null, $produc... | php | protected function _make($config = null)
{
$productClassname = $this->_normalizeString($this->_getProductClassname());
if (!$this->_classExists($productClassname)) {
throw $this->_createOutOfRangeException($this->__('Class "%1$s" does not exist', [$productClassname]), null, null, $produc... | [
"protected",
"function",
"_make",
"(",
"$",
"config",
"=",
"null",
")",
"{",
"$",
"productClassname",
"=",
"$",
"this",
"->",
"_normalizeString",
"(",
"$",
"this",
"->",
"_getProductClassname",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_c... | Creates a new instance of a placeholder template.
@since [*next-version*]
@param array|ArrayAccess|BaseContainerInterface|stdClass|null $config The make config.
@throws InvalidArgumentException If product classname is not a valid type.
@throws OutOfRangeException If class that the factory is trying to mak... | [
"Creates",
"a",
"new",
"instance",
"of",
"a",
"placeholder",
"template",
"."
] | ab6eb2f98b085dfdf22cf86fd243cd7e6ee68525 | https://github.com/Dhii/placeholder-template/blob/ab6eb2f98b085dfdf22cf86fd243cd7e6ee68525/src/AbstractBasePlaceholderTemplateFactory.php#L68-L78 | train |
wasinger/adaptimage | src/ImagineFilter/FixOrientation.php | FixOrientation.apply | public function apply(ImageInterface $image)
{
// 1 2 3 4 5 6 7 8
//
// 888888 888888 88 88 8888888888 88 88 8888888888
// 88 88 88 88 88 88 88 88 ... | php | public function apply(ImageInterface $image)
{
// 1 2 3 4 5 6 7 8
//
// 888888 888888 88 88 8888888888 88 88 8888888888
// 88 88 88 88 88 88 88 88 ... | [
"public",
"function",
"apply",
"(",
"ImageInterface",
"$",
"image",
")",
"{",
"// 1 2 3 4 5 6 7 8",
"//",
"// 888888 888888 88 88 8888888888 88 88 8888888888",
"// 88 88 ... | Applies scheduled transformation to ImageInterface instance
Returns processed ImageInterface instance
@param ImageInterface $image
@return ImageInterface | [
"Applies",
"scheduled",
"transformation",
"to",
"ImageInterface",
"instance",
"Returns",
"processed",
"ImageInterface",
"instance"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ImagineFilter/FixOrientation.php#L26-L73 | train |
danielgp/common-lib | source/MySQLiByDanielGPtables.php | MySQLiByDanielGPtables.getFieldOutputNumeric | private function getFieldOutputNumeric($tblSrc, $value, $iar = [])
{
if ($value['EXTRA'] == 'auto_increment') {
return $this->getFieldOutputNumericAI($value, $iar);
}
$fkArray = $this->getForeignKeysToArray($this->advCache['workingDatabase'], $tblSrc, $value['COLUMN_NAME']);
... | php | private function getFieldOutputNumeric($tblSrc, $value, $iar = [])
{
if ($value['EXTRA'] == 'auto_increment') {
return $this->getFieldOutputNumericAI($value, $iar);
}
$fkArray = $this->getForeignKeysToArray($this->advCache['workingDatabase'], $tblSrc, $value['COLUMN_NAME']);
... | [
"private",
"function",
"getFieldOutputNumeric",
"(",
"$",
"tblSrc",
",",
"$",
"value",
",",
"$",
"iar",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"value",
"[",
"'EXTRA'",
"]",
"==",
"'auto_increment'",
")",
"{",
"return",
"$",
"this",
"->",
"getFieldOut... | Returns a Numeric field 2 use in a form
@param string $tblSrc
@param array $value
@param array $iar
@return string | [
"Returns",
"a",
"Numeric",
"field",
"2",
"use",
"in",
"a",
"form"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPtables.php#L49-L60 | train |
danielgp/common-lib | source/MySQLiByDanielGPtables.php | MySQLiByDanielGPtables.getFieldOutputNumericAI | private function getFieldOutputNumericAI($value, $iar = [])
{
if ($this->getFieldValue($value) == '') {
$spF = ['id' => $value['COLUMN_NAME'], 'style' => 'font-style:italic;'];
return $this->setStringIntoTag('auto-numar', 'span', $spF);
}
$inAdtnl = [
'typ... | php | private function getFieldOutputNumericAI($value, $iar = [])
{
if ($this->getFieldValue($value) == '') {
$spF = ['id' => $value['COLUMN_NAME'], 'style' => 'font-style:italic;'];
return $this->setStringIntoTag('auto-numar', 'span', $spF);
}
$inAdtnl = [
'typ... | [
"private",
"function",
"getFieldOutputNumericAI",
"(",
"$",
"value",
",",
"$",
"iar",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getFieldValue",
"(",
"$",
"value",
")",
"==",
"''",
")",
"{",
"$",
"spF",
"=",
"[",
"'id'",
"=>",
"$",
"... | Handles creation of Auto Increment numeric field type output
@param array $value
@param array $iar
@return string | [
"Handles",
"creation",
"of",
"Auto",
"Increment",
"numeric",
"field",
"type",
"output"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPtables.php#L69-L85 | train |
danielgp/common-lib | source/MySQLiByDanielGPtables.php | MySQLiByDanielGPtables.getFieldOutputNumericNonFK | private function getFieldOutputNumericNonFK($fkArray, $value, $iar = [])
{
$query = $this->sQueryGenericSelectKeyValue([
'`' . $value['COLUMN_NAME'] . '`',
$fkArray[$value['COLUMN_NAME']][2],
$fkArray[$value['COLUMN_NAME']][0],
]);
$selectOptions =... | php | private function getFieldOutputNumericNonFK($fkArray, $value, $iar = [])
{
$query = $this->sQueryGenericSelectKeyValue([
'`' . $value['COLUMN_NAME'] . '`',
$fkArray[$value['COLUMN_NAME']][2],
$fkArray[$value['COLUMN_NAME']][0],
]);
$selectOptions =... | [
"private",
"function",
"getFieldOutputNumericNonFK",
"(",
"$",
"fkArray",
",",
"$",
"value",
",",
"$",
"iar",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"sQueryGenericSelectKeyValue",
"(",
"[",
"'`'",
".",
"$",
"value",
"[",
"'COLUMN_... | Builds field output type for numeric types if not FK
@param array $fkArray
@param array $value
@param array $iar
@return string | [
"Builds",
"field",
"output",
"type",
"for",
"numeric",
"types",
"if",
"not",
"FK"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPtables.php#L95-L112 | train |
danielgp/common-lib | source/MySQLiByDanielGPtables.php | MySQLiByDanielGPtables.getFieldOutputTextPrerequisites | private function getFieldOutputTextPrerequisites($tbl, $value)
{
$foreignKeysArray = [];
if (($tbl != 'user_rights') && ($value['COLUMN_NAME'] != 'eid')) {
$database = $this->advCache['workingDatabase'];
if (strpos($tbl, '`.`')) {
$database = substr($tbl, 0, s... | php | private function getFieldOutputTextPrerequisites($tbl, $value)
{
$foreignKeysArray = [];
if (($tbl != 'user_rights') && ($value['COLUMN_NAME'] != 'eid')) {
$database = $this->advCache['workingDatabase'];
if (strpos($tbl, '`.`')) {
$database = substr($tbl, 0, s... | [
"private",
"function",
"getFieldOutputTextPrerequisites",
"(",
"$",
"tbl",
",",
"$",
"value",
")",
"{",
"$",
"foreignKeysArray",
"=",
"[",
"]",
";",
"if",
"(",
"(",
"$",
"tbl",
"!=",
"'user_rights'",
")",
"&&",
"(",
"$",
"value",
"[",
"'COLUMN_NAME'",
"]... | Prepares the text output fields
@param string $tbl
@param array $value
@return array | [
"Prepares",
"the",
"text",
"output",
"fields"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPtables.php#L121-L132 | train |
danielgp/common-lib | source/MySQLiByDanielGPtables.php | MySQLiByDanielGPtables.getForeignKeysToArray | private function getForeignKeysToArray($database, $tblName, $oCol = '')
{
if (!isset($this->advCache['tableFKs'][$database][$tblName])) {
$this->setTableForeignKeyCache($database, $this->fixTableSource($tblName));
}
$aRt = [];
if (isset($this->advCache['tableFKs'][$databa... | php | private function getForeignKeysToArray($database, $tblName, $oCol = '')
{
if (!isset($this->advCache['tableFKs'][$database][$tblName])) {
$this->setTableForeignKeyCache($database, $this->fixTableSource($tblName));
}
$aRt = [];
if (isset($this->advCache['tableFKs'][$databa... | [
"private",
"function",
"getForeignKeysToArray",
"(",
"$",
"database",
",",
"$",
"tblName",
",",
"$",
"oCol",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"advCache",
"[",
"'tableFKs'",
"]",
"[",
"$",
"database",
"]",
"[",
"$"... | Returns an array with fields referenced by a Foreign key
@param string $database
@param string $tblName
@param string|array $oCol Only column(s) considered
@return array | [
"Returns",
"an",
"array",
"with",
"fields",
"referenced",
"by",
"a",
"Foreign",
"key"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPtables.php#L142-L160 | train |
danielgp/common-lib | source/MySQLiByDanielGPtables.php | MySQLiByDanielGPtables.setTableCache | protected function setTableCache($tblSrc)
{
$dat = $this->establishDatabaseAndTable($tblSrc);
if (!isset($this->advCache['tableStructureCache'][$dat[0]][$dat[1]])) {
$this->advCache['workingDatabase'] = $dat[0];
$this->advCache['tableStructureCache'][$da... | php | protected function setTableCache($tblSrc)
{
$dat = $this->establishDatabaseAndTable($tblSrc);
if (!isset($this->advCache['tableStructureCache'][$dat[0]][$dat[1]])) {
$this->advCache['workingDatabase'] = $dat[0];
$this->advCache['tableStructureCache'][$da... | [
"protected",
"function",
"setTableCache",
"(",
"$",
"tblSrc",
")",
"{",
"$",
"dat",
"=",
"$",
"this",
"->",
"establishDatabaseAndTable",
"(",
"$",
"tblSrc",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"advCache",
"[",
"'tableStructureCache'"... | create a Cache for given table to use it in many places
@param string $tblSrc | [
"create",
"a",
"Cache",
"for",
"given",
"table",
"to",
"use",
"it",
"in",
"many",
"places"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPtables.php#L167-L178 | train |
ScaraMVC/Framework | src/Scara/Session/File.php | File.content | private function content()
{
$handle = fopen($this->_config, 'r');
$content = @json_decode(stream_get_contents($handle));
return $content;
} | php | private function content()
{
$handle = fopen($this->_config, 'r');
$content = @json_decode(stream_get_contents($handle));
return $content;
} | [
"private",
"function",
"content",
"(",
")",
"{",
"$",
"handle",
"=",
"fopen",
"(",
"$",
"this",
"->",
"_config",
",",
"'r'",
")",
";",
"$",
"content",
"=",
"@",
"json_decode",
"(",
"stream_get_contents",
"(",
"$",
"handle",
")",
")",
";",
"return",
"... | Gets the file session's content.
@return mixed | [
"Gets",
"the",
"file",
"session",
"s",
"content",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Session/File.php#L121-L127 | train |
ScaraMVC/Framework | src/Scara/Session/File.php | File.write | private function write($content)
{
$handle = fopen($this->_config, 'w+');
fwrite($handle, @json_encode($content));
fclose($handle);
} | php | private function write($content)
{
$handle = fopen($this->_config, 'w+');
fwrite($handle, @json_encode($content));
fclose($handle);
} | [
"private",
"function",
"write",
"(",
"$",
"content",
")",
"{",
"$",
"handle",
"=",
"fopen",
"(",
"$",
"this",
"->",
"_config",
",",
"'w+'",
")",
";",
"fwrite",
"(",
"$",
"handle",
",",
"@",
"json_encode",
"(",
"$",
"content",
")",
")",
";",
"fclose... | Writes session info to file session.
@param mixed $content
@return void | [
"Writes",
"session",
"info",
"to",
"file",
"session",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Session/File.php#L136-L141 | train |
dmj/PicaRecord | src/HAB/Pica/Record/Subfield.php | Subfield.factory | public static function factory (array $subfield)
{
if (!array_key_exists('code', $subfield)) {
throw new InvalidArgumentException("Missing 'code' index in subfield array");
}
if (!array_key_exists('value', $subfield)) {
throw new InvalidArgumentException("Missing 'val... | php | public static function factory (array $subfield)
{
if (!array_key_exists('code', $subfield)) {
throw new InvalidArgumentException("Missing 'code' index in subfield array");
}
if (!array_key_exists('value', $subfield)) {
throw new InvalidArgumentException("Missing 'val... | [
"public",
"static",
"function",
"factory",
"(",
"array",
"$",
"subfield",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'code'",
",",
"$",
"subfield",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Missing 'code' index in subfield array\"... | Return a new subfield based on its array representation.
The array representation of a subfield is an associative array with the
keys `code' and `value', holding the subfield code and value.
@throws InvalidArgumentException Missing code or value index
@param array $subfield Array representation of a subfield
@retur... | [
"Return",
"a",
"new",
"subfield",
"based",
"on",
"its",
"array",
"representation",
"."
] | bd5577b9a4333aa6156398b94cc870a9377061b8 | https://github.com/dmj/PicaRecord/blob/bd5577b9a4333aa6156398b94cc870a9377061b8/src/HAB/Pica/Record/Subfield.php#L65-L74 | train |
Talesoft/tale-framework | src/Tale/Factory.php | Factory.registerAlias | public function registerAlias($alias, $className)
{
$this->_aliases[$alias] = $this->resolveClassName($className);
return $this;
} | php | public function registerAlias($alias, $className)
{
$this->_aliases[$alias] = $this->resolveClassName($className);
return $this;
} | [
"public",
"function",
"registerAlias",
"(",
"$",
"alias",
",",
"$",
"className",
")",
"{",
"$",
"this",
"->",
"_aliases",
"[",
"$",
"alias",
"]",
"=",
"$",
"this",
"->",
"resolveClassName",
"(",
"$",
"className",
")",
";",
"return",
"$",
"this",
";",
... | Registers a new alias with a specific FQCN
@param string $alias The alias the FQDN can be found under
@param string $className The FQCN the given alias should map to
@return $this | [
"Registers",
"a",
"new",
"alias",
"with",
"a",
"specific",
"FQCN"
] | 739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49 | https://github.com/Talesoft/tale-framework/blob/739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49/src/Tale/Factory.php#L78-L84 | train |
Talesoft/tale-framework | src/Tale/Factory.php | Factory.registerAliases | public function registerAliases(array $aliases)
{
foreach ($aliases as $alias => $className)
$this->registerAlias($alias, $className);
return $this;
} | php | public function registerAliases(array $aliases)
{
foreach ($aliases as $alias => $className)
$this->registerAlias($alias, $className);
return $this;
} | [
"public",
"function",
"registerAliases",
"(",
"array",
"$",
"aliases",
")",
"{",
"foreach",
"(",
"$",
"aliases",
"as",
"$",
"alias",
"=>",
"$",
"className",
")",
"$",
"this",
"->",
"registerAlias",
"(",
"$",
"alias",
",",
"$",
"className",
")",
";",
"r... | Registers an array of aliases.
The aliases should be the keys, the FQCNs the values of the associative array
@param array $aliases Associative array of aliases => FQCNs
@return $this | [
"Registers",
"an",
"array",
"of",
"aliases",
".",
"The",
"aliases",
"should",
"be",
"the",
"keys",
"the",
"FQCNs",
"the",
"values",
"of",
"the",
"associative",
"array"
] | 739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49 | https://github.com/Talesoft/tale-framework/blob/739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49/src/Tale/Factory.php#L94-L101 | train |
Talesoft/tale-framework | src/Tale/Factory.php | Factory.resolveClassName | public function resolveClassName($className)
{
if (isset($this->_aliases[$className]))
$className = $this->_aliases[$className];
return $className;
} | php | public function resolveClassName($className)
{
if (isset($this->_aliases[$className]))
$className = $this->_aliases[$className];
return $className;
} | [
"public",
"function",
"resolveClassName",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_aliases",
"[",
"$",
"className",
"]",
")",
")",
"$",
"className",
"=",
"$",
"this",
"->",
"_aliases",
"[",
"$",
"className",
"]",
... | Resolves a a class-name or an alias to a FQCN
If no alias is found, it returns the class name given
@param string $className The class-name to be converted
@return string The usable FQCN of the class | [
"Resolves",
"a",
"a",
"class",
"-",
"name",
"or",
"an",
"alias",
"to",
"a",
"FQCN"
] | 739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49 | https://github.com/Talesoft/tale-framework/blob/739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49/src/Tale/Factory.php#L113-L120 | train |
Talesoft/tale-framework | src/Tale/Factory.php | Factory.createInstance | public function createInstance($className, array $args = null)
{
$args = $args ? $args : [];
$className = $this->resolveClassName($className);
if (!class_exists($className) || ($this->_baseClassName && !is_subclass_of($className, $this->_baseClassName)))
throw new FactoryExcept... | php | public function createInstance($className, array $args = null)
{
$args = $args ? $args : [];
$className = $this->resolveClassName($className);
if (!class_exists($className) || ($this->_baseClassName && !is_subclass_of($className, $this->_baseClassName)))
throw new FactoryExcept... | [
"public",
"function",
"createInstance",
"(",
"$",
"className",
",",
"array",
"$",
"args",
"=",
"null",
")",
"{",
"$",
"args",
"=",
"$",
"args",
"?",
"$",
"args",
":",
"[",
"]",
";",
"$",
"className",
"=",
"$",
"this",
"->",
"resolveClassName",
"(",
... | Creates a new instance of a class based on a class name or alias given.
If the class doesnt exist or doesnt extend the base-class of this factory,
a RuntimeException is thrown
Uses Reflection internally
@see ReflectionClass->newInstanceArgs
@param string $className The alias or FQCN to instanciate
@param array|... | [
"Creates",
"a",
"new",
"instance",
"of",
"a",
"class",
"based",
"on",
"a",
"class",
"name",
"or",
"alias",
"given",
"."
] | 739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49 | https://github.com/Talesoft/tale-framework/blob/739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49/src/Tale/Factory.php#L139-L154 | train |
eloquent/blox | src/Element/DocumentationBlock.php | DocumentationBlock.tagsByName | public function tagsByName($name)
{
$tags = array();
foreach ($this->tags() as $tag) {
if ($name === $tag->name()) {
$tags[] = $tag;
}
}
return $tags;
} | php | public function tagsByName($name)
{
$tags = array();
foreach ($this->tags() as $tag) {
if ($name === $tag->name()) {
$tags[] = $tag;
}
}
return $tags;
} | [
"public",
"function",
"tagsByName",
"(",
"$",
"name",
")",
"{",
"$",
"tags",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"tags",
"(",
")",
"as",
"$",
"tag",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"$",
"tag",
"->",
"name",
... | Get all the tags of this block with a specific tag name.
@param string $name The tag name to search for.
@return array<DocumentationTag> The tags with a matching tag name. | [
"Get",
"all",
"the",
"tags",
"of",
"this",
"block",
"with",
"a",
"specific",
"tag",
"name",
"."
] | dcfe82a0a703124ab5807d894979530d6fdb536b | https://github.com/eloquent/blox/blob/dcfe82a0a703124ab5807d894979530d6fdb536b/src/Element/DocumentationBlock.php#L57-L67 | train |
vpg/titon.utility | src/Titon/Utility/Number.php | Number.bytesTo | public static function bytesTo($size, $precision = 0) {
$sizes = array('YB', 'ZB', 'EB', 'PB', 'TB', 'GB', 'MB', 'KB', 'B');
$total = count($sizes);
while ($total-- && $size >= 1024) {
$size /= 1024;
}
return static::precision($size, $precision) . $sizes[$total];
... | php | public static function bytesTo($size, $precision = 0) {
$sizes = array('YB', 'ZB', 'EB', 'PB', 'TB', 'GB', 'MB', 'KB', 'B');
$total = count($sizes);
while ($total-- && $size >= 1024) {
$size /= 1024;
}
return static::precision($size, $precision) . $sizes[$total];
... | [
"public",
"static",
"function",
"bytesTo",
"(",
"$",
"size",
",",
"$",
"precision",
"=",
"0",
")",
"{",
"$",
"sizes",
"=",
"array",
"(",
"'YB'",
",",
"'ZB'",
",",
"'EB'",
",",
"'PB'",
",",
"'TB'",
",",
"'GB'",
",",
"'MB'",
",",
"'KB'",
",",
"'B'"... | Convert a numerical value to the readable string notated equivalent.
@param int $size
@param int $precision
@return string | [
"Convert",
"a",
"numerical",
"value",
"to",
"the",
"readable",
"string",
"notated",
"equivalent",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Number.php#L70-L79 | train |
vpg/titon.utility | src/Titon/Utility/Number.php | Number.convert | public static function convert($no, $fromBase, $toBase) {
if ($fromBase == $toBase) {
return $no;
}
return base_convert($no, $fromBase, $toBase);
} | php | public static function convert($no, $fromBase, $toBase) {
if ($fromBase == $toBase) {
return $no;
}
return base_convert($no, $fromBase, $toBase);
} | [
"public",
"static",
"function",
"convert",
"(",
"$",
"no",
",",
"$",
"fromBase",
",",
"$",
"toBase",
")",
"{",
"if",
"(",
"$",
"fromBase",
"==",
"$",
"toBase",
")",
"{",
"return",
"$",
"no",
";",
"}",
"return",
"base_convert",
"(",
"$",
"no",
",",
... | Convert a number from one base to another.
@param int $no
@param int $fromBase
@param int $toBase
@return int | [
"Convert",
"a",
"number",
"from",
"one",
"base",
"to",
"another",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Number.php#L89-L95 | train |
vpg/titon.utility | src/Titon/Utility/Number.php | Number.currency | public static function currency($number, array $options = array()) {
$defaults = array(
'thousands' => ',',
'decimals' => '.',
'places' => 2,
'code' => 'USD #',
'dollar' => '$#',
'cents' => '#¢',
'use' => 'dollar',
... | php | public static function currency($number, array $options = array()) {
$defaults = array(
'thousands' => ',',
'decimals' => '.',
'places' => 2,
'code' => 'USD #',
'dollar' => '$#',
'cents' => '#¢',
'use' => 'dollar',
... | [
"public",
"static",
"function",
"currency",
"(",
"$",
"number",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"defaults",
"=",
"array",
"(",
"'thousands'",
"=>",
"','",
",",
"'decimals'",
"=>",
"'.'",
",",
"'places'",
"=>",
"2",
... | Convert a number to it's currency equivalent, respecting locale.
Allow for overrides through an options array.
@param int $number
@param array $options {
@type string $thousands Character used for thousands place
@type string $decimals Character used for decimal
@type int $places Decimal (cent) limit
@type stri... | [
"Convert",
"a",
"number",
"to",
"it",
"s",
"currency",
"equivalent",
"respecting",
"locale",
".",
"Allow",
"for",
"overrides",
"through",
"an",
"options",
"array",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Number.php#L114-L148 | train |
vpg/titon.utility | src/Titon/Utility/Number.php | Number.percentage | public static function percentage($number, $options = array()) {
if (!is_array($options)) {
$options = array('places' => $options);
}
$options = $options + array(
'thousands' => ',',
'decimals' => '.',
'places' => 2
);
return numb... | php | public static function percentage($number, $options = array()) {
if (!is_array($options)) {
$options = array('places' => $options);
}
$options = $options + array(
'thousands' => ',',
'decimals' => '.',
'places' => 2
);
return numb... | [
"public",
"static",
"function",
"percentage",
"(",
"$",
"number",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
")",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"'places'",
"=>",
"$",
"opti... | Convert a number to a percentage string with decimal and comma separations.
@param int $number
@param int|array $options {
@type string $thousands Character used for thousands place
@type string $decimals Character used for decimal
@type int $places Decimal (cent) limit
}
@return string | [
"Convert",
"a",
"number",
"to",
"a",
"percentage",
"string",
"with",
"decimal",
"and",
"comma",
"separations",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Number.php#L268-L280 | train |
WellCommerce/CurrencyBundle | EventListener/CurrencySubscriber.php | CurrencySubscriber.getLocaleCurrency | protected function getLocaleCurrency(Request $request)
{
$currentLocale = $request->getLocale();
$locale = $this->container->get('locale.repository')->findOneBy(['code' => $currentLocale]);
if (null !== $locale && $locale->getCurrency() instanceof Currency) {
return $loca... | php | protected function getLocaleCurrency(Request $request)
{
$currentLocale = $request->getLocale();
$locale = $this->container->get('locale.repository')->findOneBy(['code' => $currentLocale]);
if (null !== $locale && $locale->getCurrency() instanceof Currency) {
return $loca... | [
"protected",
"function",
"getLocaleCurrency",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"currentLocale",
"=",
"$",
"request",
"->",
"getLocale",
"(",
")",
";",
"$",
"locale",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'locale.repository'",
... | Returns the currency code for active locale
@param Request $request
@return string | [
"Returns",
"the",
"currency",
"code",
"for",
"active",
"locale"
] | 48a6995eedb9c1f93d10751a6d1070e4cbca307e | https://github.com/WellCommerce/CurrencyBundle/blob/48a6995eedb9c1f93d10751a6d1070e4cbca307e/EventListener/CurrencySubscriber.php#L54-L64 | train |
lanfisis/deflection | src/Deflection/Generator.php | Generator.asString | public function asString()
{
$display = function ($lines, $length, $loop = 0) use (&$display) {
$output = '';
foreach ($lines as $line) {
$line = is_a($line, 'Deflection\Element\AbstractElement') ? $line->getElement() : $line;
if (is_array($line)) {
... | php | public function asString()
{
$display = function ($lines, $length, $loop = 0) use (&$display) {
$output = '';
foreach ($lines as $line) {
$line = is_a($line, 'Deflection\Element\AbstractElement') ? $line->getElement() : $line;
if (is_array($line)) {
... | [
"public",
"function",
"asString",
"(",
")",
"{",
"$",
"display",
"=",
"function",
"(",
"$",
"lines",
",",
"$",
"length",
",",
"$",
"loop",
"=",
"0",
")",
"use",
"(",
"&",
"$",
"display",
")",
"{",
"$",
"output",
"=",
"''",
";",
"foreach",
"(",
... | Returns class definition as a string
@return string | [
"Returns",
"class",
"definition",
"as",
"a",
"string"
] | 31deaf7f085d6456d8a323e7ac3cc9914fbe49a9 | https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Generator.php#L46-L62 | train |
TuumPHP/Web | src/Stack/ViewStack.php | ViewStack.streamView | private function streamView($response)
{
if (Response::isError($response) &&
!$response->getBody() instanceof ViewStream
) {
$response = $this->setErrorView($response);
return $response;
}
return $response;
} | php | private function streamView($response)
{
if (Response::isError($response) &&
!$response->getBody() instanceof ViewStream
) {
$response = $this->setErrorView($response);
return $response;
}
return $response;
} | [
"private",
"function",
"streamView",
"(",
"$",
"response",
")",
"{",
"if",
"(",
"Response",
"::",
"isError",
"(",
"$",
"response",
")",
"&&",
"!",
"$",
"response",
"->",
"getBody",
"(",
")",
"instanceof",
"ViewStream",
")",
"{",
"$",
"response",
"=",
"... | fill up contents for VIEW and ERROR responses.
@param Response $response
@return Response | [
"fill",
"up",
"contents",
"for",
"VIEW",
"and",
"ERROR",
"responses",
"."
] | 8f296b6358aa93226ce08d6cc54a309f5b0a9820 | https://github.com/TuumPHP/Web/blob/8f296b6358aa93226ce08d6cc54a309f5b0a9820/src/Stack/ViewStack.php#L89-L98 | train |
TuumPHP/Web | src/Stack/ViewStack.php | ViewStack.setErrorView | private function setErrorView($response)
{
if (Response::isServerError($response) && $this->logger) {
$this->logger->error('received a server error response: ' . $response->getStatusCode());
}
$stream = $this->error->getStream($response->getStatusCode(), $response->getData());
... | php | private function setErrorView($response)
{
if (Response::isServerError($response) && $this->logger) {
$this->logger->error('received a server error response: ' . $response->getStatusCode());
}
$stream = $this->error->getStream($response->getStatusCode(), $response->getData());
... | [
"private",
"function",
"setErrorView",
"(",
"$",
"response",
")",
"{",
"if",
"(",
"Response",
"::",
"isServerError",
"(",
"$",
"response",
")",
"&&",
"$",
"this",
"->",
"logger",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"error",
"(",
"'received a ser... | render error pages.
@param Response $response
@return Response | [
"render",
"error",
"pages",
"."
] | 8f296b6358aa93226ce08d6cc54a309f5b0a9820 | https://github.com/TuumPHP/Web/blob/8f296b6358aa93226ce08d6cc54a309f5b0a9820/src/Stack/ViewStack.php#L106-L114 | train |
DoSomething/mobilecommons-php | lib/MobileCommons/Request.php | Request.call | public function call($resource, $params = array(), $method = 'GET')
{
if (!empty($params) && is_array($params)) {
$queryString = http_build_query($params);
}
else {
$queryString = '';
}
$requestUrl = self::API_URL . $resource . ((strtolower($method) == 'g... | php | public function call($resource, $params = array(), $method = 'GET')
{
if (!empty($params) && is_array($params)) {
$queryString = http_build_query($params);
}
else {
$queryString = '';
}
$requestUrl = self::API_URL . $resource . ((strtolower($method) == 'g... | [
"public",
"function",
"call",
"(",
"$",
"resource",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"method",
"=",
"'GET'",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"params",
")",
"&&",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"... | Make an api request
@param string $resource
@param array $params
@param string $method | [
"Make",
"an",
"api",
"request"
] | a820ee196d3166f827c30af69902ffb417674890 | https://github.com/DoSomething/mobilecommons-php/blob/a820ee196d3166f827c30af69902ffb417674890/lib/MobileCommons/Request.php#L103-L153 | train |
DoSomething/mobilecommons-php | lib/MobileCommons/Request.php | Request.webform | public function webform($action, $params, $friends = array()) {
$url = self::WEBFORM_URL . $action;
$header = sprintf("Authorization: Basic %s\r\n", base64_encode($this->getAuthenticationString()));
$header .= "Content-type: application/x-www-form-urlencoded\r\n";
$params = http_build_... | php | public function webform($action, $params, $friends = array()) {
$url = self::WEBFORM_URL . $action;
$header = sprintf("Authorization: Basic %s\r\n", base64_encode($this->getAuthenticationString()));
$header .= "Content-type: application/x-www-form-urlencoded\r\n";
$params = http_build_... | [
"public",
"function",
"webform",
"(",
"$",
"action",
",",
"$",
"params",
",",
"$",
"friends",
"=",
"array",
"(",
")",
")",
"{",
"$",
"url",
"=",
"self",
"::",
"WEBFORM_URL",
".",
"$",
"action",
";",
"$",
"header",
"=",
"sprintf",
"(",
"\"Authorizatio... | Make a request to the Web Form API.
@param string $action
@param array $params
@param array $friends
@return string | [
"Make",
"a",
"request",
"to",
"the",
"Web",
"Form",
"API",
"."
] | a820ee196d3166f827c30af69902ffb417674890 | https://github.com/DoSomething/mobilecommons-php/blob/a820ee196d3166f827c30af69902ffb417674890/lib/MobileCommons/Request.php#L163-L189 | train |
yivi/VerySimpleHtmlWriter | src/VerySimpleHtmlWriter/Tag.php | Tag.addClass | public function addClass( string $class ): Tag
{
if ( ! isset( $this->attributes['class'] ) ) {
$this->attributes['class'] = $class;
} else {
$this->attributes['class'] .= " $class";
}
return $this;
} | php | public function addClass( string $class ): Tag
{
if ( ! isset( $this->attributes['class'] ) ) {
$this->attributes['class'] = $class;
} else {
$this->attributes['class'] .= " $class";
}
return $this;
} | [
"public",
"function",
"addClass",
"(",
"string",
"$",
"class",
")",
":",
"Tag",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"attributes",
"[",
"'class'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"attributes",
"[",
"'class'",
"]",
"=",
"$",
... | Convenience method to add a "class" to a tag.
@param string $class
@return Tag | [
"Convenience",
"method",
"to",
"add",
"a",
"class",
"to",
"a",
"tag",
"."
] | d777e3f046e3fba25790cd10ee42ee226cba0710 | https://github.com/yivi/VerySimpleHtmlWriter/blob/d777e3f046e3fba25790cd10ee42ee226cba0710/src/VerySimpleHtmlWriter/Tag.php#L148-L158 | train |
crazy-cats/framework | src/Utility/Profile.php | Profile.start | static public function start( $name )
{
if ( !ObjectManager::getInstance()->get( Config::class )->getValue( 'profile' ) ) {
return;
}
if ( !isset( self::$profileNames[$name] ) ) {
self::$profileNames[$name] = 0;
}
$realName = $name . '_' . self::$prof... | php | static public function start( $name )
{
if ( !ObjectManager::getInstance()->get( Config::class )->getValue( 'profile' ) ) {
return;
}
if ( !isset( self::$profileNames[$name] ) ) {
self::$profileNames[$name] = 0;
}
$realName = $name . '_' . self::$prof... | [
"static",
"public",
"function",
"start",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"ObjectManager",
"::",
"getInstance",
"(",
")",
"->",
"get",
"(",
"Config",
"::",
"class",
")",
"->",
"getValue",
"(",
"'profile'",
")",
")",
"{",
"return",
";",
"}"... | Set start point for a new profile
@param string $name | [
"Set",
"start",
"point",
"for",
"a",
"new",
"profile"
] | 5ea53d3f97689a301782c0d3d7b924d763420c66 | https://github.com/crazy-cats/framework/blob/5ea53d3f97689a301782c0d3d7b924d763420c66/src/Utility/Profile.php#L108-L124 | train |
crazy-cats/framework | src/Utility/Profile.php | Profile.end | static public function end( $name )
{
if ( !ObjectManager::getInstance()->get( Config::class )->getValue( 'profile' ) ) {
return;
}
if ( $name != self::getName( self::$currentProfileNames[count( self::$currentProfileNames ) - 1] ) ) {
throw new \Exception( sprintf( '... | php | static public function end( $name )
{
if ( !ObjectManager::getInstance()->get( Config::class )->getValue( 'profile' ) ) {
return;
}
if ( $name != self::getName( self::$currentProfileNames[count( self::$currentProfileNames ) - 1] ) ) {
throw new \Exception( sprintf( '... | [
"static",
"public",
"function",
"end",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"ObjectManager",
"::",
"getInstance",
"(",
")",
"->",
"get",
"(",
"Config",
"::",
"class",
")",
"->",
"getValue",
"(",
"'profile'",
")",
")",
"{",
"return",
";",
"}",
... | Set end point for an exist profile
@param string $name | [
"Set",
"end",
"point",
"for",
"an",
"exist",
"profile"
] | 5ea53d3f97689a301782c0d3d7b924d763420c66 | https://github.com/crazy-cats/framework/blob/5ea53d3f97689a301782c0d3d7b924d763420c66/src/Utility/Profile.php#L130-L145 | train |
anime-db/item-folder-filler-bundle | src/Service/FillerFolder.php | FillerFolder.buildMenu | public function buildMenu(ItemInterface $node, ItemEntity $item)
{
if ($item->getPath() && $this->fs->exists($item->getPath())) {
$node->addChild('Fill folder', [
'route' => 'item_folder_filler_fill',
'routeParameters' => [
'id' => $item->getId... | php | public function buildMenu(ItemInterface $node, ItemEntity $item)
{
if ($item->getPath() && $this->fs->exists($item->getPath())) {
$node->addChild('Fill folder', [
'route' => 'item_folder_filler_fill',
'routeParameters' => [
'id' => $item->getId... | [
"public",
"function",
"buildMenu",
"(",
"ItemInterface",
"$",
"node",
",",
"ItemEntity",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"->",
"getPath",
"(",
")",
"&&",
"$",
"this",
"->",
"fs",
"->",
"exists",
"(",
"$",
"item",
"->",
"getPath",
"(",
... | Build menu for plugin
@param \Knp\Menu\ItemInterface $node
@param \AnimeDb\Bundle\CatalogBundle\Entity\Item $item
@return \Knp\Menu\ItemInterface | [
"Build",
"menu",
"for",
"plugin"
] | 9b5d02628fa235171a42123aaa9b54ddab5d94d1 | https://github.com/anime-db/item-folder-filler-bundle/blob/9b5d02628fa235171a42123aaa9b54ddab5d94d1/src/Service/FillerFolder.php#L104-L116 | train |
anime-db/item-folder-filler-bundle | src/Service/FillerFolder.php | FillerFolder.getCover | protected function getCover(ItemEntity $item)
{
$from = $this->root.$item->getDownloadPath().'/'.$item->getCover();
if (!$this->fs->exists($from)) {
return '';
}
// copy cover
$target = $item->getPath().'/';
$filename = self::COVER_FILENAME.'.'.pathinfo($... | php | protected function getCover(ItemEntity $item)
{
$from = $this->root.$item->getDownloadPath().'/'.$item->getCover();
if (!$this->fs->exists($from)) {
return '';
}
// copy cover
$target = $item->getPath().'/';
$filename = self::COVER_FILENAME.'.'.pathinfo($... | [
"protected",
"function",
"getCover",
"(",
"ItemEntity",
"$",
"item",
")",
"{",
"$",
"from",
"=",
"$",
"this",
"->",
"root",
".",
"$",
"item",
"->",
"getDownloadPath",
"(",
")",
".",
"'/'",
".",
"$",
"item",
"->",
"getCover",
"(",
")",
";",
"if",
"(... | Get cover filename
@param \AnimeDb\Bundle\CatalogBundle\Entity\Item $item
@return string | [
"Get",
"cover",
"filename"
] | 9b5d02628fa235171a42123aaa9b54ddab5d94d1 | https://github.com/anime-db/item-folder-filler-bundle/blob/9b5d02628fa235171a42123aaa9b54ddab5d94d1/src/Service/FillerFolder.php#L144-L160 | train |
anime-db/item-folder-filler-bundle | src/Service/FillerFolder.php | FillerFolder.getInfo | protected function getInfo(ItemEntity $item)
{
$filename = self::INFO_FILENAME.'.html';
if (is_file($item->getPath())) {
return dirname($item->getPath()).pathinfo($item->getPath(), PATHINFO_FILENAME).'-'.$filename;
} else {
return $item->getPath().'/'.$filename;
... | php | protected function getInfo(ItemEntity $item)
{
$filename = self::INFO_FILENAME.'.html';
if (is_file($item->getPath())) {
return dirname($item->getPath()).pathinfo($item->getPath(), PATHINFO_FILENAME).'-'.$filename;
} else {
return $item->getPath().'/'.$filename;
... | [
"protected",
"function",
"getInfo",
"(",
"ItemEntity",
"$",
"item",
")",
"{",
"$",
"filename",
"=",
"self",
"::",
"INFO_FILENAME",
".",
"'.html'",
";",
"if",
"(",
"is_file",
"(",
"$",
"item",
"->",
"getPath",
"(",
")",
")",
")",
"{",
"return",
"dirname... | Get info filename
@param \AnimeDb\Bundle\CatalogBundle\Entity\Item $item
@return string | [
"Get",
"info",
"filename"
] | 9b5d02628fa235171a42123aaa9b54ddab5d94d1 | https://github.com/anime-db/item-folder-filler-bundle/blob/9b5d02628fa235171a42123aaa9b54ddab5d94d1/src/Service/FillerFolder.php#L169-L177 | train |
phpgears/event | src/AbstractEventHandler.php | AbstractEventHandler.isEventSupported | private function isEventSupported(Event $event): bool
{
$supported = false;
foreach ($this->getSupportedEventTypes() as $supportedEventType) {
if (\is_a($event, $supportedEventType)) {
$supported = true;
break;
}
}
return $su... | php | private function isEventSupported(Event $event): bool
{
$supported = false;
foreach ($this->getSupportedEventTypes() as $supportedEventType) {
if (\is_a($event, $supportedEventType)) {
$supported = true;
break;
}
}
return $su... | [
"private",
"function",
"isEventSupported",
"(",
"Event",
"$",
"event",
")",
":",
"bool",
"{",
"$",
"supported",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"getSupportedEventTypes",
"(",
")",
"as",
"$",
"supportedEventType",
")",
"{",
"if",
"(",
... | Is event supported.
@param Event $event
@return bool | [
"Is",
"event",
"supported",
"."
] | 9b25301837748a67b3b48cc46ad837c859c4522d | https://github.com/phpgears/event/blob/9b25301837748a67b3b48cc46ad837c859c4522d/src/AbstractEventHandler.php#L45-L58 | train |
ibonly/Potato-ORM | src/Helper/Schema.php | Schema.dateTime | public function dateTime($value, $type = NULL)
{
$apend = "";
switch ($type) {
case 'time':
$apend = 'time';
break;
case 'timestamp':
$apend = 'timestamp';
break;
case 'date':
... | php | public function dateTime($value, $type = NULL)
{
$apend = "";
switch ($type) {
case 'time':
$apend = 'time';
break;
case 'timestamp':
$apend = 'timestamp';
break;
case 'date':
... | [
"public",
"function",
"dateTime",
"(",
"$",
"value",
",",
"$",
"type",
"=",
"NULL",
")",
"{",
"$",
"apend",
"=",
"\"\"",
";",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"'time'",
":",
"$",
"apend",
"=",
"'time'",
";",
"break",
";",
"case",
"'t... | dateTime description]
@param [type] $value [description]
@param [type] $type [description]
@return [type] [description] | [
"dateTime",
"description",
"]"
] | 644962a99e1c0191b732d7729cd466d52c5d8652 | https://github.com/ibonly/Potato-ORM/blob/644962a99e1c0191b732d7729cd466d52c5d8652/src/Helper/Schema.php#L182-L206 | train |
Kris-Kuiper/sFire-Framework | src/Form/Traits/FormTrait.php | FormTrait.value | public function value($value = null) {
if(null !== $value && false === is_string($value) && false === is_numeric($value)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($value)), E_USER_ERROR);
}
... | php | public function value($value = null) {
if(null !== $value && false === is_string($value) && false === is_numeric($value)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($value)), E_USER_ERROR);
}
... | [
"public",
"function",
"value",
"(",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"value",
"&&",
"false",
"===",
"is_string",
"(",
"$",
"value",
")",
"&&",
"false",
"===",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"retur... | Set a new value for input
@param string $value
@return sFire\Form\Traits\FormTrait | [
"Set",
"a",
"new",
"value",
"for",
"input"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Form/Traits/FormTrait.php#L85-L95 | train |
Kris-Kuiper/sFire-Framework | src/Form/Traits/FormTrait.php | FormTrait.name | public function name($name = null) {
if(null !== $name && false === is_string($name) && false === is_numeric($name)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($name)), E_USER_ERROR);
}
$thi... | php | public function name($name = null) {
if(null !== $name && false === is_string($name) && false === is_numeric($name)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($name)), E_USER_ERROR);
}
$thi... | [
"public",
"function",
"name",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"name",
"&&",
"false",
"===",
"is_string",
"(",
"$",
"name",
")",
"&&",
"false",
"===",
"is_numeric",
"(",
"$",
"name",
")",
")",
"{",
"return",
... | Set a new name for input
@param string $name
@return sFire\Form\Traits\FormTrait | [
"Set",
"a",
"new",
"name",
"for",
"input"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Form/Traits/FormTrait.php#L103-L113 | train |
Kris-Kuiper/sFire-Framework | src/Form/Traits/FormTrait.php | FormTrait.attributes | public function attributes($attributes) {
if(false === is_array($attributes)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($attributes)), E_USER_ERROR);
}
$this -> attributes = array_merge($this ... | php | public function attributes($attributes) {
if(false === is_array($attributes)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($attributes)), E_USER_ERROR);
}
$this -> attributes = array_merge($this ... | [
"public",
"function",
"attributes",
"(",
"$",
"attributes",
")",
"{",
"if",
"(",
"false",
"===",
"is_array",
"(",
"$",
"attributes",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type array, \"%s\" given'",
... | Set new attributes for input
@param array $attributes
@return sFire\Form\Traits\FormTrait | [
"Set",
"new",
"attributes",
"for",
"input"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Form/Traits/FormTrait.php#L121-L130 | train |
Kris-Kuiper/sFire-Framework | src/Form/Traits/FormTrait.php | FormTrait.filled | public function filled($filled) {
if(false === is_bool($filled)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($filled)), E_USER_ERROR);
}
$this -> filled = $filled;
return $this;
... | php | public function filled($filled) {
if(false === is_bool($filled)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($filled)), E_USER_ERROR);
}
$this -> filled = $filled;
return $this;
... | [
"public",
"function",
"filled",
"(",
"$",
"filled",
")",
"{",
"if",
"(",
"false",
"===",
"is_bool",
"(",
"$",
"filled",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type boolean, \"%s\" given'",
",",
"__... | Set if input should be automaticly filled or not
@param boolean $filled
@return sFire\Form\Traits\FormTrait | [
"Set",
"if",
"input",
"should",
"be",
"automaticly",
"filled",
"or",
"not"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Form/Traits/FormTrait.php#L138-L147 | train |
Kris-Kuiper/sFire-Framework | src/Form/Traits/FormTrait.php | FormTrait.onerror | public function onerror($attributes) {
if(false === is_array($attributes)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($attributes)), E_USER_ERROR);
}
if(true === isset($this -> attributes['name'])) {
... | php | public function onerror($attributes) {
if(false === is_array($attributes)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($attributes)), E_USER_ERROR);
}
if(true === isset($this -> attributes['name'])) {
... | [
"public",
"function",
"onerror",
"(",
"$",
"attributes",
")",
"{",
"if",
"(",
"false",
"===",
"is_array",
"(",
"$",
"attributes",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type array, \"%s\" given'",
",... | Merges the given attributes with the already existing attributes on error
@param array $attributes
@return sFire\Form\Traits\FormTrait | [
"Merges",
"the",
"given",
"attributes",
"with",
"the",
"already",
"existing",
"attributes",
"on",
"error"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Form/Traits/FormTrait.php#L155-L173 | train |
Kris-Kuiper/sFire-Framework | src/Form/Traits/FormTrait.php | FormTrait.fill | private function fill() {
//Prefill value
if(true === $this -> filled) {
if(true === isset($this -> attributes['name'])) {
if(true === Request :: isPost()) {
$this -> attributes['value'] = Request :: fromPost($this -> attributes['name']);
... | php | private function fill() {
//Prefill value
if(true === $this -> filled) {
if(true === isset($this -> attributes['name'])) {
if(true === Request :: isPost()) {
$this -> attributes['value'] = Request :: fromPost($this -> attributes['name']);
... | [
"private",
"function",
"fill",
"(",
")",
"{",
"//Prefill value\r",
"if",
"(",
"true",
"===",
"$",
"this",
"->",
"filled",
")",
"{",
"if",
"(",
"true",
"===",
"isset",
"(",
"$",
"this",
"->",
"attributes",
"[",
"'name'",
"]",
")",
")",
"{",
"if",
"(... | Sets the value if allowed | [
"Sets",
"the",
"value",
"if",
"allowed"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Form/Traits/FormTrait.php#L179-L191 | train |
bandama-framework/bandama-framework | src/foundation/session/Cookie.php | Cookie.set | public function set($key, $value, $params = array()) {
$expire = 0;
$path = null;
$domain = null;
$secure = false;
$httponly = false;
if (isset($params['expire'])) {
$expire = $params['expire'];
}
if (isset($params['path'])) {
$pat... | php | public function set($key, $value, $params = array()) {
$expire = 0;
$path = null;
$domain = null;
$secure = false;
$httponly = false;
if (isset($params['expire'])) {
$expire = $params['expire'];
}
if (isset($params['path'])) {
$pat... | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"expire",
"=",
"0",
";",
"$",
"path",
"=",
"null",
";",
"$",
"domain",
"=",
"null",
";",
"$",
"secure",
"=",
"false",
... | Set variable to storage
@var string $key Key
@var mixed $value Value
@var array $params Parameters (expire, path, domain, secure, httponly)
@see SessionInterface::set | [
"Set",
"variable",
"to",
"storage"
] | 234ed703baf9e31268941c9d5f6d5e004cc53066 | https://github.com/bandama-framework/bandama-framework/blob/234ed703baf9e31268941c9d5f6d5e004cc53066/src/foundation/session/Cookie.php#L36-L60 | train |
bandama-framework/bandama-framework | src/foundation/session/Cookie.php | Cookie.delete | public function delete($key) {
if (isset($_COOKIE[$key])) {
unset($_COOKIE[$key]);
setcookie($key, '', time() - 3600);
}
} | php | public function delete($key) {
if (isset($_COOKIE[$key])) {
unset($_COOKIE[$key]);
setcookie($key, '', time() - 3600);
}
} | [
"public",
"function",
"delete",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_COOKIE",
"[",
"$",
"key",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"_COOKIE",
"[",
"$",
"key",
"]",
")",
";",
"setcookie",
"(",
"$",
"key",
",",
"''",
",... | Remove variable from storage
@see SessionInterface::delete | [
"Remove",
"variable",
"from",
"storage"
] | 234ed703baf9e31268941c9d5f6d5e004cc53066 | https://github.com/bandama-framework/bandama-framework/blob/234ed703baf9e31268941c9d5f6d5e004cc53066/src/foundation/session/Cookie.php#L67-L72 | train |
CalderaWP/caldera-interop | src/Traits/ProvidesFormsDataSource.php | ProvidesFormsDataSource.getDataSource | public function getDataSource(string $source) : Source
{
switch ($source) {
case 'form':
case 'forms':
return $this
->getDataSources()
->getFormsDataSource();
break;
case 'entry':
case 'entries':
return $this
->getDataSources()
->getEntryDataSource();
break;
case '... | php | public function getDataSource(string $source) : Source
{
switch ($source) {
case 'form':
case 'forms':
return $this
->getDataSources()
->getFormsDataSource();
break;
case 'entry':
case 'entries':
return $this
->getDataSources()
->getEntryDataSource();
break;
case '... | [
"public",
"function",
"getDataSource",
"(",
"string",
"$",
"source",
")",
":",
"Source",
"{",
"switch",
"(",
"$",
"source",
")",
"{",
"case",
"'form'",
":",
"case",
"'forms'",
":",
"return",
"$",
"this",
"->",
"getDataSources",
"(",
")",
"->",
"getFormsD... | Get a form, form entry or form entry value data source.
@param string $source
@return Source | [
"Get",
"a",
"form",
"form",
"entry",
"or",
"form",
"entry",
"value",
"data",
"source",
"."
] | d25c4bc930200b314fbd42d084080b5d85261c94 | https://github.com/CalderaWP/caldera-interop/blob/d25c4bc930200b314fbd42d084080b5d85261c94/src/Traits/ProvidesFormsDataSource.php#L24-L45 | train |
OpenConext-Attic/OpenConext-engineblock-metadata | src/Utils.php | Utils.instantiate | public static function instantiate($className, array $namedArguments)
{
$reflectionClass = new ReflectionClass($className);
$parameters = $reflectionClass->getConstructor()->getParameters();
$positionalDefaultFilledArguments = array();
foreach ($parameters as $parameter) {
... | php | public static function instantiate($className, array $namedArguments)
{
$reflectionClass = new ReflectionClass($className);
$parameters = $reflectionClass->getConstructor()->getParameters();
$positionalDefaultFilledArguments = array();
foreach ($parameters as $parameter) {
... | [
"public",
"static",
"function",
"instantiate",
"(",
"$",
"className",
",",
"array",
"$",
"namedArguments",
")",
"{",
"$",
"reflectionClass",
"=",
"new",
"ReflectionClass",
"(",
"$",
"className",
")",
";",
"$",
"parameters",
"=",
"$",
"reflectionClass",
"->",
... | Instantiate a class with named arguments.
An answer to a problem that should not exist (legacy large Entities).
@param string $className
@param array $namedArguments
@return object | [
"Instantiate",
"a",
"class",
"with",
"named",
"arguments",
"."
] | 236e2f52ef9cf28e71404544a1c4388f63ee535d | https://github.com/OpenConext-Attic/OpenConext-engineblock-metadata/blob/236e2f52ef9cf28e71404544a1c4388f63ee535d/src/Utils.php#L37-L55 | train |
ScaraMVC/Framework | src/Scara/Support/ServiceProvider.php | ServiceProvider.create | public function create($name, $callback)
{
$this->_name = $name;
$this->_class = $callback();
$GLOBALS['providers'][$this->_name] = $this->_class;
} | php | public function create($name, $callback)
{
$this->_name = $name;
$this->_class = $callback();
$GLOBALS['providers'][$this->_name] = $this->_class;
} | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"callback",
")",
"{",
"$",
"this",
"->",
"_name",
"=",
"$",
"name",
";",
"$",
"this",
"->",
"_class",
"=",
"$",
"callback",
"(",
")",
";",
"$",
"GLOBALS",
"[",
"'providers'",
"]",
"[",
"... | Creates the provider and registers the provider to the global area.
@param string $name - The name of the service provider
@param \Closure $callback - The callback for calling the provider's given class
@return void | [
"Creates",
"the",
"provider",
"and",
"registers",
"the",
"provider",
"to",
"the",
"global",
"area",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Support/ServiceProvider.php#L39-L45 | train |
faizalpribadi/Cache | Driver/OpCache/Apc.php | Apc.set | public function set($id, $data, $lifeTime = 0)
{
if (!function_exists('apc_store')) {
throw new ApcCacheException('function [apc_store] not found !');
}
return apc_store($id, $data, $lifeTime);
} | php | public function set($id, $data, $lifeTime = 0)
{
if (!function_exists('apc_store')) {
throw new ApcCacheException('function [apc_store] not found !');
}
return apc_store($id, $data, $lifeTime);
} | [
"public",
"function",
"set",
"(",
"$",
"id",
",",
"$",
"data",
",",
"$",
"lifeTime",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"function_exists",
"(",
"'apc_store'",
")",
")",
"{",
"throw",
"new",
"ApcCacheException",
"(",
"'function [apc_store] not found !'",
"... | Set and store cache key with data content in cache key
@param string $id
@param string $data
@param int $lifeTime
@return array|bool
@throws \Mozart\Library\Cache\Exception\ApcCacheException | [
"Set",
"and",
"store",
"cache",
"key",
"with",
"data",
"content",
"in",
"cache",
"key"
] | e62a4d71739e542ca6e7bac77f5cc522accef8cb | https://github.com/faizalpribadi/Cache/blob/e62a4d71739e542ca6e7bac77f5cc522accef8cb/Driver/OpCache/Apc.php#L47-L54 | train |
jenskooij/cloudcontrol | src/storage/storage/AbstractStorage.php | AbstractStorage.validateFilename | protected function validateFilename($filename, $path)
{
$fileParts = explode('.', $filename);
if (count($fileParts) > 1) {
$extension = end($fileParts);
array_pop($fileParts);
$fileNameWithoutExtension = implode('-', $fileParts);
$fileNameWithoutExtens... | php | protected function validateFilename($filename, $path)
{
$fileParts = explode('.', $filename);
if (count($fileParts) > 1) {
$extension = end($fileParts);
array_pop($fileParts);
$fileNameWithoutExtension = implode('-', $fileParts);
$fileNameWithoutExtens... | [
"protected",
"function",
"validateFilename",
"(",
"$",
"filename",
",",
"$",
"path",
")",
"{",
"$",
"fileParts",
"=",
"explode",
"(",
"'.'",
",",
"$",
"filename",
")",
";",
"if",
"(",
"count",
"(",
"$",
"fileParts",
")",
">",
"1",
")",
"{",
"$",
"e... | Converts filename to lowercase, remove non-ascii chars
And adds "-copy" if the file already exists
@param $filename
@param $path
@return string | [
"Converts",
"filename",
"to",
"lowercase",
"remove",
"non",
"-",
"ascii",
"chars",
"And",
"adds",
"-",
"copy",
"if",
"the",
"file",
"already",
"exists"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/AbstractStorage.php#L33-L62 | train |
zarathustra323/modlr-data | src/Zarathustra/ModlrData/Resource/Relationship.php | Relationship.pushData | public function pushData(EntityInterface $entity)
{
if ($this->isMany()) {
$this->data[] = $entity;
return $this;
}
$this->data = $entity;
return $this;
} | php | public function pushData(EntityInterface $entity)
{
if ($this->isMany()) {
$this->data[] = $entity;
return $this;
}
$this->data = $entity;
return $this;
} | [
"public",
"function",
"pushData",
"(",
"EntityInterface",
"$",
"entity",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isMany",
"(",
")",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"]",
"=",
"$",
"entity",
";",
"return",
"$",
"this",
";",
"}",
"$",
"th... | Applys the relationship data.
@param EntityInterface $entity
@return self | [
"Applys",
"the",
"relationship",
"data",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Resource/Relationship.php#L94-L102 | train |
Kris-Kuiper/sFire-Framework | src/Template/Template.php | Template.render | public function render() {
$parse = true;
if($this -> getFile() -> exists()) {
if($this -> getFile() -> entity() -> getModificationTime() >= @filemtime($this -> viewmodel -> getFile())) {
$parse = false;
}
}
if(true === $parse) {
$this -> parse();
$this -> write();
}
r... | php | public function render() {
$parse = true;
if($this -> getFile() -> exists()) {
if($this -> getFile() -> entity() -> getModificationTime() >= @filemtime($this -> viewmodel -> getFile())) {
$parse = false;
}
}
if(true === $parse) {
$this -> parse();
$this -> write();
}
r... | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"parse",
"=",
"true",
";",
"if",
"(",
"$",
"this",
"->",
"getFile",
"(",
")",
"->",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getFile",
"(",
")",
"->",
"entity",
"(",
")",
... | Renders the view model
@return sFire\Template\Template | [
"Renders",
"the",
"view",
"model"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Template/Template.php#L91-L109 | train |
Kris-Kuiper/sFire-Framework | src/Template/Template.php | Template.getFileName | public function getFileName() {
if(null === $this -> filename && null !== $this -> viewmodel) {
$this -> filename = md5($this -> viewmodel -> getFile());
}
return $this -> filename;
} | php | public function getFileName() {
if(null === $this -> filename && null !== $this -> viewmodel) {
$this -> filename = md5($this -> viewmodel -> getFile());
}
return $this -> filename;
} | [
"public",
"function",
"getFileName",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"filename",
"&&",
"null",
"!==",
"$",
"this",
"->",
"viewmodel",
")",
"{",
"$",
"this",
"->",
"filename",
"=",
"md5",
"(",
"$",
"this",
"->",
"viewmodel"... | Generates filename and returns it
@return string | [
"Generates",
"filename",
"and",
"returns",
"it"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Template/Template.php#L116-L123 | train |
Kris-Kuiper/sFire-Framework | src/Template/Template.php | Template.getFile | public function getFile() {
if(null === $this -> file) {
$file = $this -> getFileName();
$this -> file = new File($this -> directory . $file);
}
return $this -> file;
} | php | public function getFile() {
if(null === $this -> file) {
$file = $this -> getFileName();
$this -> file = new File($this -> directory . $file);
}
return $this -> file;
} | [
"public",
"function",
"getFile",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"file",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"getFileName",
"(",
")",
";",
"$",
"this",
"->",
"file",
"=",
"new",
"File",
"(",
"$",
"this",
"... | Create file object from current directory and file and returns it
@return sFire\System\File | [
"Create",
"file",
"object",
"from",
"current",
"directory",
"and",
"file",
"and",
"returns",
"it"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Template/Template.php#L130-L139 | train |
Kris-Kuiper/sFire-Framework | src/Template/Template.php | Template.parse | private function parse() {
$lines = file($this -> viewmodel -> getFile());
$this -> code = '';
$classes = [
'MatchEcho',
'MatchForeach',
'MatchEndForeach',
'MatchFor',
'MatchEndFor',
'MatchIf',
'MatchIsset',
'MatchNotIsset',
'MatchEmpty',
'MatchNotEmpty',
'Ma... | php | private function parse() {
$lines = file($this -> viewmodel -> getFile());
$this -> code = '';
$classes = [
'MatchEcho',
'MatchForeach',
'MatchEndForeach',
'MatchFor',
'MatchEndFor',
'MatchIf',
'MatchIsset',
'MatchNotIsset',
'MatchEmpty',
'MatchNotEmpty',
'Ma... | [
"private",
"function",
"parse",
"(",
")",
"{",
"$",
"lines",
"=",
"file",
"(",
"$",
"this",
"->",
"viewmodel",
"->",
"getFile",
"(",
")",
")",
";",
"$",
"this",
"->",
"code",
"=",
"''",
";",
"$",
"classes",
"=",
"[",
"'MatchEcho'",
",",
"'MatchFore... | Convert template file to string
@return string | [
"Convert",
"template",
"file",
"to",
"string"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Template/Template.php#L146-L205 | train |
eureka-framework/component-template | src/Template/Template.php | Template.partial | public static function partial($template, array $vars = array())
{
$template = new Template($template, null, $vars);
return trim($template->render());
} | php | public static function partial($template, array $vars = array())
{
$template = new Template($template, null, $vars);
return trim($template->render());
} | [
"public",
"static",
"function",
"partial",
"(",
"$",
"template",
",",
"array",
"$",
"vars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"template",
"=",
"new",
"Template",
"(",
"$",
"template",
",",
"null",
",",
"$",
"vars",
")",
";",
"return",
"trim",
... | Include partial.
@param string $template
@param array $vars
@return string Content
@throws \Exception | [
"Include",
"partial",
"."
] | 42e9b3954b79892ba340ba7ca909f03ee99c36fe | https://github.com/eureka-framework/component-template/blob/42e9b3954b79892ba340ba7ca909f03ee99c36fe/src/Template/Template.php#L179-L184 | train |
eureka-framework/component-template | src/Template/Template.php | Template.setPathCompiled | public static function setPathCompiled($pathCompiled = '/tmp/Eureka/tpl')
{
$pathCompiled = rtrim($pathCompiled, '/') . '/';
if (!file_exists($pathCompiled) || !is_dir($pathCompiled)) {
if (!mkdir($pathCompiled, 0755, true)) {
throw new \Exception('Cannot create directo... | php | public static function setPathCompiled($pathCompiled = '/tmp/Eureka/tpl')
{
$pathCompiled = rtrim($pathCompiled, '/') . '/';
if (!file_exists($pathCompiled) || !is_dir($pathCompiled)) {
if (!mkdir($pathCompiled, 0755, true)) {
throw new \Exception('Cannot create directo... | [
"public",
"static",
"function",
"setPathCompiled",
"(",
"$",
"pathCompiled",
"=",
"'/tmp/Eureka/tpl'",
")",
"{",
"$",
"pathCompiled",
"=",
"rtrim",
"(",
"$",
"pathCompiled",
",",
"'/'",
")",
".",
"'/'",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"pathCo... | Set path for compiled templates.
@param string $pathCompiled
@return void
@throws \Exception | [
"Set",
"path",
"for",
"compiled",
"templates",
"."
] | 42e9b3954b79892ba340ba7ca909f03ee99c36fe | https://github.com/eureka-framework/component-template/blob/42e9b3954b79892ba340ba7ca909f03ee99c36fe/src/Template/Template.php#L193-L204 | train |
mcaskill/tokenlist | src/TokenList/DOMTokenList.php | DOMTokenList.__update | protected function __update()
{
/** Rebase array indices */
parent::__update();
if ( $this->count() && $this->attribute instanceof DOMAttr ) {
$this->attribute->value = (string) $this;
}
} | php | protected function __update()
{
/** Rebase array indices */
parent::__update();
if ( $this->count() && $this->attribute instanceof DOMAttr ) {
$this->attribute->value = (string) $this;
}
} | [
"protected",
"function",
"__update",
"(",
")",
"{",
"/** Rebase array indices */",
"parent",
"::",
"__update",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"count",
"(",
")",
"&&",
"$",
"this",
"->",
"attribute",
"instanceof",
"DOMAttr",
")",
"{",
"$",
"... | Updates the HTML attribute that DOMTokenList represents
Will only update the value if self::$attribute is a DOMAttr. | [
"Updates",
"the",
"HTML",
"attribute",
"that",
"DOMTokenList",
"represents"
] | 5266dc37157179c86f475a7a9301887d470b3664 | https://github.com/mcaskill/tokenlist/blob/5266dc37157179c86f475a7a9301887d470b3664/src/TokenList/DOMTokenList.php#L186-L194 | train |
mcaskill/tokenlist | src/TokenList/DOMTokenList.php | DOMTokenList.__toAttribute | public function __toAttribute()
{
if ( $this->count() ) {
$attr = null;
if ( is_string( $this->attribute ) ) {
$attr = $this->attribute;
}
elseif ( $this->attribute instanceof DOMAttr ) {
$attr = $this->attribute->name;
}
if ( $attr ) {
$values = htmlspecialchars((string) $this, ENT_Q... | php | public function __toAttribute()
{
if ( $this->count() ) {
$attr = null;
if ( is_string( $this->attribute ) ) {
$attr = $this->attribute;
}
elseif ( $this->attribute instanceof DOMAttr ) {
$attr = $this->attribute->name;
}
if ( $attr ) {
$values = htmlspecialchars((string) $this, ENT_Q... | [
"public",
"function",
"__toAttribute",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"count",
"(",
")",
")",
"{",
"$",
"attr",
"=",
"null",
";",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",
"attribute",
")",
")",
"{",
"$",
"attr",
"=",
"$",
"... | Retrieves the HTML attribute and concatenated list of the tokens.
@return string Stringified token list, wrapped in an HTML attribute. | [
"Retrieves",
"the",
"HTML",
"attribute",
"and",
"concatenated",
"list",
"of",
"the",
"tokens",
"."
] | 5266dc37157179c86f475a7a9301887d470b3664 | https://github.com/mcaskill/tokenlist/blob/5266dc37157179c86f475a7a9301887d470b3664/src/TokenList/DOMTokenList.php#L201-L220 | train |
Wedeto/DB | src/Query/Select.php | Select.toSQL | public function toSQL(Parameters $params, bool $inner_clause)
{
$drv = $params->getDriver();
// First get the source tables: FROM and JOIN clauses
$source = array();
if ($table = $this->getTable())
$source[] = "FROM " . $drv->toSQL($params, $table);
foreach ($th... | php | public function toSQL(Parameters $params, bool $inner_clause)
{
$drv = $params->getDriver();
// First get the source tables: FROM and JOIN clauses
$source = array();
if ($table = $this->getTable())
$source[] = "FROM " . $drv->toSQL($params, $table);
foreach ($th... | [
"public",
"function",
"toSQL",
"(",
"Parameters",
"$",
"params",
",",
"bool",
"$",
"inner_clause",
")",
"{",
"$",
"drv",
"=",
"$",
"params",
"->",
"getDriver",
"(",
")",
";",
"// First get the source tables: FROM and JOIN clauses",
"$",
"source",
"=",
"array",
... | Write a select query as SQL query syntax
@param Parameters $params The query parameters: tables and placeholder values
@param bool $inner_clause Unused
@return string The generated SQL | [
"Write",
"a",
"select",
"query",
"as",
"SQL",
"query",
"syntax"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/Select.php#L206-L253 | train |
modulusphp/http | Middleware/AuthenticateWithBasicAuth.php | AuthenticateWithBasicAuth.hasBasicAuth | protected function hasBasicAuth($request) : bool
{
if ($request->headers->has('Authorization') && starts_with($request->header('Authorization'), 'Basic ')) {
return true;
}
return false;
} | php | protected function hasBasicAuth($request) : bool
{
if ($request->headers->has('Authorization') && starts_with($request->header('Authorization'), 'Basic ')) {
return true;
}
return false;
} | [
"protected",
"function",
"hasBasicAuth",
"(",
"$",
"request",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"request",
"->",
"headers",
"->",
"has",
"(",
"'Authorization'",
")",
"&&",
"starts_with",
"(",
"$",
"request",
"->",
"header",
"(",
"'Authorization'",
")"... | Check if request has Basic Authentication header
@param \Modulus\Http\Request $request
@return bool | [
"Check",
"if",
"request",
"has",
"Basic",
"Authentication",
"header"
] | fc5c0f2b582a04de1685578d3fb790686a0a240c | https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Middleware/AuthenticateWithBasicAuth.php#L94-L101 | train |
chalasr/RCHCapistranoBundle | Util/CanGenerateTrait.php | CanGenerateTrait.generate | public function generate(GeneratorInterface $generator)
{
$callback = function () use ($generator) {
$handler = Handler::create($generator);
$handler->generate();
};
return $callback();
} | php | public function generate(GeneratorInterface $generator)
{
$callback = function () use ($generator) {
$handler = Handler::create($generator);
$handler->generate();
};
return $callback();
} | [
"public",
"function",
"generate",
"(",
"GeneratorInterface",
"$",
"generator",
")",
"{",
"$",
"callback",
"=",
"function",
"(",
")",
"use",
"(",
"$",
"generator",
")",
"{",
"$",
"handler",
"=",
"Handler",
"::",
"create",
"(",
"$",
"generator",
")",
";",
... | Generates a document from given configuration using given generator.
@param GeneratorInterface $generator Instance of AbstractGeneratord
@return callable | [
"Generates",
"a",
"document",
"from",
"given",
"configuration",
"using",
"given",
"generator",
"."
] | c4a4cbaa2bc05f33bf431fd3afe6cac39947640e | https://github.com/chalasr/RCHCapistranoBundle/blob/c4a4cbaa2bc05f33bf431fd3afe6cac39947640e/Util/CanGenerateTrait.php#L32-L40 | train |
chalasr/RCHCapistranoBundle | Util/CanGenerateTrait.php | CanGenerateTrait.parseYamlStaging | public function parseYamlStaging($yamlFile)
{
$container = !(property_exists(get_called_class(), 'container')) ? $this->getContainer() : $this->container;
$capitalizer = $container->get('rch_capistrano.capitalizer');
$params = Yaml::parse(file_get_contents($yamlFile));
return $capit... | php | public function parseYamlStaging($yamlFile)
{
$container = !(property_exists(get_called_class(), 'container')) ? $this->getContainer() : $this->container;
$capitalizer = $container->get('rch_capistrano.capitalizer');
$params = Yaml::parse(file_get_contents($yamlFile));
return $capit... | [
"public",
"function",
"parseYamlStaging",
"(",
"$",
"yamlFile",
")",
"{",
"$",
"container",
"=",
"!",
"(",
"property_exists",
"(",
"get_called_class",
"(",
")",
",",
"'container'",
")",
")",
"?",
"$",
"this",
"->",
"getContainer",
"(",
")",
":",
"$",
"th... | Read staging parameters from YAML staging file.
@param string $yamlFile The YAML staging filename
@return array | [
"Read",
"staging",
"parameters",
"from",
"YAML",
"staging",
"file",
"."
] | c4a4cbaa2bc05f33bf431fd3afe6cac39947640e | https://github.com/chalasr/RCHCapistranoBundle/blob/c4a4cbaa2bc05f33bf431fd3afe6cac39947640e/Util/CanGenerateTrait.php#L61-L68 | train |
ZendExperts/phpids | lib/IDS/Log/Database.php | IDS_Log_Database.execute | public function execute(IDS_Report $data)
{
if (!isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1);
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) {
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']... | php | public function execute(IDS_Report $data)
{
if (!isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1);
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) {
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']... | [
"public",
"function",
"execute",
"(",
"IDS_Report",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
")",
")",
"{",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
"=",
"substr",
"(",
"$",
"_SERVER",
"[",
"'P... | Stores given data into the database
@param object $data IDS_Report instance
@throws Exception if db error occurred
@return boolean | [
"Stores",
"given",
"data",
"into",
"the",
"database"
] | f30df04eea47b94d056e2ae9ec8fea1c626f1c03 | https://github.com/ZendExperts/phpids/blob/f30df04eea47b94d056e2ae9ec8fea1c626f1c03/lib/IDS/Log/Database.php#L253-L291 | train |
jacksleight/coast | library/Path.php | Path.isWithin | public function isWithin(\Coast\Path $parent)
{
$path = $this->_name;
$parts = \explode(PATH_SEPARATOR, (string) $parent);
foreach ($parts as $part) {
if (\preg_match('/^' . \preg_quote($part, '/') . '/', $path)) {
return true;
}
}
... | php | public function isWithin(\Coast\Path $parent)
{
$path = $this->_name;
$parts = \explode(PATH_SEPARATOR, (string) $parent);
foreach ($parts as $part) {
if (\preg_match('/^' . \preg_quote($part, '/') . '/', $path)) {
return true;
}
}
... | [
"public",
"function",
"isWithin",
"(",
"\\",
"Coast",
"\\",
"Path",
"$",
"parent",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"_name",
";",
"$",
"parts",
"=",
"\\",
"explode",
"(",
"PATH_SEPARATOR",
",",
"(",
"string",
")",
"$",
"parent",
")",
... | Check if path is within another
@param Coast\Path $target path to check against.
@return bool | [
"Check",
"if",
"path",
"is",
"within",
"another"
] | cd6cd41e8304adce41f59f799d4183adcaf666f9 | https://github.com/jacksleight/coast/blob/cd6cd41e8304adce41f59f799d4183adcaf666f9/library/Path.php#L167-L177 | train |
jacksleight/coast | library/Path.php | Path.toAbsolute | public function toAbsolute(\Coast\Path $base)
{
if (!$this->isRelative() || !$base->isAbsolute()) {
throw new \Exception("Path '{$this}' is not relative or base path '{$base}' is not absolute");
}
$source = explode('/', (string) $base);
$target = explode('/', $this->_nam... | php | public function toAbsolute(\Coast\Path $base)
{
if (!$this->isRelative() || !$base->isAbsolute()) {
throw new \Exception("Path '{$this}' is not relative or base path '{$base}' is not absolute");
}
$source = explode('/', (string) $base);
$target = explode('/', $this->_nam... | [
"public",
"function",
"toAbsolute",
"(",
"\\",
"Coast",
"\\",
"Path",
"$",
"base",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isRelative",
"(",
")",
"||",
"!",
"$",
"base",
"->",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception... | Get absolute path from relative path.
@param Coast\Path $base base absolute path.
@return Coast\Path | [
"Get",
"absolute",
"path",
"from",
"relative",
"path",
"."
] | cd6cd41e8304adce41f59f799d4183adcaf666f9 | https://github.com/jacksleight/coast/blob/cd6cd41e8304adce41f59f799d4183adcaf666f9/library/Path.php#L184-L206 | train |
jacksleight/coast | library/Path.php | Path.toRelative | public function toRelative(\Coast\Path $base)
{
if (!$this->isAbsolute() || !$base->isAbsolute()) {
throw new \Exception("Source path '{$this}' is not absolute or base path '{$base}' is not absolute");
}
$source = explode('/', (string) $base);
$target = explode('... | php | public function toRelative(\Coast\Path $base)
{
if (!$this->isAbsolute() || !$base->isAbsolute()) {
throw new \Exception("Source path '{$this}' is not absolute or base path '{$base}' is not absolute");
}
$source = explode('/', (string) $base);
$target = explode('... | [
"public",
"function",
"toRelative",
"(",
"\\",
"Coast",
"\\",
"Path",
"$",
"base",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isAbsolute",
"(",
")",
"||",
"!",
"$",
"base",
"->",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception... | Get relative path from absolute path.
@param Coast\Path $base Base absolute path.
@return Coast\Path | [
"Get",
"relative",
"path",
"from",
"absolute",
"path",
"."
] | cd6cd41e8304adce41f59f799d4183adcaf666f9 | https://github.com/jacksleight/coast/blob/cd6cd41e8304adce41f59f799d4183adcaf666f9/library/Path.php#L213-L235 | train |
jacksleight/coast | library/Path.php | Path.toReal | public function toReal()
{
if (!$this->isAbsolute()) {
throw new \Exception("Path '{$this}' is not absolute");
}
$target = explode('/', $this->_name);
$name = [];
foreach ($target as $part) {
if ($part == '..') {
array_pop($na... | php | public function toReal()
{
if (!$this->isAbsolute()) {
throw new \Exception("Path '{$this}' is not absolute");
}
$target = explode('/', $this->_name);
$name = [];
foreach ($target as $part) {
if ($part == '..') {
array_pop($na... | [
"public",
"function",
"toReal",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Path '{$this}' is not absolute\"",
")",
";",
"}",
"$",
"target",
"=",
"explode",
"(",
"'/'",
... | Reduce absolute path with relative parts to real path.
@return Coast\Path | [
"Reduce",
"absolute",
"path",
"with",
"relative",
"parts",
"to",
"real",
"path",
"."
] | cd6cd41e8304adce41f59f799d4183adcaf666f9 | https://github.com/jacksleight/coast/blob/cd6cd41e8304adce41f59f799d4183adcaf666f9/library/Path.php#L241-L261 | train |
hiqdev/minii-widgets | src/BaseListView.php | BaseListView.init | public function init()
{
if ($this->dataProvider === null) {
throw new InvalidConfigException('The "dataProvider" property must be set.');
}
if ($this->emptyText === null) {
$this->emptyText = Yii::t('yii', 'No results found.');
}
if (!isset($this->opt... | php | public function init()
{
if ($this->dataProvider === null) {
throw new InvalidConfigException('The "dataProvider" property must be set.');
}
if ($this->emptyText === null) {
$this->emptyText = Yii::t('yii', 'No results found.');
}
if (!isset($this->opt... | [
"public",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dataProvider",
"===",
"null",
")",
"{",
"throw",
"new",
"InvalidConfigException",
"(",
"'The \"dataProvider\" property must be set.'",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"e... | Initializes the view. | [
"Initializes",
"the",
"view",
"."
] | b8bc54a3645e9e45c228e3ec81b11ff4775385c3 | https://github.com/hiqdev/minii-widgets/blob/b8bc54a3645e9e45c228e3ec81b11ff4775385c3/src/BaseListView.php#L106-L117 | train |
PenoaksDev/Milky-Framework | src/Milky/Database/Connectors/SqlServerConnector.php | SqlServerConnector.buildConnectString | protected function buildConnectString($driver, array $arguments)
{
$options = array_map(function ($key) use ($arguments) {
return sprintf('%s=%s', $key, $arguments[$key]);
}, array_keys($arguments));
return $driver.':'.implode(';', $options);
} | php | protected function buildConnectString($driver, array $arguments)
{
$options = array_map(function ($key) use ($arguments) {
return sprintf('%s=%s', $key, $arguments[$key]);
}, array_keys($arguments));
return $driver.':'.implode(';', $options);
} | [
"protected",
"function",
"buildConnectString",
"(",
"$",
"driver",
",",
"array",
"$",
"arguments",
")",
"{",
"$",
"options",
"=",
"array_map",
"(",
"function",
"(",
"$",
"key",
")",
"use",
"(",
"$",
"arguments",
")",
"{",
"return",
"sprintf",
"(",
"'%s=%... | Build a connection string from the given arguments.
@param string $driver
@param array $arguments
@return string | [
"Build",
"a",
"connection",
"string",
"from",
"the",
"given",
"arguments",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Connectors/SqlServerConnector.php#L138-L145 | train |
Becklyn/Gluggi | src/Model/ElementTypesModel.php | ElementTypesModel.getAllElements | public function getAllElements ($elementType)
{
$iterator = new \DirectoryIterator($this->getUserSubDirectory("{$elementType}s"));
$allElements = [];
/** @var \SplFileInfo $file */
foreach ($iterator as $file)
{
if ($file->isDir() || ("twig" !== $file->getExtensi... | php | public function getAllElements ($elementType)
{
$iterator = new \DirectoryIterator($this->getUserSubDirectory("{$elementType}s"));
$allElements = [];
/** @var \SplFileInfo $file */
foreach ($iterator as $file)
{
if ($file->isDir() || ("twig" !== $file->getExtensi... | [
"public",
"function",
"getAllElements",
"(",
"$",
"elementType",
")",
"{",
"$",
"iterator",
"=",
"new",
"\\",
"DirectoryIterator",
"(",
"$",
"this",
"->",
"getUserSubDirectory",
"(",
"\"{$elementType}s\"",
")",
")",
";",
"$",
"allElements",
"=",
"[",
"]",
";... | Returns a list of all elements
@param string $elementType
@return Element[] | [
"Returns",
"a",
"list",
"of",
"all",
"elements"
] | 837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786 | https://github.com/Becklyn/Gluggi/blob/837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786/src/Model/ElementTypesModel.php#L66-L85 | train |
Becklyn/Gluggi | src/Model/ElementTypesModel.php | ElementTypesModel.getListedElements | public function getListedElements ($elementType)
{
$allElements = $this->getAllElements($elementType);
usort($allElements,
function (Element $element1, Element $element2)
{
return strnatcasecmp($element1->getKey(), $element2->getKey());
}
)... | php | public function getListedElements ($elementType)
{
$allElements = $this->getAllElements($elementType);
usort($allElements,
function (Element $element1, Element $element2)
{
return strnatcasecmp($element1->getKey(), $element2->getKey());
}
)... | [
"public",
"function",
"getListedElements",
"(",
"$",
"elementType",
")",
"{",
"$",
"allElements",
"=",
"$",
"this",
"->",
"getAllElements",
"(",
"$",
"elementType",
")",
";",
"usort",
"(",
"$",
"allElements",
",",
"function",
"(",
"Element",
"$",
"element1",... | Returns the listed elements
@param string $elementType
@return Element[] | [
"Returns",
"the",
"listed",
"elements"
] | 837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786 | https://github.com/Becklyn/Gluggi/blob/837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786/src/Model/ElementTypesModel.php#L96-L113 | train |
Becklyn/Gluggi | src/Model/ElementTypesModel.php | ElementTypesModel.getElement | public function getElement ($key, $elementType)
{
$elements = $this->getAllElements($elementType);
return array_key_exists($key, $elements)
? $elements[$key]
: null;
} | php | public function getElement ($key, $elementType)
{
$elements = $this->getAllElements($elementType);
return array_key_exists($key, $elements)
? $elements[$key]
: null;
} | [
"public",
"function",
"getElement",
"(",
"$",
"key",
",",
"$",
"elementType",
")",
"{",
"$",
"elements",
"=",
"$",
"this",
"->",
"getAllElements",
"(",
"$",
"elementType",
")",
";",
"return",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"elements",
")"... | Returns the preview by key
@param string $key
@param string $elementType
@return Element|null | [
"Returns",
"the",
"preview",
"by",
"key"
] | 837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786 | https://github.com/Becklyn/Gluggi/blob/837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786/src/Model/ElementTypesModel.php#L125-L132 | train |
Becklyn/Gluggi | src/Model/ElementTypesModel.php | ElementTypesModel.isFullPageElementType | public function isFullPageElementType ($key)
{
return array_key_exists($key, $this->elementTypes)
? $this->elementTypes[$key]["isFullPage"]
: null;
} | php | public function isFullPageElementType ($key)
{
return array_key_exists($key, $this->elementTypes)
? $this->elementTypes[$key]["isFullPage"]
: null;
} | [
"public",
"function",
"isFullPageElementType",
"(",
"$",
"key",
")",
"{",
"return",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"elementTypes",
")",
"?",
"$",
"this",
"->",
"elementTypes",
"[",
"$",
"key",
"]",
"[",
"\"isFullPage\"",
"]",
... | Returns whether the given element type is full page
@param string $key
@return bool | [
"Returns",
"whether",
"the",
"given",
"element",
"type",
"is",
"full",
"page"
] | 837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786 | https://github.com/Becklyn/Gluggi/blob/837e7ee8d34f5b16a7f1ef53ca64b1ea8722b786/src/Model/ElementTypesModel.php#L169-L174 | train |
Kris-Kuiper/sFire-Framework | src/Routing/Router.php | Router.__callstatic | public static function __callstatic($method, $arguments) {
$route = new Route();
if(false === is_callable([$route, $method])) {
return trigger_error(sprintf('Call to undefined method %s::%s', __CLASS__, $method), E_USER_ERROR);
}
$route = call_user_func_array([$route, $method], $argume... | php | public static function __callstatic($method, $arguments) {
$route = new Route();
if(false === is_callable([$route, $method])) {
return trigger_error(sprintf('Call to undefined method %s::%s', __CLASS__, $method), E_USER_ERROR);
}
$route = call_user_func_array([$route, $method], $argume... | [
"public",
"static",
"function",
"__callstatic",
"(",
"$",
"method",
",",
"$",
"arguments",
")",
"{",
"$",
"route",
"=",
"new",
"Route",
"(",
")",
";",
"if",
"(",
"false",
"===",
"is_callable",
"(",
"[",
"$",
"route",
",",
"$",
"method",
"]",
")",
"... | Creates a new route and calls the dynamic given method if exists
@param string $method
@param array $arguments
@return sFire\Routing\Extend\Route | [
"Creates",
"a",
"new",
"route",
"and",
"calls",
"the",
"dynamic",
"given",
"method",
"if",
"exists"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Routing/Router.php#L128-L139 | train |
Kris-Kuiper/sFire-Framework | src/Routing/Router.php | Router.setUrl | public static function setUrl($url) {
if(false === is_string($url) && false === $url instanceof URLParser) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or instance of sFire\\Utils\\URLParser, "%s" given', __METHOD__, gettype($url)), E_USER_ERROR);
}
if(true === i... | php | public static function setUrl($url) {
if(false === is_string($url) && false === $url instanceof URLParser) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or instance of sFire\\Utils\\URLParser, "%s" given', __METHOD__, gettype($url)), E_USER_ERROR);
}
if(true === i... | [
"public",
"static",
"function",
"setUrl",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"url",
")",
"&&",
"false",
"===",
"$",
"url",
"instanceof",
"URLParser",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'... | Set the current URL
@param string|sFire\Utils\URLParser $url
@return sFire\Utils\URLParser | [
"Set",
"the",
"current",
"URL"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Routing/Router.php#L156-L168 | train |
Kris-Kuiper/sFire-Framework | src/Routing/Router.php | Router.routeExists | public static function routeExists($identifier, $domain = null) {
if(false === is_string($identifier)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($identifier)), E_USER_ERROR);
}
if(null !== $domain && false === is_s... | php | public static function routeExists($identifier, $domain = null) {
if(false === is_string($identifier)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($identifier)), E_USER_ERROR);
}
if(null !== $domain && false === is_s... | [
"public",
"static",
"function",
"routeExists",
"(",
"$",
"identifier",
",",
"$",
"domain",
"=",
"null",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"identifier",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 pa... | Check if a Route exists by identifier with optional domain
@param string $identifier
@param string|null $domain
@return boolean | [
"Check",
"if",
"a",
"Route",
"exists",
"by",
"identifier",
"with",
"optional",
"domain"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Routing/Router.php#L311-L332 | train |
Kris-Kuiper/sFire-Framework | src/Routing/Router.php | Router.domainExists | public static function domainExists($domain) {
if(false === is_string($domain)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($domain)), E_USER_ERROR);
}
$routes = static :: getRoutes();
foreach($routes as $route) {
$do... | php | public static function domainExists($domain) {
if(false === is_string($domain)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($domain)), E_USER_ERROR);
}
$routes = static :: getRoutes();
foreach($routes as $route) {
$do... | [
"public",
"static",
"function",
"domainExists",
"(",
"$",
"domain",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"domain",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" gi... | Checks if a given domain exists
@param string $domain
@return boolean | [
"Checks",
"if",
"a",
"given",
"domain",
"exists"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Routing/Router.php#L340-L364 | train |
Kris-Kuiper/sFire-Framework | src/Routing/Router.php | Router.getRoute | public static function getRoute($identifier = null) {
if(null !== $identifier && false === is_string($identifier)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($identifier)), E_USER_ERROR);
}
if(null !== $identifier) {
if(f... | php | public static function getRoute($identifier = null) {
if(null !== $identifier && false === is_string($identifier)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($identifier)), E_USER_ERROR);
}
if(null !== $identifier) {
if(f... | [
"public",
"static",
"function",
"getRoute",
"(",
"$",
"identifier",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"identifier",
"&&",
"false",
"===",
"is_string",
"(",
"$",
"identifier",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"... | Gets the current route or a route based on identifier
@param null|string $identifier
@return sFire\Routing\Extend\Method | [
"Gets",
"the",
"current",
"route",
"or",
"a",
"route",
"based",
"on",
"identifier"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Routing/Router.php#L392-L408 | train |
Kris-Kuiper/sFire-Framework | src/Routing/Router.php | Router.addGroup | public static function addGroup($group) {
if(false === is_array($group)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($group)), E_USER_ERROR);
}
static :: $group[] = $group;
} | php | public static function addGroup($group) {
if(false === is_array($group)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($group)), E_USER_ERROR);
}
static :: $group[] = $group;
} | [
"public",
"static",
"function",
"addGroup",
"(",
"$",
"group",
")",
"{",
"if",
"(",
"false",
"===",
"is_array",
"(",
"$",
"group",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type array, \"%s\" given'",
... | Add a new group element to the stack
@param array $group | [
"Add",
"a",
"new",
"group",
"element",
"to",
"the",
"stack"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Routing/Router.php#L415-L422 | train |
Kris-Kuiper/sFire-Framework | src/Routing/Router.php | Router.getGroup | public static function getGroup() {
$attr = [];
foreach(static :: $group as $group) {
$attr = static :: arrayRecursiveMerge($attr, $group);
}
return $attr;
} | php | public static function getGroup() {
$attr = [];
foreach(static :: $group as $group) {
$attr = static :: arrayRecursiveMerge($attr, $group);
}
return $attr;
} | [
"public",
"static",
"function",
"getGroup",
"(",
")",
"{",
"$",
"attr",
"=",
"[",
"]",
";",
"foreach",
"(",
"static",
"::",
"$",
"group",
"as",
"$",
"group",
")",
"{",
"$",
"attr",
"=",
"static",
"::",
"arrayRecursiveMerge",
"(",
"$",
"attr",
",",
... | Return all the groups as one merged array
@return array | [
"Return",
"all",
"the",
"groups",
"as",
"one",
"merged",
"array"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Routing/Router.php#L438-L447 | train |
Kris-Kuiper/sFire-Framework | src/Routing/Router.php | Router.getErrorRoute | public static function getErrorRoute($type, $index = 0) {
if(false === ('-' . intval($type) == '-' . $type)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($type)), E_USER_ERROR);
}
if(false === ('-' . intval($index) == '-' . $ind... | php | public static function getErrorRoute($type, $index = 0) {
if(false === ('-' . intval($type) == '-' . $type)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($type)), E_USER_ERROR);
}
if(false === ('-' . intval($index) == '-' . $ind... | [
"public",
"static",
"function",
"getErrorRoute",
"(",
"$",
"type",
",",
"$",
"index",
"=",
"0",
")",
"{",
"if",
"(",
"false",
"===",
"(",
"'-'",
".",
"intval",
"(",
"$",
"type",
")",
"==",
"'-'",
".",
"$",
"type",
")",
")",
"{",
"return",
"trigge... | Retrieve a route from the error route stack. Default the first on the stack, or route with optional index
@param string|integer $type
@param integer $index
@return null|sFire\Routing\Extend\Route | [
"Retrieve",
"a",
"route",
"from",
"the",
"error",
"route",
"stack",
".",
"Default",
"the",
"first",
"on",
"the",
"stack",
"or",
"route",
"with",
"optional",
"index"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Routing/Router.php#L456-L471 | train |
Kris-Kuiper/sFire-Framework | src/Routing/Router.php | Router.addErrorRoute | public static function addErrorRoute($type, Route $route, $default = false) {
if(false === ('-' . intval($type) == '-' . $type)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($type)), E_USER_ERROR);
}
static :: $error['types'][$t... | php | public static function addErrorRoute($type, Route $route, $default = false) {
if(false === ('-' . intval($type) == '-' . $type)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($type)), E_USER_ERROR);
}
static :: $error['types'][$t... | [
"public",
"static",
"function",
"addErrorRoute",
"(",
"$",
"type",
",",
"Route",
"$",
"route",
",",
"$",
"default",
"=",
"false",
")",
"{",
"if",
"(",
"false",
"===",
"(",
"'-'",
".",
"intval",
"(",
"$",
"type",
")",
"==",
"'-'",
".",
"$",
"type",
... | Adds a new error route to the error routes stack
@param integer $type
@param sFire\Routing\Extend\Route $route
@param boolean $default | [
"Adds",
"a",
"new",
"error",
"route",
"to",
"the",
"error",
"routes",
"stack"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Routing/Router.php#L480-L491 | train |
Kris-Kuiper/sFire-Framework | src/Routing/Router.php | Router.setRedirect | public static function setRedirect($bool) {
if(null !== $bool && false === is_bool($bool)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($bool)), E_USER_ERROR);
}
static :: $isRedirect = $bool;
} | php | public static function setRedirect($bool) {
if(null !== $bool && false === is_bool($bool)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($bool)), E_USER_ERROR);
}
static :: $isRedirect = $bool;
} | [
"public",
"static",
"function",
"setRedirect",
"(",
"$",
"bool",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"bool",
"&&",
"false",
"===",
"is_bool",
"(",
"$",
"bool",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() ... | Set the redirect
@param boolean $redirect | [
"Set",
"the",
"redirect"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Routing/Router.php#L530-L537 | train |
Kris-Kuiper/sFire-Framework | src/Routing/Router.php | Router.arrayRecursiveMerge | private static function arrayRecursiveMerge($array1, $array2) {
if(false === is_array($array1) || false === is_array($array2)) {
return $array2;
}
foreach($array2 as $key => $value) {
$array1[$key] = static :: arrayRecursiveMerge(@$array1[$key], $value);
}
return $array1;
} | php | private static function arrayRecursiveMerge($array1, $array2) {
if(false === is_array($array1) || false === is_array($array2)) {
return $array2;
}
foreach($array2 as $key => $value) {
$array1[$key] = static :: arrayRecursiveMerge(@$array1[$key], $value);
}
return $array1;
} | [
"private",
"static",
"function",
"arrayRecursiveMerge",
"(",
"$",
"array1",
",",
"$",
"array2",
")",
"{",
"if",
"(",
"false",
"===",
"is_array",
"(",
"$",
"array1",
")",
"||",
"false",
"===",
"is_array",
"(",
"$",
"array2",
")",
")",
"{",
"return",
"$"... | Recursive merge arrays
@param array $array1
@param array $array2
@return array | [
"Recursive",
"merge",
"arrays"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Routing/Router.php#L555-L566 | train |
Kris-Kuiper/sFire-Framework | src/Routing/Router.php | Router.request | private static function request() {
if($uri = Request :: getUri()) {
$url = '';
$host = null;
if(!($scheme = Request :: getScheme())) {
$scheme = 'php';
$host = '127.0.0.1';
Request :: setScheme($scheme);
}
$url .= $scheme . '://';
if($hostname = Request :: g... | php | private static function request() {
if($uri = Request :: getUri()) {
$url = '';
$host = null;
if(!($scheme = Request :: getScheme())) {
$scheme = 'php';
$host = '127.0.0.1';
Request :: setScheme($scheme);
}
$url .= $scheme . '://';
if($hostname = Request :: g... | [
"private",
"static",
"function",
"request",
"(",
")",
"{",
"if",
"(",
"$",
"uri",
"=",
"Request",
"::",
"getUri",
"(",
")",
")",
"{",
"$",
"url",
"=",
"''",
";",
"$",
"host",
"=",
"null",
";",
"if",
"(",
"!",
"(",
"$",
"scheme",
"=",
"Request",... | Try to add the request uri | [
"Try",
"to",
"add",
"the",
"request",
"uri"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Routing/Router.php#L572-L599 | train |
Kris-Kuiper/sFire-Framework | src/Routing/Router.php | Router.format | private static function format() {
$routes = static :: getRoutes();
foreach($routes as $identifier => $route) {
$url = preg_quote($route -> getUrl(), '/');
//Prepend prefix for url
if($prefix = $route -> getPrefix()) {
$url = $prefix['url'] . $url;
}
if(preg_match_all('#(\\\/)*... | php | private static function format() {
$routes = static :: getRoutes();
foreach($routes as $identifier => $route) {
$url = preg_quote($route -> getUrl(), '/');
//Prepend prefix for url
if($prefix = $route -> getPrefix()) {
$url = $prefix['url'] . $url;
}
if(preg_match_all('#(\\\/)*... | [
"private",
"static",
"function",
"format",
"(",
")",
"{",
"$",
"routes",
"=",
"static",
"::",
"getRoutes",
"(",
")",
";",
"foreach",
"(",
"$",
"routes",
"as",
"$",
"identifier",
"=>",
"$",
"route",
")",
"{",
"$",
"url",
"=",
"preg_quote",
"(",
"$",
... | Formats all the routes urls to a regex pattern that sFire understands to match the current url to the route url | [
"Formats",
"all",
"the",
"routes",
"urls",
"to",
"a",
"regex",
"pattern",
"that",
"sFire",
"understands",
"to",
"match",
"the",
"current",
"url",
"to",
"the",
"route",
"url"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Routing/Router.php#L605-L670 | train |
os-pek/ospek | src/OspekBackend.php | OspekBackend.getOutput | public function getOutput(String $file=null):Array
{
$file = ($file)?$file:$this->_logFile;
if (file_exists($file)) {
return file($file);
}
throw new \RunTimeException("file not found!");
} | php | public function getOutput(String $file=null):Array
{
$file = ($file)?$file:$this->_logFile;
if (file_exists($file)) {
return file($file);
}
throw new \RunTimeException("file not found!");
} | [
"public",
"function",
"getOutput",
"(",
"String",
"$",
"file",
"=",
"null",
")",
":",
"Array",
"{",
"$",
"file",
"=",
"(",
"$",
"file",
")",
"?",
"$",
"file",
":",
"$",
"this",
"->",
"_logFile",
";",
"if",
"(",
"file_exists",
"(",
"$",
"file",
")... | end kill method | [
"end",
"kill",
"method"
] | 1b2994e7103886f75c0d04d9d7d704ee40f5b7cd | https://github.com/os-pek/ospek/blob/1b2994e7103886f75c0d04d9d7d704ee40f5b7cd/src/OspekBackend.php#L82-L89 | train |
ColonelBlimp/NsanjaCore | src/Nsanja/Core/Traits/PropertySetterTrait.php | PropertySetterTrait.setProperty | protected function setProperty(string $key, array $data, &$property, $default = null): void
{
if (isset($data[$key])) {
$property = $data[$key];
return;
}
// Only set the property to the default IF it is NOT null. Otherwise leave the value of the property as set
... | php | protected function setProperty(string $key, array $data, &$property, $default = null): void
{
if (isset($data[$key])) {
$property = $data[$key];
return;
}
// Only set the property to the default IF it is NOT null. Otherwise leave the value of the property as set
... | [
"protected",
"function",
"setProperty",
"(",
"string",
"$",
"key",
",",
"array",
"$",
"data",
",",
"&",
"$",
"property",
",",
"$",
"default",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"$",
"key",
"]",
")",
")"... | Checks the given key is set in the data array, if so, the given property is set with the value.
@param string $key
@param array $data
@param mixed $property Must be a property of the class.
@param mixed $default. The default value (if this parameter is set) and the key is not found in the data array. | [
"Checks",
"the",
"given",
"key",
"is",
"set",
"in",
"the",
"data",
"array",
"if",
"so",
"the",
"given",
"property",
"is",
"set",
"with",
"the",
"value",
"."
] | 935b7363ae21b340eaa5867560a29f965ec7d012 | https://github.com/ColonelBlimp/NsanjaCore/blob/935b7363ae21b340eaa5867560a29f965ec7d012/src/Nsanja/Core/Traits/PropertySetterTrait.php#L19-L31 | train |
balintsera/evista-perform | src/Form/Form.php | Form.addCSRFTokenField | private function addCSRFTokenField()
{
$this->nonceValue = $this->createNonce();
$nonce = new FormField(FormField::TYPE_HIDDEN);
$nonce
->setName('nonce')
->setValue($this->createNonce())
->setValidationCallback(
function ($value) {
... | php | private function addCSRFTokenField()
{
$this->nonceValue = $this->createNonce();
$nonce = new FormField(FormField::TYPE_HIDDEN);
$nonce
->setName('nonce')
->setValue($this->createNonce())
->setValidationCallback(
function ($value) {
... | [
"private",
"function",
"addCSRFTokenField",
"(",
")",
"{",
"$",
"this",
"->",
"nonceValue",
"=",
"$",
"this",
"->",
"createNonce",
"(",
")",
";",
"$",
"nonce",
"=",
"new",
"FormField",
"(",
"FormField",
"::",
"TYPE_HIDDEN",
")",
";",
"$",
"nonce",
"->",
... | Add CSRF token hidden input field | [
"Add",
"CSRF",
"token",
"hidden",
"input",
"field"
] | 2b8723852ebe824ed721f30293e1e0d2c14f4b21 | https://github.com/balintsera/evista-perform/blob/2b8723852ebe824ed721f30293e1e0d2c14f4b21/src/Form/Form.php#L117-L146 | train |
balintsera/evista-perform | src/Form/Form.php | Form.populateFields | public function populateFields()
{
if (count($this->submittedData) < 1) {
return;
}
array_map(
function (FormField &$field) {
if (isset($this->submittedData[$field->getName()])) {
$raw = $this->submittedData[$field->getName()];
... | php | public function populateFields()
{
if (count($this->submittedData) < 1) {
return;
}
array_map(
function (FormField &$field) {
if (isset($this->submittedData[$field->getName()])) {
$raw = $this->submittedData[$field->getName()];
... | [
"public",
"function",
"populateFields",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"submittedData",
")",
"<",
"1",
")",
"{",
"return",
";",
"}",
"array_map",
"(",
"function",
"(",
"FormField",
"&",
"$",
"field",
")",
"{",
"if",
"(",
... | populates form from POST after submission | [
"populates",
"form",
"from",
"POST",
"after",
"submission"
] | 2b8723852ebe824ed721f30293e1e0d2c14f4b21 | https://github.com/balintsera/evista-perform/blob/2b8723852ebe824ed721f30293e1e0d2c14f4b21/src/Form/Form.php#L173-L194 | train |
balintsera/evista-perform | src/Form/Form.php | Form.addFields | public function addFields(array $fields)
{
array_walk(
$fields,
function ($field, $key) {
$this->addField($key, $field);
}
);
} | php | public function addFields(array $fields)
{
array_walk(
$fields,
function ($field, $key) {
$this->addField($key, $field);
}
);
} | [
"public",
"function",
"addFields",
"(",
"array",
"$",
"fields",
")",
"{",
"array_walk",
"(",
"$",
"fields",
",",
"function",
"(",
"$",
"field",
",",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"addField",
"(",
"$",
"key",
",",
"$",
"field",
")",
";",
... | Add fields to the form
@param array $fields | [
"Add",
"fields",
"to",
"the",
"form"
] | 2b8723852ebe824ed721f30293e1e0d2c14f4b21 | https://github.com/balintsera/evista-perform/blob/2b8723852ebe824ed721f30293e1e0d2c14f4b21/src/Form/Form.php#L351-L359 | train |
TiMESPLiNTER/tsFramework | src/ch/timesplinter/auth/AuthHandlerDB.php | AuthHandlerDB.generateSalt | public static function generateSalt($length = 32)
{
$salt = '';
for($i = 0; $i < $length; ++$i)
$salt .= chr(rand(0,127));
return $salt;
} | php | public static function generateSalt($length = 32)
{
$salt = '';
for($i = 0; $i < $length; ++$i)
$salt .= chr(rand(0,127));
return $salt;
} | [
"public",
"static",
"function",
"generateSalt",
"(",
"$",
"length",
"=",
"32",
")",
"{",
"$",
"salt",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"length",
";",
"++",
"$",
"i",
")",
"$",
"salt",
".=",
"chr",
"(",
... | Generates a random string which can be used to salt the password
@param int $length
@return string | [
"Generates",
"a",
"random",
"string",
"which",
"can",
"be",
"used",
"to",
"salt",
"the",
"password"
] | b3b9fd98f6d456a9e571015877ecca203786fd0c | https://github.com/TiMESPLiNTER/tsFramework/blob/b3b9fd98f6d456a9e571015877ecca203786fd0c/src/ch/timesplinter/auth/AuthHandlerDB.php#L231-L239 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.