id int32 0 241k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
196,500 | Xsaven/laravel-intelect-admin | src/Addons/LogViewer/LogViewer.php | LogViewer.renderTableRow | protected function renderTableRow($log)
{
$color = LogViewer::$levelColors[$log['level']] ?? 'black';
$index = uniqid();
$button = '';
if (!empty($log['trace'])) {
$button = "<a class=\"btn btn-primary btn-xs\" data-toggle=\"collapse\" data-target=\".trace-{$index}\"><... | php | protected function renderTableRow($log)
{
$color = LogViewer::$levelColors[$log['level']] ?? 'black';
$index = uniqid();
$button = '';
if (!empty($log['trace'])) {
$button = "<a class=\"btn btn-primary btn-xs\" data-toggle=\"collapse\" data-target=\".trace-{$index}\"><... | [
"protected",
"function",
"renderTableRow",
"(",
"$",
"log",
")",
"{",
"$",
"color",
"=",
"LogViewer",
"::",
"$",
"levelColors",
"[",
"$",
"log",
"[",
"'level'",
"]",
"]",
"??",
"'black'",
";",
"$",
"index",
"=",
"uniqid",
"(",
")",
";",
"$",
"button"... | Render table row.
@param $log
@return string | [
"Render",
"table",
"row",
"."
] | 592574633d12c74cf25b43dd6694fee496abefcb | https://github.com/Xsaven/laravel-intelect-admin/blob/592574633d12c74cf25b43dd6694fee496abefcb/src/Addons/LogViewer/LogViewer.php#L274-L305 |
196,501 | attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/M2P.php | M2P.setMedia | public function setMedia(ChildMedia $v = null)
{
if ($v === null) {
$this->setMediaId(NULL);
} else {
$this->setMediaId($v->getId());
}
$this->aMedia = $v;
// Add binding for other direction of this n:n relationship.
// If this object has alr... | php | public function setMedia(ChildMedia $v = null)
{
if ($v === null) {
$this->setMediaId(NULL);
} else {
$this->setMediaId($v->getId());
}
$this->aMedia = $v;
// Add binding for other direction of this n:n relationship.
// If this object has alr... | [
"public",
"function",
"setMedia",
"(",
"ChildMedia",
"$",
"v",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"v",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setMediaId",
"(",
"NULL",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"setMediaId",
"(",
"$... | Declares an association between this object and a ChildMedia object.
@param ChildMedia $v
@return $this|\Attogram\SharedMedia\Orm\M2P The current object (for fluent API support)
@throws PropelException | [
"Declares",
"an",
"association",
"between",
"this",
"object",
"and",
"a",
"ChildMedia",
"object",
"."
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/M2P.php#L1080-L1098 |
196,502 | attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/M2P.php | M2P.getMedia | public function getMedia(ConnectionInterface $con = null)
{
if ($this->aMedia === null && ($this->media_id != 0)) {
$this->aMedia = ChildMediaQuery::create()->findPk($this->media_id, $con);
/* The following can be used additionally to
guarantee the related object cont... | php | public function getMedia(ConnectionInterface $con = null)
{
if ($this->aMedia === null && ($this->media_id != 0)) {
$this->aMedia = ChildMediaQuery::create()->findPk($this->media_id, $con);
/* The following can be used additionally to
guarantee the related object cont... | [
"public",
"function",
"getMedia",
"(",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"aMedia",
"===",
"null",
"&&",
"(",
"$",
"this",
"->",
"media_id",
"!=",
"0",
")",
")",
"{",
"$",
"this",
"->",
"aMedia",
... | Get the associated ChildMedia object
@param ConnectionInterface $con Optional Connection object.
@return ChildMedia The associated ChildMedia object.
@throws PropelException | [
"Get",
"the",
"associated",
"ChildMedia",
"object"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/M2P.php#L1108-L1122 |
196,503 | attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/M2P.php | M2P.setPage | public function setPage(ChildPage $v = null)
{
if ($v === null) {
$this->setPageId(NULL);
} else {
$this->setPageId($v->getId());
}
$this->aPage = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already ... | php | public function setPage(ChildPage $v = null)
{
if ($v === null) {
$this->setPageId(NULL);
} else {
$this->setPageId($v->getId());
}
$this->aPage = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already ... | [
"public",
"function",
"setPage",
"(",
"ChildPage",
"$",
"v",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"v",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setPageId",
"(",
"NULL",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"setPageId",
"(",
"$",
... | Declares an association between this object and a ChildPage object.
@param ChildPage $v
@return $this|\Attogram\SharedMedia\Orm\M2P The current object (for fluent API support)
@throws PropelException | [
"Declares",
"an",
"association",
"between",
"this",
"object",
"and",
"a",
"ChildPage",
"object",
"."
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/M2P.php#L1131-L1149 |
196,504 | attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/M2P.php | M2P.getPage | public function getPage(ConnectionInterface $con = null)
{
if ($this->aPage === null && ($this->page_id != 0)) {
$this->aPage = ChildPageQuery::create()->findPk($this->page_id, $con);
/* The following can be used additionally to
guarantee the related object contains a... | php | public function getPage(ConnectionInterface $con = null)
{
if ($this->aPage === null && ($this->page_id != 0)) {
$this->aPage = ChildPageQuery::create()->findPk($this->page_id, $con);
/* The following can be used additionally to
guarantee the related object contains a... | [
"public",
"function",
"getPage",
"(",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"aPage",
"===",
"null",
"&&",
"(",
"$",
"this",
"->",
"page_id",
"!=",
"0",
")",
")",
"{",
"$",
"this",
"->",
"aPage",
"="... | Get the associated ChildPage object
@param ConnectionInterface $con Optional Connection object.
@return ChildPage The associated ChildPage object.
@throws PropelException | [
"Get",
"the",
"associated",
"ChildPage",
"object"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/M2P.php#L1159-L1173 |
196,505 | SkinnyBot/Plugin-Installer | src/Installer/PluginInstaller.php | PluginInstaller.determinePlugins | public static function determinePlugins($packages, $pluginsDir = 'plugins', $vendorDir = 'vendor')
{
$plugins = [];
foreach ($packages as $package) {
if ($package->getType() !== 'skinny-plugin') {
continue;
}
$ns = static::primaryNamespace($packa... | php | public static function determinePlugins($packages, $pluginsDir = 'plugins', $vendorDir = 'vendor')
{
$plugins = [];
foreach ($packages as $package) {
if ($package->getType() !== 'skinny-plugin') {
continue;
}
$ns = static::primaryNamespace($packa... | [
"public",
"static",
"function",
"determinePlugins",
"(",
"$",
"packages",
",",
"$",
"pluginsDir",
"=",
"'plugins'",
",",
"$",
"vendorDir",
"=",
"'vendor'",
")",
"{",
"$",
"plugins",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"packages",
"as",
"$",
"package... | Find all plugins available.
Add all composer packages of type skinny-plugin, and all plugins located
in the plugins directory to a plugin-name indexed array of paths.
@param array $packages An array of \Composer\Package\PackageInterface objects.
@param string $pluginsDir The path to the plugins dir.
@param string $ve... | [
"Find",
"all",
"plugins",
"available",
"."
] | b88c073b2f0a6f687117840036f57d9529d1e877 | https://github.com/SkinnyBot/Plugin-Installer/blob/b88c073b2f0a6f687117840036f57d9529d1e877/src/Installer/PluginInstaller.php#L54-L82 |
196,506 | SkinnyBot/Plugin-Installer | src/Installer/PluginInstaller.php | PluginInstaller.writeConfigFile | public static function writeConfigFile($configFile, $plugins, $root = null)
{
$root = $root ?: dirname(dirname($configFile));
$data = [];
foreach ($plugins as $name => $pluginPath) {
// Normalize to *nix paths.
$pluginPath = str_replace('\\', '/', $pluginPath);
... | php | public static function writeConfigFile($configFile, $plugins, $root = null)
{
$root = $root ?: dirname(dirname($configFile));
$data = [];
foreach ($plugins as $name => $pluginPath) {
// Normalize to *nix paths.
$pluginPath = str_replace('\\', '/', $pluginPath);
... | [
"public",
"static",
"function",
"writeConfigFile",
"(",
"$",
"configFile",
",",
"$",
"plugins",
",",
"$",
"root",
"=",
"null",
")",
"{",
"$",
"root",
"=",
"$",
"root",
"?",
":",
"dirname",
"(",
"dirname",
"(",
"$",
"configFile",
")",
")",
";",
"$",
... | Rewrite the config file with a complete list of plugins.
@param string $configFile The path to the config file.
@param array $plugins Of plugins.
@param string|null $root The root directory. Defaults to a value generated from $configFile.
@return void | [
"Rewrite",
"the",
"config",
"file",
"with",
"a",
"complete",
"list",
"of",
"plugins",
"."
] | b88c073b2f0a6f687117840036f57d9529d1e877 | https://github.com/SkinnyBot/Plugin-Installer/blob/b88c073b2f0a6f687117840036f57d9529d1e877/src/Installer/PluginInstaller.php#L93-L146 |
196,507 | SkinnyBot/Plugin-Installer | src/Installer/PluginInstaller.php | PluginInstaller.primaryNamespace | public static function primaryNamespace($package)
{
$primaryNs = null;
$autoLoad = $package->getAutoload();
foreach ($autoLoad as $type => $pathMap) {
if ($type !== 'psr-4') {
continue;
}
$count = count($pathMap);
if ($count ==... | php | public static function primaryNamespace($package)
{
$primaryNs = null;
$autoLoad = $package->getAutoload();
foreach ($autoLoad as $type => $pathMap) {
if ($type !== 'psr-4') {
continue;
}
$count = count($pathMap);
if ($count ==... | [
"public",
"static",
"function",
"primaryNamespace",
"(",
"$",
"package",
")",
"{",
"$",
"primaryNs",
"=",
"null",
";",
"$",
"autoLoad",
"=",
"$",
"package",
"->",
"getAutoload",
"(",
")",
";",
"foreach",
"(",
"$",
"autoLoad",
"as",
"$",
"type",
"=>",
"... | Get the primary namespace for a plugin package.
@param \Composer\Package\PackageInterface $package composer object.
@return string The package's primary namespace.
@throws \RuntimeException When the package's primary namespace cannot be determined. | [
"Get",
"the",
"primary",
"namespace",
"for",
"a",
"plugin",
"package",
"."
] | b88c073b2f0a6f687117840036f57d9529d1e877 | https://github.com/SkinnyBot/Plugin-Installer/blob/b88c073b2f0a6f687117840036f57d9529d1e877/src/Installer/PluginInstaller.php#L169-L209 |
196,508 | SkinnyBot/Plugin-Installer | src/Installer/PluginInstaller.php | PluginInstaller.install | public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
{
parent::install($repo, $package);
$path = $this->getInstallPath($package);
$ns = static::primaryNamespace($package);
$this->updateConfig($ns, $path);
} | php | public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
{
parent::install($repo, $package);
$path = $this->getInstallPath($package);
$ns = static::primaryNamespace($package);
$this->updateConfig($ns, $path);
} | [
"public",
"function",
"install",
"(",
"InstalledRepositoryInterface",
"$",
"repo",
",",
"PackageInterface",
"$",
"package",
")",
"{",
"parent",
"::",
"install",
"(",
"$",
"repo",
",",
"$",
"package",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"getInsta... | Installs specific plugin.
After the plugin is installed, app's `skinny-plugins.php` config file is updated with
plugin namespace to path mapping.
@param \Composer\Repository\InstalledRepositoryInterface $repo Repository in which to check.
@param \Composer\Package\PackageInterface $package Package instance.
@deprecat... | [
"Installs",
"specific",
"plugin",
"."
] | b88c073b2f0a6f687117840036f57d9529d1e877 | https://github.com/SkinnyBot/Plugin-Installer/blob/b88c073b2f0a6f687117840036f57d9529d1e877/src/Installer/PluginInstaller.php#L234-L240 |
196,509 | SkinnyBot/Plugin-Installer | src/Installer/PluginInstaller.php | PluginInstaller.update | public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
{
parent::update($repo, $initial, $target);
$ns = static::primaryNamespace($initial);
$this->updateConfig($ns, null);
$path = $this->getInstallPath($target);
$ns ... | php | public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
{
parent::update($repo, $initial, $target);
$ns = static::primaryNamespace($initial);
$this->updateConfig($ns, null);
$path = $this->getInstallPath($target);
$ns ... | [
"public",
"function",
"update",
"(",
"InstalledRepositoryInterface",
"$",
"repo",
",",
"PackageInterface",
"$",
"initial",
",",
"PackageInterface",
"$",
"target",
")",
"{",
"parent",
"::",
"update",
"(",
"$",
"repo",
",",
"$",
"initial",
",",
"$",
"target",
... | Updates specific plugin.
After the plugin is installed, app's `skinny-plugins.php` config file is updated with
plugin namespace to path mapping.
@param \Composer\Repository\InstalledRepositoryInterface $repo Repository in which to check.
@param \Composer\Package\PackageInterface $initial Already installed package ver... | [
"Updates",
"specific",
"plugin",
"."
] | b88c073b2f0a6f687117840036f57d9529d1e877 | https://github.com/SkinnyBot/Plugin-Installer/blob/b88c073b2f0a6f687117840036f57d9529d1e877/src/Installer/PluginInstaller.php#L256-L266 |
196,510 | SkinnyBot/Plugin-Installer | src/Installer/PluginInstaller.php | PluginInstaller.updateConfig | public function updateConfig($name, $path)
{
$name = str_replace('\\', '/', $name);
$configFile = static::configFile($this->vendorDir);
$this->ensureConfigFile($configFile);
$return = include $configFile;
if (is_array($return) && empty($config)) {
$config = $retu... | php | public function updateConfig($name, $path)
{
$name = str_replace('\\', '/', $name);
$configFile = static::configFile($this->vendorDir);
$this->ensureConfigFile($configFile);
$return = include $configFile;
if (is_array($return) && empty($config)) {
$config = $retu... | [
"public",
"function",
"updateConfig",
"(",
"$",
"name",
",",
"$",
"path",
")",
"{",
"$",
"name",
"=",
"str_replace",
"(",
"'\\\\'",
",",
"'/'",
",",
"$",
"name",
")",
";",
"$",
"configFile",
"=",
"static",
"::",
"configFile",
"(",
"$",
"this",
"->",
... | Update the plugin path for a given package.
@param string $name The plugin name being installed.
@param string $path The path, the plugin is being installed into. | [
"Update",
"the",
"plugin",
"path",
"for",
"a",
"given",
"package",
"."
] | b88c073b2f0a6f687117840036f57d9529d1e877 | https://github.com/SkinnyBot/Plugin-Installer/blob/b88c073b2f0a6f687117840036f57d9529d1e877/src/Installer/PluginInstaller.php#L290-L317 |
196,511 | hschletz/NADA | src/Column/Mysql.php | Mysql._modify | protected function _modify()
{
$this->_table->alter(
'MODIFY ' .
$this->_database->prepareIdentifier($this->_name) .
' ' .
$this->getDefinition()
);
} | php | protected function _modify()
{
$this->_table->alter(
'MODIFY ' .
$this->_database->prepareIdentifier($this->_name) .
' ' .
$this->getDefinition()
);
} | [
"protected",
"function",
"_modify",
"(",
")",
"{",
"$",
"this",
"->",
"_table",
"->",
"alter",
"(",
"'MODIFY '",
".",
"$",
"this",
"->",
"_database",
"->",
"prepareIdentifier",
"(",
"$",
"this",
"->",
"_name",
")",
".",
"' '",
".",
"$",
"this",
"->",
... | Modify column in the database according to current properties
@return void | [
"Modify",
"column",
"in",
"the",
"database",
"according",
"to",
"current",
"properties"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Column/Mysql.php#L167-L175 |
196,512 | vainproject/vain-user | src/User/Auth/Access/Traits/UserTrait.php | UserTrait.saveRoles | public function saveRoles($inputRoles)
{
if (!empty($inputRoles)) {
$this->roles()->sync($inputRoles);
} else {
$this->roles()->detach();
}
} | php | public function saveRoles($inputRoles)
{
if (!empty($inputRoles)) {
$this->roles()->sync($inputRoles);
} else {
$this->roles()->detach();
}
} | [
"public",
"function",
"saveRoles",
"(",
"$",
"inputRoles",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"inputRoles",
")",
")",
"{",
"$",
"this",
"->",
"roles",
"(",
")",
"->",
"sync",
"(",
"$",
"inputRoles",
")",
";",
"}",
"else",
"{",
"$",
"thi... | Save the inputted roles.
@param mixed $inputRoles
@return void | [
"Save",
"the",
"inputted",
"roles",
"."
] | 1c059faa61ebf289fcaea39a90b4523cfc9d6efc | https://github.com/vainproject/vain-user/blob/1c059faa61ebf289fcaea39a90b4523cfc9d6efc/src/User/Auth/Access/Traits/UserTrait.php#L63-L70 |
196,513 | ekyna/Resource | Doctrine/ORM/Mapping/DiscriminatorMapper.php | DiscriminatorMapper.extractEntry | private function extractEntry($class)
{
if ($class != $this->baseClass && !is_subclass_of($class, $this->baseClass)) {
return false;
}
if (!preg_match_all('~/?([a-zA-Z0-9]+)~', $class, $namespaces)) {
throw new \Exception("Unexpected class {$class}.");
}
... | php | private function extractEntry($class)
{
if ($class != $this->baseClass && !is_subclass_of($class, $this->baseClass)) {
return false;
}
if (!preg_match_all('~/?([a-zA-Z0-9]+)~', $class, $namespaces)) {
throw new \Exception("Unexpected class {$class}.");
}
... | [
"private",
"function",
"extractEntry",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"$",
"class",
"!=",
"$",
"this",
"->",
"baseClass",
"&&",
"!",
"is_subclass_of",
"(",
"$",
"class",
",",
"$",
"this",
"->",
"baseClass",
")",
")",
"{",
"return",
"false",
... | Extracts the discriminator name from the given class.
@param string $class
@return string
@return bool
@throws \Exception | [
"Extracts",
"the",
"discriminator",
"name",
"from",
"the",
"given",
"class",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Doctrine/ORM/Mapping/DiscriminatorMapper.php#L190-L230 |
196,514 | MacGyer/yii2-data-uri-validator | src/DataUriValidator.php | DataUriValidator.validateAttribute | public function validateAttribute($model, $attribute)
{
$value = $model->$attribute;
$result = $this->validateValue($value);
if (!empty($result)) {
$this->addError($model, $attribute, $this->renderMessage($model, $attribute));
}
} | php | public function validateAttribute($model, $attribute)
{
$value = $model->$attribute;
$result = $this->validateValue($value);
if (!empty($result)) {
$this->addError($model, $attribute, $this->renderMessage($model, $attribute));
}
} | [
"public",
"function",
"validateAttribute",
"(",
"$",
"model",
",",
"$",
"attribute",
")",
"{",
"$",
"value",
"=",
"$",
"model",
"->",
"$",
"attribute",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"validateValue",
"(",
"$",
"value",
")",
";",
"if",
"(... | Validates a single attribute.
@param \yii\base\Model $model the data model to be validated
@param string $attribute the name of the attribute to be validated.
@uses [[renderMessage()]]
@uses [[validateValue()]] | [
"Validates",
"a",
"single",
"attribute",
"."
] | d8e9c750cdff1bf7d1bd10bdffac8405e116e47a | https://github.com/MacGyer/yii2-data-uri-validator/blob/d8e9c750cdff1bf7d1bd10bdffac8405e116e47a/src/DataUriValidator.php#L44-L52 |
196,515 | MacGyer/yii2-data-uri-validator | src/DataUriValidator.php | DataUriValidator.renderMessage | private function renderMessage($model, $attribute)
{
$attributeLabel = $model->getAttributeLabel($attribute);
$message = strtr($this->message, ['{attribute}' => $attributeLabel]);
return $message;
} | php | private function renderMessage($model, $attribute)
{
$attributeLabel = $model->getAttributeLabel($attribute);
$message = strtr($this->message, ['{attribute}' => $attributeLabel]);
return $message;
} | [
"private",
"function",
"renderMessage",
"(",
"$",
"model",
",",
"$",
"attribute",
")",
"{",
"$",
"attributeLabel",
"=",
"$",
"model",
"->",
"getAttributeLabel",
"(",
"$",
"attribute",
")",
";",
"$",
"message",
"=",
"strtr",
"(",
"$",
"this",
"->",
"messa... | Renders the attribute's error message.
@param [\yii\base\Model](http://www.yiiframework.com/doc-2.0/yii-base-model.html) $model the data model currently being validated.
@param string $attribute the name of the attribute to be validated.
@return string the error message. | [
"Renders",
"the",
"attribute",
"s",
"error",
"message",
"."
] | d8e9c750cdff1bf7d1bd10bdffac8405e116e47a | https://github.com/MacGyer/yii2-data-uri-validator/blob/d8e9c750cdff1bf7d1bd10bdffac8405e116e47a/src/DataUriValidator.php#L92-L98 |
196,516 | MetaModels/phpunit-contao-database | src/Contao/Database/QueryCollection.php | QueryCollection.findQuery | public function findQuery($strQuery)
{
foreach ($this->queries as $query) {
if ($query->matches($strQuery)) {
return $query;
}
}
return null;
} | php | public function findQuery($strQuery)
{
foreach ($this->queries as $query) {
if ($query->matches($strQuery)) {
return $query;
}
}
return null;
} | [
"public",
"function",
"findQuery",
"(",
"$",
"strQuery",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"queries",
"as",
"$",
"query",
")",
"{",
"if",
"(",
"$",
"query",
"->",
"matches",
"(",
"$",
"strQuery",
")",
")",
"{",
"return",
"$",
"query",
";... | Try to find the query matching the given string.
@param string $strQuery The query string.
@return FakeQuery|null | [
"Try",
"to",
"find",
"the",
"query",
"matching",
"the",
"given",
"string",
"."
] | aeb2ee10dac532fa73e2deb6457b6a167a1c01c7 | https://github.com/MetaModels/phpunit-contao-database/blob/aeb2ee10dac532fa73e2deb6457b6a167a1c01c7/src/Contao/Database/QueryCollection.php#L57-L66 |
196,517 | Kris-Kuiper/sFire-Framework | src/Template/TemplateData.php | TemplateData.register | public static function register($action, $closure) {
if(false === is_string($action)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($action)), E_USER_ERROR);
}
if(false === is_object($closure)) {
return trigger_error(sprin... | php | public static function register($action, $closure) {
if(false === is_string($action)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($action)), E_USER_ERROR);
}
if(false === is_object($closure)) {
return trigger_error(sprin... | [
"public",
"static",
"function",
"register",
"(",
"$",
"action",
",",
"$",
"closure",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"action",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the... | Register a new template function
@param string $action
@param object $closure
@return sFire\MVC\Controller | [
"Register",
"a",
"new",
"template",
"function"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Template/TemplateData.php#L54-L65 |
196,518 | railken/lem | src/Concerns/HasExceptions.php | HasExceptions.getException | public function getException($code)
{
if (!isset($this->exceptions[$code])) {
throw new Exceptions\ExceptionNotDefinedException($this, $code);
}
return $this->exceptions[$code];
} | php | public function getException($code)
{
if (!isset($this->exceptions[$code])) {
throw new Exceptions\ExceptionNotDefinedException($this, $code);
}
return $this->exceptions[$code];
} | [
"public",
"function",
"getException",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"exceptions",
"[",
"$",
"code",
"]",
")",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"ExceptionNotDefinedException",
"(",
"$",
"this",
... | Retrieve an exception class given code.
@param string $code
@return string | [
"Retrieve",
"an",
"exception",
"class",
"given",
"code",
"."
] | cff1efcd090a9504b2faf5594121885786dea67a | https://github.com/railken/lem/blob/cff1efcd090a9504b2faf5594121885786dea67a/src/Concerns/HasExceptions.php#L23-L30 |
196,519 | 1HappyPlace/ansi-terminal | src/ANSI/Terminal.php | Terminal.setColors | public function setColors($textColor = null, $fillColor = null) {
// set the desired text and fill
$this->desiredState->setTextColor($textColor);
$this->desiredState->setFillColor($fillColor);
// chaining
return $this;
} | php | public function setColors($textColor = null, $fillColor = null) {
// set the desired text and fill
$this->desiredState->setTextColor($textColor);
$this->desiredState->setFillColor($fillColor);
// chaining
return $this;
} | [
"public",
"function",
"setColors",
"(",
"$",
"textColor",
"=",
"null",
",",
"$",
"fillColor",
"=",
"null",
")",
"{",
"// set the desired text and fill",
"$",
"this",
"->",
"desiredState",
"->",
"setTextColor",
"(",
"$",
"textColor",
")",
";",
"$",
"this",
"-... | Set both the fill and text colors
@param $textColor int|string|null $color - can be either a Color constant Color::Blue or a string with the same spelling "blue", "Red", "LIGHT CYAN", etc
@param $fillColor int|string|null $color - can be either a Color constant Color::Blue or a string with the same spelling "blue", "R... | [
"Set",
"both",
"the",
"fill",
"and",
"text",
"colors"
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/Terminal.php#L272-L280 |
196,520 | 1HappyPlace/ansi-terminal | src/ANSI/Terminal.php | Terminal.clear | public function clear($rightAway = false) {
// clear the old settings
$this->desiredState->clear();
// if it desired to send out the clear sequence right away
if ($rightAway) {
// send it out
$this->output(EscapeSequenceGenerator::generateClearSequence());
... | php | public function clear($rightAway = false) {
// clear the old settings
$this->desiredState->clear();
// if it desired to send out the clear sequence right away
if ($rightAway) {
// send it out
$this->output(EscapeSequenceGenerator::generateClearSequence());
... | [
"public",
"function",
"clear",
"(",
"$",
"rightAway",
"=",
"false",
")",
"{",
"// clear the old settings",
"$",
"this",
"->",
"desiredState",
"->",
"clear",
"(",
")",
";",
"// if it desired to send out the clear sequence right away",
"if",
"(",
"$",
"rightAway",
")"... | Clear away all formatting - bold, underscore, text and fill color
@param boolean $rightAway - whether to send out the escape sequence right away
or allow the display to do it later
@return $this | [
"Clear",
"away",
"all",
"formatting",
"-",
"bold",
"underscore",
"text",
"and",
"fill",
"color"
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/Terminal.php#L294-L313 |
196,521 | 1HappyPlace/ansi-terminal | src/ANSI/Terminal.php | Terminal.outputEscapeSequence | public function outputEscapeSequence() {
// send out any escaping to implement anything sitting in the desired state
$this->output($this->generator->generate($this->currentState, $this->desiredState));
// copy the current state to the now achieved desired state
$this->currentState = cl... | php | public function outputEscapeSequence() {
// send out any escaping to implement anything sitting in the desired state
$this->output($this->generator->generate($this->currentState, $this->desiredState));
// copy the current state to the now achieved desired state
$this->currentState = cl... | [
"public",
"function",
"outputEscapeSequence",
"(",
")",
"{",
"// send out any escaping to implement anything sitting in the desired state",
"$",
"this",
"->",
"output",
"(",
"$",
"this",
"->",
"generator",
"->",
"generate",
"(",
"$",
"this",
"->",
"currentState",
",",
... | Send out the escape sequence which will accomplish the desired state | [
"Send",
"out",
"the",
"escape",
"sequence",
"which",
"will",
"accomplish",
"the",
"desired",
"state"
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/Terminal.php#L318-L325 |
196,522 | 1HappyPlace/ansi-terminal | src/ANSI/Terminal.php | Terminal.newLine | public function newLine($count = 1) {
// send out any escaping to implement anything sitting in the desired state
$this->outputEscapeSequence();
// if the $count is greater than one
if (is_int($count) && $count > 1) {
// send out the \n $count times
for ($i=0; ... | php | public function newLine($count = 1) {
// send out any escaping to implement anything sitting in the desired state
$this->outputEscapeSequence();
// if the $count is greater than one
if (is_int($count) && $count > 1) {
// send out the \n $count times
for ($i=0; ... | [
"public",
"function",
"newLine",
"(",
"$",
"count",
"=",
"1",
")",
"{",
"// send out any escaping to implement anything sitting in the desired state",
"$",
"this",
"->",
"outputEscapeSequence",
"(",
")",
";",
"// if the $count is greater than one",
"if",
"(",
"is_int",
"(... | Move the cursor to the next line
This is not an ANSI sequence, but rather the ASCII code 12 or \n
@param int $count - the number of newlines to output
@return $this | [
"Move",
"the",
"cursor",
"to",
"the",
"next",
"line",
"This",
"is",
"not",
"an",
"ANSI",
"sequence",
"but",
"rather",
"the",
"ASCII",
"code",
"12",
"or",
"\\",
"n"
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/Terminal.php#L354-L380 |
196,523 | 1HappyPlace/ansi-terminal | src/ANSI/Terminal.php | Terminal.clearScreen | public function clearScreen() {
// send out any escaping to implement anything sitting in the desired state
$this->outputEscapeSequence();
// escape sequences to clear screen and move it up
$this->output(EscapeSequenceGenerator::generateClearScreenSequence());
// fire the hand... | php | public function clearScreen() {
// send out any escaping to implement anything sitting in the desired state
$this->outputEscapeSequence();
// escape sequences to clear screen and move it up
$this->output(EscapeSequenceGenerator::generateClearScreenSequence());
// fire the hand... | [
"public",
"function",
"clearScreen",
"(",
")",
"{",
"// send out any escaping to implement anything sitting in the desired state",
"$",
"this",
"->",
"outputEscapeSequence",
"(",
")",
";",
"// escape sequences to clear screen and move it up",
"$",
"this",
"->",
"output",
"(",
... | Clear the screen and move cursor to the top.
@return $this | [
"Clear",
"the",
"screen",
"and",
"move",
"cursor",
"to",
"the",
"top",
"."
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/Terminal.php#L388-L401 |
196,524 | 1HappyPlace/ansi-terminal | src/ANSI/Terminal.php | Terminal.prompt | public function prompt($text) {
// send out any escaping to implement anything sitting in the desired state
$this->outputEscapeSequence();
// save off the prompt string
$prompt = $text . $this->promptCaret . " ";
// prompt and return the answer
return $this->readUserI... | php | public function prompt($text) {
// send out any escaping to implement anything sitting in the desired state
$this->outputEscapeSequence();
// save off the prompt string
$prompt = $text . $this->promptCaret . " ";
// prompt and return the answer
return $this->readUserI... | [
"public",
"function",
"prompt",
"(",
"$",
"text",
")",
"{",
"// send out any escaping to implement anything sitting in the desired state",
"$",
"this",
"->",
"outputEscapeSequence",
"(",
")",
";",
"// save off the prompt string",
"$",
"prompt",
"=",
"$",
"text",
".",
"$... | Prompt for a value.
@param $text - the prompt string
@return string | [
"Prompt",
"for",
"a",
"value",
"."
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/Terminal.php#L447-L458 |
196,525 | 1HappyPlace/ansi-terminal | src/ANSI/Terminal.php | Terminal.getScreenHeight | public static function getScreenHeight() {
// set a simple error handler that indicates the exec function was disabled
set_error_handler("self::errorHandler", E_WARNING);
// initialize the array for the output of the execute
$output = [];
// execute the bash command tput cols ... | php | public static function getScreenHeight() {
// set a simple error handler that indicates the exec function was disabled
set_error_handler("self::errorHandler", E_WARNING);
// initialize the array for the output of the execute
$output = [];
// execute the bash command tput cols ... | [
"public",
"static",
"function",
"getScreenHeight",
"(",
")",
"{",
"// set a simple error handler that indicates the exec function was disabled",
"set_error_handler",
"(",
"\"self::errorHandler\"",
",",
"E_WARNING",
")",
";",
"// initialize the array for the output of the execute",
"$... | Get the current screen height
@uses errorHandler
@return int - the number of lines it holds
@throws RuntimeException | [
"Get",
"the",
"current",
"screen",
"height"
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/Terminal.php#L520-L548 |
196,526 | 1HappyPlace/ansi-terminal | src/ANSI/Terminal.php | Terminal.getScreenWidth | public static function getScreenWidth() {
// set a simple error handler that indicates the exec function was disabled
set_error_handler("self::errorHandler", E_WARNING);
// initialize the array for the output of the execute
$output = [];
// execute the bash command tput cols t... | php | public static function getScreenWidth() {
// set a simple error handler that indicates the exec function was disabled
set_error_handler("self::errorHandler", E_WARNING);
// initialize the array for the output of the execute
$output = [];
// execute the bash command tput cols t... | [
"public",
"static",
"function",
"getScreenWidth",
"(",
")",
"{",
"// set a simple error handler that indicates the exec function was disabled",
"set_error_handler",
"(",
"\"self::errorHandler\"",
",",
"E_WARNING",
")",
";",
"// initialize the array for the output of the execute",
"$"... | Get the current screen width
@uses errorHandler
@return int - the number of characters that will fit across the screen
@throws RuntimeException | [
"Get",
"the",
"current",
"screen",
"width"
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/Terminal.php#L557-L584 |
196,527 | timostamm/web-resource | src/ResourceResponse.php | ResourceResponse.sendContent | public function sendContent()
{
if (! $this->isSuccessful()) {
return parent::sendContent();
}
if (0 === $this->maxlen) {
return $this;
}
$out = fopen('php://output', 'wb');
$in = $this->resource->getStream();
stream_copy_to_stream($in, $out, $this->maxlen, $this->offset);
fclose($out... | php | public function sendContent()
{
if (! $this->isSuccessful()) {
return parent::sendContent();
}
if (0 === $this->maxlen) {
return $this;
}
$out = fopen('php://output', 'wb');
$in = $this->resource->getStream();
stream_copy_to_stream($in, $out, $this->maxlen, $this->offset);
fclose($out... | [
"public",
"function",
"sendContent",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isSuccessful",
"(",
")",
")",
"{",
"return",
"parent",
"::",
"sendContent",
"(",
")",
";",
"}",
"if",
"(",
"0",
"===",
"$",
"this",
"->",
"maxlen",
")",
"{",
... | Sends the resource.
{@inheritdoc} | [
"Sends",
"the",
"resource",
"."
] | 4c60e679093990585ee2f0a00029ab0a218573b8 | https://github.com/timostamm/web-resource/blob/4c60e679093990585ee2f0a00029ab0a218573b8/src/ResourceResponse.php#L195-L214 |
196,528 | ScaraMVC/Framework | src/Scara/Html/FormBuilder.php | FormBuilder.open | public function open($options = [])
{
$options['method'] = self::getMethod($options);
$options['action'] = self::getAction($options);
$options['accept-charset'] = 'UTF-8';
if (isset($options['files']) && $options['files']) {
$options['enctype'] = 'multipart/form-data';... | php | public function open($options = [])
{
$options['method'] = self::getMethod($options);
$options['action'] = self::getAction($options);
$options['accept-charset'] = 'UTF-8';
if (isset($options['files']) && $options['files']) {
$options['enctype'] = 'multipart/form-data';... | [
"public",
"function",
"open",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"[",
"'method'",
"]",
"=",
"self",
"::",
"getMethod",
"(",
"$",
"options",
")",
";",
"$",
"options",
"[",
"'action'",
"]",
"=",
"self",
"::",
"getAction",
"... | Open a new form object.
@param array $options - Form options
@return string | [
"Open",
"a",
"new",
"form",
"object",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Html/FormBuilder.php#L34-L49 |
196,529 | ScaraMVC/Framework | src/Scara/Html/FormBuilder.php | FormBuilder.input | public function input($type, $name, $value = '', $options = [])
{
if (!isset($options['id'])) {
$options['id'] = $name;
}
if (!empty($value)) {
$options['value'] = $value;
}
$options['type'] = $type;
$options['name'] = $name;
return ... | php | public function input($type, $name, $value = '', $options = [])
{
if (!isset($options['id'])) {
$options['id'] = $name;
}
if (!empty($value)) {
$options['value'] = $value;
}
$options['type'] = $type;
$options['name'] = $name;
return ... | [
"public",
"function",
"input",
"(",
"$",
"type",
",",
"$",
"name",
",",
"$",
"value",
"=",
"''",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"options",
"[",... | Creates a form input element.
@param string $type - The type of form input
@param string $name - The name of the input
@param string $value - The value of the input
@param array $options - The input's options
@return string | [
"Creates",
"a",
"form",
"input",
"element",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Html/FormBuilder.php#L75-L89 |
196,530 | ScaraMVC/Framework | src/Scara/Html/FormBuilder.php | FormBuilder.textarea | public function textarea($name, $value = '', $options = [])
{
if (!isset($options['id'])) {
$options['id'] = $name;
}
$options['name'] = $name;
return '<textarea'.$this->attributes($options).'>'.$value.'</textarea>';
} | php | public function textarea($name, $value = '', $options = [])
{
if (!isset($options['id'])) {
$options['id'] = $name;
}
$options['name'] = $name;
return '<textarea'.$this->attributes($options).'>'.$value.'</textarea>';
} | [
"public",
"function",
"textarea",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"''",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"options",
"[",
"'id'",
"]",
"... | Creates a textarea form input box.
@param string $name - The textarea's name
@param string $value - The textarea's value
@param array $options - The textarea's options
@return string | [
"Creates",
"a",
"textarea",
"form",
"input",
"box",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Html/FormBuilder.php#L156-L165 |
196,531 | ScaraMVC/Framework | src/Scara/Html/FormBuilder.php | FormBuilder.getAction | private function getAction($options)
{
if (isset($options['action'])) {
$action = $this->_generator->to($options['action']);
} else {
$action = $_SERVER['REQUEST_URI'];
}
return $action;
} | php | private function getAction($options)
{
if (isset($options['action'])) {
$action = $this->_generator->to($options['action']);
} else {
$action = $_SERVER['REQUEST_URI'];
}
return $action;
} | [
"private",
"function",
"getAction",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'action'",
"]",
")",
")",
"{",
"$",
"action",
"=",
"$",
"this",
"->",
"_generator",
"->",
"to",
"(",
"$",
"options",
"[",
"'action'",
... | Gets the form action.
@param array $options - The form's options
@return string | [
"Gets",
"the",
"form",
"action",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Html/FormBuilder.php#L228-L237 |
196,532 | ScaraMVC/Framework | src/Scara/Html/FormBuilder.php | FormBuilder.getId | private function getId($options)
{
$id = '';
if (!isset($options['id'])) {
$id = $options['name'];
} else {
$id = $options['id'];
}
return $id;
} | php | private function getId($options)
{
$id = '';
if (!isset($options['id'])) {
$id = $options['name'];
} else {
$id = $options['id'];
}
return $id;
} | [
"private",
"function",
"getId",
"(",
"$",
"options",
")",
"{",
"$",
"id",
"=",
"''",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"id",
"=",
"$",
"options",
"[",
"'name'",
"]",
";",
"}",
"else",
"{"... | Gets an input's id, or sets it if not supplied.
@param array $options - The input's options
@deprecated
@return string | [
"Gets",
"an",
"input",
"s",
"id",
"or",
"sets",
"it",
"if",
"not",
"supplied",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Html/FormBuilder.php#L248-L258 |
196,533 | Larium/http-client | src/Http/Client.php | Client.createStreamFromArray | public function createStreamFromArray(array $params)
{
$string = "";
foreach ($params as $key => $value) {
$string .= $key . '=' . urlencode(trim($value)) . '&';
}
$string = rtrim($string, "&");
return $this->createStream($string);
} | php | public function createStreamFromArray(array $params)
{
$string = "";
foreach ($params as $key => $value) {
$string .= $key . '=' . urlencode(trim($value)) . '&';
}
$string = rtrim($string, "&");
return $this->createStream($string);
} | [
"public",
"function",
"createStreamFromArray",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"string",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"string",
".=",
"$",
"key",
".",
"'='",
".",
... | Helper method to create a string stream from given array.
@param array $params
@return resource | [
"Helper",
"method",
"to",
"create",
"a",
"string",
"stream",
"from",
"given",
"array",
"."
] | b87934843f32da37ce60ec3878ccf090c981989d | https://github.com/Larium/http-client/blob/b87934843f32da37ce60ec3878ccf090c981989d/src/Http/Client.php#L158-L168 |
196,534 | OxfordInfoLabs/kinikit-core | src/Util/HTTP/WebServiceProxy.php | WebServiceProxy.callMethod | public function callMethod($name, $httpMethod = "POST", $params = array(), $payload = null, $returnClass = null, $expectedExceptions = null) {
$objectToFormatConverter = $this->dataFormat == self::DATA_FORMAT_JSON ? new ObjectToJSONConverter() : new ObjectToXMLConverter();
$formatToObjectConverter = $t... | php | public function callMethod($name, $httpMethod = "POST", $params = array(), $payload = null, $returnClass = null, $expectedExceptions = null) {
$objectToFormatConverter = $this->dataFormat == self::DATA_FORMAT_JSON ? new ObjectToJSONConverter() : new ObjectToXMLConverter();
$formatToObjectConverter = $t... | [
"public",
"function",
"callMethod",
"(",
"$",
"name",
",",
"$",
"httpMethod",
"=",
"\"POST\"",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"payload",
"=",
"null",
",",
"$",
"returnClass",
"=",
"null",
",",
"$",
"expectedExceptions",
"=",
"nul... | Implement the call method to call a proxy service
@param string $name
@param $httpMethod
@param array $params
@param mixed $payload
@param string $returnClass
@param array $expectedExceptions an array of expected exceptions. This can simply be a values array of class names or an associative array defining mappings to... | [
"Implement",
"the",
"call",
"method",
"to",
"call",
"a",
"proxy",
"service"
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/HTTP/WebServiceProxy.php#L62-L128 |
196,535 | azettl/php-nano-template | template.php | template.setTemplateFile | public function setTemplateFile(string $sRelativePathToFile) : void
{
if(!is_file($sRelativePathToFile)) {
throw new \Exception('Template file not found.');
}
$sFileContent = file_get_contents($sRelativePathToFile);
$this->setTemplate($sFileContent);
} | php | public function setTemplateFile(string $sRelativePathToFile) : void
{
if(!is_file($sRelativePathToFile)) {
throw new \Exception('Template file not found.');
}
$sFileContent = file_get_contents($sRelativePathToFile);
$this->setTemplate($sFileContent);
} | [
"public",
"function",
"setTemplateFile",
"(",
"string",
"$",
"sRelativePathToFile",
")",
":",
"void",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"sRelativePathToFile",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Template file not found.'",
")",
";"... | This method is used to set the template from a relative
path.
@param string $sRelativePathToFile the relative path to the template
@throws Exception if the file is not found
@return void | [
"This",
"method",
"is",
"used",
"to",
"set",
"the",
"template",
"from",
"a",
"relative",
"path",
"."
] | bd1100ad15d290d8d6e2a58d94ad7c977f69d859 | https://github.com/azettl/php-nano-template/blob/bd1100ad15d290d8d6e2a58d94ad7c977f69d859/template.php#L77-L85 |
196,536 | azettl/php-nano-template | template.php | template.render | public function render() : string
{
$sOutput = preg_replace_callback(
'/{(.*?)}/',
function ($aResult){
$aToSearch = explode('.', $aResult[1]);
$aSearchIn = $this->getData();
foreach ($aToSearch as $sKey) {
list(
$sFormattedKey,
$mParam
... | php | public function render() : string
{
$sOutput = preg_replace_callback(
'/{(.*?)}/',
function ($aResult){
$aToSearch = explode('.', $aResult[1]);
$aSearchIn = $this->getData();
foreach ($aToSearch as $sKey) {
list(
$sFormattedKey,
$mParam
... | [
"public",
"function",
"render",
"(",
")",
":",
"string",
"{",
"$",
"sOutput",
"=",
"preg_replace_callback",
"(",
"'/{(.*?)}/'",
",",
"function",
"(",
"$",
"aResult",
")",
"{",
"$",
"aToSearch",
"=",
"explode",
"(",
"'.'",
",",
"$",
"aResult",
"[",
"1",
... | This method replaces the placeholders in the template string with
the values from the data object and returns the new string.
@return string the string with the replaced placeholders | [
"This",
"method",
"replaces",
"the",
"placeholders",
"in",
"the",
"template",
"string",
"with",
"the",
"values",
"from",
"the",
"data",
"object",
"and",
"returns",
"the",
"new",
"string",
"."
] | bd1100ad15d290d8d6e2a58d94ad7c977f69d859 | https://github.com/azettl/php-nano-template/blob/bd1100ad15d290d8d6e2a58d94ad7c977f69d859/template.php#L154-L196 |
196,537 | SlabPHP/cache-manager | src/Providers/File.php | File.safelyReadData | private function safelyReadData($path)
{
$fp = fopen($path, 'r');
$retries = 0;
do {
if ($retries > 0) {
usleep(static::MS_BETWEEN_RETRIES * 1000); //100ms
}
$retries++;
} while (!flock($fp, LOCK_SH | LOCK_NB) && $retries <= stati... | php | private function safelyReadData($path)
{
$fp = fopen($path, 'r');
$retries = 0;
do {
if ($retries > 0) {
usleep(static::MS_BETWEEN_RETRIES * 1000); //100ms
}
$retries++;
} while (!flock($fp, LOCK_SH | LOCK_NB) && $retries <= stati... | [
"private",
"function",
"safelyReadData",
"(",
"$",
"path",
")",
"{",
"$",
"fp",
"=",
"fopen",
"(",
"$",
"path",
",",
"'r'",
")",
";",
"$",
"retries",
"=",
"0",
";",
"do",
"{",
"if",
"(",
"$",
"retries",
">",
"0",
")",
"{",
"usleep",
"(",
"stati... | Safely read data from a file
@param string $path
@return mixed | [
"Safely",
"read",
"data",
"from",
"a",
"file"
] | 7bbf9fe6519071fe14d382e98925cd3e10010a3a | https://github.com/SlabPHP/cache-manager/blob/7bbf9fe6519071fe14d382e98925cd3e10010a3a/src/Providers/File.php#L96-L119 |
196,538 | SlabPHP/cache-manager | src/Providers/File.php | File.safelyWriteData | private function safelyWriteData($path, $mode, $data)
{
$fp = fopen($path, $mode);
$retries = 0;
if (empty($fp)) {
return false;
}
do {
if ($retries > 0) {
usleep(static::MS_BETWEEN_RETRIES * 1000);
}
$retries... | php | private function safelyWriteData($path, $mode, $data)
{
$fp = fopen($path, $mode);
$retries = 0;
if (empty($fp)) {
return false;
}
do {
if ($retries > 0) {
usleep(static::MS_BETWEEN_RETRIES * 1000);
}
$retries... | [
"private",
"function",
"safelyWriteData",
"(",
"$",
"path",
",",
"$",
"mode",
",",
"$",
"data",
")",
"{",
"$",
"fp",
"=",
"fopen",
"(",
"$",
"path",
",",
"$",
"mode",
")",
";",
"$",
"retries",
"=",
"0",
";",
"if",
"(",
"empty",
"(",
"$",
"fp",
... | Safely write data to a file
@param string $path
@param string $mode
@param string $data
@return boolean | [
"Safely",
"write",
"data",
"to",
"a",
"file"
] | 7bbf9fe6519071fe14d382e98925cd3e10010a3a | https://github.com/SlabPHP/cache-manager/blob/7bbf9fe6519071fe14d382e98925cd3e10010a3a/src/Providers/File.php#L130-L158 |
196,539 | SlabPHP/cache-manager | src/Providers/File.php | File.processKey | protected function processKey($key)
{
$key = trim(strtolower($key));
$key = preg_replace('#[^a-z0-9\.]#', '-', $key) . '~' . $this->keySuffix;
return $key;
} | php | protected function processKey($key)
{
$key = trim(strtolower($key));
$key = preg_replace('#[^a-z0-9\.]#', '-', $key) . '~' . $this->keySuffix;
return $key;
} | [
"protected",
"function",
"processKey",
"(",
"$",
"key",
")",
"{",
"$",
"key",
"=",
"trim",
"(",
"strtolower",
"(",
"$",
"key",
")",
")",
";",
"$",
"key",
"=",
"preg_replace",
"(",
"'#[^a-z0-9\\.]#'",
",",
"'-'",
",",
"$",
"key",
")",
".",
"'~'",
".... | Process the key to be filename safe
@param string $key
@return string | [
"Process",
"the",
"key",
"to",
"be",
"filename",
"safe"
] | 7bbf9fe6519071fe14d382e98925cd3e10010a3a | https://github.com/SlabPHP/cache-manager/blob/7bbf9fe6519071fe14d382e98925cd3e10010a3a/src/Providers/File.php#L215-L221 |
196,540 | phossa/phossa-db | src/Phossa/Db/Statement/StatementAbstract.php | StatementAbstract.closePrevious | protected function closePrevious()
{
static $previous = [];
$id = spl_object_hash($this->getDriver());
if (isset($previous[$id]) && $previous[$id] !== $this->prepared) {
$this->realClose($previous[$id]);
}
$previous[$id] = $this->prepared;
retu... | php | protected function closePrevious()
{
static $previous = [];
$id = spl_object_hash($this->getDriver());
if (isset($previous[$id]) && $previous[$id] !== $this->prepared) {
$this->realClose($previous[$id]);
}
$previous[$id] = $this->prepared;
retu... | [
"protected",
"function",
"closePrevious",
"(",
")",
"{",
"static",
"$",
"previous",
"=",
"[",
"]",
";",
"$",
"id",
"=",
"spl_object_hash",
"(",
"$",
"this",
"->",
"getDriver",
"(",
")",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"previous",
"[",
"$",
... | Close previous prepared statement
@return $this
@access protected | [
"Close",
"previous",
"prepared",
"statement"
] | 9ef2c0e0c3047f4ff2ce6b0a218187025ac64d29 | https://github.com/phossa/phossa-db/blob/9ef2c0e0c3047f4ff2ce6b0a218187025ac64d29/src/Phossa/Db/Statement/StatementAbstract.php#L187-L198 |
196,541 | phossa/phossa-db | src/Phossa/Db/Statement/StatementAbstract.php | StatementAbstract.setError | protected function setError($resource)
{
if (is_string($resource)) {
$this->getDriver()->setError(
$resource, -1
);
} else {
$this->getDriver()->setError(
$this->realError($resource),
$this->realErrorCode($r... | php | protected function setError($resource)
{
if (is_string($resource)) {
$this->getDriver()->setError(
$resource, -1
);
} else {
$this->getDriver()->setError(
$this->realError($resource),
$this->realErrorCode($r... | [
"protected",
"function",
"setError",
"(",
"$",
"resource",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"resource",
")",
")",
"{",
"$",
"this",
"->",
"getDriver",
"(",
")",
"->",
"setError",
"(",
"$",
"resource",
",",
"-",
"1",
")",
";",
"}",
"else"... | Set driver error
@param mixed $resource
@access protected | [
"Set",
"driver",
"error"
] | 9ef2c0e0c3047f4ff2ce6b0a218187025ac64d29 | https://github.com/phossa/phossa-db/blob/9ef2c0e0c3047f4ff2ce6b0a218187025ac64d29/src/Phossa/Db/Statement/StatementAbstract.php#L206-L218 |
196,542 | blueblazeassociates/geocode-postalcodes | src/php/PostalCodes/Geocoders/PostalCodeGeocoderFactory.php | PostalCodeGeocoderFactory.createGeocodingProvider | public static function createGeocodingProvider( $provider_code = GeocodingProviders::GOOGLE_MAPS ) {
if ( GeocodingProviders::GOOGLE_MAPS != $provider_code ) {
throw new GeocodingException( 'Geocoding provider \'' . $provider_code . '\' not found.' );
}
return new \BlueBlazeAssociates\Geocoding\Posta... | php | public static function createGeocodingProvider( $provider_code = GeocodingProviders::GOOGLE_MAPS ) {
if ( GeocodingProviders::GOOGLE_MAPS != $provider_code ) {
throw new GeocodingException( 'Geocoding provider \'' . $provider_code . '\' not found.' );
}
return new \BlueBlazeAssociates\Geocoding\Posta... | [
"public",
"static",
"function",
"createGeocodingProvider",
"(",
"$",
"provider_code",
"=",
"GeocodingProviders",
"::",
"GOOGLE_MAPS",
")",
"{",
"if",
"(",
"GeocodingProviders",
"::",
"GOOGLE_MAPS",
"!=",
"$",
"provider_code",
")",
"{",
"throw",
"new",
"GeocodingExce... | Creates a geocoding provider based on a set code.
@param string $provider_code
@return PostalCodeGeocodingProvider
@throws GeocodingException Throws exception if geocoding provider can't be found. | [
"Creates",
"a",
"geocoding",
"provider",
"based",
"on",
"a",
"set",
"code",
"."
] | 3a9b6c68327b13f5dc15015e78223dd215e8d4ea | https://github.com/blueblazeassociates/geocode-postalcodes/blob/3a9b6c68327b13f5dc15015e78223dd215e8d4ea/src/php/PostalCodes/Geocoders/PostalCodeGeocoderFactory.php#L23-L31 |
196,543 | blueblazeassociates/geocode-postalcodes | src/php/PostalCodes/Geocoders/PostalCodeGeocoderFactory.php | PostalCodeGeocoderFactory.createGeocoder | public static function createGeocoder( $country_code = CountryCodes::US, $provider_code = GeocodingProviders::GOOGLE_MAPS ) {
if ( CountryCodes::US != $country_code ) {
throw new GeocodingException( 'PostalCode geocoder for country \'' . $country_code . '\' not found.' );
}
$geocoding_provider = stat... | php | public static function createGeocoder( $country_code = CountryCodes::US, $provider_code = GeocodingProviders::GOOGLE_MAPS ) {
if ( CountryCodes::US != $country_code ) {
throw new GeocodingException( 'PostalCode geocoder for country \'' . $country_code . '\' not found.' );
}
$geocoding_provider = stat... | [
"public",
"static",
"function",
"createGeocoder",
"(",
"$",
"country_code",
"=",
"CountryCodes",
"::",
"US",
",",
"$",
"provider_code",
"=",
"GeocodingProviders",
"::",
"GOOGLE_MAPS",
")",
"{",
"if",
"(",
"CountryCodes",
"::",
"US",
"!=",
"$",
"country_code",
... | Create a country specific geocoder for postal codes.
@param CountryCode $countrycode
@return BasePostalCodeGeocoder
@throws GeocodingException Throws exception if country code isn't supported.
@throws GeocodingException Throws exception if geocoding provider can't be found. | [
"Create",
"a",
"country",
"specific",
"geocoder",
"for",
"postal",
"codes",
"."
] | 3a9b6c68327b13f5dc15015e78223dd215e8d4ea | https://github.com/blueblazeassociates/geocode-postalcodes/blob/3a9b6c68327b13f5dc15015e78223dd215e8d4ea/src/php/PostalCodes/Geocoders/PostalCodeGeocoderFactory.php#L43-L53 |
196,544 | fridge-project/dbal | src/Fridge/DBAL/ConnectionFactory.php | ConnectionFactory.create | public static function create(array $parameters, Configuration $configuration = null)
{
if (isset($parameters['driver_class'])) {
if (!in_array('Fridge\DBAL\Driver\DriverInterface', class_implements($parameters['driver_class']))) {
throw FactoryException::driverMustImplementDrive... | php | public static function create(array $parameters, Configuration $configuration = null)
{
if (isset($parameters['driver_class'])) {
if (!in_array('Fridge\DBAL\Driver\DriverInterface', class_implements($parameters['driver_class']))) {
throw FactoryException::driverMustImplementDrive... | [
"public",
"static",
"function",
"create",
"(",
"array",
"$",
"parameters",
",",
"Configuration",
"$",
"configuration",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"parameters",
"[",
"'driver_class'",
"]",
")",
")",
"{",
"if",
"(",
"!",
"in_array... | Creates a DBAL connection.
$parameters must contain at least:
- driver (string) (ex: pdo_mysql, pdo_pgsql)
OR
- driver_class (string) (ex: Fridge\DBAL\Driver\MySQLDriver)
If you use driver & driver_class parameters simultaneously, the driver_class will be used.
$parameters can contain:
- connection_class (string) (e... | [
"Creates",
"a",
"DBAL",
"connection",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/ConnectionFactory.php#L78-L110 |
196,545 | radioactivehamster/temporal | src/Calendar/Day.php | Day.getName | public function getName()
{
switch ($this->ofWeek) {
case Carbon::MONDAY:
$name = 'Monday';
break;
case Carbon::TUESDAY:
$name = 'Tuesday';
break;
case Carbon::WEDNESDAY:
$name = 'Wednesday'... | php | public function getName()
{
switch ($this->ofWeek) {
case Carbon::MONDAY:
$name = 'Monday';
break;
case Carbon::TUESDAY:
$name = 'Tuesday';
break;
case Carbon::WEDNESDAY:
$name = 'Wednesday'... | [
"public",
"function",
"getName",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"ofWeek",
")",
"{",
"case",
"Carbon",
"::",
"MONDAY",
":",
"$",
"name",
"=",
"'Monday'",
";",
"break",
";",
"case",
"Carbon",
"::",
"TUESDAY",
":",
"$",
"name",
"=",
... | Gets the day's name.
@return string | [
"Gets",
"the",
"day",
"s",
"name",
"."
] | bfdfc853af70af507165f50d9e92ad78ad75897c | https://github.com/radioactivehamster/temporal/blob/bfdfc853af70af507165f50d9e92ad78ad75897c/src/Calendar/Day.php#L86-L122 |
196,546 | CQD/minorwork | src/App.php | App.get | public function get($name)
{
if (isset($this->items[$name])) {
return $this->items[$name];
}
if (!isset($this->itemSetting[$name])) {
return null;
}
$itemSetting = $this->itemSetting[$name];
if (is_callable($itemSetting)) {
$item ... | php | public function get($name)
{
if (isset($this->items[$name])) {
return $this->items[$name];
}
if (!isset($this->itemSetting[$name])) {
return null;
}
$itemSetting = $this->itemSetting[$name];
if (is_callable($itemSetting)) {
$item ... | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"items",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"items",
"[",
"$",
"name",
"]",
";",
"}",
"if",
"(",
"!",
"isset"... | Get an item from container
@param string $name name for desired item | [
"Get",
"an",
"item",
"from",
"container"
] | 281ad61cf350603bdf026a36c98b32c70e728297 | https://github.com/CQD/minorwork/blob/281ad61cf350603bdf026a36c98b32c70e728297/src/App.php#L56-L77 |
196,547 | CQD/minorwork | src/App.php | App.set | public function set($name, $value = null)
{
$values = is_array($name) ? $name : [$name => $value];
foreach ($values as $name => $value) {
$this->itemSetting[$name] = $value;
}
unset($this->items[$name]);
} | php | public function set($name, $value = null)
{
$values = is_array($name) ? $name : [$name => $value];
foreach ($values as $name => $value) {
$this->itemSetting[$name] = $value;
}
unset($this->items[$name]);
} | [
"public",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"values",
"=",
"is_array",
"(",
"$",
"name",
")",
"?",
"$",
"name",
":",
"[",
"$",
"name",
"=>",
"$",
"value",
"]",
";",
"foreach",
"(",
"$",
"values"... | Set one or multiple items, or factory function of items, or class of items, into DI container. | [
"Set",
"one",
"or",
"multiple",
"items",
"or",
"factory",
"function",
"of",
"items",
"or",
"class",
"of",
"items",
"into",
"DI",
"container",
"."
] | 281ad61cf350603bdf026a36c98b32c70e728297 | https://github.com/CQD/minorwork/blob/281ad61cf350603bdf026a36c98b32c70e728297/src/App.php#L87-L95 |
196,548 | CQD/minorwork | src/App.php | App.setRouting | public function setRouting(array $routings = [])
{
$this->dispatcher = null;
$this->routings = $routings + $this->routings;
foreach ($this->routings as $name => &$routing) {
if (1 == count($routing)) {
array_unshift($routing, '/' . ltrim($name, '/'));
... | php | public function setRouting(array $routings = [])
{
$this->dispatcher = null;
$this->routings = $routings + $this->routings;
foreach ($this->routings as $name => &$routing) {
if (1 == count($routing)) {
array_unshift($routing, '/' . ltrim($name, '/'));
... | [
"public",
"function",
"setRouting",
"(",
"array",
"$",
"routings",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"dispatcher",
"=",
"null",
";",
"$",
"this",
"->",
"routings",
"=",
"$",
"routings",
"+",
"$",
"this",
"->",
"routings",
";",
"foreach",
"(... | Set app routing.
TODO group routing support | [
"Set",
"app",
"routing",
"."
] | 281ad61cf350603bdf026a36c98b32c70e728297 | https://github.com/CQD/minorwork/blob/281ad61cf350603bdf026a36c98b32c70e728297/src/App.php#L107-L120 |
196,549 | CQD/minorwork | src/App.php | App.handlerAlias | public function handlerAlias($name, $value = null)
{
$alias = is_array($name) ? $name : [$name => $value];
$this->handlerAlias = $alias + $this->handlerAlias;
} | php | public function handlerAlias($name, $value = null)
{
$alias = is_array($name) ? $name : [$name => $value];
$this->handlerAlias = $alias + $this->handlerAlias;
} | [
"public",
"function",
"handlerAlias",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"alias",
"=",
"is_array",
"(",
"$",
"name",
")",
"?",
"$",
"name",
":",
"[",
"$",
"name",
"=>",
"$",
"value",
"]",
";",
"$",
"this",
"->",
"h... | Set alias name for request handlers | [
"Set",
"alias",
"name",
"for",
"request",
"handlers"
] | 281ad61cf350603bdf026a36c98b32c70e728297 | https://github.com/CQD/minorwork/blob/281ad61cf350603bdf026a36c98b32c70e728297/src/App.php#L125-L129 |
196,550 | CQD/minorwork | src/App.php | App.route | public function route($method, $uri)
{
// Remove subfolder from URI if needed
$baseDir = $this->get('___.baseDir');
if ("/" !== $baseDir && 0 === strpos($uri, $baseDir)) {
$uri = substr($uri, strlen($baseDir));
}
// Check which route is being used.
$routi... | php | public function route($method, $uri)
{
// Remove subfolder from URI if needed
$baseDir = $this->get('___.baseDir');
if ("/" !== $baseDir && 0 === strpos($uri, $baseDir)) {
$uri = substr($uri, strlen($baseDir));
}
// Check which route is being used.
$routi... | [
"public",
"function",
"route",
"(",
"$",
"method",
",",
"$",
"uri",
")",
"{",
"// Remove subfolder from URI if needed",
"$",
"baseDir",
"=",
"$",
"this",
"->",
"get",
"(",
"'___.baseDir'",
")",
";",
"if",
"(",
"\"/\"",
"!==",
"$",
"baseDir",
"&&",
"0",
"... | Determin which route to use and parameters in uri.
@param string $method HTTP Method used
@param string $uri request path, without query string
@return array|null [$routeName, $params] | [
"Determin",
"which",
"route",
"to",
"use",
"and",
"parameters",
"in",
"uri",
"."
] | 281ad61cf350603bdf026a36c98b32c70e728297 | https://github.com/CQD/minorwork/blob/281ad61cf350603bdf026a36c98b32c70e728297/src/App.php#L146-L170 |
196,551 | CQD/minorwork | src/App.php | App.patternToPath | private function patternToPath($pattern, $params)
{
// Inspired by https://github.com/nikic/FastRoute/issues/66
// but uses named params, don't care param order and size
$routeParser = new RouteParserStd;
$routes = $routeParser->parse($pattern);
// check from the longest rou... | php | private function patternToPath($pattern, $params)
{
// Inspired by https://github.com/nikic/FastRoute/issues/66
// but uses named params, don't care param order and size
$routeParser = new RouteParserStd;
$routes = $routeParser->parse($pattern);
// check from the longest rou... | [
"private",
"function",
"patternToPath",
"(",
"$",
"pattern",
",",
"$",
"params",
")",
"{",
"// Inspired by https://github.com/nikic/FastRoute/issues/66",
"// but uses named params, don't care param order and size",
"$",
"routeParser",
"=",
"new",
"RouteParserStd",
";",
"$",
"... | Convert url pattern to actual path | [
"Convert",
"url",
"pattern",
"to",
"actual",
"path"
] | 281ad61cf350603bdf026a36c98b32c70e728297 | https://github.com/CQD/minorwork/blob/281ad61cf350603bdf026a36c98b32c70e728297/src/App.php#L218-L248 |
196,552 | CQD/minorwork | src/App.php | App.run | public function run($options = [])
{
$method = @$options['method'] ?: $_SERVER['REQUEST_METHOD'];
$uri = @$options['uri'] ?: rawurldecode($_SERVER['REQUEST_URI']);
if (false !== $pos = strpos($uri, '?')) {
$uri = substr($uri, 0, $pos);
}
$routeInfo = $this->rout... | php | public function run($options = [])
{
$method = @$options['method'] ?: $_SERVER['REQUEST_METHOD'];
$uri = @$options['uri'] ?: rawurldecode($_SERVER['REQUEST_URI']);
if (false !== $pos = strpos($uri, '?')) {
$uri = substr($uri, 0, $pos);
}
$routeInfo = $this->rout... | [
"public",
"function",
"run",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"method",
"=",
"@",
"$",
"options",
"[",
"'method'",
"]",
"?",
":",
"$",
"_SERVER",
"[",
"'REQUEST_METHOD'",
"]",
";",
"$",
"uri",
"=",
"@",
"$",
"options",
"[",
"'ur... | Entry point for application | [
"Entry",
"point",
"for",
"application"
] | 281ad61cf350603bdf026a36c98b32c70e728297 | https://github.com/CQD/minorwork/blob/281ad61cf350603bdf026a36c98b32c70e728297/src/App.php#L253-L275 |
196,553 | CQD/minorwork | src/App.php | App.runAs | public function runAs($routeName, $params = [])
{
if (!isset($this->routings[$routeName])) {
throw new \Exception("Route name '{$routeName}' not found!");
}
// populate handler queue
$handler = end($this->routings[$routeName]);
$this->appendHandlerQueue($handler)... | php | public function runAs($routeName, $params = [])
{
if (!isset($this->routings[$routeName])) {
throw new \Exception("Route name '{$routeName}' not found!");
}
// populate handler queue
$handler = end($this->routings[$routeName]);
$this->appendHandlerQueue($handler)... | [
"public",
"function",
"runAs",
"(",
"$",
"routeName",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"routings",
"[",
"$",
"routeName",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"... | Handle current request using specificed route handler | [
"Handle",
"current",
"request",
"using",
"specificed",
"route",
"handler"
] | 281ad61cf350603bdf026a36c98b32c70e728297 | https://github.com/CQD/minorwork/blob/281ad61cf350603bdf026a36c98b32c70e728297/src/App.php#L280-L298 |
196,554 | CQD/minorwork | src/App.php | App.executeHandler | public function executeHandler($handler, $params, $prevOutput = null)
{
// a function(-ish) thing which can be called
if (is_callable($handler)) {
return $handler($this, $params, $prevOutput);
}
// aliased handler
if ($actualHandler = @$this->handlerAlias[$handle... | php | public function executeHandler($handler, $params, $prevOutput = null)
{
// a function(-ish) thing which can be called
if (is_callable($handler)) {
return $handler($this, $params, $prevOutput);
}
// aliased handler
if ($actualHandler = @$this->handlerAlias[$handle... | [
"public",
"function",
"executeHandler",
"(",
"$",
"handler",
",",
"$",
"params",
",",
"$",
"prevOutput",
"=",
"null",
")",
"{",
"// a function(-ish) thing which can be called",
"if",
"(",
"is_callable",
"(",
"$",
"handler",
")",
")",
"{",
"return",
"$",
"handl... | Parse and execute request handler | [
"Parse",
"and",
"execute",
"request",
"handler"
] | 281ad61cf350603bdf026a36c98b32c70e728297 | https://github.com/CQD/minorwork/blob/281ad61cf350603bdf026a36c98b32c70e728297/src/App.php#L335-L362 |
196,555 | Steveorevo/GString | src/GString.php | GString.hashCode | public function hashCode() {
$h = $this->hash;
$l = $this->length();
if ( $h == 0 && $l > 0 ) {
for ( $i = 0; $i < $l; $i ++ ) {
$h = (int) ( 31 * $h + $this->charCodeAt( $i ) );
}
$this->hash = $h;
}
return $h;
} | php | public function hashCode() {
$h = $this->hash;
$l = $this->length();
if ( $h == 0 && $l > 0 ) {
for ( $i = 0; $i < $l; $i ++ ) {
$h = (int) ( 31 * $h + $this->charCodeAt( $i ) );
}
$this->hash = $h;
}
return $h;
} | [
"public",
"function",
"hashCode",
"(",
")",
"{",
"$",
"h",
"=",
"$",
"this",
"->",
"hash",
";",
"$",
"l",
"=",
"$",
"this",
"->",
"length",
"(",
")",
";",
"if",
"(",
"$",
"h",
"==",
"0",
"&&",
"$",
"l",
">",
"0",
")",
"{",
"for",
"(",
"$"... | Returns a hash code for this string.
@access public
@return int a hash code for this string. | [
"Returns",
"a",
"hash",
"code",
"for",
"this",
"string",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L246-L257 |
196,556 | Steveorevo/GString | src/GString.php | GString.indexOf | public function indexOf( $sequence, $fromIndex = 0, $ignoreCase = false ) {
if ( $fromIndex < 0 ) {
$fromIndex = 0;
} else if ( $fromIndex >= $this->length() ) {
return - 1;
}
if ( $ignoreCase == false ) {
$index = strpos( $this->value, $sequence, $fromIndex );
} else {
$index = stripos( $this->va... | php | public function indexOf( $sequence, $fromIndex = 0, $ignoreCase = false ) {
if ( $fromIndex < 0 ) {
$fromIndex = 0;
} else if ( $fromIndex >= $this->length() ) {
return - 1;
}
if ( $ignoreCase == false ) {
$index = strpos( $this->value, $sequence, $fromIndex );
} else {
$index = stripos( $this->va... | [
"public",
"function",
"indexOf",
"(",
"$",
"sequence",
",",
"$",
"fromIndex",
"=",
"0",
",",
"$",
"ignoreCase",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"fromIndex",
"<",
"0",
")",
"{",
"$",
"fromIndex",
"=",
"0",
";",
"}",
"else",
"if",
"(",
"$",... | Returns the index within this string of the first occurrence of the specified
string, optionally starting the search at the specified index.
@access public
@param string $sequence A string
@param int $fromIndex The index to start the search from
@param boolean $ignoreCase If true, ignore case
@return int the index o... | [
"Returns",
"the",
"index",
"within",
"this",
"string",
"of",
"the",
"first",
"occurrence",
"of",
"the",
"specified",
"string",
"optionally",
"starting",
"the",
"search",
"at",
"the",
"specified",
"index",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L271-L284 |
196,557 | Steveorevo/GString | src/GString.php | GString.lastIndexOf | public function lastIndexOf( $sequence, $fromIndex = 0, $ignoreCase = false ) {
if ( $fromIndex < 0 ) {
$fromIndex = 0;
} else if ( $fromIndex >= $this->length() ) {
return - 1;
}
if ( $ignoreCase == false ) {
$index = strrpos( $this->value, $sequence, $fromIndex );
} else {
$index = strripos( $th... | php | public function lastIndexOf( $sequence, $fromIndex = 0, $ignoreCase = false ) {
if ( $fromIndex < 0 ) {
$fromIndex = 0;
} else if ( $fromIndex >= $this->length() ) {
return - 1;
}
if ( $ignoreCase == false ) {
$index = strrpos( $this->value, $sequence, $fromIndex );
} else {
$index = strripos( $th... | [
"public",
"function",
"lastIndexOf",
"(",
"$",
"sequence",
",",
"$",
"fromIndex",
"=",
"0",
",",
"$",
"ignoreCase",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"fromIndex",
"<",
"0",
")",
"{",
"$",
"fromIndex",
"=",
"0",
";",
"}",
"else",
"if",
"(",
... | Returns the index within this string of the last occurrence of the specified
string, searching backward starting at the specified index.
@access public
@param string $sequence A string
@param int $fromIndex The index to start the search from
@param boolean $ignoreCase If true, ignore case
@return int the index of th... | [
"Returns",
"the",
"index",
"within",
"this",
"string",
"of",
"the",
"last",
"occurrence",
"of",
"the",
"specified",
"string",
"searching",
"backward",
"starting",
"at",
"the",
"specified",
"index",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L338-L351 |
196,558 | Steveorevo/GString | src/GString.php | GString.matches | public function matches( $regex, & $matches = null ) {
$match = preg_match( $regex, $this->value, $matches );
for ( $i = 0, $l = count( $matches ); $i < $l; $i ++ ) {
$matches[ $i ] = new GString( $matches[ $i ] );
}
return $match == 1;
} | php | public function matches( $regex, & $matches = null ) {
$match = preg_match( $regex, $this->value, $matches );
for ( $i = 0, $l = count( $matches ); $i < $l; $i ++ ) {
$matches[ $i ] = new GString( $matches[ $i ] );
}
return $match == 1;
} | [
"public",
"function",
"matches",
"(",
"$",
"regex",
",",
"&",
"$",
"matches",
"=",
"null",
")",
"{",
"$",
"match",
"=",
"preg_match",
"(",
"$",
"regex",
",",
"$",
"this",
"->",
"value",
",",
"$",
"matches",
")",
";",
"for",
"(",
"$",
"i",
"=",
... | Tells whether or not this string matches the given regular expression.
@access public
@param string $regex The regular expression to which this string is to be matched
@param array $matches This will be set to the results of the search
@return boolean true if the string matches the given regular expression. | [
"Tells",
"whether",
"or",
"not",
"this",
"string",
"matches",
"the",
"given",
"regular",
"expression",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L389-L396 |
196,559 | Steveorevo/GString | src/GString.php | GString.padLeft | public function padLeft( $length, $padString ) {
return new GString( str_pad( $this->value, $length, $padString, STR_PAD_LEFT ) );
} | php | public function padLeft( $length, $padString ) {
return new GString( str_pad( $this->value, $length, $padString, STR_PAD_LEFT ) );
} | [
"public",
"function",
"padLeft",
"(",
"$",
"length",
",",
"$",
"padString",
")",
"{",
"return",
"new",
"GString",
"(",
"str_pad",
"(",
"$",
"this",
"->",
"value",
",",
"$",
"length",
",",
"$",
"padString",
",",
"STR_PAD_LEFT",
")",
")",
";",
"}"
] | Returns the left padded string to a certain length with the specified string.
@access public
@param int $length The length to pad the string to
@param string $padString The string to pad with
@return \String the resulting string. | [
"Returns",
"the",
"left",
"padded",
"string",
"to",
"a",
"certain",
"length",
"with",
"the",
"specified",
"string",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L408-L410 |
196,560 | Steveorevo/GString | src/GString.php | GString.padRight | public function padRight( $length, $padString ) {
return new GString( str_pad( $this->value, $length, $padString, STR_PAD_RIGHT ) );
} | php | public function padRight( $length, $padString ) {
return new GString( str_pad( $this->value, $length, $padString, STR_PAD_RIGHT ) );
} | [
"public",
"function",
"padRight",
"(",
"$",
"length",
",",
"$",
"padString",
")",
"{",
"return",
"new",
"GString",
"(",
"str_pad",
"(",
"$",
"this",
"->",
"value",
",",
"$",
"length",
",",
"$",
"padString",
",",
"STR_PAD_RIGHT",
")",
")",
";",
"}"
] | Returns the right padded string to a certain length with the specified string.
@access public
@param int $length The length to pad the string to
@param string $padString The string to pad with
@return \String the resulting string. | [
"Returns",
"the",
"right",
"padded",
"string",
"to",
"a",
"certain",
"length",
"with",
"the",
"specified",
"string",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L422-L424 |
196,561 | Steveorevo/GString | src/GString.php | GString.regionCompare | public function regionCompare( $offseta, $str, $offsetb, $length, $ignoreCase = false ) {
$a = $this->substring( $offseta );
$b = new GString( $str );
$b = $b->substring( $offsetb );
if ( $ignoreCase == false ) {
return strncmp( $a, $b, $length );
} else {
return strncasecmp( $a, $b, $length );
}
} | php | public function regionCompare( $offseta, $str, $offsetb, $length, $ignoreCase = false ) {
$a = $this->substring( $offseta );
$b = new GString( $str );
$b = $b->substring( $offsetb );
if ( $ignoreCase == false ) {
return strncmp( $a, $b, $length );
} else {
return strncasecmp( $a, $b, $length );
}
} | [
"public",
"function",
"regionCompare",
"(",
"$",
"offseta",
",",
"$",
"str",
",",
"$",
"offsetb",
",",
"$",
"length",
",",
"$",
"ignoreCase",
"=",
"false",
")",
"{",
"$",
"a",
"=",
"$",
"this",
"->",
"substring",
"(",
"$",
"offseta",
")",
";",
"$",... | Compare two string regions.
@access public
@param int $offseta The starting offset of the subregion in this string
@param string $str The string argument
@param int $offsetb The starting offset of the subregion in the string argument
@param int $length The number of characters to compare
@param boolean $ignoreCase If... | [
"Compare",
"two",
"string",
"regions",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L439-L448 |
196,562 | Steveorevo/GString | src/GString.php | GString.regionCompareIgnoreCase | public function regionCompareIgnoreCase( $offseta, $str, $offsetb, $length ) {
return $this->regionCompare( $offseta, $str, $offsetb, $length, true );
} | php | public function regionCompareIgnoreCase( $offseta, $str, $offsetb, $length ) {
return $this->regionCompare( $offseta, $str, $offsetb, $length, true );
} | [
"public",
"function",
"regionCompareIgnoreCase",
"(",
"$",
"offseta",
",",
"$",
"str",
",",
"$",
"offsetb",
",",
"$",
"length",
")",
"{",
"return",
"$",
"this",
"->",
"regionCompare",
"(",
"$",
"offseta",
",",
"$",
"str",
",",
"$",
"offsetb",
",",
"$",... | Compare two string regions, ignoring case differences.
@access public
@param int $offseta The starting offset of the subregion in this string
@param string $str The string argument
@param int $offsetb The starting offset of the subregion in the string argument
@param int $length The number of characters to compare
@... | [
"Compare",
"two",
"string",
"regions",
"ignoring",
"case",
"differences",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L462-L464 |
196,563 | Steveorevo/GString | src/GString.php | GString.regionMatches | public function regionMatches( $offseta, $str, $offsetb, $length ) {
return $this->regionCompare( $offseta, $str, $offsetb, $length ) == 0;
} | php | public function regionMatches( $offseta, $str, $offsetb, $length ) {
return $this->regionCompare( $offseta, $str, $offsetb, $length ) == 0;
} | [
"public",
"function",
"regionMatches",
"(",
"$",
"offseta",
",",
"$",
"str",
",",
"$",
"offsetb",
",",
"$",
"length",
")",
"{",
"return",
"$",
"this",
"->",
"regionCompare",
"(",
"$",
"offseta",
",",
"$",
"str",
",",
"$",
"offsetb",
",",
"$",
"length... | Tests if two string regions are equal.
@access public
@param int $offseta The starting offset of the subregion in this string
@param string $str The string argument
@param int $offsetb The starting offset of the subregion in the string argument
@param int $length The number of characters to compare
@return bool true... | [
"Tests",
"if",
"two",
"string",
"regions",
"are",
"equal",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L478-L480 |
196,564 | Steveorevo/GString | src/GString.php | GString.regionMatchesIgnoreCase | public function regionMatchesIgnoreCase( $offseta, $str, $offsetb, $length ) {
return $this->regionCompareIgnoreCase( $offseta, $str, $offsetb, $length ) == 0;
} | php | public function regionMatchesIgnoreCase( $offseta, $str, $offsetb, $length ) {
return $this->regionCompareIgnoreCase( $offseta, $str, $offsetb, $length ) == 0;
} | [
"public",
"function",
"regionMatchesIgnoreCase",
"(",
"$",
"offseta",
",",
"$",
"str",
",",
"$",
"offsetb",
",",
"$",
"length",
")",
"{",
"return",
"$",
"this",
"->",
"regionCompareIgnoreCase",
"(",
"$",
"offseta",
",",
"$",
"str",
",",
"$",
"offsetb",
"... | Tests if two string regions are equal, ignoring case differences.
@access public
@param int $offseta The starting offset of the subregion in this string
@param string $str The string argument
@param int $offsetb The starting offset of the subregion in the string argument
@param int $length The number of characters to... | [
"Tests",
"if",
"two",
"string",
"regions",
"are",
"equal",
"ignoring",
"case",
"differences",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L494-L496 |
196,565 | Steveorevo/GString | src/GString.php | GString.replace | public function replace( $search, $replacement, & $count = 0 ) {
return new GString( str_replace( $search, $replacement, $this->value, $count ) );
} | php | public function replace( $search, $replacement, & $count = 0 ) {
return new GString( str_replace( $search, $replacement, $this->value, $count ) );
} | [
"public",
"function",
"replace",
"(",
"$",
"search",
",",
"$",
"replacement",
",",
"&",
"$",
"count",
"=",
"0",
")",
"{",
"return",
"new",
"GString",
"(",
"str_replace",
"(",
"$",
"search",
",",
"$",
"replacement",
",",
"$",
"this",
"->",
"value",
",... | Returns a new GString resulting from replacing all occurrences of the search
string with the replacement string.
@access public
@param string $search The old string
@param string $replacement The new GString
@param int $count This will be set to the number of replacements performed
@return \String the resulting stri... | [
"Returns",
"a",
"new",
"GString",
"resulting",
"from",
"replacing",
"all",
"occurrences",
"of",
"the",
"search",
"string",
"with",
"the",
"replacement",
"string",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L510-L512 |
196,566 | Steveorevo/GString | src/GString.php | GString.replaceAll | public function replaceAll( $regex, $replacement, $limit = - 1, & $count = 0 ) {
return new GString( preg_replace( $regex, $replacement, $this->value, $limit, $count ) );
} | php | public function replaceAll( $regex, $replacement, $limit = - 1, & $count = 0 ) {
return new GString( preg_replace( $regex, $replacement, $this->value, $limit, $count ) );
} | [
"public",
"function",
"replaceAll",
"(",
"$",
"regex",
",",
"$",
"replacement",
",",
"$",
"limit",
"=",
"-",
"1",
",",
"&",
"$",
"count",
"=",
"0",
")",
"{",
"return",
"new",
"GString",
"(",
"preg_replace",
"(",
"$",
"regex",
",",
"$",
"replacement",... | Replaces each substring of this string that matches the given regular
expression with the given replacement.
@access public
@param string $regex The regular expression to which this string is to be matched
@param string $replacement The string to be substituted for each match
@param int $limit The limit threshold
@pa... | [
"Replaces",
"each",
"substring",
"of",
"this",
"string",
"that",
"matches",
"the",
"given",
"regular",
"expression",
"with",
"the",
"given",
"replacement",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L527-L529 |
196,567 | Steveorevo/GString | src/GString.php | GString.replaceIgnoreCase | public function replaceIgnoreCase( $search, $replacement, & $count = 0 ) {
return new GString( str_ireplace( $search, $replacement, $this->value, $count ) );
} | php | public function replaceIgnoreCase( $search, $replacement, & $count = 0 ) {
return new GString( str_ireplace( $search, $replacement, $this->value, $count ) );
} | [
"public",
"function",
"replaceIgnoreCase",
"(",
"$",
"search",
",",
"$",
"replacement",
",",
"&",
"$",
"count",
"=",
"0",
")",
"{",
"return",
"new",
"GString",
"(",
"str_ireplace",
"(",
"$",
"search",
",",
"$",
"replacement",
",",
"$",
"this",
"->",
"v... | Returns a new GString resulting from replacing all occurrences of the search
string with the replacement string, ignoring case differences.
@access public
@param string $search The old string
@param string $replacement The new GString
@param int $count This will be set to the number of replacements performed
@return... | [
"Returns",
"a",
"new",
"GString",
"resulting",
"from",
"replacing",
"all",
"occurrences",
"of",
"the",
"search",
"string",
"with",
"the",
"replacement",
"string",
"ignoring",
"case",
"differences",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L558-L560 |
196,568 | Steveorevo/GString | src/GString.php | GString.split | public function split( $regex, $limit = - 1 ) {
$parts = preg_split( $regex, $this->value, $limit );
for ( $i = 0, $l = count( $parts ); $i < $l; $i ++ ) {
$parts[ $i ] = new GString( $parts[ $i ] );
}
return $parts;
} | php | public function split( $regex, $limit = - 1 ) {
$parts = preg_split( $regex, $this->value, $limit );
for ( $i = 0, $l = count( $parts ); $i < $l; $i ++ ) {
$parts[ $i ] = new GString( $parts[ $i ] );
}
return $parts;
} | [
"public",
"function",
"split",
"(",
"$",
"regex",
",",
"$",
"limit",
"=",
"-",
"1",
")",
"{",
"$",
"parts",
"=",
"preg_split",
"(",
"$",
"regex",
",",
"$",
"this",
"->",
"value",
",",
"$",
"limit",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
",... | Splits this string around matches of the given regular expression.
@access public
@param string $regex The delimiting regular expression
@param int $limit The result threshold
@return array the resulting array of strings. | [
"Splits",
"this",
"string",
"around",
"matches",
"of",
"the",
"given",
"regular",
"expression",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L582-L589 |
196,569 | Steveorevo/GString | src/GString.php | GString.startsWith | public function startsWith( $prefix, $fromIndex = 0 ) {
$pattern = "/^" . preg_quote( $prefix ) . "/";
return $this->substring( $fromIndex )->matches( $pattern );
} | php | public function startsWith( $prefix, $fromIndex = 0 ) {
$pattern = "/^" . preg_quote( $prefix ) . "/";
return $this->substring( $fromIndex )->matches( $pattern );
} | [
"public",
"function",
"startsWith",
"(",
"$",
"prefix",
",",
"$",
"fromIndex",
"=",
"0",
")",
"{",
"$",
"pattern",
"=",
"\"/^\"",
".",
"preg_quote",
"(",
"$",
"prefix",
")",
".",
"\"/\"",
";",
"return",
"$",
"this",
"->",
"substring",
"(",
"$",
"from... | Tests if this string starts with the specified prefix, optionally checking
for a match at the specified index.
@access public
@param string $prefix The prefix
@param int $fromIndex Where to begin looking in this string
@return boolean true if the string starts with the given prefix. | [
"Tests",
"if",
"this",
"string",
"starts",
"with",
"the",
"specified",
"prefix",
"optionally",
"checking",
"for",
"a",
"match",
"at",
"the",
"specified",
"index",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L602-L606 |
196,570 | Steveorevo/GString | src/GString.php | GString.substring | public function substring( $beginIndex, $endIndex = null ) {
if ( $beginIndex < 0 ) {
throw new GStringIndexOutOfBoundsException( $beginIndex );
} else if ( $beginIndex == $this->length() ) {
return new GString( "" );
}
if ( $endIndex === null ) {
$length = $this->length() - $beginIndex;
if ( $lengt... | php | public function substring( $beginIndex, $endIndex = null ) {
if ( $beginIndex < 0 ) {
throw new GStringIndexOutOfBoundsException( $beginIndex );
} else if ( $beginIndex == $this->length() ) {
return new GString( "" );
}
if ( $endIndex === null ) {
$length = $this->length() - $beginIndex;
if ( $lengt... | [
"public",
"function",
"substring",
"(",
"$",
"beginIndex",
",",
"$",
"endIndex",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"beginIndex",
"<",
"0",
")",
"{",
"throw",
"new",
"GStringIndexOutOfBoundsException",
"(",
"$",
"beginIndex",
")",
";",
"}",
"else",
"... | Returns a new GString that is a substring of this string.
@access public
@param int $beginIndex The beginning index, inclusive
@param int $endIndex The ending index, exclusive
@return \String the specified substring.
@throws StringIndexOutOfBoundsException | [
"Returns",
"a",
"new",
"GString",
"that",
"is",
"a",
"substring",
"of",
"this",
"string",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L619-L649 |
196,571 | Steveorevo/GString | src/GString.php | GString.delRightMost | public function delRightMost( $sSearch ) {
$sSource = $this->value;
for ( $i = strlen( $sSource ); $i >= 0; $i = $i - 1 ) {
$f = strpos( $sSource, $sSearch, $i );
if ( $f !== false ) {
return new GString( substr( $sSource, 0, $f ) );
break;
}
}
return new GString( $sSource );
} | php | public function delRightMost( $sSearch ) {
$sSource = $this->value;
for ( $i = strlen( $sSource ); $i >= 0; $i = $i - 1 ) {
$f = strpos( $sSource, $sSearch, $i );
if ( $f !== false ) {
return new GString( substr( $sSource, 0, $f ) );
break;
}
}
return new GString( $sSource );
} | [
"public",
"function",
"delRightMost",
"(",
"$",
"sSearch",
")",
"{",
"$",
"sSource",
"=",
"$",
"this",
"->",
"value",
";",
"for",
"(",
"$",
"i",
"=",
"strlen",
"(",
"$",
"sSource",
")",
";",
"$",
"i",
">=",
"0",
";",
"$",
"i",
"=",
"$",
"i",
... | Deletes the right most string from the found search string
starting from right to left, including the search string itself.
@access public
@return string | [
"Deletes",
"the",
"right",
"most",
"string",
"from",
"the",
"found",
"search",
"string",
"starting",
"from",
"right",
"to",
"left",
"including",
"the",
"search",
"string",
"itself",
"."
] | 69150558cdbeca33ae03b4becce47c7cc0de495c | https://github.com/Steveorevo/GString/blob/69150558cdbeca33ae03b4becce47c7cc0de495c/src/GString.php#L730-L741 |
196,572 | shgysk8zer0/core_api | traits/url.php | URL.URLToString | final protected function URLToString(array $components = array(
'scheme',
'user',
'pass',
'host',
'port',
'path',
'query',
'fragment'
))
{
$url = '';
$query = "{$this->query}";
if (in_array('scheme', $components)) {
if (is_string($this->_url_data['scheme'])) {
$url .= rtrim($this->_url_da... | php | final protected function URLToString(array $components = array(
'scheme',
'user',
'pass',
'host',
'port',
'path',
'query',
'fragment'
))
{
$url = '';
$query = "{$this->query}";
if (in_array('scheme', $components)) {
if (is_string($this->_url_data['scheme'])) {
$url .= rtrim($this->_url_da... | [
"final",
"protected",
"function",
"URLToString",
"(",
"array",
"$",
"components",
"=",
"array",
"(",
"'scheme'",
",",
"'user'",
",",
"'pass'",
",",
"'host'",
",",
"'port'",
",",
"'path'",
",",
"'query'",
",",
"'fragment'",
")",
")",
"{",
"$",
"url",
"=",... | Combine URL components into a URL string
@param void
@return string | [
"Combine",
"URL",
"components",
"into",
"a",
"URL",
"string"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/url.php#L147-L206 |
196,573 | freialib/fenrir.system | src/Trait/SQLStatementCommon.php | SQLStatementCommonTrait.fetch_calc | function fetch_calc($on_null = null) {
$calc_entry = $this->fetch_entry();
$value = array_pop($calc_entry);
if ($value !== null) {
return $value;
}
else { // null value
return $on_null;
}
} | php | function fetch_calc($on_null = null) {
$calc_entry = $this->fetch_entry();
$value = array_pop($calc_entry);
if ($value !== null) {
return $value;
}
else { // null value
return $on_null;
}
} | [
"function",
"fetch_calc",
"(",
"$",
"on_null",
"=",
"null",
")",
"{",
"$",
"calc_entry",
"=",
"$",
"this",
"->",
"fetch_entry",
"(",
")",
";",
"$",
"value",
"=",
"array_pop",
"(",
"$",
"calc_entry",
")",
";",
"if",
"(",
"$",
"value",
"!==",
"null",
... | Shorthand for retrieving value from a querie that performs a COUNT, SUM
or some other calculation.
@return mixed | [
"Shorthand",
"for",
"retrieving",
"value",
"from",
"a",
"querie",
"that",
"performs",
"a",
"COUNT",
"SUM",
"or",
"some",
"other",
"calculation",
"."
] | 388d360dbc3bc6dcf85b09bb06e08a2dce8f3ec8 | https://github.com/freialib/fenrir.system/blob/388d360dbc3bc6dcf85b09bb06e08a2dce8f3ec8/src/Trait/SQLStatementCommon.php#L57-L67 |
196,574 | horntell/php-sdk | src/Horntell/Horn.php | Horn.toProfiles | public function toProfiles($profiles, $horn)
{
$horn = array_merge(['profile_uids' => $profiles], $horn);
return $this->request->send('POST', "/profiles/horns", $horn);
} | php | public function toProfiles($profiles, $horn)
{
$horn = array_merge(['profile_uids' => $profiles], $horn);
return $this->request->send('POST', "/profiles/horns", $horn);
} | [
"public",
"function",
"toProfiles",
"(",
"$",
"profiles",
",",
"$",
"horn",
")",
"{",
"$",
"horn",
"=",
"array_merge",
"(",
"[",
"'profile_uids'",
"=>",
"$",
"profiles",
"]",
",",
"$",
"horn",
")",
";",
"return",
"$",
"this",
"->",
"request",
"->",
"... | Sends a horn to a multiple profiles
@param array $horn
@return Horntell\Http\Response | [
"Sends",
"a",
"horn",
"to",
"a",
"multiple",
"profiles"
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/src/Horntell/Horn.php#L38-L43 |
196,575 | Ydle/HubBundle | Entity/Node.php | Node.hasType | public function hasType(NodeType $type)
{
foreach ($this->types as $t) {
if ($t->getId() == $type->getId()) { return true; }
}
return false;
} | php | public function hasType(NodeType $type)
{
foreach ($this->types as $t) {
if ($t->getId() == $type->getId()) { return true; }
}
return false;
} | [
"public",
"function",
"hasType",
"(",
"NodeType",
"$",
"type",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"types",
"as",
"$",
"t",
")",
"{",
"if",
"(",
"$",
"t",
"->",
"getId",
"(",
")",
"==",
"$",
"type",
"->",
"getId",
"(",
")",
")",
"{",
... | Check if a node got a specific type
@param Ydle\HubBundle\Entity\NodeType $type
@return boolean | [
"Check",
"if",
"a",
"node",
"got",
"a",
"specific",
"type"
] | 7fa423241246bcfd115f2ed3ad3997b4b63adb01 | https://github.com/Ydle/HubBundle/blob/7fa423241246bcfd115f2ed3ad3997b4b63adb01/Entity/Node.php#L265-L272 |
196,576 | nails/module-blog | admin/controllers/Category.php | Category.delete | public function delete()
{
if (!userHasPermission('admin:blog:category:' . $this->blog->id . ':delete')) {
unauthorised();
}
// --------------------------------------------------------------------------
$id = $this->uri->segment(6);
if ($this->blog_category_mo... | php | public function delete()
{
if (!userHasPermission('admin:blog:category:' . $this->blog->id . ':delete')) {
unauthorised();
}
// --------------------------------------------------------------------------
$id = $this->uri->segment(6);
if ($this->blog_category_mo... | [
"public",
"function",
"delete",
"(",
")",
"{",
"if",
"(",
"!",
"userHasPermission",
"(",
"'admin:blog:category:'",
".",
"$",
"this",
"->",
"blog",
"->",
"id",
".",
"':delete'",
")",
")",
"{",
"unauthorised",
"(",
")",
";",
"}",
"// --------------------------... | Delete a blog category
@return void | [
"Delete",
"a",
"blog",
"category"
] | 7b369c5209f4343fff7c7e2a22c237d5a95c8c24 | https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/admin/controllers/Category.php#L332-L356 |
196,577 | jbouzekri/SculpinTagCloudBundle | Component/Strategy/AlphaStrategy.php | AlphaStrategy.process | public function process(\Jb\Bundle\TagCloudBundle\Model\TagCloud $cloud)
{
$keys = array_keys($cloud->getTags());
asort($keys);
$new = array();
$old = $cloud->getTags();
foreach($keys as $key) {
$new[$key] = $old[$key];
}
$cloud->setTags($new);
... | php | public function process(\Jb\Bundle\TagCloudBundle\Model\TagCloud $cloud)
{
$keys = array_keys($cloud->getTags());
asort($keys);
$new = array();
$old = $cloud->getTags();
foreach($keys as $key) {
$new[$key] = $old[$key];
}
$cloud->setTags($new);
... | [
"public",
"function",
"process",
"(",
"\\",
"Jb",
"\\",
"Bundle",
"\\",
"TagCloudBundle",
"\\",
"Model",
"\\",
"TagCloud",
"$",
"cloud",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"cloud",
"->",
"getTags",
"(",
")",
")",
";",
"asort",
"(",
"... | Sort the tag in the cloud
@param \Jb\Bundle\TagCloudBundle\Model\TagCloud $cloud | [
"Sort",
"the",
"tag",
"in",
"the",
"cloud"
] | 936cf34ce60cb8fb4774931b1841fc775a3e9208 | https://github.com/jbouzekri/SculpinTagCloudBundle/blob/936cf34ce60cb8fb4774931b1841fc775a3e9208/Component/Strategy/AlphaStrategy.php#L17-L30 |
196,578 | bkstg/schedule-bundle | Controller/EventController.php | EventController.createAction | public function createAction(
string $production_slug,
AuthorizationCheckerInterface $auth,
TokenStorageInterface $token_storage,
Request $request
): Response {
// Lookup the production by production_slug.
$production_repo = $this->em->getRepository(Production::class)... | php | public function createAction(
string $production_slug,
AuthorizationCheckerInterface $auth,
TokenStorageInterface $token_storage,
Request $request
): Response {
// Lookup the production by production_slug.
$production_repo = $this->em->getRepository(Production::class)... | [
"public",
"function",
"createAction",
"(",
"string",
"$",
"production_slug",
",",
"AuthorizationCheckerInterface",
"$",
"auth",
",",
"TokenStorageInterface",
"$",
"token_storage",
",",
"Request",
"$",
"request",
")",
":",
"Response",
"{",
"// Lookup the production by pr... | Create a new standalone event.
@param string $production_slug The slug for the production.
@param AuthorizationCheckerInterface $auth The authorization checker service.
@param TokenStorageInterface $token_storage The token storage service.
@param Request ... | [
"Create",
"a",
"new",
"standalone",
"event",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Controller/EventController.php#L45-L113 |
196,579 | bkstg/schedule-bundle | Controller/EventController.php | EventController.readAction | public function readAction(
string $production_slug,
int $id,
AuthorizationCheckerInterface $auth
): Response {
// Get the event and production for this action.
list($event, $production) = $this->lookupEntity(Event::class, $id, $production_slug);
// If this event is ... | php | public function readAction(
string $production_slug,
int $id,
AuthorizationCheckerInterface $auth
): Response {
// Get the event and production for this action.
list($event, $production) = $this->lookupEntity(Event::class, $id, $production_slug);
// If this event is ... | [
"public",
"function",
"readAction",
"(",
"string",
"$",
"production_slug",
",",
"int",
"$",
"id",
",",
"AuthorizationCheckerInterface",
"$",
"auth",
")",
":",
"Response",
"{",
"// Get the event and production for this action.",
"list",
"(",
"$",
"event",
",",
"$",
... | Show a single event.
@param string $production_slug The slug for the production.
@param int $id The event id.
@param AuthorizationCheckerInterface $auth The authorization checker service.
@throws AccessDeniedException When the user is not in the... | [
"Show",
"a",
"single",
"event",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Controller/EventController.php#L126-L149 |
196,580 | bkstg/schedule-bundle | Controller/EventController.php | EventController.updateAction | public function updateAction(
string $production_slug,
int $id,
AuthorizationCheckerInterface $auth,
TokenStorageInterface $token,
Request $request
): Response {
// Get the event and production for this action.
list($event, $production) = $this->lookupEntity(E... | php | public function updateAction(
string $production_slug,
int $id,
AuthorizationCheckerInterface $auth,
TokenStorageInterface $token,
Request $request
): Response {
// Get the event and production for this action.
list($event, $production) = $this->lookupEntity(E... | [
"public",
"function",
"updateAction",
"(",
"string",
"$",
"production_slug",
",",
"int",
"$",
"id",
",",
"AuthorizationCheckerInterface",
"$",
"auth",
",",
"TokenStorageInterface",
"$",
"token",
",",
"Request",
"$",
"request",
")",
":",
"Response",
"{",
"// Get ... | Update a standalone event.
@param string $production_slug The slug for the production.
@param int $id The event id.
@param AuthorizationCheckerInterface $auth The authorization checker service.
@param TokenStorageInterface $token ... | [
"Update",
"a",
"standalone",
"event",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Controller/EventController.php#L164-L226 |
196,581 | bkstg/schedule-bundle | Controller/EventController.php | EventController.archiveAction | public function archiveAction(
string $production_slug,
PaginatorInterface $paginator,
AuthorizationCheckerInterface $auth,
Request $request
): Response {
// Lookup the production by production_slug.
$production_repo = $this->em->getRepository(Production::class);
... | php | public function archiveAction(
string $production_slug,
PaginatorInterface $paginator,
AuthorizationCheckerInterface $auth,
Request $request
): Response {
// Lookup the production by production_slug.
$production_repo = $this->em->getRepository(Production::class);
... | [
"public",
"function",
"archiveAction",
"(",
"string",
"$",
"production_slug",
",",
"PaginatorInterface",
"$",
"paginator",
",",
"AuthorizationCheckerInterface",
"$",
"auth",
",",
"Request",
"$",
"request",
")",
":",
"Response",
"{",
"// Lookup the production by producti... | Show a list of archived events.
@param string $production_slug The production to look in.
@param PaginatorInterface $paginator The paginator service.
@param AuthorizationCheckerInterface $auth The authorization checker service.
@param Request $re... | [
"Show",
"a",
"list",
"of",
"archived",
"events",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Controller/EventController.php#L305-L333 |
196,582 | bkstg/schedule-bundle | Controller/EventController.php | EventController.checkSchedule | private function checkSchedule(Event $event, Production $production): ?RedirectResponse
{
// If this event is handled by a schedule generate a redirect there.
if (null !== $schedule = $event->getSchedule()) {
return new RedirectResponse($this->url_generator->generate(
'bk... | php | private function checkSchedule(Event $event, Production $production): ?RedirectResponse
{
// If this event is handled by a schedule generate a redirect there.
if (null !== $schedule = $event->getSchedule()) {
return new RedirectResponse($this->url_generator->generate(
'bk... | [
"private",
"function",
"checkSchedule",
"(",
"Event",
"$",
"event",
",",
"Production",
"$",
"production",
")",
":",
"?",
"RedirectResponse",
"{",
"// If this event is handled by a schedule generate a redirect there.",
"if",
"(",
"null",
"!==",
"$",
"schedule",
"=",
"$... | Check if an event has a parent schedule.
@param Event $event The event to check.
@param Production $production The production this event is in.
@return RedirectResponse | [
"Check",
"if",
"an",
"event",
"has",
"a",
"parent",
"schedule",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Controller/EventController.php#L343-L357 |
196,583 | kkthek/diqa-util | src/Util/FileUtils.php | FileUtils.last_lines | public static function last_lines($path, $line_count, $offset = 0, $block_size = 512){
$lines = array();
// we will always have a fragment of a non-complete line
// keep this in here till we have our next entire line.
$leftover = "";
$fh = fopen($path, 'r');
$storeOffset = $offset;
// go to the end of... | php | public static function last_lines($path, $line_count, $offset = 0, $block_size = 512){
$lines = array();
// we will always have a fragment of a non-complete line
// keep this in here till we have our next entire line.
$leftover = "";
$fh = fopen($path, 'r');
$storeOffset = $offset;
// go to the end of... | [
"public",
"static",
"function",
"last_lines",
"(",
"$",
"path",
",",
"$",
"line_count",
",",
"$",
"offset",
"=",
"0",
",",
"$",
"block_size",
"=",
"512",
")",
"{",
"$",
"lines",
"=",
"array",
"(",
")",
";",
"// we will always have a fragment of a non-complet... | Shows the last lines of a text-file.
@param string $path
@param int $line_count
@param ont $offset (negative value from the end of file)
@param int $block_size
@return multitype: | [
"Shows",
"the",
"last",
"lines",
"of",
"a",
"text",
"-",
"file",
"."
] | df35d16403b5dbf0f7570daded6cfa26814ae7e0 | https://github.com/kkthek/diqa-util/blob/df35d16403b5dbf0f7570daded6cfa26814ae7e0/src/Util/FileUtils.php#L15-L60 |
196,584 | ScaraMVC/Framework | src/Scara/Validation/Validator.php | Validator.getLang | private function getLang()
{
$path = $this->_config->get('langpath')
.$this->_config->get('lang');
if (file_exists($path.'/validation.php')) {
$this->_lang = require_once $path.'/validation.php';
} else {
$this->_lang = require_once $this->_config->get('langp... | php | private function getLang()
{
$path = $this->_config->get('langpath')
.$this->_config->get('lang');
if (file_exists($path.'/validation.php')) {
$this->_lang = require_once $path.'/validation.php';
} else {
$this->_lang = require_once $this->_config->get('langp... | [
"private",
"function",
"getLang",
"(",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"_config",
"->",
"get",
"(",
"'langpath'",
")",
".",
"$",
"this",
"->",
"_config",
"->",
"get",
"(",
"'lang'",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"path... | Gets the language pack.
@return void | [
"Gets",
"the",
"language",
"pack",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/Validator.php#L63-L77 |
196,585 | ScaraMVC/Framework | src/Scara/Validation/Validator.php | Validator.make | public function make($input, $rules = [])
{
$this->_input = $input;
foreach ($rules as $key => $value) {
$this->validateInput($input, $rules, $key);
}
return $this;
} | php | public function make($input, $rules = [])
{
$this->_input = $input;
foreach ($rules as $key => $value) {
$this->validateInput($input, $rules, $key);
}
return $this;
} | [
"public",
"function",
"make",
"(",
"$",
"input",
",",
"$",
"rules",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"_input",
"=",
"$",
"input",
";",
"foreach",
"(",
"$",
"rules",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
... | Creates validation.
@param array $input - Form input array
@param array $rules - Validation rules
@return \Scara\Validation\Validator | [
"Creates",
"validation",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/Validator.php#L87-L95 |
196,586 | ScaraMVC/Framework | src/Scara/Validation/Validator.php | Validator.isValid | public function isValid()
{
$valid = true;
foreach ($this->_errors as $input => $message) {
foreach ($message as $item) {
if (!empty($item)) {
$valid = false;
}
}
}
foreach ($this->_input as $key => $value) ... | php | public function isValid()
{
$valid = true;
foreach ($this->_errors as $input => $message) {
foreach ($message as $item) {
if (!empty($item)) {
$valid = false;
}
}
}
foreach ($this->_input as $key => $value) ... | [
"public",
"function",
"isValid",
"(",
")",
"{",
"$",
"valid",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"_errors",
"as",
"$",
"input",
"=>",
"$",
"message",
")",
"{",
"foreach",
"(",
"$",
"message",
"as",
"$",
"item",
")",
"{",
"if",
"... | Checks to see if the validation passed.
@return bool | [
"Checks",
"to",
"see",
"if",
"the",
"validation",
"passed",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/Validator.php#L102-L118 |
196,587 | ScaraMVC/Framework | src/Scara/Validation/Validator.php | Validator.validateInput | private function validateInput($input, $rules, $key)
{
if (isset($input[$key]) && isset($rules[$key])) {
$ruleExp = explode('|', $rules[$key]);
foreach ($ruleExp as $rule) {
$this->parseRule($rule, $input, $key);
}
}
} | php | private function validateInput($input, $rules, $key)
{
if (isset($input[$key]) && isset($rules[$key])) {
$ruleExp = explode('|', $rules[$key]);
foreach ($ruleExp as $rule) {
$this->parseRule($rule, $input, $key);
}
}
} | [
"private",
"function",
"validateInput",
"(",
"$",
"input",
",",
"$",
"rules",
",",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"input",
"[",
"$",
"key",
"]",
")",
"&&",
"isset",
"(",
"$",
"rules",
"[",
"$",
"key",
"]",
")",
")",
"{",
... | Validates the given input.
@param array $input - Form input array
@param array $rules - Validation rules
@param string $key - Validation option
@return void | [
"Validates",
"the",
"given",
"input",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/Validator.php#L139-L148 |
196,588 | ScaraMVC/Framework | src/Scara/Validation/Validator.php | Validator.parseRule | private function parseRule($rule, $input, $key)
{
$ruleExp = explode(':', $rule);
if (count($ruleExp) > 1) {
switch ($ruleExp[0]) {
case 'match':
$this->_errors[$key][] = $this->_parser->match($input, $key, $ruleExp[1], $this->_lang['match']);
... | php | private function parseRule($rule, $input, $key)
{
$ruleExp = explode(':', $rule);
if (count($ruleExp) > 1) {
switch ($ruleExp[0]) {
case 'match':
$this->_errors[$key][] = $this->_parser->match($input, $key, $ruleExp[1], $this->_lang['match']);
... | [
"private",
"function",
"parseRule",
"(",
"$",
"rule",
",",
"$",
"input",
",",
"$",
"key",
")",
"{",
"$",
"ruleExp",
"=",
"explode",
"(",
"':'",
",",
"$",
"rule",
")",
";",
"if",
"(",
"count",
"(",
"$",
"ruleExp",
")",
">",
"1",
")",
"{",
"switc... | Parses a given rule with the given input.
@param string $rule - The rule being parsed
@param array $input - Form input array
@param string $key - Validation option | [
"Parses",
"a",
"given",
"rule",
"with",
"the",
"given",
"input",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/Validator.php#L157-L188 |
196,589 | ApatisArchive/ArrayStorage | src/Collection.php | Collection.sort | public function sort($sort = null)
{
if ($sort !== null && ! is_int($sort)) {
throw new \InvalidArgumentException(
'Invalid sort type. Sort type must ne integer.',
E_USER_ERROR
);
}
return $sort === null
? sort($this->store... | php | public function sort($sort = null)
{
if ($sort !== null && ! is_int($sort)) {
throw new \InvalidArgumentException(
'Invalid sort type. Sort type must ne integer.',
E_USER_ERROR
);
}
return $sort === null
? sort($this->store... | [
"public",
"function",
"sort",
"(",
"$",
"sort",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"sort",
"!==",
"null",
"&&",
"!",
"is_int",
"(",
"$",
"sort",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid sort type. Sort type must n... | Sort an array collection
@param null|int $sort
@return bool
@throws \InvalidArgumentException | [
"Sort",
"an",
"array",
"collection"
] | 4f6515164352f2997275278b89884fc1e885e7d9 | https://github.com/ApatisArchive/ArrayStorage/blob/4f6515164352f2997275278b89884fc1e885e7d9/src/Collection.php#L264-L276 |
196,590 | ekyna/Table | Registry.php | Registry.resolveColumnType | private function resolveColumnType(Column\ColumnTypeInterface $type)
{
$typeExtensions = [];
$parentType = $type->getParent();
$class = get_class($type);
foreach ($this->extensions as $extension) {
$typeExtensions = array_merge(
$typeExtensions,
... | php | private function resolveColumnType(Column\ColumnTypeInterface $type)
{
$typeExtensions = [];
$parentType = $type->getParent();
$class = get_class($type);
foreach ($this->extensions as $extension) {
$typeExtensions = array_merge(
$typeExtensions,
... | [
"private",
"function",
"resolveColumnType",
"(",
"Column",
"\\",
"ColumnTypeInterface",
"$",
"type",
")",
"{",
"$",
"typeExtensions",
"=",
"[",
"]",
";",
"$",
"parentType",
"=",
"$",
"type",
"->",
"getParent",
"(",
")",
";",
"$",
"class",
"=",
"get_class",... | Wraps a type into a ResolvedColumnTypeInterface implementation
and connects it with its parent type.
@param Column\ColumnTypeInterface $type The type to resolve
@return Column\ResolvedColumnTypeInterface The resolved type | [
"Wraps",
"a",
"type",
"into",
"a",
"ResolvedColumnTypeInterface",
"implementation",
"and",
"connects",
"it",
"with",
"its",
"parent",
"type",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Registry.php#L181-L199 |
196,591 | ekyna/Table | Registry.php | Registry.resolveFilterType | private function resolveFilterType(Filter\FilterTypeInterface $type)
{
$typeExtensions = [];
$parentType = $type->getParent();
$class = get_class($type);
foreach ($this->extensions as $extension) {
$typeExtensions = array_merge(
$typeExtensions,
... | php | private function resolveFilterType(Filter\FilterTypeInterface $type)
{
$typeExtensions = [];
$parentType = $type->getParent();
$class = get_class($type);
foreach ($this->extensions as $extension) {
$typeExtensions = array_merge(
$typeExtensions,
... | [
"private",
"function",
"resolveFilterType",
"(",
"Filter",
"\\",
"FilterTypeInterface",
"$",
"type",
")",
"{",
"$",
"typeExtensions",
"=",
"[",
"]",
";",
"$",
"parentType",
"=",
"$",
"type",
"->",
"getParent",
"(",
")",
";",
"$",
"class",
"=",
"get_class",... | Wraps a type into a ResolvedFilterTypeInterface implementation
and connects it with its parent type.
@param Filter\FilterTypeInterface $type The type to resolve
@return Filter\ResolvedFilterTypeInterface The resolved type | [
"Wraps",
"a",
"type",
"into",
"a",
"ResolvedFilterTypeInterface",
"implementation",
"and",
"connects",
"it",
"with",
"its",
"parent",
"type",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Registry.php#L257-L275 |
196,592 | ekyna/Table | Registry.php | Registry.resolveActionType | private function resolveActionType(Action\ActionTypeInterface $type)
{
$typeExtensions = [];
$parentType = $type->getParent();
$class = get_class($type);
foreach ($this->extensions as $extension) {
$typeExtensions = array_merge(
$typeExtensions,
... | php | private function resolveActionType(Action\ActionTypeInterface $type)
{
$typeExtensions = [];
$parentType = $type->getParent();
$class = get_class($type);
foreach ($this->extensions as $extension) {
$typeExtensions = array_merge(
$typeExtensions,
... | [
"private",
"function",
"resolveActionType",
"(",
"Action",
"\\",
"ActionTypeInterface",
"$",
"type",
")",
"{",
"$",
"typeExtensions",
"=",
"[",
"]",
";",
"$",
"parentType",
"=",
"$",
"type",
"->",
"getParent",
"(",
")",
";",
"$",
"class",
"=",
"get_class",... | Wraps a type into a ResolvedActionTypeInterface implementation
and connects it with its parent type.
@param Action\ActionTypeInterface $type The type to resolve
@return Action\ResolvedActionTypeInterface The resolved type | [
"Wraps",
"a",
"type",
"into",
"a",
"ResolvedActionTypeInterface",
"implementation",
"and",
"connects",
"it",
"with",
"its",
"parent",
"type",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Registry.php#L333-L351 |
196,593 | fulgurio/LightCMSBundle | Controller/AdminMenuController.php | AdminMenuController.upAction | public function upAction($pageId, $menuName)
{
$pageMenuRepo = $this->getDoctrine()->getRepository('FulgurioLightCMSBundle:PageMenu');
$pageMenu = $pageMenuRepo->findOneBy(array('page' => $pageId, 'label' => $menuName));
$position = $pageMenu->getPosition();
if ($position > 1)
... | php | public function upAction($pageId, $menuName)
{
$pageMenuRepo = $this->getDoctrine()->getRepository('FulgurioLightCMSBundle:PageMenu');
$pageMenu = $pageMenuRepo->findOneBy(array('page' => $pageId, 'label' => $menuName));
$position = $pageMenu->getPosition();
if ($position > 1)
... | [
"public",
"function",
"upAction",
"(",
"$",
"pageId",
",",
"$",
"menuName",
")",
"{",
"$",
"pageMenuRepo",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getRepository",
"(",
"'FulgurioLightCMSBundle:PageMenu'",
")",
";",
"$",
"pageMenu",
"=",
"$",
... | Move up page position in menu
@param number $pageId
@param string $menuName
@return | [
"Move",
"up",
"page",
"position",
"in",
"menu"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Controller/AdminMenuController.php#L46-L63 |
196,594 | fulgurio/LightCMSBundle | Controller/AdminMenuController.php | AdminMenuController.changePositionAction | public function changePositionAction($pageId, $menuName, $newPosition)
{
if ($this->getRequest()->isXmlHttpRequest())
{
$pageMenuRepo = $this->getDoctrine()->getRepository('FulgurioLightCMSBundle:PageMenu');
$pageMenu = $pageMenuRepo->findOneBy(array('page' => $pageId, 'label... | php | public function changePositionAction($pageId, $menuName, $newPosition)
{
if ($this->getRequest()->isXmlHttpRequest())
{
$pageMenuRepo = $this->getDoctrine()->getRepository('FulgurioLightCMSBundle:PageMenu');
$pageMenu = $pageMenuRepo->findOneBy(array('page' => $pageId, 'label... | [
"public",
"function",
"changePositionAction",
"(",
"$",
"pageId",
",",
"$",
"menuName",
",",
"$",
"newPosition",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"isXmlHttpRequest",
"(",
")",
")",
"{",
"$",
"pageMenuRepo",
"=",
"$",
... | Change position of page in menu, in ajax
@throws AccessDeniedException
@param number $pageId
@param string $menuName
@param number $newPosition
@return Response | [
"Change",
"position",
"of",
"page",
"in",
"menu",
"in",
"ajax"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Controller/AdminMenuController.php#L100-L140 |
196,595 | bytic/MediaLibrary | src/Media/Traits/FileMethodsTrait.php | FileMethodsTrait.getPath | public function getPath(string $conversionName = ''): string
{
if (!$this->hasFile()) {
throw new Exception('Error getting path for media with no file');
}
$path = $this->getFile()->getPath();
if ($conversionName) {
$path = $this->getBasePath()
... | php | public function getPath(string $conversionName = ''): string
{
if (!$this->hasFile()) {
throw new Exception('Error getting path for media with no file');
}
$path = $this->getFile()->getPath();
if ($conversionName) {
$path = $this->getBasePath()
... | [
"public",
"function",
"getPath",
"(",
"string",
"$",
"conversionName",
"=",
"''",
")",
":",
"string",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasFile",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Error getting path for media with no file'",
")",... | Get the path to the original media file.
@param string $conversionName
@return string
@throws Exception | [
"Get",
"the",
"path",
"to",
"the",
"original",
"media",
"file",
"."
] | c52783e726b512184bd72e04d829d6f93242a61d | https://github.com/bytic/MediaLibrary/blob/c52783e726b512184bd72e04d829d6f93242a61d/src/Media/Traits/FileMethodsTrait.php#L92-L107 |
196,596 | ptlis/grep-db | src/Metadata/MySQL/TableMetadata.php | TableMetadata.getColumnMetadata | public function getColumnMetadata(string $columnName): ColumnMetadata
{
if (!array_key_exists($columnName, $this->columnMetadataList)) {
throw new \RuntimeException('Table "' . $this->tableName . '" doesn\'t contain column "' . $columnName . '"');
}
return $this->columnMetadataL... | php | public function getColumnMetadata(string $columnName): ColumnMetadata
{
if (!array_key_exists($columnName, $this->columnMetadataList)) {
throw new \RuntimeException('Table "' . $this->tableName . '" doesn\'t contain column "' . $columnName . '"');
}
return $this->columnMetadataL... | [
"public",
"function",
"getColumnMetadata",
"(",
"string",
"$",
"columnName",
")",
":",
"ColumnMetadata",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"columnName",
",",
"$",
"this",
"->",
"columnMetadataList",
")",
")",
"{",
"throw",
"new",
"\\",
"Runt... | Get the metadata for a single column.
@throws \RuntimeException when the column does not exist. | [
"Get",
"the",
"metadata",
"for",
"a",
"single",
"column",
"."
] | 7abff68982d426690d0515ccd7adc7a2e3d72a3f | https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Metadata/MySQL/TableMetadata.php#L103-L110 |
196,597 | ptlis/grep-db | src/Metadata/MySQL/TableMetadata.php | TableMetadata.hasStringTypeColumn | public function hasStringTypeColumn(): bool
{
$hasStringType = false;
foreach ($this->columnMetadataList as $columnMetadata) {
$hasStringType = $hasStringType || $columnMetadata->isStringType();
}
return $hasStringType;
} | php | public function hasStringTypeColumn(): bool
{
$hasStringType = false;
foreach ($this->columnMetadataList as $columnMetadata) {
$hasStringType = $hasStringType || $columnMetadata->isStringType();
}
return $hasStringType;
} | [
"public",
"function",
"hasStringTypeColumn",
"(",
")",
":",
"bool",
"{",
"$",
"hasStringType",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"columnMetadataList",
"as",
"$",
"columnMetadata",
")",
"{",
"$",
"hasStringType",
"=",
"$",
"hasStringType",
... | Returns true if the table has at least one column that is a string type. | [
"Returns",
"true",
"if",
"the",
"table",
"has",
"at",
"least",
"one",
"column",
"that",
"is",
"a",
"string",
"type",
"."
] | 7abff68982d426690d0515ccd7adc7a2e3d72a3f | https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Metadata/MySQL/TableMetadata.php#L125-L132 |
196,598 | ptlis/grep-db | src/Metadata/MySQL/TableMetadata.php | TableMetadata.getPrimaryKeyMetadata | public function getPrimaryKeyMetadata(): ?ColumnMetadata
{
$filteredColumnList = array_filter($this->columnMetadataList, function (ColumnMetadata $columnMetadata) {
return $columnMetadata->isPrimaryKey();
});
return (count($filteredColumnList)) ? current($filteredColumnList) : n... | php | public function getPrimaryKeyMetadata(): ?ColumnMetadata
{
$filteredColumnList = array_filter($this->columnMetadataList, function (ColumnMetadata $columnMetadata) {
return $columnMetadata->isPrimaryKey();
});
return (count($filteredColumnList)) ? current($filteredColumnList) : n... | [
"public",
"function",
"getPrimaryKeyMetadata",
"(",
")",
":",
"?",
"ColumnMetadata",
"{",
"$",
"filteredColumnList",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"columnMetadataList",
",",
"function",
"(",
"ColumnMetadata",
"$",
"columnMetadata",
")",
"{",
"return... | Returns the primary key column metadata. | [
"Returns",
"the",
"primary",
"key",
"column",
"metadata",
"."
] | 7abff68982d426690d0515ccd7adc7a2e3d72a3f | https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Metadata/MySQL/TableMetadata.php#L137-L144 |
196,599 | erenmustafaozdal/laravel-modules-base | src/Repositories/ImageRepository.php | ImageRepository.moveImage | public function moveImage($photo, $photoKey, $model, $request)
{
$path = $this->getUploadPath($model);
$photos['fileName'] = $this->fileName;
$photos['fileSize'] = $this->fileSize;
$photos['original'] = $this->original($photo, $path['original']);
$photos['thumbnails']... | php | public function moveImage($photo, $photoKey, $model, $request)
{
$path = $this->getUploadPath($model);
$photos['fileName'] = $this->fileName;
$photos['fileSize'] = $this->fileSize;
$photos['original'] = $this->original($photo, $path['original']);
$photos['thumbnails']... | [
"public",
"function",
"moveImage",
"(",
"$",
"photo",
",",
"$",
"photoKey",
",",
"$",
"model",
",",
"$",
"request",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getUploadPath",
"(",
"$",
"model",
")",
";",
"$",
"photos",
"[",
"'fileName'",
"]",
... | move upload image
@param $photo
@param integer $photoKey
@param \Illuminate\Database\Eloquent\Model $model
@param \Illuminate\Http\Request $request
@return array | [
"move",
"upload",
"image"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Repositories/ImageRepository.php#L59-L68 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.