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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
rujiali/acquia-site-factory-cli | src/AppBundle/Connector/ConnectorSites.php | ConnectorSites.getBackupURL | public function getBackupURL($backupId)
{
if ($this->connector->getURL() === null) {
return 'Cannot find site URL from configuration.';
}
$url = $this->connector->getURL().self::VERSION.$this->connector->getSiteID().'/backups/'.$backupId.'/url';
$params = [];
$res... | php | public function getBackupURL($backupId)
{
if ($this->connector->getURL() === null) {
return 'Cannot find site URL from configuration.';
}
$url = $this->connector->getURL().self::VERSION.$this->connector->getSiteID().'/backups/'.$backupId.'/url';
$params = [];
$res... | [
"public",
"function",
"getBackupURL",
"(",
"$",
"backupId",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"connector",
"->",
"getURL",
"(",
")",
"===",
"null",
")",
"{",
"return",
"'Cannot find site URL from configuration.'",
";",
"}",
"$",
"url",
"=",
"$",
"thi... | Get backup URL.
@param string $backupId Backup ID.
@return string | [
"Get",
"backup",
"URL",
"."
] | c9dbb9dfd71408adff0ea26db94678a61c584df6 | https://github.com/rujiali/acquia-site-factory-cli/blob/c9dbb9dfd71408adff0ea26db94678a61c584df6/src/AppBundle/Connector/ConnectorSites.php#L117-L130 | train |
rujiali/acquia-site-factory-cli | src/AppBundle/Connector/ConnectorSites.php | ConnectorSites.getSiteDetails | public function getSiteDetails($siteId)
{
if ($this->connector->getURL() === null) {
return 'Cannot find site URL from configuration.';
}
$url = $this->connector->getURL().self::VERSION.$siteId;
$params = [];
$response = $this->connector->connecting($url, $params,... | php | public function getSiteDetails($siteId)
{
if ($this->connector->getURL() === null) {
return 'Cannot find site URL from configuration.';
}
$url = $this->connector->getURL().self::VERSION.$siteId;
$params = [];
$response = $this->connector->connecting($url, $params,... | [
"public",
"function",
"getSiteDetails",
"(",
"$",
"siteId",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"connector",
"->",
"getURL",
"(",
")",
"===",
"null",
")",
"{",
"return",
"'Cannot find site URL from configuration.'",
";",
"}",
"$",
"url",
"=",
"$",
"thi... | Get site details
@param int $siteId Site ID.
@return mixed|string | [
"Get",
"site",
"details"
] | c9dbb9dfd71408adff0ea26db94678a61c584df6 | https://github.com/rujiali/acquia-site-factory-cli/blob/c9dbb9dfd71408adff0ea26db94678a61c584df6/src/AppBundle/Connector/ConnectorSites.php#L161-L171 | train |
rujiali/acquia-site-factory-cli | src/AppBundle/Connector/ConnectorSites.php | ConnectorSites.listBackups | public function listBackups()
{
if ($this->connector->getURL() === null) {
return 'Cannot find site URL from configuration.';
}
$url = $this->connector->getURL().self::VERSION.$this->connector->getSiteID().'/backups';
$params = [];
$response = $this->connector->co... | php | public function listBackups()
{
if ($this->connector->getURL() === null) {
return 'Cannot find site URL from configuration.';
}
$url = $this->connector->getURL().self::VERSION.$this->connector->getSiteID().'/backups';
$params = [];
$response = $this->connector->co... | [
"public",
"function",
"listBackups",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"connector",
"->",
"getURL",
"(",
")",
"===",
"null",
")",
"{",
"return",
"'Cannot find site URL from configuration.'",
";",
"}",
"$",
"url",
"=",
"$",
"this",
"->",
"connect... | List all backups in for specific site in site factory.
@return mixed | [
"List",
"all",
"backups",
"in",
"for",
"specific",
"site",
"in",
"site",
"factory",
"."
] | c9dbb9dfd71408adff0ea26db94678a61c584df6 | https://github.com/rujiali/acquia-site-factory-cli/blob/c9dbb9dfd71408adff0ea26db94678a61c584df6/src/AppBundle/Connector/ConnectorSites.php#L178-L192 | train |
rujiali/acquia-site-factory-cli | src/AppBundle/Connector/ConnectorSites.php | ConnectorSites.getLastBackupTime | public function getLastBackupTime()
{
$backups = $this->listBackups();
if (is_array($backups)) {
if (!empty($backups)) {
$timestamp = $backups[0]->timestamp;
return $timestamp;
}
return 'There is no backup available.';
}
... | php | public function getLastBackupTime()
{
$backups = $this->listBackups();
if (is_array($backups)) {
if (!empty($backups)) {
$timestamp = $backups[0]->timestamp;
return $timestamp;
}
return 'There is no backup available.';
}
... | [
"public",
"function",
"getLastBackupTime",
"(",
")",
"{",
"$",
"backups",
"=",
"$",
"this",
"->",
"listBackups",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"backups",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"backups",
")",
")",
"{",
... | Get the last backup timestamp.
@return mixed|string | [
"Get",
"the",
"last",
"backup",
"timestamp",
"."
] | c9dbb9dfd71408adff0ea26db94678a61c584df6 | https://github.com/rujiali/acquia-site-factory-cli/blob/c9dbb9dfd71408adff0ea26db94678a61c584df6/src/AppBundle/Connector/ConnectorSites.php#L199-L213 | train |
rujiali/acquia-site-factory-cli | src/AppBundle/Connector/ConnectorSites.php | ConnectorSites.backupSuccessIndicator | public function backupSuccessIndicator($label)
{
$backups = $this->listBackups();
if (is_array($backups)) {
if (!empty($backups)) {
if ($backups[0]->label === $label) {
return true;
}
return false;
}
... | php | public function backupSuccessIndicator($label)
{
$backups = $this->listBackups();
if (is_array($backups)) {
if (!empty($backups)) {
if ($backups[0]->label === $label) {
return true;
}
return false;
}
... | [
"public",
"function",
"backupSuccessIndicator",
"(",
"$",
"label",
")",
"{",
"$",
"backups",
"=",
"$",
"this",
"->",
"listBackups",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"backups",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"backups"... | Indicate when required backup is generated.
@param string $label Backup label.
@return bool | [
"Indicate",
"when",
"required",
"backup",
"is",
"generated",
"."
] | c9dbb9dfd71408adff0ea26db94678a61c584df6 | https://github.com/rujiali/acquia-site-factory-cli/blob/c9dbb9dfd71408adff0ea26db94678a61c584df6/src/AppBundle/Connector/ConnectorSites.php#L222-L236 | train |
rujiali/acquia-site-factory-cli | src/AppBundle/Connector/ConnectorSites.php | ConnectorSites.listSites | public function listSites($limit, $page, $canary = false)
{
if ($this->connector->getURL() === null) {
return 'Cannot find site URL from configuration.';
}
$params = [
'limit' => $limit,
'page' => $page,
'canary' => $canary,
];
$url =... | php | public function listSites($limit, $page, $canary = false)
{
if ($this->connector->getURL() === null) {
return 'Cannot find site URL from configuration.';
}
$params = [
'limit' => $limit,
'page' => $page,
'canary' => $canary,
];
$url =... | [
"public",
"function",
"listSites",
"(",
"$",
"limit",
",",
"$",
"page",
",",
"$",
"canary",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"connector",
"->",
"getURL",
"(",
")",
"===",
"null",
")",
"{",
"return",
"'Cannot find site URL from config... | List sites.
@param int $limit Limit number.
@param int $page Page number.
@param boolean $canary No value necessary.
@return string | [
"List",
"sites",
"."
] | c9dbb9dfd71408adff0ea26db94678a61c584df6 | https://github.com/rujiali/acquia-site-factory-cli/blob/c9dbb9dfd71408adff0ea26db94678a61c584df6/src/AppBundle/Connector/ConnectorSites.php#L263-L282 | train |
anklimsk/cakephp-console-installer | Console/Helper/StateShellHelper.php | StateShellHelper.output | public function output($args) {
$args += ['', '', 63];
$this->_consoleOutput->write($this->_getState($args[0], $args[1], $args[2]));
} | php | public function output($args) {
$args += ['', '', 63];
$this->_consoleOutput->write($this->_getState($args[0], $args[1], $args[2]));
} | [
"public",
"function",
"output",
"(",
"$",
"args",
")",
"{",
"$",
"args",
"+=",
"[",
"''",
",",
"''",
",",
"63",
"]",
";",
"$",
"this",
"->",
"_consoleOutput",
"->",
"write",
"(",
"$",
"this",
"->",
"_getState",
"(",
"$",
"args",
"[",
"0",
"]",
... | This method should output formatted message.
@param array $args The arguments for the `StateShellHelper::_getState()`.
@return void | [
"This",
"method",
"should",
"output",
"formatted",
"message",
"."
] | 76136550e856ff4f8fd3634b77633f86510f63e9 | https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Console/Helper/StateShellHelper.php#L69-L72 | train |
chilimatic/chilimatic-framework | lib/database/sql/mysql/Tool.php | Tool.mysql_aes_encrypt | static public function mysql_aes_encrypt($val, $ky)
{
if (empty($ky) && empty($val)) return null;
$key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
for ($a = 0; $a < strlen($ky); $a++) {
$key[$a % 16] = chr(ord($key[$a % 16]) ^ ord($ky[$a]));
}
$mode = MCRYPT_MODE_ECB;... | php | static public function mysql_aes_encrypt($val, $ky)
{
if (empty($ky) && empty($val)) return null;
$key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
for ($a = 0; $a < strlen($ky); $a++) {
$key[$a % 16] = chr(ord($key[$a % 16]) ^ ord($ky[$a]));
}
$mode = MCRYPT_MODE_ECB;... | [
"static",
"public",
"function",
"mysql_aes_encrypt",
"(",
"$",
"val",
",",
"$",
"ky",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"ky",
")",
"&&",
"empty",
"(",
"$",
"val",
")",
")",
"return",
"null",
";",
"$",
"key",
"=",
"\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0... | aes mysql encryption
@param string $val
@param string $ky
@return null|string | [
"aes",
"mysql",
"encryption"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/database/sql/mysql/Tool.php#L75-L89 | train |
schpill/thin | src/Url/Rule.php | Rule.resolveUrl | public function resolveUrl($url, &$parameters)
{
$parameters = array();
$patternSegments = $this->segments;
$patternSegmentNum = count($patternSegments);
$urlSegments = Helper::segmentizeUrl($url);
/*
* If the number of URL segments is m... | php | public function resolveUrl($url, &$parameters)
{
$parameters = array();
$patternSegments = $this->segments;
$patternSegmentNum = count($patternSegments);
$urlSegments = Helper::segmentizeUrl($url);
/*
* If the number of URL segments is m... | [
"public",
"function",
"resolveUrl",
"(",
"$",
"url",
",",
"&",
"$",
"parameters",
")",
"{",
"$",
"parameters",
"=",
"array",
"(",
")",
";",
"$",
"patternSegments",
"=",
"$",
"this",
"->",
"segments",
";",
"$",
"patternSegmentNum",
"=",
"count",
"(",
"$... | Checks whether a given URL matches a given pattern.
@param string $url The URL to check.
@param array $parameters A reference to a PHP array variable to return the parameter list fetched from URL.
@return boolean Returns true if the URL matches the pattern. Otherwise returns false. | [
"Checks",
"whether",
"a",
"given",
"URL",
"matches",
"a",
"given",
"pattern",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Url/Rule.php#L83-L169 | train |
schpill/thin | src/Url/Rule.php | Rule.name | public function name($name = null)
{
if ($name === null) return $this->ruleName;
$this->ruleName = $name;
return $this;
} | php | public function name($name = null)
{
if ($name === null) return $this->ruleName;
$this->ruleName = $name;
return $this;
} | [
"public",
"function",
"name",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"null",
")",
"return",
"$",
"this",
"->",
"ruleName",
";",
"$",
"this",
"->",
"ruleName",
"=",
"$",
"name",
";",
"return",
"$",
"this",
";",
"}"... | Unique route name
@param string $name Unique name for the router object
@return object Self | [
"Unique",
"route",
"name"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Url/Rule.php#L177-L184 | train |
schpill/thin | src/Url/Rule.php | Rule.pattern | public function pattern($pattern = null)
{
if ($pattern === null) return $this->rulePattern;
$this->rulePattern = $pattern;
return $this;
} | php | public function pattern($pattern = null)
{
if ($pattern === null) return $this->rulePattern;
$this->rulePattern = $pattern;
return $this;
} | [
"public",
"function",
"pattern",
"(",
"$",
"pattern",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"pattern",
"===",
"null",
")",
"return",
"$",
"this",
"->",
"rulePattern",
";",
"$",
"this",
"->",
"rulePattern",
"=",
"$",
"pattern",
";",
"return",
"$",
"t... | Route match pattern
@param string $pattern Pattern used to match this rule
@return object Self | [
"Route",
"match",
"pattern"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Url/Rule.php#L192-L199 | train |
schpill/thin | src/Url/Rule.php | Rule.afterMatch | public function afterMatch($callback = null)
{
if ($callback !== null) {
if (!is_callable($callback)) {
throw new InvalidArgumentException(
sprintf(
"The after match callback provided is not valid. Given (%s)",
... | php | public function afterMatch($callback = null)
{
if ($callback !== null) {
if (!is_callable($callback)) {
throw new InvalidArgumentException(
sprintf(
"The after match callback provided is not valid. Given (%s)",
... | [
"public",
"function",
"afterMatch",
"(",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"callback",
"!==",
"null",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"... | After match callback
@param callback $callback Callback function to be used to modify params after a successful match
@throws InvalidArgumentException When supplied argument is not a valid callback
@return callback | [
"After",
"match",
"callback"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Url/Rule.php#L236-L254 | train |
znframework/package-hypertext | BuilderExtends.php | BuilderExtends.openCloseTag | protected function openCloseTag($string)
{
if( $this->tag === true )
{
$script = $this->getScriptClass();
$string = $script->open() . $string . $script->close();
}
$this->tag = false;
return $string;
} | php | protected function openCloseTag($string)
{
if( $this->tag === true )
{
$script = $this->getScriptClass();
$string = $script->open() . $string . $script->close();
}
$this->tag = false;
return $string;
} | [
"protected",
"function",
"openCloseTag",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"tag",
"===",
"true",
")",
"{",
"$",
"script",
"=",
"$",
"this",
"->",
"getScriptClass",
"(",
")",
";",
"$",
"string",
"=",
"$",
"script",
"->",
"o... | Protected script open close tag | [
"Protected",
"script",
"open",
"close",
"tag"
] | 12bbc3bd47a2fae735f638a3e01cc82c1b9c9005 | https://github.com/znframework/package-hypertext/blob/12bbc3bd47a2fae735f638a3e01cc82c1b9c9005/BuilderExtends.php#L64-L76 | train |
znframework/package-hypertext | BuilderExtends.php | BuilderExtends.isCallableOption | protected function isCallableOption($callback, $parameter)
{
$option = 'function(' . $parameter . '){' . PHP_EOL;
$option .= Buffering\Callback::do($callback);
$option .= '}';
return $option;
} | php | protected function isCallableOption($callback, $parameter)
{
$option = 'function(' . $parameter . '){' . PHP_EOL;
$option .= Buffering\Callback::do($callback);
$option .= '}';
return $option;
} | [
"protected",
"function",
"isCallableOption",
"(",
"$",
"callback",
",",
"$",
"parameter",
")",
"{",
"$",
"option",
"=",
"'function('",
".",
"$",
"parameter",
".",
"'){'",
".",
"PHP_EOL",
";",
"$",
"option",
".=",
"Buffering",
"\\",
"Callback",
"::",
"do",
... | Protected is callable option | [
"Protected",
"is",
"callable",
"option"
] | 12bbc3bd47a2fae735f638a3e01cc82c1b9c9005 | https://github.com/znframework/package-hypertext/blob/12bbc3bd47a2fae735f638a3e01cc82c1b9c9005/BuilderExtends.php#L81-L88 | train |
wdbo/webdocbook | src/WebDocBook/Controller/WebDocBookController.php | WebDocBookController.docbookdocAction | public function docbookdocAction()
{
$title = _T('User manual');
$md_parser = $this->wdb->getMarkdownParser();
// user manual
$path = Kernel::getPath('webdocbook_assets') . Kernel::getConfig('pages:user_manual', '');
$update = ... | php | public function docbookdocAction()
{
$title = _T('User manual');
$md_parser = $this->wdb->getMarkdownParser();
// user manual
$path = Kernel::getPath('webdocbook_assets') . Kernel::getConfig('pages:user_manual', '');
$update = ... | [
"public",
"function",
"docbookdocAction",
"(",
")",
"{",
"$",
"title",
"=",
"_T",
"(",
"'User manual'",
")",
";",
"$",
"md_parser",
"=",
"$",
"this",
"->",
"wdb",
"->",
"getMarkdownParser",
"(",
")",
";",
"// user manual",
"$",
"path",
"=",
"Kernel",
"::... | The internal documentation action
@return array | [
"The",
"internal",
"documentation",
"action"
] | 7d4e806f674b6222c9a3e85bfed34e72bc9d584e | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Controller/WebDocBookController.php#L91-L150 | train |
wdbo/webdocbook | src/WebDocBook/Controller/WebDocBookController.php | WebDocBookController.adminAction | public function adminAction()
{
$allowed = Kernel::getConfig('expose_admin', false, 'user_config');
$saveadmin = $this->wdb->getUser()->getSession()->get('saveadmin');
$this->wdb->getUser()->getSession()->remove('saveadmin');
if (
(!$allowed || ('true' !== $allowed &&... | php | public function adminAction()
{
$allowed = Kernel::getConfig('expose_admin', false, 'user_config');
$saveadmin = $this->wdb->getUser()->getSession()->get('saveadmin');
$this->wdb->getUser()->getSession()->remove('saveadmin');
if (
(!$allowed || ('true' !== $allowed &&... | [
"public",
"function",
"adminAction",
"(",
")",
"{",
"$",
"allowed",
"=",
"Kernel",
"::",
"getConfig",
"(",
"'expose_admin'",
",",
"false",
",",
"'user_config'",
")",
";",
"$",
"saveadmin",
"=",
"$",
"this",
"->",
"wdb",
"->",
"getUser",
"(",
")",
"->",
... | Admin panel action
@return array
@throws \WebDocBook\Exception\NotFoundException | [
"Admin",
"panel",
"action"
] | 7d4e806f674b6222c9a3e85bfed34e72bc9d584e | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Controller/WebDocBookController.php#L157-L198 | train |
jasny/iterator-stream | src/CsvOutputStream.php | CsvOutputStream.write | public function write(iterable $data, ?array $headers = null): void
{
$this->assertAttached();
$this->begin($headers);
foreach ($data as $element) {
$this->writeElement($element);
}
$this->end();
} | php | public function write(iterable $data, ?array $headers = null): void
{
$this->assertAttached();
$this->begin($headers);
foreach ($data as $element) {
$this->writeElement($element);
}
$this->end();
} | [
"public",
"function",
"write",
"(",
"iterable",
"$",
"data",
",",
"?",
"array",
"$",
"headers",
"=",
"null",
")",
":",
"void",
"{",
"$",
"this",
"->",
"assertAttached",
"(",
")",
";",
"$",
"this",
"->",
"begin",
"(",
"$",
"headers",
")",
";",
"fore... | Write to traversable data to stream.
@param iterable $data
@param string[]|null $headers
@return void | [
"Write",
"to",
"traversable",
"data",
"to",
"stream",
"."
] | a4d63eb2825956a879740cc44addd6170f7a481d | https://github.com/jasny/iterator-stream/blob/a4d63eb2825956a879740cc44addd6170f7a481d/src/CsvOutputStream.php#L90-L101 | train |
alekitto/metadata | lib/Factory/MetadataFactory.php | MetadataFactory.setMetadataClass | public function setMetadataClass(string $metadataClass): void
{
if (! class_exists($metadataClass) || ! (new \ReflectionClass($metadataClass))->implementsInterface(ClassMetadataInterface::class)) {
throw InvalidArgumentException::create(InvalidArgumentException::INVALID_METADATA_CLASS, $metadata... | php | public function setMetadataClass(string $metadataClass): void
{
if (! class_exists($metadataClass) || ! (new \ReflectionClass($metadataClass))->implementsInterface(ClassMetadataInterface::class)) {
throw InvalidArgumentException::create(InvalidArgumentException::INVALID_METADATA_CLASS, $metadata... | [
"public",
"function",
"setMetadataClass",
"(",
"string",
"$",
"metadataClass",
")",
":",
"void",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"metadataClass",
")",
"||",
"!",
"(",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"metadataClass",
")",
")",
"->",... | Set the metadata class to be created by this factory.
@param string $metadataClass | [
"Set",
"the",
"metadata",
"class",
"to",
"be",
"created",
"by",
"this",
"factory",
"."
] | 0422ac8d7fe72d5fa8cc51b6f1e173866e8afb2c | https://github.com/alekitto/metadata/blob/0422ac8d7fe72d5fa8cc51b6f1e173866e8afb2c/lib/Factory/MetadataFactory.php#L23-L30 | train |
oliwierptak/Everon1 | src/Everon/Logger.php | Logger.write | protected function write($message, $level, array $parameters)
{
if ($this->enabled === false) {
return null;
}
if ($this->log_request_identifier === null) {
$this->log_request_identifier = "MISSING_REQUEST_ID";
}
$ExceptionToTrace = $message;... | php | protected function write($message, $level, array $parameters)
{
if ($this->enabled === false) {
return null;
}
if ($this->log_request_identifier === null) {
$this->log_request_identifier = "MISSING_REQUEST_ID";
}
$ExceptionToTrace = $message;... | [
"protected",
"function",
"write",
"(",
"$",
"message",
",",
"$",
"level",
",",
"array",
"$",
"parameters",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"enabled",
"===",
"false",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"log_r... | Don't generate errors and only write to log file when possible
@param $message \Exception or string
@param $level
@param $parameters
@return \DateTime
@throws Exception\Logger | [
"Don",
"t",
"generate",
"errors",
"and",
"only",
"write",
"to",
"log",
"file",
"when",
"possible"
] | ac93793d1fa517a8394db5f00062f1925dc218a3 | https://github.com/oliwierptak/Everon1/blob/ac93793d1fa517a8394db5f00062f1925dc218a3/src/Everon/Logger.php#L72-L119 | train |
vi-kon/laravel-bootstrap | src/ViKon/Bootstrap/Compiler.php | Compiler.enableComponent | public function enableComponent($name)
{
if (!array_key_exists($name, $this->components)) {
throw new NotValidCompoenentException($name . ' component is not valid');
}
$this->components[$name] = true;
return $this;
} | php | public function enableComponent($name)
{
if (!array_key_exists($name, $this->components)) {
throw new NotValidCompoenentException($name . ' component is not valid');
}
$this->components[$name] = true;
return $this;
} | [
"public",
"function",
"enableComponent",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"components",
")",
")",
"{",
"throw",
"new",
"NotValidCompoenentException",
"(",
"$",
"name",
".",
"' compone... | Enable named component for compiler
@param string $name component name
@return $this | [
"Enable",
"named",
"component",
"for",
"compiler"
] | f4bdfd19241ad19344bef3d2bdbf3658bbbb2ddd | https://github.com/vi-kon/laravel-bootstrap/blob/f4bdfd19241ad19344bef3d2bdbf3658bbbb2ddd/src/ViKon/Bootstrap/Compiler.php#L101-L110 | train |
vi-kon/laravel-bootstrap | src/ViKon/Bootstrap/Compiler.php | Compiler.enableAll | public function enableAll(array $except = [])
{
// Check if excluded components name are exists or not
foreach ($except as $name) {
if (!array_key_exists($name, $this->components)) {
throw new NotValidCompoenentException($name . ' component is not valid');
}
... | php | public function enableAll(array $except = [])
{
// Check if excluded components name are exists or not
foreach ($except as $name) {
if (!array_key_exists($name, $this->components)) {
throw new NotValidCompoenentException($name . ' component is not valid');
}
... | [
"public",
"function",
"enableAll",
"(",
"array",
"$",
"except",
"=",
"[",
"]",
")",
"{",
"// Check if excluded components name are exists or not",
"foreach",
"(",
"$",
"except",
"as",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",... | Enable all components except listed ones
@param string[] $except list of components that will be not enabled
@return $this | [
"Enable",
"all",
"components",
"except",
"listed",
"ones"
] | f4bdfd19241ad19344bef3d2bdbf3658bbbb2ddd | https://github.com/vi-kon/laravel-bootstrap/blob/f4bdfd19241ad19344bef3d2bdbf3658bbbb2ddd/src/ViKon/Bootstrap/Compiler.php#L119-L134 | train |
vi-kon/laravel-bootstrap | src/ViKon/Bootstrap/Compiler.php | Compiler.compile | public function compile($force = false)
{
$jsOutputPath = $this->outputPath['js'] . '/bootstrap.min.js';
$cssOutputPath = $this->outputPath['css'] . '/bootstrap.min.css';
if ($force === true || !$this->filesystem->exists($jsOutputPath)) {
$this->filesystem->makeDirectory(dirnam... | php | public function compile($force = false)
{
$jsOutputPath = $this->outputPath['js'] . '/bootstrap.min.js';
$cssOutputPath = $this->outputPath['css'] . '/bootstrap.min.css';
if ($force === true || !$this->filesystem->exists($jsOutputPath)) {
$this->filesystem->makeDirectory(dirnam... | [
"public",
"function",
"compile",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"jsOutputPath",
"=",
"$",
"this",
"->",
"outputPath",
"[",
"'js'",
"]",
".",
"'/bootstrap.min.js'",
";",
"$",
"cssOutputPath",
"=",
"$",
"this",
"->",
"outputPath",
"[",
"'c... | Compile enabled components
@param bool $force if TRUE cache will be invalidated and new compiled resources will be created
@return void
@throws \ViKon\Bootstrap\Exception\CompilerException | [
"Compile",
"enabled",
"components"
] | f4bdfd19241ad19344bef3d2bdbf3658bbbb2ddd | https://github.com/vi-kon/laravel-bootstrap/blob/f4bdfd19241ad19344bef3d2bdbf3658bbbb2ddd/src/ViKon/Bootstrap/Compiler.php#L194-L210 | train |
vi-kon/laravel-bootstrap | src/ViKon/Bootstrap/Compiler.php | Compiler.minifyJs | protected function minifyJs()
{
$minifier = new Minify\JS();
// Components
$this->addJsToMinifier($minifier, 'dropdowns', 'dropdown');
// Components w/ JavaScript
$this->addJsToMinifier($minifier, 'modals', 'modal');
$this->addJsToMinifier($minifier, 'tooltip');
... | php | protected function minifyJs()
{
$minifier = new Minify\JS();
// Components
$this->addJsToMinifier($minifier, 'dropdowns', 'dropdown');
// Components w/ JavaScript
$this->addJsToMinifier($minifier, 'modals', 'modal');
$this->addJsToMinifier($minifier, 'tooltip');
... | [
"protected",
"function",
"minifyJs",
"(",
")",
"{",
"$",
"minifier",
"=",
"new",
"Minify",
"\\",
"JS",
"(",
")",
";",
"// Components",
"$",
"this",
"->",
"addJsToMinifier",
"(",
"$",
"minifier",
",",
"'dropdowns'",
",",
"'dropdown'",
")",
";",
"// Componen... | Minify JS components to single string
@return string | [
"Minify",
"JS",
"components",
"to",
"single",
"string"
] | f4bdfd19241ad19344bef3d2bdbf3658bbbb2ddd | https://github.com/vi-kon/laravel-bootstrap/blob/f4bdfd19241ad19344bef3d2bdbf3658bbbb2ddd/src/ViKon/Bootstrap/Compiler.php#L217-L240 | train |
vi-kon/laravel-bootstrap | src/ViKon/Bootstrap/Compiler.php | Compiler.addJsToMinifier | protected function addJsToMinifier(Minify\JS $minify, $componentName, $fileName = null)
{
if ($fileName === null) {
$fileName = $componentName;
}
// Add component data to minifier if it is enabled
if ($this->components[$componentName] === true) {
$minify->add... | php | protected function addJsToMinifier(Minify\JS $minify, $componentName, $fileName = null)
{
if ($fileName === null) {
$fileName = $componentName;
}
// Add component data to minifier if it is enabled
if ($this->components[$componentName] === true) {
$minify->add... | [
"protected",
"function",
"addJsToMinifier",
"(",
"Minify",
"\\",
"JS",
"$",
"minify",
",",
"$",
"componentName",
",",
"$",
"fileName",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"fileName",
"===",
"null",
")",
"{",
"$",
"fileName",
"=",
"$",
"componentName",... | Add components javascript file to minifier if component is enabled
@param \MatthiasMullie\Minify\JS $minify minifier instance
@param string $componentName valid component name
@param string|null $fileName file name (if not set component name is used)
@return void | [
"Add",
"components",
"javascript",
"file",
"to",
"minifier",
"if",
"component",
"is",
"enabled"
] | f4bdfd19241ad19344bef3d2bdbf3658bbbb2ddd | https://github.com/vi-kon/laravel-bootstrap/blob/f4bdfd19241ad19344bef3d2bdbf3658bbbb2ddd/src/ViKon/Bootstrap/Compiler.php#L251-L261 | train |
vi-kon/laravel-bootstrap | src/ViKon/Bootstrap/Compiler.php | Compiler.prepareCssForLess | protected function prepareCssForLess($componentName, $fileName = null)
{
if ($fileName === null) {
$fileName = $componentName;
}
// Add component data to minifier if it is enabled
if ($this->components[$componentName] === true) {
return "@import \"{$fileName}... | php | protected function prepareCssForLess($componentName, $fileName = null)
{
if ($fileName === null) {
$fileName = $componentName;
}
// Add component data to minifier if it is enabled
if ($this->components[$componentName] === true) {
return "@import \"{$fileName}... | [
"protected",
"function",
"prepareCssForLess",
"(",
"$",
"componentName",
",",
"$",
"fileName",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"fileName",
"===",
"null",
")",
"{",
"$",
"fileName",
"=",
"$",
"componentName",
";",
"}",
"// Add component data to minifier ... | Prepare components less file for less processor's input if component is enabled
@param string $componentName valid component name
@param string|null $fileName file name (if not set component name is used)
@return string | [
"Prepare",
"components",
"less",
"file",
"for",
"less",
"processor",
"s",
"input",
"if",
"component",
"is",
"enabled"
] | f4bdfd19241ad19344bef3d2bdbf3658bbbb2ddd | https://github.com/vi-kon/laravel-bootstrap/blob/f4bdfd19241ad19344bef3d2bdbf3658bbbb2ddd/src/ViKon/Bootstrap/Compiler.php#L358-L370 | train |
rackberg/para | src/EventSubscriber/AddEnvironmentVariableEventSubscriber.php | AddEnvironmentVariableEventSubscriber.addEnvironmentVariable | public function addEnvironmentVariable(PostProcessCreationEvent $event)
{
// Get the current set environment variables.
$env = $event->getProcess()->getEnv();
// Add the "para_project" environment variable
$env['para_project'] = $event->getProject()->getName();
// Save the ... | php | public function addEnvironmentVariable(PostProcessCreationEvent $event)
{
// Get the current set environment variables.
$env = $event->getProcess()->getEnv();
// Add the "para_project" environment variable
$env['para_project'] = $event->getProject()->getName();
// Save the ... | [
"public",
"function",
"addEnvironmentVariable",
"(",
"PostProcessCreationEvent",
"$",
"event",
")",
"{",
"// Get the current set environment variables.",
"$",
"env",
"=",
"$",
"event",
"->",
"getProcess",
"(",
")",
"->",
"getEnv",
"(",
")",
";",
"// Add the \"para_pro... | This callback method adds an environment variable to a created process.
@param \Para\Event\PostProcessCreationEvent $event | [
"This",
"callback",
"method",
"adds",
"an",
"environment",
"variable",
"to",
"a",
"created",
"process",
"."
] | e0ef1356ed2979670eb7c670d88921406cade46e | https://github.com/rackberg/para/blob/e0ef1356ed2979670eb7c670d88921406cade46e/src/EventSubscriber/AddEnvironmentVariableEventSubscriber.php#L37-L47 | train |
inc2734/wp-awesome-components | src/Awesome_Components.php | Awesome_Components._media_buttons | public function _media_buttons( $editor_id = 'content' ) {
$post_type = get_post_type();
if ( ! $post_type ) {
return;
}
$post_type_object = get_post_type_object( $post_type );
if ( ! $post_type_object || ! $post_type_object->public ) {
return;
}
?>
<button type="button" id="button-wp-awesome-co... | php | public function _media_buttons( $editor_id = 'content' ) {
$post_type = get_post_type();
if ( ! $post_type ) {
return;
}
$post_type_object = get_post_type_object( $post_type );
if ( ! $post_type_object || ! $post_type_object->public ) {
return;
}
?>
<button type="button" id="button-wp-awesome-co... | [
"public",
"function",
"_media_buttons",
"(",
"$",
"editor_id",
"=",
"'content'",
")",
"{",
"$",
"post_type",
"=",
"get_post_type",
"(",
")",
";",
"if",
"(",
"!",
"$",
"post_type",
")",
"{",
"return",
";",
"}",
"$",
"post_type_object",
"=",
"get_post_type_o... | Added "Add components" button
@param string $editor_id
@return void | [
"Added",
"Add",
"components",
"button"
] | 45ce014943db141350a001d4138921b1c7bec0a2 | https://github.com/inc2734/wp-awesome-components/blob/45ce014943db141350a001d4138921b1c7bec0a2/src/Awesome_Components.php#L32-L49 | train |
inc2734/wp-awesome-components | src/Awesome_Components.php | Awesome_Components._edit_form_after_editor | public function _edit_form_after_editor() {
$post_type = get_post_type();
if ( ! $post_type ) {
return;
}
if ( false === get_post_type_object( $post_type )->public ) {
return;
}
ob_start();
include( __DIR__ . '/view/modal.php' );
// @codingStandardsIgnoreStart
echo ob_get_clean();
// @codin... | php | public function _edit_form_after_editor() {
$post_type = get_post_type();
if ( ! $post_type ) {
return;
}
if ( false === get_post_type_object( $post_type )->public ) {
return;
}
ob_start();
include( __DIR__ . '/view/modal.php' );
// @codingStandardsIgnoreStart
echo ob_get_clean();
// @codin... | [
"public",
"function",
"_edit_form_after_editor",
"(",
")",
"{",
"$",
"post_type",
"=",
"get_post_type",
"(",
")",
";",
"if",
"(",
"!",
"$",
"post_type",
")",
"{",
"return",
";",
"}",
"if",
"(",
"false",
"===",
"get_post_type_object",
"(",
"$",
"post_type",... | Added modal html
@return void | [
"Added",
"modal",
"html"
] | 45ce014943db141350a001d4138921b1c7bec0a2 | https://github.com/inc2734/wp-awesome-components/blob/45ce014943db141350a001d4138921b1c7bec0a2/src/Awesome_Components.php#L56-L72 | train |
gplcart/file_manager | models/Command.php | Command.getHandlers | public function getHandlers()
{
$commands = &gplcart_static('module.file_manager.handlers');
if (isset($commands)) {
return $commands;
}
$commands = (array) gplcart_config_get(__DIR__ . '/../config/commands.php');
foreach ($commands as $id => &$command) {
... | php | public function getHandlers()
{
$commands = &gplcart_static('module.file_manager.handlers');
if (isset($commands)) {
return $commands;
}
$commands = (array) gplcart_config_get(__DIR__ . '/../config/commands.php');
foreach ($commands as $id => &$command) {
... | [
"public",
"function",
"getHandlers",
"(",
")",
"{",
"$",
"commands",
"=",
"&",
"gplcart_static",
"(",
"'module.file_manager.handlers'",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"commands",
")",
")",
"{",
"return",
"$",
"commands",
";",
"}",
"$",
"commands",... | Returns an array of supported commands
@return array | [
"Returns",
"an",
"array",
"of",
"supported",
"commands"
] | 45424e93eafea75d31af6410ac9cf110f08e500a | https://github.com/gplcart/file_manager/blob/45424e93eafea75d31af6410ac9cf110f08e500a/models/Command.php#L41-L57 | train |
gplcart/file_manager | models/Command.php | Command.get | public function get($command)
{
$commands = $this->getHandlers();
return empty($commands[$command]) ? array() : $commands[$command];
} | php | public function get($command)
{
$commands = $this->getHandlers();
return empty($commands[$command]) ? array() : $commands[$command];
} | [
"public",
"function",
"get",
"(",
"$",
"command",
")",
"{",
"$",
"commands",
"=",
"$",
"this",
"->",
"getHandlers",
"(",
")",
";",
"return",
"empty",
"(",
"$",
"commands",
"[",
"$",
"command",
"]",
")",
"?",
"array",
"(",
")",
":",
"$",
"commands",... | Returns a single command
@param string $command
@return array | [
"Returns",
"a",
"single",
"command"
] | 45424e93eafea75d31af6410ac9cf110f08e500a | https://github.com/gplcart/file_manager/blob/45424e93eafea75d31af6410ac9cf110f08e500a/models/Command.php#L64-L68 | train |
gplcart/file_manager | models/Command.php | Command.getAllowed | public function getAllowed($file)
{
$commands = array();
foreach ($this->getHandlers() as $id => $command) {
if ($this->isAllowed($command, $file)) {
$commands[$id] = $command;
}
}
return $commands;
} | php | public function getAllowed($file)
{
$commands = array();
foreach ($this->getHandlers() as $id => $command) {
if ($this->isAllowed($command, $file)) {
$commands[$id] = $command;
}
}
return $commands;
} | [
"public",
"function",
"getAllowed",
"(",
"$",
"file",
")",
"{",
"$",
"commands",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getHandlers",
"(",
")",
"as",
"$",
"id",
"=>",
"$",
"command",
")",
"{",
"if",
"(",
"$",
"this",
"->... | Returns an array of allowed commands for the given file
@param SplFileInfo|array $file
@return array | [
"Returns",
"an",
"array",
"of",
"allowed",
"commands",
"for",
"the",
"given",
"file"
] | 45424e93eafea75d31af6410ac9cf110f08e500a | https://github.com/gplcart/file_manager/blob/45424e93eafea75d31af6410ac9cf110f08e500a/models/Command.php#L75-L86 | train |
gplcart/file_manager | models/Command.php | Command.callHandler | public function callHandler(array $command, $method, $args = array())
{
try {
$handlers = $this->getHandlers();
return Handler::call($handlers, $command['command_id'], $method, $args);
} catch (Exception $ex) {
return $ex->getMessage();
}
} | php | public function callHandler(array $command, $method, $args = array())
{
try {
$handlers = $this->getHandlers();
return Handler::call($handlers, $command['command_id'], $method, $args);
} catch (Exception $ex) {
return $ex->getMessage();
}
} | [
"public",
"function",
"callHandler",
"(",
"array",
"$",
"command",
",",
"$",
"method",
",",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"$",
"handlers",
"=",
"$",
"this",
"->",
"getHandlers",
"(",
")",
";",
"return",
"Handler",
"::",
... | Call a command handler
@param array $command
@param string $method
@param array $args
@return mixed | [
"Call",
"a",
"command",
"handler"
] | 45424e93eafea75d31af6410ac9cf110f08e500a | https://github.com/gplcart/file_manager/blob/45424e93eafea75d31af6410ac9cf110f08e500a/models/Command.php#L112-L120 | train |
gplcart/file_manager | models/Command.php | Command.submit | public function submit(array $command, array $args)
{
$result = (array) $this->callHandler($command, 'submit', $args);
$result += array('redirect' => '', 'message' => '', 'severity' => '');
return $result;
} | php | public function submit(array $command, array $args)
{
$result = (array) $this->callHandler($command, 'submit', $args);
$result += array('redirect' => '', 'message' => '', 'severity' => '');
return $result;
} | [
"public",
"function",
"submit",
"(",
"array",
"$",
"command",
",",
"array",
"$",
"args",
")",
"{",
"$",
"result",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"callHandler",
"(",
"$",
"command",
",",
"'submit'",
",",
"$",
"args",
")",
";",
"$",
"resu... | Submit a command
@param array $command
@param array $args
@return array | [
"Submit",
"a",
"command"
] | 45424e93eafea75d31af6410ac9cf110f08e500a | https://github.com/gplcart/file_manager/blob/45424e93eafea75d31af6410ac9cf110f08e500a/models/Command.php#L128-L133 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.getUrl | public function getUrl()
{
$query = $this->getQueryString();
return sprintf('%s://%s/%s/%s%s',
$this->getScheme(),
trim($this->getHost(), '/'),
trim($this->config->getRootEndpoint(), '/'),
$this->getEntityType(),
empty($query) ? '' : sprint... | php | public function getUrl()
{
$query = $this->getQueryString();
return sprintf('%s://%s/%s/%s%s',
$this->getScheme(),
trim($this->getHost(), '/'),
trim($this->config->getRootEndpoint(), '/'),
$this->getEntityType(),
empty($query) ? '' : sprint... | [
"public",
"function",
"getUrl",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"getQueryString",
"(",
")",
";",
"return",
"sprintf",
"(",
"'%s://%s/%s/%s%s'",
",",
"$",
"this",
"->",
"getScheme",
"(",
")",
",",
"trim",
"(",
"$",
"this",
"->",
"... | Generates the request URL based on its current object state.
@todo Add support for inclusions and other items.
@return string | [
"Generates",
"the",
"request",
"URL",
"based",
"on",
"its",
"current",
"object",
"state",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L150-L160 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.getQueryString | public function getQueryString()
{
$query = [];
if (!empty($this->pagination)) {
$query[self::PARAM_PAGINATION] = $this->pagination;
}
if (!empty($this->filters)) {
$query[self::PARAM_FILTERING] = $this->filters;
}
foreach ($this->fields as $mo... | php | public function getQueryString()
{
$query = [];
if (!empty($this->pagination)) {
$query[self::PARAM_PAGINATION] = $this->pagination;
}
if (!empty($this->filters)) {
$query[self::PARAM_FILTERING] = $this->filters;
}
foreach ($this->fields as $mo... | [
"public",
"function",
"getQueryString",
"(",
")",
"{",
"$",
"query",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"pagination",
")",
")",
"{",
"$",
"query",
"[",
"self",
"::",
"PARAM_PAGINATION",
"]",
"=",
"$",
"this",
"->",... | Gets the query string based on the current object properties.
@return string | [
"Gets",
"the",
"query",
"string",
"based",
"on",
"the",
"current",
"object",
"properties",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L227-L247 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.isAutocomplete | public function isAutocomplete()
{
if (false === $this->hasFilter(self::FILTER_AUTOCOMPLETE)) {
return false;
}
$autocomplete = $this->getFilter(self::FILTER_AUTOCOMPLETE);
return isset($autocomplete[self::FILTER_AUTOCOMPLETE_KEY]) && isset($autocomplete[self::FILTER_AUTO... | php | public function isAutocomplete()
{
if (false === $this->hasFilter(self::FILTER_AUTOCOMPLETE)) {
return false;
}
$autocomplete = $this->getFilter(self::FILTER_AUTOCOMPLETE);
return isset($autocomplete[self::FILTER_AUTOCOMPLETE_KEY]) && isset($autocomplete[self::FILTER_AUTO... | [
"public",
"function",
"isAutocomplete",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"hasFilter",
"(",
"self",
"::",
"FILTER_AUTOCOMPLETE",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"autocomplete",
"=",
"$",
"this",
"->",
"getFilte... | Determines if this has an autocomplete filter enabled.
@return bool | [
"Determines",
"if",
"this",
"has",
"an",
"autocomplete",
"filter",
"enabled",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L323-L330 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.getAutocompleteKey | public function getAutocompleteKey()
{
if (false === $this->isAutocomplete()) {
return null;
}
return $this->getFilter(self::FILTER_AUTOCOMPLETE)[self::FILTER_AUTOCOMPLETE_KEY];
} | php | public function getAutocompleteKey()
{
if (false === $this->isAutocomplete()) {
return null;
}
return $this->getFilter(self::FILTER_AUTOCOMPLETE)[self::FILTER_AUTOCOMPLETE_KEY];
} | [
"public",
"function",
"getAutocompleteKey",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"isAutocomplete",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"getFilter",
"(",
"self",
"::",
"FILTER_AUTOCOMPLETE",
... | Gets the autocomplete attribute key.
@return string|null | [
"Gets",
"the",
"autocomplete",
"attribute",
"key",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L337-L343 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.getAutocompleteValue | public function getAutocompleteValue()
{
if (false === $this->isAutocomplete()) {
return null;
}
return $this->getFilter(self::FILTER_AUTOCOMPLETE)[self::FILTER_AUTOCOMPLETE_VALUE];
} | php | public function getAutocompleteValue()
{
if (false === $this->isAutocomplete()) {
return null;
}
return $this->getFilter(self::FILTER_AUTOCOMPLETE)[self::FILTER_AUTOCOMPLETE_VALUE];
} | [
"public",
"function",
"getAutocompleteValue",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"isAutocomplete",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"getFilter",
"(",
"self",
"::",
"FILTER_AUTOCOMPLETE",... | Gets the autocomplete search value.
@return string|null | [
"Gets",
"the",
"autocomplete",
"search",
"value",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L350-L356 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.isQuery | public function isQuery()
{
if (false === $this->hasFilter(self::FILTER_QUERY)) {
return false;
}
$query = $this->getFilter(self::FILTER_QUERY);
return isset($query[self::FILTER_QUERY_CRITERIA]);
} | php | public function isQuery()
{
if (false === $this->hasFilter(self::FILTER_QUERY)) {
return false;
}
$query = $this->getFilter(self::FILTER_QUERY);
return isset($query[self::FILTER_QUERY_CRITERIA]);
} | [
"public",
"function",
"isQuery",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"hasFilter",
"(",
"self",
"::",
"FILTER_QUERY",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"query",
"=",
"$",
"this",
"->",
"getFilter",
"(",
"self",
... | Determines if this has the database query filter enabled.
@return bool | [
"Determines",
"if",
"this",
"has",
"the",
"database",
"query",
"filter",
"enabled",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L363-L370 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.getQueryCriteria | public function getQueryCriteria()
{
if (false === $this->isQuery()) {
return [];
}
$queryKey = self::FILTER_QUERY;
$criteriaKey = self::FILTER_QUERY_CRITERIA;
$decoded = @json_decode($this->getFilter($queryKey)[$criteriaKey], true);
if (!is_array($decod... | php | public function getQueryCriteria()
{
if (false === $this->isQuery()) {
return [];
}
$queryKey = self::FILTER_QUERY;
$criteriaKey = self::FILTER_QUERY_CRITERIA;
$decoded = @json_decode($this->getFilter($queryKey)[$criteriaKey], true);
if (!is_array($decod... | [
"public",
"function",
"getQueryCriteria",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"isQuery",
"(",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"queryKey",
"=",
"self",
"::",
"FILTER_QUERY",
";",
"$",
"criteriaKey",
"=",
"sel... | Gets the query criteria value.
@return array | [
"Gets",
"the",
"query",
"criteria",
"value",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L377-L392 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.getFilter | public function getFilter($key)
{
if (!isset($this->filters[$key])) {
return null;
}
return $this->filters[$key];
} | php | public function getFilter($key)
{
if (!isset($this->filters[$key])) {
return null;
}
return $this->filters[$key];
} | [
"public",
"function",
"getFilter",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"filters",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"filters",
"[",
"$",
"key",
... | Gets a specific filter, by key.
@param string $key
@return mixed|null | [
"Gets",
"a",
"specific",
"filter",
"by",
"key",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L519-L525 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.parsePath | private function parsePath($path)
{
$parts = explode('/', trim($path, '/'));
for ($i = 0; $i < 1; $i++) {
// All paths must contain /{workspace_entityType}
if (false === $this->issetNotEmpty($i, $parts)) {
throw RestException::invalidEndpoint($path);
... | php | private function parsePath($path)
{
$parts = explode('/', trim($path, '/'));
for ($i = 0; $i < 1; $i++) {
// All paths must contain /{workspace_entityType}
if (false === $this->issetNotEmpty($i, $parts)) {
throw RestException::invalidEndpoint($path);
... | [
"private",
"function",
"parsePath",
"(",
"$",
"path",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'/'",
",",
"trim",
"(",
"$",
"path",
",",
"'/'",
")",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"1",
";",
"$",
"i",
"++"... | Parses the incoming request path and sets appropriate properties on this RestRequest object.
@param string $path
@return self
@throws RestException | [
"Parses",
"the",
"incoming",
"request",
"path",
"and",
"sets",
"appropriate",
"properties",
"on",
"this",
"RestRequest",
"object",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L580-L593 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.extractRelationship | private function extractRelationship(array $parts)
{
if (isset($parts[2])) {
if ('relationships' === $parts[2]) {
if (!isset($parts[3])) {
throw RestException::invalidRelationshipEndpoint($this->parsedUri['path']);
}
$this->rela... | php | private function extractRelationship(array $parts)
{
if (isset($parts[2])) {
if ('relationships' === $parts[2]) {
if (!isset($parts[3])) {
throw RestException::invalidRelationshipEndpoint($this->parsedUri['path']);
}
$this->rela... | [
"private",
"function",
"extractRelationship",
"(",
"array",
"$",
"parts",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"parts",
"[",
"2",
"]",
")",
")",
"{",
"if",
"(",
"'relationships'",
"===",
"$",
"parts",
"[",
"2",
"]",
")",
"{",
"if",
"(",
"!",
"... | Extracts the entity relationship properties from an array of path parts.
@param array $parts
@return self | [
"Extracts",
"the",
"entity",
"relationship",
"properties",
"from",
"an",
"array",
"of",
"path",
"parts",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L627-L646 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.parseQueryString | private function parseQueryString($queryString)
{
parse_str($queryString, $parsed);
$supported = $this->getSupportedParams();
foreach ($parsed as $param => $value) {
if (!isset($supported[$param])) {
throw RestException::unsupportedQueryParam($param, array_keys($... | php | private function parseQueryString($queryString)
{
parse_str($queryString, $parsed);
$supported = $this->getSupportedParams();
foreach ($parsed as $param => $value) {
if (!isset($supported[$param])) {
throw RestException::unsupportedQueryParam($param, array_keys($... | [
"private",
"function",
"parseQueryString",
"(",
"$",
"queryString",
")",
"{",
"parse_str",
"(",
"$",
"queryString",
",",
"$",
"parsed",
")",
";",
"$",
"supported",
"=",
"$",
"this",
"->",
"getSupportedParams",
"(",
")",
";",
"foreach",
"(",
"$",
"parsed",
... | Parses the incoming request query string and sets appropriate properties on this RestRequest object.
@param string $queryString
@return self
@throws RestException | [
"Parses",
"the",
"incoming",
"request",
"query",
"string",
"and",
"sets",
"appropriate",
"properties",
"on",
"this",
"RestRequest",
"object",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L655-L672 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.extractInclusions | private function extractInclusions(array $params)
{
if (false === $this->issetNotEmpty(self::PARAM_INCLUSIONS, $params)) {
if (true === $this->config->includeAllByDefault()) {
$this->inclusions = ['*' => true];
}
return $this;
}
$inclusions... | php | private function extractInclusions(array $params)
{
if (false === $this->issetNotEmpty(self::PARAM_INCLUSIONS, $params)) {
if (true === $this->config->includeAllByDefault()) {
$this->inclusions = ['*' => true];
}
return $this;
}
$inclusions... | [
"private",
"function",
"extractInclusions",
"(",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"issetNotEmpty",
"(",
"self",
"::",
"PARAM_INCLUSIONS",
",",
"$",
"params",
")",
")",
"{",
"if",
"(",
"true",
"===",
"$",
"... | Extracts relationship inclusions from an array of query params.
@param array $params
@return self | [
"Extracts",
"relationship",
"inclusions",
"from",
"an",
"array",
"of",
"query",
"params",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L680-L696 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.extractSorting | private function extractSorting(array $params)
{
if (false === $this->issetNotEmpty(self::PARAM_SORTING, $params)) {
return $this;
}
$sort = explode(',', $params[self::PARAM_SORTING]);
$this->sorting = [];
foreach ($sort as $field) {
$direction = 1;
... | php | private function extractSorting(array $params)
{
if (false === $this->issetNotEmpty(self::PARAM_SORTING, $params)) {
return $this;
}
$sort = explode(',', $params[self::PARAM_SORTING]);
$this->sorting = [];
foreach ($sort as $field) {
$direction = 1;
... | [
"private",
"function",
"extractSorting",
"(",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"issetNotEmpty",
"(",
"self",
"::",
"PARAM_SORTING",
",",
"$",
"params",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
... | Extracts sorting criteria from an array of query params.
@param array $params
@return self | [
"Extracts",
"sorting",
"criteria",
"from",
"an",
"array",
"of",
"query",
"params",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L704-L720 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.extractFields | private function extractFields(array $params)
{
if (false === $this->issetNotEmpty(self::PARAM_FIELDSETS, $params)) {
return $this;
}
$fields = $params[self::PARAM_FIELDSETS];
if (!is_array($fields)) {
throw RestException::invalidQueryParam(self::PARAM_FIELDSE... | php | private function extractFields(array $params)
{
if (false === $this->issetNotEmpty(self::PARAM_FIELDSETS, $params)) {
return $this;
}
$fields = $params[self::PARAM_FIELDSETS];
if (!is_array($fields)) {
throw RestException::invalidQueryParam(self::PARAM_FIELDSE... | [
"private",
"function",
"extractFields",
"(",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"issetNotEmpty",
"(",
"self",
"::",
"PARAM_FIELDSETS",
",",
"$",
"params",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",... | Extracts fields to return from an array of query params.
@param array $params
@return self | [
"Extracts",
"fields",
"to",
"return",
"from",
"an",
"array",
"of",
"query",
"params",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L728-L741 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.extractFilters | private function extractFilters(array $params)
{
if (false === $this->issetNotEmpty(self::PARAM_FILTERING, $params)) {
return $this;
}
$filters = $params[self::PARAM_FILTERING];
if (!is_array($filters)) {
throw RestException::invalidQueryParam(self::PARAM_FILT... | php | private function extractFilters(array $params)
{
if (false === $this->issetNotEmpty(self::PARAM_FILTERING, $params)) {
return $this;
}
$filters = $params[self::PARAM_FILTERING];
if (!is_array($filters)) {
throw RestException::invalidQueryParam(self::PARAM_FILT... | [
"private",
"function",
"extractFilters",
"(",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"issetNotEmpty",
"(",
"self",
"::",
"PARAM_FILTERING",
",",
"$",
"params",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$"... | Extracts filtering criteria from an array of query params.
@param array $params
@return self | [
"Extracts",
"filtering",
"criteria",
"from",
"an",
"array",
"of",
"query",
"params",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L771-L784 | train |
as3io/modlr | src/Rest/RestRequest.php | RestRequest.getSupportedParams | public function getSupportedParams()
{
return [
self::PARAM_INCLUSIONS => true,
self::PARAM_FIELDSETS => true,
self::PARAM_SORTING => true,
self::PARAM_PAGINATION => true,
self::PARAM_FILTERING => true,
];
} | php | public function getSupportedParams()
{
return [
self::PARAM_INCLUSIONS => true,
self::PARAM_FIELDSETS => true,
self::PARAM_SORTING => true,
self::PARAM_PAGINATION => true,
self::PARAM_FILTERING => true,
];
} | [
"public",
"function",
"getSupportedParams",
"(",
")",
"{",
"return",
"[",
"self",
"::",
"PARAM_INCLUSIONS",
"=>",
"true",
",",
"self",
"::",
"PARAM_FIELDSETS",
"=>",
"true",
",",
"self",
"::",
"PARAM_SORTING",
"=>",
"true",
",",
"self",
"::",
"PARAM_PAGINATION... | Gets query string parameters that this request supports.
@return array | [
"Gets",
"query",
"string",
"parameters",
"that",
"this",
"request",
"supports",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Rest/RestRequest.php#L791-L800 | train |
soliantconsulting/SoliantEntityAudit | src/SoliantEntityAudit/Controller/IndexController.php | IndexController.userAction | public function userAction()
{
$page = (int)$this->getEvent()->getRouteMatch()->getParam('page');
$userId = (int)$this->getEvent()->getRouteMatch()->getParam('userId');
$user = \SoliantEntityAudit\Module::getModuleOptions()->getEntityManager()
->getRepository(\SoliantEntityAudit... | php | public function userAction()
{
$page = (int)$this->getEvent()->getRouteMatch()->getParam('page');
$userId = (int)$this->getEvent()->getRouteMatch()->getParam('userId');
$user = \SoliantEntityAudit\Module::getModuleOptions()->getEntityManager()
->getRepository(\SoliantEntityAudit... | [
"public",
"function",
"userAction",
"(",
")",
"{",
"$",
"page",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getEvent",
"(",
")",
"->",
"getRouteMatch",
"(",
")",
"->",
"getParam",
"(",
"'page'",
")",
";",
"$",
"userId",
"=",
"(",
"int",
")",
"$",
"... | Renders a paginated list of revisions for the given user
@param int $page | [
"Renders",
"a",
"paginated",
"list",
"of",
"revisions",
"for",
"the",
"given",
"user"
] | 9e77a39ca8399d43c2113c532f3cf2df5349d4a5 | https://github.com/soliantconsulting/SoliantEntityAudit/blob/9e77a39ca8399d43c2113c532f3cf2df5349d4a5/src/SoliantEntityAudit/Controller/IndexController.php#L31-L43 | train |
soliantconsulting/SoliantEntityAudit | src/SoliantEntityAudit/Controller/IndexController.php | IndexController.revisionEntityAction | public function revisionEntityAction()
{
$this->mapAllAuditedClasses();
$page = (int)$this->getEvent()->getRouteMatch()->getParam('page');
$revisionEntityId = (int) $this->getEvent()->getRouteMatch()->getParam('revisionEntityId');
$revisionEntity = \SoliantEntityAudit\Module::getMo... | php | public function revisionEntityAction()
{
$this->mapAllAuditedClasses();
$page = (int)$this->getEvent()->getRouteMatch()->getParam('page');
$revisionEntityId = (int) $this->getEvent()->getRouteMatch()->getParam('revisionEntityId');
$revisionEntity = \SoliantEntityAudit\Module::getMo... | [
"public",
"function",
"revisionEntityAction",
"(",
")",
"{",
"$",
"this",
"->",
"mapAllAuditedClasses",
"(",
")",
";",
"$",
"page",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getEvent",
"(",
")",
"->",
"getRouteMatch",
"(",
")",
"->",
"getParam",
"(",
"... | Show the detail for a specific revision entity | [
"Show",
"the",
"detail",
"for",
"a",
"specific",
"revision",
"entity"
] | 9e77a39ca8399d43c2113c532f3cf2df5349d4a5 | https://github.com/soliantconsulting/SoliantEntityAudit/blob/9e77a39ca8399d43c2113c532f3cf2df5349d4a5/src/SoliantEntityAudit/Controller/IndexController.php#L70-L91 | train |
soliantconsulting/SoliantEntityAudit | src/SoliantEntityAudit/Controller/IndexController.php | IndexController.entityAction | public function entityAction()
{
$page = (int)$this->getEvent()->getRouteMatch()->getParam('page');
$entityClass = $this->getEvent()->getRouteMatch()->getParam('entityClass');
return array(
'entityClass' => $entityClass,
'page' => $page,
);
} | php | public function entityAction()
{
$page = (int)$this->getEvent()->getRouteMatch()->getParam('page');
$entityClass = $this->getEvent()->getRouteMatch()->getParam('entityClass');
return array(
'entityClass' => $entityClass,
'page' => $page,
);
} | [
"public",
"function",
"entityAction",
"(",
")",
"{",
"$",
"page",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"getEvent",
"(",
")",
"->",
"getRouteMatch",
"(",
")",
"->",
"getParam",
"(",
"'page'",
")",
";",
"$",
"entityClass",
"=",
"$",
"this",
"->",
... | Lists revisions for the supplied entity. Takes an audited entity class or audit class
@param string $className
@param string $id | [
"Lists",
"revisions",
"for",
"the",
"supplied",
"entity",
".",
"Takes",
"an",
"audited",
"entity",
"class",
"or",
"audit",
"class"
] | 9e77a39ca8399d43c2113c532f3cf2df5349d4a5 | https://github.com/soliantconsulting/SoliantEntityAudit/blob/9e77a39ca8399d43c2113c532f3cf2df5349d4a5/src/SoliantEntityAudit/Controller/IndexController.php#L99-L108 | train |
edwardstock/forker | src/system/SharedMemoryManager.php | SharedMemoryManager.packHeader | private function packHeader(int $id, int $offset, int $size, int $flags = 0): string
{
return pack('SSQI', $id, $offset, $size, $flags);
} | php | private function packHeader(int $id, int $offset, int $size, int $flags = 0): string
{
return pack('SSQI', $id, $offset, $size, $flags);
} | [
"private",
"function",
"packHeader",
"(",
"int",
"$",
"id",
",",
"int",
"$",
"offset",
",",
"int",
"$",
"size",
",",
"int",
"$",
"flags",
"=",
"0",
")",
":",
"string",
"{",
"return",
"pack",
"(",
"'SSQI'",
",",
"$",
"id",
",",
"$",
"offset",
",",... | Blocking method, writes process result state to state file
@param int $id
@param int $offset
@param int $size
@param int $flags
@return string binary data
sizes: 2 (ushort) + 2 (ushort) + 8(ulong long) + 4(uint) bytes, order - machine-dependent
@see SharedMemoryManager::F_SERIALIZED and other flags | [
"Blocking",
"method",
"writes",
"process",
"result",
"state",
"to",
"state",
"file"
] | 024a6d1d8a34a4fffb59717e066cad01a78141b5 | https://github.com/edwardstock/forker/blob/024a6d1d8a34a4fffb59717e066cad01a78141b5/src/system/SharedMemoryManager.php#L323-L326 | train |
activecollab/databaseconnection | src/Connection/MysqliConnection.php | MysqliConnection.& | public function &setDatabaseName($database_name, $select_database = true)
{
if (empty($select_database) || $this->link->select_db($database_name)) {
$this->database_name = $database_name;
} else {
throw new ConnectionException("Failed to select database '$database_name'");
... | php | public function &setDatabaseName($database_name, $select_database = true)
{
if (empty($select_database) || $this->link->select_db($database_name)) {
$this->database_name = $database_name;
} else {
throw new ConnectionException("Failed to select database '$database_name'");
... | [
"public",
"function",
"&",
"setDatabaseName",
"(",
"$",
"database_name",
",",
"$",
"select_database",
"=",
"true",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"select_database",
")",
"||",
"$",
"this",
"->",
"link",
"->",
"select_db",
"(",
"$",
"database_name"... | Set database name and optionally select that database.
@param string $database_name
@param bool|true $select_database
@return $this
@throws ConnectionException | [
"Set",
"database",
"name",
"and",
"optionally",
"select",
"that",
"database",
"."
] | f38accc083863262325858a3d72a5afb6b4513f8 | https://github.com/activecollab/databaseconnection/blob/f38accc083863262325858a3d72a5afb6b4513f8/src/Connection/MysqliConnection.php#L71-L80 | train |
activecollab/databaseconnection | src/Connection/MysqliConnection.php | MysqliConnection.tryToRecoverFromFailedQuery | private function tryToRecoverFromFailedQuery($sql, $arguments, $load_mode, $return_mode)
{
switch ($this->link->errno) {
// Non-transactional tables not rolled back!
case 1196:
return null;
// Server gone away
case 2006:
case 2013... | php | private function tryToRecoverFromFailedQuery($sql, $arguments, $load_mode, $return_mode)
{
switch ($this->link->errno) {
// Non-transactional tables not rolled back!
case 1196:
return null;
// Server gone away
case 2006:
case 2013... | [
"private",
"function",
"tryToRecoverFromFailedQuery",
"(",
"$",
"sql",
",",
"$",
"arguments",
",",
"$",
"load_mode",
",",
"$",
"return_mode",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"link",
"->",
"errno",
")",
"{",
"// Non-transactional tables not rolled bac... | Try to recover from failed query.
@param string $sql
@param array|null $arguments
@param $load_mode
@param $return_mode
@return array|bool|DateTime|float|int|mixed|null|string|void
@throws QueryException | [
"Try",
"to",
"recover",
"from",
"failed",
"query",
"."
] | f38accc083863262325858a3d72a5afb6b4513f8 | https://github.com/activecollab/databaseconnection/blob/f38accc083863262325858a3d72a5afb6b4513f8/src/Connection/MysqliConnection.php#L778-L799 | train |
activecollab/databaseconnection | src/Connection/MysqliConnection.php | MysqliConnection.onLogQuery | public function onLogQuery(callable $callback = null)
{
if ($callback === null || is_callable($callback)) {
$this->on_log_query = $callback;
} else {
throw new InvalidArgumentException('Callback needs to be NULL or callable');
}
} | php | public function onLogQuery(callable $callback = null)
{
if ($callback === null || is_callable($callback)) {
$this->on_log_query = $callback;
} else {
throw new InvalidArgumentException('Callback needs to be NULL or callable');
}
} | [
"public",
"function",
"onLogQuery",
"(",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"callback",
"===",
"null",
"||",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"$",
"this",
"->",
"on_log_query",
"=",
"$",
"callback",
"... | Set a callback that will receive every query after we run it.
Callback should accept two parameters: first for SQL that was ran, and second for time that it took to run
@param callable|null $callback | [
"Set",
"a",
"callback",
"that",
"will",
"receive",
"every",
"query",
"after",
"we",
"run",
"it",
"."
] | f38accc083863262325858a3d72a5afb6b4513f8 | https://github.com/activecollab/databaseconnection/blob/f38accc083863262325858a3d72a5afb6b4513f8/src/Connection/MysqliConnection.php#L955-L962 | train |
QoboLtd/cakephp-translations | src/Model/Table/TranslationsTable.php | TranslationsTable.getLanguageId | public function getLanguageId(string $shortCode): string
{
$query = $this->Languages->find('all', [
'conditions' => ['Languages.code' => $shortCode]
]);
$language = $query->first();
if (empty($language->id)) {
throw new InvalidArgumentException("Unsupported l... | php | public function getLanguageId(string $shortCode): string
{
$query = $this->Languages->find('all', [
'conditions' => ['Languages.code' => $shortCode]
]);
$language = $query->first();
if (empty($language->id)) {
throw new InvalidArgumentException("Unsupported l... | [
"public",
"function",
"getLanguageId",
"(",
"string",
"$",
"shortCode",
")",
":",
"string",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"Languages",
"->",
"find",
"(",
"'all'",
",",
"[",
"'conditions'",
"=>",
"[",
"'Languages.code'",
"=>",
"$",
"shortCode",... | Retrive language ID by code
@throws \InvalidArgumentException for unknown short code
@param string $shortCode language code i.e. ru, cn etc
@return string language's uuid | [
"Retrive",
"language",
"ID",
"by",
"code"
] | b488eafce71a55d517b975342487812f0d2d375a | https://github.com/QoboLtd/cakephp-translations/blob/b488eafce71a55d517b975342487812f0d2d375a/src/Model/Table/TranslationsTable.php#L185-L197 | train |
andyburton/Sonic-Framework | src/Resource/Crypt.php | Crypt._genRijndael256IV | public static function _genRijndael256IV ($cypher = FALSE)
{
// If a module has not been passed
if (!$cypher)
{
// Open the cypher
$cypher = mcrypt_module_open ('rijndael-256', '', 'ofb', '');
}
// Create the IV
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($cypher), MCRYPT... | php | public static function _genRijndael256IV ($cypher = FALSE)
{
// If a module has not been passed
if (!$cypher)
{
// Open the cypher
$cypher = mcrypt_module_open ('rijndael-256', '', 'ofb', '');
}
// Create the IV
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($cypher), MCRYPT... | [
"public",
"static",
"function",
"_genRijndael256IV",
"(",
"$",
"cypher",
"=",
"FALSE",
")",
"{",
"// If a module has not been passed",
"if",
"(",
"!",
"$",
"cypher",
")",
"{",
"// Open the cypher",
"$",
"cypher",
"=",
"mcrypt_module_open",
"(",
"'rijndael-256'",
"... | Generate a rijndael 256 initialisation vector
@param resource $cypher Encryption Resource
@return string | [
"Generate",
"a",
"rijndael",
"256",
"initialisation",
"vector"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/Crypt.php#L70-L96 | train |
andyburton/Sonic-Framework | src/Resource/Crypt.php | Crypt._encryptRijndael256 | public static function _encryptRijndael256 ($str, $key, $iv = FALSE)
{
// If the string is empty
if (empty ($str))
{
return '';
}
// Open the cypher
$cypher = mcrypt_module_open ('rijndael-256', '', 'ofb', '');
// Create the IV if there is none
if ($iv === FALSE)
{
$iv = sel... | php | public static function _encryptRijndael256 ($str, $key, $iv = FALSE)
{
// If the string is empty
if (empty ($str))
{
return '';
}
// Open the cypher
$cypher = mcrypt_module_open ('rijndael-256', '', 'ofb', '');
// Create the IV if there is none
if ($iv === FALSE)
{
$iv = sel... | [
"public",
"static",
"function",
"_encryptRijndael256",
"(",
"$",
"str",
",",
"$",
"key",
",",
"$",
"iv",
"=",
"FALSE",
")",
"{",
"// If the string is empty",
"if",
"(",
"empty",
"(",
"$",
"str",
")",
")",
"{",
"return",
"''",
";",
"}",
"// Open the cyphe... | Encrypt and return a string using the Rijndael 256 cypher
@param string $str String to encrypt
@param string $key Key to encrypt the string
@param string $iv Initialisation vector
@return string | [
"Encrypt",
"and",
"return",
"a",
"string",
"using",
"the",
"Rijndael",
"256",
"cypher"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/Crypt.php#L107-L152 | train |
andyburton/Sonic-Framework | src/Resource/Crypt.php | Crypt._decryptRijndael256 | public static function _decryptRijndael256 ($str, $key, $iv)
{
// If the string is empty
if (empty ($str))
{
return '';
}
// Open the cypher
$cypher = mcrypt_module_open ('rijndael-256', '', 'ofb', '');
// Set Key
$key = substr ($key, 0, mcrypt_enc_get_key_size ($cypher));
/... | php | public static function _decryptRijndael256 ($str, $key, $iv)
{
// If the string is empty
if (empty ($str))
{
return '';
}
// Open the cypher
$cypher = mcrypt_module_open ('rijndael-256', '', 'ofb', '');
// Set Key
$key = substr ($key, 0, mcrypt_enc_get_key_size ($cypher));
/... | [
"public",
"static",
"function",
"_decryptRijndael256",
"(",
"$",
"str",
",",
"$",
"key",
",",
"$",
"iv",
")",
"{",
"// If the string is empty",
"if",
"(",
"empty",
"(",
"$",
"str",
")",
")",
"{",
"return",
"''",
";",
"}",
"// Open the cypher",
"$",
"cyph... | Decrypt and return a string using the Rijndael 256 cypher
@param string $str String to decrypt
@param string $key Key to decrypt the string
@param string $ic Initialisation vector
@return string | [
"Decrypt",
"and",
"return",
"a",
"string",
"using",
"the",
"Rijndael",
"256",
"cypher"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/Crypt.php#L163-L201 | train |
canax/anax-ramverk1-me | src/StyleChooser/StyleChooserController.php | StyleChooserController.updateActionPost | public function updateActionPost() : object
{
$response = $this->di->get("response");
$request = $this->di->get("request");
$session = $this->di->get("session");
$key = $request->getPost("stylechooser");
if ($key === "none") {
$session->set("flashmessage", "Unset... | php | public function updateActionPost() : object
{
$response = $this->di->get("response");
$request = $this->di->get("request");
$session = $this->di->get("session");
$key = $request->getPost("stylechooser");
if ($key === "none") {
$session->set("flashmessage", "Unset... | [
"public",
"function",
"updateActionPost",
"(",
")",
":",
"object",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"di",
"->",
"get",
"(",
"\"response\"",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"di",
"->",
"get",
"(",
"\"request\"",
")",
";"... | Update current selected style.
@return object | [
"Update",
"current",
"selected",
"style",
"."
] | 592d5e7891f20b68047009ae2c9efdff45763543 | https://github.com/canax/anax-ramverk1-me/blob/592d5e7891f20b68047009ae2c9efdff45763543/src/StyleChooser/StyleChooserController.php#L111-L127 | train |
canax/anax-ramverk1-me | src/StyleChooser/StyleChooserController.php | StyleChooserController.updateActionGet | public function updateActionGet($style) : object
{
$response = $this->di->get("response");
$session = $this->di->get("session");
$key = $this->cssUrl . "/" . $style . ".css";
$keyMin = $this->cssUrl . "/" . $style . ".min.css";
if ($style === "none") {
$session-... | php | public function updateActionGet($style) : object
{
$response = $this->di->get("response");
$session = $this->di->get("session");
$key = $this->cssUrl . "/" . $style . ".css";
$keyMin = $this->cssUrl . "/" . $style . ".min.css";
if ($style === "none") {
$session-... | [
"public",
"function",
"updateActionGet",
"(",
"$",
"style",
")",
":",
"object",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"di",
"->",
"get",
"(",
"\"response\"",
")",
";",
"$",
"session",
"=",
"$",
"this",
"->",
"di",
"->",
"get",
"(",
"\"session... | Update current selected style using a GET url and redirect to last
page visited.
@param string $style the key to the style to use.
@return object | [
"Update",
"current",
"selected",
"style",
"using",
"a",
"GET",
"url",
"and",
"redirect",
"to",
"last",
"page",
"visited",
"."
] | 592d5e7891f20b68047009ae2c9efdff45763543 | https://github.com/canax/anax-ramverk1-me/blob/592d5e7891f20b68047009ae2c9efdff45763543/src/StyleChooser/StyleChooserController.php#L139-L160 | train |
schpill/thin | src/Reflection.php | Reflection.get | public function get($class = null)
{
$class = $this->getClass($class);
if (Arrays::exists($class, $this->reflections)) {
return $this->reflections[$class];
}
throw new Exception("Class not found: $class");
} | php | public function get($class = null)
{
$class = $this->getClass($class);
if (Arrays::exists($class, $this->reflections)) {
return $this->reflections[$class];
}
throw new Exception("Class not found: $class");
} | [
"public",
"function",
"get",
"(",
"$",
"class",
"=",
"null",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"getClass",
"(",
"$",
"class",
")",
";",
"if",
"(",
"Arrays",
"::",
"exists",
"(",
"$",
"class",
",",
"$",
"this",
"->",
"reflections",
"... | Get an Instantiated ReflectionClass.
@param string $class Optional name of a class
@return mixed null or a ReflectionClass instance
@throws Exception if class was not found | [
"Get",
"an",
"Instantiated",
"ReflectionClass",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Reflection.php#L58-L67 | train |
ScreamingDev/phpsemver | lib/PHPSemVer/Console/AbstractCommand.php | AbstractCommand.appendIgnorePattern | protected function appendIgnorePattern($config, $latestWrapper, $previousWrapper)
{
$latestWrapper->setFilter($config->filter());
$previousWrapper->setFilter($config->filter());
} | php | protected function appendIgnorePattern($config, $latestWrapper, $previousWrapper)
{
$latestWrapper->setFilter($config->filter());
$previousWrapper->setFilter($config->filter());
} | [
"protected",
"function",
"appendIgnorePattern",
"(",
"$",
"config",
",",
"$",
"latestWrapper",
",",
"$",
"previousWrapper",
")",
"{",
"$",
"latestWrapper",
"->",
"setFilter",
"(",
"$",
"config",
"->",
"filter",
"(",
")",
")",
";",
"$",
"previousWrapper",
"->... | Add pattern to exclude files.
@param Config $config
@param AbstractWrapper $latestWrapper
@param AbstractWrapper $previousWrapper | [
"Add",
"pattern",
"to",
"exclude",
"files",
"."
] | 11a4bc508f71dee73d4f5fee2e9d39e7984d3e15 | https://github.com/ScreamingDev/phpsemver/blob/11a4bc508f71dee73d4f5fee2e9d39e7984d3e15/lib/PHPSemVer/Console/AbstractCommand.php#L54-L58 | train |
ScreamingDev/phpsemver | lib/PHPSemVer/Console/AbstractCommand.php | AbstractCommand.debug | public function debug($message)
{
if ( ! $this->getOutput()->isDebug()) {
return null;
}
if (func_num_args() > 1) {
$message = vsprintf($message, array_slice(func_get_args(), 1));
}
$this->getOutput()->writeln($message);
} | php | public function debug($message)
{
if ( ! $this->getOutput()->isDebug()) {
return null;
}
if (func_num_args() > 1) {
$message = vsprintf($message, array_slice(func_get_args(), 1));
}
$this->getOutput()->writeln($message);
} | [
"public",
"function",
"debug",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getOutput",
"(",
")",
"->",
"isDebug",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"func_num_args",
"(",
")",
">",
"1",
")",
"{",
"... | Print debug message.
Prints debug message,
if debug mode is enabled (via -vvv).
@param $message
@return null | [
"Print",
"debug",
"message",
"."
] | 11a4bc508f71dee73d4f5fee2e9d39e7984d3e15 | https://github.com/ScreamingDev/phpsemver/blob/11a4bc508f71dee73d4f5fee2e9d39e7984d3e15/lib/PHPSemVer/Console/AbstractCommand.php#L97-L108 | train |
ScreamingDev/phpsemver | lib/PHPSemVer/Console/AbstractCommand.php | AbstractCommand.getEnvironment | public function getEnvironment($config = null)
{
if ( ! $this->environment) {
if (null == $config) {
$config = $this->getConfig();
}
$this->environment = new Environment($config);
}
return $this->environment;
} | php | public function getEnvironment($config = null)
{
if ( ! $this->environment) {
if (null == $config) {
$config = $this->getConfig();
}
$this->environment = new Environment($config);
}
return $this->environment;
} | [
"public",
"function",
"getEnvironment",
"(",
"$",
"config",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"environment",
")",
"{",
"if",
"(",
"null",
"==",
"$",
"config",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"("... | Get environment object.
@param Config $config Deprecated 4.0.0, command config will be used instead.
@return Environment | [
"Get",
"environment",
"object",
"."
] | 11a4bc508f71dee73d4f5fee2e9d39e7984d3e15 | https://github.com/ScreamingDev/phpsemver/blob/11a4bc508f71dee73d4f5fee2e9d39e7984d3e15/lib/PHPSemVer/Console/AbstractCommand.php#L154-L165 | train |
ScreamingDev/phpsemver | lib/PHPSemVer/Console/AbstractCommand.php | AbstractCommand.getPreviousWrapper | protected function getPreviousWrapper()
{
if ($this->previousWrapper) {
return $this->previousWrapper;
}
$input = $this->getInput();
$this->previousWrapper = $this->getWrapperInstance(
$input->getArgument('previous'),
$input->getOption('type')
... | php | protected function getPreviousWrapper()
{
if ($this->previousWrapper) {
return $this->previousWrapper;
}
$input = $this->getInput();
$this->previousWrapper = $this->getWrapperInstance(
$input->getArgument('previous'),
$input->getOption('type')
... | [
"protected",
"function",
"getPreviousWrapper",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"previousWrapper",
")",
"{",
"return",
"$",
"this",
"->",
"previousWrapper",
";",
"}",
"$",
"input",
"=",
"$",
"this",
"->",
"getInput",
"(",
")",
";",
"$",
"th... | Get the wrapper for the VCS.
@return AbstractWrapper | [
"Get",
"the",
"wrapper",
"for",
"the",
"VCS",
"."
] | 11a4bc508f71dee73d4f5fee2e9d39e7984d3e15 | https://github.com/ScreamingDev/phpsemver/blob/11a4bc508f71dee73d4f5fee2e9d39e7984d3e15/lib/PHPSemVer/Console/AbstractCommand.php#L213-L227 | train |
ScreamingDev/phpsemver | lib/PHPSemVer/Console/AbstractCommand.php | AbstractCommand.getWrapperInstance | protected function getWrapperInstance($base, $type = 'Directory')
{
$wrapper = $this->getWrapperClass($type);
if ( ! $wrapper) {
throw new \InvalidArgumentException(
sprintf(
'<error>Unknown wrapper-type "%s"</error>',
$type
... | php | protected function getWrapperInstance($base, $type = 'Directory')
{
$wrapper = $this->getWrapperClass($type);
if ( ! $wrapper) {
throw new \InvalidArgumentException(
sprintf(
'<error>Unknown wrapper-type "%s"</error>',
$type
... | [
"protected",
"function",
"getWrapperInstance",
"(",
"$",
"base",
",",
"$",
"type",
"=",
"'Directory'",
")",
"{",
"$",
"wrapper",
"=",
"$",
"this",
"->",
"getWrapperClass",
"(",
"$",
"type",
")",
";",
"if",
"(",
"!",
"$",
"wrapper",
")",
"{",
"throw",
... | Create a wrapper for the given target.
When the target is a directory,
then the type overridden with "Directory".
@param string $base
@param string $type
@return AbstractWrapper | [
"Create",
"a",
"wrapper",
"for",
"the",
"given",
"target",
"."
] | 11a4bc508f71dee73d4f5fee2e9d39e7984d3e15 | https://github.com/ScreamingDev/phpsemver/blob/11a4bc508f71dee73d4f5fee2e9d39e7984d3e15/lib/PHPSemVer/Console/AbstractCommand.php#L251-L271 | train |
ScreamingDev/phpsemver | lib/PHPSemVer/Console/AbstractCommand.php | AbstractCommand.parseFiles | protected function parseFiles($wrapper, $prefix)
{
$this->verbose($prefix . 'Fetching files ...');
$time = microtime(true);
$fileAmount = count($wrapper->getAllFileNames());
$this->verbose(
sprintf(
"\r" . $prefix . "Collected %d files in %0.2f secon... | php | protected function parseFiles($wrapper, $prefix)
{
$this->verbose($prefix . 'Fetching files ...');
$time = microtime(true);
$fileAmount = count($wrapper->getAllFileNames());
$this->verbose(
sprintf(
"\r" . $prefix . "Collected %d files in %0.2f secon... | [
"protected",
"function",
"parseFiles",
"(",
"$",
"wrapper",
",",
"$",
"prefix",
")",
"{",
"$",
"this",
"->",
"verbose",
"(",
"$",
"prefix",
".",
"'Fetching files ...'",
")",
";",
"$",
"time",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"fileAmount",
... | Parse files within a wrapper.
@param AbstractWrapper $wrapper
@param string $prefix
@return mixed | [
"Parse",
"files",
"within",
"a",
"wrapper",
"."
] | 11a4bc508f71dee73d4f5fee2e9d39e7984d3e15 | https://github.com/ScreamingDev/phpsemver/blob/11a4bc508f71dee73d4f5fee2e9d39e7984d3e15/lib/PHPSemVer/Console/AbstractCommand.php#L348-L386 | train |
ScreamingDev/phpsemver | lib/PHPSemVer/Console/AbstractCommand.php | AbstractCommand.printConfig | protected function printConfig()
{
$config = $this->getConfig();
$output = $this->getOutput();
foreach ($config->ruleSet()->getChildren() as $ruleSet) {
$output->writeln('Using rule set ' . $ruleSet->getName());
if ( ! $output->isDebug()) {
continue;... | php | protected function printConfig()
{
$config = $this->getConfig();
$output = $this->getOutput();
foreach ($config->ruleSet()->getChildren() as $ruleSet) {
$output->writeln('Using rule set ' . $ruleSet->getName());
if ( ! $output->isDebug()) {
continue;... | [
"protected",
"function",
"printConfig",
"(",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"$",
"output",
"=",
"$",
"this",
"->",
"getOutput",
"(",
")",
";",
"foreach",
"(",
"$",
"config",
"->",
"ruleSet",
"(",
")",
"... | Print debug information of the used config.
@param Config $config
@param OutputInterface $output | [
"Print",
"debug",
"information",
"of",
"the",
"used",
"config",
"."
] | 11a4bc508f71dee73d4f5fee2e9d39e7984d3e15 | https://github.com/ScreamingDev/phpsemver/blob/11a4bc508f71dee73d4f5fee2e9d39e7984d3e15/lib/PHPSemVer/Console/AbstractCommand.php#L394-L415 | train |
ScreamingDev/phpsemver | lib/PHPSemVer/Console/AbstractCommand.php | AbstractCommand.resolveConfigFile | protected function resolveConfigFile()
{
$ruleSet = $this->getInput()->getOption('ruleSet');
if (null === $ruleSet && file_exists('phpsemver.xml')) {
return 'phpsemver.xml';
}
if (null === $ruleSet) {
$ruleSet = 'SemVer2';
}
if (file_exists(... | php | protected function resolveConfigFile()
{
$ruleSet = $this->getInput()->getOption('ruleSet');
if (null === $ruleSet && file_exists('phpsemver.xml')) {
return 'phpsemver.xml';
}
if (null === $ruleSet) {
$ruleSet = 'SemVer2';
}
if (file_exists(... | [
"protected",
"function",
"resolveConfigFile",
"(",
")",
"{",
"$",
"ruleSet",
"=",
"$",
"this",
"->",
"getInput",
"(",
")",
"->",
"getOption",
"(",
"'ruleSet'",
")",
";",
"if",
"(",
"null",
"===",
"$",
"ruleSet",
"&&",
"file_exists",
"(",
"'phpsemver.xml'",... | Resolve path to rule set XML.
@param string $ruleSet Path to XML config file.
@return string | [
"Resolve",
"path",
"to",
"rule",
"set",
"XML",
"."
] | 11a4bc508f71dee73d4f5fee2e9d39e7984d3e15 | https://github.com/ScreamingDev/phpsemver/blob/11a4bc508f71dee73d4f5fee2e9d39e7984d3e15/lib/PHPSemVer/Console/AbstractCommand.php#L424-L448 | train |
infusephp/auth | src/Models/UserLink.php | UserLink.url | public function url()
{
if ($this->type === self::FORGOT_PASSWORD) {
return $this->getApp()['base_url'].'users/forgot/'.$this->link;
} else if ($this->type === self::TEMPORARY) {
return $this->getApp()['base_url'].'users/signup/'.$this->link;
}
return false;
... | php | public function url()
{
if ($this->type === self::FORGOT_PASSWORD) {
return $this->getApp()['base_url'].'users/forgot/'.$this->link;
} else if ($this->type === self::TEMPORARY) {
return $this->getApp()['base_url'].'users/signup/'.$this->link;
}
return false;
... | [
"public",
"function",
"url",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"type",
"===",
"self",
"::",
"FORGOT_PASSWORD",
")",
"{",
"return",
"$",
"this",
"->",
"getApp",
"(",
")",
"[",
"'base_url'",
"]",
".",
"'users/forgot/'",
".",
"$",
"this",
"->... | Gets the URL for this link.
@return string|false | [
"Gets",
"the",
"URL",
"for",
"this",
"link",
"."
] | 720280b4b2635572f331afe8d082e3e88cf54eb7 | https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Models/UserLink.php#L84-L93 | train |
graze/csv-token | src/Tokeniser/StreamTokeniser.php | StreamTokeniser.getTokens | public function getTokens()
{
fseek($this->stream, 0);
$this->buffer = new StreamBuffer($this->stream, static::BUFFER_SIZE, $this->minLength);
$this->buffer->read();
/** @var Token $last */
$last = null;
while (!$this->buffer->isEof()) {
foreach ($this->... | php | public function getTokens()
{
fseek($this->stream, 0);
$this->buffer = new StreamBuffer($this->stream, static::BUFFER_SIZE, $this->minLength);
$this->buffer->read();
/** @var Token $last */
$last = null;
while (!$this->buffer->isEof()) {
foreach ($this->... | [
"public",
"function",
"getTokens",
"(",
")",
"{",
"fseek",
"(",
"$",
"this",
"->",
"stream",
",",
"0",
")",
";",
"$",
"this",
"->",
"buffer",
"=",
"new",
"StreamBuffer",
"(",
"$",
"this",
"->",
"stream",
",",
"static",
"::",
"BUFFER_SIZE",
",",
"$",
... | Loop through the stream, pulling maximum type length each time, find the largest type that matches and create a
token, then move on length characters
@return Iterator | [
"Loop",
"through",
"the",
"stream",
"pulling",
"maximum",
"type",
"length",
"each",
"time",
"find",
"the",
"largest",
"type",
"that",
"matches",
"and",
"create",
"a",
"token",
"then",
"move",
"on",
"length",
"characters"
] | ad11cfc83e7f0cae56da6844f9216bbaf5c8dcb8 | https://github.com/graze/csv-token/blob/ad11cfc83e7f0cae56da6844f9216bbaf5c8dcb8/src/Tokeniser/StreamTokeniser.php#L61-L104 | train |
pmdevelopment/tool-bundle | Components/Traits/HasDoctrineTrait.php | HasDoctrineTrait.persistAndFlush | public function persistAndFlush()
{
if (0 === func_num_args()) {
throw new \LogicException('Missing arguments');
}
$persists = [];
$entities = func_get_args();
foreach ($entities as $entity) {
if (true === is_array($entity)) {
$persis... | php | public function persistAndFlush()
{
if (0 === func_num_args()) {
throw new \LogicException('Missing arguments');
}
$persists = [];
$entities = func_get_args();
foreach ($entities as $entity) {
if (true === is_array($entity)) {
$persis... | [
"public",
"function",
"persistAndFlush",
"(",
")",
"{",
"if",
"(",
"0",
"===",
"func_num_args",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Missing arguments'",
")",
";",
"}",
"$",
"persists",
"=",
"[",
"]",
";",
"$",
"entities",
... | Persist and Flush
@return $this | [
"Persist",
"and",
"Flush"
] | 2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129 | https://github.com/pmdevelopment/tool-bundle/blob/2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129/Components/Traits/HasDoctrineTrait.php#L35-L59 | train |
pmdevelopment/tool-bundle | Components/Traits/HasDoctrineTrait.php | HasDoctrineTrait.removeAndFlush | public function removeAndFlush()
{
if (0 === func_num_args()) {
throw new \LogicException('Missing arguments');
}
foreach (func_get_args() as $remove) {
$this->getDoctrine()->getManager()->remove($remove);
}
$this->getDoctrine()->getManager()->flush(... | php | public function removeAndFlush()
{
if (0 === func_num_args()) {
throw new \LogicException('Missing arguments');
}
foreach (func_get_args() as $remove) {
$this->getDoctrine()->getManager()->remove($remove);
}
$this->getDoctrine()->getManager()->flush(... | [
"public",
"function",
"removeAndFlush",
"(",
")",
"{",
"if",
"(",
"0",
"===",
"func_num_args",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Missing arguments'",
")",
";",
"}",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"r... | Remove and Flush
@return $this | [
"Remove",
"and",
"Flush"
] | 2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129 | https://github.com/pmdevelopment/tool-bundle/blob/2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129/Components/Traits/HasDoctrineTrait.php#L66-L79 | train |
amarcinkowski/hospitalplugin | src/WP/Menu.php | Menu.registerPages | public function registerPages()
{
foreach ($this->menus as $menu) {
$this->registerPage($menu['title'], $menu['cap'], $menu['link'], $menu['class'], $menu['callback'], $menu['type']);
}
$this->hideMenu();
} | php | public function registerPages()
{
foreach ($this->menus as $menu) {
$this->registerPage($menu['title'], $menu['cap'], $menu['link'], $menu['class'], $menu['callback'], $menu['type']);
}
$this->hideMenu();
} | [
"public",
"function",
"registerPages",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"menus",
"as",
"$",
"menu",
")",
"{",
"$",
"this",
"->",
"registerPage",
"(",
"$",
"menu",
"[",
"'title'",
"]",
",",
"$",
"menu",
"[",
"'cap'",
"]",
",",
"$",
... | register menu pages | [
"register",
"menu",
"pages"
] | acdc2be5157abfbdcafb4dcf6c6ba505e291263f | https://github.com/amarcinkowski/hospitalplugin/blob/acdc2be5157abfbdcafb4dcf6c6ba505e291263f/src/WP/Menu.php#L65-L71 | train |
amarcinkowski/hospitalplugin | src/WP/Menu.php | Menu.registerPage | private function registerPage($title, $capabilities, $url_param, $class, $callback, $type)
{
if ($type == 'submenu') {
add_submenu_page($this->url, $title, $title, $capabilities, $url_param, array(
$class,
$callback
));
} else {
add... | php | private function registerPage($title, $capabilities, $url_param, $class, $callback, $type)
{
if ($type == 'submenu') {
add_submenu_page($this->url, $title, $title, $capabilities, $url_param, array(
$class,
$callback
));
} else {
add... | [
"private",
"function",
"registerPage",
"(",
"$",
"title",
",",
"$",
"capabilities",
",",
"$",
"url_param",
",",
"$",
"class",
",",
"$",
"callback",
",",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"==",
"'submenu'",
")",
"{",
"add_submenu_page",
"("... | register using add_submenu_page | [
"register",
"using",
"add_submenu_page"
] | acdc2be5157abfbdcafb4dcf6c6ba505e291263f | https://github.com/amarcinkowski/hospitalplugin/blob/acdc2be5157abfbdcafb4dcf6c6ba505e291263f/src/WP/Menu.php#L86-L99 | train |
graze/csv-token | src/Tokeniser/Token/TokenStore.php | TokenStore.sort | private function sort()
{
// sort by reverse key length
uksort($this->tokens, function ($first, $second) {
return strlen($second) - strlen($first);
});
} | php | private function sort()
{
// sort by reverse key length
uksort($this->tokens, function ($first, $second) {
return strlen($second) - strlen($first);
});
} | [
"private",
"function",
"sort",
"(",
")",
"{",
"// sort by reverse key length",
"uksort",
"(",
"$",
"this",
"->",
"tokens",
",",
"function",
"(",
"$",
"first",
",",
"$",
"second",
")",
"{",
"return",
"strlen",
"(",
"$",
"second",
")",
"-",
"strlen",
"(",
... | Sort the tokens into reverse key length order | [
"Sort",
"the",
"tokens",
"into",
"reverse",
"key",
"length",
"order"
] | ad11cfc83e7f0cae56da6844f9216bbaf5c8dcb8 | https://github.com/graze/csv-token/blob/ad11cfc83e7f0cae56da6844f9216bbaf5c8dcb8/src/Tokeniser/Token/TokenStore.php#L123-L129 | train |
aledefreitas/zlx_security | src/Security/Security.php | Security.validHmac | private function validHmac($hmac, $compareHmac)
{
if(function_exists("hash_equals")) {
return hash_equals($hmac, $compareHmac);
}
$hashLength = mb_strlen($hmac, '8bit');
$compareLength = mb_strlen($compareHmac, '8bit');
if ($hashLength !== $compareLength) {
... | php | private function validHmac($hmac, $compareHmac)
{
if(function_exists("hash_equals")) {
return hash_equals($hmac, $compareHmac);
}
$hashLength = mb_strlen($hmac, '8bit');
$compareLength = mb_strlen($compareHmac, '8bit');
if ($hashLength !== $compareLength) {
... | [
"private",
"function",
"validHmac",
"(",
"$",
"hmac",
",",
"$",
"compareHmac",
")",
"{",
"if",
"(",
"function_exists",
"(",
"\"hash_equals\"",
")",
")",
"{",
"return",
"hash_equals",
"(",
"$",
"hmac",
",",
"$",
"compareHmac",
")",
";",
"}",
"$",
"hashLen... | Validates if the provided hmac is equal to the expected hmac
@param string $hmac Provided hmac
@param string $compareHmac Expected hmac
@return boolean | [
"Validates",
"if",
"the",
"provided",
"hmac",
"is",
"equal",
"to",
"the",
"expected",
"hmac"
] | 3281db6bacfff51695835e1e6fc5bbddcf1a028a | https://github.com/aledefreitas/zlx_security/blob/3281db6bacfff51695835e1e6fc5bbddcf1a028a/src/Security/Security.php#L66-L86 | train |
aledefreitas/zlx_security | src/Security/Security.php | Security.encrypt | public function encrypt($original_string, $cipher_key)
{
$cipher_key = $this->_genKey($cipher_key);
$ivSize = openssl_cipher_iv_length('AES-256-CBC');
$iv = openssl_random_pseudo_bytes($ivSize);
$cipher_text = $iv . openssl_encrypt($original_string, 'AES-256-CBC', $cipher_key, OPEN... | php | public function encrypt($original_string, $cipher_key)
{
$cipher_key = $this->_genKey($cipher_key);
$ivSize = openssl_cipher_iv_length('AES-256-CBC');
$iv = openssl_random_pseudo_bytes($ivSize);
$cipher_text = $iv . openssl_encrypt($original_string, 'AES-256-CBC', $cipher_key, OPEN... | [
"public",
"function",
"encrypt",
"(",
"$",
"original_string",
",",
"$",
"cipher_key",
")",
"{",
"$",
"cipher_key",
"=",
"$",
"this",
"->",
"_genKey",
"(",
"$",
"cipher_key",
")",
";",
"$",
"ivSize",
"=",
"openssl_cipher_iv_length",
"(",
"'AES-256-CBC'",
")",... | Encrypts a string using a secret
@param string $original_string Original string
@param string $cipher_key Secret used to encrypt
@return string | [
"Encrypts",
"a",
"string",
"using",
"a",
"secret"
] | 3281db6bacfff51695835e1e6fc5bbddcf1a028a | https://github.com/aledefreitas/zlx_security/blob/3281db6bacfff51695835e1e6fc5bbddcf1a028a/src/Security/Security.php#L108-L118 | train |
aledefreitas/zlx_security | src/Security/Security.php | Security.decrypt | public function decrypt($cipher_string, $cipher_key)
{
$cipher_key = $this->_genKey($cipher_key);
$hmacSize = 64;
$hmacString = mb_substr($cipher_string, 0, $hmacSize, "8bit");
$cipher_text = mb_substr($cipher_string, $hmacSize, null, "8bit");
if(!$this->validHmac($hmacStri... | php | public function decrypt($cipher_string, $cipher_key)
{
$cipher_key = $this->_genKey($cipher_key);
$hmacSize = 64;
$hmacString = mb_substr($cipher_string, 0, $hmacSize, "8bit");
$cipher_text = mb_substr($cipher_string, $hmacSize, null, "8bit");
if(!$this->validHmac($hmacStri... | [
"public",
"function",
"decrypt",
"(",
"$",
"cipher_string",
",",
"$",
"cipher_key",
")",
"{",
"$",
"cipher_key",
"=",
"$",
"this",
"->",
"_genKey",
"(",
"$",
"cipher_key",
")",
";",
"$",
"hmacSize",
"=",
"64",
";",
"$",
"hmacString",
"=",
"mb_substr",
... | Decrypts a string using a secret
@param string $cipher_string Ciphered string
@param string $cipher_key Secret used to encrypt
@return string | [
"Decrypts",
"a",
"string",
"using",
"a",
"secret"
] | 3281db6bacfff51695835e1e6fc5bbddcf1a028a | https://github.com/aledefreitas/zlx_security/blob/3281db6bacfff51695835e1e6fc5bbddcf1a028a/src/Security/Security.php#L128-L144 | train |
bruno-barros/w.eloquent-framework | src/weloquent/Core/Http/Ajax.php | Ajax.listen | public function listen($action, $logged = 'no', $callable)
{
if (!is_string($action) || strlen($action) == 0)
{
throw new AjaxException("Invalid parameter for the action.");
}
// resolve callable
if (is_callable($callable))
{
$this->registerWithClosure($action, $logged, $callable);
}
else
{
... | php | public function listen($action, $logged = 'no', $callable)
{
if (!is_string($action) || strlen($action) == 0)
{
throw new AjaxException("Invalid parameter for the action.");
}
// resolve callable
if (is_callable($callable))
{
$this->registerWithClosure($action, $logged, $callable);
}
else
{
... | [
"public",
"function",
"listen",
"(",
"$",
"action",
",",
"$",
"logged",
"=",
"'no'",
",",
"$",
"callable",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"action",
")",
"||",
"strlen",
"(",
"$",
"action",
")",
"==",
"0",
")",
"{",
"throw",
"new... | Handle the Ajax response. Run the appropriate
action hooks used by WordPress in order to perform
POST ajax request securely.
Developers have the option to run ajax for the
Front-end, Back-end either users are logged in or not
or both.
@param string $action Your ajax 'action' name
@param string $logged Accepted values ... | [
"Handle",
"the",
"Ajax",
"response",
".",
"Run",
"the",
"appropriate",
"action",
"hooks",
"used",
"by",
"WordPress",
"in",
"order",
"to",
"perform",
"POST",
"ajax",
"request",
"securely",
".",
"Developers",
"have",
"the",
"option",
"to",
"run",
"ajax",
"for"... | d252dcb1ba1b6b1cecf67877d7d6d3ba57ebedbd | https://github.com/bruno-barros/w.eloquent-framework/blob/d252dcb1ba1b6b1cecf67877d7d6d3ba57ebedbd/src/weloquent/Core/Http/Ajax.php#L43-L82 | train |
bruno-barros/w.eloquent-framework | src/weloquent/Core/Http/Ajax.php | Ajax.validate | public function validate($nonce = null, $value = null, $message = null, $data = null)
{
$nonce = ($nonce) ? $nonce : $this->app['request']->get('nonce');
$value = ($value) ? $value : $this->app['config']->get('app.key');
if (!wp_verify_nonce($nonce, $value))
{
$default = ($msg = trans('ajax.invalid')) ? $... | php | public function validate($nonce = null, $value = null, $message = null, $data = null)
{
$nonce = ($nonce) ? $nonce : $this->app['request']->get('nonce');
$value = ($value) ? $value : $this->app['config']->get('app.key');
if (!wp_verify_nonce($nonce, $value))
{
$default = ($msg = trans('ajax.invalid')) ? $... | [
"public",
"function",
"validate",
"(",
"$",
"nonce",
"=",
"null",
",",
"$",
"value",
"=",
"null",
",",
"$",
"message",
"=",
"null",
",",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"nonce",
"=",
"(",
"$",
"nonce",
")",
"?",
"$",
"nonce",
":",
"$",... | Check nonce against app.key
@param null|string $nonce By default will use 'nonce' index
@param null|string $value By default will get app.key
@param null|string $message By default try to get translation on ajax.invalid
@param null|mixed $data | [
"Check",
"nonce",
"against",
"app",
".",
"key"
] | d252dcb1ba1b6b1cecf67877d7d6d3ba57ebedbd | https://github.com/bruno-barros/w.eloquent-framework/blob/d252dcb1ba1b6b1cecf67877d7d6d3ba57ebedbd/src/weloquent/Core/Http/Ajax.php#L93-L111 | train |
kmfk/slowdb | src/File.php | File.insert | public function insert($key, $value)
{
$this->file->flock(LOCK_SH);
$this->file->fseek(0, SEEK_END);
$position = $this->file->ftell();
if (is_array($value) || is_object($value)) {
$value = json_encode($value);
}
$this->file->flock(LOCK_EX);
$thi... | php | public function insert($key, $value)
{
$this->file->flock(LOCK_SH);
$this->file->fseek(0, SEEK_END);
$position = $this->file->ftell();
if (is_array($value) || is_object($value)) {
$value = json_encode($value);
}
$this->file->flock(LOCK_EX);
$thi... | [
"public",
"function",
"insert",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"file",
"->",
"flock",
"(",
"LOCK_SH",
")",
";",
"$",
"this",
"->",
"file",
"->",
"fseek",
"(",
"0",
",",
"SEEK_END",
")",
";",
"$",
"position",
"=",... | Write the new record to the database file
We store metadata (lengths) in the first 8 bytes of each row
allowing us to use binary searches and indexing key/value positions
@param string $key The Key to be stored
@param mixed $value The Value to be stored
@return integer Returns the position of the data | [
"Write",
"the",
"new",
"record",
"to",
"the",
"database",
"file"
] | 7461771b8ddc0c9887e2ee69a76ff5ffc763974c | https://github.com/kmfk/slowdb/blob/7461771b8ddc0c9887e2ee69a76ff5ffc763974c/src/File.php#L75-L96 | train |
kmfk/slowdb | src/File.php | File.read | public function read($position)
{
$this->file->flock(LOCK_SH);
$metadata = $this->getMetadata($position);
$this->file->fseek($metadata->klen, SEEK_CUR);
$value = $this->file->fread($metadata->vlen);
$this->file->flock(LOCK_UN);
$mixed = json_decode($value, true);
... | php | public function read($position)
{
$this->file->flock(LOCK_SH);
$metadata = $this->getMetadata($position);
$this->file->fseek($metadata->klen, SEEK_CUR);
$value = $this->file->fread($metadata->vlen);
$this->file->flock(LOCK_UN);
$mixed = json_decode($value, true);
... | [
"public",
"function",
"read",
"(",
"$",
"position",
")",
"{",
"$",
"this",
"->",
"file",
"->",
"flock",
"(",
"LOCK_SH",
")",
";",
"$",
"metadata",
"=",
"$",
"this",
"->",
"getMetadata",
"(",
"$",
"position",
")",
";",
"$",
"this",
"->",
"file",
"->... | Retrieves the data from the database for a Key based on position
@param integer $position The offset in the file where the data is stored
@return array | [
"Retrieves",
"the",
"data",
"from",
"the",
"database",
"for",
"a",
"Key",
"based",
"on",
"position"
] | 7461771b8ddc0c9887e2ee69a76ff5ffc763974c | https://github.com/kmfk/slowdb/blob/7461771b8ddc0c9887e2ee69a76ff5ffc763974c/src/File.php#L105-L120 | train |
kmfk/slowdb | src/File.php | File.update | public function update($position, $key, $value)
{
$this->remove($position);
return $this->insert($key, $value);
} | php | public function update($position, $key, $value)
{
$this->remove($position);
return $this->insert($key, $value);
} | [
"public",
"function",
"update",
"(",
"$",
"position",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"remove",
"(",
"$",
"position",
")",
";",
"return",
"$",
"this",
"->",
"insert",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
... | Updates an existing key by removing it from the existing file and
appending the new value to the end of the file.
@param string $key The Key to be stored
@param mixed $value The Value to be stored
@return integer | [
"Updates",
"an",
"existing",
"key",
"by",
"removing",
"it",
"from",
"the",
"existing",
"file",
"and",
"appending",
"the",
"new",
"value",
"to",
"the",
"end",
"of",
"the",
"file",
"."
] | 7461771b8ddc0c9887e2ee69a76ff5ffc763974c | https://github.com/kmfk/slowdb/blob/7461771b8ddc0c9887e2ee69a76ff5ffc763974c/src/File.php#L131-L136 | train |
kmfk/slowdb | src/File.php | File.truncate | public function truncate()
{
$this->file->flock(LOCK_EX);
$result = $this->file->ftruncate(0);
$this->file->flock(LOCK_UN);
return $result;
} | php | public function truncate()
{
$this->file->flock(LOCK_EX);
$result = $this->file->ftruncate(0);
$this->file->flock(LOCK_UN);
return $result;
} | [
"public",
"function",
"truncate",
"(",
")",
"{",
"$",
"this",
"->",
"file",
"->",
"flock",
"(",
"LOCK_EX",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"file",
"->",
"ftruncate",
"(",
"0",
")",
";",
"$",
"this",
"->",
"file",
"->",
"flock",
"... | Truncates the collection, removing all the data from the file
@return bool | [
"Truncates",
"the",
"collection",
"removing",
"all",
"the",
"data",
"from",
"the",
"file"
] | 7461771b8ddc0c9887e2ee69a76ff5ffc763974c | https://github.com/kmfk/slowdb/blob/7461771b8ddc0c9887e2ee69a76ff5ffc763974c/src/File.php#L174-L181 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Socket.php | Socket.create | public static function create($context, $type, LoggerInterface $logger = null, $persistentId = null, $onNewSocket = null)
{
if (!is_callable($onNewSocket)) {
$onNewSocket = null;
}
$newSocket = false;
$callback = function() use ($onNewSocket, &$newSocket) {
$... | php | public static function create($context, $type, LoggerInterface $logger = null, $persistentId = null, $onNewSocket = null)
{
if (!is_callable($onNewSocket)) {
$onNewSocket = null;
}
$newSocket = false;
$callback = function() use ($onNewSocket, &$newSocket) {
$... | [
"public",
"static",
"function",
"create",
"(",
"$",
"context",
",",
"$",
"type",
",",
"LoggerInterface",
"$",
"logger",
"=",
"null",
",",
"$",
"persistentId",
"=",
"null",
",",
"$",
"onNewSocket",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_callable",
"... | Create a new Socket.
@param \ZMQContext $context The Context to create this Socket with
@param integer $type One of the ZMQ::SOCKET_{PUB,SUB,PUSH,PULL,REQ,REP,ROUTER,DEALER} contants.
@param LoggerInterface $logger A Logger
@param string $persistentId When using a persistent soc... | [
"Create",
"a",
"new",
"Socket",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Socket.php#L54-L79 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Socket.php | Socket.hasEvents | public function hasEvents($timeout = 0)
{
$poll = new ZMQPoll();
$poll->add($this, ZMQ::POLL_IN);
$read = $write = array();
$events = $poll->poll($read, $write, $timeout);
if ($events > 0) {
return true;
}
return false;
} | php | public function hasEvents($timeout = 0)
{
$poll = new ZMQPoll();
$poll->add($this, ZMQ::POLL_IN);
$read = $write = array();
$events = $poll->poll($read, $write, $timeout);
if ($events > 0) {
return true;
}
return false;
} | [
"public",
"function",
"hasEvents",
"(",
"$",
"timeout",
"=",
"0",
")",
"{",
"$",
"poll",
"=",
"new",
"ZMQPoll",
"(",
")",
";",
"$",
"poll",
"->",
"add",
"(",
"$",
"this",
",",
"ZMQ",
"::",
"POLL_IN",
")",
";",
"$",
"read",
"=",
"$",
"write",
"=... | Poll for new Events on this Socket.
@param integer $timeout Timeout in milliseconds. Defaults to 0 (return immediately).
@return boolean | [
"Poll",
"for",
"new",
"Events",
"on",
"this",
"Socket",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Socket.php#L88-L99 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Socket.php | Socket.mrecv | public function mrecv($mode = 0)
{
if ($this->verbose) {
$this->getLogger()->debug('PRE RECV: '.$this->id);
}
$data = array();
while (true) {
$data[] = $this->recv($mode);
if (!$this->getSockOpt(ZMQ::SOCKOPT_RCVMORE)) {
break;
... | php | public function mrecv($mode = 0)
{
if ($this->verbose) {
$this->getLogger()->debug('PRE RECV: '.$this->id);
}
$data = array();
while (true) {
$data[] = $this->recv($mode);
if (!$this->getSockOpt(ZMQ::SOCKOPT_RCVMORE)) {
break;
... | [
"public",
"function",
"mrecv",
"(",
"$",
"mode",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"verbose",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"debug",
"(",
"'PRE RECV: '",
".",
"$",
"this",
"->",
"id",
")",
";",
"}",
"... | Receive a Message.
Use this instead of {@see ::recv}.
@param int $mode
@return \AlphaRPC\Common\Socket\Message | [
"Receive",
"a",
"Message",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Socket.php#L166-L190 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Socket.php | Socket.msend | public function msend(Message $msg)
{
if (ZMQ::SOCKET_ROUTER === $this->getSocketType()) {
$msg->prepend($msg->getRoutingInformation());
}
if ($this->verbose) {
$this->getLogger()->debug('SEND: '.$this->id);
$this->getLogger()->debug($msg);
}
... | php | public function msend(Message $msg)
{
if (ZMQ::SOCKET_ROUTER === $this->getSocketType()) {
$msg->prepend($msg->getRoutingInformation());
}
if ($this->verbose) {
$this->getLogger()->debug('SEND: '.$this->id);
$this->getLogger()->debug($msg);
}
... | [
"public",
"function",
"msend",
"(",
"Message",
"$",
"msg",
")",
"{",
"if",
"(",
"ZMQ",
"::",
"SOCKET_ROUTER",
"===",
"$",
"this",
"->",
"getSocketType",
"(",
")",
")",
"{",
"$",
"msg",
"->",
"prepend",
"(",
"$",
"msg",
"->",
"getRoutingInformation",
"(... | Send a Messsage.
@param Message $msg
@return Socket | [
"Send",
"a",
"Messsage",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Socket.php#L199-L223 | train |
K-Phoen/gaufrette-extras-bundle | DependencyInjection/KPhoenGaufretteExtrasExtension.php | KPhoenGaufretteExtrasExtension.createResolverFactories | private function createResolverFactories($config, ContainerBuilder $container)
{
if (null !== $this->factories) {
return $this->factories;
}
// load bundled adapter factories
$tempContainer = new ContainerBuilder();
$parameterBag = $container->getParameterBag();... | php | private function createResolverFactories($config, ContainerBuilder $container)
{
if (null !== $this->factories) {
return $this->factories;
}
// load bundled adapter factories
$tempContainer = new ContainerBuilder();
$parameterBag = $container->getParameterBag();... | [
"private",
"function",
"createResolverFactories",
"(",
"$",
"config",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"factories",
")",
"{",
"return",
"$",
"this",
"->",
"factories",
";",
"}",
"// load bundle... | Creates the resolver factories
@param array $config
@param ContainerBuilder $container | [
"Creates",
"the",
"resolver",
"factories"
] | 3f05779179117d5649184164544e1f22de28d706 | https://github.com/K-Phoen/gaufrette-extras-bundle/blob/3f05779179117d5649184164544e1f22de28d706/DependencyInjection/KPhoenGaufretteExtrasExtension.php#L66-L92 | train |
hal-platform/hal-core | src/Repository/AuditEventRepository.php | AuditEventRepository.getPagedResults | public function getPagedResults($limit = 50, $page = 0)
{
$dql = sprintf(self::DQL_GET_PAGED, AuditEvent::class);
return $this->getPaginator($dql, $limit, $page);
} | php | public function getPagedResults($limit = 50, $page = 0)
{
$dql = sprintf(self::DQL_GET_PAGED, AuditEvent::class);
return $this->getPaginator($dql, $limit, $page);
} | [
"public",
"function",
"getPagedResults",
"(",
"$",
"limit",
"=",
"50",
",",
"$",
"page",
"=",
"0",
")",
"{",
"$",
"dql",
"=",
"sprintf",
"(",
"self",
"::",
"DQL_GET_PAGED",
",",
"AuditEvent",
"::",
"class",
")",
";",
"return",
"$",
"this",
"->",
"get... | Get all audit events, paged.
@param int $limit
@param int $page
@return Paginator | [
"Get",
"all",
"audit",
"events",
"paged",
"."
] | 30d456f8392fc873301ad4217d2ae90436c67090 | https://github.com/hal-platform/hal-core/blob/30d456f8392fc873301ad4217d2ae90436c67090/src/Repository/AuditEventRepository.php#L33-L37 | train |
zikula/FileSystem | Ftp.php | Ftp.connect | public function connect()
{
$this->errorHandler->start();
//create the connection
if ($this->configuration->getSSL()) {
$this->resource = $this->driver->sslConnect($this->configuration->getHost(), $this->configuration->getPort(), $this->configuration->getTimeout());
} el... | php | public function connect()
{
$this->errorHandler->start();
//create the connection
if ($this->configuration->getSSL()) {
$this->resource = $this->driver->sslConnect($this->configuration->getHost(), $this->configuration->getPort(), $this->configuration->getTimeout());
} el... | [
"public",
"function",
"connect",
"(",
")",
"{",
"$",
"this",
"->",
"errorHandler",
"->",
"start",
"(",
")",
";",
"//create the connection",
"if",
"(",
"$",
"this",
"->",
"configuration",
"->",
"getSSL",
"(",
")",
")",
"{",
"$",
"this",
"->",
"resource",
... | Standard function for creating a FTP connection and logging in.
This must be called before any of the other functions in the
Interface. However the construct itself calles this
function upon completion, which alleviates the need to ever call
this function manualy.
@return boolean | [
"Standard",
"function",
"for",
"creating",
"a",
"FTP",
"connection",
"and",
"logging",
"in",
"."
] | 8e12d6839aa50a7590f5ad22cc2d33c8f88ff726 | https://github.com/zikula/FileSystem/blob/8e12d6839aa50a7590f5ad22cc2d33c8f88ff726/Ftp.php#L47-L75 | train |
zikula/FileSystem | Ftp.php | Ftp.fput | public function fput($stream, $remote)
{
$this->isAlive(true);
$this->errorHandler->start();
if ($this->driver->fput($this->resource, $remote, $stream, FTP_BINARY)) {
$this->errorHandler->stop();
return true;
}
$this->errorHandler->stop();
re... | php | public function fput($stream, $remote)
{
$this->isAlive(true);
$this->errorHandler->start();
if ($this->driver->fput($this->resource, $remote, $stream, FTP_BINARY)) {
$this->errorHandler->stop();
return true;
}
$this->errorHandler->stop();
re... | [
"public",
"function",
"fput",
"(",
"$",
"stream",
",",
"$",
"remote",
")",
"{",
"$",
"this",
"->",
"isAlive",
"(",
"true",
")",
";",
"$",
"this",
"->",
"errorHandler",
"->",
"start",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"driver",
"->",
"f... | Similar to put but does not get the file localy.
This should be used instead of put in most cases.
@param stream|resource $stream The resource to put remotely, probably the resource returned from a fget.
@param string $remote The pathname to the desired remote pathname.
@return integer|boolean number of by... | [
"Similar",
"to",
"put",
"but",
"does",
"not",
"get",
"the",
"file",
"localy",
"."
] | 8e12d6839aa50a7590f5ad22cc2d33c8f88ff726 | https://github.com/zikula/FileSystem/blob/8e12d6839aa50a7590f5ad22cc2d33c8f88ff726/Ftp.php#L113-L125 | train |
zikula/FileSystem | Ftp.php | Ftp.putContents | public function putContents($contents, $remote)
{
$stream = fopen('data://text/plain,' . $contents, 'r');
return $this->fput($stream, $remote);
} | php | public function putContents($contents, $remote)
{
$stream = fopen('data://text/plain,' . $contents, 'r');
return $this->fput($stream, $remote);
} | [
"public",
"function",
"putContents",
"(",
"$",
"contents",
",",
"$",
"remote",
")",
"{",
"$",
"stream",
"=",
"fopen",
"(",
"'data://text/plain,'",
".",
"$",
"contents",
",",
"'r'",
")",
";",
"return",
"$",
"this",
"->",
"fput",
"(",
"$",
"stream",
",",... | Write the contents of a string to the remote.
@param string $contents The contents to put remotely.
@param string $remote The pathname to the desired remote pathname.
@return boolean|integer Number of bytes written on success, false on failure. | [
"Write",
"the",
"contents",
"of",
"a",
"string",
"to",
"the",
"remote",
"."
] | 8e12d6839aa50a7590f5ad22cc2d33c8f88ff726 | https://github.com/zikula/FileSystem/blob/8e12d6839aa50a7590f5ad22cc2d33c8f88ff726/Ftp.php#L135-L140 | train |
zikula/FileSystem | Ftp.php | Ftp.fget | public function fget($remote)
{
$this->isAlive(true);
$this->errorHandler->start();
$handle = fopen('php://temp', 'r+');
if ($this->driver->fget($this->resource, $handle, $remote, FTP_BINARY)) {
rewind($handle);
$this->errorHandler->stop();
return... | php | public function fget($remote)
{
$this->isAlive(true);
$this->errorHandler->start();
$handle = fopen('php://temp', 'r+');
if ($this->driver->fget($this->resource, $handle, $remote, FTP_BINARY)) {
rewind($handle);
$this->errorHandler->stop();
return... | [
"public",
"function",
"fget",
"(",
"$",
"remote",
")",
"{",
"$",
"this",
"->",
"isAlive",
"(",
"true",
")",
";",
"$",
"this",
"->",
"errorHandler",
"->",
"start",
"(",
")",
";",
"$",
"handle",
"=",
"fopen",
"(",
"'php://temp'",
",",
"'r+'",
")",
";... | Similar to get but does not save file localy.
This should usually be used instead of get in most cases.
@param string $remote The path to the remote file.
@return resource|boolean The resource on success false on fail. | [
"Similar",
"to",
"get",
"but",
"does",
"not",
"save",
"file",
"localy",
"."
] | 8e12d6839aa50a7590f5ad22cc2d33c8f88ff726 | https://github.com/zikula/FileSystem/blob/8e12d6839aa50a7590f5ad22cc2d33c8f88ff726/Ftp.php#L189-L203 | train |
villermen/runescape-lookup-commons | src/Activity.php | Activity.getActivity | public static function getActivity(int $id): Activity
{
self::initializeActivities();
if (!isset(self::$activities[$id])) {
throw new RuneScapeException(sprintf("Activity with id %d does not exist.", $id));
}
return self::$activities[$id];
} | php | public static function getActivity(int $id): Activity
{
self::initializeActivities();
if (!isset(self::$activities[$id])) {
throw new RuneScapeException(sprintf("Activity with id %d does not exist.", $id));
}
return self::$activities[$id];
} | [
"public",
"static",
"function",
"getActivity",
"(",
"int",
"$",
"id",
")",
":",
"Activity",
"{",
"self",
"::",
"initializeActivities",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"activities",
"[",
"$",
"id",
"]",
")",
")",
"{",
... | Retrieve an activity by ID.
You can use the ACTIVITY_ constants in this class for IDs.
@param int $id
@return Activity
@throws RuneScapeException When the requested activity does not exist. | [
"Retrieve",
"an",
"activity",
"by",
"ID",
".",
"You",
"can",
"use",
"the",
"ACTIVITY_",
"constants",
"in",
"this",
"class",
"for",
"IDs",
"."
] | 3e24dadbdc5e20b755280e5110f4ca0a1758b04c | https://github.com/villermen/runescape-lookup-commons/blob/3e24dadbdc5e20b755280e5110f4ca0a1758b04c/src/Activity.php#L112-L121 | train |
chilimatic/chilimatic-framework | lib/database/sql/mysql/Command.php | Command.kill_process | public function kill_process($pid)
{
if (!is_numeric($pid)) return false;
$pid = (int)$pid;
$sql = "KILL $pid";
return $this->db->query($sql);
} | php | public function kill_process($pid)
{
if (!is_numeric($pid)) return false;
$pid = (int)$pid;
$sql = "KILL $pid";
return $this->db->query($sql);
} | [
"public",
"function",
"kill_process",
"(",
"$",
"pid",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"pid",
")",
")",
"return",
"false",
";",
"$",
"pid",
"=",
"(",
"int",
")",
"$",
"pid",
";",
"$",
"sql",
"=",
"\"KILL $pid\"",
";",
"return",
... | kill a specific process
@param int $pid
@return boolean | [
"kill",
"a",
"specific",
"process"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/database/sql/mysql/Command.php#L44-L52 | train |
timostamm/url-builder | src/UrlQuery.php | UrlQuery.setArray | public function setArray($key, array $values)
{
$this->validateKey($key);
if (empty($values)) {
throw new \InvalidArgumentException("Missing value.");
}
foreach ($values as $v) {
$this->validateValue($v);
}
$this->params[$key] = [];
foreach ($values as $v) {
$this->params[$key][] = $v;
}
ret... | php | public function setArray($key, array $values)
{
$this->validateKey($key);
if (empty($values)) {
throw new \InvalidArgumentException("Missing value.");
}
foreach ($values as $v) {
$this->validateValue($v);
}
$this->params[$key] = [];
foreach ($values as $v) {
$this->params[$key][] = $v;
}
ret... | [
"public",
"function",
"setArray",
"(",
"$",
"key",
",",
"array",
"$",
"values",
")",
"{",
"$",
"this",
"->",
"validateKey",
"(",
"$",
"key",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"values",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentExcept... | Sets several values for the given parameter key.
@param string $key
@param array $values
@throws \InvalidArgumentException If the key is empty, the key is not a string, no values are given or a value is not a string.
@return self | [
"Sets",
"several",
"values",
"for",
"the",
"given",
"parameter",
"key",
"."
] | 9dec80635017415d83b7e6ef155e9324f4b27a00 | https://github.com/timostamm/url-builder/blob/9dec80635017415d83b7e6ef155e9324f4b27a00/src/UrlQuery.php#L59-L73 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.