repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
expectation-php/expect | src/matcher/ToBeAnInstanceOf.php | ToBeAnInstanceOf.reportNegativeFailed | public function reportNegativeFailed(FailedMessage $message)
{
$message->appendText('Expected ')
->appendText($this->className)
->appendText(' not to be an instance of ')
->appendText($this->expected)
->appendText("\n\n")
->appendText(' expected... | php | public function reportNegativeFailed(FailedMessage $message)
{
$message->appendText('Expected ')
->appendText($this->className)
->appendText(' not to be an instance of ')
->appendText($this->expected)
->appendText("\n\n")
->appendText(' expected... | [
"public",
"function",
"reportNegativeFailed",
"(",
"FailedMessage",
"$",
"message",
")",
"{",
"$",
"message",
"->",
"appendText",
"(",
"'Expected '",
")",
"->",
"appendText",
"(",
"$",
"this",
"->",
"className",
")",
"->",
"appendText",
"(",
"' not to be an inst... | {@inheritdoc} | [
"{"
] | train | https://github.com/expectation-php/expect/blob/1a32c5af37f3dc8dabe4e8eedeeb21aea16ce139/src/matcher/ToBeAnInstanceOf.php#L93-L105 |
ShaoZeMing/laravel-merchant | src/Grid/Exporters/AbstractExporter.php | AbstractExporter.withScope | public function withScope($scope)
{
if ($scope == Grid\Exporter::SCOPE_ALL) {
return $this;
}
list($scope, $args) = explode(':', $scope);
if ($scope == Grid\Exporter::SCOPE_CURRENT_PAGE) {
$this->grid->model()->usePaginate(true);
}
if ($scop... | php | public function withScope($scope)
{
if ($scope == Grid\Exporter::SCOPE_ALL) {
return $this;
}
list($scope, $args) = explode(':', $scope);
if ($scope == Grid\Exporter::SCOPE_CURRENT_PAGE) {
$this->grid->model()->usePaginate(true);
}
if ($scop... | [
"public",
"function",
"withScope",
"(",
"$",
"scope",
")",
"{",
"if",
"(",
"$",
"scope",
"==",
"Grid",
"\\",
"Exporter",
"::",
"SCOPE_ALL",
")",
"{",
"return",
"$",
"this",
";",
"}",
"list",
"(",
"$",
"scope",
",",
"$",
"args",
")",
"=",
"explode",... | Export data with scope.
@param string $scope
@return $this | [
"Export",
"data",
"with",
"scope",
"."
] | train | https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Grid/Exporters/AbstractExporter.php#L78-L96 |
nguyenanhung/security | src/Encryption/AES.php | AES.encrypt | public function encrypt($plainText = '')
{
$cipher = new \phpseclib\Crypt\AES();
// could use AES::MODE_CBC
// keys are null-padded to the closest valid size
// longer than the longest key and it's truncated
$cipher->setKeyLength($this->keyLength);
$cipher->setKey($th... | php | public function encrypt($plainText = '')
{
$cipher = new \phpseclib\Crypt\AES();
// could use AES::MODE_CBC
// keys are null-padded to the closest valid size
// longer than the longest key and it's truncated
$cipher->setKeyLength($this->keyLength);
$cipher->setKey($th... | [
"public",
"function",
"encrypt",
"(",
"$",
"plainText",
"=",
"''",
")",
"{",
"$",
"cipher",
"=",
"new",
"\\",
"phpseclib",
"\\",
"Crypt",
"\\",
"AES",
"(",
")",
";",
"// could use AES::MODE_CBC",
"// keys are null-padded to the closest valid size",
"// longer than t... | Function encrypt
@author: 713uk13m <dev@nguyenanhung.com>
@time : 2018-12-03 16:36
@param string $plainText
@return string | [
"Function",
"encrypt"
] | train | https://github.com/nguyenanhung/security/blob/a2c9bac66d3c2dad6d668ba6c2bd82ed04bffbd6/src/Encryption/AES.php#L103-L116 |
nguyenanhung/security | src/Encryption/AES.php | AES.decrypt | public function decrypt($cipherText = '')
{
$cipher = new \phpseclib\Crypt\AES();
// could use AES::MODE_CBC
// keys are null-padded to the closest valid size
// longer than the longest key and it's truncated
$cipher->setKeyLength($this->keyLength);
$cipher->setKey($t... | php | public function decrypt($cipherText = '')
{
$cipher = new \phpseclib\Crypt\AES();
// could use AES::MODE_CBC
// keys are null-padded to the closest valid size
// longer than the longest key and it's truncated
$cipher->setKeyLength($this->keyLength);
$cipher->setKey($t... | [
"public",
"function",
"decrypt",
"(",
"$",
"cipherText",
"=",
"''",
")",
"{",
"$",
"cipher",
"=",
"new",
"\\",
"phpseclib",
"\\",
"Crypt",
"\\",
"AES",
"(",
")",
";",
"// could use AES::MODE_CBC",
"// keys are null-padded to the closest valid size",
"// longer than ... | Function decrypt
@author: 713uk13m <dev@nguyenanhung.com>
@time : 2018-12-03 16:35
@param string $cipherText
@return string | [
"Function",
"decrypt"
] | train | https://github.com/nguyenanhung/security/blob/a2c9bac66d3c2dad6d668ba6c2bd82ed04bffbd6/src/Encryption/AES.php#L128-L141 |
php-lug/lug | src/Component/Translation/Repository/Doctrine/ORM/TranslatableRepositoryFactory.php | TranslatableRepositoryFactory.createResourceRepository | protected function createResourceRepository(
$class,
EntityManagerInterface $entityManager,
ClassMetadata $metadata,
ResourceInterface $resource = null
) {
if ($resource !== null && is_a($class, TranslatableRepository::class, true)) {
return new $class($entityMana... | php | protected function createResourceRepository(
$class,
EntityManagerInterface $entityManager,
ClassMetadata $metadata,
ResourceInterface $resource = null
) {
if ($resource !== null && is_a($class, TranslatableRepository::class, true)) {
return new $class($entityMana... | [
"protected",
"function",
"createResourceRepository",
"(",
"$",
"class",
",",
"EntityManagerInterface",
"$",
"entityManager",
",",
"ClassMetadata",
"$",
"metadata",
",",
"ResourceInterface",
"$",
"resource",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"resource",
"!==",... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Translation/Repository/Doctrine/ORM/TranslatableRepositoryFactory.php#L44-L55 |
ZayconFoods/whatcounts | src/ZayconWhatCounts/SubscriberList.php | SubscriberList.setSentFlag | public function setSentFlag($sent_flag)
{
$this->sent_flag = ($sent_flag == 1 || $sent_flag == 'Y' || $sent_flag === TRUE) ? TRUE : FALSE;
return $this;
} | php | public function setSentFlag($sent_flag)
{
$this->sent_flag = ($sent_flag == 1 || $sent_flag == 'Y' || $sent_flag === TRUE) ? TRUE : FALSE;
return $this;
} | [
"public",
"function",
"setSentFlag",
"(",
"$",
"sent_flag",
")",
"{",
"$",
"this",
"->",
"sent_flag",
"=",
"(",
"$",
"sent_flag",
"==",
"1",
"||",
"$",
"sent_flag",
"==",
"'Y'",
"||",
"$",
"sent_flag",
"===",
"TRUE",
")",
"?",
"TRUE",
":",
"FALSE",
"... | @param mixed $sent_flag
@return SubscriberList | [
"@param",
"mixed",
"$sent_flag"
] | train | https://github.com/ZayconFoods/whatcounts/blob/ff18491fc152571a72e4b558f8102f4fbb9bb7fd/src/ZayconWhatCounts/SubscriberList.php#L93-L98 |
caffeinated/beverage | src/Traits/NamespacedPackageTrait.php | NamespacedPackageTrait.isValidPackageName | protected function isValidPackageName($packageName)
{
if (! preg_match($this->getNamespacedPackageRegex(), $packageName, $matches) or count($matches) !== 3) {
return false;
}
return true;
} | php | protected function isValidPackageName($packageName)
{
if (! preg_match($this->getNamespacedPackageRegex(), $packageName, $matches) or count($matches) !== 3) {
return false;
}
return true;
} | [
"protected",
"function",
"isValidPackageName",
"(",
"$",
"packageName",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"$",
"this",
"->",
"getNamespacedPackageRegex",
"(",
")",
",",
"$",
"packageName",
",",
"$",
"matches",
")",
"or",
"count",
"(",
"$",
"matc... | Checks if the given $packageName is valid
@param $packageName
@return bool | [
"Checks",
"if",
"the",
"given",
"$packageName",
"is",
"valid"
] | train | https://github.com/caffeinated/beverage/blob/c7d612a1d3bc1baddc97fec60ab17224550efaf3/src/Traits/NamespacedPackageTrait.php#L38-L45 |
NuclearCMS/Hierarchy | src/Repositories/NodeTypeRepository.php | NodeTypeRepository.create | public function create(array $attributes)
{
$model = $this->getModelName();
$nodeType = $model::create($attributes);
$this->builderService->buildTable(
$nodeType->getName(),
$nodeType->getKey()
);
return $nodeType;
} | php | public function create(array $attributes)
{
$model = $this->getModelName();
$nodeType = $model::create($attributes);
$this->builderService->buildTable(
$nodeType->getName(),
$nodeType->getKey()
);
return $nodeType;
} | [
"public",
"function",
"create",
"(",
"array",
"$",
"attributes",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"getModelName",
"(",
")",
";",
"$",
"nodeType",
"=",
"$",
"model",
"::",
"create",
"(",
"$",
"attributes",
")",
";",
"$",
"this",
"->",
... | Creates a node type
@param array $attributes
@return NodeTypeContract | [
"Creates",
"a",
"node",
"type"
] | train | https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Repositories/NodeTypeRepository.php#L14-L26 |
NuclearCMS/Hierarchy | src/Repositories/NodeTypeRepository.php | NodeTypeRepository.destroy | public function destroy($id)
{
$model = $this->getModelName();
$nodeType = $model::findOrFail($id);
$this->builderService->destroyTable(
$nodeType->getName(),
$nodeType->getFieldKeys(),
$nodeType->getKey()
);
$nodeType->delete();
... | php | public function destroy($id)
{
$model = $this->getModelName();
$nodeType = $model::findOrFail($id);
$this->builderService->destroyTable(
$nodeType->getName(),
$nodeType->getFieldKeys(),
$nodeType->getKey()
);
$nodeType->delete();
... | [
"public",
"function",
"destroy",
"(",
"$",
"id",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"getModelName",
"(",
")",
";",
"$",
"nodeType",
"=",
"$",
"model",
"::",
"findOrFail",
"(",
"$",
"id",
")",
";",
"$",
"this",
"->",
"builderService",
"... | Destroys a node type
@param int $id
@return NodeTypeContract | [
"Destroys",
"a",
"node",
"type"
] | train | https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Repositories/NodeTypeRepository.php#L34-L49 |
NuclearCMS/Hierarchy | src/Repositories/NodeTypeRepository.php | NodeTypeRepository.getNodeTypesByIds | public function getNodeTypesByIds($ids)
{
if (empty($ids))
{
return null;
}
if (is_string($ids))
{
$ids = json_decode($ids, true);
}
if (is_array($ids) && ! empty($ids))
{
$model = $this->getModelName();
... | php | public function getNodeTypesByIds($ids)
{
if (empty($ids))
{
return null;
}
if (is_string($ids))
{
$ids = json_decode($ids, true);
}
if (is_array($ids) && ! empty($ids))
{
$model = $this->getModelName();
... | [
"public",
"function",
"getNodeTypesByIds",
"(",
"$",
"ids",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"ids",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"ids",
")",
")",
"{",
"$",
"ids",
"=",
"json_decode",
"(",
"$"... | Returns node types by ids
@param array|string $ids
@return Collection | [
"Returns",
"node",
"types",
"by",
"ids"
] | train | https://github.com/NuclearCMS/Hierarchy/blob/535171c5e2db72265313fd2110aec8456e46f459/src/Repositories/NodeTypeRepository.php#L57-L83 |
Danzabar/config-builder | src/Data/Extensions/YamlTranslator.php | YamlTranslator.validate | public function validate()
{
try
{
Yaml\Yaml::parse($this->data);
} catch(\Exception $e)
{
return false;
}
return true;
} | php | public function validate()
{
try
{
Yaml\Yaml::parse($this->data);
} catch(\Exception $e)
{
return false;
}
return true;
} | [
"public",
"function",
"validate",
"(",
")",
"{",
"try",
"{",
"Yaml",
"\\",
"Yaml",
"::",
"parse",
"(",
"$",
"this",
"->",
"data",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
"... | Validates a Yaml string
@return Boolean
@author Dan Cox | [
"Validates",
"a",
"Yaml",
"string"
] | train | https://github.com/Danzabar/config-builder/blob/3b237be578172c32498bbcdfb360e69a6243739d/src/Data/Extensions/YamlTranslator.php#L65-L77 |
CupOfTea696/WordPress-Composer | src/EventSubscriber.php | EventSubscriber.getSubscribedEvents | public static function getSubscribedEvents()
{
return [
ScriptEvents::PRE_INSTALL_CMD => 'configureComposerJson',
ScriptEvents::PRE_UPDATE_CMD => 'configureComposerJson',
PackageEvents::PRE_PACKAGE_INSTALL => 'setWordPressInstallDirectory',
PackageEvents::POST... | php | public static function getSubscribedEvents()
{
return [
ScriptEvents::PRE_INSTALL_CMD => 'configureComposerJson',
ScriptEvents::PRE_UPDATE_CMD => 'configureComposerJson',
PackageEvents::PRE_PACKAGE_INSTALL => 'setWordPressInstallDirectory',
PackageEvents::POST... | [
"public",
"static",
"function",
"getSubscribedEvents",
"(",
")",
"{",
"return",
"[",
"ScriptEvents",
"::",
"PRE_INSTALL_CMD",
"=>",
"'configureComposerJson'",
",",
"ScriptEvents",
"::",
"PRE_UPDATE_CMD",
"=>",
"'configureComposerJson'",
",",
"PackageEvents",
"::",
"PRE_... | {@inheritdoc} | [
"{"
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/EventSubscriber.php#L42-L52 |
CupOfTea696/WordPress-Composer | src/EventSubscriber.php | EventSubscriber.configureComposerJson | public function configureComposerJson(Event $event)
{
static::$plugin->getInstanceOf(ComposerConfigurator::class)->configure($event->getComposer(), $event->getIO());
} | php | public function configureComposerJson(Event $event)
{
static::$plugin->getInstanceOf(ComposerConfigurator::class)->configure($event->getComposer(), $event->getIO());
} | [
"public",
"function",
"configureComposerJson",
"(",
"Event",
"$",
"event",
")",
"{",
"static",
"::",
"$",
"plugin",
"->",
"getInstanceOf",
"(",
"ComposerConfigurator",
"::",
"class",
")",
"->",
"configure",
"(",
"$",
"event",
"->",
"getComposer",
"(",
")",
"... | Configure the composer sonfiguration file.
@param \Composer\EventDispatcher\Event $event
@return void | [
"Configure",
"the",
"composer",
"sonfiguration",
"file",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/EventSubscriber.php#L85-L88 |
CupOfTea696/WordPress-Composer | src/EventSubscriber.php | EventSubscriber.setWordPressInstallDirectory | public function setWordPressInstallDirectory(PackageEvent $event)
{
if ($this->getPackageName($event) != 'johnpbloch/wordpress') {
return;
}
$composer = $event->getComposer();
$rootPkg = $composer->getPackage();
if (! $rootPkg) {
retu... | php | public function setWordPressInstallDirectory(PackageEvent $event)
{
if ($this->getPackageName($event) != 'johnpbloch/wordpress') {
return;
}
$composer = $event->getComposer();
$rootPkg = $composer->getPackage();
if (! $rootPkg) {
retu... | [
"public",
"function",
"setWordPressInstallDirectory",
"(",
"PackageEvent",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getPackageName",
"(",
"$",
"event",
")",
"!=",
"'johnpbloch/wordpress'",
")",
"{",
"return",
";",
"}",
"$",
"composer",
"=",
"$"... | Set the WordPress installation directory.
@param \Composer\EventDispatcher\Event $event
@return void | [
"Set",
"the",
"WordPress",
"installation",
"directory",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/EventSubscriber.php#L96-L119 |
CupOfTea696/WordPress-Composer | src/EventSubscriber.php | EventSubscriber.cleanWordPressInstallation | public function cleanWordPressInstallation(PackageEvent $event)
{
if ($this->getPackageName($event) != 'johnpbloch/wordpress') {
return;
}
static::$plugin->getInstanceOf(WordPressInstallationCleaner::class)->clean($event->getComposer(), $event->getIO());
} | php | public function cleanWordPressInstallation(PackageEvent $event)
{
if ($this->getPackageName($event) != 'johnpbloch/wordpress') {
return;
}
static::$plugin->getInstanceOf(WordPressInstallationCleaner::class)->clean($event->getComposer(), $event->getIO());
} | [
"public",
"function",
"cleanWordPressInstallation",
"(",
"PackageEvent",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getPackageName",
"(",
"$",
"event",
")",
"!=",
"'johnpbloch/wordpress'",
")",
"{",
"return",
";",
"}",
"static",
"::",
"$",
"plugi... | Clean the WordPress installation.
@param \Composer\Installer\PackageEvent $event
@return void | [
"Clean",
"the",
"WordPress",
"installation",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/EventSubscriber.php#L127-L134 |
CupOfTea696/WordPress-Composer | src/EventSubscriber.php | EventSubscriber.activateWordPressPlugin | public function activateWordPressPlugin(PackageEvent $event)
{
if (! $this->isWordPressPlugin($this->getPackage($event))) {
return;
}
static::$plugin->getInstanceOf(PluginInteractor::class)->activate(
$event->getComposer(),
$event->getIO(),
... | php | public function activateWordPressPlugin(PackageEvent $event)
{
if (! $this->isWordPressPlugin($this->getPackage($event))) {
return;
}
static::$plugin->getInstanceOf(PluginInteractor::class)->activate(
$event->getComposer(),
$event->getIO(),
... | [
"public",
"function",
"activateWordPressPlugin",
"(",
"PackageEvent",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isWordPressPlugin",
"(",
"$",
"this",
"->",
"getPackage",
"(",
"$",
"event",
")",
")",
")",
"{",
"return",
";",
"}",
"static... | Activate a WordPress plugin.
@param \Composer\Installer\PackageEvent $event
@return void | [
"Activate",
"a",
"WordPress",
"plugin",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/EventSubscriber.php#L142-L153 |
CupOfTea696/WordPress-Composer | src/EventSubscriber.php | EventSubscriber.deactivateWordPressPlugin | public function deactivateWordPressPlugin(PackageEvent $event)
{
if (! $this->isWordPressPlugin($this->getPackage($event))) {
return;
}
static::$plugin->getInstanceOf(PluginInteractor::class)->deactivate(
$event->getComposer(),
$event->getIO(),
... | php | public function deactivateWordPressPlugin(PackageEvent $event)
{
if (! $this->isWordPressPlugin($this->getPackage($event))) {
return;
}
static::$plugin->getInstanceOf(PluginInteractor::class)->deactivate(
$event->getComposer(),
$event->getIO(),
... | [
"public",
"function",
"deactivateWordPressPlugin",
"(",
"PackageEvent",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isWordPressPlugin",
"(",
"$",
"this",
"->",
"getPackage",
"(",
"$",
"event",
")",
")",
")",
"{",
"return",
";",
"}",
"stat... | Deactivate a WordPress plugin.
@param \Composer\Installer\PackageEvent $event
@return void | [
"Deactivate",
"a",
"WordPress",
"plugin",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/EventSubscriber.php#L161-L172 |
CupOfTea696/WordPress-Composer | src/EventSubscriber.php | EventSubscriber.uninstallWordPressPlugin | public function uninstallWordPressPlugin(PackageEvent $event)
{
if (! $this->isWordPressPlugin($this->getPackage($event))) {
return;
}
static::$plugin->getInstanceOf(PluginInteractor::class)->uninstall(
$event->getComposer(),
$event->getIO(),
... | php | public function uninstallWordPressPlugin(PackageEvent $event)
{
if (! $this->isWordPressPlugin($this->getPackage($event))) {
return;
}
static::$plugin->getInstanceOf(PluginInteractor::class)->uninstall(
$event->getComposer(),
$event->getIO(),
... | [
"public",
"function",
"uninstallWordPressPlugin",
"(",
"PackageEvent",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isWordPressPlugin",
"(",
"$",
"this",
"->",
"getPackage",
"(",
"$",
"event",
")",
")",
")",
"{",
"return",
";",
"}",
"stati... | Uninstall a WordPress plugin.
@param \Composer\Installer\PackageEvent $event
@return void | [
"Uninstall",
"a",
"WordPress",
"plugin",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/EventSubscriber.php#L180-L191 |
CupOfTea696/WordPress-Composer | src/EventSubscriber.php | EventSubscriber.getPackage | protected function getPackage(PackageEvent $event)
{
$operation = $event->getOperation();
if (method_exists($operation, 'getPackage')) {
return $operation->getPackage();
}
return $operation->getTargetPackage();
} | php | protected function getPackage(PackageEvent $event)
{
$operation = $event->getOperation();
if (method_exists($operation, 'getPackage')) {
return $operation->getPackage();
}
return $operation->getTargetPackage();
} | [
"protected",
"function",
"getPackage",
"(",
"PackageEvent",
"$",
"event",
")",
"{",
"$",
"operation",
"=",
"$",
"event",
"->",
"getOperation",
"(",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"operation",
",",
"'getPackage'",
")",
")",
"{",
"return",
... | Get the PackageInterface from a PackageEvent.
@param \Composer\Installer\PackageEvent $event
@return \Composer\Package\PackageInterface | [
"Get",
"the",
"PackageInterface",
"from",
"a",
"PackageEvent",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/EventSubscriber.php#L199-L208 |
novaway/open-graph | src/Metadata/Driver/AnnotationDriver.php | AnnotationDriver.loadMetadataForClass | public function loadMetadataForClass(\ReflectionClass $class)
{
$classMetadata = new ClassMetadata($class->name);
$classMetadata->fileResources[] = $class->getFileName();
foreach ($this->reader->getClassAnnotations($class) as $annotation) {
if ($annotation instanceof NamespaceNo... | php | public function loadMetadataForClass(\ReflectionClass $class)
{
$classMetadata = new ClassMetadata($class->name);
$classMetadata->fileResources[] = $class->getFileName();
foreach ($this->reader->getClassAnnotations($class) as $annotation) {
if ($annotation instanceof NamespaceNo... | [
"public",
"function",
"loadMetadataForClass",
"(",
"\\",
"ReflectionClass",
"$",
"class",
")",
"{",
"$",
"classMetadata",
"=",
"new",
"ClassMetadata",
"(",
"$",
"class",
"->",
"name",
")",
";",
"$",
"classMetadata",
"->",
"fileResources",
"[",
"]",
"=",
"$",... | Load metadata class
@param \ReflectionClass $class
@return ClassMetadata | [
"Load",
"metadata",
"class"
] | train | https://github.com/novaway/open-graph/blob/19817bee4b91cf26ca3fe44883ad58b32328e464/src/Metadata/Driver/AnnotationDriver.php#L36-L68 |
heidelpay/PhpDoc | src/phpDocumentor/Compiler/Pass/ElementsIndexBuilder.php | ElementsIndexBuilder.getIndexKey | protected function getIndexKey($element)
{
$key = $element->getFullyQualifiedStructuralElementName();
// properties should have an additional $ before the property name
if ($element instanceof PropertyInterface) {
list($fqcn, $propertyName) = explode('::', $key);
$ke... | php | protected function getIndexKey($element)
{
$key = $element->getFullyQualifiedStructuralElementName();
// properties should have an additional $ before the property name
if ($element instanceof PropertyInterface) {
list($fqcn, $propertyName) = explode('::', $key);
$ke... | [
"protected",
"function",
"getIndexKey",
"(",
"$",
"element",
")",
"{",
"$",
"key",
"=",
"$",
"element",
"->",
"getFullyQualifiedStructuralElementName",
"(",
")",
";",
"// properties should have an additional $ before the property name",
"if",
"(",
"$",
"element",
"insta... | Retrieves a key for the index for the provided element.
@param DescriptorAbstract $element
@return string | [
"Retrieves",
"a",
"key",
"for",
"the",
"index",
"for",
"the",
"provided",
"element",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Pass/ElementsIndexBuilder.php#L146-L157 |
heidelpay/PhpDoc | src/phpDocumentor/Partials/Collection.php | Collection.set | public function set($index, $item)
{
$this->offsetSet($index, $this->parser->text($item));
} | php | public function set($index, $item)
{
$this->offsetSet($index, $this->parser->text($item));
} | [
"public",
"function",
"set",
"(",
"$",
"index",
",",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"offsetSet",
"(",
"$",
"index",
",",
"$",
"this",
"->",
"parser",
"->",
"text",
"(",
"$",
"item",
")",
")",
";",
"}"
] | Sets a new object onto the collection or clear it using null.
@param string|integer $index An index value to recognize this item with.
@param string $item The item to store, generally a Descriptor but may be something else.
@return void | [
"Sets",
"a",
"new",
"object",
"onto",
"the",
"collection",
"or",
"clear",
"it",
"using",
"null",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Partials/Collection.php#L42-L45 |
chrismou/phergie-irc-plugin-react-google | src/Provider/GoogleSearchCount.php | GoogleSearchCount.getSuccessLines | public function getSuccessLines(Event $event, $apiResponse)
{
$json = json_decode($apiResponse);
$json = $json->responseData;
$messages = [];
$messages[] = sprintf(
"%s results [ %s ]",
(isset($json->cursor->estimatedResultCount)) ? $json->cursor->estimatedR... | php | public function getSuccessLines(Event $event, $apiResponse)
{
$json = json_decode($apiResponse);
$json = $json->responseData;
$messages = [];
$messages[] = sprintf(
"%s results [ %s ]",
(isset($json->cursor->estimatedResultCount)) ? $json->cursor->estimatedR... | [
"public",
"function",
"getSuccessLines",
"(",
"Event",
"$",
"event",
",",
"$",
"apiResponse",
")",
"{",
"$",
"json",
"=",
"json_decode",
"(",
"$",
"apiResponse",
")",
";",
"$",
"json",
"=",
"$",
"json",
"->",
"responseData",
";",
"$",
"messages",
"=",
... | Process the response (when the request is successful)
@param \Phergie\Irc\Plugin\React\Command\CommandEvent $event
@param string $apiResponse
@return array | [
"Process",
"the",
"response",
"(",
"when",
"the",
"request",
"is",
"successful",
")"
] | train | https://github.com/chrismou/phergie-irc-plugin-react-google/blob/4492bf1e25826a9cf7187afee0ec35deddefaf6f/src/Provider/GoogleSearchCount.php#L31-L45 |
superjimpupcake/Pupcake | src/Pupcake/Event.php | Event.register | public function register()
{
$this->helper_callbacks = array();
$arguments= func_get_args();
if(count($arguments) > 0){
foreach($arguments as $argument){
if($argument instanceof Plugin){ //this is a plugin object
$callback = $argument->getEvent... | php | public function register()
{
$this->helper_callbacks = array();
$arguments= func_get_args();
if(count($arguments) > 0){
foreach($arguments as $argument){
if($argument instanceof Plugin){ //this is a plugin object
$callback = $argument->getEvent... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"helper_callbacks",
"=",
"array",
"(",
")",
";",
"$",
"arguments",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"arguments",
")",
">",
"0",
")",
"{",
"foreach",... | register an array of plugins objects and allow the plugins to join the process of handling this event | [
"register",
"an",
"array",
"of",
"plugins",
"objects",
"and",
"allow",
"the",
"plugins",
"to",
"join",
"the",
"process",
"of",
"handling",
"this",
"event"
] | train | https://github.com/superjimpupcake/Pupcake/blob/2f962818646e4e1d65f5d008eeb953cb41ebb3e0/src/Pupcake/Event.php#L76-L95 |
superjimpupcake/Pupcake | src/Pupcake/Event.php | Event.start | public function start()
{
$result = array();
if(count($this->helper_callbacks) > 0){
foreach($this->helper_callbacks as $callback){
$return_value = call_user_func_array($callback, array($this));
$result[] = $return_value;
}
}
re... | php | public function start()
{
$result = array();
if(count($this->helper_callbacks) > 0){
foreach($this->helper_callbacks as $callback){
$return_value = call_user_func_array($callback, array($this));
$result[] = $return_value;
}
}
re... | [
"public",
"function",
"start",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"helper_callbacks",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"helper_callbacks",
"as",
"$",
"ca... | start this event | [
"start",
"this",
"event"
] | train | https://github.com/superjimpupcake/Pupcake/blob/2f962818646e4e1d65f5d008eeb953cb41ebb3e0/src/Pupcake/Event.php#L118-L128 |
prooph/link-dashboard | src/Service/Factory/DashboardProviderFactory.php | DashboardProviderFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('config');
$controllerLoader = $serviceLocator->get('ControllerLoader');
/** @var $systemConfig ProcessingConfig */
$systemConfig = $serviceLocator->get('prooph.link.system_confi... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('config');
$controllerLoader = $serviceLocator->get('ControllerLoader');
/** @var $systemConfig ProcessingConfig */
$systemConfig = $serviceLocator->get('prooph.link.system_confi... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"$",
"config",
"=",
"$",
"serviceLocator",
"->",
"get",
"(",
"'config'",
")",
";",
"$",
"controllerLoader",
"=",
"$",
"serviceLocator",
"->",
"get",
"(",
"'... | Create service
@param ServiceLocatorInterface $serviceLocator
@throws \RuntimeException
@return DashboardProvider | [
"Create",
"service"
] | train | https://github.com/prooph/link-dashboard/blob/6b1806c65552aa03092c63abae45c269cdc8b6bf/src/Service/Factory/DashboardProviderFactory.php#L30-L84 |
oroinc/OroLayoutComponent | BlockViewCache.php | BlockViewCache.save | public function save(ContextInterface $context, BlockView $rootView)
{
$hash = $context->getHash();
$serialized = $this->serializer->serialize($rootView, JsonEncoder::FORMAT);
$this->cache->save($hash, $serialized);
} | php | public function save(ContextInterface $context, BlockView $rootView)
{
$hash = $context->getHash();
$serialized = $this->serializer->serialize($rootView, JsonEncoder::FORMAT);
$this->cache->save($hash, $serialized);
} | [
"public",
"function",
"save",
"(",
"ContextInterface",
"$",
"context",
",",
"BlockView",
"$",
"rootView",
")",
"{",
"$",
"hash",
"=",
"$",
"context",
"->",
"getHash",
"(",
")",
";",
"$",
"serialized",
"=",
"$",
"this",
"->",
"serializer",
"->",
"serializ... | {@inheritdoc} | [
"{"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/BlockViewCache.php#L34-L41 |
oroinc/OroLayoutComponent | BlockViewCache.php | BlockViewCache.fetch | public function fetch(ContextInterface $context)
{
$hash = $context->getHash();
if ($this->cache->contains($hash)) {
$cached = $this->cache->fetch($hash);
return $this->serializer->deserialize($cached, BlockView::class, JsonEncoder::FORMAT);
} else {
ret... | php | public function fetch(ContextInterface $context)
{
$hash = $context->getHash();
if ($this->cache->contains($hash)) {
$cached = $this->cache->fetch($hash);
return $this->serializer->deserialize($cached, BlockView::class, JsonEncoder::FORMAT);
} else {
ret... | [
"public",
"function",
"fetch",
"(",
"ContextInterface",
"$",
"context",
")",
"{",
"$",
"hash",
"=",
"$",
"context",
"->",
"getHash",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"cache",
"->",
"contains",
"(",
"$",
"hash",
")",
")",
"{",
"$",
"cach... | {@inheritdoc} | [
"{"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/BlockViewCache.php#L46-L57 |
eloquent/cosmos | src/Eloquent/Cosmos/ClassNameResolver.php | ClassNameResolver.resolve | public function resolve(ClassName $className)
{
if ($className->isAbsolute()) {
return $className;
} elseif ($className->isShortName()) {
$usedClass = $this->usedClass($className);
if (null !== $usedClass) {
return $usedClass;
}
... | php | public function resolve(ClassName $className)
{
if ($className->isAbsolute()) {
return $className;
} elseif ($className->isShortName()) {
$usedClass = $this->usedClass($className);
if (null !== $usedClass) {
return $usedClass;
}
... | [
"public",
"function",
"resolve",
"(",
"ClassName",
"$",
"className",
")",
"{",
"if",
"(",
"$",
"className",
"->",
"isAbsolute",
"(",
")",
")",
"{",
"return",
"$",
"className",
";",
"}",
"elseif",
"(",
"$",
"className",
"->",
"isShortName",
"(",
")",
")... | @param ClassName $className
@return ClassName | [
"@param",
"ClassName",
"$className"
] | train | https://github.com/eloquent/cosmos/blob/0226b7aa39c629cdbb41bde759adff59d932d16d/src/Eloquent/Cosmos/ClassNameResolver.php#L68-L84 |
eloquent/cosmos | src/Eloquent/Cosmos/ClassNameResolver.php | ClassNameResolver.shorten | public function shorten(ClassName $className)
{
if (!$className->isAbsolute()) {
return $className;
}
foreach ($this->usedClasses() as $tuple) {
list($usedClass, $as) = $tuple;
if ($this->comparator()->equals($usedClass, $className)) {
ret... | php | public function shorten(ClassName $className)
{
if (!$className->isAbsolute()) {
return $className;
}
foreach ($this->usedClasses() as $tuple) {
list($usedClass, $as) = $tuple;
if ($this->comparator()->equals($usedClass, $className)) {
ret... | [
"public",
"function",
"shorten",
"(",
"ClassName",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"$",
"className",
"->",
"isAbsolute",
"(",
")",
")",
"{",
"return",
"$",
"className",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"usedClasses",
"(",
")",
... | @param ClassName $className
@return ClassName | [
"@param",
"ClassName",
"$className"
] | train | https://github.com/eloquent/cosmos/blob/0226b7aa39c629cdbb41bde759adff59d932d16d/src/Eloquent/Cosmos/ClassNameResolver.php#L91-L112 |
eloquent/cosmos | src/Eloquent/Cosmos/ClassNameResolver.php | ClassNameResolver.normalizeUsedClasses | protected function normalizeUsedClasses(array $usedClasses)
{
$normalized = array();
foreach ($usedClasses as $tuple) {
$tuple[0] = $tuple[0]->toAbsolute();
if (array_key_exists(1, $tuple)) {
if (!$tuple[1]->isShortName()) {
throw new Exce... | php | protected function normalizeUsedClasses(array $usedClasses)
{
$normalized = array();
foreach ($usedClasses as $tuple) {
$tuple[0] = $tuple[0]->toAbsolute();
if (array_key_exists(1, $tuple)) {
if (!$tuple[1]->isShortName()) {
throw new Exce... | [
"protected",
"function",
"normalizeUsedClasses",
"(",
"array",
"$",
"usedClasses",
")",
"{",
"$",
"normalized",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"usedClasses",
"as",
"$",
"tuple",
")",
"{",
"$",
"tuple",
"[",
"0",
"]",
"=",
"$",
"tuple... | @param array<array<ClassName>> $usedClasses
@return array<tuple<ClassName,ClassName>> | [
"@param",
"array<array<ClassName",
">>",
"$usedClasses"
] | train | https://github.com/eloquent/cosmos/blob/0226b7aa39c629cdbb41bde759adff59d932d16d/src/Eloquent/Cosmos/ClassNameResolver.php#L119-L137 |
eloquent/cosmos | src/Eloquent/Cosmos/ClassNameResolver.php | ClassNameResolver.usedClass | protected function usedClass(ClassName $className)
{
foreach ($this->usedClasses() as $tuple) {
list($usedClass, $as) = $tuple;
if ($this->comparator()->equals($as, $className)) {
return $usedClass;
}
}
return null;
} | php | protected function usedClass(ClassName $className)
{
foreach ($this->usedClasses() as $tuple) {
list($usedClass, $as) = $tuple;
if ($this->comparator()->equals($as, $className)) {
return $usedClass;
}
}
return null;
} | [
"protected",
"function",
"usedClass",
"(",
"ClassName",
"$",
"className",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"usedClasses",
"(",
")",
"as",
"$",
"tuple",
")",
"{",
"list",
"(",
"$",
"usedClass",
",",
"$",
"as",
")",
"=",
"$",
"tuple",
";",
... | @param ClassName $className
@return ClassName|null | [
"@param",
"ClassName",
"$className"
] | train | https://github.com/eloquent/cosmos/blob/0226b7aa39c629cdbb41bde759adff59d932d16d/src/Eloquent/Cosmos/ClassNameResolver.php#L144-L154 |
xiewulong/yii2-fileupload | oss/libs/guzzle/http/Guzzle/Http/Curl/CurlMulti.php | CurlMulti.throwMultiException | protected function throwMultiException(array $exceptions, array $successful)
{
$multiException = new MultiTransferException('Errors during multi transfer');
while ($e = array_shift($exceptions)) {
$multiException->add($e['exception']);
$multiException->addFailedRequest($e['r... | php | protected function throwMultiException(array $exceptions, array $successful)
{
$multiException = new MultiTransferException('Errors during multi transfer');
while ($e = array_shift($exceptions)) {
$multiException->add($e['exception']);
$multiException->addFailedRequest($e['r... | [
"protected",
"function",
"throwMultiException",
"(",
"array",
"$",
"exceptions",
",",
"array",
"$",
"successful",
")",
"{",
"$",
"multiException",
"=",
"new",
"MultiTransferException",
"(",
"'Errors during multi transfer'",
")",
";",
"while",
"(",
"$",
"e",
"=",
... | Build and throw a MultiTransferException
@param array $exceptions Exceptions encountered
@param array $successful Successful requests
@throws MultiTransferException | [
"Build",
"and",
"throw",
"a",
"MultiTransferException"
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/guzzle/http/Guzzle/Http/Curl/CurlMulti.php#L128-L145 |
xiewulong/yii2-fileupload | oss/libs/guzzle/http/Guzzle/Http/Curl/CurlMulti.php | CurlMulti.beforeSend | protected function beforeSend(RequestInterface $request)
{
try {
$state = $request->setState(RequestInterface::STATE_TRANSFER);
if ($state == RequestInterface::STATE_TRANSFER) {
// Add the request curl handle to the multi handle
$this->checkCurlResult(... | php | protected function beforeSend(RequestInterface $request)
{
try {
$state = $request->setState(RequestInterface::STATE_TRANSFER);
if ($state == RequestInterface::STATE_TRANSFER) {
// Add the request curl handle to the multi handle
$this->checkCurlResult(... | [
"protected",
"function",
"beforeSend",
"(",
"RequestInterface",
"$",
"request",
")",
"{",
"try",
"{",
"$",
"state",
"=",
"$",
"request",
"->",
"setState",
"(",
"RequestInterface",
"::",
"STATE_TRANSFER",
")",
";",
"if",
"(",
"$",
"state",
"==",
"RequestInter... | Prepare for sending
@param RequestInterface $request Request to prepare
@throws \Exception on error preparing the request | [
"Prepare",
"for",
"sending"
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/guzzle/http/Guzzle/Http/Curl/CurlMulti.php#L153-L171 |
xiewulong/yii2-fileupload | oss/libs/guzzle/http/Guzzle/Http/Curl/CurlMulti.php | CurlMulti.perform | protected function perform()
{
if (!$this->requests) {
return;
}
// Initialize the handles with a very quick select timeout
$active = $mrc = null;
$this->executeHandles($active, $mrc, 0.001);
$event = new Event(array('curl_multi' => $this));
$this... | php | protected function perform()
{
if (!$this->requests) {
return;
}
// Initialize the handles with a very quick select timeout
$active = $mrc = null;
$this->executeHandles($active, $mrc, 0.001);
$event = new Event(array('curl_multi' => $this));
$this... | [
"protected",
"function",
"perform",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"requests",
")",
"{",
"return",
";",
"}",
"// Initialize the handles with a very quick select timeout",
"$",
"active",
"=",
"$",
"mrc",
"=",
"null",
";",
"$",
"this",
"->",... | Get the data from the multi handle | [
"Get",
"the",
"data",
"from",
"the",
"multi",
"handle"
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/guzzle/http/Guzzle/Http/Curl/CurlMulti.php#L192-L228 |
xiewulong/yii2-fileupload | oss/libs/guzzle/http/Guzzle/Http/Curl/CurlMulti.php | CurlMulti.executeHandles | private function executeHandles(&$active, &$mrc, $timeout = 1)
{
do {
$mrc = curl_multi_exec($this->multiHandle, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM && $active);
$this->checkCurlResult($mrc);
// @codeCoverageIgnoreStart
// Select the curl handles ... | php | private function executeHandles(&$active, &$mrc, $timeout = 1)
{
do {
$mrc = curl_multi_exec($this->multiHandle, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM && $active);
$this->checkCurlResult($mrc);
// @codeCoverageIgnoreStart
// Select the curl handles ... | [
"private",
"function",
"executeHandles",
"(",
"&",
"$",
"active",
",",
"&",
"$",
"mrc",
",",
"$",
"timeout",
"=",
"1",
")",
"{",
"do",
"{",
"$",
"mrc",
"=",
"curl_multi_exec",
"(",
"$",
"this",
"->",
"multiHandle",
",",
"$",
"active",
")",
";",
"}"... | Execute and select curl handles until there is activity
@param int $active Active value to update
@param int $mrc Multi result value to update
@param int $timeout Select timeout in seconds | [
"Execute",
"and",
"select",
"curl",
"handles",
"until",
"there",
"is",
"activity"
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/guzzle/http/Guzzle/Http/Curl/CurlMulti.php#L257-L273 |
xiewulong/yii2-fileupload | oss/libs/guzzle/http/Guzzle/Http/Curl/CurlMulti.php | CurlMulti.removeErroredRequest | protected function removeErroredRequest(RequestInterface $request, \Exception $e = null, $buffer = true)
{
if ($buffer) {
$this->exceptions[] = array('request' => $request, 'exception' => $e);
}
$this->remove($request);
$this->dispatch(self::MULTI_EXCEPTION, array('excep... | php | protected function removeErroredRequest(RequestInterface $request, \Exception $e = null, $buffer = true)
{
if ($buffer) {
$this->exceptions[] = array('request' => $request, 'exception' => $e);
}
$this->remove($request);
$this->dispatch(self::MULTI_EXCEPTION, array('excep... | [
"protected",
"function",
"removeErroredRequest",
"(",
"RequestInterface",
"$",
"request",
",",
"\\",
"Exception",
"$",
"e",
"=",
"null",
",",
"$",
"buffer",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"buffer",
")",
"{",
"$",
"this",
"->",
"exceptions",
"[",
... | Remove a request that encountered an exception
@param RequestInterface $request Request to remove
@param \Exception $e Exception encountered
@param bool $buffer Set to false to not buffer the exception | [
"Remove",
"a",
"request",
"that",
"encountered",
"an",
"exception"
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/guzzle/http/Guzzle/Http/Curl/CurlMulti.php#L282-L290 |
xiewulong/yii2-fileupload | oss/libs/guzzle/http/Guzzle/Http/Curl/CurlMulti.php | CurlMulti.processResponse | protected function processResponse(RequestInterface $request, CurlHandle $handle, array $curl)
{
// Set the transfer stats on the response
$handle->updateRequestFromTransfer($request);
// Check if a cURL exception occurred, and if so, notify things
$curlException = $this->isCurlExcep... | php | protected function processResponse(RequestInterface $request, CurlHandle $handle, array $curl)
{
// Set the transfer stats on the response
$handle->updateRequestFromTransfer($request);
// Check if a cURL exception occurred, and if so, notify things
$curlException = $this->isCurlExcep... | [
"protected",
"function",
"processResponse",
"(",
"RequestInterface",
"$",
"request",
",",
"CurlHandle",
"$",
"handle",
",",
"array",
"$",
"curl",
")",
"{",
"// Set the transfer stats on the response",
"$",
"handle",
"->",
"updateRequestFromTransfer",
"(",
"$",
"reques... | Check for errors and fix headers of a request based on a curl response
@param RequestInterface $request Request to process
@param CurlHandle $handle Curl handle object
@param array $curl Array returned from curl_multi_info_read
@throws CurlException on Curl error | [
"Check",
"for",
"errors",
"and",
"fix",
"headers",
"of",
"a",
"request",
"based",
"on",
"a",
"curl",
"response"
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/guzzle/http/Guzzle/Http/Curl/CurlMulti.php#L301-L331 |
xiewulong/yii2-fileupload | oss/libs/guzzle/http/Guzzle/Http/Curl/CurlMulti.php | CurlMulti.removeHandle | protected function removeHandle(RequestInterface $request)
{
if (isset($this->handles[$request])) {
$handle = $this->handles[$request];
unset($this->handles[$request]);
unset($this->resourceHash[(int) $handle->getHandle()]);
curl_multi_remove_handle($this->mul... | php | protected function removeHandle(RequestInterface $request)
{
if (isset($this->handles[$request])) {
$handle = $this->handles[$request];
unset($this->handles[$request]);
unset($this->resourceHash[(int) $handle->getHandle()]);
curl_multi_remove_handle($this->mul... | [
"protected",
"function",
"removeHandle",
"(",
"RequestInterface",
"$",
"request",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"handles",
"[",
"$",
"request",
"]",
")",
")",
"{",
"$",
"handle",
"=",
"$",
"this",
"->",
"handles",
"[",
"$",
"r... | Remove a curl handle from the curl multi object
@param RequestInterface $request Request that owns the handle | [
"Remove",
"a",
"curl",
"handle",
"from",
"the",
"curl",
"multi",
"object"
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/guzzle/http/Guzzle/Http/Curl/CurlMulti.php#L338-L347 |
heidelpay/PhpDoc | src/phpDocumentor/Transformer/Command/Project/TransformCommand.php | TransformCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var ConfigurationHelper $configurationHelper */
$configurationHelper = $this->getHelper('phpdocumentor_configuration');
$progress = $this->getProgressBar($input);
if (! $progress) {
$this->... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var ConfigurationHelper $configurationHelper */
$configurationHelper = $this->getHelper('phpdocumentor_configuration');
$progress = $this->getProgressBar($input);
if (! $progress) {
$this->... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"/** @var ConfigurationHelper $configurationHelper */",
"$",
"configurationHelper",
"=",
"$",
"this",
"->",
"getHelper",
"(",
"'phpdocumentor_configur... | Executes the business logic involved with this command.
@param InputInterface $input
@param OutputInterface $output
@throws \Exception if the provided source is not an existing file or a folder.
@return int | [
"Executes",
"the",
"business",
"logic",
"involved",
"with",
"this",
"command",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Transformer/Command/Project/TransformCommand.php#L156-L214 |
heidelpay/PhpDoc | src/phpDocumentor/Transformer/Command/Project/TransformCommand.php | TransformCommand.getTemplates | protected function getTemplates(InputInterface $input)
{
/** @var ConfigurationHelper $configurationHelper */
$configurationHelper = $this->getHelper('phpdocumentor_configuration');
$templates = $input->getOption('template');
if (!$templates) {
/** @var Template[] $templ... | php | protected function getTemplates(InputInterface $input)
{
/** @var ConfigurationHelper $configurationHelper */
$configurationHelper = $this->getHelper('phpdocumentor_configuration');
$templates = $input->getOption('template');
if (!$templates) {
/** @var Template[] $templ... | [
"protected",
"function",
"getTemplates",
"(",
"InputInterface",
"$",
"input",
")",
"{",
"/** @var ConfigurationHelper $configurationHelper */",
"$",
"configurationHelper",
"=",
"$",
"this",
"->",
"getHelper",
"(",
"'phpdocumentor_configuration'",
")",
";",
"$",
"templates... | Retrieves the templates to be used by analyzing the options and the configuration.
@param InputInterface $input
@return string[] | [
"Retrieves",
"the",
"templates",
"to",
"be",
"used",
"by",
"analyzing",
"the",
"options",
"and",
"the",
"configuration",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Transformer/Command/Project/TransformCommand.php#L233-L252 |
heidelpay/PhpDoc | src/phpDocumentor/Transformer/Command/Project/TransformCommand.php | TransformCommand.loadTransformations | public function loadTransformations(Transformer $transformer)
{
/** @var ConfigurationHelper $configurationHelper */
$configurationHelper = $this->getHelper('phpdocumentor_configuration');
$received = array();
$transformations = $configurationHelper->getConfigValueFromPath('transfor... | php | public function loadTransformations(Transformer $transformer)
{
/** @var ConfigurationHelper $configurationHelper */
$configurationHelper = $this->getHelper('phpdocumentor_configuration');
$received = array();
$transformations = $configurationHelper->getConfigValueFromPath('transfor... | [
"public",
"function",
"loadTransformations",
"(",
"Transformer",
"$",
"transformer",
")",
"{",
"/** @var ConfigurationHelper $configurationHelper */",
"$",
"configurationHelper",
"=",
"$",
"this",
"->",
"getHelper",
"(",
"'phpdocumentor_configuration'",
")",
";",
"$",
"re... | Load custom defined transformations.
@param Transformer $transformer
@todo this is an ugly implementation done for speed of development, should be refactored
@return void | [
"Load",
"custom",
"defined",
"transformations",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Transformer/Command/Project/TransformCommand.php#L263-L283 |
heidelpay/PhpDoc | src/phpDocumentor/Transformer/Command/Project/TransformCommand.php | TransformCommand.createTransformation | protected function createTransformation(array $transformations)
{
return new Transformation(
isset($transformations['query']) ? $transformations['query'] : '',
$transformations['writer'],
isset($transformations['source']) ? $transformations['source'] : '',
iss... | php | protected function createTransformation(array $transformations)
{
return new Transformation(
isset($transformations['query']) ? $transformations['query'] : '',
$transformations['writer'],
isset($transformations['source']) ? $transformations['source'] : '',
iss... | [
"protected",
"function",
"createTransformation",
"(",
"array",
"$",
"transformations",
")",
"{",
"return",
"new",
"Transformation",
"(",
"isset",
"(",
"$",
"transformations",
"[",
"'query'",
"]",
")",
"?",
"$",
"transformations",
"[",
"'query'",
"]",
":",
"''"... | Create Transformation instance.
@param array $transformations
@return \phpDocumentor\Transformer\Transformation | [
"Create",
"Transformation",
"instance",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Transformer/Command/Project/TransformCommand.php#L292-L300 |
heidelpay/PhpDoc | src/phpDocumentor/Transformer/Command/Project/TransformCommand.php | TransformCommand.appendReceivedTransformations | protected function appendReceivedTransformations(Transformer $transformer, $received)
{
if (!empty($received)) {
$template = new Template('__');
foreach ($received as $transformation) {
$template[] = $transformation;
}
$transformer->getTemplate... | php | protected function appendReceivedTransformations(Transformer $transformer, $received)
{
if (!empty($received)) {
$template = new Template('__');
foreach ($received as $transformation) {
$template[] = $transformation;
}
$transformer->getTemplate... | [
"protected",
"function",
"appendReceivedTransformations",
"(",
"Transformer",
"$",
"transformer",
",",
"$",
"received",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"received",
")",
")",
"{",
"$",
"template",
"=",
"new",
"Template",
"(",
"'__'",
")",
";",
... | Append received transformations.
@param Transformer $transformer
@param array $received
@return void | [
"Append",
"received",
"transformations",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Transformer/Command/Project/TransformCommand.php#L310-L319 |
heidelpay/PhpDoc | src/phpDocumentor/Transformer/Command/Project/TransformCommand.php | TransformCommand.getProgressBar | protected function getProgressBar(InputInterface $input)
{
$progress = parent::getProgressBar($input);
if (!$progress) {
return null;
}
/** @var Dispatcher $eventDispatcher */
$eventDispatcher = $this->getService('event_dispatcher');
$eventDispatcher->add... | php | protected function getProgressBar(InputInterface $input)
{
$progress = parent::getProgressBar($input);
if (!$progress) {
return null;
}
/** @var Dispatcher $eventDispatcher */
$eventDispatcher = $this->getService('event_dispatcher');
$eventDispatcher->add... | [
"protected",
"function",
"getProgressBar",
"(",
"InputInterface",
"$",
"input",
")",
"{",
"$",
"progress",
"=",
"parent",
"::",
"getProgressBar",
"(",
"$",
"input",
")",
";",
"if",
"(",
"!",
"$",
"progress",
")",
"{",
"return",
"null",
";",
"}",
"/** @va... | Adds the transformer.transformation.post event to advance the progressbar.
@param InputInterface $input
@return HelperInterface|null | [
"Adds",
"the",
"transformer",
".",
"transformation",
".",
"post",
"event",
"to",
"advance",
"the",
"progressbar",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Transformer/Command/Project/TransformCommand.php#L328-L345 |
heidelpay/PhpDoc | src/phpDocumentor/Transformer/Command/Project/TransformCommand.php | TransformCommand.connectOutputToEvents | private function connectOutputToEvents(OutputInterface $output)
{
$this->getHelper('phpdocumentor_logger')->connectOutputToLogging($output, $this);
Dispatcher::getInstance()->addListener(
Transformer::EVENT_PRE_TRANSFORM,
function (PreTransformEvent $event) use ($output) {
... | php | private function connectOutputToEvents(OutputInterface $output)
{
$this->getHelper('phpdocumentor_logger')->connectOutputToLogging($output, $this);
Dispatcher::getInstance()->addListener(
Transformer::EVENT_PRE_TRANSFORM,
function (PreTransformEvent $event) use ($output) {
... | [
"private",
"function",
"connectOutputToEvents",
"(",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"getHelper",
"(",
"'phpdocumentor_logger'",
")",
"->",
"connectOutputToLogging",
"(",
"$",
"output",
",",
"$",
"this",
")",
";",
"Dispatcher",
"::... | Connect a series of output messages to various events to display progress.
@param OutputInterface $output
@return void | [
"Connect",
"a",
"series",
"of",
"output",
"messages",
"to",
"various",
"events",
"to",
"display",
"progress",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Transformer/Command/Project/TransformCommand.php#L354-L379 |
caffeinated/beverage | src/Filesystem.php | Filesystem.rsearch | public function rsearch($folder, $pattern)
{
$dir = new RecursiveDirectoryIterator($folder);
$iterator = new RecursiveIteratorIterator($dir);
$files = new RegexIterator($iterator, $pattern, RegexIterator::GET_MATCH);
$fileList = [];
foreach ($files as $file) {
... | php | public function rsearch($folder, $pattern)
{
$dir = new RecursiveDirectoryIterator($folder);
$iterator = new RecursiveIteratorIterator($dir);
$files = new RegexIterator($iterator, $pattern, RegexIterator::GET_MATCH);
$fileList = [];
foreach ($files as $file) {
... | [
"public",
"function",
"rsearch",
"(",
"$",
"folder",
",",
"$",
"pattern",
")",
"{",
"$",
"dir",
"=",
"new",
"RecursiveDirectoryIterator",
"(",
"$",
"folder",
")",
";",
"$",
"iterator",
"=",
"new",
"RecursiveIteratorIterator",
"(",
"$",
"dir",
")",
";",
"... | Search the given folder recursively for files using
a regular expression pattern.
@param string $folder
@param string $pattern
@return array | [
"Search",
"the",
"given",
"folder",
"recursively",
"for",
"files",
"using",
"a",
"regular",
"expression",
"pattern",
"."
] | train | https://github.com/caffeinated/beverage/blob/c7d612a1d3bc1baddc97fec60ab17224550efaf3/src/Filesystem.php#L66-L78 |
php-lug/lug | src/Component/Grid/Column/Type/NumberType.php | NumberType.render | public function render($data, array $options)
{
$number = $this->getValue($data, $options);
if ($number === null) {
return;
}
if (!is_numeric($number)) {
throw new InvalidTypeException(sprintf(
'The "%s" %s column type expects a numeric value... | php | public function render($data, array $options)
{
$number = $this->getValue($data, $options);
if ($number === null) {
return;
}
if (!is_numeric($number)) {
throw new InvalidTypeException(sprintf(
'The "%s" %s column type expects a numeric value... | [
"public",
"function",
"render",
"(",
"$",
"data",
",",
"array",
"$",
"options",
")",
"{",
"$",
"number",
"=",
"$",
"this",
"->",
"getValue",
"(",
"$",
"data",
",",
"$",
"options",
")",
";",
"if",
"(",
"$",
"number",
"===",
"null",
")",
"{",
"retu... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/Column/Type/NumberType.php#L69-L87 |
php-lug/lug | src/Component/Grid/Column/Type/NumberType.php | NumberType.configureOptions | public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver
->setDefaults([
'scale' => $this->scale,
'rounding' => $this->rounding,
'grouping' => $this->grouping,
])
... | php | public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver
->setDefaults([
'scale' => $this->scale,
'rounding' => $this->rounding,
'grouping' => $this->grouping,
])
... | [
"public",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"parent",
"::",
"configureOptions",
"(",
"$",
"resolver",
")",
";",
"$",
"resolver",
"->",
"setDefaults",
"(",
"[",
"'scale'",
"=>",
"$",
"this",
"->",
"scale",
",",... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/Column/Type/NumberType.php#L92-L113 |
tystuyfzand/flysystem-seaweedfs | src/Seaweed.php | Seaweed.write | public function write($path, $contents, Config $config) {
try {
$mapping = $this->mapper->get($path);
$file = null;
if ($mapping) {
$volume = $this->client->lookup($mapping['fid']);
$file = new \stdClass();
$file->url = $volu... | php | public function write($path, $contents, Config $config) {
try {
$mapping = $this->mapper->get($path);
$file = null;
if ($mapping) {
$volume = $this->client->lookup($mapping['fid']);
$file = new \stdClass();
$file->url = $volu... | [
"public",
"function",
"write",
"(",
"$",
"path",
",",
"$",
"contents",
",",
"Config",
"$",
"config",
")",
"{",
"try",
"{",
"$",
"mapping",
"=",
"$",
"this",
"->",
"mapper",
"->",
"get",
"(",
"$",
"path",
")",
";",
"$",
"file",
"=",
"null",
";",
... | Write a new file.
@param string $path
@param string $contents
@param Config $config Config object
@return array|false false on failure file meta data on success | [
"Write",
"a",
"new",
"file",
"."
] | train | https://github.com/tystuyfzand/flysystem-seaweedfs/blob/992334ba1d8e26fe6bbb9e33feedbf66b4872613/src/Seaweed.php#L48-L74 |
tystuyfzand/flysystem-seaweedfs | src/Seaweed.php | Seaweed.delete | public function delete($path) {
$mapping = $this->mapper->get($path);
if (!$mapping) {
return false;
}
try {
$this->client->delete($mapping['fid']);
$this->mapper->remove($path);
return true;
} catch (SeaweedFSException $e) {
... | php | public function delete($path) {
$mapping = $this->mapper->get($path);
if (!$mapping) {
return false;
}
try {
$this->client->delete($mapping['fid']);
$this->mapper->remove($path);
return true;
} catch (SeaweedFSException $e) {
... | [
"public",
"function",
"delete",
"(",
"$",
"path",
")",
"{",
"$",
"mapping",
"=",
"$",
"this",
"->",
"mapper",
"->",
"get",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"$",
"mapping",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"$",
"this... | Delete a file.
@param string $path
@return bool | [
"Delete",
"a",
"file",
"."
] | train | https://github.com/tystuyfzand/flysystem-seaweedfs/blob/992334ba1d8e26fe6bbb9e33feedbf66b4872613/src/Seaweed.php#L146-L161 |
tystuyfzand/flysystem-seaweedfs | src/Seaweed.php | Seaweed.has | public function has($path) {
$mapping = $this->mapper->get($path);
if (!$mapping) {
return false;
}
return $this->client->has($mapping['fid']);
} | php | public function has($path) {
$mapping = $this->mapper->get($path);
if (!$mapping) {
return false;
}
return $this->client->has($mapping['fid']);
} | [
"public",
"function",
"has",
"(",
"$",
"path",
")",
"{",
"$",
"mapping",
"=",
"$",
"this",
"->",
"mapper",
"->",
"get",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"$",
"mapping",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"-... | Check whether a file exists.
@param string $path
@return array|bool|null | [
"Check",
"whether",
"a",
"file",
"exists",
"."
] | train | https://github.com/tystuyfzand/flysystem-seaweedfs/blob/992334ba1d8e26fe6bbb9e33feedbf66b4872613/src/Seaweed.php#L193-L201 |
tystuyfzand/flysystem-seaweedfs | src/Seaweed.php | Seaweed.read | public function read($path) {
$mapping = $this->mapper->get($path);
if (!$mapping) {
return false;
}
try {
$file = $this->client->get($mapping['fid']);
if (!$file) {
return false;
}
return [
'... | php | public function read($path) {
$mapping = $this->mapper->get($path);
if (!$mapping) {
return false;
}
try {
$file = $this->client->get($mapping['fid']);
if (!$file) {
return false;
}
return [
'... | [
"public",
"function",
"read",
"(",
"$",
"path",
")",
"{",
"$",
"mapping",
"=",
"$",
"this",
"->",
"mapper",
"->",
"get",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"$",
"mapping",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"$",
"file",... | Read a file.
@param string $path
@return array|false | [
"Read",
"a",
"file",
"."
] | train | https://github.com/tystuyfzand/flysystem-seaweedfs/blob/992334ba1d8e26fe6bbb9e33feedbf66b4872613/src/Seaweed.php#L210-L230 |
tystuyfzand/flysystem-seaweedfs | src/Seaweed.php | Seaweed.readStream | public function readStream($path) {
$mapping = $this->mapper->get($path);
if (!$mapping) {
return false;
}
try {
$file = $this->client->get($mapping['fid']);
if (!$file) {
return false;
}
return [
... | php | public function readStream($path) {
$mapping = $this->mapper->get($path);
if (!$mapping) {
return false;
}
try {
$file = $this->client->get($mapping['fid']);
if (!$file) {
return false;
}
return [
... | [
"public",
"function",
"readStream",
"(",
"$",
"path",
")",
"{",
"$",
"mapping",
"=",
"$",
"this",
"->",
"mapper",
"->",
"get",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"$",
"mapping",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"$",
"... | Read a file as a stream.
@param string $path
@return array|false | [
"Read",
"a",
"file",
"as",
"a",
"stream",
"."
] | train | https://github.com/tystuyfzand/flysystem-seaweedfs/blob/992334ba1d8e26fe6bbb9e33feedbf66b4872613/src/Seaweed.php#L239-L259 |
tystuyfzand/flysystem-seaweedfs | src/Seaweed.php | Seaweed.getUrl | public function getUrl($path) {
$mapping = $this->mapper->get($path);
if (!$mapping) {
return false;
}
try {
$volume = $this->client->lookup($mapping['fid']);
return $this->client->buildVolumeUrl($volume->getPublicUrl(), $mapping['fid']);
} ... | php | public function getUrl($path) {
$mapping = $this->mapper->get($path);
if (!$mapping) {
return false;
}
try {
$volume = $this->client->lookup($mapping['fid']);
return $this->client->buildVolumeUrl($volume->getPublicUrl(), $mapping['fid']);
} ... | [
"public",
"function",
"getUrl",
"(",
"$",
"path",
")",
"{",
"$",
"mapping",
"=",
"$",
"this",
"->",
"mapper",
"->",
"get",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"$",
"mapping",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"$",
"volu... | Get the public URL of a path.
@param $path
@return string|bool | [
"Get",
"the",
"public",
"URL",
"of",
"a",
"path",
"."
] | train | https://github.com/tystuyfzand/flysystem-seaweedfs/blob/992334ba1d8e26fe6bbb9e33feedbf66b4872613/src/Seaweed.php#L325-L339 |
mothership-ec/composer | src/Composer/Util/SpdxLicense.php | SpdxLicense.getLicenseByIdentifier | public function getLicenseByIdentifier($identifier)
{
if (!isset($this->licenses[$identifier])) {
return;
}
$license = $this->licenses[$identifier];
// add URL for the license text (it's not included in the json)
$license[2] = 'http://spdx.org/licenses/' . $iden... | php | public function getLicenseByIdentifier($identifier)
{
if (!isset($this->licenses[$identifier])) {
return;
}
$license = $this->licenses[$identifier];
// add URL for the license text (it's not included in the json)
$license[2] = 'http://spdx.org/licenses/' . $iden... | [
"public",
"function",
"getLicenseByIdentifier",
"(",
"$",
"identifier",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"licenses",
"[",
"$",
"identifier",
"]",
")",
")",
"{",
"return",
";",
"}",
"$",
"license",
"=",
"$",
"this",
"->",
"li... | Returns license metadata by license identifier.
@param string $identifier
@return array|null | [
"Returns",
"license",
"metadata",
"by",
"license",
"identifier",
"."
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Util/SpdxLicense.php#L54-L66 |
mothership-ec/composer | src/Composer/Util/SpdxLicense.php | SpdxLicense.getIdentifierByName | public function getIdentifierByName($name)
{
foreach ($this->licenses as $identifier => $licenseData) {
if ($licenseData[0] === $name) { // key 0 = fullname
return $identifier;
}
}
} | php | public function getIdentifierByName($name)
{
foreach ($this->licenses as $identifier => $licenseData) {
if ($licenseData[0] === $name) { // key 0 = fullname
return $identifier;
}
}
} | [
"public",
"function",
"getIdentifierByName",
"(",
"$",
"name",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"licenses",
"as",
"$",
"identifier",
"=>",
"$",
"licenseData",
")",
"{",
"if",
"(",
"$",
"licenseData",
"[",
"0",
"]",
"===",
"$",
"name",
")",
... | Returns the short identifier of a license by full name.
@param string $identifier
@return string | [
"Returns",
"the",
"short",
"identifier",
"of",
"a",
"license",
"by",
"full",
"name",
"."
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Util/SpdxLicense.php#L75-L82 |
mothership-ec/composer | src/Composer/Util/SpdxLicense.php | SpdxLicense.isValidLicenseString | private function isValidLicenseString($license)
{
$tokens = array(
'po' => '\(',
'pc' => '\)',
'op' => '(?:or|and)',
'lix' => '(?:NONE|NOASSERTION)',
'lir' => 'LicenseRef-\d+',
'lic' => '[-+_.a-zA-Z0-9]{3,}',
'ws' => '\s+',
... | php | private function isValidLicenseString($license)
{
$tokens = array(
'po' => '\(',
'pc' => '\)',
'op' => '(?:or|and)',
'lix' => '(?:NONE|NOASSERTION)',
'lir' => 'LicenseRef-\d+',
'lic' => '[-+_.a-zA-Z0-9]{3,}',
'ws' => '\s+',
... | [
"private",
"function",
"isValidLicenseString",
"(",
"$",
"license",
")",
"{",
"$",
"tokens",
"=",
"array",
"(",
"'po'",
"=>",
"'\\('",
",",
"'pc'",
"=>",
"'\\)'",
",",
"'op'",
"=>",
"'(?:or|and)'",
",",
"'lix'",
"=>",
"'(?:NONE|NOASSERTION)'",
",",
"'lir'",
... | @param string $license
@return bool
@throws \RuntimeException | [
"@param",
"string",
"$license"
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Util/SpdxLicense.php#L139-L232 |
andromeda-framework/doctrine | src/Doctrine/Tracy/SqlDumper.php | SqlDumper.dump | public static function dump(string $query, array $params = [])
{
[$query, $params] = Doctrine\DBAL\SQLParserUtils::expandListParameters($query, $params, []);
$parts = explode('?', $query);
$output = [];
while ($parts && $params) {
$output[] = array_shift($parts);
$output[] = self::formatParameter(array... | php | public static function dump(string $query, array $params = [])
{
[$query, $params] = Doctrine\DBAL\SQLParserUtils::expandListParameters($query, $params, []);
$parts = explode('?', $query);
$output = [];
while ($parts && $params) {
$output[] = array_shift($parts);
$output[] = self::formatParameter(array... | [
"public",
"static",
"function",
"dump",
"(",
"string",
"$",
"query",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"[",
"$",
"query",
",",
"$",
"params",
"]",
"=",
"Doctrine",
"\\",
"DBAL",
"\\",
"SQLParserUtils",
"::",
"expandListParameters",
... | @param string $query
@param array $params
@return string | [
"@param",
"string",
"$query",
"@param",
"array",
"$params"
] | train | https://github.com/andromeda-framework/doctrine/blob/46924d91c09e0b9fbe5764518cbad70e467ffad4/src/Doctrine/Tracy/SqlDumper.php#L40-L53 |
andromeda-framework/doctrine | src/Doctrine/Tracy/SqlDumper.php | SqlDumper.highlightQuery | public static function highlightQuery($sql)
{
static $keywords1 = 'SELECT|(?:ON\s+DUPLICATE\s+KEY)?UPDATE|INSERT(?:\s+INTO)?|REPLACE(?:\s+INTO)?|DELETE|CALL|UNION|FROM|WHERE|HAVING|GROUP\s+BY|ORDER\s+BY|'
. 'LIMIT|OFFSET|SET|VALUES|LEFT\s+JOIN|INNER\s+JOIN|TRUNCATE';
static $keywords2 = 'ALL|DISTINCT|DISTINCTRO... | php | public static function highlightQuery($sql)
{
static $keywords1 = 'SELECT|(?:ON\s+DUPLICATE\s+KEY)?UPDATE|INSERT(?:\s+INTO)?|REPLACE(?:\s+INTO)?|DELETE|CALL|UNION|FROM|WHERE|HAVING|GROUP\s+BY|ORDER\s+BY|'
. 'LIMIT|OFFSET|SET|VALUES|LEFT\s+JOIN|INNER\s+JOIN|TRUNCATE';
static $keywords2 = 'ALL|DISTINCT|DISTINCTRO... | [
"public",
"static",
"function",
"highlightQuery",
"(",
"$",
"sql",
")",
"{",
"static",
"$",
"keywords1",
"=",
"'SELECT|(?:ON\\s+DUPLICATE\\s+KEY)?UPDATE|INSERT(?:\\s+INTO)?|REPLACE(?:\\s+INTO)?|DELETE|CALL|UNION|FROM|WHERE|HAVING|GROUP\\s+BY|ORDER\\s+BY|'",
".",
"'LIMIT|OFFSET|SET|VALU... | Returns syntax highlighted SQL command.
@link https://github.com/nette/database/blob/667143b2d5b940f78c8dc9212f95b1bbc033c6a3/src/Database/Helpers.php#L75-L138
@author David Grudl
@param string $sql
@return string | [
"Returns",
"syntax",
"highlighted",
"SQL",
"command",
"."
] | train | https://github.com/andromeda-framework/doctrine/blob/46924d91c09e0b9fbe5764518cbad70e467ffad4/src/Doctrine/Tracy/SqlDumper.php#L66-L100 |
andromeda-framework/doctrine | src/Doctrine/Tracy/SqlDumper.php | SqlDumper.formatParameter | private static function formatParameter($param): string
{
if (is_int($param) || is_float($param)) {
return (string) $param;
} elseif (is_string($param)) {
return "'" . addslashes($param) . "'";
} elseif (is_null($param)) {
return "NULL";
} elseif (is_bool($param)) {
return $param ? "TRUE" : "FAL... | php | private static function formatParameter($param): string
{
if (is_int($param) || is_float($param)) {
return (string) $param;
} elseif (is_string($param)) {
return "'" . addslashes($param) . "'";
} elseif (is_null($param)) {
return "NULL";
} elseif (is_bool($param)) {
return $param ? "TRUE" : "FAL... | [
"private",
"static",
"function",
"formatParameter",
"(",
"$",
"param",
")",
":",
"string",
"{",
"if",
"(",
"is_int",
"(",
"$",
"param",
")",
"||",
"is_float",
"(",
"$",
"param",
")",
")",
"{",
"return",
"(",
"string",
")",
"$",
"param",
";",
"}",
"... | @param mixed $param
@return string | [
"@param",
"mixed",
"$param"
] | train | https://github.com/andromeda-framework/doctrine/blob/46924d91c09e0b9fbe5764518cbad70e467ffad4/src/Doctrine/Tracy/SqlDumper.php#L108-L138 |
antaresproject/notifications | src/Listener/NotificationsListener.php | NotificationsListener.listen | public function listen()
{
$notifications = $this->repository->findSendable()->toArray();
foreach ($notifications as $notification) {
$this->listenNotificationsEvents($notification);
}
} | php | public function listen()
{
$notifications = $this->repository->findSendable()->toArray();
foreach ($notifications as $notification) {
$this->listenNotificationsEvents($notification);
}
} | [
"public",
"function",
"listen",
"(",
")",
"{",
"$",
"notifications",
"=",
"$",
"this",
"->",
"repository",
"->",
"findSendable",
"(",
")",
"->",
"toArray",
"(",
")",
";",
"foreach",
"(",
"$",
"notifications",
"as",
"$",
"notification",
")",
"{",
"$",
"... | Listening for notifications | [
"Listening",
"for",
"notifications"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Listener/NotificationsListener.php#L62-L69 |
antaresproject/notifications | src/Listener/NotificationsListener.php | NotificationsListener.listenNotificationsEvents | protected function listenNotificationsEvents(array $notification)
{
$events = Arr::get($notification, 'event');
if($events === null && isset($notification['classname'])) {
$events = app()->make($notification['classname'])->getEvents();
}
foreach ((array) $events as $eve... | php | protected function listenNotificationsEvents(array $notification)
{
$events = Arr::get($notification, 'event');
if($events === null && isset($notification['classname'])) {
$events = app()->make($notification['classname'])->getEvents();
}
foreach ((array) $events as $eve... | [
"protected",
"function",
"listenNotificationsEvents",
"(",
"array",
"$",
"notification",
")",
"{",
"$",
"events",
"=",
"Arr",
"::",
"get",
"(",
"$",
"notification",
",",
"'event'",
")",
";",
"if",
"(",
"$",
"events",
"===",
"null",
"&&",
"isset",
"(",
"$... | Runs notification events.
@param array $notification | [
"Runs",
"notification",
"events",
"."
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Listener/NotificationsListener.php#L76-L87 |
antaresproject/notifications | src/Listener/NotificationsListener.php | NotificationsListener.runNotificationListener | protected function runNotificationListener(string $event, array $notification)
{
app('events')->listen($event, function(array $variables = null, array $recipients = null) use($notification) {
$this->eventDispatcher->run($notification, $variables, $recipients);
});
} | php | protected function runNotificationListener(string $event, array $notification)
{
app('events')->listen($event, function(array $variables = null, array $recipients = null) use($notification) {
$this->eventDispatcher->run($notification, $variables, $recipients);
});
} | [
"protected",
"function",
"runNotificationListener",
"(",
"string",
"$",
"event",
",",
"array",
"$",
"notification",
")",
"{",
"app",
"(",
"'events'",
")",
"->",
"listen",
"(",
"$",
"event",
",",
"function",
"(",
"array",
"$",
"variables",
"=",
"null",
",",... | Runs notification listener.
@param string $event
@param array $notification | [
"Runs",
"notification",
"listener",
"."
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Listener/NotificationsListener.php#L95-L100 |
lukasz-adamski/teamspeak3-framework | src/TeamSpeak3/Helper/Char.php | Char.fromHex | public static function fromHex($hex)
{
if(strlen($hex) != 2)
{
throw new Exception("given parameter '" . $hex . "' is not a valid hexadecimal number");
}
return new self(chr(hexdec($hex)));
} | php | public static function fromHex($hex)
{
if(strlen($hex) != 2)
{
throw new Exception("given parameter '" . $hex . "' is not a valid hexadecimal number");
}
return new self(chr(hexdec($hex)));
} | [
"public",
"static",
"function",
"fromHex",
"(",
"$",
"hex",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"hex",
")",
"!=",
"2",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"given parameter '\"",
".",
"$",
"hex",
".",
"\"' is not a valid hexadecimal number\"",
... | Returns the Char based on a given hex value.
@param string $hex
@throws Exception
@return Char | [
"Returns",
"the",
"Char",
"based",
"on",
"a",
"given",
"hex",
"value",
"."
] | train | https://github.com/lukasz-adamski/teamspeak3-framework/blob/39a56eca608da6b56b6aa386a7b5b31dc576c41a/src/TeamSpeak3/Helper/Char.php#L231-L239 |
technote-space/wordpress-plugin-base | src/classes/models/lib/filter.php | Filter.initialize | protected function initialize() {
foreach ( $this->apply_filters( 'filter', $this->app->config->load( 'filter' ) ) as $class => $tags ) {
$this->register_class_filter( $class, $tags );
}
} | php | protected function initialize() {
foreach ( $this->apply_filters( 'filter', $this->app->config->load( 'filter' ) ) as $class => $tags ) {
$this->register_class_filter( $class, $tags );
}
} | [
"protected",
"function",
"initialize",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"apply_filters",
"(",
"'filter'",
",",
"$",
"this",
"->",
"app",
"->",
"config",
"->",
"load",
"(",
"'filter'",
")",
")",
"as",
"$",
"class",
"=>",
"$",
"tags",
... | initialize
@since 2.4.2 Improved: change timing to load filter target instance | [
"initialize"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/filter.php#L37-L41 |
technote-space/wordpress-plugin-base | src/classes/models/lib/filter.php | Filter.get_target_app | private function get_target_app( $class ) {
if ( ! isset( $this->_target_app[ $class ] ) ) {
$app = false;
if ( strpos( $class, '->' ) !== false ) {
$app = $this->app;
$exploded = explode( '->', $class );
foreach ( $exploded as $property ) {
if ( isset( $app->$property ) ) {
$app = $... | php | private function get_target_app( $class ) {
if ( ! isset( $this->_target_app[ $class ] ) ) {
$app = false;
if ( strpos( $class, '->' ) !== false ) {
$app = $this->app;
$exploded = explode( '->', $class );
foreach ( $exploded as $property ) {
if ( isset( $app->$property ) ) {
$app = $... | [
"private",
"function",
"get_target_app",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_target_app",
"[",
"$",
"class",
"]",
")",
")",
"{",
"$",
"app",
"=",
"false",
";",
"if",
"(",
"strpos",
"(",
"$",
"class",
",... | @since 2.4.2
@param string $class
@return false|\Technote|\Technote\Interfaces\Singleton | [
"@since",
"2",
".",
"4",
".",
"2"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/filter.php#L88-L120 |
technote-space/wordpress-plugin-base | src/classes/models/lib/filter.php | Filter.get_filter_params | private function get_filter_params( $params ) {
$priority = 10;
$accepted_args = 100;
if ( is_array( $params ) ) {
if ( count( $params ) >= 1 ) {
$priority = $params[0];
}
if ( count( $params ) >= 2 ) {
$accepted_args = $params[1];
}
}
return [ $priority, $accepted_args ];
} | php | private function get_filter_params( $params ) {
$priority = 10;
$accepted_args = 100;
if ( is_array( $params ) ) {
if ( count( $params ) >= 1 ) {
$priority = $params[0];
}
if ( count( $params ) >= 2 ) {
$accepted_args = $params[1];
}
}
return [ $priority, $accepted_args ];
} | [
"private",
"function",
"get_filter_params",
"(",
"$",
"params",
")",
"{",
"$",
"priority",
"=",
"10",
";",
"$",
"accepted_args",
"=",
"100",
";",
"if",
"(",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"params",
")",
... | @since 2.4.2
@param array $params
@return array | [
"@since",
"2",
".",
"4",
".",
"2"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/filter.php#L129-L142 |
technote-space/wordpress-plugin-base | src/classes/models/lib/filter.php | Filter.call_filter_callback | private function call_filter_callback( $class, $method, $args ) {
$result = empty( $args ) ? null : reset( $args );
$app = $this->get_target_app( $class );
if ( empty( $app ) ) {
return $result;
}
if ( $app->is_filter_callable( $method ) ) {
return $app->filter_callback( $method, $args );
}
ret... | php | private function call_filter_callback( $class, $method, $args ) {
$result = empty( $args ) ? null : reset( $args );
$app = $this->get_target_app( $class );
if ( empty( $app ) ) {
return $result;
}
if ( $app->is_filter_callable( $method ) ) {
return $app->filter_callback( $method, $args );
}
ret... | [
"private",
"function",
"call_filter_callback",
"(",
"$",
"class",
",",
"$",
"method",
",",
"$",
"args",
")",
"{",
"$",
"result",
"=",
"empty",
"(",
"$",
"args",
")",
"?",
"null",
":",
"reset",
"(",
"$",
"args",
")",
";",
"$",
"app",
"=",
"$",
"th... | @since 2.4.2
@param string $class
@param string $method
@param array $args
@return mixed | [
"@since",
"2",
".",
"4",
".",
"2"
] | train | https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/filter.php#L153-L165 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.discoverFields | public function discoverFields() {
if (!empty($this->fields)) {
return; // Already configured.
}
$sm = $this->db()->getSchemaManager();
$columns = $sm->listTableColumns($this->table);
foreach ($columns as $column) {
$this->fields[$column->getName()] = array(
'name' => $column->g... | php | public function discoverFields() {
if (!empty($this->fields)) {
return; // Already configured.
}
$sm = $this->db()->getSchemaManager();
$columns = $sm->listTableColumns($this->table);
foreach ($columns as $column) {
$this->fields[$column->getName()] = array(
'name' => $column->g... | [
"public",
"function",
"discoverFields",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fields",
")",
")",
"{",
"return",
";",
"// Already configured.",
"}",
"$",
"sm",
"=",
"$",
"this",
"->",
"db",
"(",
")",
"->",
"getSchemaManager",
... | Gets info of the fields from the table. | [
"Gets",
"info",
"of",
"the",
"fields",
"from",
"the",
"table",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L25-L45 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.setField | public function setField($name, $value) {
if (isset($this->fields[$name])) {
$this->isDirty = TRUE;
return $this->record[$name] = $value;
}
throw new \Exception('Not a valid Field for Set ' . $name);
} | php | public function setField($name, $value) {
if (isset($this->fields[$name])) {
$this->isDirty = TRUE;
return $this->record[$name] = $value;
}
throw new \Exception('Not a valid Field for Set ' . $name);
} | [
"public",
"function",
"setField",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"fields",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"this",
"->",
"isDirty",
"=",
"TRUE",
";",
"return",
"$",
"this",
... | Sets a field to the record.
@param $name
@param $value
@return mixed
@throws \Exception | [
"Sets",
"a",
"field",
"to",
"the",
"record",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L88-L95 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.getField | public function getField($name) {
if (isset($this->fields[$name])) {
return $this->record[$name];
}
if (isset($this->fetchedRecord[$name])) {
return $this->fetchedRecord[$name];
}
throw new \Exception('Not a valid Field for Get ' . $name);
} | php | public function getField($name) {
if (isset($this->fields[$name])) {
return $this->record[$name];
}
if (isset($this->fetchedRecord[$name])) {
return $this->fetchedRecord[$name];
}
throw new \Exception('Not a valid Field for Get ' . $name);
} | [
"public",
"function",
"getField",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"fields",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"record",
"[",
"$",
"name",
"]",
";",
"}",
"if",
"(",
"isset"... | Gets a Field from Record.
If the field is not in record will check in fetchedRecord, fetched record may have
some fields from the last query that you will need, like related records.
@param $name
@return mixed
@throws \Exception | [
"Gets",
"a",
"Field",
"from",
"Record",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L107-L117 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.insert | public function insert() {
$this->db()->insert($this->table, $this->record);
$id = $this->db()->lastInsertId();
$this->record[$this->id_name] = $id;
$this->isDirty = FALSE;
return $this;
} | php | public function insert() {
$this->db()->insert($this->table, $this->record);
$id = $this->db()->lastInsertId();
$this->record[$this->id_name] = $id;
$this->isDirty = FALSE;
return $this;
} | [
"public",
"function",
"insert",
"(",
")",
"{",
"$",
"this",
"->",
"db",
"(",
")",
"->",
"insert",
"(",
"$",
"this",
"->",
"table",
",",
"$",
"this",
"->",
"record",
")",
";",
"$",
"id",
"=",
"$",
"this",
"->",
"db",
"(",
")",
"->",
"lastInsertI... | Inserts the record.
@return $this | [
"Inserts",
"the",
"record",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L124-L131 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.update | public function update() {
$this->db()->update($this->table, $this->record, $this->identifier());
$this->isDirty = FALSE;
return $this;
} | php | public function update() {
$this->db()->update($this->table, $this->record, $this->identifier());
$this->isDirty = FALSE;
return $this;
} | [
"public",
"function",
"update",
"(",
")",
"{",
"$",
"this",
"->",
"db",
"(",
")",
"->",
"update",
"(",
"$",
"this",
"->",
"table",
",",
"$",
"this",
"->",
"record",
",",
"$",
"this",
"->",
"identifier",
"(",
")",
")",
";",
"$",
"this",
"->",
"i... | Updates the record.
@return $this | [
"Updates",
"the",
"record",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L138-L143 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.delete | public function delete() {
if ($this->isNew()) {
throw new \Exception('ID is not setted for Delete');
}
$this->db()->delete($this->table, $this->identifier());
$this->isDeleted = TRUE;
return $this;
} | php | public function delete() {
if ($this->isNew()) {
throw new \Exception('ID is not setted for Delete');
}
$this->db()->delete($this->table, $this->identifier());
$this->isDeleted = TRUE;
return $this;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNew",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'ID is not setted for Delete'",
")",
";",
"}",
"$",
"this",
"->",
"db",
"(",
")",
"->",
"delete",
"(",
... | Deletes the record.
@return $this
@throws \Exception | [
"Deletes",
"the",
"record",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L168-L177 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.identifier | public function identifier() {
if (empty($this->record[$this->id_name])) {
return FALSE;
}
return array($this->id_name => $this->record[$this->id_name]);
} | php | public function identifier() {
if (empty($this->record[$this->id_name])) {
return FALSE;
}
return array($this->id_name => $this->record[$this->id_name]);
} | [
"public",
"function",
"identifier",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"record",
"[",
"$",
"this",
"->",
"id_name",
"]",
")",
")",
"{",
"return",
"FALSE",
";",
"}",
"return",
"array",
"(",
"$",
"this",
"->",
"id_name",
"=>",... | Provides the Id in array format column-value.
False if is a new object.
@return array|bool | [
"Provides",
"the",
"Id",
"in",
"array",
"format",
"column",
"-",
"value",
".",
"False",
"if",
"is",
"a",
"new",
"object",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L207-L213 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.getId | public function getId() {
if (empty($this->record[$this->id_name])) {
return FALSE;
}
return $this->record[$this->id_name];
} | php | public function getId() {
if (empty($this->record[$this->id_name])) {
return FALSE;
}
return $this->record[$this->id_name];
} | [
"public",
"function",
"getId",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"record",
"[",
"$",
"this",
"->",
"id_name",
"]",
")",
")",
"{",
"return",
"FALSE",
";",
"}",
"return",
"$",
"this",
"->",
"record",
"[",
"$",
"this",
"->",... | Gets the ID value or false.
@return mixed ID Value or false. | [
"Gets",
"the",
"ID",
"value",
"or",
"false",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L220-L226 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.setRecord | public function setRecord($record) {
$this->resetObject();
$newRecord = array();
foreach ($this->fields as $field_name => $field) {
if (!empty($record[$field_name])) {
$newRecord[$field_name] = $record[$field_name];
}
else {
$newRecord[$field_name] = ''; //Adds the field bu... | php | public function setRecord($record) {
$this->resetObject();
$newRecord = array();
foreach ($this->fields as $field_name => $field) {
if (!empty($record[$field_name])) {
$newRecord[$field_name] = $record[$field_name];
}
else {
$newRecord[$field_name] = ''; //Adds the field bu... | [
"public",
"function",
"setRecord",
"(",
"$",
"record",
")",
"{",
"$",
"this",
"->",
"resetObject",
"(",
")",
";",
"$",
"newRecord",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"field_name",
"=>",
"$",
"field",... | Sets the internal record with a new record.
@param $record
@return \Towel\Model\BaseModel | [
"Sets",
"the",
"internal",
"record",
"with",
"a",
"new",
"record",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L244-L259 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.mergeRecord | public function mergeRecord($record) {
if ($this->isNew()) {
throw new \Exception('Can not merge, is new');
}
foreach ($this->fields as $field_name => $field) {
if (!empty($record[$field_name])) {
$this->record[$field_name] = $record[$field_name];
}
$this->isDirty = TRUE;
... | php | public function mergeRecord($record) {
if ($this->isNew()) {
throw new \Exception('Can not merge, is new');
}
foreach ($this->fields as $field_name => $field) {
if (!empty($record[$field_name])) {
$this->record[$field_name] = $record[$field_name];
}
$this->isDirty = TRUE;
... | [
"public",
"function",
"mergeRecord",
"(",
"$",
"record",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNew",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Can not merge, is new'",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"fields",... | Update partial values of the record and keep the current
non modified values.
@param $record
@return $this
@throws \Exception | [
"Update",
"partial",
"values",
"of",
"the",
"record",
"and",
"keep",
"the",
"current",
"non",
"modified",
"values",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L270-L282 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.fetchOne | public function fetchOne($sql, $params = array()) {
$result = $this->db()->fetchAssoc($sql, $params);
if (!empty($result)) {
$this->setRecord($result);
return $this;
}
return FALSE;
} | php | public function fetchOne($sql, $params = array()) {
$result = $this->db()->fetchAssoc($sql, $params);
if (!empty($result)) {
$this->setRecord($result);
return $this;
}
return FALSE;
} | [
"public",
"function",
"fetchOne",
"(",
"$",
"sql",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"db",
"(",
")",
"->",
"fetchAssoc",
"(",
"$",
"sql",
",",
"$",
"params",
")",
";",
"if",
"(",
"!",
... | Fetchs one record with the given query.
If success sets the record in the current object and return $this.
If fails return false.
@param $sql
@param $params
@return The current instance with the record setted internally. | [
"Fetchs",
"one",
"record",
"with",
"the",
"given",
"query",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L304-L314 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.findByFieldWithoutFetch | public function findByFieldWithoutFetch($field_name, $value, $operator = '=') {
$query = $this->db()->createQueryBuilder();
$query->select('t.*')
->from($this->table, 't')
->where("$field_name $operator ?")
->setParameter(0, $value);
return $query->execute();
} | php | public function findByFieldWithoutFetch($field_name, $value, $operator = '=') {
$query = $this->db()->createQueryBuilder();
$query->select('t.*')
->from($this->table, 't')
->where("$field_name $operator ?")
->setParameter(0, $value);
return $query->execute();
} | [
"public",
"function",
"findByFieldWithoutFetch",
"(",
"$",
"field_name",
",",
"$",
"value",
",",
"$",
"operator",
"=",
"'='",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"db",
"(",
")",
"->",
"createQueryBuilder",
"(",
")",
";",
"$",
"query",
"->",... | Finds into table by any given field.
@param $field_name
@param $value
@param $operator : A valid SQL operator for the comparison =, >, <, LIKE, IN, NOT IN. By default =
@return PDOStatement : PDOStatement with results. | [
"Finds",
"into",
"table",
"by",
"any",
"given",
"field",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L363-L371 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.findByField | public function findByField($field_name, $value, $operator = '=') {
$results = $this->findByFieldWithoutFetch($field_name, $value, $operator);
$return = $this->hydrate($results);
return $return;
} | php | public function findByField($field_name, $value, $operator = '=') {
$results = $this->findByFieldWithoutFetch($field_name, $value, $operator);
$return = $this->hydrate($results);
return $return;
} | [
"public",
"function",
"findByField",
"(",
"$",
"field_name",
",",
"$",
"value",
",",
"$",
"operator",
"=",
"'='",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"findByFieldWithoutFetch",
"(",
"$",
"field_name",
",",
"$",
"value",
",",
"$",
"operator"... | Finds into table by any given field.
@param $field_name
@param $value
@param $operator : A valid SQL operator for the comparison =, >, <, LIKE, IN, NOT IN. By default =
@return Array of Model Objects
. | [
"Finds",
"into",
"table",
"by",
"any",
"given",
"field",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L383-L388 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.hydrate | public function hydrate(PDOStatement $results) {
if (method_exists($this, 'preHydrate')) {
$results = $this->preHydrate($results);
}
$return = array();
if ($results) {
$arrayResults = $results->fetchAll();
foreach ($arrayResults as $arrayResult) {
$className = get_class($thi... | php | public function hydrate(PDOStatement $results) {
if (method_exists($this, 'preHydrate')) {
$results = $this->preHydrate($results);
}
$return = array();
if ($results) {
$arrayResults = $results->fetchAll();
foreach ($arrayResults as $arrayResult) {
$className = get_class($thi... | [
"public",
"function",
"hydrate",
"(",
"PDOStatement",
"$",
"results",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"'preHydrate'",
")",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"preHydrate",
"(",
"$",
"results",
")",
";",
"}",
... | Default Hydrate.
Use preHydrate and postHydrate methods to change the default behavior.
You can override this method too if you need.
@param PDOStatement $results
@return Array of Model Objects | [
"Default",
"Hydrate",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L400-L422 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.findRelatedModel | public function findRelatedModel($modelName, $field, $id = NULL) {
$relatedModel = $this->getInstance($modelName);
if ($this->isNew() && $id === NULL) {
throw new \Exception('No id for related');
}
if ($id === NULL) {
$id = $this->getField($field);
}
$result = $relatedModel->findB... | php | public function findRelatedModel($modelName, $field, $id = NULL) {
$relatedModel = $this->getInstance($modelName);
if ($this->isNew() && $id === NULL) {
throw new \Exception('No id for related');
}
if ($id === NULL) {
$id = $this->getField($field);
}
$result = $relatedModel->findB... | [
"public",
"function",
"findRelatedModel",
"(",
"$",
"modelName",
",",
"$",
"field",
",",
"$",
"id",
"=",
"NULL",
")",
"{",
"$",
"relatedModel",
"=",
"$",
"this",
"->",
"getInstance",
"(",
"$",
"modelName",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isN... | Finds a related model instance by the given field name and the id value.
Use it in a 1 to N relation, with an object instance of the N side to the get 1 related model.
@param $modelName : The related model name.
@param $field : The field that must be used to relate.
@param $id : Optional, the ID the related model, if... | [
"Finds",
"a",
"related",
"model",
"instance",
"by",
"the",
"given",
"field",
"name",
"and",
"the",
"id",
"value",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L437-L451 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.findRelatedModels | public function findRelatedModels($modelName, $field, $id = NULL) {
$relatedModel = $this->getInstance($modelName);
if ($this->isNew() && $id === NULL) {
throw new \Exception('No id for related');
}
if ($id === NULL) {
$id = $this->getId();
}
$result = $relatedModel->findByField($... | php | public function findRelatedModels($modelName, $field, $id = NULL) {
$relatedModel = $this->getInstance($modelName);
if ($this->isNew() && $id === NULL) {
throw new \Exception('No id for related');
}
if ($id === NULL) {
$id = $this->getId();
}
$result = $relatedModel->findByField($... | [
"public",
"function",
"findRelatedModels",
"(",
"$",
"modelName",
",",
"$",
"field",
",",
"$",
"id",
"=",
"NULL",
")",
"{",
"$",
"relatedModel",
"=",
"$",
"this",
"->",
"getInstance",
"(",
"$",
"modelName",
")",
";",
"if",
"(",
"$",
"this",
"->",
"is... | Finds related models instances using the field name and the id value.
Use it in a 1 to N relation, with an object instance of the 1 side to the get N related models.
@param $modelName : The related model name.
@param $field : The field that must be used to relate.
@param $id : Optional, the ID the related model, if i... | [
"Finds",
"related",
"models",
"instances",
"using",
"the",
"field",
"name",
"and",
"the",
"id",
"value",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L466-L480 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.plain | static public function plain($objects) {
$data = array();
foreach ($objects as $object) {
$data[] = $object->getRecord();
}
return $data;
} | php | static public function plain($objects) {
$data = array();
foreach ($objects as $object) {
$data[] = $object->getRecord();
}
return $data;
} | [
"static",
"public",
"function",
"plain",
"(",
"$",
"objects",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"objects",
"as",
"$",
"object",
")",
"{",
"$",
"data",
"[",
"]",
"=",
"$",
"object",
"->",
"getRecord",
"(",
")... | Convert the array of objects into a plain array.
@param $objects
@return array | [
"Convert",
"the",
"array",
"of",
"objects",
"into",
"a",
"plain",
"array",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L516-L523 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.createQuery | public function createQuery() {
$query = $this->db()->createQueryBuilder();
$query->select('t.*')
->from($this->table, 't');
return $query;
} | php | public function createQuery() {
$query = $this->db()->createQueryBuilder();
$query->select('t.*')
->from($this->table, 't');
return $query;
} | [
"public",
"function",
"createQuery",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"db",
"(",
")",
"->",
"createQueryBuilder",
"(",
")",
";",
"$",
"query",
"->",
"select",
"(",
"'t.*'",
")",
"->",
"from",
"(",
"$",
"this",
"->",
"table",
","... | Creates a QueryBuilder with the table selected.
@return \Doctrine\DBAL\Query\QueryBuilder | [
"Creates",
"a",
"QueryBuilder",
"with",
"the",
"table",
"selected",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L530-L536 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.findAllPaged | public function findAllPaged($page = 0, $limit = 20) {
$results = $this->findAllWithoutFetchPaged($page, $limit);
$return = $this->hydrate($results);
return $return;
} | php | public function findAllPaged($page = 0, $limit = 20) {
$results = $this->findAllWithoutFetchPaged($page, $limit);
$return = $this->hydrate($results);
return $return;
} | [
"public",
"function",
"findAllPaged",
"(",
"$",
"page",
"=",
"0",
",",
"$",
"limit",
"=",
"20",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"findAllWithoutFetchPaged",
"(",
"$",
"page",
",",
"$",
"limit",
")",
";",
"$",
"return",
"=",
"$",
"t... | Finds all records of a table paged.
@param int $page
@param int $limit
@return mixed : Array with results. | [
"Finds",
"all",
"records",
"of",
"a",
"table",
"paged",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L556-L561 |
42mate/towel | src/Towel/Model/BaseModel.php | BaseModel.findAllWithoutFetchPaged | public function findAllWithoutFetchPaged($page = 0, $limit = 20) {
$offset = $page * $limit;
$results = $this->createQuery()
->setFirstResult($offset)
->setMaxResults($limit)
->execute();
return $results;
} | php | public function findAllWithoutFetchPaged($page = 0, $limit = 20) {
$offset = $page * $limit;
$results = $this->createQuery()
->setFirstResult($offset)
->setMaxResults($limit)
->execute();
return $results;
} | [
"public",
"function",
"findAllWithoutFetchPaged",
"(",
"$",
"page",
"=",
"0",
",",
"$",
"limit",
"=",
"20",
")",
"{",
"$",
"offset",
"=",
"$",
"page",
"*",
"$",
"limit",
";",
"$",
"results",
"=",
"$",
"this",
"->",
"createQuery",
"(",
")",
"->",
"s... | Finds all records of a table.
@param int $page
@param int $limit
@return mixed : PDOStatement with results. | [
"Finds",
"all",
"records",
"of",
"a",
"table",
"."
] | train | https://github.com/42mate/towel/blob/5316c3075fc844e8a5cbae113712b26556227dff/src/Towel/Model/BaseModel.php#L572-L579 |
edhelas/sasl2 | src/SASL2/SASL2.php | SASL2.factory | function factory($type)
{
$classname = 'SASL2\Auth\\';
switch (strtolower($type)) {
case 'anonymous':
$classname .= 'Anonymous';
break;
case 'login':
$classname .= 'Login';
break;
case 'plain':
... | php | function factory($type)
{
$classname = 'SASL2\Auth\\';
switch (strtolower($type)) {
case 'anonymous':
$classname .= 'Anonymous';
break;
case 'login':
$classname .= 'Login';
break;
case 'plain':
... | [
"function",
"factory",
"(",
"$",
"type",
")",
"{",
"$",
"classname",
"=",
"'SASL2\\Auth\\\\'",
";",
"switch",
"(",
"strtolower",
"(",
"$",
"type",
")",
")",
"{",
"case",
"'anonymous'",
":",
"$",
"classname",
".=",
"'Anonymous'",
";",
"break",
";",
"case"... | Factory class. Returns an object of the request
type.
@param string $type One of: Anonymous
Plain
CramMD5
DigestMD5
SCRAM-* (any mechanism of the SCRAM family)
Types are not case sensitive | [
"Factory",
"class",
".",
"Returns",
"an",
"object",
"of",
"the",
"request",
"type",
"."
] | train | https://github.com/edhelas/sasl2/blob/b9c7cecb1ebb6086262304b901bbc71dff435504/src/SASL2/SASL2.php#L69-L125 |
ShaoZeMing/laravel-merchant | src/Form.php | Form.redirectAfterUpdate | protected function redirectAfterUpdate()
{
merchant_toastr(trans('merchant.update_succeeded'));
$url = Input::get(Builder::PREVIOUS_URL_KEY) ?: $this->resource(-1);
return redirect($url);
} | php | protected function redirectAfterUpdate()
{
merchant_toastr(trans('merchant.update_succeeded'));
$url = Input::get(Builder::PREVIOUS_URL_KEY) ?: $this->resource(-1);
return redirect($url);
} | [
"protected",
"function",
"redirectAfterUpdate",
"(",
")",
"{",
"merchant_toastr",
"(",
"trans",
"(",
"'merchant.update_succeeded'",
")",
")",
";",
"$",
"url",
"=",
"Input",
"::",
"get",
"(",
"Builder",
"::",
"PREVIOUS_URL_KEY",
")",
"?",
":",
"$",
"this",
"-... | Get RedirectResponse after update.
@return \Illuminate\Http\RedirectResponse | [
"Get",
"RedirectResponse",
"after",
"update",
"."
] | train | https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Form.php#L559-L566 |
ShaoZeMing/laravel-merchant | src/Form.php | Form.updateRelation | protected function updateRelation($relationsData)
{
foreach ($relationsData as $name => $values) {
if (!method_exists($this->model, $name)) {
continue;
}
$relation = $this->model->$name();
$oneToOneRelation = $relation instanceof \Illuminate\... | php | protected function updateRelation($relationsData)
{
foreach ($relationsData as $name => $values) {
if (!method_exists($this->model, $name)) {
continue;
}
$relation = $this->model->$name();
$oneToOneRelation = $relation instanceof \Illuminate\... | [
"protected",
"function",
"updateRelation",
"(",
"$",
"relationsData",
")",
"{",
"foreach",
"(",
"$",
"relationsData",
"as",
"$",
"name",
"=>",
"$",
"values",
")",
"{",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"this",
"->",
"model",
",",
"$",
"name",
... | Update relation data.
@param array $relationsData
@return void | [
"Update",
"relation",
"data",
"."
] | train | https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Form.php#L635-L712 |
ShaoZeMing/laravel-merchant | src/Form.php | Form.registerBuiltinFields | public static function registerBuiltinFields()
{
$map = [
'button' => \ShaoZeMing\Merchant\Form\Field\Button::class,
'checkbox' => \ShaoZeMing\Merchant\Form\Field\Checkbox::class,
'color' => \ShaoZeMing\Merchant\Form\Field\Color::class,
... | php | public static function registerBuiltinFields()
{
$map = [
'button' => \ShaoZeMing\Merchant\Form\Field\Button::class,
'checkbox' => \ShaoZeMing\Merchant\Form\Field\Checkbox::class,
'color' => \ShaoZeMing\Merchant\Form\Field\Color::class,
... | [
"public",
"static",
"function",
"registerBuiltinFields",
"(",
")",
"{",
"$",
"map",
"=",
"[",
"'button'",
"=>",
"\\",
"ShaoZeMing",
"\\",
"Merchant",
"\\",
"Form",
"\\",
"Field",
"\\",
"Button",
"::",
"class",
",",
"'checkbox'",
"=>",
"\\",
"ShaoZeMing",
"... | Register builtin fields.
@return void | [
"Register",
"builtin",
"fields",
"."
] | train | https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Form.php#L1198-L1252 |
Humanized/yii2-location | controllers/AdminController.php | AdminController.actionIndex | public function actionIndex()
{
$model = new Location();
if ($model->load(\Yii::$app->request->post()) && $model->save()) {
$model = new Location(); //reset model
}
$searchModel = new LocationSearch(['pagination' => TRUE]);
$dataProvider = $searchModel->search(\Y... | php | public function actionIndex()
{
$model = new Location();
if ($model->load(\Yii::$app->request->post()) && $model->save()) {
$model = new Location(); //reset model
}
$searchModel = new LocationSearch(['pagination' => TRUE]);
$dataProvider = $searchModel->search(\Y... | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"Location",
"(",
")",
";",
"if",
"(",
"$",
"model",
"->",
"load",
"(",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"post",
"(",
")",
")",
"&&",
"$",
"model",
... | Lists all Location models.
@return mixed | [
"Lists",
"all",
"Location",
"models",
"."
] | train | https://github.com/Humanized/yii2-location/blob/48ac12ceab741fc4c82ac8e979415a11bf9175f2/controllers/AdminController.php#L38-L53 |
raideer/twitch-api | src/Resources/Resource.php | Resource.resolveOptions | public function resolveOptions($options, $defaults, $required = [], $allowedTypes = [])
{
$resolver = new OptionsResolver();
$resolver->setDefaults($defaults);
if (!empty($required)) {
$resolver->setRequired($required);
}
if (!empty($allowedTypes)) {
foreach ($allow... | php | public function resolveOptions($options, $defaults, $required = [], $allowedTypes = [])
{
$resolver = new OptionsResolver();
$resolver->setDefaults($defaults);
if (!empty($required)) {
$resolver->setRequired($required);
}
if (!empty($allowedTypes)) {
foreach ($allow... | [
"public",
"function",
"resolveOptions",
"(",
"$",
"options",
",",
"$",
"defaults",
",",
"$",
"required",
"=",
"[",
"]",
",",
"$",
"allowedTypes",
"=",
"[",
"]",
")",
"{",
"$",
"resolver",
"=",
"new",
"OptionsResolver",
"(",
")",
";",
"$",
"resolver",
... | Helper function for resolving parameters.
@param array $options Passed params
@param array $defaults Default values
@param array $required Required fields
@param array $allowedTypes Allowed field values
@return array | [
"Helper",
"function",
"for",
"resolving",
"parameters",
"."
] | train | https://github.com/raideer/twitch-api/blob/27ebf1dcb0315206300d507600b6a82ebe33d57e/src/Resources/Resource.php#L45-L61 |
php-lug/lug | src/Bundle/GridBundle/Form/Type/Filter/NumberFilterType.php | NumberFilterType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add($builder->create('type', ChoiceType::class, [
'choices' => array_combine(
array_map(function ($choice) use ($options) {
return $options['label_pre... | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add($builder->create('type', ChoiceType::class, [
'choices' => array_combine(
array_map(function ($choice) use ($options) {
return $options['label_pre... | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"$",
"builder",
"->",
"create",
"(",
"'type'",
",",
"ChoiceType",
"::",
"class",
",",
"[",
"'choices'"... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/GridBundle/Form/Type/Filter/NumberFilterType.php#L40-L54 |
gpupo/common-schema | src/ORM/Entity/Trading/Order/Shipping/Shipping.php | Shipping.setSeller | public function setSeller(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Seller $seller = null)
{
$this->seller = $seller;
return $this;
} | php | public function setSeller(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Seller $seller = null)
{
$this->seller = $seller;
return $this;
} | [
"public",
"function",
"setSeller",
"(",
"\\",
"Gpupo",
"\\",
"CommonSchema",
"\\",
"ORM",
"\\",
"Entity",
"\\",
"Trading",
"\\",
"Order",
"\\",
"Shipping",
"\\",
"Seller",
"$",
"seller",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"seller",
"=",
"$",
"se... | Set seller.
@param null|\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Seller $seller
@return Shipping | [
"Set",
"seller",
"."
] | train | https://github.com/gpupo/common-schema/blob/a762d2eb3063b7317c72c69cbb463b1f95b86b0a/src/ORM/Entity/Trading/Order/Shipping/Shipping.php#L685-L690 |
gpupo/common-schema | src/ORM/Entity/Trading/Order/Shipping/Shipping.php | Shipping.addProduct | public function addProduct(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Product\Product $product)
{
$this->products[] = $product;
return $this;
} | php | public function addProduct(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Product\Product $product)
{
$this->products[] = $product;
return $this;
} | [
"public",
"function",
"addProduct",
"(",
"\\",
"Gpupo",
"\\",
"CommonSchema",
"\\",
"ORM",
"\\",
"Entity",
"\\",
"Trading",
"\\",
"Order",
"\\",
"Shipping",
"\\",
"Product",
"\\",
"Product",
"$",
"product",
")",
"{",
"$",
"this",
"->",
"products",
"[",
"... | Add product.
@param \Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Product\Product $product
@return Shipping | [
"Add",
"product",
"."
] | train | https://github.com/gpupo/common-schema/blob/a762d2eb3063b7317c72c69cbb463b1f95b86b0a/src/ORM/Entity/Trading/Order/Shipping/Shipping.php#L709-L714 |
gpupo/common-schema | src/ORM/Entity/Trading/Order/Shipping/Shipping.php | Shipping.removeProduct | public function removeProduct(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Product\Product $product)
{
return $this->products->removeElement($product);
} | php | public function removeProduct(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Product\Product $product)
{
return $this->products->removeElement($product);
} | [
"public",
"function",
"removeProduct",
"(",
"\\",
"Gpupo",
"\\",
"CommonSchema",
"\\",
"ORM",
"\\",
"Entity",
"\\",
"Trading",
"\\",
"Order",
"\\",
"Shipping",
"\\",
"Product",
"\\",
"Product",
"$",
"product",
")",
"{",
"return",
"$",
"this",
"->",
"produc... | Remove product.
@param \Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Product\Product $product
@return bool TRUE if this collection contained the specified element, FALSE otherwise | [
"Remove",
"product",
"."
] | train | https://github.com/gpupo/common-schema/blob/a762d2eb3063b7317c72c69cbb463b1f95b86b0a/src/ORM/Entity/Trading/Order/Shipping/Shipping.php#L723-L726 |
gpupo/common-schema | src/ORM/Entity/Trading/Order/Shipping/Shipping.php | Shipping.addTransport | public function addTransport(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Transport\Transport $transport)
{
$this->transports[] = $transport;
return $this;
} | php | public function addTransport(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Transport\Transport $transport)
{
$this->transports[] = $transport;
return $this;
} | [
"public",
"function",
"addTransport",
"(",
"\\",
"Gpupo",
"\\",
"CommonSchema",
"\\",
"ORM",
"\\",
"Entity",
"\\",
"Trading",
"\\",
"Order",
"\\",
"Shipping",
"\\",
"Transport",
"\\",
"Transport",
"$",
"transport",
")",
"{",
"$",
"this",
"->",
"transports",
... | Add transport.
@param \Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Transport\Transport $transport
@return Shipping | [
"Add",
"transport",
"."
] | train | https://github.com/gpupo/common-schema/blob/a762d2eb3063b7317c72c69cbb463b1f95b86b0a/src/ORM/Entity/Trading/Order/Shipping/Shipping.php#L745-L750 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.