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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
190,400 | sop/x509 | lib/X509/Certificate/Time.php | Time.fromString | public static function fromString($time, $tz = null): self
{
return new self(self::_createDateTime($time, $tz));
} | php | public static function fromString($time, $tz = null): self
{
return new self(self::_createDateTime($time, $tz));
} | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"time",
",",
"$",
"tz",
"=",
"null",
")",
":",
"self",
"{",
"return",
"new",
"self",
"(",
"self",
"::",
"_createDateTime",
"(",
"$",
"time",
",",
"$",
"tz",
")",
")",
";",
"}"
] | Initialize from date string.
@param string|null $time
@param string|null $tz
@return self | [
"Initialize",
"from",
"date",
"string",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Time.php#L67-L70 |
190,401 | sop/x509 | lib/X509/Certificate/Time.php | Time.toASN1 | public function toASN1(): TimeType
{
$dt = $this->_dt;
switch ($this->_type) {
case Element::TYPE_UTC_TIME:
return new UTCTime($dt);
case Element::TYPE_GENERALIZED_TIME:
// GeneralizedTime must not contain fractional seconds
// ... | php | public function toASN1(): TimeType
{
$dt = $this->_dt;
switch ($this->_type) {
case Element::TYPE_UTC_TIME:
return new UTCTime($dt);
case Element::TYPE_GENERALIZED_TIME:
// GeneralizedTime must not contain fractional seconds
// ... | [
"public",
"function",
"toASN1",
"(",
")",
":",
"TimeType",
"{",
"$",
"dt",
"=",
"$",
"this",
"->",
"_dt",
";",
"switch",
"(",
"$",
"this",
"->",
"_type",
")",
"{",
"case",
"Element",
"::",
"TYPE_UTC_TIME",
":",
"return",
"new",
"UTCTime",
"(",
"$",
... | Generate ASN.1.
@throws \UnexpectedValueException
@return TimeType | [
"Generate",
"ASN",
".",
"1",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Time.php#L88-L105 |
190,402 | sop/x509 | lib/X509/Certificate/Time.php | Time._determineType | protected static function _determineType(\DateTimeImmutable $dt): int
{
if ($dt->format("Y") >= 2050) {
return Element::TYPE_GENERALIZED_TIME;
}
return Element::TYPE_UTC_TIME;
} | php | protected static function _determineType(\DateTimeImmutable $dt): int
{
if ($dt->format("Y") >= 2050) {
return Element::TYPE_GENERALIZED_TIME;
}
return Element::TYPE_UTC_TIME;
} | [
"protected",
"static",
"function",
"_determineType",
"(",
"\\",
"DateTimeImmutable",
"$",
"dt",
")",
":",
"int",
"{",
"if",
"(",
"$",
"dt",
"->",
"format",
"(",
"\"Y\"",
")",
">=",
"2050",
")",
"{",
"return",
"Element",
"::",
"TYPE_GENERALIZED_TIME",
";",
... | Determine whether to use UTCTime or GeneralizedTime ASN.1 type.
@param \DateTimeImmutable $dt
@return int Type tag | [
"Determine",
"whether",
"to",
"use",
"UTCTime",
"or",
"GeneralizedTime",
"ASN",
".",
"1",
"type",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Time.php#L113-L119 |
190,403 | sop/x509 | lib/X509/Certificate/Extension/Extension.php | Extension.extensionName | public function extensionName(): string
{
if (array_key_exists($this->_oid, self::MAP_OID_TO_NAME)) {
return self::MAP_OID_TO_NAME[$this->_oid];
}
return $this->oid();
} | php | public function extensionName(): string
{
if (array_key_exists($this->_oid, self::MAP_OID_TO_NAME)) {
return self::MAP_OID_TO_NAME[$this->_oid];
}
return $this->oid();
} | [
"public",
"function",
"extensionName",
"(",
")",
":",
"string",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"this",
"->",
"_oid",
",",
"self",
"::",
"MAP_OID_TO_NAME",
")",
")",
"{",
"return",
"self",
"::",
"MAP_OID_TO_NAME",
"[",
"$",
"this",
"->",
"_... | Get short name of the extension.
@return string | [
"Get",
"short",
"name",
"of",
"the",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/Extension.php#L285-L291 |
190,404 | bitrix-expert/monolog-adapter | src/Formatter/BitrixFormatter.php | BitrixFormatter.toBitrixLevel | public static function toBitrixLevel($level)
{
$levels = static::logLevels();
if (isset($levels[$level]))
{
return $levels[$level];
}
return false;
} | php | public static function toBitrixLevel($level)
{
$levels = static::logLevels();
if (isset($levels[$level]))
{
return $levels[$level];
}
return false;
} | [
"public",
"static",
"function",
"toBitrixLevel",
"(",
"$",
"level",
")",
"{",
"$",
"levels",
"=",
"static",
"::",
"logLevels",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"levels",
"[",
"$",
"level",
"]",
")",
")",
"{",
"return",
"$",
"levels",
"[... | Converts Monolog levels to Bitrix ones if necessary.
@param int $level Level number.
@return string|bool | [
"Converts",
"Monolog",
"levels",
"to",
"Bitrix",
"ones",
"if",
"necessary",
"."
] | 112d6524f217c7d7cac29249faad0217a549ce27 | https://github.com/bitrix-expert/monolog-adapter/blob/112d6524f217c7d7cac29249faad0217a549ce27/src/Formatter/BitrixFormatter.php#L79-L89 |
190,405 | chartmogul/chartmogul-php | src/Customer.php | Customer.findByExternalId | public static function findByExternalId($externalId)
{
if (gettype($externalId) == 'string') {
$externalId = ['external_id' => $externalId];
}
$response = static::all($externalId);
if (is_null($response)) {
return null;
} else {
return $r... | php | public static function findByExternalId($externalId)
{
if (gettype($externalId) == 'string') {
$externalId = ['external_id' => $externalId];
}
$response = static::all($externalId);
if (is_null($response)) {
return null;
} else {
return $r... | [
"public",
"static",
"function",
"findByExternalId",
"(",
"$",
"externalId",
")",
"{",
"if",
"(",
"gettype",
"(",
"$",
"externalId",
")",
"==",
"'string'",
")",
"{",
"$",
"externalId",
"=",
"[",
"'external_id'",
"=>",
"$",
"externalId",
"]",
";",
"}",
"$"... | Find a Customer by External ID. Returns only first result!
@param string $externalId
@return Customer | [
"Find",
"a",
"Customer",
"by",
"External",
"ID",
".",
"Returns",
"only",
"first",
"result!"
] | 1a2bcdf8b71600aaa4fb2ce40191f289fecc018e | https://github.com/chartmogul/chartmogul-php/blob/1a2bcdf8b71600aaa4fb2ce40191f289fecc018e/src/Customer.php#L104-L117 |
190,406 | chartmogul/chartmogul-php | src/Customer.php | Customer.search | public static function search($email, ClientInterface $client = null)
{
$response = (new static([], $client))
->getClient()
->setResourceKey(static::RESOURCE_NAME)
->send('/v1/customers/search', 'GET', ['email' => $email]);
return static::fromArray($response, $c... | php | public static function search($email, ClientInterface $client = null)
{
$response = (new static([], $client))
->getClient()
->setResourceKey(static::RESOURCE_NAME)
->send('/v1/customers/search', 'GET', ['email' => $email]);
return static::fromArray($response, $c... | [
"public",
"static",
"function",
"search",
"(",
"$",
"email",
",",
"ClientInterface",
"$",
"client",
"=",
"null",
")",
"{",
"$",
"response",
"=",
"(",
"new",
"static",
"(",
"[",
"]",
",",
"$",
"client",
")",
")",
"->",
"getClient",
"(",
")",
"->",
"... | Search for Customers
@param string $email
@param ClientInterface|null $client
@return Customers | [
"Search",
"for",
"Customers"
] | 1a2bcdf8b71600aaa4fb2ce40191f289fecc018e | https://github.com/chartmogul/chartmogul-php/blob/1a2bcdf8b71600aaa4fb2ce40191f289fecc018e/src/Customer.php#L125-L134 |
190,407 | chartmogul/chartmogul-php | src/Customer.php | Customer.removeTags | public function removeTags($tags)
{
$result = $this->getClient()
->send('/v1/customers/'.$this->uuid.'/attributes/tags', 'DELETE', [
'tags' => func_get_args()
]);
$this->attributes['tags'] = $result['tags'];
return $result['tags'];
} | php | public function removeTags($tags)
{
$result = $this->getClient()
->send('/v1/customers/'.$this->uuid.'/attributes/tags', 'DELETE', [
'tags' => func_get_args()
]);
$this->attributes['tags'] = $result['tags'];
return $result['tags'];
} | [
"public",
"function",
"removeTags",
"(",
"$",
"tags",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getClient",
"(",
")",
"->",
"send",
"(",
"'/v1/customers/'",
".",
"$",
"this",
"->",
"uuid",
".",
"'/attributes/tags'",
",",
"'DELETE'",
",",
"[",
"... | Remove Tags from a Customer
@param mixed $tags,...
@return array | [
"Remove",
"Tags",
"from",
"a",
"Customer"
] | 1a2bcdf8b71600aaa4fb2ce40191f289fecc018e | https://github.com/chartmogul/chartmogul-php/blob/1a2bcdf8b71600aaa4fb2ce40191f289fecc018e/src/Customer.php#L194-L203 |
190,408 | chartmogul/chartmogul-php | src/Customer.php | Customer.addCustomAttributes | public function addCustomAttributes($custom)
{
$result = $this->getClient()
->send('/v1/customers/'.$this->uuid.'/attributes/custom', 'POST', [
'custom' => func_get_args()
]);
$this->attributes['custom'] = $result['custom'];
return $result['custom'];
... | php | public function addCustomAttributes($custom)
{
$result = $this->getClient()
->send('/v1/customers/'.$this->uuid.'/attributes/custom', 'POST', [
'custom' => func_get_args()
]);
$this->attributes['custom'] = $result['custom'];
return $result['custom'];
... | [
"public",
"function",
"addCustomAttributes",
"(",
"$",
"custom",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getClient",
"(",
")",
"->",
"send",
"(",
"'/v1/customers/'",
".",
"$",
"this",
"->",
"uuid",
".",
"'/attributes/custom'",
",",
"'POST'",
",",... | Add Custom Attributes to a Customer
@param mixed $custom,...
@return array | [
"Add",
"Custom",
"Attributes",
"to",
"a",
"Customer"
] | 1a2bcdf8b71600aaa4fb2ce40191f289fecc018e | https://github.com/chartmogul/chartmogul-php/blob/1a2bcdf8b71600aaa4fb2ce40191f289fecc018e/src/Customer.php#L210-L219 |
190,409 | chartmogul/chartmogul-php | src/Customer.php | Customer.updateCustomAttributes | public function updateCustomAttributes($custom)
{
$data = [];
foreach (func_get_args() as $value) {
$data = array_merge($data, $value);
}
$result = $this->getClient()
->send('/v1/customers/'.$this->uuid.'/attributes/custom', 'PUT', [
'custom' ... | php | public function updateCustomAttributes($custom)
{
$data = [];
foreach (func_get_args() as $value) {
$data = array_merge($data, $value);
}
$result = $this->getClient()
->send('/v1/customers/'.$this->uuid.'/attributes/custom', 'PUT', [
'custom' ... | [
"public",
"function",
"updateCustomAttributes",
"(",
"$",
"custom",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"value",
")",
"{",
"$",
"data",
"=",
"array_merge",
"(",
"$",
"data",
",",
"$",
"valu... | Update Custom Attributes of a Customer
@param mixed $custom,...
@return array | [
"Update",
"Custom",
"Attributes",
"of",
"a",
"Customer"
] | 1a2bcdf8b71600aaa4fb2ce40191f289fecc018e | https://github.com/chartmogul/chartmogul-php/blob/1a2bcdf8b71600aaa4fb2ce40191f289fecc018e/src/Customer.php#L243-L257 |
190,410 | chartmogul/chartmogul-php | src/Customer.php | Customer.subscriptions | public function subscriptions(array $options = [])
{
if (!isset($this->subscriptions)) {
$options['customer_uuid'] = $this->uuid;
$this->subscriptions = Subscription::all($options);
}
return $this->subscriptions;
} | php | public function subscriptions(array $options = [])
{
if (!isset($this->subscriptions)) {
$options['customer_uuid'] = $this->uuid;
$this->subscriptions = Subscription::all($options);
}
return $this->subscriptions;
} | [
"public",
"function",
"subscriptions",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"subscriptions",
")",
")",
"{",
"$",
"options",
"[",
"'customer_uuid'",
"]",
"=",
"$",
"this",
"->",
"uuid"... | Find a Customer Subscriptions
@param array $options
@return \Doctrine\Common\Collections\ArrayCollection | Customer
@deprecated Use Import\Subscription. | [
"Find",
"a",
"Customer",
"Subscriptions"
] | 1a2bcdf8b71600aaa4fb2ce40191f289fecc018e | https://github.com/chartmogul/chartmogul-php/blob/1a2bcdf8b71600aaa4fb2ce40191f289fecc018e/src/Customer.php#L265-L272 |
190,411 | chartmogul/chartmogul-php | src/Customer.php | Customer.invoices | public function invoices(array $options = [])
{
if (!isset($this->invoices)) {
$options['customer_uuid'] = $this->uuid;
$this->invoices = CustomerInvoices::all($options)->invoices;
}
return $this->invoices;
} | php | public function invoices(array $options = [])
{
if (!isset($this->invoices)) {
$options['customer_uuid'] = $this->uuid;
$this->invoices = CustomerInvoices::all($options)->invoices;
}
return $this->invoices;
} | [
"public",
"function",
"invoices",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"invoices",
")",
")",
"{",
"$",
"options",
"[",
"'customer_uuid'",
"]",
"=",
"$",
"this",
"->",
"uuid",
";",
... | Find customer's invoices
@param array $options
@return \Doctrine\Common\Collections\ArrayCollection | Customer
@deprecated Use Import\CustomerInvoices. | [
"Find",
"customer",
"s",
"invoices"
] | 1a2bcdf8b71600aaa4fb2ce40191f289fecc018e | https://github.com/chartmogul/chartmogul-php/blob/1a2bcdf8b71600aaa4fb2ce40191f289fecc018e/src/Customer.php#L280-L287 |
190,412 | sop/x509 | lib/X509/AttributeCertificate/Holder.php | Holder.withBaseCertificateID | public function withBaseCertificateID(IssuerSerial $issuer): self
{
$obj = clone $this;
$obj->_baseCertificateID = $issuer;
return $obj;
} | php | public function withBaseCertificateID(IssuerSerial $issuer): self
{
$obj = clone $this;
$obj->_baseCertificateID = $issuer;
return $obj;
} | [
"public",
"function",
"withBaseCertificateID",
"(",
"IssuerSerial",
"$",
"issuer",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_baseCertificateID",
"=",
"$",
"issuer",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with base certificate ID.
@param IssuerSerial $issuer
@return self | [
"Get",
"self",
"with",
"base",
"certificate",
"ID",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Holder.php#L106-L111 |
190,413 | sop/x509 | lib/X509/AttributeCertificate/Holder.php | Holder.withEntityName | public function withEntityName(GeneralNames $names): self
{
$obj = clone $this;
$obj->_entityName = $names;
return $obj;
} | php | public function withEntityName(GeneralNames $names): self
{
$obj = clone $this;
$obj->_entityName = $names;
return $obj;
} | [
"public",
"function",
"withEntityName",
"(",
"GeneralNames",
"$",
"names",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_entityName",
"=",
"$",
"names",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with entity name.
@param GeneralNames $names
@return self | [
"Get",
"self",
"with",
"entity",
"name",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Holder.php#L119-L124 |
190,414 | sop/x509 | lib/X509/AttributeCertificate/Holder.php | Holder.withObjectDigestInfo | public function withObjectDigestInfo(ObjectDigestInfo $odi): self
{
$obj = clone $this;
$obj->_objectDigestInfo = $odi;
return $obj;
} | php | public function withObjectDigestInfo(ObjectDigestInfo $odi): self
{
$obj = clone $this;
$obj->_objectDigestInfo = $odi;
return $obj;
} | [
"public",
"function",
"withObjectDigestInfo",
"(",
"ObjectDigestInfo",
"$",
"odi",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_objectDigestInfo",
"=",
"$",
"odi",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with object digest info.
@param ObjectDigestInfo $odi
@return self | [
"Get",
"self",
"with",
"object",
"digest",
"info",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Holder.php#L132-L137 |
190,415 | sop/x509 | lib/X509/AttributeCertificate/Holder.php | Holder.identifiesPKC | public function identifiesPKC(Certificate $cert): bool
{
// if neither baseCertificateID nor entityName are present
if (!$this->_baseCertificateID && !$this->_entityName) {
return false;
}
// if baseCertificateID is present, but doesn't match
if ($this->_baseCerti... | php | public function identifiesPKC(Certificate $cert): bool
{
// if neither baseCertificateID nor entityName are present
if (!$this->_baseCertificateID && !$this->_entityName) {
return false;
}
// if baseCertificateID is present, but doesn't match
if ($this->_baseCerti... | [
"public",
"function",
"identifiesPKC",
"(",
"Certificate",
"$",
"cert",
")",
":",
"bool",
"{",
"// if neither baseCertificateID nor entityName are present",
"if",
"(",
"!",
"$",
"this",
"->",
"_baseCertificateID",
"&&",
"!",
"$",
"this",
"->",
"_entityName",
")",
... | Check whether Holder identifies given certificate.
@param Certificate $cert
@return boolean | [
"Check",
"whether",
"Holder",
"identifies",
"given",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Holder.php#L240-L256 |
190,416 | sop/x509 | lib/X509/AttributeCertificate/Holder.php | Holder._checkEntityName | private function _checkEntityName(Certificate $cert): bool
{
$name = $this->_entityName->firstDN();
if ($cert->tbsCertificate()
->subject()
->equals($name)) {
return true;
}
$exts = $cert->tbsCertificate()->extensions();
if ($exts->hasSubje... | php | private function _checkEntityName(Certificate $cert): bool
{
$name = $this->_entityName->firstDN();
if ($cert->tbsCertificate()
->subject()
->equals($name)) {
return true;
}
$exts = $cert->tbsCertificate()->extensions();
if ($exts->hasSubje... | [
"private",
"function",
"_checkEntityName",
"(",
"Certificate",
"$",
"cert",
")",
":",
"bool",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"_entityName",
"->",
"firstDN",
"(",
")",
";",
"if",
"(",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"subj... | Check whether entityName matches the given certificate.
@param Certificate $cert
@return boolean | [
"Check",
"whether",
"entityName",
"matches",
"the",
"given",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Holder.php#L264-L280 |
190,417 | sop/x509 | lib/X509/AttributeCertificate/Holder.php | Holder._checkEntityAlternativeNames | private function _checkEntityAlternativeNames(GeneralNames $san): bool
{
// only directory names supported for now
$name = $this->_entityName->firstDN();
foreach ($san->allOf(GeneralName::TAG_DIRECTORY_NAME) as $dn) {
if ($dn instanceof DirectoryName && $dn->dn()->equals($name)) ... | php | private function _checkEntityAlternativeNames(GeneralNames $san): bool
{
// only directory names supported for now
$name = $this->_entityName->firstDN();
foreach ($san->allOf(GeneralName::TAG_DIRECTORY_NAME) as $dn) {
if ($dn instanceof DirectoryName && $dn->dn()->equals($name)) ... | [
"private",
"function",
"_checkEntityAlternativeNames",
"(",
"GeneralNames",
"$",
"san",
")",
":",
"bool",
"{",
"// only directory names supported for now",
"$",
"name",
"=",
"$",
"this",
"->",
"_entityName",
"->",
"firstDN",
"(",
")",
";",
"foreach",
"(",
"$",
"... | Check whether any of the subject alternative names match entityName.
@param GeneralNames $san
@return boolean | [
"Check",
"whether",
"any",
"of",
"the",
"subject",
"alternative",
"names",
"match",
"entityName",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Holder.php#L288-L298 |
190,418 | sop/x509 | lib/X509/AttributeCertificate/Validation/ACValidationConfig.php | ACValidationConfig.withEvaluationTime | public function withEvaluationTime(\DateTimeImmutable $dt): self
{
$obj = clone $this;
$obj->_evalTime = $dt;
return $obj;
} | php | public function withEvaluationTime(\DateTimeImmutable $dt): self
{
$obj = clone $this;
$obj->_evalTime = $dt;
return $obj;
} | [
"public",
"function",
"withEvaluationTime",
"(",
"\\",
"DateTimeImmutable",
"$",
"dt",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_evalTime",
"=",
"$",
"dt",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with given evaluation reference time.
@param \DateTimeImmutable $dt
@return self | [
"Get",
"self",
"with",
"given",
"evaluation",
"reference",
"time",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Validation/ACValidationConfig.php#L84-L89 |
190,419 | sop/x509 | lib/X509/AttributeCertificate/Validation/ACValidationConfig.php | ACValidationConfig.withTargets | public function withTargets(Target ...$targets): self
{
$obj = clone $this;
$obj->_targets = $targets;
return $obj;
} | php | public function withTargets(Target ...$targets): self
{
$obj = clone $this;
$obj->_targets = $targets;
return $obj;
} | [
"public",
"function",
"withTargets",
"(",
"Target",
"...",
"$",
"targets",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_targets",
"=",
"$",
"targets",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with permitted targets.
@param Target ...$targets
@return self | [
"Get",
"self",
"with",
"permitted",
"targets",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Validation/ACValidationConfig.php#L107-L112 |
190,420 | phpsec/phpSec | lib/phpSec/Auth/Authy.php | Authy.userNew | public function userNew($email, $cellphone, $countrycode = 1) {
$data = array(
'user[email]' => $email,
'user[cellphone]' => $cellphone,
'user[country_code]' => $countrycode,
);
$result = $this->apiCall('new', $data);
if($result === false) {
$this->lastError = 'AUTHY... | php | public function userNew($email, $cellphone, $countrycode = 1) {
$data = array(
'user[email]' => $email,
'user[cellphone]' => $cellphone,
'user[country_code]' => $countrycode,
);
$result = $this->apiCall('new', $data);
if($result === false) {
$this->lastError = 'AUTHY... | [
"public",
"function",
"userNew",
"(",
"$",
"email",
",",
"$",
"cellphone",
",",
"$",
"countrycode",
"=",
"1",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'user[email]'",
"=>",
"$",
"email",
",",
"'user[cellphone]'",
"=>",
"$",
"cellphone",
",",
"'user[cou... | Add a new Authy user and get the Authy ID.
@param string $email
User email.
@param string $cellphone
User cellphone.
@param string $countrycode
User countrycode. Defaults to 1 (USA).
@return mixed
Returns the users Authy ID on success or false on errors.
@see \phpSec\Auth\Authy::$lastError. | [
"Add",
"a",
"new",
"Authy",
"user",
"and",
"get",
"the",
"Authy",
"ID",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Authy.php#L62-L91 |
190,421 | phpsec/phpSec | lib/phpSec/Auth/Authy.php | Authy.verify | public function verify($authyId, $token) {
$data = array(
'token' => $token,
'authy_id' => $authyId,
);
$result = $this->apiCall('verify', $data);
if($result === false) {
$this->lastError = 'AUTHY_SERVER_ERROR';
return false;
}
if(isset($result->errors)) {
if... | php | public function verify($authyId, $token) {
$data = array(
'token' => $token,
'authy_id' => $authyId,
);
$result = $this->apiCall('verify', $data);
if($result === false) {
$this->lastError = 'AUTHY_SERVER_ERROR';
return false;
}
if(isset($result->errors)) {
if... | [
"public",
"function",
"verify",
"(",
"$",
"authyId",
",",
"$",
"token",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'token'",
"=>",
"$",
"token",
",",
"'authy_id'",
"=>",
"$",
"authyId",
",",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"apiCall... | Verify a Authy OTP.
@param int $authyId
User Authy ID. @see \phpSec\Auth\Authy::userNew().
@param int $token
User supplied OPT/token.
@return boolean
Return true if a valid Authy token is supplied, false on any errors.
@see \phpSec\Auth\Authy::$lastError. | [
"Verify",
"a",
"Authy",
"OTP",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Authy.php#L106-L136 |
190,422 | phpsec/phpSec | lib/phpSec/Auth/Authy.php | Authy.requestSms | public function requestSms($authyId, $force = false) {
$data = array(
'authy_id' => $authyId,
'force' => $force,
);
$result = $this->apiCall('sms', $data);
if ($result === false) {
$this->lastError = 'AUTHY_SERVER_ERROR';
return false;
}
if (isset($result->errors)) ... | php | public function requestSms($authyId, $force = false) {
$data = array(
'authy_id' => $authyId,
'force' => $force,
);
$result = $this->apiCall('sms', $data);
if ($result === false) {
$this->lastError = 'AUTHY_SERVER_ERROR';
return false;
}
if (isset($result->errors)) ... | [
"public",
"function",
"requestSms",
"(",
"$",
"authyId",
",",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'authy_id'",
"=>",
"$",
"authyId",
",",
"'force'",
"=>",
"$",
"force",
",",
")",
";",
"$",
"result",
"=",
"$",
"thi... | Request SMS token.
@param int $authyId
Authy ID to request SMS token for.
@param bool $force
Force sending of SMS even for users with App.
@return boolean
Returns true if SMS request was OK. false if not. | [
"Request",
"SMS",
"token",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Authy.php#L150-L169 |
190,423 | phpsec/phpSec | lib/phpSec/Auth/Authy.php | Authy.apiCall | private function apiCall($action, $data) {
switch($this->_sandbox) {
case true:
$url = $this->_servers['sandbox'];
break;
default:
$url = $this->_servers['production'];
}
switch($action) {
case 'new':
$url = $url.'/protected/json/users/new?api_key='... | php | private function apiCall($action, $data) {
switch($this->_sandbox) {
case true:
$url = $this->_servers['sandbox'];
break;
default:
$url = $this->_servers['production'];
}
switch($action) {
case 'new':
$url = $url.'/protected/json/users/new?api_key='... | [
"private",
"function",
"apiCall",
"(",
"$",
"action",
",",
"$",
"data",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"_sandbox",
")",
"{",
"case",
"true",
":",
"$",
"url",
"=",
"$",
"this",
"->",
"_servers",
"[",
"'sandbox'",
"]",
";",
"break",
";",... | Performs a call to the Authy API.
@param string $action
Action to perform: should be 'new' or 'verify'
@param array $data
Data to perform the action with.
@throws \phpSec\Exception\IOException If the Auty API server is unreachable.
@return object
Decoded JSON results from Authy server. | [
"Performs",
"a",
"call",
"to",
"the",
"Authy",
"API",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Authy.php#L185-L251 |
190,424 | sop/x509 | lib/X509/CertificationPath/PathBuilding/CertificationPathBuilder.php | CertificationPathBuilder.allPathsToTarget | public function allPathsToTarget(Certificate $target,
CertificateBundle $intermediate = null): array
{
$paths = $this->_resolvePathsToTarget($target, $intermediate);
// map paths to CertificationPath objects
return array_map(
function ($certs) {
return new... | php | public function allPathsToTarget(Certificate $target,
CertificateBundle $intermediate = null): array
{
$paths = $this->_resolvePathsToTarget($target, $intermediate);
// map paths to CertificationPath objects
return array_map(
function ($certs) {
return new... | [
"public",
"function",
"allPathsToTarget",
"(",
"Certificate",
"$",
"target",
",",
"CertificateBundle",
"$",
"intermediate",
"=",
"null",
")",
":",
"array",
"{",
"$",
"paths",
"=",
"$",
"this",
"->",
"_resolvePathsToTarget",
"(",
"$",
"target",
",",
"$",
"int... | Get all certification paths to given target certificate from
any trust anchor.
@param Certificate $target Target certificate
@param CertificateBundle|null $intermediate Optional intermediate
certificates
@return CertificationPath[] | [
"Get",
"all",
"certification",
"paths",
"to",
"given",
"target",
"certificate",
"from",
"any",
"trust",
"anchor",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathBuilding/CertificationPathBuilder.php#L45-L54 |
190,425 | sop/x509 | lib/X509/CertificationPath/PathBuilding/CertificationPathBuilder.php | CertificationPathBuilder._resolvePathsToTarget | private function _resolvePathsToTarget(Certificate $target,
CertificateBundle $intermediate = null): array
{
// array of possible paths
$paths = array();
// signed by certificate in the trust list
foreach ($this->_findIssuers($target, $this->_trustList) as $issuer) {
... | php | private function _resolvePathsToTarget(Certificate $target,
CertificateBundle $intermediate = null): array
{
// array of possible paths
$paths = array();
// signed by certificate in the trust list
foreach ($this->_findIssuers($target, $this->_trustList) as $issuer) {
... | [
"private",
"function",
"_resolvePathsToTarget",
"(",
"Certificate",
"$",
"target",
",",
"CertificateBundle",
"$",
"intermediate",
"=",
"null",
")",
":",
"array",
"{",
"// array of possible paths",
"$",
"paths",
"=",
"array",
"(",
")",
";",
"// signed by certificate ... | Resolve all possible certification paths from any trust anchor to
the target certificate, using optional intermediate certificates.
Helper method for allPathsToTarget to be called recursively.
@todo Implement loop detection
@param Certificate $target
@param CertificateBundle $intermediate
@return array[] Array of arr... | [
"Resolve",
"all",
"possible",
"certification",
"paths",
"from",
"any",
"trust",
"anchor",
"to",
"the",
"target",
"certificate",
"using",
"optional",
"intermediate",
"certificates",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathBuilding/CertificationPathBuilder.php#L67-L97 |
190,426 | sop/x509 | lib/X509/CertificationPath/PathBuilding/CertificationPathBuilder.php | CertificationPathBuilder._findIssuers | protected function _findIssuers(Certificate $target,
CertificateBundle $bundle): array
{
$issuers = array();
$issuer_name = $target->tbsCertificate()->issuer();
$extensions = $target->tbsCertificate()->extensions();
// find by authority key identifier
if ($extensions-... | php | protected function _findIssuers(Certificate $target,
CertificateBundle $bundle): array
{
$issuers = array();
$issuer_name = $target->tbsCertificate()->issuer();
$extensions = $target->tbsCertificate()->extensions();
// find by authority key identifier
if ($extensions-... | [
"protected",
"function",
"_findIssuers",
"(",
"Certificate",
"$",
"target",
",",
"CertificateBundle",
"$",
"bundle",
")",
":",
"array",
"{",
"$",
"issuers",
"=",
"array",
"(",
")",
";",
"$",
"issuer_name",
"=",
"$",
"target",
"->",
"tbsCertificate",
"(",
"... | Find all issuers of the target certificate from a given bundle.
@param Certificate $target Target certificate
@param CertificateBundle $bundle Certificates to search
@return Certificate[] | [
"Find",
"all",
"issuers",
"of",
"the",
"target",
"certificate",
"from",
"a",
"given",
"bundle",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathBuilding/CertificationPathBuilder.php#L129-L151 |
190,427 | sop/x509 | lib/X509/Feature/AttributeContainer.php | AttributeContainer._findFirst | protected function _findFirst(string $name)
{
$oid = AttributeType::attrNameToOID($name);
foreach ($this->_attributes as $attr) {
if ($attr->oid() == $oid) {
return $attr;
}
}
return null;
} | php | protected function _findFirst(string $name)
{
$oid = AttributeType::attrNameToOID($name);
foreach ($this->_attributes as $attr) {
if ($attr->oid() == $oid) {
return $attr;
}
}
return null;
} | [
"protected",
"function",
"_findFirst",
"(",
"string",
"$",
"name",
")",
"{",
"$",
"oid",
"=",
"AttributeType",
"::",
"attrNameToOID",
"(",
"$",
"name",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_attributes",
"as",
"$",
"attr",
")",
"{",
"if",
"(",
... | Find first attribute of given name or OID.
@param string $name
@return Attribute|null | [
"Find",
"first",
"attribute",
"of",
"given",
"name",
"or",
"OID",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Feature/AttributeContainer.php#L30-L39 |
190,428 | sop/x509 | lib/X509/Feature/AttributeContainer.php | AttributeContainer.firstOf | public function firstOf(string $name): Attribute
{
$attr = $this->_findFirst($name);
if (!$attr) {
throw new \UnexpectedValueException("No $name attribute.");
}
return $attr;
} | php | public function firstOf(string $name): Attribute
{
$attr = $this->_findFirst($name);
if (!$attr) {
throw new \UnexpectedValueException("No $name attribute.");
}
return $attr;
} | [
"public",
"function",
"firstOf",
"(",
"string",
"$",
"name",
")",
":",
"Attribute",
"{",
"$",
"attr",
"=",
"$",
"this",
"->",
"_findFirst",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"$",
"attr",
")",
"{",
"throw",
"new",
"\\",
"UnexpectedValueExcep... | Get first attribute by OID or attribute name.
@param string $name OID or attribute name
@throws \OutOfBoundsException
@return Attribute | [
"Get",
"first",
"attribute",
"by",
"OID",
"or",
"attribute",
"name",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Feature/AttributeContainer.php#L59-L66 |
190,429 | sop/x509 | lib/X509/Feature/AttributeContainer.php | AttributeContainer.allOf | public function allOf(string $name): array
{
$oid = AttributeType::attrNameToOID($name);
$attrs = array_filter($this->_attributes,
function (Attribute $attr) use ($oid) {
return $attr->oid() == $oid;
});
return array_values($attrs);
} | php | public function allOf(string $name): array
{
$oid = AttributeType::attrNameToOID($name);
$attrs = array_filter($this->_attributes,
function (Attribute $attr) use ($oid) {
return $attr->oid() == $oid;
});
return array_values($attrs);
} | [
"public",
"function",
"allOf",
"(",
"string",
"$",
"name",
")",
":",
"array",
"{",
"$",
"oid",
"=",
"AttributeType",
"::",
"attrNameToOID",
"(",
"$",
"name",
")",
";",
"$",
"attrs",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"_attributes",
",",
"func... | Get all attributes of given name.
@param string $name OID or attribute name
@return Attribute[] | [
"Get",
"all",
"attributes",
"of",
"given",
"name",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Feature/AttributeContainer.php#L74-L82 |
190,430 | sop/x509 | lib/X509/Feature/AttributeContainer.php | AttributeContainer.withAdditional | public function withAdditional(Attribute ...$attribs): self
{
$obj = clone $this;
foreach ($attribs as $attr) {
$obj->_attributes[] = $attr;
}
return $obj;
} | php | public function withAdditional(Attribute ...$attribs): self
{
$obj = clone $this;
foreach ($attribs as $attr) {
$obj->_attributes[] = $attr;
}
return $obj;
} | [
"public",
"function",
"withAdditional",
"(",
"Attribute",
"...",
"$",
"attribs",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"foreach",
"(",
"$",
"attribs",
"as",
"$",
"attr",
")",
"{",
"$",
"obj",
"->",
"_attributes",
"[",
"]"... | Get self with additional attributes added.
@param Attribute ...$attribs
@return self | [
"Get",
"self",
"with",
"additional",
"attributes",
"added",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Feature/AttributeContainer.php#L100-L107 |
190,431 | sop/x509 | lib/X509/Feature/AttributeContainer.php | AttributeContainer.withUnique | public function withUnique(Attribute $attr): self
{
$obj = clone $this;
$obj->_attributes = array_filter($obj->_attributes,
function (Attribute $a) use ($attr) {
return $a->oid() != $attr->oid();
});
$obj->_attributes[] = $attr;
return $obj;
... | php | public function withUnique(Attribute $attr): self
{
$obj = clone $this;
$obj->_attributes = array_filter($obj->_attributes,
function (Attribute $a) use ($attr) {
return $a->oid() != $attr->oid();
});
$obj->_attributes[] = $attr;
return $obj;
... | [
"public",
"function",
"withUnique",
"(",
"Attribute",
"$",
"attr",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_attributes",
"=",
"array_filter",
"(",
"$",
"obj",
"->",
"_attributes",
",",
"function",
"(",
"Att... | Get self with single unique attribute added.
All previous attributes of the same type are removed.
@param Attribute $attr
@return self | [
"Get",
"self",
"with",
"single",
"unique",
"attribute",
"added",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Feature/AttributeContainer.php#L117-L126 |
190,432 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._processCertificate | private function _processCertificate(ValidatorState $state, Certificate $cert): ValidatorState
{
// (a.1) verify signature
$this->_verifySignature($state, $cert);
// (a.2) check validity period
$this->_checkValidity($cert);
// (a.3) check that certificate is not revoked
... | php | private function _processCertificate(ValidatorState $state, Certificate $cert): ValidatorState
{
// (a.1) verify signature
$this->_verifySignature($state, $cert);
// (a.2) check validity period
$this->_checkValidity($cert);
// (a.3) check that certificate is not revoked
... | [
"private",
"function",
"_processCertificate",
"(",
"ValidatorState",
"$",
"state",
",",
"Certificate",
"$",
"cert",
")",
":",
"ValidatorState",
"{",
"// (a.1) verify signature",
"$",
"this",
"->",
"_verifySignature",
"(",
"$",
"state",
",",
"$",
"cert",
")",
";"... | Apply basic certificate processing according to RFC 5280 section 6.1.3.
@link https://tools.ietf.org/html/rfc5280#section-6.1.3
@param ValidatorState $state
@param Certificate $cert
@throws PathValidationException
@return ValidatorState | [
"Apply",
"basic",
"certificate",
"processing",
"according",
"to",
"RFC",
"5280",
"section",
"6",
".",
"1",
".",
"3",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L112-L147 |
190,433 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._prepareNext | private function _prepareNext(ValidatorState $state, Certificate $cert): ValidatorState
{
// (a)(b) if policy mappings extension is present
$state = $this->_preparePolicyMappings($state, $cert);
// (c) assign working_issuer_name
$state = $state->withWorkingIssuerName(
$ce... | php | private function _prepareNext(ValidatorState $state, Certificate $cert): ValidatorState
{
// (a)(b) if policy mappings extension is present
$state = $this->_preparePolicyMappings($state, $cert);
// (c) assign working_issuer_name
$state = $state->withWorkingIssuerName(
$ce... | [
"private",
"function",
"_prepareNext",
"(",
"ValidatorState",
"$",
"state",
",",
"Certificate",
"$",
"cert",
")",
":",
"ValidatorState",
"{",
"// (a)(b) if policy mappings extension is present",
"$",
"state",
"=",
"$",
"this",
"->",
"_preparePolicyMappings",
"(",
"$",... | Apply preparation for the certificate i+1 according to rfc5280 section
6.1.4.
@link https://tools.ietf.org/html/rfc5280#section-6.1.4
@param ValidatorState $state
@param Certificate $cert
@return ValidatorState | [
"Apply",
"preparation",
"for",
"the",
"certificate",
"i",
"+",
"1",
"according",
"to",
"rfc5280",
"section",
"6",
".",
"1",
".",
"4",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L158-L189 |
190,434 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._wrapUp | private function _wrapUp(ValidatorState $state, Certificate $cert): ValidatorState
{
$tbs_cert = $cert->tbsCertificate();
$extensions = $tbs_cert->extensions();
// (a)
if ($state->explicitPolicy() > 0) {
$state = $state->withExplicitPolicy($state->explicitPolicy() - 1);
... | php | private function _wrapUp(ValidatorState $state, Certificate $cert): ValidatorState
{
$tbs_cert = $cert->tbsCertificate();
$extensions = $tbs_cert->extensions();
// (a)
if ($state->explicitPolicy() > 0) {
$state = $state->withExplicitPolicy($state->explicitPolicy() - 1);
... | [
"private",
"function",
"_wrapUp",
"(",
"ValidatorState",
"$",
"state",
",",
"Certificate",
"$",
"cert",
")",
":",
"ValidatorState",
"{",
"$",
"tbs_cert",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
";",
"$",
"extensions",
"=",
"$",
"tbs_cert",
"->"... | Apply wrap-up procedure according to RFC 5280 section 6.1.5.
@link https://tools.ietf.org/html/rfc5280#section-6.1.5
@param ValidatorState $state
@param Certificate $cert
@throws PathValidationException
@return ValidatorState | [
"Apply",
"wrap",
"-",
"up",
"procedure",
"according",
"to",
"RFC",
"5280",
"section",
"6",
".",
"1",
".",
"5",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L200-L228 |
190,435 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._setPublicKeyState | private function _setPublicKeyState(ValidatorState $state, Certificate $cert): ValidatorState
{
$pk_info = $cert->tbsCertificate()->subjectPublicKeyInfo();
// assign working_public_key
$state = $state->withWorkingPublicKey($pk_info);
// assign working_public_key_parameters
$p... | php | private function _setPublicKeyState(ValidatorState $state, Certificate $cert): ValidatorState
{
$pk_info = $cert->tbsCertificate()->subjectPublicKeyInfo();
// assign working_public_key
$state = $state->withWorkingPublicKey($pk_info);
// assign working_public_key_parameters
$p... | [
"private",
"function",
"_setPublicKeyState",
"(",
"ValidatorState",
"$",
"state",
",",
"Certificate",
"$",
"cert",
")",
":",
"ValidatorState",
"{",
"$",
"pk_info",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"subjectPublicKeyInfo",
"(",
")",
";",... | Update working_public_key, working_public_key_parameters and
working_public_key_algorithm state variables from certificate.
@param ValidatorState $state
@param Certificate $cert
@return ValidatorState | [
"Update",
"working_public_key",
"working_public_key_parameters",
"and",
"working_public_key_algorithm",
"state",
"variables",
"from",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L238-L259 |
190,436 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._verifySignature | private function _verifySignature(ValidatorState $state, Certificate $cert)
{
try {
$valid = $cert->verify($state->workingPublicKey(), $this->_crypto);
} catch (\RuntimeException $e) {
throw new PathValidationException(
"Failed to verify signature: " . $e->get... | php | private function _verifySignature(ValidatorState $state, Certificate $cert)
{
try {
$valid = $cert->verify($state->workingPublicKey(), $this->_crypto);
} catch (\RuntimeException $e) {
throw new PathValidationException(
"Failed to verify signature: " . $e->get... | [
"private",
"function",
"_verifySignature",
"(",
"ValidatorState",
"$",
"state",
",",
"Certificate",
"$",
"cert",
")",
"{",
"try",
"{",
"$",
"valid",
"=",
"$",
"cert",
"->",
"verify",
"(",
"$",
"state",
"->",
"workingPublicKey",
"(",
")",
",",
"$",
"this"... | Verify certificate signature.
@param ValidatorState $state
@param Certificate $cert
@throws PathValidationException | [
"Verify",
"certificate",
"signature",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L268-L280 |
190,437 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._checkValidity | private function _checkValidity(Certificate $cert)
{
$refdt = $this->_config->dateTime();
$validity = $cert->tbsCertificate()->validity();
if ($validity->notBefore()
->dateTime()
->diff($refdt)->invert) {
throw new PathValidationException(
... | php | private function _checkValidity(Certificate $cert)
{
$refdt = $this->_config->dateTime();
$validity = $cert->tbsCertificate()->validity();
if ($validity->notBefore()
->dateTime()
->diff($refdt)->invert) {
throw new PathValidationException(
... | [
"private",
"function",
"_checkValidity",
"(",
"Certificate",
"$",
"cert",
")",
"{",
"$",
"refdt",
"=",
"$",
"this",
"->",
"_config",
"->",
"dateTime",
"(",
")",
";",
"$",
"validity",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"validity",
... | Check certificate validity.
@param Certificate $cert
@throws PathValidationException | [
"Check",
"certificate",
"validity",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L288-L302 |
190,438 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._checkIssuer | private function _checkIssuer(ValidatorState $state, Certificate $cert)
{
if (!$cert->tbsCertificate()
->issuer()
->equals($state->workingIssuerName())) {
throw new PathValidationException("Certification issuer mismatch.");
}
} | php | private function _checkIssuer(ValidatorState $state, Certificate $cert)
{
if (!$cert->tbsCertificate()
->issuer()
->equals($state->workingIssuerName())) {
throw new PathValidationException("Certification issuer mismatch.");
}
} | [
"private",
"function",
"_checkIssuer",
"(",
"ValidatorState",
"$",
"state",
",",
"Certificate",
"$",
"cert",
")",
"{",
"if",
"(",
"!",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"issuer",
"(",
")",
"->",
"equals",
"(",
"$",
"state",
"->",
"wo... | Check certificate issuer.
@param ValidatorState $state
@param Certificate $cert
@throws PathValidationException | [
"Check",
"certificate",
"issuer",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L321-L328 |
190,439 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._preparePolicyMappings | private function _preparePolicyMappings(ValidatorState $state,
Certificate $cert): ValidatorState
{
$extensions = $cert->tbsCertificate()->extensions();
if ($extensions->hasPolicyMappings()) {
// (a) verify that anyPolicy mapping is not used
if ($extensions->policyMap... | php | private function _preparePolicyMappings(ValidatorState $state,
Certificate $cert): ValidatorState
{
$extensions = $cert->tbsCertificate()->extensions();
if ($extensions->hasPolicyMappings()) {
// (a) verify that anyPolicy mapping is not used
if ($extensions->policyMap... | [
"private",
"function",
"_preparePolicyMappings",
"(",
"ValidatorState",
"$",
"state",
",",
"Certificate",
"$",
"cert",
")",
":",
"ValidatorState",
"{",
"$",
"extensions",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"extensions",
"(",
")",
";",
... | Apply policy mappings handling for the preparation step.
@param ValidatorState $state
@param Certificate $cert
@throws PathValidationException
@return ValidatorState | [
"Apply",
"policy",
"mappings",
"handling",
"for",
"the",
"preparation",
"step",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L362-L378 |
190,440 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._prepareNameConstraints | private function _prepareNameConstraints(ValidatorState $state,
Certificate $cert): ValidatorState
{
$extensions = $cert->tbsCertificate()->extensions();
if ($extensions->hasNameConstraints()) {
$state = $this->_processNameConstraints($state, $cert);
}
return $sta... | php | private function _prepareNameConstraints(ValidatorState $state,
Certificate $cert): ValidatorState
{
$extensions = $cert->tbsCertificate()->extensions();
if ($extensions->hasNameConstraints()) {
$state = $this->_processNameConstraints($state, $cert);
}
return $sta... | [
"private",
"function",
"_prepareNameConstraints",
"(",
"ValidatorState",
"$",
"state",
",",
"Certificate",
"$",
"cert",
")",
":",
"ValidatorState",
"{",
"$",
"extensions",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"extensions",
"(",
")",
";",
... | Apply name constraints handling for the preparation step.
@param ValidatorState $state
@param Certificate $cert
@return ValidatorState | [
"Apply",
"name",
"constraints",
"handling",
"for",
"the",
"preparation",
"step",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L387-L395 |
190,441 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._prepareNonSelfIssued | private function _prepareNonSelfIssued(ValidatorState $state): ValidatorState
{
// (h.1)
if ($state->explicitPolicy() > 0) {
$state = $state->withExplicitPolicy($state->explicitPolicy() - 1);
}
// (h.2)
if ($state->policyMapping() > 0) {
$state = $stat... | php | private function _prepareNonSelfIssued(ValidatorState $state): ValidatorState
{
// (h.1)
if ($state->explicitPolicy() > 0) {
$state = $state->withExplicitPolicy($state->explicitPolicy() - 1);
}
// (h.2)
if ($state->policyMapping() > 0) {
$state = $stat... | [
"private",
"function",
"_prepareNonSelfIssued",
"(",
"ValidatorState",
"$",
"state",
")",
":",
"ValidatorState",
"{",
"// (h.1)",
"if",
"(",
"$",
"state",
"->",
"explicitPolicy",
"(",
")",
">",
"0",
")",
"{",
"$",
"state",
"=",
"$",
"state",
"->",
"withExp... | Apply preparation for a non-self-signed certificate.
@param ValidatorState $state
@return ValidatorState | [
"Apply",
"preparation",
"for",
"a",
"non",
"-",
"self",
"-",
"signed",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L403-L419 |
190,442 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._preparePolicyConstraints | private function _preparePolicyConstraints(ValidatorState $state,
Certificate $cert): ValidatorState
{
$extensions = $cert->tbsCertificate()->extensions();
if (!$extensions->hasPolicyConstraints()) {
return $state;
}
$ext = $extensions->policyConstraints();
... | php | private function _preparePolicyConstraints(ValidatorState $state,
Certificate $cert): ValidatorState
{
$extensions = $cert->tbsCertificate()->extensions();
if (!$extensions->hasPolicyConstraints()) {
return $state;
}
$ext = $extensions->policyConstraints();
... | [
"private",
"function",
"_preparePolicyConstraints",
"(",
"ValidatorState",
"$",
"state",
",",
"Certificate",
"$",
"cert",
")",
":",
"ValidatorState",
"{",
"$",
"extensions",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"extensions",
"(",
")",
";",... | Apply policy constraints handling for the preparation step.
@param ValidatorState $state
@param Certificate $cert
@return ValidatorState | [
"Apply",
"policy",
"constraints",
"handling",
"for",
"the",
"preparation",
"step",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L428-L447 |
190,443 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._prepareInhibitAnyPolicy | private function _prepareInhibitAnyPolicy(ValidatorState $state,
Certificate $cert): ValidatorState
{
$extensions = $cert->tbsCertificate()->extensions();
if ($extensions->hasInhibitAnyPolicy()) {
$ext = $extensions->inhibitAnyPolicy();
if ($ext->skipCerts() < $state-... | php | private function _prepareInhibitAnyPolicy(ValidatorState $state,
Certificate $cert): ValidatorState
{
$extensions = $cert->tbsCertificate()->extensions();
if ($extensions->hasInhibitAnyPolicy()) {
$ext = $extensions->inhibitAnyPolicy();
if ($ext->skipCerts() < $state-... | [
"private",
"function",
"_prepareInhibitAnyPolicy",
"(",
"ValidatorState",
"$",
"state",
",",
"Certificate",
"$",
"cert",
")",
":",
"ValidatorState",
"{",
"$",
"extensions",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"extensions",
"(",
")",
";",
... | Apply inhibit any-policy handling for the preparation step.
@param ValidatorState $state
@param Certificate $cert
@return ValidatorState | [
"Apply",
"inhibit",
"any",
"-",
"policy",
"handling",
"for",
"the",
"preparation",
"step",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L456-L467 |
190,444 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._verifyMaxPathLength | private function _verifyMaxPathLength(ValidatorState $state,
Certificate $cert): ValidatorState
{
if (!$cert->isSelfIssued()) {
if ($state->maxPathLength() <= 0) {
throw new PathValidationException(
"Certification path length exceeded.");
}... | php | private function _verifyMaxPathLength(ValidatorState $state,
Certificate $cert): ValidatorState
{
if (!$cert->isSelfIssued()) {
if ($state->maxPathLength() <= 0) {
throw new PathValidationException(
"Certification path length exceeded.");
}... | [
"private",
"function",
"_verifyMaxPathLength",
"(",
"ValidatorState",
"$",
"state",
",",
"Certificate",
"$",
"cert",
")",
":",
"ValidatorState",
"{",
"if",
"(",
"!",
"$",
"cert",
"->",
"isSelfIssued",
"(",
")",
")",
"{",
"if",
"(",
"$",
"state",
"->",
"m... | Verify maximum certification path length for the preparation step.
@param ValidatorState $state
@param Certificate $cert
@throws PathValidationException
@return ValidatorState | [
"Verify",
"maximum",
"certification",
"path",
"length",
"for",
"the",
"preparation",
"step",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L477-L488 |
190,445 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._checkKeyUsage | private function _checkKeyUsage(Certificate $cert)
{
$extensions = $cert->tbsCertificate()->extensions();
if ($extensions->hasKeyUsage()) {
$ext = $extensions->keyUsage();
if (!$ext->isKeyCertSign()) {
throw new PathValidationException("keyCertSign usage not s... | php | private function _checkKeyUsage(Certificate $cert)
{
$extensions = $cert->tbsCertificate()->extensions();
if ($extensions->hasKeyUsage()) {
$ext = $extensions->keyUsage();
if (!$ext->isKeyCertSign()) {
throw new PathValidationException("keyCertSign usage not s... | [
"private",
"function",
"_checkKeyUsage",
"(",
"Certificate",
"$",
"cert",
")",
"{",
"$",
"extensions",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"extensions",
"(",
")",
";",
"if",
"(",
"$",
"extensions",
"->",
"hasKeyUsage",
"(",
")",
")"... | Check key usage extension for the preparation step.
@param Certificate $cert
@throws PathValidationException | [
"Check",
"key",
"usage",
"extension",
"for",
"the",
"preparation",
"step",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L496-L505 |
190,446 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._processBasicContraints | private function _processBasicContraints(Certificate $cert)
{
if ($cert->tbsCertificate()->version() == TBSCertificate::VERSION_3) {
$extensions = $cert->tbsCertificate()->extensions();
if (!$extensions->hasBasicConstraints()) {
throw new PathValidationException(
... | php | private function _processBasicContraints(Certificate $cert)
{
if ($cert->tbsCertificate()->version() == TBSCertificate::VERSION_3) {
$extensions = $cert->tbsCertificate()->extensions();
if (!$extensions->hasBasicConstraints()) {
throw new PathValidationException(
... | [
"private",
"function",
"_processBasicContraints",
"(",
"Certificate",
"$",
"cert",
")",
"{",
"if",
"(",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"version",
"(",
")",
"==",
"TBSCertificate",
"::",
"VERSION_3",
")",
"{",
"$",
"extensions",
"=",
"... | Process basic constraints extension.
@param Certificate $cert
@throws PathValidationException | [
"Process",
"basic",
"constraints",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L526-L540 |
190,447 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidator.php | PathValidator._processPathLengthContraint | private function _processPathLengthContraint(ValidatorState $state,
Certificate $cert): ValidatorState
{
$extensions = $cert->tbsCertificate()->extensions();
if ($extensions->hasBasicConstraints()) {
$ext = $extensions->basicConstraints();
if ($ext->hasPathLen()) {
... | php | private function _processPathLengthContraint(ValidatorState $state,
Certificate $cert): ValidatorState
{
$extensions = $cert->tbsCertificate()->extensions();
if ($extensions->hasBasicConstraints()) {
$ext = $extensions->basicConstraints();
if ($ext->hasPathLen()) {
... | [
"private",
"function",
"_processPathLengthContraint",
"(",
"ValidatorState",
"$",
"state",
",",
"Certificate",
"$",
"cert",
")",
":",
"ValidatorState",
"{",
"$",
"extensions",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"extensions",
"(",
")",
";... | Process pathLenConstraint.
@param ValidatorState $state
@param Certificate $cert
@return ValidatorState | [
"Process",
"pathLenConstraint",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidator.php#L549-L562 |
190,448 | chartmogul/chartmogul-php | src/Service/GetTrait.php | GetTrait.retrieve | public static function retrieve($uuid, ClientInterface $client = null)
{
return (new RequestService($client))
->setResourceClass(static::class)
->get($uuid);
} | php | public static function retrieve($uuid, ClientInterface $client = null)
{
return (new RequestService($client))
->setResourceClass(static::class)
->get($uuid);
} | [
"public",
"static",
"function",
"retrieve",
"(",
"$",
"uuid",
",",
"ClientInterface",
"$",
"client",
"=",
"null",
")",
"{",
"return",
"(",
"new",
"RequestService",
"(",
"$",
"client",
")",
")",
"->",
"setResourceClass",
"(",
"static",
"::",
"class",
")",
... | Get a single resource by UUID.
@return resource | [
"Get",
"a",
"single",
"resource",
"by",
"UUID",
"."
] | 1a2bcdf8b71600aaa4fb2ce40191f289fecc018e | https://github.com/chartmogul/chartmogul-php/blob/1a2bcdf8b71600aaa4fb2ce40191f289fecc018e/src/Service/GetTrait.php#L16-L21 |
190,449 | phpsec/phpSec | lib/phpSec/Http/Hsts.php | Hsts.enable | public function enable() {
if ($this->detectHttps() === true) {
header('Strict-Transport-Security: max-age='.$this->maxAge);
} else {
header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], true, 301);
/* Prevent further execution and output. */
die();
}
} | php | public function enable() {
if ($this->detectHttps() === true) {
header('Strict-Transport-Security: max-age='.$this->maxAge);
} else {
header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], true, 301);
/* Prevent further execution and output. */
die();
}
} | [
"public",
"function",
"enable",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"detectHttps",
"(",
")",
"===",
"true",
")",
"{",
"header",
"(",
"'Strict-Transport-Security: max-age='",
".",
"$",
"this",
"->",
"maxAge",
")",
";",
"}",
"else",
"{",
"header",... | Enables HSTS. | [
"Enables",
"HSTS",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Http/Hsts.php#L23-L31 |
190,450 | sop/x509 | lib/X509/Certificate/Extension/Target/Target.php | Target.fromASN1 | public static function fromASN1(TaggedType $el): self
{
switch ($el->tag()) {
case self::TYPE_NAME:
return TargetName::fromChosenASN1($el->asExplicit()->asTagged());
case self::TYPE_GROUP:
return TargetGroup::fromChosenASN1(
$el->as... | php | public static function fromASN1(TaggedType $el): self
{
switch ($el->tag()) {
case self::TYPE_NAME:
return TargetName::fromChosenASN1($el->asExplicit()->asTagged());
case self::TYPE_GROUP:
return TargetGroup::fromChosenASN1(
$el->as... | [
"public",
"static",
"function",
"fromASN1",
"(",
"TaggedType",
"$",
"el",
")",
":",
"self",
"{",
"switch",
"(",
"$",
"el",
"->",
"tag",
"(",
")",
")",
"{",
"case",
"self",
"::",
"TYPE_NAME",
":",
"return",
"TargetName",
"::",
"fromChosenASN1",
"(",
"$"... | Parse from ASN.1.
@param TaggedType $el
@throws \UnexpectedValueException
@return self | [
"Parse",
"from",
"ASN",
".",
"1",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/Target/Target.php#L60-L73 |
190,451 | sop/x509 | lib/X509/Certificate/Extension/Target/Target.php | Target.equals | public function equals(Target $other): bool
{
if ($this->_type != $other->_type) {
return false;
}
if ($this->toASN1()->toDER() != $other->toASN1()->toDER()) {
return false;
}
return true;
} | php | public function equals(Target $other): bool
{
if ($this->_type != $other->_type) {
return false;
}
if ($this->toASN1()->toDER() != $other->toASN1()->toDER()) {
return false;
}
return true;
} | [
"public",
"function",
"equals",
"(",
"Target",
"$",
"other",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"_type",
"!=",
"$",
"other",
"->",
"_type",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"toASN1",
"(",
")",... | Check whether target is equal to another.
@param Target $other
@return bool | [
"Check",
"whether",
"target",
"is",
"equal",
"to",
"another",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/Target/Target.php#L91-L100 |
190,452 | bitrix-expert/monolog-adapter | src/MonologAdapter.php | MonologAdapter.loadConfiguration | public static function loadConfiguration($force = false)
{
if ($force === false && static::$isConfigurationLoaded === true)
{
return true;
}
if (class_exists('\Bitrix\Main\Config\Configuration'))
{
$config = Configuration::getInstance()->get('monolog'... | php | public static function loadConfiguration($force = false)
{
if ($force === false && static::$isConfigurationLoaded === true)
{
return true;
}
if (class_exists('\Bitrix\Main\Config\Configuration'))
{
$config = Configuration::getInstance()->get('monolog'... | [
"public",
"static",
"function",
"loadConfiguration",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"force",
"===",
"false",
"&&",
"static",
"::",
"$",
"isConfigurationLoaded",
"===",
"true",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
... | Load a configuration for the loggers from `.settings.php` or `.settings_extra.php`.
@param bool $force Load even if the configuration has already been loaded.
@return bool | [
"Load",
"a",
"configuration",
"for",
"the",
"loggers",
"from",
".",
"settings",
".",
"php",
"or",
".",
"settings_extra",
".",
"php",
"."
] | 112d6524f217c7d7cac29249faad0217a549ce27 | https://github.com/bitrix-expert/monolog-adapter/blob/112d6524f217c7d7cac29249faad0217a549ce27/src/MonologAdapter.php#L28-L48 |
190,453 | chartmogul/chartmogul-php | src/Metrics.php | Metrics.all | public static function all(array $options = [], ClientInterface $client = null)
{
return Metrics\AllKeyMetrics::all($options, $client);
} | php | public static function all(array $options = [], ClientInterface $client = null)
{
return Metrics\AllKeyMetrics::all($options, $client);
} | [
"public",
"static",
"function",
"all",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"ClientInterface",
"$",
"client",
"=",
"null",
")",
"{",
"return",
"Metrics",
"\\",
"AllKeyMetrics",
"::",
"all",
"(",
"$",
"options",
",",
"$",
"client",
")",
";"... | Retrieves all key metrics, for the specified time period.
@param array|array $options
@param ClientInterface|null $client
@return Metrics\AllKeyMetrics | [
"Retrieves",
"all",
"key",
"metrics",
"for",
"the",
"specified",
"time",
"period",
"."
] | 1a2bcdf8b71600aaa4fb2ce40191f289fecc018e | https://github.com/chartmogul/chartmogul-php/blob/1a2bcdf8b71600aaa4fb2ce40191f289fecc018e/src/Metrics.php#L20-L23 |
190,454 | chartmogul/chartmogul-php | src/Metrics.php | Metrics.customerChurnRate | public static function customerChurnRate(array $options = [], ClientInterface $client = null)
{
return Metrics\CustomerChurnRates::all($options, $client);
} | php | public static function customerChurnRate(array $options = [], ClientInterface $client = null)
{
return Metrics\CustomerChurnRates::all($options, $client);
} | [
"public",
"static",
"function",
"customerChurnRate",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"ClientInterface",
"$",
"client",
"=",
"null",
")",
"{",
"return",
"Metrics",
"\\",
"CustomerChurnRates",
"::",
"all",
"(",
"$",
"options",
",",
"$",
"cl... | Retrieves the Customer Churn Rate, for the specified time period.
@param array|array $options
@param ClientInterface|null $client
@return Metrics\CustomerChurnRates | [
"Retrieves",
"the",
"Customer",
"Churn",
"Rate",
"for",
"the",
"specified",
"time",
"period",
"."
] | 1a2bcdf8b71600aaa4fb2ce40191f289fecc018e | https://github.com/chartmogul/chartmogul-php/blob/1a2bcdf8b71600aaa4fb2ce40191f289fecc018e/src/Metrics.php#L63-L66 |
190,455 | chartmogul/chartmogul-php | src/Metrics.php | Metrics.customerCount | public static function customerCount(array $options = [], ClientInterface $client = null)
{
return Metrics\CustomerCounts::all($options, $client);
} | php | public static function customerCount(array $options = [], ClientInterface $client = null)
{
return Metrics\CustomerCounts::all($options, $client);
} | [
"public",
"static",
"function",
"customerCount",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"ClientInterface",
"$",
"client",
"=",
"null",
")",
"{",
"return",
"Metrics",
"\\",
"CustomerCounts",
"::",
"all",
"(",
"$",
"options",
",",
"$",
"client",
... | Retrieves the number of active customers, for the specified time period.
@param array|array $options
@param ClientInterface|null $client
@return Metrics\CustomerCounts | [
"Retrieves",
"the",
"number",
"of",
"active",
"customers",
"for",
"the",
"specified",
"time",
"period",
"."
] | 1a2bcdf8b71600aaa4fb2ce40191f289fecc018e | https://github.com/chartmogul/chartmogul-php/blob/1a2bcdf8b71600aaa4fb2ce40191f289fecc018e/src/Metrics.php#L74-L77 |
190,456 | chartmogul/chartmogul-php | src/Metrics.php | Metrics.mrrChurnRate | public static function mrrChurnRate(array $options = [], ClientInterface $client = null)
{
return Metrics\MRRChurnRates::all($options, $client);
} | php | public static function mrrChurnRate(array $options = [], ClientInterface $client = null)
{
return Metrics\MRRChurnRates::all($options, $client);
} | [
"public",
"static",
"function",
"mrrChurnRate",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"ClientInterface",
"$",
"client",
"=",
"null",
")",
"{",
"return",
"Metrics",
"\\",
"MRRChurnRates",
"::",
"all",
"(",
"$",
"options",
",",
"$",
"client",
"... | Retrieves the Net MRR Churn Rate, for the specified time period.
@param array|array $options
@param ClientInterface|null $client
@return Metrics\MRRChurnRates | [
"Retrieves",
"the",
"Net",
"MRR",
"Churn",
"Rate",
"for",
"the",
"specified",
"time",
"period",
"."
] | 1a2bcdf8b71600aaa4fb2ce40191f289fecc018e | https://github.com/chartmogul/chartmogul-php/blob/1a2bcdf8b71600aaa4fb2ce40191f289fecc018e/src/Metrics.php#L107-L110 |
190,457 | phpsec/phpSec | lib/phpSec/Auth/Yubikey.php | Yubikey.verify | public function verify($otp) {
$rand = $this->psl['crypt/rand'];
if($this->clientId === null || $this->clientSecret === null) {
$this->lastError = 'YUBIKEY_CLIENT_DATA_NEEDED';
return false;
}
if(!self::validOtp($otp)) {
$this->lastError = 'YUBIKEY_INVALID_OTP';
return false;
... | php | public function verify($otp) {
$rand = $this->psl['crypt/rand'];
if($this->clientId === null || $this->clientSecret === null) {
$this->lastError = 'YUBIKEY_CLIENT_DATA_NEEDED';
return false;
}
if(!self::validOtp($otp)) {
$this->lastError = 'YUBIKEY_INVALID_OTP';
return false;
... | [
"public",
"function",
"verify",
"(",
"$",
"otp",
")",
"{",
"$",
"rand",
"=",
"$",
"this",
"->",
"psl",
"[",
"'crypt/rand'",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"clientId",
"===",
"null",
"||",
"$",
"this",
"->",
"clientSecret",
"===",
"null",
"... | Verify Yubikey one time password against the Yubico servers.
@param string $otp
One time password to verify.
@return boolean
True on valid OTP, false on invalid. If this method returns false
$lastError will contain details.
@see https://phpseclib.com/manual/09-Yubikey-Authentication.md | [
"Verify",
"Yubikey",
"one",
"time",
"password",
"against",
"the",
"Yubico",
"servers",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Yubikey.php#L84-L148 |
190,458 | phpsec/phpSec | lib/phpSec/Auth/Yubikey.php | Yubikey.sign | public function sign($data) {
/* Remove signature from server. */
unset($data['h']);
/* Sort keys alphabetically. */
ksort($data);
/* Build query string to sign. */
$n = count($data);
$query = '';
$i = 0;
while(list($key, $val) = each($data)) {
$i++;
$query .= $key.'='.... | php | public function sign($data) {
/* Remove signature from server. */
unset($data['h']);
/* Sort keys alphabetically. */
ksort($data);
/* Build query string to sign. */
$n = count($data);
$query = '';
$i = 0;
while(list($key, $val) = each($data)) {
$i++;
$query .= $key.'='.... | [
"public",
"function",
"sign",
"(",
"$",
"data",
")",
"{",
"/* Remove signature from server. */",
"unset",
"(",
"$",
"data",
"[",
"'h'",
"]",
")",
";",
"/* Sort keys alphabetically. */",
"ksort",
"(",
"$",
"data",
")",
";",
"/* Build query string to sign. */",
"$",... | Sign data using shared secret.
@param array $data
Data to sign.
@return string
Base64 encoded HMAC hash. | [
"Sign",
"data",
"using",
"shared",
"secret",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Yubikey.php#L159-L181 |
190,459 | phpsec/phpSec | lib/phpSec/Auth/Yubikey.php | Yubikey.getResponse | private function getResponse($data) {
/* Convert the array with data to a request string. */
$query = http_build_query($data);
/* Set up array with options for the context used by file_get_contents(). */
$opts = array(
'http'=>array(
'method' => 'GET',
'timeout' => $this->_server... | php | private function getResponse($data) {
/* Convert the array with data to a request string. */
$query = http_build_query($data);
/* Set up array with options for the context used by file_get_contents(). */
$opts = array(
'http'=>array(
'method' => 'GET',
'timeout' => $this->_server... | [
"private",
"function",
"getResponse",
"(",
"$",
"data",
")",
"{",
"/* Convert the array with data to a request string. */",
"$",
"query",
"=",
"http_build_query",
"(",
"$",
"data",
")",
";",
"/* Set up array with options for the context used by file_get_contents(). */",
"$",
... | Make a request to the Yubico servers and get the response.
@param array $data
Array containing the key/values for the request.
@return array
Array containing key/values from the response. | [
"Make",
"a",
"request",
"to",
"the",
"Yubico",
"servers",
"and",
"get",
"the",
"response",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Yubikey.php#L192-L235 |
190,460 | phpsec/phpSec | lib/phpSec/Auth/Yubikey.php | Yubikey.validOtp | public function validOtp($otp) {
$length = strlen($otp);
/* Check length. */
if($length > 48 || $length < 32) {
return false;
}
/* Check for printable charcters (no whitespace). */
return ctype_graph($otp);
} | php | public function validOtp($otp) {
$length = strlen($otp);
/* Check length. */
if($length > 48 || $length < 32) {
return false;
}
/* Check for printable charcters (no whitespace). */
return ctype_graph($otp);
} | [
"public",
"function",
"validOtp",
"(",
"$",
"otp",
")",
"{",
"$",
"length",
"=",
"strlen",
"(",
"$",
"otp",
")",
";",
"/* Check length. */",
"if",
"(",
"$",
"length",
">",
"48",
"||",
"$",
"length",
"<",
"32",
")",
"{",
"return",
"false",
";",
"}",... | Validate a string as a one-time-password.
A valid OTP should consist of 32-48 printable characters.
@param string $otp
String to Validate
@return boolean
True if the OTP is valid, false on error. | [
"Validate",
"a",
"string",
"as",
"a",
"one",
"-",
"time",
"-",
"password",
".",
"A",
"valid",
"OTP",
"should",
"consist",
"of",
"32",
"-",
"48",
"printable",
"characters",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Yubikey.php#L247-L257 |
190,461 | phpsec/phpSec | lib/phpSec/Auth/Yubikey.php | Yubikey.getYubikeyId | public function getYubikeyId($otp) {
if(!$this->validOtp($otp)) {
return false;
}
$idLen = strlen($otp) - 32;
return substr($otp, 0, $idLen);
} | php | public function getYubikeyId($otp) {
if(!$this->validOtp($otp)) {
return false;
}
$idLen = strlen($otp) - 32;
return substr($otp, 0, $idLen);
} | [
"public",
"function",
"getYubikeyId",
"(",
"$",
"otp",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"validOtp",
"(",
"$",
"otp",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"idLen",
"=",
"strlen",
"(",
"$",
"otp",
")",
"-",
"32",
";",
"ret... | Get the identity of a Yubikey OTP.
The identity part is the same for every OTP, and it is the initial 2-16 modhex characters of the OTP.
Since the rest of the OTP is always 32 characters, the method to extract the identity is to remove
32 characters from the end and then use the remaining string, which should be 2-16 c... | [
"Get",
"the",
"identity",
"of",
"a",
"Yubikey",
"OTP",
".",
"The",
"identity",
"part",
"is",
"the",
"same",
"for",
"every",
"OTP",
"and",
"it",
"is",
"the",
"initial",
"2",
"-",
"16",
"modhex",
"characters",
"of",
"the",
"OTP",
".",
"Since",
"the",
"... | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Yubikey.php#L272-L279 |
190,462 | sop/x509 | lib/X509/GeneralName/IPv6Address.php | IPv6Address._wordsToIPv6String | protected static function _wordsToIPv6String(array $words): string
{
$groups = array_map(
function ($word) {
return sprintf("%04x", $word);
}, $words);
return implode(":", $groups);
} | php | protected static function _wordsToIPv6String(array $words): string
{
$groups = array_map(
function ($word) {
return sprintf("%04x", $word);
}, $words);
return implode(":", $groups);
} | [
"protected",
"static",
"function",
"_wordsToIPv6String",
"(",
"array",
"$",
"words",
")",
":",
"string",
"{",
"$",
"groups",
"=",
"array_map",
"(",
"function",
"(",
"$",
"word",
")",
"{",
"return",
"sprintf",
"(",
"\"%04x\"",
",",
"$",
"word",
")",
";",
... | Convert an array of 16 bit words to an IPv6 string representation.
@param int[] $words
@return string | [
"Convert",
"an",
"array",
"of",
"16",
"bit",
"words",
"to",
"an",
"IPv6",
"string",
"representation",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/GeneralName/IPv6Address.php#L40-L47 |
190,463 | chartmogul/chartmogul-php | src/Service/CreateTrait.php | CreateTrait.create | public static function create(array $data = [], ClientInterface $client = null)
{
return (new RequestService($client))
->setResourceClass(static::class)
->create($data);
} | php | public static function create(array $data = [], ClientInterface $client = null)
{
return (new RequestService($client))
->setResourceClass(static::class)
->create($data);
} | [
"public",
"static",
"function",
"create",
"(",
"array",
"$",
"data",
"=",
"[",
"]",
",",
"ClientInterface",
"$",
"client",
"=",
"null",
")",
"{",
"return",
"(",
"new",
"RequestService",
"(",
"$",
"client",
")",
")",
"->",
"setResourceClass",
"(",
"static... | Create a Resource
@param array $data
@param ClientInterface|null $client
@return self | [
"Create",
"a",
"Resource"
] | 1a2bcdf8b71600aaa4fb2ce40191f289fecc018e | https://github.com/chartmogul/chartmogul-php/blob/1a2bcdf8b71600aaa4fb2ce40191f289fecc018e/src/Service/CreateTrait.php#L19-L25 |
190,464 | sop/x509 | lib/X509/Certificate/Certificate.php | Certificate.equals | public function equals(Certificate $cert): bool
{
return $this->_hasEqualSerialNumber($cert) &&
$this->_hasEqualPublicKey($cert) && $this->_hasEqualSubject($cert);
} | php | public function equals(Certificate $cert): bool
{
return $this->_hasEqualSerialNumber($cert) &&
$this->_hasEqualPublicKey($cert) && $this->_hasEqualSubject($cert);
} | [
"public",
"function",
"equals",
"(",
"Certificate",
"$",
"cert",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"_hasEqualSerialNumber",
"(",
"$",
"cert",
")",
"&&",
"$",
"this",
"->",
"_hasEqualPublicKey",
"(",
"$",
"cert",
")",
"&&",
"$",
"this",
... | Check whether certificate is semantically equal to another.
@param Certificate $cert Certificate to compare to
@return bool | [
"Check",
"whether",
"certificate",
"is",
"semantically",
"equal",
"to",
"another",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Certificate.php#L153-L157 |
190,465 | sop/x509 | lib/X509/Certificate/Certificate.php | Certificate._hasEqualSerialNumber | private function _hasEqualSerialNumber(Certificate $cert): bool
{
$sn1 = $this->_tbsCertificate->serialNumber();
$sn2 = $cert->_tbsCertificate->serialNumber();
return $sn1 == $sn2;
} | php | private function _hasEqualSerialNumber(Certificate $cert): bool
{
$sn1 = $this->_tbsCertificate->serialNumber();
$sn2 = $cert->_tbsCertificate->serialNumber();
return $sn1 == $sn2;
} | [
"private",
"function",
"_hasEqualSerialNumber",
"(",
"Certificate",
"$",
"cert",
")",
":",
"bool",
"{",
"$",
"sn1",
"=",
"$",
"this",
"->",
"_tbsCertificate",
"->",
"serialNumber",
"(",
")",
";",
"$",
"sn2",
"=",
"$",
"cert",
"->",
"_tbsCertificate",
"->",... | Check whether certificate has serial number equal to another.
@param Certificate $cert
@return bool | [
"Check",
"whether",
"certificate",
"has",
"serial",
"number",
"equal",
"to",
"another",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Certificate.php#L165-L170 |
190,466 | sop/x509 | lib/X509/Certificate/Certificate.php | Certificate._hasEqualPublicKey | private function _hasEqualPublicKey(Certificate $cert): bool
{
$kid1 = $this->_tbsCertificate->subjectPublicKeyInfo()->keyIdentifier();
$kid2 = $cert->_tbsCertificate->subjectPublicKeyInfo()->keyIdentifier();
return $kid1 == $kid2;
} | php | private function _hasEqualPublicKey(Certificate $cert): bool
{
$kid1 = $this->_tbsCertificate->subjectPublicKeyInfo()->keyIdentifier();
$kid2 = $cert->_tbsCertificate->subjectPublicKeyInfo()->keyIdentifier();
return $kid1 == $kid2;
} | [
"private",
"function",
"_hasEqualPublicKey",
"(",
"Certificate",
"$",
"cert",
")",
":",
"bool",
"{",
"$",
"kid1",
"=",
"$",
"this",
"->",
"_tbsCertificate",
"->",
"subjectPublicKeyInfo",
"(",
")",
"->",
"keyIdentifier",
"(",
")",
";",
"$",
"kid2",
"=",
"$"... | Check whether certificate has public key equal to another.
@param Certificate $cert
@return bool | [
"Check",
"whether",
"certificate",
"has",
"public",
"key",
"equal",
"to",
"another",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Certificate.php#L178-L183 |
190,467 | sop/x509 | lib/X509/Certificate/Certificate.php | Certificate._hasEqualSubject | private function _hasEqualSubject(Certificate $cert): bool
{
$dn1 = $this->_tbsCertificate->subject();
$dn2 = $cert->_tbsCertificate->subject();
return $dn1->equals($dn2);
} | php | private function _hasEqualSubject(Certificate $cert): bool
{
$dn1 = $this->_tbsCertificate->subject();
$dn2 = $cert->_tbsCertificate->subject();
return $dn1->equals($dn2);
} | [
"private",
"function",
"_hasEqualSubject",
"(",
"Certificate",
"$",
"cert",
")",
":",
"bool",
"{",
"$",
"dn1",
"=",
"$",
"this",
"->",
"_tbsCertificate",
"->",
"subject",
"(",
")",
";",
"$",
"dn2",
"=",
"$",
"cert",
"->",
"_tbsCertificate",
"->",
"subjec... | Check whether certificate has subject equal to another.
@param Certificate $cert
@return bool | [
"Check",
"whether",
"certificate",
"has",
"subject",
"equal",
"to",
"another",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Certificate.php#L191-L196 |
190,468 | sop/x509 | lib/X509/CertificationRequest/Attributes.php | Attributes.extensionRequest | public function extensionRequest(): ExtensionRequestValue
{
if (!$this->hasExtensionRequest()) {
throw new \LogicException("No extension request attribute.");
}
return $this->firstOf(ExtensionRequestValue::OID)->first();
} | php | public function extensionRequest(): ExtensionRequestValue
{
if (!$this->hasExtensionRequest()) {
throw new \LogicException("No extension request attribute.");
}
return $this->firstOf(ExtensionRequestValue::OID)->first();
} | [
"public",
"function",
"extensionRequest",
"(",
")",
":",
"ExtensionRequestValue",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasExtensionRequest",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"\"No extension request attribute.\"",
")",
";",
"}"... | Get extension request attribute value.
@throws \LogicException
@return ExtensionRequestValue | [
"Get",
"extension",
"request",
"attribute",
"value",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationRequest/Attributes.php#L104-L110 |
190,469 | sop/x509 | lib/X509/GeneralName/GeneralName.php | GeneralName.equals | public function equals(GeneralName $other): bool
{
if ($this->_tag != $other->_tag) {
return false;
}
if ($this->_choiceASN1()->toDER() != $other->_choiceASN1()->toDER()) {
return false;
}
return true;
} | php | public function equals(GeneralName $other): bool
{
if ($this->_tag != $other->_tag) {
return false;
}
if ($this->_choiceASN1()->toDER() != $other->_choiceASN1()->toDER()) {
return false;
}
return true;
} | [
"public",
"function",
"equals",
"(",
"GeneralName",
"$",
"other",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"_tag",
"!=",
"$",
"other",
"->",
"_tag",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"_choiceASN1",
"("... | Check whether GeneralName is equal to other.
@param GeneralName $other GeneralName to compare to
@return boolean True if names are equal | [
"Check",
"whether",
"GeneralName",
"is",
"equal",
"to",
"other",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/GeneralName/GeneralName.php#L141-L150 |
190,470 | sop/x509 | lib/X509/GeneralName/GeneralNames.php | GeneralNames._findFirst | protected function _findFirst(int $tag)
{
foreach ($this->_names as $name) {
if ($name->tag() == $tag) {
return $name;
}
}
return null;
} | php | protected function _findFirst(int $tag)
{
foreach ($this->_names as $name) {
if ($name->tag() == $tag) {
return $name;
}
}
return null;
} | [
"protected",
"function",
"_findFirst",
"(",
"int",
"$",
"tag",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_names",
"as",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"name",
"->",
"tag",
"(",
")",
"==",
"$",
"tag",
")",
"{",
"return",
"$",
"name",
... | Find first GeneralName by given tag.
@param int $tag
@return GeneralName|null | [
"Find",
"first",
"GeneralName",
"by",
"given",
"tag",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/GeneralName/GeneralNames.php#L64-L72 |
190,471 | sop/x509 | lib/X509/GeneralName/GeneralNames.php | GeneralNames.firstOf | public function firstOf(int $tag): GeneralName
{
$name = $this->_findFirst($tag);
if (!$name) {
throw new \UnexpectedValueException("No GeneralName by tag $tag.");
}
return $name;
} | php | public function firstOf(int $tag): GeneralName
{
$name = $this->_findFirst($tag);
if (!$name) {
throw new \UnexpectedValueException("No GeneralName by tag $tag.");
}
return $name;
} | [
"public",
"function",
"firstOf",
"(",
"int",
"$",
"tag",
")",
":",
"GeneralName",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"_findFirst",
"(",
"$",
"tag",
")",
";",
"if",
"(",
"!",
"$",
"name",
")",
"{",
"throw",
"new",
"\\",
"UnexpectedValueExceptio... | Get first GeneralName of given type.
@param int $tag One of <code>GeneralName::TAG_*</code> enumerations
@throws \OutOfBoundsException
@return GeneralName | [
"Get",
"first",
"GeneralName",
"of",
"given",
"type",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/GeneralName/GeneralNames.php#L92-L99 |
190,472 | sop/x509 | lib/X509/GeneralName/GeneralNames.php | GeneralNames.allOf | public function allOf(int $tag): array
{
$names = array_filter($this->_names,
function (GeneralName $name) use ($tag) {
return $name->tag() == $tag;
});
return array_values($names);
} | php | public function allOf(int $tag): array
{
$names = array_filter($this->_names,
function (GeneralName $name) use ($tag) {
return $name->tag() == $tag;
});
return array_values($names);
} | [
"public",
"function",
"allOf",
"(",
"int",
"$",
"tag",
")",
":",
"array",
"{",
"$",
"names",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"_names",
",",
"function",
"(",
"GeneralName",
"$",
"name",
")",
"use",
"(",
"$",
"tag",
")",
"{",
"return",
"... | Get all GeneralName objects of given type.
@param int $tag One of <code>GeneralName::TAG_*</code> enumerations
@return GeneralName[] | [
"Get",
"all",
"GeneralName",
"objects",
"of",
"given",
"type",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/GeneralName/GeneralNames.php#L107-L114 |
190,473 | sop/x509 | lib/X509/GeneralName/GeneralNames.php | GeneralNames.firstDNS | public function firstDNS(): string
{
$gn = $this->firstOf(GeneralName::TAG_DNS_NAME);
if (!$gn instanceof DNSName) {
throw new \RuntimeException(
DNSName::class . " expected, got " . get_class($gn));
}
return $gn->name();
} | php | public function firstDNS(): string
{
$gn = $this->firstOf(GeneralName::TAG_DNS_NAME);
if (!$gn instanceof DNSName) {
throw new \RuntimeException(
DNSName::class . " expected, got " . get_class($gn));
}
return $gn->name();
} | [
"public",
"function",
"firstDNS",
"(",
")",
":",
"string",
"{",
"$",
"gn",
"=",
"$",
"this",
"->",
"firstOf",
"(",
"GeneralName",
"::",
"TAG_DNS_NAME",
")",
";",
"if",
"(",
"!",
"$",
"gn",
"instanceof",
"DNSName",
")",
"{",
"throw",
"new",
"\\",
"Run... | Get value of the first 'dNSName' type.
@return string | [
"Get",
"value",
"of",
"the",
"first",
"dNSName",
"type",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/GeneralName/GeneralNames.php#L121-L129 |
190,474 | sop/x509 | lib/X509/GeneralName/GeneralNames.php | GeneralNames.firstDN | public function firstDN(): Name
{
$gn = $this->firstOf(GeneralName::TAG_DIRECTORY_NAME);
if (!$gn instanceof DirectoryName) {
throw new \RuntimeException(
DirectoryName::class . " expected, got " . get_class($gn));
}
return $gn->dn();
} | php | public function firstDN(): Name
{
$gn = $this->firstOf(GeneralName::TAG_DIRECTORY_NAME);
if (!$gn instanceof DirectoryName) {
throw new \RuntimeException(
DirectoryName::class . " expected, got " . get_class($gn));
}
return $gn->dn();
} | [
"public",
"function",
"firstDN",
"(",
")",
":",
"Name",
"{",
"$",
"gn",
"=",
"$",
"this",
"->",
"firstOf",
"(",
"GeneralName",
"::",
"TAG_DIRECTORY_NAME",
")",
";",
"if",
"(",
"!",
"$",
"gn",
"instanceof",
"DirectoryName",
")",
"{",
"throw",
"new",
"\\... | Get value of the first 'directoryName' type.
@return Name | [
"Get",
"value",
"of",
"the",
"first",
"directoryName",
"type",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/GeneralName/GeneralNames.php#L136-L144 |
190,475 | sop/x509 | lib/X509/GeneralName/GeneralNames.php | GeneralNames.firstURI | public function firstURI(): string
{
$gn = $this->firstOf(GeneralName::TAG_URI);
if (!$gn instanceof UniformResourceIdentifier) {
throw new \RuntimeException(
UniformResourceIdentifier::class . " expected, got " .
get_class($gn));
}
re... | php | public function firstURI(): string
{
$gn = $this->firstOf(GeneralName::TAG_URI);
if (!$gn instanceof UniformResourceIdentifier) {
throw new \RuntimeException(
UniformResourceIdentifier::class . " expected, got " .
get_class($gn));
}
re... | [
"public",
"function",
"firstURI",
"(",
")",
":",
"string",
"{",
"$",
"gn",
"=",
"$",
"this",
"->",
"firstOf",
"(",
"GeneralName",
"::",
"TAG_URI",
")",
";",
"if",
"(",
"!",
"$",
"gn",
"instanceof",
"UniformResourceIdentifier",
")",
"{",
"throw",
"new",
... | Get value of the first 'uniformResourceIdentifier' type.
@return string | [
"Get",
"value",
"of",
"the",
"first",
"uniformResourceIdentifier",
"type",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/GeneralName/GeneralNames.php#L151-L160 |
190,476 | phpsec/phpSec | lib/phpSec/Common/Cache.php | Cache.cacheGet | public function cacheGet($name) {
/* Do cache garbage collection. */
$this->cacheGc();
try {
$data = $this->store->read('cache', $this->cacheId($name));
} catch (\phpSec\Exception $e) {
return false;
}
if($data ==! false) {
if($data['ttl'] > time()) {
return unserializ... | php | public function cacheGet($name) {
/* Do cache garbage collection. */
$this->cacheGc();
try {
$data = $this->store->read('cache', $this->cacheId($name));
} catch (\phpSec\Exception $e) {
return false;
}
if($data ==! false) {
if($data['ttl'] > time()) {
return unserializ... | [
"public",
"function",
"cacheGet",
"(",
"$",
"name",
")",
"{",
"/* Do cache garbage collection. */",
"$",
"this",
"->",
"cacheGc",
"(",
")",
";",
"try",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"store",
"->",
"read",
"(",
"'cache'",
",",
"$",
"this",
"... | Get data from the cache.
@param string $name
String containing the name of the data to get.
@return mixed
Returns data in it's original form, or false if no data stored. | [
"Get",
"data",
"from",
"the",
"cache",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Common/Cache.php#L78-L94 |
190,477 | phpsec/phpSec | lib/phpSec/Common/Cache.php | Cache.cacheGc | private function cacheGc() {
$probMax = 1 / self::GC_PROB;
$do = rand(1, $probMax);
if($do > 1) {
/* Skipping GC this time. */
return false;
}
$cahceIds = $this->store->listIds('cache');
foreach($cahceIds as $cahceId) {
try {
$data = $this->store->read('cache', $cahceId... | php | private function cacheGc() {
$probMax = 1 / self::GC_PROB;
$do = rand(1, $probMax);
if($do > 1) {
/* Skipping GC this time. */
return false;
}
$cahceIds = $this->store->listIds('cache');
foreach($cahceIds as $cahceId) {
try {
$data = $this->store->read('cache', $cahceId... | [
"private",
"function",
"cacheGc",
"(",
")",
"{",
"$",
"probMax",
"=",
"1",
"/",
"self",
"::",
"GC_PROB",
";",
"$",
"do",
"=",
"rand",
"(",
"1",
",",
"$",
"probMax",
")",
";",
"if",
"(",
"$",
"do",
">",
"1",
")",
"{",
"/* Skipping GC this time. */",... | Do garbage collection on cached data. | [
"Do",
"garbage",
"collection",
"on",
"cached",
"data",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Common/Cache.php#L112-L133 |
190,478 | phpsec/phpSec | lib/phpSec/Auth/Otp.php | Otp.validate | public function validate($otp, $action, $uid = null, $data = null) {
$hash = $this->psl['crypt/hash'];
$store = $this->psl['store'];
if($uid === null) {
$uid = $this->psl->getUid();
}
$storeData = $store->read('otp', $this->storeId($uid, $action));
if($storeData !== false) {
if($s... | php | public function validate($otp, $action, $uid = null, $data = null) {
$hash = $this->psl['crypt/hash'];
$store = $this->psl['store'];
if($uid === null) {
$uid = $this->psl->getUid();
}
$storeData = $store->read('otp', $this->storeId($uid, $action));
if($storeData !== false) {
if($s... | [
"public",
"function",
"validate",
"(",
"$",
"otp",
",",
"$",
"action",
",",
"$",
"uid",
"=",
"null",
",",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"hash",
"=",
"$",
"this",
"->",
"psl",
"[",
"'crypt/hash'",
"]",
";",
"$",
"store",
"=",
"$",
"th... | Validate a one-time-password.
@param strgin $otp
OTP supplied by user.
@param string $action
See phpsecOtp::generate().
@param string $uid
See phpsecOtp::generate().
@param array $data
See phpsecOtp::generate(). | [
"Validate",
"a",
"one",
"-",
"time",
"-",
"password",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Otp.php#L99-L121 |
190,479 | sop/x509 | lib/X509/Certificate/Extension/CertificatePoliciesExtension.php | CertificatePoliciesExtension.get | public function get(string $oid): PolicyInformation
{
if (!$this->has($oid)) {
throw new \LogicException("Not certificate policy by OID $oid.");
}
return $this->_policies[$oid];
} | php | public function get(string $oid): PolicyInformation
{
if (!$this->has($oid)) {
throw new \LogicException("Not certificate policy by OID $oid.");
}
return $this->_policies[$oid];
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"oid",
")",
":",
"PolicyInformation",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"oid",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"\"Not certificate policy by OID $oid.\"",
")... | Get policy information by OID.
@param string $oid
@throws \LogicException
@return PolicyInformation | [
"Get",
"policy",
"information",
"by",
"OID",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/CertificatePoliciesExtension.php#L79-L85 |
190,480 | phpsec/phpSec | lib/phpSec/Common/Token.php | Token.set | public function set($name, $ttl = 3600) {
$rand = $this->psl['crypt/rand'];
$cache = $this->psl['cache'];
$token = $rand->str(32, $this->_charset);
/* Save the token to the cahce. */
$cache->cacheSet('token-'.$name, $token, $ttl);
return $token;
} | php | public function set($name, $ttl = 3600) {
$rand = $this->psl['crypt/rand'];
$cache = $this->psl['cache'];
$token = $rand->str(32, $this->_charset);
/* Save the token to the cahce. */
$cache->cacheSet('token-'.$name, $token, $ttl);
return $token;
} | [
"public",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"ttl",
"=",
"3600",
")",
"{",
"$",
"rand",
"=",
"$",
"this",
"->",
"psl",
"[",
"'crypt/rand'",
"]",
";",
"$",
"cache",
"=",
"$",
"this",
"->",
"psl",
"[",
"'cache'",
"]",
";",
"$",
"token... | Generate and save a one-time-token for a form. Used to protect against
CSRF attacks.
@param string $name
Name of the form to generate a token for.
@param integer $ttl
How long the token should be valid in seconds.
@return string
The token to supply with the form data. | [
"Generate",
"and",
"save",
"a",
"one",
"-",
"time",
"-",
"token",
"for",
"a",
"form",
".",
"Used",
"to",
"protect",
"against",
"CSRF",
"attacks",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Common/Token.php#L48-L56 |
190,481 | sop/x509 | lib/X509/CertificationPath/PathValidation/ValidatorState.php | ValidatorState.initialize | public static function initialize(PathValidationConfig $config,
Certificate $trust_anchor, $n)
{
$state = new self();
$state->_pathLength = $n;
$state->_index = 1;
$state->_validPolicyTree = new PolicyTree(PolicyNode::anyPolicyNode());
$state->_permittedSubtrees = nul... | php | public static function initialize(PathValidationConfig $config,
Certificate $trust_anchor, $n)
{
$state = new self();
$state->_pathLength = $n;
$state->_index = 1;
$state->_validPolicyTree = new PolicyTree(PolicyNode::anyPolicyNode());
$state->_permittedSubtrees = nul... | [
"public",
"static",
"function",
"initialize",
"(",
"PathValidationConfig",
"$",
"config",
",",
"Certificate",
"$",
"trust_anchor",
",",
"$",
"n",
")",
"{",
"$",
"state",
"=",
"new",
"self",
"(",
")",
";",
"$",
"state",
"->",
"_pathLength",
"=",
"$",
"n",... | Initialize variables according to RFC 5280 6.1.2.
@link https://tools.ietf.org/html/rfc5280#section-6.1.2
@param PathValidationConfig $config
@param Certificate $trust_anchor Trust anchor certificate
@param int $n Number of certificates in the certification path
@return self | [
"Initialize",
"variables",
"according",
"to",
"RFC",
"5280",
"6",
".",
"1",
".",
"2",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/ValidatorState.php#L161-L181 |
190,482 | sop/x509 | lib/X509/CertificationPath/PathValidation/ValidatorState.php | ValidatorState.withIndex | public function withIndex(int $index): self
{
$state = clone $this;
$state->_index = $index;
return $state;
} | php | public function withIndex(int $index): self
{
$state = clone $this;
$state->_index = $index;
return $state;
} | [
"public",
"function",
"withIndex",
"(",
"int",
"$",
"index",
")",
":",
"self",
"{",
"$",
"state",
"=",
"clone",
"$",
"this",
";",
"$",
"state",
"->",
"_index",
"=",
"$",
"index",
";",
"return",
"$",
"state",
";",
"}"
] | Get self with current certification path index set.
@param int $index
@return self | [
"Get",
"self",
"with",
"current",
"certification",
"path",
"index",
"set",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/ValidatorState.php#L189-L194 |
190,483 | sop/x509 | lib/X509/CertificationPath/PathValidation/ValidatorState.php | ValidatorState.withValidPolicyTree | public function withValidPolicyTree(PolicyTree $policy_tree): self
{
$state = clone $this;
$state->_validPolicyTree = $policy_tree;
return $state;
} | php | public function withValidPolicyTree(PolicyTree $policy_tree): self
{
$state = clone $this;
$state->_validPolicyTree = $policy_tree;
return $state;
} | [
"public",
"function",
"withValidPolicyTree",
"(",
"PolicyTree",
"$",
"policy_tree",
")",
":",
"self",
"{",
"$",
"state",
"=",
"clone",
"$",
"this",
";",
"$",
"state",
"->",
"_validPolicyTree",
"=",
"$",
"policy_tree",
";",
"return",
"$",
"state",
";",
"}"
... | Get self with valid_policy_tree.
@param PolicyTree $policy_tree
@return self | [
"Get",
"self",
"with",
"valid_policy_tree",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/ValidatorState.php#L202-L207 |
190,484 | sop/x509 | lib/X509/CertificationPath/PathValidation/ValidatorState.php | ValidatorState.withExplicitPolicy | public function withExplicitPolicy(int $num): self
{
$state = clone $this;
$state->_explicitPolicy = $num;
return $state;
} | php | public function withExplicitPolicy(int $num): self
{
$state = clone $this;
$state->_explicitPolicy = $num;
return $state;
} | [
"public",
"function",
"withExplicitPolicy",
"(",
"int",
"$",
"num",
")",
":",
"self",
"{",
"$",
"state",
"=",
"clone",
"$",
"this",
";",
"$",
"state",
"->",
"_explicitPolicy",
"=",
"$",
"num",
";",
"return",
"$",
"state",
";",
"}"
] | Get self with explicit_policy.
@param int $num
@return self | [
"Get",
"self",
"with",
"explicit_policy",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/ValidatorState.php#L227-L232 |
190,485 | sop/x509 | lib/X509/CertificationPath/PathValidation/ValidatorState.php | ValidatorState.withInhibitAnyPolicy | public function withInhibitAnyPolicy(int $num): self
{
$state = clone $this;
$state->_inhibitAnyPolicy = $num;
return $state;
} | php | public function withInhibitAnyPolicy(int $num): self
{
$state = clone $this;
$state->_inhibitAnyPolicy = $num;
return $state;
} | [
"public",
"function",
"withInhibitAnyPolicy",
"(",
"int",
"$",
"num",
")",
":",
"self",
"{",
"$",
"state",
"=",
"clone",
"$",
"this",
";",
"$",
"state",
"->",
"_inhibitAnyPolicy",
"=",
"$",
"num",
";",
"return",
"$",
"state",
";",
"}"
] | Get self with inhibit_anyPolicy.
@param int $num
@return self | [
"Get",
"self",
"with",
"inhibit_anyPolicy",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/ValidatorState.php#L240-L245 |
190,486 | sop/x509 | lib/X509/CertificationPath/PathValidation/ValidatorState.php | ValidatorState.withPolicyMapping | public function withPolicyMapping(int $num): self
{
$state = clone $this;
$state->_policyMapping = $num;
return $state;
} | php | public function withPolicyMapping(int $num): self
{
$state = clone $this;
$state->_policyMapping = $num;
return $state;
} | [
"public",
"function",
"withPolicyMapping",
"(",
"int",
"$",
"num",
")",
":",
"self",
"{",
"$",
"state",
"=",
"clone",
"$",
"this",
";",
"$",
"state",
"->",
"_policyMapping",
"=",
"$",
"num",
";",
"return",
"$",
"state",
";",
"}"
] | Get self with policy_mapping.
@param int $num
@return self | [
"Get",
"self",
"with",
"policy_mapping",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/ValidatorState.php#L253-L258 |
190,487 | sop/x509 | lib/X509/CertificationPath/PathValidation/ValidatorState.php | ValidatorState.withWorkingPublicKeyAlgorithm | public function withWorkingPublicKeyAlgorithm(AlgorithmIdentifierType $algo): self
{
$state = clone $this;
$state->_workingPublicKeyAlgorithm = $algo;
return $state;
} | php | public function withWorkingPublicKeyAlgorithm(AlgorithmIdentifierType $algo): self
{
$state = clone $this;
$state->_workingPublicKeyAlgorithm = $algo;
return $state;
} | [
"public",
"function",
"withWorkingPublicKeyAlgorithm",
"(",
"AlgorithmIdentifierType",
"$",
"algo",
")",
":",
"self",
"{",
"$",
"state",
"=",
"clone",
"$",
"this",
";",
"$",
"state",
"->",
"_workingPublicKeyAlgorithm",
"=",
"$",
"algo",
";",
"return",
"$",
"st... | Get self with working_public_key_algorithm.
@param AlgorithmIdentifierType $algo
@return self | [
"Get",
"self",
"with",
"working_public_key_algorithm",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/ValidatorState.php#L266-L271 |
190,488 | sop/x509 | lib/X509/CertificationPath/PathValidation/ValidatorState.php | ValidatorState.withWorkingPublicKey | public function withWorkingPublicKey(PublicKeyInfo $pubkey_info): self
{
$state = clone $this;
$state->_workingPublicKey = $pubkey_info;
return $state;
} | php | public function withWorkingPublicKey(PublicKeyInfo $pubkey_info): self
{
$state = clone $this;
$state->_workingPublicKey = $pubkey_info;
return $state;
} | [
"public",
"function",
"withWorkingPublicKey",
"(",
"PublicKeyInfo",
"$",
"pubkey_info",
")",
":",
"self",
"{",
"$",
"state",
"=",
"clone",
"$",
"this",
";",
"$",
"state",
"->",
"_workingPublicKey",
"=",
"$",
"pubkey_info",
";",
"return",
"$",
"state",
";",
... | Get self with working_public_key.
@param PublicKeyInfo $pubkey_info
@return self | [
"Get",
"self",
"with",
"working_public_key",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/ValidatorState.php#L279-L284 |
190,489 | sop/x509 | lib/X509/CertificationPath/PathValidation/ValidatorState.php | ValidatorState.withWorkingPublicKeyParameters | public function withWorkingPublicKeyParameters(Element $params = null): self
{
$state = clone $this;
$state->_workingPublicKeyParameters = $params;
return $state;
} | php | public function withWorkingPublicKeyParameters(Element $params = null): self
{
$state = clone $this;
$state->_workingPublicKeyParameters = $params;
return $state;
} | [
"public",
"function",
"withWorkingPublicKeyParameters",
"(",
"Element",
"$",
"params",
"=",
"null",
")",
":",
"self",
"{",
"$",
"state",
"=",
"clone",
"$",
"this",
";",
"$",
"state",
"->",
"_workingPublicKeyParameters",
"=",
"$",
"params",
";",
"return",
"$"... | Get self with working_public_key_parameters.
@param Element|null $params
@return self | [
"Get",
"self",
"with",
"working_public_key_parameters",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/ValidatorState.php#L292-L297 |
190,490 | sop/x509 | lib/X509/CertificationPath/PathValidation/ValidatorState.php | ValidatorState.withWorkingIssuerName | public function withWorkingIssuerName(Name $issuer): self
{
$state = clone $this;
$state->_workingIssuerName = $issuer;
return $state;
} | php | public function withWorkingIssuerName(Name $issuer): self
{
$state = clone $this;
$state->_workingIssuerName = $issuer;
return $state;
} | [
"public",
"function",
"withWorkingIssuerName",
"(",
"Name",
"$",
"issuer",
")",
":",
"self",
"{",
"$",
"state",
"=",
"clone",
"$",
"this",
";",
"$",
"state",
"->",
"_workingIssuerName",
"=",
"$",
"issuer",
";",
"return",
"$",
"state",
";",
"}"
] | Get self with working_issuer_name.
@param Name $issuer
@return self | [
"Get",
"self",
"with",
"working_issuer_name",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/ValidatorState.php#L305-L310 |
190,491 | sop/x509 | lib/X509/CertificationPath/PathValidation/ValidatorState.php | ValidatorState.withMaxPathLength | public function withMaxPathLength(int $length): self
{
$state = clone $this;
$state->_maxPathLength = $length;
return $state;
} | php | public function withMaxPathLength(int $length): self
{
$state = clone $this;
$state->_maxPathLength = $length;
return $state;
} | [
"public",
"function",
"withMaxPathLength",
"(",
"int",
"$",
"length",
")",
":",
"self",
"{",
"$",
"state",
"=",
"clone",
"$",
"this",
";",
"$",
"state",
"->",
"_maxPathLength",
"=",
"$",
"length",
";",
"return",
"$",
"state",
";",
"}"
] | Get self with max_path_length.
@param int $length
@return self | [
"Get",
"self",
"with",
"max_path_length",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/ValidatorState.php#L318-L323 |
190,492 | sop/x509 | lib/X509/CertificationPath/PathValidation/ValidatorState.php | ValidatorState.getResult | public function getResult(array $certificates): PathValidationResult
{
return new PathValidationResult($certificates, $this->_validPolicyTree,
$this->_workingPublicKey, $this->_workingPublicKeyAlgorithm,
$this->_workingPublicKeyParameters);
} | php | public function getResult(array $certificates): PathValidationResult
{
return new PathValidationResult($certificates, $this->_validPolicyTree,
$this->_workingPublicKey, $this->_workingPublicKeyAlgorithm,
$this->_workingPublicKeyParameters);
} | [
"public",
"function",
"getResult",
"(",
"array",
"$",
"certificates",
")",
":",
"PathValidationResult",
"{",
"return",
"new",
"PathValidationResult",
"(",
"$",
"certificates",
",",
"$",
"this",
"->",
"_validPolicyTree",
",",
"$",
"this",
"->",
"_workingPublicKey",... | Get the path validation result.
@param Certificate[] $certificates Certificates in a certification path
@return PathValidationResult | [
"Get",
"the",
"path",
"validation",
"result",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/ValidatorState.php#L485-L490 |
190,493 | sop/x509 | lib/X509/CertificationPath/PathValidation/ValidatorState.php | ValidatorState.getAlgorithmParameters | public static function getAlgorithmParameters(AlgorithmIdentifierType $algo)
{
$seq = $algo->toASN1();
return $seq->has(1) ? $seq->at(1)->asElement() : null;
} | php | public static function getAlgorithmParameters(AlgorithmIdentifierType $algo)
{
$seq = $algo->toASN1();
return $seq->has(1) ? $seq->at(1)->asElement() : null;
} | [
"public",
"static",
"function",
"getAlgorithmParameters",
"(",
"AlgorithmIdentifierType",
"$",
"algo",
")",
"{",
"$",
"seq",
"=",
"$",
"algo",
"->",
"toASN1",
"(",
")",
";",
"return",
"$",
"seq",
"->",
"has",
"(",
"1",
")",
"?",
"$",
"seq",
"->",
"at",... | Get ASN.1 parameters from algorithm identifier.
@param AlgorithmIdentifierType $algo
@return Element|null ASN.1 element or null if parameters are omitted | [
"Get",
"ASN",
".",
"1",
"parameters",
"from",
"algorithm",
"identifier",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/ValidatorState.php#L498-L502 |
190,494 | phpsec/phpSec | lib/phpSec/Crypt/Crypto.php | Crypto.pbkdf2 | public function pbkdf2($p, $s, $c, $dkLen, $a = 'sha256') {
$hLen = strlen(hash($a, null, true)); /* Hash length. */
$l = ceil($dkLen / $hLen); /* Length in blocks of derived key. */
$dk = ''; /* Derived key. */
/* Step 1. Check dkLen. */
if($dkLen > (2^32-1) ... | php | public function pbkdf2($p, $s, $c, $dkLen, $a = 'sha256') {
$hLen = strlen(hash($a, null, true)); /* Hash length. */
$l = ceil($dkLen / $hLen); /* Length in blocks of derived key. */
$dk = ''; /* Derived key. */
/* Step 1. Check dkLen. */
if($dkLen > (2^32-1) ... | [
"public",
"function",
"pbkdf2",
"(",
"$",
"p",
",",
"$",
"s",
",",
"$",
"c",
",",
"$",
"dkLen",
",",
"$",
"a",
"=",
"'sha256'",
")",
"{",
"$",
"hLen",
"=",
"strlen",
"(",
"hash",
"(",
"$",
"a",
",",
"null",
",",
"true",
")",
")",
";",
"/* H... | Implement PBKDF2 as described in RFC 2898.
@param string $p
Password to protect.
@param string $s
Salt.
@param integer $c
Iteration count.
@param integer $dkLen
Derived key length.
@param string $a
A hash algorithm.
@return binary
Derived key. | [
"Implement",
"PBKDF2",
"as",
"described",
"in",
"RFC",
"2898",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Crypt/Crypto.php#L203-L227 |
190,495 | phpsec/phpSec | lib/phpSec/Crypt/Crypto.php | Crypto.stripPadding | public function stripPadding($block, $data) {
$pad = ord($data[($len = strlen($data)) - 1]);
/* Check that what we have at the end of the string really is padding, and if it is remove it. */
if ($pad && $pad < $block && preg_match('/' . chr($pad) . '{' . $pad . '}$/', $data)) {
return substr($data, 0... | php | public function stripPadding($block, $data) {
$pad = ord($data[($len = strlen($data)) - 1]);
/* Check that what we have at the end of the string really is padding, and if it is remove it. */
if ($pad && $pad < $block && preg_match('/' . chr($pad) . '{' . $pad . '}$/', $data)) {
return substr($data, 0... | [
"public",
"function",
"stripPadding",
"(",
"$",
"block",
",",
"$",
"data",
")",
"{",
"$",
"pad",
"=",
"ord",
"(",
"$",
"data",
"[",
"(",
"$",
"len",
"=",
"strlen",
"(",
"$",
"data",
")",
")",
"-",
"1",
"]",
")",
";",
"/* Check that what we have at ... | Strip PKCS7-padding.
@param integer $block
Block size.
@param string $data
Padded data.
@return string
Original data. | [
"Strip",
"PKCS7",
"-",
"padding",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Crypt/Crypto.php#L263-L271 |
190,496 | phpsec/phpSec | lib/phpSec/Text/Filter.php | Filter.t | public function t($str, $args) {
/* Loop trough the args and apply the filters. */
while(list($name, $data) = each($args)) {
$safeData = false;
$filterType = mb_substr($name, 0, 1);
switch($filterType) {
case '%':
/* %variables: HTML tags are stripped of from the string
... | php | public function t($str, $args) {
/* Loop trough the args and apply the filters. */
while(list($name, $data) = each($args)) {
$safeData = false;
$filterType = mb_substr($name, 0, 1);
switch($filterType) {
case '%':
/* %variables: HTML tags are stripped of from the string
... | [
"public",
"function",
"t",
"(",
"$",
"str",
",",
"$",
"args",
")",
"{",
"/* Loop trough the args and apply the filters. */",
"while",
"(",
"list",
"(",
"$",
"name",
",",
"$",
"data",
")",
"=",
"each",
"(",
"$",
"args",
")",
")",
"{",
"$",
"safeData",
"... | XSS text filter. Returns a string that is safe to use on the page.
There are three types of variables:
%variables: stip mode of phpsec::f() is used.
!variables: escapeAll mode of phpsec::f() is used.
@variables: escape mode of phpsec::f() is used.
&variables: url mode of phpsec::f() is used.
@see phpsec::f()
@see htt... | [
"XSS",
"text",
"filter",
".",
"Returns",
"a",
"string",
"that",
"is",
"safe",
"to",
"use",
"on",
"the",
"page",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Text/Filter.php#L44-L79 |
190,497 | phpsec/phpSec | lib/phpSec/Text/Filter.php | Filter.f | public function f($str, $mode = 'escape') {
switch($mode) {
case 'strip':
/* HTML tags are stripped from the string
before it is used. */
return strip_tags($str);
case 'escapeAll':
/* HTML and special characters are escaped from the string
before it is used.... | php | public function f($str, $mode = 'escape') {
switch($mode) {
case 'strip':
/* HTML tags are stripped from the string
before it is used. */
return strip_tags($str);
case 'escapeAll':
/* HTML and special characters are escaped from the string
before it is used.... | [
"public",
"function",
"f",
"(",
"$",
"str",
",",
"$",
"mode",
"=",
"'escape'",
")",
"{",
"switch",
"(",
"$",
"mode",
")",
"{",
"case",
"'strip'",
":",
"/* HTML tags are stripped from the string\n before it is used. */",
"return",
"strip_tags",
"(",
"$",
... | XSS filter. Returns a string that is safe to use on the page.
There are three modes:
strip: HTML is stripped from the string
before it is inserted.
escapeAll: HTML and special characters is escaped from the string
before it is inserted.
escape: Only HTML is escaped from the string. Special characters
is kept as is.
ur... | [
"XSS",
"filter",
".",
"Returns",
"a",
"string",
"that",
"is",
"safe",
"to",
"use",
"on",
"the",
"page",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Text/Filter.php#L103-L126 |
190,498 | sop/x509 | lib/X509/Certificate/CertificateBundle.php | CertificateBundle.withCertificates | public function withCertificates(Certificate ...$cert): self
{
$obj = clone $this;
$obj->_certs = array_merge($obj->_certs, $cert);
return $obj;
} | php | public function withCertificates(Certificate ...$cert): self
{
$obj = clone $this;
$obj->_certs = array_merge($obj->_certs, $cert);
return $obj;
} | [
"public",
"function",
"withCertificates",
"(",
"Certificate",
"...",
"$",
"cert",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_certs",
"=",
"array_merge",
"(",
"$",
"obj",
"->",
"_certs",
",",
"$",
"cert",
")... | Get self with certificates added.
@param Certificate ...$cert
@return self | [
"Get",
"self",
"with",
"certificates",
"added",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/CertificateBundle.php#L79-L84 |
190,499 | sop/x509 | lib/X509/Certificate/CertificateBundle.php | CertificateBundle.withPEMBundle | public function withPEMBundle(PEMBundle $pem_bundle): self
{
$certs = $this->_certs;
foreach ($pem_bundle as $pem) {
$certs[] = Certificate::fromPEM($pem);
}
return new self(...$certs);
} | php | public function withPEMBundle(PEMBundle $pem_bundle): self
{
$certs = $this->_certs;
foreach ($pem_bundle as $pem) {
$certs[] = Certificate::fromPEM($pem);
}
return new self(...$certs);
} | [
"public",
"function",
"withPEMBundle",
"(",
"PEMBundle",
"$",
"pem_bundle",
")",
":",
"self",
"{",
"$",
"certs",
"=",
"$",
"this",
"->",
"_certs",
";",
"foreach",
"(",
"$",
"pem_bundle",
"as",
"$",
"pem",
")",
"{",
"$",
"certs",
"[",
"]",
"=",
"Certi... | Get self with certificates from PEMBundle added.
@param PEMBundle $pem_bundle
@return self | [
"Get",
"self",
"with",
"certificates",
"from",
"PEMBundle",
"added",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/CertificateBundle.php#L92-L99 |
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.