id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
228,800 | contao-bootstrap/templates | src/EventListener/ThemeConfigurationListener.php | ThemeConfigurationListener.onBuildContextConfig | public function onBuildContextConfig(BuildContextConfig $command): void
{
$context = $command->getContext();
if (!$context instanceof ThemeContext) {
return;
}
$theme = ThemeModel::findByPk($context->getThemeId());
if (!$theme) {
return;
}
... | php | public function onBuildContextConfig(BuildContextConfig $command): void
{
$context = $command->getContext();
if (!$context instanceof ThemeContext) {
return;
}
$theme = ThemeModel::findByPk($context->getThemeId());
if (!$theme) {
return;
}
... | [
"public",
"function",
"onBuildContextConfig",
"(",
"BuildContextConfig",
"$",
"command",
")",
":",
"void",
"{",
"$",
"context",
"=",
"$",
"command",
"->",
"getContext",
"(",
")",
";",
"if",
"(",
"!",
"$",
"context",
"instanceof",
"ThemeContext",
")",
"{",
... | Build the context config.
@param BuildContextConfig $command The command.
@return void | [
"Build",
"the",
"context",
"config",
"."
] | cf507af3a194895923c6b84d97aa224e8b5b6d2f | https://github.com/contao-bootstrap/templates/blob/cf507af3a194895923c6b84d97aa224e8b5b6d2f/src/EventListener/ThemeConfigurationListener.php#L36-L62 |
228,801 | contao-bootstrap/templates | src/EventListener/ThemeConfigurationListener.php | ThemeConfigurationListener.buildGravatarConfig | private function buildGravatarConfig(ThemeModel $theme, array $config): array
{
$file = FilesModel::findByPk($theme->bs_gravatar_default);
if ($file) {
$config['gravatar']['default'] = Environment::get('base') . $file->path;
}
if ($theme->bs_gravatar_size) {
... | php | private function buildGravatarConfig(ThemeModel $theme, array $config): array
{
$file = FilesModel::findByPk($theme->bs_gravatar_default);
if ($file) {
$config['gravatar']['default'] = Environment::get('base') . $file->path;
}
if ($theme->bs_gravatar_size) {
... | [
"private",
"function",
"buildGravatarConfig",
"(",
"ThemeModel",
"$",
"theme",
",",
"array",
"$",
"config",
")",
":",
"array",
"{",
"$",
"file",
"=",
"FilesModel",
"::",
"findByPk",
"(",
"$",
"theme",
"->",
"bs_gravatar_default",
")",
";",
"if",
"(",
"$",
... | Build the gravatar config.
@param ThemeModel $theme The theme model.
@param array $config The theme config.
@return array | [
"Build",
"the",
"gravatar",
"config",
"."
] | cf507af3a194895923c6b84d97aa224e8b5b6d2f | https://github.com/contao-bootstrap/templates/blob/cf507af3a194895923c6b84d97aa224e8b5b6d2f/src/EventListener/ThemeConfigurationListener.php#L72-L85 |
228,802 | minmb/phpmailer | class.smtp.php | SMTP.Connected | public function Connected() {
if(!empty($this->smtp_conn)) {
$sock_status = socket_get_status($this->smtp_conn);
if($sock_status["eof"]) {
// the socket is valid but we are not connected
if($this->do_debug >= 1) {
$this->edebug("SMTP -> NOTICE:" . $this->CRLF . "EOF caught wh... | php | public function Connected() {
if(!empty($this->smtp_conn)) {
$sock_status = socket_get_status($this->smtp_conn);
if($sock_status["eof"]) {
// the socket is valid but we are not connected
if($this->do_debug >= 1) {
$this->edebug("SMTP -> NOTICE:" . $this->CRLF . "EOF caught wh... | [
"public",
"function",
"Connected",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"smtp_conn",
")",
")",
"{",
"$",
"sock_status",
"=",
"socket_get_status",
"(",
"$",
"this",
"->",
"smtp_conn",
")",
";",
"if",
"(",
"$",
"sock_status",
... | Returns true if connected to a server otherwise false
@access public
@return bool | [
"Returns",
"true",
"if",
"connected",
"to",
"a",
"server",
"otherwise",
"false"
] | df443234ad0ca10cbf91a0c0a728b256afcab1d1 | https://github.com/minmb/phpmailer/blob/df443234ad0ca10cbf91a0c0a728b256afcab1d1/class.smtp.php#L408-L422 |
228,803 | czim/laravel-cms-upload-module | src/Repositories/FileRepository.php | FileRepository.create | public function create($path, array $data)
{
$data = array_merge($data, ['path' => $path]);
return File::create($data);
} | php | public function create($path, array $data)
{
$data = array_merge($data, ['path' => $path]);
return File::create($data);
} | [
"public",
"function",
"create",
"(",
"$",
"path",
",",
"array",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"array_merge",
"(",
"$",
"data",
",",
"[",
"'path'",
"=>",
"$",
"path",
"]",
")",
";",
"return",
"File",
"::",
"create",
"(",
"$",
"data",
")... | Creates a new record for a semi-permanent uploaded file.
@param string $path local path to uploaded file
@param array $data
@return \Czim\CmsUploadModule\Models\File | [
"Creates",
"a",
"new",
"record",
"for",
"a",
"semi",
"-",
"permanent",
"uploaded",
"file",
"."
] | 3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3 | https://github.com/czim/laravel-cms-upload-module/blob/3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3/src/Repositories/FileRepository.php#L20-L25 |
228,804 | czim/laravel-cms-upload-module | src/Repositories/FileRepository.php | FileRepository.delete | public function delete($id, $unlink = true)
{
if ( ! ($file = $this->findById($id))) {
return true;
}
if (FileFacade::exists($file->path)) {
FileFacade::delete($file->path);
}
return $file->delete();
} | php | public function delete($id, $unlink = true)
{
if ( ! ($file = $this->findById($id))) {
return true;
}
if (FileFacade::exists($file->path)) {
FileFacade::delete($file->path);
}
return $file->delete();
} | [
"public",
"function",
"delete",
"(",
"$",
"id",
",",
"$",
"unlink",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"file",
"=",
"$",
"this",
"->",
"findById",
"(",
"$",
"id",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"FileF... | Deletes an uploaded file.
@param int $id
@param bool $unlink if true, also deletes the referenced file
@return bool | [
"Deletes",
"an",
"uploaded",
"file",
"."
] | 3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3 | https://github.com/czim/laravel-cms-upload-module/blob/3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3/src/Repositories/FileRepository.php#L66-L77 |
228,805 | czim/laravel-cms-upload-module | src/Repositories/FileRepository.php | FileRepository.cleanup | public function cleanup()
{
// Find all files older than the given gc age
$fileIds = File::query()
->where('created_at', '<', Carbon::now()->subMinutes($this->getGarbageAgeInMinutes()))
->pluck('id');
if ( ! count($fileIds)) {
return 0;
}
... | php | public function cleanup()
{
// Find all files older than the given gc age
$fileIds = File::query()
->where('created_at', '<', Carbon::now()->subMinutes($this->getGarbageAgeInMinutes()))
->pluck('id');
if ( ! count($fileIds)) {
return 0;
}
... | [
"public",
"function",
"cleanup",
"(",
")",
"{",
"// Find all files older than the given gc age",
"$",
"fileIds",
"=",
"File",
"::",
"query",
"(",
")",
"->",
"where",
"(",
"'created_at'",
",",
"'<'",
",",
"Carbon",
"::",
"now",
"(",
")",
"->",
"subMinutes",
"... | Cleans up old upload records and files.
@return int Records deleted | [
"Cleans",
"up",
"old",
"upload",
"records",
"and",
"files",
"."
] | 3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3 | https://github.com/czim/laravel-cms-upload-module/blob/3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3/src/Repositories/FileRepository.php#L84-L102 |
228,806 | mariano/disque-php | src/Connection/Node/ConservativeJobCountPrioritizer.php | ConservativeJobCountPrioritizer.calculateNodePriority | private function calculateNodePriority(Node $node, $currentNodeId)
{
$priority = $node->getJobCount();
if ($node->getId() === $currentNodeId) {
$margin = 1 + $this->marginToSwitch;
$priority = $priority * $margin;
}
// Apply a weight determined by the node p... | php | private function calculateNodePriority(Node $node, $currentNodeId)
{
$priority = $node->getJobCount();
if ($node->getId() === $currentNodeId) {
$margin = 1 + $this->marginToSwitch;
$priority = $priority * $margin;
}
// Apply a weight determined by the node p... | [
"private",
"function",
"calculateNodePriority",
"(",
"Node",
"$",
"node",
",",
"$",
"currentNodeId",
")",
"{",
"$",
"priority",
"=",
"$",
"node",
"->",
"getJobCount",
"(",
")",
";",
"if",
"(",
"$",
"node",
"->",
"getId",
"(",
")",
"===",
"$",
"currentN... | Calculate the node priority from its job count, stick to the current node
As the priority is based on the number of jobs, higher is better.
@param Node $node
@param string $currentNodeId
@return float Node priority | [
"Calculate",
"the",
"node",
"priority",
"from",
"its",
"job",
"count",
"stick",
"to",
"the",
"current",
"node"
] | 56cf00d97e739fec861717484657dbef2888df60 | https://github.com/mariano/disque-php/blob/56cf00d97e739fec861717484657dbef2888df60/src/Connection/Node/ConservativeJobCountPrioritizer.php#L94-L125 |
228,807 | contao-bootstrap/templates | src/View/Gravatar.php | Gravatar.generateUrl | public function generateUrl($email, $size = null, $default = null)
{
if ($size == null) {
$size = $this->environment->getConfig()->get(['templates', 'gravatar', 'size']);
}
if ($default == null) {
$default = $this->environment->getConfig()->get(['templates', 'gravata... | php | public function generateUrl($email, $size = null, $default = null)
{
if ($size == null) {
$size = $this->environment->getConfig()->get(['templates', 'gravatar', 'size']);
}
if ($default == null) {
$default = $this->environment->getConfig()->get(['templates', 'gravata... | [
"public",
"function",
"generateUrl",
"(",
"$",
"email",
",",
"$",
"size",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"size",
"==",
"null",
")",
"{",
"$",
"size",
"=",
"$",
"this",
"->",
"environment",
"->",
"getConfig"... | Generate the gravatar url.
@param string $email The given email.
@param null $size Optional size.
@param null $default Optional default image url.
@return string
@SuppressWarnings(PHPMD.Superglobals) | [
"Generate",
"the",
"gravatar",
"url",
"."
] | cf507af3a194895923c6b84d97aa224e8b5b6d2f | https://github.com/contao-bootstrap/templates/blob/cf507af3a194895923c6b84d97aa224e8b5b6d2f/src/View/Gravatar.php#L60-L83 |
228,808 | dnunez24/craft-laravel-mix | models/Mix_ManifestModel.php | Mix_ManifestModel.getAssetPath | public function getAssetPath(string $sourcePath)
{
$manifest = $this->readFile();
$path = $this->pathHelper->prefix($sourcePath);
if (!array_key_exists($path, $manifest)) {
throw new Exception("Unable to locate path '{$path}' in Mix manifest.");
}
return $this->... | php | public function getAssetPath(string $sourcePath)
{
$manifest = $this->readFile();
$path = $this->pathHelper->prefix($sourcePath);
if (!array_key_exists($path, $manifest)) {
throw new Exception("Unable to locate path '{$path}' in Mix manifest.");
}
return $this->... | [
"public",
"function",
"getAssetPath",
"(",
"string",
"$",
"sourcePath",
")",
"{",
"$",
"manifest",
"=",
"$",
"this",
"->",
"readFile",
"(",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"pathHelper",
"->",
"prefix",
"(",
"$",
"sourcePath",
")",
";",
... | Get mapped asset path from manifest file
@param string $sourcePath
@return string
@throws Exception | [
"Get",
"mapped",
"asset",
"path",
"from",
"manifest",
"file"
] | c2f060f87be351d30e7d00123bb0ac25dd035490 | https://github.com/dnunez24/craft-laravel-mix/blob/c2f060f87be351d30e7d00123bb0ac25dd035490/models/Mix_ManifestModel.php#L63-L73 |
228,809 | dnunez24/craft-laravel-mix | models/Mix_ManifestModel.php | Mix_ManifestModel.getFile | protected function getFile()
{
$path = $this->directory.'/'.self::MANIFEST_FILENAME;
$file = $this->pathHelper->getPublicPath($path, true);
return $file;
} | php | protected function getFile()
{
$path = $this->directory.'/'.self::MANIFEST_FILENAME;
$file = $this->pathHelper->getPublicPath($path, true);
return $file;
} | [
"protected",
"function",
"getFile",
"(",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"directory",
".",
"'/'",
".",
"self",
"::",
"MANIFEST_FILENAME",
";",
"$",
"file",
"=",
"$",
"this",
"->",
"pathHelper",
"->",
"getPublicPath",
"(",
"$",
"path",
",... | Get manifest file
@return string | [
"Get",
"manifest",
"file"
] | c2f060f87be351d30e7d00123bb0ac25dd035490 | https://github.com/dnunez24/craft-laravel-mix/blob/c2f060f87be351d30e7d00123bb0ac25dd035490/models/Mix_ManifestModel.php#L80-L85 |
228,810 | dnunez24/craft-laravel-mix | models/Mix_ManifestModel.php | Mix_ManifestModel.readFile | protected function readFile()
{
$file = $this->getFile();
$raw = $this->ioHelper->getFileContents($file);
return $this->jsonHelper->decode($raw);
} | php | protected function readFile()
{
$file = $this->getFile();
$raw = $this->ioHelper->getFileContents($file);
return $this->jsonHelper->decode($raw);
} | [
"protected",
"function",
"readFile",
"(",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"getFile",
"(",
")",
";",
"$",
"raw",
"=",
"$",
"this",
"->",
"ioHelper",
"->",
"getFileContents",
"(",
"$",
"file",
")",
";",
"return",
"$",
"this",
"->",
"js... | Read & decode contents of manifest file
@return mixed | [
"Read",
"&",
"decode",
"contents",
"of",
"manifest",
"file"
] | c2f060f87be351d30e7d00123bb0ac25dd035490 | https://github.com/dnunez24/craft-laravel-mix/blob/c2f060f87be351d30e7d00123bb0ac25dd035490/models/Mix_ManifestModel.php#L92-L97 |
228,811 | sop/crypto-types | lib/CryptoTypes/AlgorithmIdentifier/Signature/SignatureAlgorithmIdentifierFactory.php | SignatureAlgorithmIdentifierFactory.algoForAsymmetricCrypto | public static function algoForAsymmetricCrypto(
AsymmetricCryptoAlgorithmIdentifier $crypto_algo,
HashAlgorithmIdentifier $hash_algo): SignatureAlgorithmIdentifier
{
switch ($crypto_algo->oid()) {
case AlgorithmIdentifier::OID_RSA_ENCRYPTION:
$oid = self::_oidForR... | php | public static function algoForAsymmetricCrypto(
AsymmetricCryptoAlgorithmIdentifier $crypto_algo,
HashAlgorithmIdentifier $hash_algo): SignatureAlgorithmIdentifier
{
switch ($crypto_algo->oid()) {
case AlgorithmIdentifier::OID_RSA_ENCRYPTION:
$oid = self::_oidForR... | [
"public",
"static",
"function",
"algoForAsymmetricCrypto",
"(",
"AsymmetricCryptoAlgorithmIdentifier",
"$",
"crypto_algo",
",",
"HashAlgorithmIdentifier",
"$",
"hash_algo",
")",
":",
"SignatureAlgorithmIdentifier",
"{",
"switch",
"(",
"$",
"crypto_algo",
"->",
"oid",
"(",... | Get signature algorithm identifier of given asymmetric cryptographic type
utilizing given hash algorithm.
@param AsymmetricCryptoAlgorithmIdentifier $crypto_algo Cryptographic
algorithm identifier, eg. RSA or EC
@param HashAlgorithmIdentifier $hash_algo Hash algorithm identifier
@throws \UnexpectedValueException
@retu... | [
"Get",
"signature",
"algorithm",
"identifier",
"of",
"given",
"asymmetric",
"cryptographic",
"type",
"utilizing",
"given",
"hash",
"algorithm",
"."
] | 1d36250a110b07300aeb003a20aeaadfc6445501 | https://github.com/sop/crypto-types/blob/1d36250a110b07300aeb003a20aeaadfc6445501/lib/CryptoTypes/AlgorithmIdentifier/Signature/SignatureAlgorithmIdentifierFactory.php#L63-L81 |
228,812 | sop/crypto-types | lib/CryptoTypes/AlgorithmIdentifier/Signature/SignatureAlgorithmIdentifierFactory.php | SignatureAlgorithmIdentifierFactory._oidForRSA | private static function _oidForRSA(HashAlgorithmIdentifier $hash_algo): string
{
if (!array_key_exists($hash_algo->oid(), self::MAP_RSA_OID)) {
throw new \UnexpectedValueException(
sprintf("No RSA signature algorithm for %s.", $hash_algo->name()));
}
return self::... | php | private static function _oidForRSA(HashAlgorithmIdentifier $hash_algo): string
{
if (!array_key_exists($hash_algo->oid(), self::MAP_RSA_OID)) {
throw new \UnexpectedValueException(
sprintf("No RSA signature algorithm for %s.", $hash_algo->name()));
}
return self::... | [
"private",
"static",
"function",
"_oidForRSA",
"(",
"HashAlgorithmIdentifier",
"$",
"hash_algo",
")",
":",
"string",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"hash_algo",
"->",
"oid",
"(",
")",
",",
"self",
"::",
"MAP_RSA_OID",
")",
")",
"{",
"th... | Get RSA signature algorithm OID for the given hash algorithm identifier.
@param HashAlgorithmIdentifier $hash_algo
@throws \UnexpectedValueException
@return string | [
"Get",
"RSA",
"signature",
"algorithm",
"OID",
"for",
"the",
"given",
"hash",
"algorithm",
"identifier",
"."
] | 1d36250a110b07300aeb003a20aeaadfc6445501 | https://github.com/sop/crypto-types/blob/1d36250a110b07300aeb003a20aeaadfc6445501/lib/CryptoTypes/AlgorithmIdentifier/Signature/SignatureAlgorithmIdentifierFactory.php#L90-L97 |
228,813 | sop/crypto-types | lib/CryptoTypes/AlgorithmIdentifier/Signature/SignatureAlgorithmIdentifierFactory.php | SignatureAlgorithmIdentifierFactory._oidForEC | private static function _oidForEC(HashAlgorithmIdentifier $hash_algo): string
{
if (!array_key_exists($hash_algo->oid(), self::MAP_EC_OID)) {
throw new \UnexpectedValueException(
sprintf("No EC signature algorithm for %s.", $hash_algo->name()));
}
return self::MAP... | php | private static function _oidForEC(HashAlgorithmIdentifier $hash_algo): string
{
if (!array_key_exists($hash_algo->oid(), self::MAP_EC_OID)) {
throw new \UnexpectedValueException(
sprintf("No EC signature algorithm for %s.", $hash_algo->name()));
}
return self::MAP... | [
"private",
"static",
"function",
"_oidForEC",
"(",
"HashAlgorithmIdentifier",
"$",
"hash_algo",
")",
":",
"string",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"hash_algo",
"->",
"oid",
"(",
")",
",",
"self",
"::",
"MAP_EC_OID",
")",
")",
"{",
"thro... | Get EC signature algorithm OID for the given hash algorithm identifier.
@param HashAlgorithmIdentifier $hash_algo
@throws \UnexpectedValueException
@return string | [
"Get",
"EC",
"signature",
"algorithm",
"OID",
"for",
"the",
"given",
"hash",
"algorithm",
"identifier",
"."
] | 1d36250a110b07300aeb003a20aeaadfc6445501 | https://github.com/sop/crypto-types/blob/1d36250a110b07300aeb003a20aeaadfc6445501/lib/CryptoTypes/AlgorithmIdentifier/Signature/SignatureAlgorithmIdentifierFactory.php#L106-L113 |
228,814 | jeremeamia/FunctionParser | src/Token.php | Token.serialize | public function serialize()
{
return serialize(array($this->name, $this->value, $this->code, $this->line));
} | php | public function serialize()
{
return serialize(array($this->name, $this->value, $this->code, $this->line));
} | [
"public",
"function",
"serialize",
"(",
")",
"{",
"return",
"serialize",
"(",
"array",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"this",
"->",
"value",
",",
"$",
"this",
"->",
"code",
",",
"$",
"this",
"->",
"line",
")",
")",
";",
"}"
] | Serializes the token.
@return string The serialized token. | [
"Serializes",
"the",
"token",
"."
] | 035b52000b88ea8d72a6647dd4cd39f080cf7ada | https://github.com/jeremeamia/FunctionParser/blob/035b52000b88ea8d72a6647dd4cd39f080cf7ada/src/Token.php#L225-L228 |
228,815 | jeremeamia/FunctionParser | src/Token.php | Token.unserialize | public function unserialize($serialized)
{
list($this->name, $this->value, $this->code, $this->line) = unserialize($serialized);
} | php | public function unserialize($serialized)
{
list($this->name, $this->value, $this->code, $this->line) = unserialize($serialized);
} | [
"public",
"function",
"unserialize",
"(",
"$",
"serialized",
")",
"{",
"list",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"this",
"->",
"value",
",",
"$",
"this",
"->",
"code",
",",
"$",
"this",
"->",
"line",
")",
"=",
"unserialize",
"(",
"$",
"seri... | Unserializes the token
@param string $serialized The serialized token | [
"Unserializes",
"the",
"token"
] | 035b52000b88ea8d72a6647dd4cd39f080cf7ada | https://github.com/jeremeamia/FunctionParser/blob/035b52000b88ea8d72a6647dd4cd39f080cf7ada/src/Token.php#L235-L238 |
228,816 | sop/crypto-types | lib/CryptoTypes/AlgorithmIdentifier/Cipher/CipherAlgorithmIdentifier.php | CipherAlgorithmIdentifier.withInitializationVector | public function withInitializationVector($iv): self
{
$this->_checkIVSize($iv);
$obj = clone $this;
$obj->_initializationVector = $iv;
return $obj;
} | php | public function withInitializationVector($iv): self
{
$this->_checkIVSize($iv);
$obj = clone $this;
$obj->_initializationVector = $iv;
return $obj;
} | [
"public",
"function",
"withInitializationVector",
"(",
"$",
"iv",
")",
":",
"self",
"{",
"$",
"this",
"->",
"_checkIVSize",
"(",
"$",
"iv",
")",
";",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_initializationVector",
"=",
"$",
"iv",... | Get copy of the object with given initialization vector.
@param string|null $iv Initialization vector or null to remove
@throws \UnexpectedValueException If initialization vector size is
invalid
@return self | [
"Get",
"copy",
"of",
"the",
"object",
"with",
"given",
"initialization",
"vector",
"."
] | 1d36250a110b07300aeb003a20aeaadfc6445501 | https://github.com/sop/crypto-types/blob/1d36250a110b07300aeb003a20aeaadfc6445501/lib/CryptoTypes/AlgorithmIdentifier/Cipher/CipherAlgorithmIdentifier.php#L53-L59 |
228,817 | czim/laravel-cms-upload-module | src/Http/Requests/UploadFileRequest.php | UploadFileRequest.getNormalizedValidationRules | public function getNormalizedValidationRules()
{
$rules = json_decode($this->get('validation'), true);
if ( ! is_string($rules) && ! is_array($rules)) {
return null;
}
return $rules;
} | php | public function getNormalizedValidationRules()
{
$rules = json_decode($this->get('validation'), true);
if ( ! is_string($rules) && ! is_array($rules)) {
return null;
}
return $rules;
} | [
"public",
"function",
"getNormalizedValidationRules",
"(",
")",
"{",
"$",
"rules",
"=",
"json_decode",
"(",
"$",
"this",
"->",
"get",
"(",
"'validation'",
")",
",",
"true",
")",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"rules",
")",
"&&",
"!",
"is_a... | Returns validation rules as string or array.
Anything else will return null.
@return string|array|null | [
"Returns",
"validation",
"rules",
"as",
"string",
"or",
"array",
".",
"Anything",
"else",
"will",
"return",
"null",
"."
] | 3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3 | https://github.com/czim/laravel-cms-upload-module/blob/3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3/src/Http/Requests/UploadFileRequest.php#L23-L32 |
228,818 | pear/Net_LDAP2 | doc/examples/schema_cache.php | MySessionSchemaCache.loadSchema | public function loadSchema() {
// Lets see if we have a session, otherwise we cant use this cache
// and drop some error that will be returned by Net_LDAP2->schema().
// Minor errors should be indicated by returning false, so Net_LDAP2
// can continue its work. This will result in the sa... | php | public function loadSchema() {
// Lets see if we have a session, otherwise we cant use this cache
// and drop some error that will be returned by Net_LDAP2->schema().
// Minor errors should be indicated by returning false, so Net_LDAP2
// can continue its work. This will result in the sa... | [
"public",
"function",
"loadSchema",
"(",
")",
"{",
"// Lets see if we have a session, otherwise we cant use this cache",
"// and drop some error that will be returned by Net_LDAP2->schema().",
"// Minor errors should be indicated by returning false, so Net_LDAP2",
"// can continue its work. This w... | Load schema from session
For the sake of simplicity we dont implement a cache aging here.
This is not a big problem, since php sessions shouldnt last endlessly.
@return Net_LDAP2_Schema|Net_LDAP2_Error|false | [
"Load",
"schema",
"from",
"session"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/doc/examples/schema_cache.php#L108-L129 |
228,819 | sop/crypto-types | lib/CryptoTypes/AlgorithmIdentifier/AlgorithmIdentifierFactory.php | AlgorithmIdentifierFactory.getClass | public function getClass(string $oid)
{
// if OID is provided by this factory
if (array_key_exists($oid, self::MAP_OID_TO_CLASS)) {
return self::MAP_OID_TO_CLASS[$oid];
}
// try additional providers
foreach ($this->_additionalProviders as $provider) {
... | php | public function getClass(string $oid)
{
// if OID is provided by this factory
if (array_key_exists($oid, self::MAP_OID_TO_CLASS)) {
return self::MAP_OID_TO_CLASS[$oid];
}
// try additional providers
foreach ($this->_additionalProviders as $provider) {
... | [
"public",
"function",
"getClass",
"(",
"string",
"$",
"oid",
")",
"{",
"// if OID is provided by this factory",
"if",
"(",
"array_key_exists",
"(",
"$",
"oid",
",",
"self",
"::",
"MAP_OID_TO_CLASS",
")",
")",
"{",
"return",
"self",
"::",
"MAP_OID_TO_CLASS",
"[",... | Get the name of a class that implements algorithm identifier for given
OID.
@param string $oid Object identifier in dotted format
@return string|null Fully qualified class name or null if not supported | [
"Get",
"the",
"name",
"of",
"a",
"class",
"that",
"implements",
"algorithm",
"identifier",
"for",
"given",
"OID",
"."
] | 1d36250a110b07300aeb003a20aeaadfc6445501 | https://github.com/sop/crypto-types/blob/1d36250a110b07300aeb003a20aeaadfc6445501/lib/CryptoTypes/AlgorithmIdentifier/AlgorithmIdentifierFactory.php#L85-L98 |
228,820 | sop/crypto-types | lib/CryptoTypes/AlgorithmIdentifier/AlgorithmIdentifierFactory.php | AlgorithmIdentifierFactory.parse | public function parse(Sequence $seq): AlgorithmIdentifier
{
$oid = $seq->at(0)
->asObjectIdentifier()
->oid();
$params = $seq->has(1) ? $seq->at(1) : null;
/** @var SpecificAlgorithmIdentifier $cls */
$cls = $this->getClass($oid);
if ($cls) {
... | php | public function parse(Sequence $seq): AlgorithmIdentifier
{
$oid = $seq->at(0)
->asObjectIdentifier()
->oid();
$params = $seq->has(1) ? $seq->at(1) : null;
/** @var SpecificAlgorithmIdentifier $cls */
$cls = $this->getClass($oid);
if ($cls) {
... | [
"public",
"function",
"parse",
"(",
"Sequence",
"$",
"seq",
")",
":",
"AlgorithmIdentifier",
"{",
"$",
"oid",
"=",
"$",
"seq",
"->",
"at",
"(",
"0",
")",
"->",
"asObjectIdentifier",
"(",
")",
"->",
"oid",
"(",
")",
";",
"$",
"params",
"=",
"$",
"se... | Parse AlgorithmIdentifier from an ASN.1 sequence.
@param Sequence $seq
@return AlgorithmIdentifier | [
"Parse",
"AlgorithmIdentifier",
"from",
"an",
"ASN",
".",
"1",
"sequence",
"."
] | 1d36250a110b07300aeb003a20aeaadfc6445501 | https://github.com/sop/crypto-types/blob/1d36250a110b07300aeb003a20aeaadfc6445501/lib/CryptoTypes/AlgorithmIdentifier/AlgorithmIdentifierFactory.php#L106-L119 |
228,821 | pear/Net_LDAP2 | Net/LDAP2/RootDSE.php | Net_LDAP2_RootDSE.fetch | public static function fetch($ldap, $attrs = null)
{
if (!$ldap instanceof Net_LDAP2) {
return PEAR::raiseError("Unable to fetch Schema: Parameter \$ldap must be a Net_LDAP2 object!");
}
if (is_array($attrs) && count($attrs) > 0 ) {
$attributes = $attrs;
} el... | php | public static function fetch($ldap, $attrs = null)
{
if (!$ldap instanceof Net_LDAP2) {
return PEAR::raiseError("Unable to fetch Schema: Parameter \$ldap must be a Net_LDAP2 object!");
}
if (is_array($attrs) && count($attrs) > 0 ) {
$attributes = $attrs;
} el... | [
"public",
"static",
"function",
"fetch",
"(",
"$",
"ldap",
",",
"$",
"attrs",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"ldap",
"instanceof",
"Net_LDAP2",
")",
"{",
"return",
"PEAR",
"::",
"raiseError",
"(",
"\"Unable to fetch Schema: Parameter \\$ldap must ... | Fetches a RootDSE object from an LDAP connection
@param Net_LDAP2 $ldap Directory from which the RootDSE should be fetched
@param array $attrs Array of attributes to search for
@access static
@return Net_LDAP2_RootDSE|Net_LDAP2_Error | [
"Fetches",
"a",
"RootDSE",
"object",
"from",
"an",
"LDAP",
"connection"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/RootDSE.php#L58-L87 |
228,822 | pear/Net_LDAP2 | Net/LDAP2/RootDSE.php | Net_LDAP2_RootDSE.checkAttr | protected function checkAttr($values, $attr)
{
if (!is_array($values)) $values = array($values);
foreach ($values as $value) {
if (!@in_array($value, $this->get_value($attr, 'all'))) {
return false;
}
}
return true;
} | php | protected function checkAttr($values, $attr)
{
if (!is_array($values)) $values = array($values);
foreach ($values as $value) {
if (!@in_array($value, $this->get_value($attr, 'all'))) {
return false;
}
}
return true;
} | [
"protected",
"function",
"checkAttr",
"(",
"$",
"values",
",",
"$",
"attr",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"values",
")",
")",
"$",
"values",
"=",
"array",
"(",
"$",
"values",
")",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"... | Checks for existance of value in attribute
@param array $values values to check
@param string $attr attribute name
@access protected
@return boolean | [
"Checks",
"for",
"existance",
"of",
"value",
"in",
"attribute"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/RootDSE.php#L227-L237 |
228,823 | mlaphp/mlaphp | src/Mlaphp/Router.php | Router.fixPath | protected function fixPath($path)
{
$len = strlen($this->front);
if (substr($path, 0, $len) == $this->front) {
$path = substr($path, $len);
}
return '/' . ltrim($path, '/');
} | php | protected function fixPath($path)
{
$len = strlen($this->front);
if (substr($path, 0, $len) == $this->front) {
$path = substr($path, $len);
}
return '/' . ltrim($path, '/');
} | [
"protected",
"function",
"fixPath",
"(",
"$",
"path",
")",
"{",
"$",
"len",
"=",
"strlen",
"(",
"$",
"this",
"->",
"front",
")",
";",
"if",
"(",
"substr",
"(",
"$",
"path",
",",
"0",
",",
"$",
"len",
")",
"==",
"$",
"this",
"->",
"front",
")",
... | Fixes the incoming URL path to strip the front controller script
name.
@param string $path The incoming URL path.
@return string The fixed path. | [
"Fixes",
"the",
"incoming",
"URL",
"path",
"to",
"strip",
"the",
"front",
"controller",
"script",
"name",
"."
] | c0c90e7217c598c82bb65e5304e8076da381c1f8 | https://github.com/mlaphp/mlaphp/blob/c0c90e7217c598c82bb65e5304e8076da381c1f8/src/Mlaphp/Router.php#L135-L144 |
228,824 | mlaphp/mlaphp | src/Mlaphp/Router.php | Router.fixFileRoute | protected function fixFileRoute($route)
{
if (! $this->pages_dir) {
throw new RuntimeException('No pages directory specified.');
}
$page = realpath($this->pages_dir . $route);
if ($this->pageExists($page)) {
return $page;
}
if ($this->isFile... | php | protected function fixFileRoute($route)
{
if (! $this->pages_dir) {
throw new RuntimeException('No pages directory specified.');
}
$page = realpath($this->pages_dir . $route);
if ($this->pageExists($page)) {
return $page;
}
if ($this->isFile... | [
"protected",
"function",
"fixFileRoute",
"(",
"$",
"route",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"pages_dir",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'No pages directory specified.'",
")",
";",
"}",
"$",
"page",
"=",
"realpath",
"(",
"$... | Fixes a file route specification by finding the real path to see if it
exists in the pages directory and is readable.
@param string $route The matched route.
@return string The real path if it exists, or the not-found route if it
does not.
@throws RuntimeException when the route is a file but no pages directory
is spe... | [
"Fixes",
"a",
"file",
"route",
"specification",
"by",
"finding",
"the",
"real",
"path",
"to",
"see",
"if",
"it",
"exists",
"in",
"the",
"pages",
"directory",
"and",
"is",
"readable",
"."
] | c0c90e7217c598c82bb65e5304e8076da381c1f8 | https://github.com/mlaphp/mlaphp/blob/c0c90e7217c598c82bb65e5304e8076da381c1f8/src/Mlaphp/Router.php#L204-L221 |
228,825 | mlaphp/mlaphp | src/Mlaphp/Router.php | Router.pageExists | protected function pageExists($file)
{
$file = str_replace(DIRECTORY_SEPARATOR, '/', $file);
return $file != ''
&& substr($file, 0, strlen($this->pages_dir)) == $this->pages_dir
&& file_exists($file)
&& is_readable($file);
} | php | protected function pageExists($file)
{
$file = str_replace(DIRECTORY_SEPARATOR, '/', $file);
return $file != ''
&& substr($file, 0, strlen($this->pages_dir)) == $this->pages_dir
&& file_exists($file)
&& is_readable($file);
} | [
"protected",
"function",
"pageExists",
"(",
"$",
"file",
")",
"{",
"$",
"file",
"=",
"str_replace",
"(",
"DIRECTORY_SEPARATOR",
",",
"'/'",
",",
"$",
"file",
")",
";",
"return",
"$",
"file",
"!=",
"''",
"&&",
"substr",
"(",
"$",
"file",
",",
"0",
","... | Does the pages directory have a matching readable file?
@param string $file The file to check.
@return bool | [
"Does",
"the",
"pages",
"directory",
"have",
"a",
"matching",
"readable",
"file?"
] | c0c90e7217c598c82bb65e5304e8076da381c1f8 | https://github.com/mlaphp/mlaphp/blob/c0c90e7217c598c82bb65e5304e8076da381c1f8/src/Mlaphp/Router.php#L229-L236 |
228,826 | sop/crypto-types | lib/CryptoTypes/Asymmetric/RSA/RSAPublicKey.php | RSAPublicKey.fromDER | public static function fromDER(string $data): RSAPublicKey
{
return self::fromASN1(UnspecifiedType::fromDER($data)->asSequence());
} | php | public static function fromDER(string $data): RSAPublicKey
{
return self::fromASN1(UnspecifiedType::fromDER($data)->asSequence());
} | [
"public",
"static",
"function",
"fromDER",
"(",
"string",
"$",
"data",
")",
":",
"RSAPublicKey",
"{",
"return",
"self",
"::",
"fromASN1",
"(",
"UnspecifiedType",
"::",
"fromDER",
"(",
"$",
"data",
")",
"->",
"asSequence",
"(",
")",
")",
";",
"}"
] | Initialize from DER data.
@param string $data
@return self | [
"Initialize",
"from",
"DER",
"data",
"."
] | 1d36250a110b07300aeb003a20aeaadfc6445501 | https://github.com/sop/crypto-types/blob/1d36250a110b07300aeb003a20aeaadfc6445501/lib/CryptoTypes/Asymmetric/RSA/RSAPublicKey.php#L73-L76 |
228,827 | pear/Net_LDAP2 | Net/LDAP2/Util.php | Net_LDAP2_Util.escape_dn_value | public static function escape_dn_value($values = array())
{
// Parameter validation
if (!is_array($values)) {
$values = array($values);
}
foreach ($values as $key => $val) {
// Escaping of filter meta characters
$val = str_replace('\\', '\\\\', $v... | php | public static function escape_dn_value($values = array())
{
// Parameter validation
if (!is_array($values)) {
$values = array($values);
}
foreach ($values as $key => $val) {
// Escaping of filter meta characters
$val = str_replace('\\', '\\\\', $v... | [
"public",
"static",
"function",
"escape_dn_value",
"(",
"$",
"values",
"=",
"array",
"(",
")",
")",
"{",
"// Parameter validation",
"if",
"(",
"!",
"is_array",
"(",
"$",
"values",
")",
")",
"{",
"$",
"values",
"=",
"array",
"(",
"$",
"values",
")",
";"... | Escapes a DN value according to RFC 2253
Escapes the given VALUES according to RFC 2253 so that they can be safely used in LDAP DNs.
The characters ",", "+", """, "\", "<", ">", ";", "#", "=" with a special meaning in RFC 2252
are preceeded by ba backslash. Control characters with an ASCII code < 32 are represented as... | [
"Escapes",
"a",
"DN",
"value",
"according",
"to",
"RFC",
"2253"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Util.php#L202-L241 |
228,828 | pear/Net_LDAP2 | Net/LDAP2/Util.php | Net_LDAP2_Util.escape_filter_value | public static function escape_filter_value($values = array())
{
// Parameter validation
if (!is_array($values)) {
$values = array($values);
}
foreach ($values as $key => $val) {
// Escaping of filter meta characters
$val = str_replace('\\', '\5c',... | php | public static function escape_filter_value($values = array())
{
// Parameter validation
if (!is_array($values)) {
$values = array($values);
}
foreach ($values as $key => $val) {
// Escaping of filter meta characters
$val = str_replace('\\', '\5c',... | [
"public",
"static",
"function",
"escape_filter_value",
"(",
"$",
"values",
"=",
"array",
"(",
")",
")",
"{",
"// Parameter validation",
"if",
"(",
"!",
"is_array",
"(",
"$",
"values",
")",
")",
"{",
"$",
"values",
"=",
"array",
"(",
"$",
"values",
")",
... | Escapes the given VALUES according to RFC 2254 so that they can be safely used in LDAP filters.
Any control characters with an ACII code < 32 as well as the characters with special meaning in
LDAP filters "*", "(", ")", and "\" (the backslash) are converted into the representation of a
backslash followed by two hex di... | [
"Escapes",
"the",
"given",
"VALUES",
"according",
"to",
"RFC",
"2254",
"so",
"that",
"they",
"can",
"be",
"safely",
"used",
"in",
"LDAP",
"filters",
"."
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Util.php#L435-L458 |
228,829 | pear/Net_LDAP2 | Net/LDAP2/Util.php | Net_LDAP2_Util.asc2hex32 | public static function asc2hex32($string)
{
for ($i = 0; $i < strlen($string); $i++) {
$char = substr($string, $i, 1);
if (ord($char) < 32) {
$hex = dechex(ord($char));
if (strlen($hex) == 1) $hex = '0'.$hex;
$string = str_replace($char... | php | public static function asc2hex32($string)
{
for ($i = 0; $i < strlen($string); $i++) {
$char = substr($string, $i, 1);
if (ord($char) < 32) {
$hex = dechex(ord($char));
if (strlen($hex) == 1) $hex = '0'.$hex;
$string = str_replace($char... | [
"public",
"static",
"function",
"asc2hex32",
"(",
"$",
"string",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"strlen",
"(",
"$",
"string",
")",
";",
"$",
"i",
"++",
")",
"{",
"$",
"char",
"=",
"substr",
"(",
"$",
"string",
"... | Converts all ASCII chars < 32 to "\HEX"
@param string $string String to convert
@static
@return string | [
"Converts",
"all",
"ASCII",
"chars",
"<",
"32",
"to",
"\\",
"HEX"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Util.php#L493-L504 |
228,830 | pear/Net_LDAP2 | Net/LDAP2/Util.php | Net_LDAP2_Util.split_rdn_multival | public static function split_rdn_multival($rdn)
{
$rdns = preg_split('/(?<!\\\\)\+/', $rdn);
$rdns = self::correct_dn_splitting($rdns, '+');
return array_values($rdns);
} | php | public static function split_rdn_multival($rdn)
{
$rdns = preg_split('/(?<!\\\\)\+/', $rdn);
$rdns = self::correct_dn_splitting($rdns, '+');
return array_values($rdns);
} | [
"public",
"static",
"function",
"split_rdn_multival",
"(",
"$",
"rdn",
")",
"{",
"$",
"rdns",
"=",
"preg_split",
"(",
"'/(?<!\\\\\\\\)\\+/'",
",",
"$",
"rdn",
")",
";",
"$",
"rdns",
"=",
"self",
"::",
"correct_dn_splitting",
"(",
"$",
"rdns",
",",
"'+'",
... | Split an multivalued RDN value into an Array
A RDN can contain multiple values, spearated by a plus sign.
This function returns each separate ocl=value pair of the RDN part.
If no multivalued RDN is detected, an array containing only
the original rdn part is returned.
For example, the multivalued RDN 'OU=Sales+CN=J.... | [
"Split",
"an",
"multivalued",
"RDN",
"value",
"into",
"an",
"Array"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Util.php#L556-L561 |
228,831 | pear/Net_LDAP2 | Net/LDAP2/Util.php | Net_LDAP2_Util.split_attribute_string | public static function split_attribute_string($attr, $extended=false, $withDelim=false)
{
if ($withDelim) $withDelim = PREG_SPLIT_DELIM_CAPTURE;
if (!$extended) {
return preg_split('/(?<!\\\\)(=)/', $attr, 2, $withDelim);
} else {
return preg_split('/(?<!\\\\)(>=|<=|>|<|~=|... | php | public static function split_attribute_string($attr, $extended=false, $withDelim=false)
{
if ($withDelim) $withDelim = PREG_SPLIT_DELIM_CAPTURE;
if (!$extended) {
return preg_split('/(?<!\\\\)(=)/', $attr, 2, $withDelim);
} else {
return preg_split('/(?<!\\\\)(>=|<=|>|<|~=|... | [
"public",
"static",
"function",
"split_attribute_string",
"(",
"$",
"attr",
",",
"$",
"extended",
"=",
"false",
",",
"$",
"withDelim",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"withDelim",
")",
"$",
"withDelim",
"=",
"PREG_SPLIT_DELIM_CAPTURE",
";",
"if",
"... | Splits an attribute=value syntax into an array
If escaped delimeters are used, they are returned escaped as well.
The split will occur at the first unescaped delimeter character.
In case an invalid delimeter is given, no split will be performed and an
one element array gets returned.
Optional also filter-assertion del... | [
"Splits",
"an",
"attribute",
"=",
"value",
"syntax",
"into",
"an",
"array"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Util.php#L578-L587 |
228,832 | pear/Net_LDAP2 | Net/LDAP2/Util.php | Net_LDAP2_Util.correct_dn_splitting | protected static function correct_dn_splitting($dn = array(), $separator = ',')
{
foreach ($dn as $key => $dn_value) {
$dn_value = $dn[$key]; // refresh value (foreach caches!)
// if the dn_value is not in attr=value format, then we had an
// unescaped separator character... | php | protected static function correct_dn_splitting($dn = array(), $separator = ',')
{
foreach ($dn as $key => $dn_value) {
$dn_value = $dn[$key]; // refresh value (foreach caches!)
// if the dn_value is not in attr=value format, then we had an
// unescaped separator character... | [
"protected",
"static",
"function",
"correct_dn_splitting",
"(",
"$",
"dn",
"=",
"array",
"(",
")",
",",
"$",
"separator",
"=",
"','",
")",
"{",
"foreach",
"(",
"$",
"dn",
"as",
"$",
"key",
"=>",
"$",
"dn_value",
")",
"{",
"$",
"dn_value",
"=",
"$",
... | Corrects splitting of dn parts
@param array $dn Raw DN array
@param array $separator Separator that was used when splitting
@return array Corrected array
@access protected | [
"Corrects",
"splitting",
"of",
"dn",
"parts"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Util.php#L598-L617 |
228,833 | coolcsn/CsnCms | src/CsnCms/Controller/CategoryController.php | CategoryController.editAction | public function editAction()
{
$id = $this->params()->fromRoute('id');
if (!$id) {
return $this->redirect()->toRoute('csn-cms/default', array('controller' => 'category', 'action' => 'index'));
}
$entityManager = $this->getServiceLocator()->get('doctrine.entitymanager.orm... | php | public function editAction()
{
$id = $this->params()->fromRoute('id');
if (!$id) {
return $this->redirect()->toRoute('csn-cms/default', array('controller' => 'category', 'action' => 'index'));
}
$entityManager = $this->getServiceLocator()->get('doctrine.entitymanager.orm... | [
"public",
"function",
"editAction",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fromRoute",
"(",
"'id'",
")",
";",
"if",
"(",
"!",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"redirect",
"(",
")",
"->",
"t... | U - update | [
"U",
"-",
"update"
] | fd2b163e292836b9f672400694a86f75225b725a | https://github.com/coolcsn/CsnCms/blob/fd2b163e292836b9f672400694a86f75225b725a/src/CsnCms/Controller/CategoryController.php#L61-L104 |
228,834 | JustBlackBird/codeception-config-module | src/Config.php | Config.grabFromConfig | public function grabFromConfig($parameter)
{
if (!isset($this->config[$parameter])) {
throw new ModuleConfigException(get_class($this), sprintf(
'Parameter "%s" is not specified in module\'s configurations.',
$parameter
));
}
return $t... | php | public function grabFromConfig($parameter)
{
if (!isset($this->config[$parameter])) {
throw new ModuleConfigException(get_class($this), sprintf(
'Parameter "%s" is not specified in module\'s configurations.',
$parameter
));
}
return $t... | [
"public",
"function",
"grabFromConfig",
"(",
"$",
"parameter",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"$",
"parameter",
"]",
")",
")",
"{",
"throw",
"new",
"ModuleConfigException",
"(",
"get_class",
"(",
"$",
"this",
... | Retrieves value for configuration param with the passed in name.
@param string $parameter
@return mixed
@throws ModuleConfigException If the specified parameter was not set in
the configs. | [
"Retrieves",
"value",
"for",
"configuration",
"param",
"with",
"the",
"passed",
"in",
"name",
"."
] | 97c9a68d6a2fe4d67b760449805ac1de10be59f9 | https://github.com/JustBlackBird/codeception-config-module/blob/97c9a68d6a2fe4d67b760449805ac1de10be59f9/src/Config.php#L29-L39 |
228,835 | mariano/disque-php | src/Connection/Node/Node.php | Node.connect | public function connect()
{
if ($this->connection->isConnected() && !empty($this->hello)) {
return $this->hello;
}
$this->connectToTheNode();
$this->authenticateWithPassword();
try {
$this->sayHello();
} catch (ResponseException $e) {
... | php | public function connect()
{
if ($this->connection->isConnected() && !empty($this->hello)) {
return $this->hello;
}
$this->connectToTheNode();
$this->authenticateWithPassword();
try {
$this->sayHello();
} catch (ResponseException $e) {
... | [
"public",
"function",
"connect",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"connection",
"->",
"isConnected",
"(",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"hello",
")",
")",
"{",
"return",
"$",
"this",
"->",
"hello",
";",
"}",
"$",
"t... | Connect to the node and return the HELLO response
This method is idempotent and can be called multiple times
@return array The HELLO response
@throws ConnectionException
@throws AuthenticationException | [
"Connect",
"to",
"the",
"node",
"and",
"return",
"the",
"HELLO",
"response"
] | 56cf00d97e739fec861717484657dbef2888df60 | https://github.com/mariano/disque-php/blob/56cf00d97e739fec861717484657dbef2888df60/src/Connection/Node/Node.php#L231-L259 |
228,836 | mariano/disque-php | src/Connection/Node/Node.php | Node.sayHello | public function sayHello()
{
$helloCommand = new Hello();
$helloResponse = $this->connection->execute($helloCommand);
$this->hello = (array) $helloCommand->parse($helloResponse);
$this->id = $this->hello[HelloResponse::NODE_ID];
$this->createPrefix($this->id);
$this... | php | public function sayHello()
{
$helloCommand = new Hello();
$helloResponse = $this->connection->execute($helloCommand);
$this->hello = (array) $helloCommand->parse($helloResponse);
$this->id = $this->hello[HelloResponse::NODE_ID];
$this->createPrefix($this->id);
$this... | [
"public",
"function",
"sayHello",
"(",
")",
"{",
"$",
"helloCommand",
"=",
"new",
"Hello",
"(",
")",
";",
"$",
"helloResponse",
"=",
"$",
"this",
"->",
"connection",
"->",
"execute",
"(",
"$",
"helloCommand",
")",
";",
"$",
"this",
"->",
"hello",
"=",
... | Say a new HELLO to the node and parse the response
@return array The HELLO response
@throws ConnectionException | [
"Say",
"a",
"new",
"HELLO",
"to",
"the",
"node",
"and",
"parse",
"the",
"response"
] | 56cf00d97e739fec861717484657dbef2888df60 | https://github.com/mariano/disque-php/blob/56cf00d97e739fec861717484657dbef2888df60/src/Connection/Node/Node.php#L291-L303 |
228,837 | mariano/disque-php | src/Connection/Node/Node.php | Node.connectToTheNode | private function connectToTheNode()
{
$this->connection->connect(
$this->credentials->getConnectionTimeout(),
$this->credentials->getResponseTimeout()
);
} | php | private function connectToTheNode()
{
$this->connection->connect(
$this->credentials->getConnectionTimeout(),
$this->credentials->getResponseTimeout()
);
} | [
"private",
"function",
"connectToTheNode",
"(",
")",
"{",
"$",
"this",
"->",
"connection",
"->",
"connect",
"(",
"$",
"this",
"->",
"credentials",
"->",
"getConnectionTimeout",
"(",
")",
",",
"$",
"this",
"->",
"credentials",
"->",
"getResponseTimeout",
"(",
... | Connect to the node
@throws ConnectionException | [
"Connect",
"to",
"the",
"node"
] | 56cf00d97e739fec861717484657dbef2888df60 | https://github.com/mariano/disque-php/blob/56cf00d97e739fec861717484657dbef2888df60/src/Connection/Node/Node.php#L310-L316 |
228,838 | mariano/disque-php | src/Connection/Node/Node.php | Node.authenticateWithPassword | private function authenticateWithPassword()
{
if ($this->credentials->havePassword()) {
$authCommand = new Auth();
$authCommand->setArguments([$this->credentials->getPassword()]);
$authResponse = $this->connection->execute($authCommand);
$response = $authComma... | php | private function authenticateWithPassword()
{
if ($this->credentials->havePassword()) {
$authCommand = new Auth();
$authCommand->setArguments([$this->credentials->getPassword()]);
$authResponse = $this->connection->execute($authCommand);
$response = $authComma... | [
"private",
"function",
"authenticateWithPassword",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"credentials",
"->",
"havePassword",
"(",
")",
")",
"{",
"$",
"authCommand",
"=",
"new",
"Auth",
"(",
")",
";",
"$",
"authCommand",
"->",
"setArguments",
"(",
... | Authenticate with the node with a password, if set
@throws AuthenticationException | [
"Authenticate",
"with",
"the",
"node",
"with",
"a",
"password",
"if",
"set"
] | 56cf00d97e739fec861717484657dbef2888df60 | https://github.com/mariano/disque-php/blob/56cf00d97e739fec861717484657dbef2888df60/src/Connection/Node/Node.php#L323-L334 |
228,839 | mariano/disque-php | src/Connection/Node/Node.php | Node.createPrefix | private function createPrefix($id)
{
$this->prefix = substr($id, self::PREFIX_START, self::PREFIX_LENGTH);
} | php | private function createPrefix($id)
{
$this->prefix = substr($id, self::PREFIX_START, self::PREFIX_LENGTH);
} | [
"private",
"function",
"createPrefix",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"prefix",
"=",
"substr",
"(",
"$",
"id",
",",
"self",
"::",
"PREFIX_START",
",",
"self",
"::",
"PREFIX_LENGTH",
")",
";",
"}"
] | Create a node prefix from the node ID
@param string $id | [
"Create",
"a",
"node",
"prefix",
"from",
"the",
"node",
"ID"
] | 56cf00d97e739fec861717484657dbef2888df60 | https://github.com/mariano/disque-php/blob/56cf00d97e739fec861717484657dbef2888df60/src/Connection/Node/Node.php#L341-L344 |
228,840 | mariano/disque-php | src/Connection/Node/Node.php | Node.readPriorityFromHello | private function readPriorityFromHello($hello, $id)
{
foreach ($hello[HelloResponse::NODES] as $node) {
if ($node[HelloResponse::NODE_ID] === $id) {
return $node[HelloResponse::NODE_PRIORITY];
}
}
// Node not found in the HELLO? This should not happen... | php | private function readPriorityFromHello($hello, $id)
{
foreach ($hello[HelloResponse::NODES] as $node) {
if ($node[HelloResponse::NODE_ID] === $id) {
return $node[HelloResponse::NODE_PRIORITY];
}
}
// Node not found in the HELLO? This should not happen... | [
"private",
"function",
"readPriorityFromHello",
"(",
"$",
"hello",
",",
"$",
"id",
")",
"{",
"foreach",
"(",
"$",
"hello",
"[",
"HelloResponse",
"::",
"NODES",
"]",
"as",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"[",
"HelloResponse",
"::",
"NODE_... | Read out the node's own priority from a HELLO response
@param array $hello The HELLO response
@param string $id Node ID
@return int Node priority | [
"Read",
"out",
"the",
"node",
"s",
"own",
"priority",
"from",
"a",
"HELLO",
"response"
] | 56cf00d97e739fec861717484657dbef2888df60 | https://github.com/mariano/disque-php/blob/56cf00d97e739fec861717484657dbef2888df60/src/Connection/Node/Node.php#L354-L365 |
228,841 | czim/laravel-cms-upload-module | src/Support/Security/FileChecker.php | FileChecker.checkFileName | protected function checkFileName($fileName)
{
$extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
$allow = $this->getWhitelistedExtensions();
$block = $this->getBlacklistedExtensions();
return ( (false === $allow || in_array($extension, $allow))
&& ... | php | protected function checkFileName($fileName)
{
$extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
$allow = $this->getWhitelistedExtensions();
$block = $this->getBlacklistedExtensions();
return ( (false === $allow || in_array($extension, $allow))
&& ... | [
"protected",
"function",
"checkFileName",
"(",
"$",
"fileName",
")",
"{",
"$",
"extension",
"=",
"strtolower",
"(",
"pathinfo",
"(",
"$",
"fileName",
",",
"PATHINFO_EXTENSION",
")",
")",
";",
"$",
"allow",
"=",
"$",
"this",
"->",
"getWhitelistedExtensions",
... | Checks whether the file name is acceptable for upload.
@param string $fileName
@return bool | [
"Checks",
"whether",
"the",
"file",
"name",
"is",
"acceptable",
"for",
"upload",
"."
] | 3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3 | https://github.com/czim/laravel-cms-upload-module/blob/3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3/src/Support/Security/FileChecker.php#L33-L43 |
228,842 | czim/laravel-cms-upload-module | src/Support/Security/FileChecker.php | FileChecker.checkMimeType | protected function checkMimeType($mimeType)
{
$allow = $this->getWhitelistedMimeTypes();
$block = $this->getBlacklistedMimeTypes();
if (false !== $allow) {
foreach ($allow as $pattern) {
if ($this->wildCardMatch($mimeType, $pattern)) {
return ... | php | protected function checkMimeType($mimeType)
{
$allow = $this->getWhitelistedMimeTypes();
$block = $this->getBlacklistedMimeTypes();
if (false !== $allow) {
foreach ($allow as $pattern) {
if ($this->wildCardMatch($mimeType, $pattern)) {
return ... | [
"protected",
"function",
"checkMimeType",
"(",
"$",
"mimeType",
")",
"{",
"$",
"allow",
"=",
"$",
"this",
"->",
"getWhitelistedMimeTypes",
"(",
")",
";",
"$",
"block",
"=",
"$",
"this",
"->",
"getBlacklistedMimeTypes",
"(",
")",
";",
"if",
"(",
"false",
... | Checks whether the mimetype is acceptable for upload.
@param string $mimeType
@return bool | [
"Checks",
"whether",
"the",
"mimetype",
"is",
"acceptable",
"for",
"upload",
"."
] | 3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3 | https://github.com/czim/laravel-cms-upload-module/blob/3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3/src/Support/Security/FileChecker.php#L51-L75 |
228,843 | czim/laravel-cms-upload-module | src/Support/Security/FileChecker.php | FileChecker.getWhitelistedExtensions | protected function getWhitelistedExtensions()
{
$allow = config('cms-upload-module.upload.restrict.extensions.allow', null);
if ( ! is_array($allow) || ! count($allow)) {
return false;
}
return array_map('trim', array_map('strtolower', $allow));
} | php | protected function getWhitelistedExtensions()
{
$allow = config('cms-upload-module.upload.restrict.extensions.allow', null);
if ( ! is_array($allow) || ! count($allow)) {
return false;
}
return array_map('trim', array_map('strtolower', $allow));
} | [
"protected",
"function",
"getWhitelistedExtensions",
"(",
")",
"{",
"$",
"allow",
"=",
"config",
"(",
"'cms-upload-module.upload.restrict.extensions.allow'",
",",
"null",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"allow",
")",
"||",
"!",
"count",
"(",
"$... | Returns whitelisted extensions, or false if no whitelist is set.
@return bool|string[] | [
"Returns",
"whitelisted",
"extensions",
"or",
"false",
"if",
"no",
"whitelist",
"is",
"set",
"."
] | 3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3 | https://github.com/czim/laravel-cms-upload-module/blob/3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3/src/Support/Security/FileChecker.php#L82-L91 |
228,844 | czim/laravel-cms-upload-module | src/Support/Security/FileChecker.php | FileChecker.getBlacklistedExtensions | protected function getBlacklistedExtensions()
{
$block = config('cms-upload-module.upload.restrict.extensions.block', null);
if ( ! is_array($block) || ! count($block)) {
return false;
}
return array_map('trim', array_map('strtolower', $block));
} | php | protected function getBlacklistedExtensions()
{
$block = config('cms-upload-module.upload.restrict.extensions.block', null);
if ( ! is_array($block) || ! count($block)) {
return false;
}
return array_map('trim', array_map('strtolower', $block));
} | [
"protected",
"function",
"getBlacklistedExtensions",
"(",
")",
"{",
"$",
"block",
"=",
"config",
"(",
"'cms-upload-module.upload.restrict.extensions.block'",
",",
"null",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"block",
")",
"||",
"!",
"count",
"(",
"$... | Returns blacklisted extensions, or false if no whitelist is set.
@return bool|string[] | [
"Returns",
"blacklisted",
"extensions",
"or",
"false",
"if",
"no",
"whitelist",
"is",
"set",
"."
] | 3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3 | https://github.com/czim/laravel-cms-upload-module/blob/3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3/src/Support/Security/FileChecker.php#L98-L107 |
228,845 | czim/laravel-cms-upload-module | src/Support/Security/FileChecker.php | FileChecker.getWhitelistedMimeTypes | protected function getWhitelistedMimeTypes()
{
$allow = config('cms-upload-module.upload.restrict.mimetypes.allow', null);
if ( ! is_array($allow) || ! count($allow)) {
return false;
}
return array_map('trim', array_map('strtolower', $allow));
} | php | protected function getWhitelistedMimeTypes()
{
$allow = config('cms-upload-module.upload.restrict.mimetypes.allow', null);
if ( ! is_array($allow) || ! count($allow)) {
return false;
}
return array_map('trim', array_map('strtolower', $allow));
} | [
"protected",
"function",
"getWhitelistedMimeTypes",
"(",
")",
"{",
"$",
"allow",
"=",
"config",
"(",
"'cms-upload-module.upload.restrict.mimetypes.allow'",
",",
"null",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"allow",
")",
"||",
"!",
"count",
"(",
"$",... | Returns whitelisted mimetypes, or false if no whitelist is set.
@return bool|string[] | [
"Returns",
"whitelisted",
"mimetypes",
"or",
"false",
"if",
"no",
"whitelist",
"is",
"set",
"."
] | 3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3 | https://github.com/czim/laravel-cms-upload-module/blob/3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3/src/Support/Security/FileChecker.php#L114-L123 |
228,846 | czim/laravel-cms-upload-module | src/Support/Security/FileChecker.php | FileChecker.getBlacklistedMimeTypes | protected function getBlacklistedMimeTypes()
{
$block = config('cms-upload-module.upload.restrict.mimetypes.block', null);
if ( ! is_array($block) || ! count($block)) {
return false;
}
return array_map('trim', array_map('strtolower', $block));
} | php | protected function getBlacklistedMimeTypes()
{
$block = config('cms-upload-module.upload.restrict.mimetypes.block', null);
if ( ! is_array($block) || ! count($block)) {
return false;
}
return array_map('trim', array_map('strtolower', $block));
} | [
"protected",
"function",
"getBlacklistedMimeTypes",
"(",
")",
"{",
"$",
"block",
"=",
"config",
"(",
"'cms-upload-module.upload.restrict.mimetypes.block'",
",",
"null",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"block",
")",
"||",
"!",
"count",
"(",
"$",... | Returns blacklisted mimetypes, or false if no whitelist is set.
@return bool|string[] | [
"Returns",
"blacklisted",
"mimetypes",
"or",
"false",
"if",
"no",
"whitelist",
"is",
"set",
"."
] | 3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3 | https://github.com/czim/laravel-cms-upload-module/blob/3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3/src/Support/Security/FileChecker.php#L130-L139 |
228,847 | czim/laravel-cms-upload-module | src/Support/Security/FileChecker.php | FileChecker.wildCardMatch | protected function wildCardMatch($source, $pattern)
{
$pattern = preg_quote($pattern, '#');
$pattern = str_replace('\?' , '.?', $pattern);
$pattern = str_replace('\*' , '.*?', $pattern);
return (bool) preg_match('#^' . $pattern . '$#i' , $source);
} | php | protected function wildCardMatch($source, $pattern)
{
$pattern = preg_quote($pattern, '#');
$pattern = str_replace('\?' , '.?', $pattern);
$pattern = str_replace('\*' , '.*?', $pattern);
return (bool) preg_match('#^' . $pattern . '$#i' , $source);
} | [
"protected",
"function",
"wildCardMatch",
"(",
"$",
"source",
",",
"$",
"pattern",
")",
"{",
"$",
"pattern",
"=",
"preg_quote",
"(",
"$",
"pattern",
",",
"'#'",
")",
";",
"$",
"pattern",
"=",
"str_replace",
"(",
"'\\?'",
",",
"'.?'",
",",
"$",
"pattern... | Returns whether a string matches against a wildcard pattern.
May use * and ? wildcards.
@param string $source
@param string $pattern
@return bool | [
"Returns",
"whether",
"a",
"string",
"matches",
"against",
"a",
"wildcard",
"pattern",
"."
] | 3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3 | https://github.com/czim/laravel-cms-upload-module/blob/3599801efcfdcf9164e8c75c3e1b2c6e7e3692c3/src/Support/Security/FileChecker.php#L150-L158 |
228,848 | dnunez24/craft-laravel-mix | helpers/Mix_PathHelper.php | Mix_PathHelper.getPublicPath | public function getPublicPath($path = '', $raiseException = false)
{
$publicDir = $this->config->get('publicDir', self::PLUGIN_HANDLE);
$publicPath = $this->ioHelper->getRealPath($publicDir.'/'.$path);
if (!$publicPath && $raiseException) {
throw new Exception("{$publicPath} doe... | php | public function getPublicPath($path = '', $raiseException = false)
{
$publicDir = $this->config->get('publicDir', self::PLUGIN_HANDLE);
$publicPath = $this->ioHelper->getRealPath($publicDir.'/'.$path);
if (!$publicPath && $raiseException) {
throw new Exception("{$publicPath} doe... | [
"public",
"function",
"getPublicPath",
"(",
"$",
"path",
"=",
"''",
",",
"$",
"raiseException",
"=",
"false",
")",
"{",
"$",
"publicDir",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'publicDir'",
",",
"self",
"::",
"PLUGIN_HANDLE",
")",
";",
"... | Get a path relative to the site public directory
@param string $path
@param bool $raiseException
@return string
@throws Exception | [
"Get",
"a",
"path",
"relative",
"to",
"the",
"site",
"public",
"directory"
] | c2f060f87be351d30e7d00123bb0ac25dd035490 | https://github.com/dnunez24/craft-laravel-mix/blob/c2f060f87be351d30e7d00123bb0ac25dd035490/helpers/Mix_PathHelper.php#L45-L55 |
228,849 | dnunez24/craft-laravel-mix | helpers/Mix_PathHelper.php | Mix_PathHelper.prefix | public function prefix(string $path, $char = '/')
{
if (!$this->startsWith($path, $char)) {
$path = "{$char}{$path}";
}
return $path;
} | php | public function prefix(string $path, $char = '/')
{
if (!$this->startsWith($path, $char)) {
$path = "{$char}{$path}";
}
return $path;
} | [
"public",
"function",
"prefix",
"(",
"string",
"$",
"path",
",",
"$",
"char",
"=",
"'/'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"startsWith",
"(",
"$",
"path",
",",
"$",
"char",
")",
")",
"{",
"$",
"path",
"=",
"\"{$char}{$path}\"",
";",
"... | Prefix character to path if not present
@param string $path
@return string | [
"Prefix",
"character",
"to",
"path",
"if",
"not",
"present"
] | c2f060f87be351d30e7d00123bb0ac25dd035490 | https://github.com/dnunez24/craft-laravel-mix/blob/c2f060f87be351d30e7d00123bb0ac25dd035490/helpers/Mix_PathHelper.php#L64-L71 |
228,850 | sop/crypto-types | lib/CryptoTypes/Asymmetric/PrivateKey.php | PrivateKey.fromPEM | public static function fromPEM(PEM $pem)
{
switch ($pem->type()) {
case PEM::TYPE_RSA_PRIVATE_KEY:
return RSA\RSAPrivateKey::fromDER($pem->data());
case PEM::TYPE_EC_PRIVATE_KEY:
return EC\ECPrivateKey::fromDER($pem->data());
case PEM::TYPE... | php | public static function fromPEM(PEM $pem)
{
switch ($pem->type()) {
case PEM::TYPE_RSA_PRIVATE_KEY:
return RSA\RSAPrivateKey::fromDER($pem->data());
case PEM::TYPE_EC_PRIVATE_KEY:
return EC\ECPrivateKey::fromDER($pem->data());
case PEM::TYPE... | [
"public",
"static",
"function",
"fromPEM",
"(",
"PEM",
"$",
"pem",
")",
"{",
"switch",
"(",
"$",
"pem",
"->",
"type",
"(",
")",
")",
"{",
"case",
"PEM",
"::",
"TYPE_RSA_PRIVATE_KEY",
":",
"return",
"RSA",
"\\",
"RSAPrivateKey",
"::",
"fromDER",
"(",
"$... | Initialize private key from PEM.
@param PEM $pem
@throws \UnexpectedValueException
@return PrivateKey | [
"Initialize",
"private",
"key",
"from",
"PEM",
"."
] | 1d36250a110b07300aeb003a20aeaadfc6445501 | https://github.com/sop/crypto-types/blob/1d36250a110b07300aeb003a20aeaadfc6445501/lib/CryptoTypes/Asymmetric/PrivateKey.php#L60-L72 |
228,851 | pinfirestudios/yii2-bugsnag | src/BugsnagErrorHandlerTrait.php | BugsnagErrorHandlerTrait.handleException | public function handleException($exception)
{
Yii::$app->bugsnag->notifyException($exception);
$this->inExceptionHandler = true;
parent::handleException($exception);
} | php | public function handleException($exception)
{
Yii::$app->bugsnag->notifyException($exception);
$this->inExceptionHandler = true;
parent::handleException($exception);
} | [
"public",
"function",
"handleException",
"(",
"$",
"exception",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"bugsnag",
"->",
"notifyException",
"(",
"$",
"exception",
")",
";",
"$",
"this",
"->",
"inExceptionHandler",
"=",
"true",
";",
"parent",
"::",
"handle... | Ensures CB logs are written to the DB if an exception occurs | [
"Ensures",
"CB",
"logs",
"are",
"written",
"to",
"the",
"DB",
"if",
"an",
"exception",
"occurs"
] | 032c061e8293e41917b12fc78b59290f3219d2e4 | https://github.com/pinfirestudios/yii2-bugsnag/blob/032c061e8293e41917b12fc78b59290f3219d2e4/src/BugsnagErrorHandlerTrait.php#L39-L45 |
228,852 | pinfirestudios/yii2-bugsnag | src/BugsnagErrorHandlerTrait.php | BugsnagErrorHandlerTrait.handleFatalError | public function handleFatalError()
{
// When running under codeception, a Yii application won't actually exist, so we just have to eat it here...
if (is_object(Yii::$app))
{
// Call into Bugsnag client's errorhandler since this will potentially kill the script below
... | php | public function handleFatalError()
{
// When running under codeception, a Yii application won't actually exist, so we just have to eat it here...
if (is_object(Yii::$app))
{
// Call into Bugsnag client's errorhandler since this will potentially kill the script below
... | [
"public",
"function",
"handleFatalError",
"(",
")",
"{",
"// When running under codeception, a Yii application won't actually exist, so we just have to eat it here...",
"if",
"(",
"is_object",
"(",
"Yii",
"::",
"$",
"app",
")",
")",
"{",
"// Call into Bugsnag client's errorhandle... | Handles fatal PHP errors | [
"Handles",
"fatal",
"PHP",
"errors"
] | 032c061e8293e41917b12fc78b59290f3219d2e4 | https://github.com/pinfirestudios/yii2-bugsnag/blob/032c061e8293e41917b12fc78b59290f3219d2e4/src/BugsnagErrorHandlerTrait.php#L50-L60 |
228,853 | micmania1/silverstripe-lumberjack | code/extensions/Lumberjack.php | Lumberjack.updateCMSFields | public function updateCMSFields(FieldList $fields) {
$excluded = $this->owner->getExcludedSiteTreeClassNames();
if(!empty($excluded)) {
$pages = SiteTree::get()->filter(array(
'ParentID' => $this->owner->ID,
'ClassName' => $excluded
));
$gridField = new GridField(
"ChildPages",
$th... | php | public function updateCMSFields(FieldList $fields) {
$excluded = $this->owner->getExcludedSiteTreeClassNames();
if(!empty($excluded)) {
$pages = SiteTree::get()->filter(array(
'ParentID' => $this->owner->ID,
'ClassName' => $excluded
));
$gridField = new GridField(
"ChildPages",
$th... | [
"public",
"function",
"updateCMSFields",
"(",
"FieldList",
"$",
"fields",
")",
"{",
"$",
"excluded",
"=",
"$",
"this",
"->",
"owner",
"->",
"getExcludedSiteTreeClassNames",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"excluded",
")",
")",
"{",
"$",... | This is responsible for adding the child pages tab and gridfield.
@param FieldList $fields | [
"This",
"is",
"responsible",
"for",
"adding",
"the",
"child",
"pages",
"tab",
"and",
"gridfield",
"."
] | 5582ea0a799041c21df4ed10d0d05e13e7553fea | https://github.com/micmania1/silverstripe-lumberjack/blob/5582ea0a799041c21df4ed10d0d05e13e7553fea/code/extensions/Lumberjack.php#L37-L54 |
228,854 | contao-bootstrap/templates | src/EventListener/TemplateMappingListener.php | TemplateMappingListener.onParseTemplate | public function onParseTemplate(Template $template): void
{
if (!$this->environment->isEnabled()) {
return;
}
$this->initialize();
if ($this->isAutoMappingDisabled($template->getName())) {
return;
}
$templateName = $this->getMappedTemplateNam... | php | public function onParseTemplate(Template $template): void
{
if (!$this->environment->isEnabled()) {
return;
}
$this->initialize();
if ($this->isAutoMappingDisabled($template->getName())) {
return;
}
$templateName = $this->getMappedTemplateNam... | [
"public",
"function",
"onParseTemplate",
"(",
"Template",
"$",
"template",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"environment",
"->",
"isEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"initialize",
"(",
")",
... | Handle the on parse template hook.
@param Template $template The template being parsed.
@return void | [
"Handle",
"the",
"on",
"parse",
"template",
"hook",
"."
] | cf507af3a194895923c6b84d97aa224e8b5b6d2f | https://github.com/contao-bootstrap/templates/blob/cf507af3a194895923c6b84d97aa224e8b5b6d2f/src/EventListener/TemplateMappingListener.php#L57-L72 |
228,855 | contao-bootstrap/templates | src/EventListener/TemplateMappingListener.php | TemplateMappingListener.initialize | private function initialize(): void
{
if ($this->mapping === null) {
$this->mapping = $this->environment->getConfig()->get('templates.mapping', []);
}
} | php | private function initialize(): void
{
if ($this->mapping === null) {
$this->mapping = $this->environment->getConfig()->get('templates.mapping', []);
}
} | [
"private",
"function",
"initialize",
"(",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"mapping",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"mapping",
"=",
"$",
"this",
"->",
"environment",
"->",
"getConfig",
"(",
")",
"->",
"get",
"(",
"... | Initialize the mapping configuration.
@return void | [
"Initialize",
"the",
"mapping",
"configuration",
"."
] | cf507af3a194895923c6b84d97aa224e8b5b6d2f | https://github.com/contao-bootstrap/templates/blob/cf507af3a194895923c6b84d97aa224e8b5b6d2f/src/EventListener/TemplateMappingListener.php#L79-L84 |
228,856 | contao-bootstrap/templates | src/EventListener/TemplateMappingListener.php | TemplateMappingListener.getMappedTemplateName | private function getMappedTemplateName(string $templateName): ?string
{
if (isset($this->mapping['mandatory'][$templateName])) {
return $this->mapping['mandatory'][$templateName];
}
if (isset($this->mapping['optional'][$templateName])) {
return $this->mapping['option... | php | private function getMappedTemplateName(string $templateName): ?string
{
if (isset($this->mapping['mandatory'][$templateName])) {
return $this->mapping['mandatory'][$templateName];
}
if (isset($this->mapping['optional'][$templateName])) {
return $this->mapping['option... | [
"private",
"function",
"getMappedTemplateName",
"(",
"string",
"$",
"templateName",
")",
":",
"?",
"string",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"mapping",
"[",
"'mandatory'",
"]",
"[",
"$",
"templateName",
"]",
")",
")",
"{",
"return",
"$",... | Get the mapped template name. Returns null if not mapped.
@param string $templateName The default template name.
@return null|string | [
"Get",
"the",
"mapped",
"template",
"name",
".",
"Returns",
"null",
"if",
"not",
"mapped",
"."
] | cf507af3a194895923c6b84d97aa224e8b5b6d2f | https://github.com/contao-bootstrap/templates/blob/cf507af3a194895923c6b84d97aa224e8b5b6d2f/src/EventListener/TemplateMappingListener.php#L93-L104 |
228,857 | contao-bootstrap/templates | src/EventListener/TemplateMappingListener.php | TemplateMappingListener.isAutoMappingDisabled | private function isAutoMappingDisabled(string $templateName): bool
{
if (isset($this->mapping['mandatory'][$templateName])) {
return false;
}
return !$this->environment->getConfig()->get('templates.auto_mapping', true);
} | php | private function isAutoMappingDisabled(string $templateName): bool
{
if (isset($this->mapping['mandatory'][$templateName])) {
return false;
}
return !$this->environment->getConfig()->get('templates.auto_mapping', true);
} | [
"private",
"function",
"isAutoMappingDisabled",
"(",
"string",
"$",
"templateName",
")",
":",
"bool",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"mapping",
"[",
"'mandatory'",
"]",
"[",
"$",
"templateName",
"]",
")",
")",
"{",
"return",
"false",
";... | Check if template auto mapping is disabled.
@param string $templateName The template name.
@return bool | [
"Check",
"if",
"template",
"auto",
"mapping",
"is",
"disabled",
"."
] | cf507af3a194895923c6b84d97aa224e8b5b6d2f | https://github.com/contao-bootstrap/templates/blob/cf507af3a194895923c6b84d97aa224e8b5b6d2f/src/EventListener/TemplateMappingListener.php#L113-L120 |
228,858 | pear/Net_LDAP2 | Net/LDAP2/Entry.php | Net_LDAP2_Entry.createFresh | public static function createFresh($dn, $attrs = array())
{
if (!is_array($attrs)) {
return PEAR::raiseError("Unable to create fresh entry: Parameter \$attrs needs to be an array!");
}
$entry = new Net_LDAP2_Entry($attrs, $dn);
return $entry;
} | php | public static function createFresh($dn, $attrs = array())
{
if (!is_array($attrs)) {
return PEAR::raiseError("Unable to create fresh entry: Parameter \$attrs needs to be an array!");
}
$entry = new Net_LDAP2_Entry($attrs, $dn);
return $entry;
} | [
"public",
"static",
"function",
"createFresh",
"(",
"$",
"dn",
",",
"$",
"attrs",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"attrs",
")",
")",
"{",
"return",
"PEAR",
"::",
"raiseError",
"(",
"\"Unable to create fresh entry: ... | Creates a fresh entry that may be added to the directory later on
Use this method, if you want to initialize a fresh entry.
The method should be called statically: $entry = Net_LDAP2_Entry::createFresh();
You should put a 'objectClass' attribute into the $attrs so the directory server
knows which object you want to c... | [
"Creates",
"a",
"fresh",
"entry",
"that",
"may",
"be",
"added",
"to",
"the",
"directory",
"later",
"on"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Entry.php#L206-L214 |
228,859 | pear/Net_LDAP2 | Net/LDAP2/Entry.php | Net_LDAP2_Entry.createConnected | public static function createConnected($ldap, $entry)
{
if (!$ldap instanceof Net_LDAP2) {
return PEAR::raiseError("Unable to create connected entry: Parameter \$ldap needs to be a Net_LDAP2 object!");
}
if (!is_resource($entry)) {
return PEAR::raiseError("Unable to c... | php | public static function createConnected($ldap, $entry)
{
if (!$ldap instanceof Net_LDAP2) {
return PEAR::raiseError("Unable to create connected entry: Parameter \$ldap needs to be a Net_LDAP2 object!");
}
if (!is_resource($entry)) {
return PEAR::raiseError("Unable to c... | [
"public",
"static",
"function",
"createConnected",
"(",
"$",
"ldap",
",",
"$",
"entry",
")",
"{",
"if",
"(",
"!",
"$",
"ldap",
"instanceof",
"Net_LDAP2",
")",
"{",
"return",
"PEAR",
"::",
"raiseError",
"(",
"\"Unable to create connected entry: Parameter \\$ldap ne... | Creates a Net_LDAP2_Entry object out of an ldap entry resource
Use this method, if you want to initialize an entry object that is
already present in some directory and that you have read manually.
Please note, that if you want to create an entry object that represents
some already existing entry, you should use {@lin... | [
"Creates",
"a",
"Net_LDAP2_Entry",
"object",
"out",
"of",
"an",
"ldap",
"entry",
"resource"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Entry.php#L233-L244 |
228,860 | pear/Net_LDAP2 | Net/LDAP2/Entry.php | Net_LDAP2_Entry.createExisting | public static function createExisting($dn, $attrs = array())
{
if (!is_array($attrs)) {
return PEAR::raiseError("Unable to create entry object: Parameter \$attrs needs to be an array!");
}
$entry = Net_LDAP2_Entry::createFresh($dn, $attrs);
if ($entry instanceof Net_LDAP... | php | public static function createExisting($dn, $attrs = array())
{
if (!is_array($attrs)) {
return PEAR::raiseError("Unable to create entry object: Parameter \$attrs needs to be an array!");
}
$entry = Net_LDAP2_Entry::createFresh($dn, $attrs);
if ($entry instanceof Net_LDAP... | [
"public",
"static",
"function",
"createExisting",
"(",
"$",
"dn",
",",
"$",
"attrs",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"attrs",
")",
")",
"{",
"return",
"PEAR",
"::",
"raiseError",
"(",
"\"Unable to create entry obje... | Creates an Net_LDAP2_Entry object that is considered already existing
Use this method, if you want to modify an already existing entry
without fetching it first.
In most cases however, it is better to fetch the entry via Net_LDAP2->getEntry()!
Please note that you should take care if you construct entries manually wi... | [
"Creates",
"an",
"Net_LDAP2_Entry",
"object",
"that",
"is",
"considered",
"already",
"existing"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Entry.php#L276-L289 |
228,861 | pear/Net_LDAP2 | Net/LDAP2/Entry.php | Net_LDAP2_Entry.dn | public function dn($dn = null)
{
if (false == is_null($dn)) {
if (is_null($this->_dn) ) {
$this->_dn = $dn;
} else {
$this->_newdn = $dn;
}
return true;
}
return (isset($this->_newdn) ? $this->_newdn : $this->cur... | php | public function dn($dn = null)
{
if (false == is_null($dn)) {
if (is_null($this->_dn) ) {
$this->_dn = $dn;
} else {
$this->_newdn = $dn;
}
return true;
}
return (isset($this->_newdn) ? $this->_newdn : $this->cur... | [
"public",
"function",
"dn",
"(",
"$",
"dn",
"=",
"null",
")",
"{",
"if",
"(",
"false",
"==",
"is_null",
"(",
"$",
"dn",
")",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_dn",
")",
")",
"{",
"$",
"this",
"->",
"_dn",
"=",
"$",
"... | Get or set the distinguished name of the entry
If called without an argument the current (or the new DN if set) DN gets returned.
If you provide an DN, this entry is moved to the new location specified if a DN existed.
If the DN was not set, the DN gets initialized. Call {@link update()} to actually create
the new Ent... | [
"Get",
"or",
"set",
"the",
"distinguished",
"name",
"of",
"the",
"entry"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Entry.php#L309-L320 |
228,862 | pear/Net_LDAP2 | Net/LDAP2/Entry.php | Net_LDAP2_Entry.setAttributes | protected function setAttributes($attributes = null)
{
/*
* fetch attributes from the server
*/
if (is_null($attributes) && is_resource($this->_entry) && is_resource($this->_link)) {
// fetch schema
if ($this->_ldap instanceof Net_LDAP2) {
$sch... | php | protected function setAttributes($attributes = null)
{
/*
* fetch attributes from the server
*/
if (is_null($attributes) && is_resource($this->_entry) && is_resource($this->_link)) {
// fetch schema
if ($this->_ldap instanceof Net_LDAP2) {
$sch... | [
"protected",
"function",
"setAttributes",
"(",
"$",
"attributes",
"=",
"null",
")",
"{",
"/*\n * fetch attributes from the server\n */",
"if",
"(",
"is_null",
"(",
"$",
"attributes",
")",
"&&",
"is_resource",
"(",
"$",
"this",
"->",
"_entry",
")",
"&... | Sets the internal attributes array
This fetches the values for the attributes from the server.
The attribute Syntax will be checked so binary attributes will be returned
as binary values.
Attributes may be passed directly via the $attributes parameter to setup this
entry manually. This overrides attribute fetching fr... | [
"Sets",
"the",
"internal",
"attributes",
"array"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Entry.php#L352-L414 |
228,863 | pear/Net_LDAP2 | Net/LDAP2/Entry.php | Net_LDAP2_Entry.getValues | public function getValues()
{
$attrs = array();
foreach ($this->_attributes as $attr => $value) {
$attrs[$attr] = $this->getValue($attr);
}
return $attrs;
} | php | public function getValues()
{
$attrs = array();
foreach ($this->_attributes as $attr => $value) {
$attrs[$attr] = $this->getValue($attr);
}
return $attrs;
} | [
"public",
"function",
"getValues",
"(",
")",
"{",
"$",
"attrs",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_attributes",
"as",
"$",
"attr",
"=>",
"$",
"value",
")",
"{",
"$",
"attrs",
"[",
"$",
"attr",
"]",
"=",
"$",
"this",... | Get the values of all attributes in a hash
The returned hash has the form
<code>array('attributename' => 'single value',
'attributename' => array('value1', value2', value3'))</code>
Only attributes present at the entry will be returned.
@access public
@return array Hash of all attributes with their values | [
"Get",
"the",
"values",
"of",
"all",
"attributes",
"in",
"a",
"hash"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Entry.php#L427-L434 |
228,864 | pear/Net_LDAP2 | Net/LDAP2/Entry.php | Net_LDAP2_Entry.getValue | public function getValue($attr, $option = null)
{
$attr = $this->getAttrName($attr);
// return depending on set $options
if (!array_key_exists($attr, $this->_attributes)) {
// attribute not set
switch ($option) {
case 'single':
$va... | php | public function getValue($attr, $option = null)
{
$attr = $this->getAttrName($attr);
// return depending on set $options
if (!array_key_exists($attr, $this->_attributes)) {
// attribute not set
switch ($option) {
case 'single':
$va... | [
"public",
"function",
"getValue",
"(",
"$",
"attr",
",",
"$",
"option",
"=",
"null",
")",
"{",
"$",
"attr",
"=",
"$",
"this",
"->",
"getAttrName",
"(",
"$",
"attr",
")",
";",
"// return depending on set $options",
"if",
"(",
"!",
"array_key_exists",
"(",
... | Get the value of a specific attribute
The first parameter is the name of the attribute
The second parameter influences the way the value is returned:
'single': only the first value is returned as string
'all': all values are returned in an array
'default': in all other cases an attribute value with a single value... | [
"Get",
"the",
"value",
"of",
"a",
"specific",
"attribute"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Entry.php#L460-L497 |
228,865 | pear/Net_LDAP2 | Net/LDAP2/Entry.php | Net_LDAP2_Entry.exists | public function exists($attr)
{
$attr = $this->getAttrName($attr);
return array_key_exists($attr, $this->_attributes);
} | php | public function exists($attr)
{
$attr = $this->getAttrName($attr);
return array_key_exists($attr, $this->_attributes);
} | [
"public",
"function",
"exists",
"(",
"$",
"attr",
")",
"{",
"$",
"attr",
"=",
"$",
"this",
"->",
"getAttrName",
"(",
"$",
"attr",
")",
";",
"return",
"array_key_exists",
"(",
"$",
"attr",
",",
"$",
"this",
"->",
"_attributes",
")",
";",
"}"
] | Returns whether an attribute exists or not
@param string $attr Attribute name
@access public
@return boolean | [
"Returns",
"whether",
"an",
"attribute",
"exists",
"or",
"not"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Entry.php#L530-L534 |
228,866 | pear/Net_LDAP2 | Net/LDAP2/Entry.php | Net_LDAP2_Entry.add | public function add($attr = array())
{
if (false == is_array($attr)) {
return PEAR::raiseError("Parameter must be an array");
}
if ($this->isNew()) {
$this->setAttributes($attr);
}
foreach ($attr as $k => $v) {
$k = $this->getAttrName($k);
... | php | public function add($attr = array())
{
if (false == is_array($attr)) {
return PEAR::raiseError("Parameter must be an array");
}
if ($this->isNew()) {
$this->setAttributes($attr);
}
foreach ($attr as $k => $v) {
$k = $this->getAttrName($k);
... | [
"public",
"function",
"add",
"(",
"$",
"attr",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"false",
"==",
"is_array",
"(",
"$",
"attr",
")",
")",
"{",
"return",
"PEAR",
"::",
"raiseError",
"(",
"\"Parameter must be an array\"",
")",
";",
"}",
"if",
... | Adds a new attribute or a new value to an existing attribute
The paramter has to be an array of the form:
array('attributename' => 'single value',
'attributename' => array('value1', 'value2))
When the attribute already exists the values will be added, else the
attribute will be created. These changes are local to the ... | [
"Adds",
"a",
"new",
"attribute",
"or",
"a",
"new",
"value",
"to",
"an",
"existing",
"attribute"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Entry.php#L556-L590 |
228,867 | pear/Net_LDAP2 | Net/LDAP2/Entry.php | Net_LDAP2_Entry.delete | public function delete($attr = null)
{
if (is_null($attr)) {
$this->_delete = true;
return true;
}
if (is_string($attr)) {
$attr = array($attr);
}
// Make the assumption that attribute names cannot be numeric,
// therefore this has ... | php | public function delete($attr = null)
{
if (is_null($attr)) {
$this->_delete = true;
return true;
}
if (is_string($attr)) {
$attr = array($attr);
}
// Make the assumption that attribute names cannot be numeric,
// therefore this has ... | [
"public",
"function",
"delete",
"(",
"$",
"attr",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"attr",
")",
")",
"{",
"$",
"this",
"->",
"_delete",
"=",
"true",
";",
"return",
"true",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"attr",
... | Deletes an whole attribute or a value or the whole entry
The parameter can be one of the following:
"attributename" - The attribute as a whole will be deleted
array("attributename1", "attributename2) - All given attributes will be
deleted
array("attributename" => "value") - The value will be deleted
array("attributen... | [
"Deletes",
"an",
"whole",
"attribute",
"or",
"a",
"value",
"or",
"the",
"whole",
"entry"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Entry.php#L617-L677 |
228,868 | pear/Net_LDAP2 | Net/LDAP2/Entry.php | Net_LDAP2_Entry.replace | public function replace($attr = array(), $force = false)
{
if (false == is_array($attr)) {
return PEAR::raiseError("Parameter must be an array");
}
foreach ($attr as $k => $v) {
$k = $this->getAttrName($k);
if (false == is_array($v)) {
// d... | php | public function replace($attr = array(), $force = false)
{
if (false == is_array($attr)) {
return PEAR::raiseError("Parameter must be an array");
}
foreach ($attr as $k => $v) {
$k = $this->getAttrName($k);
if (false == is_array($v)) {
// d... | [
"public",
"function",
"replace",
"(",
"$",
"attr",
"=",
"array",
"(",
")",
",",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"false",
"==",
"is_array",
"(",
"$",
"attr",
")",
")",
"{",
"return",
"PEAR",
"::",
"raiseError",
"(",
"\"Parameter must ... | Replaces attributes or its values
The parameter has to an array of the following form:
array("attributename" => "single value",
"attribute2name" => array("value1", "value2"),
"deleteme1" => null,
"deleteme2" => "")
If the attribute does not yet exist it will be added instead (see also $force).
If the attribue value is... | [
"Replaces",
"attributes",
"or",
"its",
"values"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Entry.php#L706-L736 |
228,869 | pear/Net_LDAP2 | Net/LDAP2/Entry.php | Net_LDAP2_Entry.getAttrName | protected function getAttrName($attr)
{
$name = strtolower($attr);
if (array_key_exists($name, $this->_map)) {
$attr = $this->_map[$name];
}
return $attr;
} | php | protected function getAttrName($attr)
{
$name = strtolower($attr);
if (array_key_exists($name, $this->_map)) {
$attr = $this->_map[$name];
}
return $attr;
} | [
"protected",
"function",
"getAttrName",
"(",
"$",
"attr",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"attr",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"_map",
")",
")",
"{",
"$",
"attr",
"=",
"$",
... | Returns the right attribute name
@param string $attr Name of attribute
@access protected
@return string The right name of the attribute | [
"Returns",
"the",
"right",
"attribute",
"name"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Entry.php#L902-L909 |
228,870 | pear/Net_LDAP2 | Net/LDAP2/Entry.php | Net_LDAP2_Entry.setLDAP | public function setLDAP($ldap)
{
if (!$ldap instanceof Net_LDAP2) {
return PEAR::raiseError("LDAP is not a valid Net_LDAP2 object");
} else {
$this->_ldap = $ldap;
return true;
}
} | php | public function setLDAP($ldap)
{
if (!$ldap instanceof Net_LDAP2) {
return PEAR::raiseError("LDAP is not a valid Net_LDAP2 object");
} else {
$this->_ldap = $ldap;
return true;
}
} | [
"public",
"function",
"setLDAP",
"(",
"$",
"ldap",
")",
"{",
"if",
"(",
"!",
"$",
"ldap",
"instanceof",
"Net_LDAP2",
")",
"{",
"return",
"PEAR",
"::",
"raiseError",
"(",
"\"LDAP is not a valid Net_LDAP2 object\"",
")",
";",
"}",
"else",
"{",
"$",
"this",
"... | Sets a reference to the LDAP-Object of this entry
After setting a Net_LDAP2 object, calling update() will use that object for
updating directory contents. Use this to dynamicly switch directorys.
@param Net_LDAP2 $ldap Net_LDAP2 object that this entry should be connected to
@access public
@return true|Net_LDAP2_Erro... | [
"Sets",
"a",
"reference",
"to",
"the",
"LDAP",
"-",
"Object",
"of",
"this",
"entry"
] | 38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8 | https://github.com/pear/Net_LDAP2/blob/38f1b22a96dfbd7ec53852f0e1e7ec1a9a5eb0e8/Net/LDAP2/Entry.php#L938-L946 |
228,871 | AOEpeople/StackFormation | src/AwsInspector/Ssh/Connection.php | Connection.closeMuxConnections | public static function closeMuxConnections()
{
$count = count(self::$multiplexedConnections);
if ($count) {
echo "Closing $count multiplexed connections...\n";
foreach (self::$multiplexedConnections as $key => $connection) {
exec("ssh -O stop -o LogLevel=QUIET... | php | public static function closeMuxConnections()
{
$count = count(self::$multiplexedConnections);
if ($count) {
echo "Closing $count multiplexed connections...\n";
foreach (self::$multiplexedConnections as $key => $connection) {
exec("ssh -O stop -o LogLevel=QUIET... | [
"public",
"static",
"function",
"closeMuxConnections",
"(",
")",
"{",
"$",
"count",
"=",
"count",
"(",
"self",
"::",
"$",
"multiplexedConnections",
")",
";",
"if",
"(",
"$",
"count",
")",
"{",
"echo",
"\"Closing $count multiplexed connections...\\n\"",
";",
"for... | Close all multiplexed connections | [
"Close",
"all",
"multiplexed",
"connections"
] | 5332dbbe54653e50d610cbaf75fb865c68aa2f1e | https://github.com/AOEpeople/StackFormation/blob/5332dbbe54653e50d610cbaf75fb865c68aa2f1e/src/AwsInspector/Ssh/Connection.php#L106-L116 |
228,872 | AOEpeople/StackFormation | src/AwsInspector/Ssh/Connection.php | Connection.exec | public function exec($command, $asUser=null)
{
$command = new Command($this, $command, $asUser);
return $command->exec();
} | php | public function exec($command, $asUser=null)
{
$command = new Command($this, $command, $asUser);
return $command->exec();
} | [
"public",
"function",
"exec",
"(",
"$",
"command",
",",
"$",
"asUser",
"=",
"null",
")",
"{",
"$",
"command",
"=",
"new",
"Command",
"(",
"$",
"this",
",",
"$",
"command",
",",
"$",
"asUser",
")",
";",
"return",
"$",
"command",
"->",
"exec",
"(",
... | Execute command on this connection
@param string $command
@param string $asUser
@return array | [
"Execute",
"command",
"on",
"this",
"connection"
] | 5332dbbe54653e50d610cbaf75fb865c68aa2f1e | https://github.com/AOEpeople/StackFormation/blob/5332dbbe54653e50d610cbaf75fb865c68aa2f1e/src/AwsInspector/Ssh/Connection.php#L125-L129 |
228,873 | chewett/php-uglifyjs | src/JSUglify.php | JSUglify.uglify | public function uglify(array $files, $outputFilename, array $options = [], $finalJsHeaderFilename=null) {
foreach($files as $filename) {
if(!is_readable($filename)) {
throw new UglifyJSException("Filename " . $filename . " is not readable");
}
}
$optionsSt... | php | public function uglify(array $files, $outputFilename, array $options = [], $finalJsHeaderFilename=null) {
foreach($files as $filename) {
if(!is_readable($filename)) {
throw new UglifyJSException("Filename " . $filename . " is not readable");
}
}
$optionsSt... | [
"public",
"function",
"uglify",
"(",
"array",
"$",
"files",
",",
"$",
"outputFilename",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"finalJsHeaderFilename",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"files",
"as",
"$",
"filename",
")",
"{"... | Calls the uglifyjs script and minifies the Javascript
@param array $files List of filenames to minimise
@param string $outputFilename Filename to output the javascript to
@param array $options Options to pass to the script
@param string|null $finalJsHeaderFilename Path to file of header to place at the top of the JS fi... | [
"Calls",
"the",
"uglifyjs",
"script",
"and",
"minifies",
"the",
"Javascript"
] | fad3be0056e96ff92def2c66bd1e413197fbfd10 | https://github.com/chewett/php-uglifyjs/blob/fad3be0056e96ff92def2c66bd1e413197fbfd10/src/JSUglify.php#L84-L125 |
228,874 | lekoala/silverstripe-form-extras | code/fields/BaseUploadField.php | BaseUploadField.createForClass | public static function createForClass(
$class,
$name,
$title = null,
\SS_List $items = null
)
{
$folderName = self::getFolderForClass($class, $name);
$inst = new static($name, $title, $items);
$inst->setFolderName($folderName . '/' . $name);
retur... | php | public static function createForClass(
$class,
$name,
$title = null,
\SS_List $items = null
)
{
$folderName = self::getFolderForClass($class, $name);
$inst = new static($name, $title, $items);
$inst->setFolderName($folderName . '/' . $name);
retur... | [
"public",
"static",
"function",
"createForClass",
"(",
"$",
"class",
",",
"$",
"name",
",",
"$",
"title",
"=",
"null",
",",
"\\",
"SS_List",
"$",
"items",
"=",
"null",
")",
"{",
"$",
"folderName",
"=",
"self",
"::",
"getFolderForClass",
"(",
"$",
"clas... | Return an instance of UploadField with the folder name already set up
@param object|string $class
@param string $name
@param string $title
@param \SS_List $items
@return \static | [
"Return",
"an",
"instance",
"of",
"UploadField",
"with",
"the",
"folder",
"name",
"already",
"set",
"up"
] | e0c1200792af8e6cea916e1999c73cf8408c6dd2 | https://github.com/lekoala/silverstripe-form-extras/blob/e0c1200792af8e6cea916e1999c73cf8408c6dd2/code/fields/BaseUploadField.php#L25-L37 |
228,875 | lekoala/silverstripe-form-extras | code/fields/BaseUploadField.php | BaseUploadField.getFolderForClass | public static function getFolderForClass($class)
{
$folderName = 'Uploads';
if (is_object($class)) {
if (method_exists($class, 'hasMethod') && $class->hasMethod('BaseFolder')) {
$folderName = $class->BaseFolder();
}
elseif ($class instanceof Page)... | php | public static function getFolderForClass($class)
{
$folderName = 'Uploads';
if (is_object($class)) {
if (method_exists($class, 'hasMethod') && $class->hasMethod('BaseFolder')) {
$folderName = $class->BaseFolder();
}
elseif ($class instanceof Page)... | [
"public",
"static",
"function",
"getFolderForClass",
"(",
"$",
"class",
")",
"{",
"$",
"folderName",
"=",
"'Uploads'",
";",
"if",
"(",
"is_object",
"(",
"$",
"class",
")",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"class",
",",
"'hasMethod'",
")",
... | Get folder for a given class
@param mixed $class
@return string | [
"Get",
"folder",
"for",
"a",
"given",
"class"
] | e0c1200792af8e6cea916e1999c73cf8408c6dd2 | https://github.com/lekoala/silverstripe-form-extras/blob/e0c1200792af8e6cea916e1999c73cf8408c6dd2/code/fields/BaseUploadField.php#L45-L96 |
228,876 | slickframework/slick | src/Slick/Form/Factory.php | Factory.newForm | public function newForm($name, array $definition)
{
$container = ContainerBuilder::buildContainer([
$name => Definition::object('Slick\Form\Form')
->constructor([$name])
]);
$this->_form = $container->get($name);
foreach ($definition as $name => $element... | php | public function newForm($name, array $definition)
{
$container = ContainerBuilder::buildContainer([
$name => Definition::object('Slick\Form\Form')
->constructor([$name])
]);
$this->_form = $container->get($name);
foreach ($definition as $name => $element... | [
"public",
"function",
"newForm",
"(",
"$",
"name",
",",
"array",
"$",
"definition",
")",
"{",
"$",
"container",
"=",
"ContainerBuilder",
"::",
"buildContainer",
"(",
"[",
"$",
"name",
"=>",
"Definition",
"::",
"object",
"(",
"'Slick\\Form\\Form'",
")",
"->",... | Creates a new form object
@param string $name
@param array $definition
@return Form | [
"Creates",
"a",
"new",
"form",
"object"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Form/Factory.php#L83-L96 |
228,877 | slickframework/slick | src/Slick/Form/Factory.php | Factory.addElement | public function addElement(FieldsetInterface &$form, $name, $data)
{
if ($data['type'] == 'fieldset') {
$fieldset = new Fieldset(['name' => $name]);
foreach ($data['elements'] as $key => $def) {
$this->addElement($fieldset, $key, $def);
}
$form... | php | public function addElement(FieldsetInterface &$form, $name, $data)
{
if ($data['type'] == 'fieldset') {
$fieldset = new Fieldset(['name' => $name]);
foreach ($data['elements'] as $key => $def) {
$this->addElement($fieldset, $key, $def);
}
$form... | [
"public",
"function",
"addElement",
"(",
"FieldsetInterface",
"&",
"$",
"form",
",",
"$",
"name",
",",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"data",
"[",
"'type'",
"]",
"==",
"'fieldset'",
")",
"{",
"$",
"fieldset",
"=",
"new",
"Fieldset",
"(",
"[",... | Adds an element to the form
@param FieldsetInterface $form
@param string $name
@param array $data
@throws Exception\UnknownElementException | [
"Adds",
"an",
"element",
"to",
"the",
"form"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Form/Factory.php#L107-L151 |
228,878 | slickframework/slick | src/Slick/Form/Factory.php | Factory.addValidation | public function addValidation(Element &$element, array $data)
{
foreach ($data as $key => $value) {
if (is_string($key)) {
$element->getInput()->getValidatorChain()->add(StaticValidator::create($key, $value));
$this->checkRequired($key, $element);
} el... | php | public function addValidation(Element &$element, array $data)
{
foreach ($data as $key => $value) {
if (is_string($key)) {
$element->getInput()->getValidatorChain()->add(StaticValidator::create($key, $value));
$this->checkRequired($key, $element);
} el... | [
"public",
"function",
"addValidation",
"(",
"Element",
"&",
"$",
"element",
",",
"array",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
... | Add validator to the provided element
@param Element $element
@param array $data | [
"Add",
"validator",
"to",
"the",
"provided",
"element"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Form/Factory.php#L159-L170 |
228,879 | slickframework/slick | src/Slick/Form/Factory.php | Factory.checkRequired | public function checkRequired($validator, Element &$element)
{
if (in_array($validator, ['notEmpty'])) {
$element->getInput()->required = true;
$element->getInput()->allowEmpty = false;
}
} | php | public function checkRequired($validator, Element &$element)
{
if (in_array($validator, ['notEmpty'])) {
$element->getInput()->required = true;
$element->getInput()->allowEmpty = false;
}
} | [
"public",
"function",
"checkRequired",
"(",
"$",
"validator",
",",
"Element",
"&",
"$",
"element",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"validator",
",",
"[",
"'notEmpty'",
"]",
")",
")",
"{",
"$",
"element",
"->",
"getInput",
"(",
")",
"->",
"... | Check required flag based on validator name
@param $validator
@param Element $element | [
"Check",
"required",
"flag",
"based",
"on",
"validator",
"name"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Form/Factory.php#L178-L184 |
228,880 | inc2734/wp-breadcrumbs | src/Controller/Single.php | Single.set_post_type_archive | protected function set_post_type_archive( $post_type_object ) {
$label = $post_type_object->label;
$this->set( $label, $this->get_post_type_archive_link( $post_type_object->name ) );
} | php | protected function set_post_type_archive( $post_type_object ) {
$label = $post_type_object->label;
$this->set( $label, $this->get_post_type_archive_link( $post_type_object->name ) );
} | [
"protected",
"function",
"set_post_type_archive",
"(",
"$",
"post_type_object",
")",
"{",
"$",
"label",
"=",
"$",
"post_type_object",
"->",
"label",
";",
"$",
"this",
"->",
"set",
"(",
"$",
"label",
",",
"$",
"this",
"->",
"get_post_type_archive_link",
"(",
... | Sets Breadcrumbs items of post type archive
@param object $post_type_object
@return void | [
"Sets",
"Breadcrumbs",
"items",
"of",
"post",
"type",
"archive"
] | fb904467f5ab3ec18c17c7420d1cbd98248367d8 | https://github.com/inc2734/wp-breadcrumbs/blob/fb904467f5ab3ec18c17c7420d1cbd98248367d8/src/Controller/Single.php#L44-L47 |
228,881 | inc2734/wp-breadcrumbs | src/Controller/Single.php | Single.set_terms | protected function set_terms( $post_type_object ) {
$taxonomies = get_object_taxonomies( $post_type_object->name );
if ( ! $taxonomies ) {
return;
}
$taxonomy = apply_filters( 'inc2734_wp_breadcrumbs_main_taxonomy', array_shift( $taxonomies ), $taxonomies, $post_type_object );
$terms = get_the_terms( g... | php | protected function set_terms( $post_type_object ) {
$taxonomies = get_object_taxonomies( $post_type_object->name );
if ( ! $taxonomies ) {
return;
}
$taxonomy = apply_filters( 'inc2734_wp_breadcrumbs_main_taxonomy', array_shift( $taxonomies ), $taxonomies, $post_type_object );
$terms = get_the_terms( g... | [
"protected",
"function",
"set_terms",
"(",
"$",
"post_type_object",
")",
"{",
"$",
"taxonomies",
"=",
"get_object_taxonomies",
"(",
"$",
"post_type_object",
"->",
"name",
")",
";",
"if",
"(",
"!",
"$",
"taxonomies",
")",
"{",
"return",
";",
"}",
"$",
"taxo... | Sets Breadcrumbs items of terms
@param object $post_type_object
@return void | [
"Sets",
"Breadcrumbs",
"items",
"of",
"terms"
] | fb904467f5ab3ec18c17c7420d1cbd98248367d8 | https://github.com/inc2734/wp-breadcrumbs/blob/fb904467f5ab3ec18c17c7420d1cbd98248367d8/src/Controller/Single.php#L55-L71 |
228,882 | inc2734/wp-breadcrumbs | src/Controller/Single.php | Single.set_categories | protected function set_categories() {
$categories = get_the_category( get_the_ID() );
if ( $categories ) {
$category = array_shift( $categories );
$this->set_ancestors( $category->term_id, 'category' );
$this->set( $category->name, get_term_link( $category ) );
}
} | php | protected function set_categories() {
$categories = get_the_category( get_the_ID() );
if ( $categories ) {
$category = array_shift( $categories );
$this->set_ancestors( $category->term_id, 'category' );
$this->set( $category->name, get_term_link( $category ) );
}
} | [
"protected",
"function",
"set_categories",
"(",
")",
"{",
"$",
"categories",
"=",
"get_the_category",
"(",
"get_the_ID",
"(",
")",
")",
";",
"if",
"(",
"$",
"categories",
")",
"{",
"$",
"category",
"=",
"array_shift",
"(",
"$",
"categories",
")",
";",
"$... | Sets Breadcrumbs items of categories
@return void | [
"Sets",
"Breadcrumbs",
"items",
"of",
"categories"
] | fb904467f5ab3ec18c17c7420d1cbd98248367d8 | https://github.com/inc2734/wp-breadcrumbs/blob/fb904467f5ab3ec18c17c7420d1cbd98248367d8/src/Controller/Single.php#L78-L85 |
228,883 | slickframework/slick | src/Slick/Utility/WeightList.php | WeightList.insert | public function insert($data, $weight = 0)
{
if ($this->isEmpty()) {
$this->_nodes[] = ['data' => $data, 'weight' => $weight];
return $this;
}
$inserted = false;
$new = [];
while(count($this->_nodes) > 0) {
$element = array_shift($this->_n... | php | public function insert($data, $weight = 0)
{
if ($this->isEmpty()) {
$this->_nodes[] = ['data' => $data, 'weight' => $weight];
return $this;
}
$inserted = false;
$new = [];
while(count($this->_nodes) > 0) {
$element = array_shift($this->_n... | [
"public",
"function",
"insert",
"(",
"$",
"data",
",",
"$",
"weight",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isEmpty",
"(",
")",
")",
"{",
"$",
"this",
"->",
"_nodes",
"[",
"]",
"=",
"[",
"'data'",
"=>",
"$",
"data",
",",
"'weight'"... | Inserts a new object in the list
@param $data
@param int $weight
@return WeightList | [
"Inserts",
"a",
"new",
"object",
"in",
"the",
"list"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Utility/WeightList.php#L47-L74 |
228,884 | slickframework/slick | src/Slick/Utility/WeightList.php | WeightList.remove | public function remove()
{
unset($this->_nodes[$this->_pointer]);
$this->_nodes = array_values($this->_nodes);
return $this;
} | php | public function remove()
{
unset($this->_nodes[$this->_pointer]);
$this->_nodes = array_values($this->_nodes);
return $this;
} | [
"public",
"function",
"remove",
"(",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"_nodes",
"[",
"$",
"this",
"->",
"_pointer",
"]",
")",
";",
"$",
"this",
"->",
"_nodes",
"=",
"array_values",
"(",
"$",
"this",
"->",
"_nodes",
")",
";",
"return",
"$"... | Removes current object from the list
@return WeightList | [
"Removes",
"current",
"object",
"from",
"the",
"list"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Utility/WeightList.php#L81-L86 |
228,885 | mjacobus/php-query-builder | lib/PO/QueryBuilder/Clauses/SetClause.php | SetClause.addSets | public function addSets(array $values = array())
{
foreach ($values as $column => $value) {
$this->addSet($column, $value);
}
return $this;
} | php | public function addSets(array $values = array())
{
foreach ($values as $column => $value) {
$this->addSet($column, $value);
}
return $this;
} | [
"public",
"function",
"addSets",
"(",
"array",
"$",
"values",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"column",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"addSet",
"(",
"$",
"column",
",",
"$",
"value",
... | Add the values to be set
@param array $values
@return PO\QueryBuilder\SetClause | [
"Add",
"the",
"values",
"to",
"be",
"set"
] | eb7a90ae3bc433659306807535b39f12ce4dfd9f | https://github.com/mjacobus/php-query-builder/blob/eb7a90ae3bc433659306807535b39f12ce4dfd9f/lib/PO/QueryBuilder/Clauses/SetClause.php#L30-L37 |
228,886 | mjacobus/php-query-builder | lib/PO/QueryBuilder/Clauses/SetClause.php | SetClause.toSql | public function toSql()
{
if ($this->isEmpty()) {
return '';
}
$params = $this->getParams();
$sql = array('SET');
$set = array();
foreach ($params as $column => $value) {
$set[] = implode(' = ', array(
$column, $this->getBuil... | php | public function toSql()
{
if ($this->isEmpty()) {
return '';
}
$params = $this->getParams();
$sql = array('SET');
$set = array();
foreach ($params as $column => $value) {
$set[] = implode(' = ', array(
$column, $this->getBuil... | [
"public",
"function",
"toSql",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"params",
"=",
"$",
"this",
"->",
"getParams",
"(",
")",
";",
"$",
"sql",
"=",
"array",
"(",
"'SET'",
")",... | The SET query part
@return string | [
"The",
"SET",
"query",
"part"
] | eb7a90ae3bc433659306807535b39f12ce4dfd9f | https://github.com/mjacobus/php-query-builder/blob/eb7a90ae3bc433659306807535b39f12ce4dfd9f/lib/PO/QueryBuilder/Clauses/SetClause.php#L58-L78 |
228,887 | gauravojha/shoppingcart-eloquent | src/ShoppingCartImpl.php | ShoppingCartImpl.addToCart | public function addToCart($productid, $price, $quantity)
{
// check if the product already exists in the cart.
// if it does, add the quantities together
$productAlreadyExists = 0;
$olderProduct = ShoppingCartItem::where('product_id', '=', $productid)->where('user_id', '=', Auth::user()->id)->first();
if($ol... | php | public function addToCart($productid, $price, $quantity)
{
// check if the product already exists in the cart.
// if it does, add the quantities together
$productAlreadyExists = 0;
$olderProduct = ShoppingCartItem::where('product_id', '=', $productid)->where('user_id', '=', Auth::user()->id)->first();
if($ol... | [
"public",
"function",
"addToCart",
"(",
"$",
"productid",
",",
"$",
"price",
",",
"$",
"quantity",
")",
"{",
"// check if the product already exists in the cart.",
"// if it does, add the quantities together",
"$",
"productAlreadyExists",
"=",
"0",
";",
"$",
"olderProduct... | Function to add items to a cart | [
"Function",
"to",
"add",
"items",
"to",
"a",
"cart"
] | 7d0f9f51e393abc36b771d2919ddf1c1cd14057f | https://github.com/gauravojha/shoppingcart-eloquent/blob/7d0f9f51e393abc36b771d2919ddf1c1cd14057f/src/ShoppingCartImpl.php#L31-L49 |
228,888 | gauravojha/shoppingcart-eloquent | src/ShoppingCartImpl.php | ShoppingCartImpl.removeFromCart | public function removeFromCart($productid)
{
ShoppingCartItem::where('product_id', '=', $productid)->where('user_id', '=', Auth::user()->id)->delete();
} | php | public function removeFromCart($productid)
{
ShoppingCartItem::where('product_id', '=', $productid)->where('user_id', '=', Auth::user()->id)->delete();
} | [
"public",
"function",
"removeFromCart",
"(",
"$",
"productid",
")",
"{",
"ShoppingCartItem",
"::",
"where",
"(",
"'product_id'",
",",
"'='",
",",
"$",
"productid",
")",
"->",
"where",
"(",
"'user_id'",
",",
"'='",
",",
"Auth",
"::",
"user",
"(",
")",
"->... | Function to delete an item from a cart | [
"Function",
"to",
"delete",
"an",
"item",
"from",
"a",
"cart"
] | 7d0f9f51e393abc36b771d2919ddf1c1cd14057f | https://github.com/gauravojha/shoppingcart-eloquent/blob/7d0f9f51e393abc36b771d2919ddf1c1cd14057f/src/ShoppingCartImpl.php#L62-L65 |
228,889 | gauravojha/shoppingcart-eloquent | src/ShoppingCartImpl.php | ShoppingCartImpl.updateItemInCart | public function updateItemInCart($productid, $quantity)
{
$olderProduct = ShoppingCartItem::where('product_id', '=', $productid)->where('user_id', '=', Auth::user()->id)->first();
if($olderProduct != null) {
$olderProduct->qty = $quantity;
$olderProduct->save();
}
} | php | public function updateItemInCart($productid, $quantity)
{
$olderProduct = ShoppingCartItem::where('product_id', '=', $productid)->where('user_id', '=', Auth::user()->id)->first();
if($olderProduct != null) {
$olderProduct->qty = $quantity;
$olderProduct->save();
}
} | [
"public",
"function",
"updateItemInCart",
"(",
"$",
"productid",
",",
"$",
"quantity",
")",
"{",
"$",
"olderProduct",
"=",
"ShoppingCartItem",
"::",
"where",
"(",
"'product_id'",
",",
"'='",
",",
"$",
"productid",
")",
"->",
"where",
"(",
"'user_id'",
",",
... | Function to update an item in the cart | [
"Function",
"to",
"update",
"an",
"item",
"in",
"the",
"cart"
] | 7d0f9f51e393abc36b771d2919ddf1c1cd14057f | https://github.com/gauravojha/shoppingcart-eloquent/blob/7d0f9f51e393abc36b771d2919ddf1c1cd14057f/src/ShoppingCartImpl.php#L78-L85 |
228,890 | gauravojha/shoppingcart-eloquent | src/ShoppingCartImpl.php | ShoppingCartImpl.totalPrice | public function totalPrice()
{
$total = 0;
$products = $this->content();
foreach ($products as $product) {
$total += ($product->qty * $product->price);
}
$total = ($total + ($total * ($this->taxRate/100)));
$total += $this->deliveryCharges;
return $total;
} | php | public function totalPrice()
{
$total = 0;
$products = $this->content();
foreach ($products as $product) {
$total += ($product->qty * $product->price);
}
$total = ($total + ($total * ($this->taxRate/100)));
$total += $this->deliveryCharges;
return $total;
} | [
"public",
"function",
"totalPrice",
"(",
")",
"{",
"$",
"total",
"=",
"0",
";",
"$",
"products",
"=",
"$",
"this",
"->",
"content",
"(",
")",
";",
"foreach",
"(",
"$",
"products",
"as",
"$",
"product",
")",
"{",
"$",
"total",
"+=",
"(",
"$",
"pro... | Function to calculate the total price of products in the cart | [
"Function",
"to",
"calculate",
"the",
"total",
"price",
"of",
"products",
"in",
"the",
"cart"
] | 7d0f9f51e393abc36b771d2919ddf1c1cd14057f | https://github.com/gauravojha/shoppingcart-eloquent/blob/7d0f9f51e393abc36b771d2919ddf1c1cd14057f/src/ShoppingCartImpl.php#L90-L100 |
228,891 | slickframework/slick | src/Slick/Mvc/Dispatcher.php | Dispatcher.dispatch | public function dispatch(RouteInfo $routeInfo)
{
$this->setRouteInfo($routeInfo);
$method = $this->_routeInfo->getAction();
$controller = $this->getController($method);
$inspector = new Inspector($controller);
$methodExists = $inspector->hasMethod($method);
if (
... | php | public function dispatch(RouteInfo $routeInfo)
{
$this->setRouteInfo($routeInfo);
$method = $this->_routeInfo->getAction();
$controller = $this->getController($method);
$inspector = new Inspector($controller);
$methodExists = $inspector->hasMethod($method);
if (
... | [
"public",
"function",
"dispatch",
"(",
"RouteInfo",
"$",
"routeInfo",
")",
"{",
"$",
"this",
"->",
"setRouteInfo",
"(",
"$",
"routeInfo",
")",
";",
"$",
"method",
"=",
"$",
"this",
"->",
"_routeInfo",
"->",
"getAction",
"(",
")",
";",
"$",
"controller",
... | Dispatches the routed request
@param RouteInfo $routeInfo
@return Response | [
"Dispatches",
"the",
"routed",
"request"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Mvc/Dispatcher.php#L71-L157 |
228,892 | slickframework/slick | src/Slick/Mvc/Dispatcher.php | Dispatcher.getController | public function getController($method)
{
if (is_null($this->_controller)) {
$className = $this->_routeInfo->getController();
if (!class_exists($className)) {
throw new Exception\ControllerNotFoundException(
"Controller '{$className}' not found"
... | php | public function getController($method)
{
if (is_null($this->_controller)) {
$className = $this->_routeInfo->getController();
if (!class_exists($className)) {
throw new Exception\ControllerNotFoundException(
"Controller '{$className}' not found"
... | [
"public",
"function",
"getController",
"(",
"$",
"method",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_controller",
")",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"_routeInfo",
"->",
"getController",
"(",
")",
";",
"if",
"(",
... | Loads the controller
@param string $method
@return Controller | [
"Loads",
"the",
"controller"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Mvc/Dispatcher.php#L165-L191 |
228,893 | slickframework/slick | src/Slick/Mvc/Dispatcher.php | Dispatcher._render | protected function _render()
{
$response = $this->_application->response;
$body = $response->getBody();
$this->_controller->set(
'flashMessages', $this->_controller->flashMessages
);
$data = $this->_controller->getViewVars();
$doLayout = $this->_controlle... | php | protected function _render()
{
$response = $this->_application->response;
$body = $response->getBody();
$this->_controller->set(
'flashMessages', $this->_controller->flashMessages
);
$data = $this->_controller->getViewVars();
$doLayout = $this->_controlle... | [
"protected",
"function",
"_render",
"(",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"_application",
"->",
"response",
";",
"$",
"body",
"=",
"$",
"response",
"->",
"getBody",
"(",
")",
";",
"$",
"this",
"->",
"_controller",
"->",
"set",
"(",
... | Render the view and layout templates with controller data
@return Response | [
"Render",
"the",
"view",
"and",
"layout",
"templates",
"with",
"controller",
"data"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Mvc/Dispatcher.php#L198-L232 |
228,894 | slickframework/slick | src/Slick/Mvc/Dispatcher.php | Dispatcher.getView | public function getView()
{
if (is_null($this->_view)) {
$controller = $this->_routeInfo->controllerName;
$name = $this->_routeInfo->action;
$ext = $this->_routeInfo->getExtension();
$template = "{$controller}/{$name}.{$ext}.twig";
if (!is_null($th... | php | public function getView()
{
if (is_null($this->_view)) {
$controller = $this->_routeInfo->controllerName;
$name = $this->_routeInfo->action;
$ext = $this->_routeInfo->getExtension();
$template = "{$controller}/{$name}.{$ext}.twig";
if (!is_null($th... | [
"public",
"function",
"getView",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_view",
")",
")",
"{",
"$",
"controller",
"=",
"$",
"this",
"->",
"_routeInfo",
"->",
"controllerName",
";",
"$",
"name",
"=",
"$",
"this",
"->",
"_routeIn... | Returns the view for current request
@return View | [
"Returns",
"the",
"view",
"for",
"current",
"request"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Mvc/Dispatcher.php#L239-L252 |
228,895 | slickframework/slick | src/Slick/Mvc/Dispatcher.php | Dispatcher.getLayout | public function getLayout()
{
if (is_null($this->_layout)) {
$default = 'layouts/default';
$ext = $this->_routeInfo->getExtension();
$file = "{$default}.{$ext}.twig";
if (!is_null($this->_controller->layout)) {
$file = "{$this->_controller->lay... | php | public function getLayout()
{
if (is_null($this->_layout)) {
$default = 'layouts/default';
$ext = $this->_routeInfo->getExtension();
$file = "{$default}.{$ext}.twig";
if (!is_null($this->_controller->layout)) {
$file = "{$this->_controller->lay... | [
"public",
"function",
"getLayout",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_layout",
")",
")",
"{",
"$",
"default",
"=",
"'layouts/default'",
";",
"$",
"ext",
"=",
"$",
"this",
"->",
"_routeInfo",
"->",
"getExtension",
"(",
")",
... | Returns the layout for current request
@return View | [
"Returns",
"the",
"layout",
"for",
"current",
"request"
] | 77f56b81020ce8c10f25f7d918661ccd9a918a37 | https://github.com/slickframework/slick/blob/77f56b81020ce8c10f25f7d918661ccd9a918a37/src/Slick/Mvc/Dispatcher.php#L260-L272 |
228,896 | AOEpeople/StackFormation | src/StackFormation/Command/Stack/TreeCommand.php | TreeCommand.prepareTree | protected function prepareTree(array $arr) {
$tree = [];
foreach ($arr as $a) {
$name = $a->getName();
$cur = &$tree;
foreach (explode("-", $name) as $e) {
if (empty($cur[$e])) $cur[$e] = [];
$cur = &$cur[$e];
}
}
... | php | protected function prepareTree(array $arr) {
$tree = [];
foreach ($arr as $a) {
$name = $a->getName();
$cur = &$tree;
foreach (explode("-", $name) as $e) {
if (empty($cur[$e])) $cur[$e] = [];
$cur = &$cur[$e];
}
}
... | [
"protected",
"function",
"prepareTree",
"(",
"array",
"$",
"arr",
")",
"{",
"$",
"tree",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"a",
")",
"{",
"$",
"name",
"=",
"$",
"a",
"->",
"getName",
"(",
")",
";",
"$",
"cur",
"=",
"&... | prepare stack list
@param StackFormation\Stack[]
@return array | [
"prepare",
"stack",
"list"
] | 5332dbbe54653e50d610cbaf75fb865c68aa2f1e | https://github.com/AOEpeople/StackFormation/blob/5332dbbe54653e50d610cbaf75fb865c68aa2f1e/src/StackFormation/Command/Stack/TreeCommand.php#L51-L62 |
228,897 | AOEpeople/StackFormation | src/StackFormation/Command/Stack/TreeCommand.php | TreeCommand.flatternTree | protected function flatternTree(array $treeIn)
{
$treeOut = [];
foreach ($treeIn as $name => $children) {
if (count($children) === 0) {
$treeOut[$name] = [];
} elseif (count($children) === 1) {
$name = sprintf('%s-%s', $name, key($children));
... | php | protected function flatternTree(array $treeIn)
{
$treeOut = [];
foreach ($treeIn as $name => $children) {
if (count($children) === 0) {
$treeOut[$name] = [];
} elseif (count($children) === 1) {
$name = sprintf('%s-%s', $name, key($children));
... | [
"protected",
"function",
"flatternTree",
"(",
"array",
"$",
"treeIn",
")",
"{",
"$",
"treeOut",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"treeIn",
"as",
"$",
"name",
"=>",
"$",
"children",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"children",
")",
"=... | flattern tree to gain a better overview
@param array $treeIn
@return array | [
"flattern",
"tree",
"to",
"gain",
"a",
"better",
"overview"
] | 5332dbbe54653e50d610cbaf75fb865c68aa2f1e | https://github.com/AOEpeople/StackFormation/blob/5332dbbe54653e50d610cbaf75fb865c68aa2f1e/src/StackFormation/Command/Stack/TreeCommand.php#L70-L89 |
228,898 | Ardakilic/laravel-mutlucell-sms | src/Ardakilic/Mutlucell/Mutlucell.php | Mutlucell.setConfig | public function setConfig(array $config)
{
$this->config = $config;
$this->senderID = $this->config['default_sender'];
// The user may have called setConfig() manually,
// and the array may have missing arguments.
// So, we're checking whether they are set, and filling them ... | php | public function setConfig(array $config)
{
$this->config = $config;
$this->senderID = $this->config['default_sender'];
// The user may have called setConfig() manually,
// and the array may have missing arguments.
// So, we're checking whether they are set, and filling them ... | [
"public",
"function",
"setConfig",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"$",
"config",
";",
"$",
"this",
"->",
"senderID",
"=",
"$",
"this",
"->",
"config",
"[",
"'default_sender'",
"]",
";",
"// The user may have called... | This method allows user to change configuration on-the-fly
@param array $config
@throws \Exception if auth parameter or originator is not set
@return $this | [
"This",
"method",
"allows",
"user",
"to",
"change",
"configuration",
"on",
"-",
"the",
"-",
"fly"
] | a6b5208b6cffe7c33b1fe9fb670e8e16a86b4b11 | https://github.com/Ardakilic/laravel-mutlucell-sms/blob/a6b5208b6cffe7c33b1fe9fb670e8e16a86b4b11/src/Ardakilic/Mutlucell/Mutlucell.php#L41-L70 |
228,899 | Ardakilic/laravel-mutlucell-sms | src/Ardakilic/Mutlucell/Mutlucell.php | Mutlucell.sendBulk | public function sendBulk($recipents, $message = '', $date = '', $senderID = '')
{
//Checks the $message and $senderID, and initializes it
$this->preChecks($message, $senderID);
//Sending for future date
$dateStr = '';
if (strlen($date)) {
$dateStr = ' tarih="' .... | php | public function sendBulk($recipents, $message = '', $date = '', $senderID = '')
{
//Checks the $message and $senderID, and initializes it
$this->preChecks($message, $senderID);
//Sending for future date
$dateStr = '';
if (strlen($date)) {
$dateStr = ' tarih="' .... | [
"public",
"function",
"sendBulk",
"(",
"$",
"recipents",
",",
"$",
"message",
"=",
"''",
",",
"$",
"date",
"=",
"''",
",",
"$",
"senderID",
"=",
"''",
")",
"{",
"//Checks the $message and $senderID, and initializes it",
"$",
"this",
"->",
"preChecks",
"(",
"... | Send same bulk message to many people
@param $recipents array recipents
@param $message string message to be sent
@param $date string when will the message be sent?
@param $senderID string originator/sender id (may be a text or number)
@return string status API response | [
"Send",
"same",
"bulk",
"message",
"to",
"many",
"people"
] | a6b5208b6cffe7c33b1fe9fb670e8e16a86b4b11 | https://github.com/Ardakilic/laravel-mutlucell-sms/blob/a6b5208b6cffe7c33b1fe9fb670e8e16a86b4b11/src/Ardakilic/Mutlucell/Mutlucell.php#L80-L104 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.