CoreFiles by mySites.guru
InhibitAnyPolicyExtension.php44 lines, 1,085 bytes, from Joomla_5.2.5-Stable-Full_Package.zip
Raw History Compare with 5.2.4
md5
fb468af438be9f977352a01f56a95c9f
sha1
41cfc31fa2298d3361db29bf51336f93613ebc5e
sha256
3310bd5475dbf060ab93c8964e0f3537ccebf2ea4e6d8911c5f2f1e3489e600f
<?php

declare(strict_types=1);

namespace SpomkyLabs\Pki\X509\Certificate\Extension;

use SpomkyLabs\Pki\ASN1\Element;
use SpomkyLabs\Pki\ASN1\Type\Primitive\Integer;
use SpomkyLabs\Pki\ASN1\Type\UnspecifiedType;

/**
 * Implements 'Inhibit anyPolicy' extension.
 *
 * @see https://tools.ietf.org/html/rfc5280#section-4.2.1.14
 */
final class InhibitAnyPolicyExtension extends Extension
{
    private function __construct(
        bool $critical,
        private readonly int $skipCerts
    ) {
        parent::__construct(self::OID_INHIBIT_ANY_POLICY, $critical);
    }

    public static function create(bool $critical, int $skipCerts): self
    {
        return new self($critical, $skipCerts);
    }

    public function skipCerts(): int
    {
        return $this->skipCerts;
    }

    protected static function fromDER(string $data, bool $critical): static
    {
        return self::create($critical, UnspecifiedType::fromDER($data)->asInteger()->intNumber());
    }

    protected function valueASN1(): Element
    {
        return Integer::create($this->skipCerts);
    }
}

The same content is in 158 releases, Joomla 5.0.0-alpha1 to 6.3.0-alpha1. See them all, or every version of this file.