GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 91afec...2569ae )
by Joni
05:59
created
lib/X509/GeneralName/IPv4Address.php 2 patches
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@
 block discarded – undo
16 16
         $mask = null;
17 17
         $bytes = unpack("C*", $octets);
18 18
         switch (count($bytes)) {
19
-            case 4:
20
-                $ip = implode(".", $bytes);
21
-                break;
22
-            case 8:
23
-                $ip = implode(".", array_slice($bytes, 0, 4));
24
-                $mask = implode(".", array_slice($bytes, 4, 4));
25
-                break;
26
-            default:
27
-                throw new \UnexpectedValueException("Invalid IPv4 octet length.");
19
+        case 4:
20
+            $ip = implode(".", $bytes);
21
+            break;
22
+        case 8:
23
+            $ip = implode(".", array_slice($bytes, 0, 4));
24
+            $mask = implode(".", array_slice($bytes, 4, 4));
25
+            break;
26
+        default:
27
+            throw new \UnexpectedValueException("Invalid IPv4 octet length.");
28 28
         }
29 29
         return new self($ip, $mask);
30 30
     }
Please login to merge, or discard this patch.
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -6,42 +6,42 @@
 block discarded – undo
6 6
 
7 7
 class IPv4Address extends IPAddress
8 8
 {
9
-    /**
10
-     * Initialize from octets.
11
-     *
12
-     * @param string $octets
13
-     * @throws \InvalidArgumentException
14
-     * @return self
15
-     */
16
-    public static function fromOctets(string $octets): self
17
-    {
18
-        $mask = null;
19
-        $bytes = unpack("C*", $octets);
20
-        switch (count($bytes)) {
21
-            case 4:
22
-                $ip = implode(".", $bytes);
23
-                break;
24
-            case 8:
25
-                $ip = implode(".", array_slice($bytes, 0, 4));
26
-                $mask = implode(".", array_slice($bytes, 4, 4));
27
-                break;
28
-            default:
29
-                throw new \UnexpectedValueException("Invalid IPv4 octet length.");
30
-        }
31
-        return new self($ip, $mask);
32
-    }
9
+	/**
10
+	 * Initialize from octets.
11
+	 *
12
+	 * @param string $octets
13
+	 * @throws \InvalidArgumentException
14
+	 * @return self
15
+	 */
16
+	public static function fromOctets(string $octets): self
17
+	{
18
+		$mask = null;
19
+		$bytes = unpack("C*", $octets);
20
+		switch (count($bytes)) {
21
+			case 4:
22
+				$ip = implode(".", $bytes);
23
+				break;
24
+			case 8:
25
+				$ip = implode(".", array_slice($bytes, 0, 4));
26
+				$mask = implode(".", array_slice($bytes, 4, 4));
27
+				break;
28
+			default:
29
+				throw new \UnexpectedValueException("Invalid IPv4 octet length.");
30
+		}
31
+		return new self($ip, $mask);
32
+	}
33 33
     
34
-    /**
35
-     *
36
-     * {@inheritdoc}
37
-     */
38
-    protected function _octets(): string
39
-    {
40
-        $bytes = array_map("intval", explode(".", $this->_ip));
41
-        if (isset($this->_mask)) {
42
-            $bytes = array_merge($bytes,
43
-                array_map("intval", explode(".", $this->_mask)));
44
-        }
45
-        return pack("C*", ...$bytes);
46
-    }
34
+	/**
35
+	 *
36
+	 * {@inheritdoc}
37
+	 */
38
+	protected function _octets(): string
39
+	{
40
+		$bytes = array_map("intval", explode(".", $this->_ip));
41
+		if (isset($this->_mask)) {
42
+			$bytes = array_merge($bytes,
43
+				array_map("intval", explode(".", $this->_mask)));
44
+		}
45
+		return pack("C*", ...$bytes);
46
+	}
47 47
 }
Please login to merge, or discard this patch.
lib/X509/GeneralName/IPAddress.php 2 patches
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -59,15 +59,15 @@
 block discarded – undo
59 59
     {
60 60
         $octets = $el->asOctetString()->string();
61 61
         switch (strlen($octets)) {
62
-            case 4:
63
-            case 8:
64
-                return IPv4Address::fromOctets($octets);
65
-            case 16:
66
-            case 32:
67
-                return IPv6Address::fromOctets($octets);
68
-            default:
69
-                throw new \UnexpectedValueException(
70
-                    "Invalid octet length for IP address.");
62
+        case 4:
63
+        case 8:
64
+            return IPv4Address::fromOctets($octets);
65
+        case 16:
66
+        case 32:
67
+            return IPv6Address::fromOctets($octets);
68
+        default:
69
+            throw new \UnexpectedValueException(
70
+                "Invalid octet length for IP address.");
71 71
         }
72 72
     }
73 73
     
Please login to merge, or discard this patch.
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -19,97 +19,97 @@
 block discarded – undo
19 19
  */
20 20
 abstract class IPAddress extends GeneralName
21 21
 {
22
-    /**
23
-     * IP address.
24
-     *
25
-     * @var string $_ip
26
-     */
27
-    protected $_ip;
22
+	/**
23
+	 * IP address.
24
+	 *
25
+	 * @var string $_ip
26
+	 */
27
+	protected $_ip;
28 28
     
29
-    /**
30
-     * Subnet mask.
31
-     *
32
-     * @var string|null $_mask
33
-     */
34
-    protected $_mask;
29
+	/**
30
+	 * Subnet mask.
31
+	 *
32
+	 * @var string|null $_mask
33
+	 */
34
+	protected $_mask;
35 35
     
36
-    /**
37
-     * Get octet representation of the IP address.
38
-     *
39
-     * @return string
40
-     */
41
-    abstract protected function _octets();
36
+	/**
37
+	 * Get octet representation of the IP address.
38
+	 *
39
+	 * @return string
40
+	 */
41
+	abstract protected function _octets();
42 42
     
43
-    /**
44
-     * Constructor.
45
-     *
46
-     * @param string $ip
47
-     * @param string|null $mask
48
-     */
49
-    public function __construct(string $ip, $mask = null)
50
-    {
51
-        $this->_tag = self::TAG_IP_ADDRESS;
52
-        $this->_ip = $ip;
53
-        $this->_mask = $mask;
54
-    }
43
+	/**
44
+	 * Constructor.
45
+	 *
46
+	 * @param string $ip
47
+	 * @param string|null $mask
48
+	 */
49
+	public function __construct(string $ip, $mask = null)
50
+	{
51
+		$this->_tag = self::TAG_IP_ADDRESS;
52
+		$this->_ip = $ip;
53
+		$this->_mask = $mask;
54
+	}
55 55
     
56
-    /**
57
-     *
58
-     * @param UnspecifiedType $el
59
-     * @return self
60
-     */
61
-    public static function fromChosenASN1(UnspecifiedType $el): self
62
-    {
63
-        $octets = $el->asOctetString()->string();
64
-        switch (strlen($octets)) {
65
-            case 4:
66
-            case 8:
67
-                return IPv4Address::fromOctets($octets);
68
-            case 16:
69
-            case 32:
70
-                return IPv6Address::fromOctets($octets);
71
-            default:
72
-                throw new \UnexpectedValueException(
73
-                    "Invalid octet length for IP address.");
74
-        }
75
-    }
56
+	/**
57
+	 *
58
+	 * @param UnspecifiedType $el
59
+	 * @return self
60
+	 */
61
+	public static function fromChosenASN1(UnspecifiedType $el): self
62
+	{
63
+		$octets = $el->asOctetString()->string();
64
+		switch (strlen($octets)) {
65
+			case 4:
66
+			case 8:
67
+				return IPv4Address::fromOctets($octets);
68
+			case 16:
69
+			case 32:
70
+				return IPv6Address::fromOctets($octets);
71
+			default:
72
+				throw new \UnexpectedValueException(
73
+					"Invalid octet length for IP address.");
74
+		}
75
+	}
76 76
     
77
-    /**
78
-     *
79
-     * {@inheritdoc}
80
-     */
81
-    public function string(): string
82
-    {
83
-        return $this->_ip . (isset($this->_mask) ? "/" . $this->_mask : "");
84
-    }
77
+	/**
78
+	 *
79
+	 * {@inheritdoc}
80
+	 */
81
+	public function string(): string
82
+	{
83
+		return $this->_ip . (isset($this->_mask) ? "/" . $this->_mask : "");
84
+	}
85 85
     
86
-    /**
87
-     * Get IP address as a string.
88
-     *
89
-     * @return string
90
-     */
91
-    public function address(): string
92
-    {
93
-        return $this->_ip;
94
-    }
86
+	/**
87
+	 * Get IP address as a string.
88
+	 *
89
+	 * @return string
90
+	 */
91
+	public function address(): string
92
+	{
93
+		return $this->_ip;
94
+	}
95 95
     
96
-    /**
97
-     * Get subnet mask as a string.
98
-     *
99
-     * @return string
100
-     */
101
-    public function mask(): string
102
-    {
103
-        return $this->_mask;
104
-    }
96
+	/**
97
+	 * Get subnet mask as a string.
98
+	 *
99
+	 * @return string
100
+	 */
101
+	public function mask(): string
102
+	{
103
+		return $this->_mask;
104
+	}
105 105
     
106
-    /**
107
-     *
108
-     * {@inheritdoc}
109
-     */
110
-    protected function _choiceASN1(): TaggedType
111
-    {
112
-        return new ImplicitlyTaggedType($this->_tag,
113
-            new OctetString($this->_octets()));
114
-    }
106
+	/**
107
+	 *
108
+	 * {@inheritdoc}
109
+	 */
110
+	protected function _choiceASN1(): TaggedType
111
+	{
112
+		return new ImplicitlyTaggedType($this->_tag,
113
+			new OctetString($this->_octets()));
114
+	}
115 115
 }
Please login to merge, or discard this patch.
lib/X509/GeneralName/IPv6Address.php 3 patches
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@
 block discarded – undo
16 16
         $mask = null;
17 17
         $words = unpack("n*", $octets);
18 18
         switch (count($words)) {
19
-            case 8:
20
-                $ip = self::_wordsToIPv6String($words);
21
-                break;
22
-            case 16:
23
-                $ip = self::_wordsToIPv6String(array_slice($words, 0, 8));
24
-                $mask = self::_wordsToIPv6String(array_slice($words, 8, 8));
25
-                break;
26
-            default:
27
-                throw new \UnexpectedValueException("Invalid IPv6 octet length.");
19
+        case 8:
20
+            $ip = self::_wordsToIPv6String($words);
21
+            break;
22
+        case 16:
23
+            $ip = self::_wordsToIPv6String(array_slice($words, 0, 8));
24
+            $mask = self::_wordsToIPv6String(array_slice($words, 8, 8));
25
+            break;
26
+        default:
27
+            throw new \UnexpectedValueException("Invalid IPv6 octet length.");
28 28
         }
29 29
         return new self($ip, $mask);
30 30
     }
Please login to merge, or discard this patch.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -6,57 +6,57 @@
 block discarded – undo
6 6
 
7 7
 class IPv6Address extends IPAddress
8 8
 {
9
-    /**
10
-     * Initialize from octets.
11
-     *
12
-     * @param string $octets
13
-     * @throws \InvalidArgumentException
14
-     * @return self
15
-     */
16
-    public static function fromOctets(string $octets): self
17
-    {
18
-        $mask = null;
19
-        $words = unpack("n*", $octets);
20
-        switch (count($words)) {
21
-            case 8:
22
-                $ip = self::_wordsToIPv6String($words);
23
-                break;
24
-            case 16:
25
-                $ip = self::_wordsToIPv6String(array_slice($words, 0, 8));
26
-                $mask = self::_wordsToIPv6String(array_slice($words, 8, 8));
27
-                break;
28
-            default:
29
-                throw new \UnexpectedValueException("Invalid IPv6 octet length.");
30
-        }
31
-        return new self($ip, $mask);
32
-    }
9
+	/**
10
+	 * Initialize from octets.
11
+	 *
12
+	 * @param string $octets
13
+	 * @throws \InvalidArgumentException
14
+	 * @return self
15
+	 */
16
+	public static function fromOctets(string $octets): self
17
+	{
18
+		$mask = null;
19
+		$words = unpack("n*", $octets);
20
+		switch (count($words)) {
21
+			case 8:
22
+				$ip = self::_wordsToIPv6String($words);
23
+				break;
24
+			case 16:
25
+				$ip = self::_wordsToIPv6String(array_slice($words, 0, 8));
26
+				$mask = self::_wordsToIPv6String(array_slice($words, 8, 8));
27
+				break;
28
+			default:
29
+				throw new \UnexpectedValueException("Invalid IPv6 octet length.");
30
+		}
31
+		return new self($ip, $mask);
32
+	}
33 33
     
34
-    /**
35
-     * Convert an array of 16 bit words to an IPv6 string representation.
36
-     *
37
-     * @param int[] $words
38
-     * @return string
39
-     */
40
-    protected static function _wordsToIPv6String(array $words): string
41
-    {
42
-        $groups = array_map(
43
-            function ($word) {
44
-                return sprintf("%04x", $word);
45
-            }, $words);
46
-        return implode(":", $groups);
47
-    }
34
+	/**
35
+	 * Convert an array of 16 bit words to an IPv6 string representation.
36
+	 *
37
+	 * @param int[] $words
38
+	 * @return string
39
+	 */
40
+	protected static function _wordsToIPv6String(array $words): string
41
+	{
42
+		$groups = array_map(
43
+			function ($word) {
44
+				return sprintf("%04x", $word);
45
+			}, $words);
46
+		return implode(":", $groups);
47
+	}
48 48
     
49
-    /**
50
-     *
51
-     * {@inheritdoc}
52
-     */
53
-    protected function _octets(): string
54
-    {
55
-        $words = array_map("hexdec", explode(":", $this->_ip));
56
-        if (isset($this->_mask)) {
57
-            $words = array_merge($words,
58
-                array_map("hexdec", explode(":", $this->_mask)));
59
-        }
60
-        return pack("n*", ...$words);
61
-    }
49
+	/**
50
+	 *
51
+	 * {@inheritdoc}
52
+	 */
53
+	protected function _octets(): string
54
+	{
55
+		$words = array_map("hexdec", explode(":", $this->_ip));
56
+		if (isset($this->_mask)) {
57
+			$words = array_merge($words,
58
+				array_map("hexdec", explode(":", $this->_mask)));
59
+		}
60
+		return pack("n*", ...$words);
61
+	}
62 62
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
     protected static function _wordsToIPv6String(array $words): string
41 41
     {
42 42
         $groups = array_map(
43
-            function ($word) {
43
+            function($word) {
44 44
                 return sprintf("%04x", $word);
45 45
             }, $words);
46 46
         return implode(":", $groups);
Please login to merge, or discard this patch.
lib/X509/GeneralName/GeneralName.php 2 patches
Switch Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -68,43 +68,43 @@
 block discarded – undo
68 68
     {
69 69
         switch ($el->tag()) {
70 70
             // otherName
71
-            case self::TAG_OTHER_NAME:
72
-                return OtherName::fromChosenASN1(
73
-                    $el->asImplicit(Element::TYPE_SEQUENCE));
74
-            // rfc822Name
75
-            case self::TAG_RFC822_NAME:
76
-                return RFC822Name::fromChosenASN1(
77
-                    $el->asImplicit(Element::TYPE_IA5_STRING));
78
-            // dNSName
79
-            case self::TAG_DNS_NAME:
80
-                return DNSName::fromChosenASN1(
81
-                    $el->asImplicit(Element::TYPE_IA5_STRING));
82
-            // x400Address
83
-            case self::TAG_X400_ADDRESS:
84
-                return X400Address::fromChosenASN1(
85
-                    $el->asImplicit(Element::TYPE_SEQUENCE));
86
-            // directoryName
87
-            case self::TAG_DIRECTORY_NAME:
88
-                // because Name is a CHOICE, albeit having only one option,
89
-                // explicit tagging must be used
90
-                // (see X.680 07/2002 30.6.c)
91
-                return DirectoryName::fromChosenASN1($el->asExplicit());
92
-            // ediPartyName
93
-            case self::TAG_EDI_PARTY_NAME:
94
-                return EDIPartyName::fromChosenASN1(
95
-                    $el->asImplicit(Element::TYPE_SEQUENCE));
96
-            // uniformResourceIdentifier
97
-            case self::TAG_URI:
98
-                return UniformResourceIdentifier::fromChosenASN1(
99
-                    $el->asImplicit(Element::TYPE_IA5_STRING));
100
-            // iPAddress
101
-            case self::TAG_IP_ADDRESS:
102
-                return IPAddress::fromChosenASN1(
103
-                    $el->asImplicit(Element::TYPE_OCTET_STRING));
104
-            // registeredID
105
-            case self::TAG_REGISTERED_ID:
106
-                return RegisteredID::fromChosenASN1(
107
-                    $el->asImplicit(Element::TYPE_OBJECT_IDENTIFIER));
71
+        case self::TAG_OTHER_NAME:
72
+            return OtherName::fromChosenASN1(
73
+                $el->asImplicit(Element::TYPE_SEQUENCE));
74
+        // rfc822Name
75
+        case self::TAG_RFC822_NAME:
76
+            return RFC822Name::fromChosenASN1(
77
+                $el->asImplicit(Element::TYPE_IA5_STRING));
78
+        // dNSName
79
+        case self::TAG_DNS_NAME:
80
+            return DNSName::fromChosenASN1(
81
+                $el->asImplicit(Element::TYPE_IA5_STRING));
82
+        // x400Address
83
+        case self::TAG_X400_ADDRESS:
84
+            return X400Address::fromChosenASN1(
85
+                $el->asImplicit(Element::TYPE_SEQUENCE));
86
+        // directoryName
87
+        case self::TAG_DIRECTORY_NAME:
88
+            // because Name is a CHOICE, albeit having only one option,
89
+            // explicit tagging must be used
90
+            // (see X.680 07/2002 30.6.c)
91
+            return DirectoryName::fromChosenASN1($el->asExplicit());
92
+        // ediPartyName
93
+        case self::TAG_EDI_PARTY_NAME:
94
+            return EDIPartyName::fromChosenASN1(
95
+                $el->asImplicit(Element::TYPE_SEQUENCE));
96
+        // uniformResourceIdentifier
97
+        case self::TAG_URI:
98
+            return UniformResourceIdentifier::fromChosenASN1(
99
+                $el->asImplicit(Element::TYPE_IA5_STRING));
100
+        // iPAddress
101
+        case self::TAG_IP_ADDRESS:
102
+            return IPAddress::fromChosenASN1(
103
+                $el->asImplicit(Element::TYPE_OCTET_STRING));
104
+        // registeredID
105
+        case self::TAG_REGISTERED_ID:
106
+            return RegisteredID::fromChosenASN1(
107
+                $el->asImplicit(Element::TYPE_OBJECT_IDENTIFIER));
108 108
         }
109 109
         throw new \UnexpectedValueException(
110 110
             "GeneralName type " . $el->tag() . " not supported.");
Please login to merge, or discard this patch.
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -15,147 +15,147 @@
 block discarded – undo
15 15
  */
16 16
 abstract class GeneralName
17 17
 {
18
-    // GeneralName CHOICE tags
19
-    const TAG_OTHER_NAME = 0;
20
-    const TAG_RFC822_NAME = 1;
21
-    const TAG_DNS_NAME = 2;
22
-    const TAG_X400_ADDRESS = 3;
23
-    const TAG_DIRECTORY_NAME = 4;
24
-    const TAG_EDI_PARTY_NAME = 5;
25
-    const TAG_URI = 6;
26
-    const TAG_IP_ADDRESS = 7;
27
-    const TAG_REGISTERED_ID = 8;
18
+	// GeneralName CHOICE tags
19
+	const TAG_OTHER_NAME = 0;
20
+	const TAG_RFC822_NAME = 1;
21
+	const TAG_DNS_NAME = 2;
22
+	const TAG_X400_ADDRESS = 3;
23
+	const TAG_DIRECTORY_NAME = 4;
24
+	const TAG_EDI_PARTY_NAME = 5;
25
+	const TAG_URI = 6;
26
+	const TAG_IP_ADDRESS = 7;
27
+	const TAG_REGISTERED_ID = 8;
28 28
     
29
-    /**
30
-     * Chosen tag.
31
-     *
32
-     * @var int $_tag
33
-     */
34
-    protected $_tag;
29
+	/**
30
+	 * Chosen tag.
31
+	 *
32
+	 * @var int $_tag
33
+	 */
34
+	protected $_tag;
35 35
     
36
-    /**
37
-     * Get string value of the type.
38
-     *
39
-     * @return string
40
-     */
41
-    abstract public function string(): string;
36
+	/**
37
+	 * Get string value of the type.
38
+	 *
39
+	 * @return string
40
+	 */
41
+	abstract public function string(): string;
42 42
     
43
-    /**
44
-     * Get ASN.1 value in GeneralName CHOICE context.
45
-     *
46
-     * @return TaggedType
47
-     */
48
-    abstract protected function _choiceASN1(): TaggedType;
43
+	/**
44
+	 * Get ASN.1 value in GeneralName CHOICE context.
45
+	 *
46
+	 * @return TaggedType
47
+	 */
48
+	abstract protected function _choiceASN1(): TaggedType;
49 49
     
50
-    /**
51
-     * Initialize concrete object from the chosen ASN.1 element.
52
-     *
53
-     * @param UnspecifiedType $el
54
-     * @return self
55
-     */
56
-    public static function fromChosenASN1(UnspecifiedType $el)
57
-    {
58
-        throw new \BadMethodCallException(
59
-            __FUNCTION__ . " must be implemented in the derived class.");
60
-    }
50
+	/**
51
+	 * Initialize concrete object from the chosen ASN.1 element.
52
+	 *
53
+	 * @param UnspecifiedType $el
54
+	 * @return self
55
+	 */
56
+	public static function fromChosenASN1(UnspecifiedType $el)
57
+	{
58
+		throw new \BadMethodCallException(
59
+			__FUNCTION__ . " must be implemented in the derived class.");
60
+	}
61 61
     
62
-    /**
63
-     * Initialize from ASN.1.
64
-     *
65
-     * @param TaggedType $el
66
-     * @throws \UnexpectedValueException
67
-     * @return self
68
-     */
69
-    public static function fromASN1(TaggedType $el): self
70
-    {
71
-        switch ($el->tag()) {
72
-            // otherName
73
-            case self::TAG_OTHER_NAME:
74
-                return OtherName::fromChosenASN1(
75
-                    $el->asImplicit(Element::TYPE_SEQUENCE));
76
-            // rfc822Name
77
-            case self::TAG_RFC822_NAME:
78
-                return RFC822Name::fromChosenASN1(
79
-                    $el->asImplicit(Element::TYPE_IA5_STRING));
80
-            // dNSName
81
-            case self::TAG_DNS_NAME:
82
-                return DNSName::fromChosenASN1(
83
-                    $el->asImplicit(Element::TYPE_IA5_STRING));
84
-            // x400Address
85
-            case self::TAG_X400_ADDRESS:
86
-                return X400Address::fromChosenASN1(
87
-                    $el->asImplicit(Element::TYPE_SEQUENCE));
88
-            // directoryName
89
-            case self::TAG_DIRECTORY_NAME:
90
-                // because Name is a CHOICE, albeit having only one option,
91
-                // explicit tagging must be used
92
-                // (see X.680 07/2002 30.6.c)
93
-                return DirectoryName::fromChosenASN1($el->asExplicit());
94
-            // ediPartyName
95
-            case self::TAG_EDI_PARTY_NAME:
96
-                return EDIPartyName::fromChosenASN1(
97
-                    $el->asImplicit(Element::TYPE_SEQUENCE));
98
-            // uniformResourceIdentifier
99
-            case self::TAG_URI:
100
-                return UniformResourceIdentifier::fromChosenASN1(
101
-                    $el->asImplicit(Element::TYPE_IA5_STRING));
102
-            // iPAddress
103
-            case self::TAG_IP_ADDRESS:
104
-                return IPAddress::fromChosenASN1(
105
-                    $el->asImplicit(Element::TYPE_OCTET_STRING));
106
-            // registeredID
107
-            case self::TAG_REGISTERED_ID:
108
-                return RegisteredID::fromChosenASN1(
109
-                    $el->asImplicit(Element::TYPE_OBJECT_IDENTIFIER));
110
-        }
111
-        throw new \UnexpectedValueException(
112
-            "GeneralName type " . $el->tag() . " not supported.");
113
-    }
62
+	/**
63
+	 * Initialize from ASN.1.
64
+	 *
65
+	 * @param TaggedType $el
66
+	 * @throws \UnexpectedValueException
67
+	 * @return self
68
+	 */
69
+	public static function fromASN1(TaggedType $el): self
70
+	{
71
+		switch ($el->tag()) {
72
+			// otherName
73
+			case self::TAG_OTHER_NAME:
74
+				return OtherName::fromChosenASN1(
75
+					$el->asImplicit(Element::TYPE_SEQUENCE));
76
+			// rfc822Name
77
+			case self::TAG_RFC822_NAME:
78
+				return RFC822Name::fromChosenASN1(
79
+					$el->asImplicit(Element::TYPE_IA5_STRING));
80
+			// dNSName
81
+			case self::TAG_DNS_NAME:
82
+				return DNSName::fromChosenASN1(
83
+					$el->asImplicit(Element::TYPE_IA5_STRING));
84
+			// x400Address
85
+			case self::TAG_X400_ADDRESS:
86
+				return X400Address::fromChosenASN1(
87
+					$el->asImplicit(Element::TYPE_SEQUENCE));
88
+			// directoryName
89
+			case self::TAG_DIRECTORY_NAME:
90
+				// because Name is a CHOICE, albeit having only one option,
91
+				// explicit tagging must be used
92
+				// (see X.680 07/2002 30.6.c)
93
+				return DirectoryName::fromChosenASN1($el->asExplicit());
94
+			// ediPartyName
95
+			case self::TAG_EDI_PARTY_NAME:
96
+				return EDIPartyName::fromChosenASN1(
97
+					$el->asImplicit(Element::TYPE_SEQUENCE));
98
+			// uniformResourceIdentifier
99
+			case self::TAG_URI:
100
+				return UniformResourceIdentifier::fromChosenASN1(
101
+					$el->asImplicit(Element::TYPE_IA5_STRING));
102
+			// iPAddress
103
+			case self::TAG_IP_ADDRESS:
104
+				return IPAddress::fromChosenASN1(
105
+					$el->asImplicit(Element::TYPE_OCTET_STRING));
106
+			// registeredID
107
+			case self::TAG_REGISTERED_ID:
108
+				return RegisteredID::fromChosenASN1(
109
+					$el->asImplicit(Element::TYPE_OBJECT_IDENTIFIER));
110
+		}
111
+		throw new \UnexpectedValueException(
112
+			"GeneralName type " . $el->tag() . " not supported.");
113
+	}
114 114
     
115
-    /**
116
-     * Get type tag.
117
-     *
118
-     * @return int
119
-     */
120
-    public function tag(): int
121
-    {
122
-        return $this->_tag;
123
-    }
115
+	/**
116
+	 * Get type tag.
117
+	 *
118
+	 * @return int
119
+	 */
120
+	public function tag(): int
121
+	{
122
+		return $this->_tag;
123
+	}
124 124
     
125
-    /**
126
-     * Generate ASN.1 element.
127
-     *
128
-     * @return Element
129
-     */
130
-    public function toASN1(): Element
131
-    {
132
-        return $this->_choiceASN1();
133
-    }
125
+	/**
126
+	 * Generate ASN.1 element.
127
+	 *
128
+	 * @return Element
129
+	 */
130
+	public function toASN1(): Element
131
+	{
132
+		return $this->_choiceASN1();
133
+	}
134 134
     
135
-    /**
136
-     * Check whether GeneralName is equal to other.
137
-     *
138
-     * @param GeneralName $other GeneralName to compare to
139
-     * @return boolean True if names are equal
140
-     */
141
-    public function equals(GeneralName $other): bool
142
-    {
143
-        if ($this->_tag != $other->_tag) {
144
-            return false;
145
-        }
146
-        if ($this->_choiceASN1()->toDER() != $other->_choiceASN1()->toDER()) {
147
-            return false;
148
-        }
149
-        return true;
150
-    }
135
+	/**
136
+	 * Check whether GeneralName is equal to other.
137
+	 *
138
+	 * @param GeneralName $other GeneralName to compare to
139
+	 * @return boolean True if names are equal
140
+	 */
141
+	public function equals(GeneralName $other): bool
142
+	{
143
+		if ($this->_tag != $other->_tag) {
144
+			return false;
145
+		}
146
+		if ($this->_choiceASN1()->toDER() != $other->_choiceASN1()->toDER()) {
147
+			return false;
148
+		}
149
+		return true;
150
+	}
151 151
     
152
-    /**
153
-     * Get general name as a string.
154
-     *
155
-     * @return string
156
-     */
157
-    public function __toString()
158
-    {
159
-        return $this->string();
160
-    }
152
+	/**
153
+	 * Get general name as a string.
154
+	 *
155
+	 * @return string
156
+	 */
157
+	public function __toString()
158
+	{
159
+		return $this->string();
160
+	}
161 161
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/AAControlsExtension.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
                 ->asImplicit(Element::TYPE_SEQUENCE)
92 92
                 ->asSequence();
93 93
             $permitted = array_map(
94
-                function (UnspecifiedType $el) {
94
+                function(UnspecifiedType $el) {
95 95
                     return $el->asObjectIdentifier()->oid();
96 96
                 }, $attr_seq->elements());
97 97
             $idx++;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                 ->asImplicit(Element::TYPE_SEQUENCE)
102 102
                 ->asSequence();
103 103
             $excluded = array_map(
104
-                function (UnspecifiedType $el) {
104
+                function(UnspecifiedType $el) {
105 105
                     return $el->asObjectIdentifier()->oid();
106 106
                 }, $attr_seq->elements());
107 107
             $idx++;
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
         }
212 212
         if (isset($this->_permittedAttrs)) {
213 213
             $oids = array_map(
214
-                function ($oid) {
214
+                function($oid) {
215 215
                     return new ObjectIdentifier($oid);
216 216
                 }, $this->_permittedAttrs);
217 217
             $elements[] = new ImplicitlyTaggedType(0, new Sequence(...$oids));
218 218
         }
219 219
         if (isset($this->_excludedAttrs)) {
220 220
             $oids = array_map(
221
-                function ($oid) {
221
+                function($oid) {
222 222
                     return new ObjectIdentifier($oid);
223 223
                 }, $this->_excludedAttrs);
224 224
             $elements[] = new ImplicitlyTaggedType(1, new Sequence(...$oids));
Please login to merge, or discard this patch.
Indentation   +198 added lines, -198 removed lines patch added patch discarded remove patch
@@ -19,215 +19,215 @@
 block discarded – undo
19 19
  */
20 20
 class AAControlsExtension extends Extension
21 21
 {
22
-    /**
23
-     * Path length contraint.
24
-     *
25
-     * @var int|null $_pathLenConstraint
26
-     */
27
-    protected $_pathLenConstraint;
22
+	/**
23
+	 * Path length contraint.
24
+	 *
25
+	 * @var int|null $_pathLenConstraint
26
+	 */
27
+	protected $_pathLenConstraint;
28 28
     
29
-    /**
30
-     * Permitted attributes.
31
-     *
32
-     * Array of OID's.
33
-     *
34
-     * @var string[]|null $_permittedAttrs
35
-     */
36
-    protected $_permittedAttrs;
29
+	/**
30
+	 * Permitted attributes.
31
+	 *
32
+	 * Array of OID's.
33
+	 *
34
+	 * @var string[]|null $_permittedAttrs
35
+	 */
36
+	protected $_permittedAttrs;
37 37
     
38
-    /**
39
-     * Excluded attributes.
40
-     *
41
-     * Array of OID's.
42
-     *
43
-     * @var string[]|null $_excludedAttrs
44
-     */
45
-    protected $_excludedAttrs;
38
+	/**
39
+	 * Excluded attributes.
40
+	 *
41
+	 * Array of OID's.
42
+	 *
43
+	 * @var string[]|null $_excludedAttrs
44
+	 */
45
+	protected $_excludedAttrs;
46 46
     
47
-    /**
48
-     * Whether to permit unspecified attributes.
49
-     *
50
-     * @var bool $_permitUnSpecified
51
-     */
52
-    protected $_permitUnSpecified;
47
+	/**
48
+	 * Whether to permit unspecified attributes.
49
+	 *
50
+	 * @var bool $_permitUnSpecified
51
+	 */
52
+	protected $_permitUnSpecified;
53 53
     
54
-    /**
55
-     * Constructor.
56
-     *
57
-     * @param bool $critical
58
-     * @param int|null $path_len
59
-     * @param string[]|null $permitted
60
-     * @param string[]|null $excluded
61
-     * @param bool $permit_unspecified
62
-     */
63
-    public function __construct(bool $critical, $path_len = null,
64
-        array $permitted = null, array $excluded = null, bool $permit_unspecified = true)
65
-    {
66
-        parent::__construct(self::OID_AA_CONTROLS, $critical);
67
-        $this->_pathLenConstraint = isset($path_len) ? intval($path_len) : null;
68
-        $this->_permittedAttrs = $permitted;
69
-        $this->_excludedAttrs = $excluded;
70
-        $this->_permitUnSpecified = $permit_unspecified;
71
-    }
54
+	/**
55
+	 * Constructor.
56
+	 *
57
+	 * @param bool $critical
58
+	 * @param int|null $path_len
59
+	 * @param string[]|null $permitted
60
+	 * @param string[]|null $excluded
61
+	 * @param bool $permit_unspecified
62
+	 */
63
+	public function __construct(bool $critical, $path_len = null,
64
+		array $permitted = null, array $excluded = null, bool $permit_unspecified = true)
65
+	{
66
+		parent::__construct(self::OID_AA_CONTROLS, $critical);
67
+		$this->_pathLenConstraint = isset($path_len) ? intval($path_len) : null;
68
+		$this->_permittedAttrs = $permitted;
69
+		$this->_excludedAttrs = $excluded;
70
+		$this->_permitUnSpecified = $permit_unspecified;
71
+	}
72 72
     
73
-    /**
74
-     *
75
-     * {@inheritdoc}
76
-     * @return self
77
-     */
78
-    protected static function _fromDER(string $data, bool $critical): self
79
-    {
80
-        $seq = UnspecifiedType::fromDER($data)->asSequence();
81
-        $path_len = null;
82
-        $permitted = null;
83
-        $excluded = null;
84
-        $permit_unspecified = true;
85
-        $idx = 0;
86
-        if ($seq->has($idx, Element::TYPE_INTEGER)) {
87
-            $path_len = $seq->at($idx++)
88
-                ->asInteger()
89
-                ->intNumber();
90
-        }
91
-        if ($seq->hasTagged(0)) {
92
-            $attr_seq = $seq->getTagged(0)
93
-                ->asImplicit(Element::TYPE_SEQUENCE)
94
-                ->asSequence();
95
-            $permitted = array_map(
96
-                function (UnspecifiedType $el) {
97
-                    return $el->asObjectIdentifier()->oid();
98
-                }, $attr_seq->elements());
99
-            $idx++;
100
-        }
101
-        if ($seq->hasTagged(1)) {
102
-            $attr_seq = $seq->getTagged(1)
103
-                ->asImplicit(Element::TYPE_SEQUENCE)
104
-                ->asSequence();
105
-            $excluded = array_map(
106
-                function (UnspecifiedType $el) {
107
-                    return $el->asObjectIdentifier()->oid();
108
-                }, $attr_seq->elements());
109
-            $idx++;
110
-        }
111
-        if ($seq->has($idx, Element::TYPE_BOOLEAN)) {
112
-            $permit_unspecified = $seq->at($idx++)
113
-                ->asBoolean()
114
-                ->value();
115
-        }
116
-        return new self($critical, $path_len, $permitted, $excluded,
117
-            $permit_unspecified);
118
-    }
73
+	/**
74
+	 *
75
+	 * {@inheritdoc}
76
+	 * @return self
77
+	 */
78
+	protected static function _fromDER(string $data, bool $critical): self
79
+	{
80
+		$seq = UnspecifiedType::fromDER($data)->asSequence();
81
+		$path_len = null;
82
+		$permitted = null;
83
+		$excluded = null;
84
+		$permit_unspecified = true;
85
+		$idx = 0;
86
+		if ($seq->has($idx, Element::TYPE_INTEGER)) {
87
+			$path_len = $seq->at($idx++)
88
+				->asInteger()
89
+				->intNumber();
90
+		}
91
+		if ($seq->hasTagged(0)) {
92
+			$attr_seq = $seq->getTagged(0)
93
+				->asImplicit(Element::TYPE_SEQUENCE)
94
+				->asSequence();
95
+			$permitted = array_map(
96
+				function (UnspecifiedType $el) {
97
+					return $el->asObjectIdentifier()->oid();
98
+				}, $attr_seq->elements());
99
+			$idx++;
100
+		}
101
+		if ($seq->hasTagged(1)) {
102
+			$attr_seq = $seq->getTagged(1)
103
+				->asImplicit(Element::TYPE_SEQUENCE)
104
+				->asSequence();
105
+			$excluded = array_map(
106
+				function (UnspecifiedType $el) {
107
+					return $el->asObjectIdentifier()->oid();
108
+				}, $attr_seq->elements());
109
+			$idx++;
110
+		}
111
+		if ($seq->has($idx, Element::TYPE_BOOLEAN)) {
112
+			$permit_unspecified = $seq->at($idx++)
113
+				->asBoolean()
114
+				->value();
115
+		}
116
+		return new self($critical, $path_len, $permitted, $excluded,
117
+			$permit_unspecified);
118
+	}
119 119
     
120
-    /**
121
-     * Check whether path length constraint is present.
122
-     *
123
-     * @return bool
124
-     */
125
-    public function hasPathLen(): bool
126
-    {
127
-        return isset($this->_pathLenConstraint);
128
-    }
120
+	/**
121
+	 * Check whether path length constraint is present.
122
+	 *
123
+	 * @return bool
124
+	 */
125
+	public function hasPathLen(): bool
126
+	{
127
+		return isset($this->_pathLenConstraint);
128
+	}
129 129
     
130
-    /**
131
-     * Get path length constraint.
132
-     *
133
-     * @throws \LogicException
134
-     * @return int
135
-     */
136
-    public function pathLen(): int
137
-    {
138
-        if (!$this->hasPathLen()) {
139
-            throw new \LogicException("pathLen not set.");
140
-        }
141
-        return $this->_pathLenConstraint;
142
-    }
130
+	/**
131
+	 * Get path length constraint.
132
+	 *
133
+	 * @throws \LogicException
134
+	 * @return int
135
+	 */
136
+	public function pathLen(): int
137
+	{
138
+		if (!$this->hasPathLen()) {
139
+			throw new \LogicException("pathLen not set.");
140
+		}
141
+		return $this->_pathLenConstraint;
142
+	}
143 143
     
144
-    /**
145
-     * Check whether permitted attributes are present.
146
-     *
147
-     * @return bool
148
-     */
149
-    public function hasPermittedAttrs(): bool
150
-    {
151
-        return isset($this->_permittedAttrs);
152
-    }
144
+	/**
145
+	 * Check whether permitted attributes are present.
146
+	 *
147
+	 * @return bool
148
+	 */
149
+	public function hasPermittedAttrs(): bool
150
+	{
151
+		return isset($this->_permittedAttrs);
152
+	}
153 153
     
154
-    /**
155
-     * Get OID's of permitted attributes.
156
-     *
157
-     * @throws \LogicException
158
-     * @return string[]
159
-     */
160
-    public function permittedAttrs(): array
161
-    {
162
-        if (!$this->hasPermittedAttrs()) {
163
-            throw new \LogicException("permittedAttrs not set.");
164
-        }
165
-        return $this->_permittedAttrs;
166
-    }
154
+	/**
155
+	 * Get OID's of permitted attributes.
156
+	 *
157
+	 * @throws \LogicException
158
+	 * @return string[]
159
+	 */
160
+	public function permittedAttrs(): array
161
+	{
162
+		if (!$this->hasPermittedAttrs()) {
163
+			throw new \LogicException("permittedAttrs not set.");
164
+		}
165
+		return $this->_permittedAttrs;
166
+	}
167 167
     
168
-    /**
169
-     * Check whether excluded attributes are present.
170
-     *
171
-     * @return bool
172
-     */
173
-    public function hasExcludedAttrs(): bool
174
-    {
175
-        return isset($this->_excludedAttrs);
176
-    }
168
+	/**
169
+	 * Check whether excluded attributes are present.
170
+	 *
171
+	 * @return bool
172
+	 */
173
+	public function hasExcludedAttrs(): bool
174
+	{
175
+		return isset($this->_excludedAttrs);
176
+	}
177 177
     
178
-    /**
179
-     * Get OID's of excluded attributes.
180
-     *
181
-     * @throws \LogicException
182
-     * @return string[]
183
-     */
184
-    public function excludedAttrs(): array
185
-    {
186
-        if (!$this->hasExcludedAttrs()) {
187
-            throw new \LogicException("excludedAttrs not set.");
188
-        }
189
-        return $this->_excludedAttrs;
190
-    }
178
+	/**
179
+	 * Get OID's of excluded attributes.
180
+	 *
181
+	 * @throws \LogicException
182
+	 * @return string[]
183
+	 */
184
+	public function excludedAttrs(): array
185
+	{
186
+		if (!$this->hasExcludedAttrs()) {
187
+			throw new \LogicException("excludedAttrs not set.");
188
+		}
189
+		return $this->_excludedAttrs;
190
+	}
191 191
     
192
-    /**
193
-     * Whether to permit attributes that are not explicitly specified in
194
-     * neither permitted nor excluded list.
195
-     *
196
-     * @return bool
197
-     */
198
-    public function permitUnspecified(): bool
199
-    {
200
-        return $this->_permitUnSpecified;
201
-    }
192
+	/**
193
+	 * Whether to permit attributes that are not explicitly specified in
194
+	 * neither permitted nor excluded list.
195
+	 *
196
+	 * @return bool
197
+	 */
198
+	public function permitUnspecified(): bool
199
+	{
200
+		return $this->_permitUnSpecified;
201
+	}
202 202
     
203
-    /**
204
-     *
205
-     * {@inheritdoc}
206
-     * @return Sequence
207
-     */
208
-    protected function _valueASN1(): Sequence
209
-    {
210
-        $elements = array();
211
-        if (isset($this->_pathLenConstraint)) {
212
-            $elements[] = new Integer($this->_pathLenConstraint);
213
-        }
214
-        if (isset($this->_permittedAttrs)) {
215
-            $oids = array_map(
216
-                function ($oid) {
217
-                    return new ObjectIdentifier($oid);
218
-                }, $this->_permittedAttrs);
219
-            $elements[] = new ImplicitlyTaggedType(0, new Sequence(...$oids));
220
-        }
221
-        if (isset($this->_excludedAttrs)) {
222
-            $oids = array_map(
223
-                function ($oid) {
224
-                    return new ObjectIdentifier($oid);
225
-                }, $this->_excludedAttrs);
226
-            $elements[] = new ImplicitlyTaggedType(1, new Sequence(...$oids));
227
-        }
228
-        if ($this->_permitUnSpecified !== true) {
229
-            $elements[] = new Boolean(false);
230
-        }
231
-        return new Sequence(...$elements);
232
-    }
203
+	/**
204
+	 *
205
+	 * {@inheritdoc}
206
+	 * @return Sequence
207
+	 */
208
+	protected function _valueASN1(): Sequence
209
+	{
210
+		$elements = array();
211
+		if (isset($this->_pathLenConstraint)) {
212
+			$elements[] = new Integer($this->_pathLenConstraint);
213
+		}
214
+		if (isset($this->_permittedAttrs)) {
215
+			$oids = array_map(
216
+				function ($oid) {
217
+					return new ObjectIdentifier($oid);
218
+				}, $this->_permittedAttrs);
219
+			$elements[] = new ImplicitlyTaggedType(0, new Sequence(...$oids));
220
+		}
221
+		if (isset($this->_excludedAttrs)) {
222
+			$oids = array_map(
223
+				function ($oid) {
224
+					return new ObjectIdentifier($oid);
225
+				}, $this->_excludedAttrs);
226
+			$elements[] = new ImplicitlyTaggedType(1, new Sequence(...$oids));
227
+		}
228
+		if ($this->_permitUnSpecified !== true) {
229
+			$elements[] = new Boolean(false);
230
+		}
231
+		return new Sequence(...$elements);
232
+	}
233 233
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/CertificatePolicy/PolicyQualifierInfo.php 2 patches
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@
 block discarded – undo
67 67
             ->asObjectIdentifier()
68 68
             ->oid();
69 69
         switch ($oid) {
70
-            case self::OID_CPS:
71
-                return CPSQualifier::fromQualifierASN1($seq->at(1));
72
-            case self::OID_UNOTICE:
73
-                return UserNoticeQualifier::fromQualifierASN1($seq->at(1));
70
+        case self::OID_CPS:
71
+            return CPSQualifier::fromQualifierASN1($seq->at(1));
72
+        case self::OID_UNOTICE:
73
+            return UserNoticeQualifier::fromQualifierASN1($seq->at(1));
74 74
         }
75 75
         throw new \UnexpectedValueException("Qualifier $oid not supported.");
76 76
     }
Please login to merge, or discard this patch.
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -16,85 +16,85 @@
 block discarded – undo
16 16
  */
17 17
 abstract class PolicyQualifierInfo
18 18
 {
19
-    /**
20
-     * OID for the CPS Pointer qualifier.
21
-     *
22
-     * @var string
23
-     */
24
-    const OID_CPS = "1.3.6.1.5.5.7.2.1";
19
+	/**
20
+	 * OID for the CPS Pointer qualifier.
21
+	 *
22
+	 * @var string
23
+	 */
24
+	const OID_CPS = "1.3.6.1.5.5.7.2.1";
25 25
     
26
-    /**
27
-     * OID for the user notice qualifier.
28
-     *
29
-     * @var string
30
-     */
31
-    const OID_UNOTICE = "1.3.6.1.5.5.7.2.2";
26
+	/**
27
+	 * OID for the user notice qualifier.
28
+	 *
29
+	 * @var string
30
+	 */
31
+	const OID_UNOTICE = "1.3.6.1.5.5.7.2.2";
32 32
     
33
-    /**
34
-     * Qualifier identifier.
35
-     *
36
-     * @var string $_oid
37
-     */
38
-    protected $_oid;
33
+	/**
34
+	 * Qualifier identifier.
35
+	 *
36
+	 * @var string $_oid
37
+	 */
38
+	protected $_oid;
39 39
     
40
-    /**
41
-     * Generate ASN.1 for the 'qualifier' field.
42
-     *
43
-     * @return \ASN1\Element
44
-     */
45
-    abstract protected function _qualifierASN1();
40
+	/**
41
+	 * Generate ASN.1 for the 'qualifier' field.
42
+	 *
43
+	 * @return \ASN1\Element
44
+	 */
45
+	abstract protected function _qualifierASN1();
46 46
     
47
-    /**
48
-     * Initialize from qualifier ASN.1 element.
49
-     *
50
-     * @param UnspecifiedType $el
51
-     * @return self
52
-     */
53
-    public static function fromQualifierASN1(UnspecifiedType $el)
54
-    {
55
-        throw new \BadMethodCallException(
56
-            __FUNCTION__ . " must be implemented in the derived class.");
57
-    }
47
+	/**
48
+	 * Initialize from qualifier ASN.1 element.
49
+	 *
50
+	 * @param UnspecifiedType $el
51
+	 * @return self
52
+	 */
53
+	public static function fromQualifierASN1(UnspecifiedType $el)
54
+	{
55
+		throw new \BadMethodCallException(
56
+			__FUNCTION__ . " must be implemented in the derived class.");
57
+	}
58 58
     
59
-    /**
60
-     * Initialize from ASN.1.
61
-     *
62
-     * @param Sequence $seq
63
-     * @throws \UnexpectedValueException
64
-     * @return self
65
-     */
66
-    public static function fromASN1(Sequence $seq): self
67
-    {
68
-        $oid = $seq->at(0)
69
-            ->asObjectIdentifier()
70
-            ->oid();
71
-        switch ($oid) {
72
-            case self::OID_CPS:
73
-                return CPSQualifier::fromQualifierASN1($seq->at(1));
74
-            case self::OID_UNOTICE:
75
-                return UserNoticeQualifier::fromQualifierASN1($seq->at(1));
76
-        }
77
-        throw new \UnexpectedValueException("Qualifier $oid not supported.");
78
-    }
59
+	/**
60
+	 * Initialize from ASN.1.
61
+	 *
62
+	 * @param Sequence $seq
63
+	 * @throws \UnexpectedValueException
64
+	 * @return self
65
+	 */
66
+	public static function fromASN1(Sequence $seq): self
67
+	{
68
+		$oid = $seq->at(0)
69
+			->asObjectIdentifier()
70
+			->oid();
71
+		switch ($oid) {
72
+			case self::OID_CPS:
73
+				return CPSQualifier::fromQualifierASN1($seq->at(1));
74
+			case self::OID_UNOTICE:
75
+				return UserNoticeQualifier::fromQualifierASN1($seq->at(1));
76
+		}
77
+		throw new \UnexpectedValueException("Qualifier $oid not supported.");
78
+	}
79 79
     
80
-    /**
81
-     * Get qualifier identifier.
82
-     *
83
-     * @return string
84
-     */
85
-    public function oid(): string
86
-    {
87
-        return $this->_oid;
88
-    }
80
+	/**
81
+	 * Get qualifier identifier.
82
+	 *
83
+	 * @return string
84
+	 */
85
+	public function oid(): string
86
+	{
87
+		return $this->_oid;
88
+	}
89 89
     
90
-    /**
91
-     * Generate ASN.1 structure.
92
-     *
93
-     * @return Sequence
94
-     */
95
-    public function toASN1(): Sequence
96
-    {
97
-        return new Sequence(new ObjectIdentifier($this->_oid),
98
-            $this->_qualifierASN1());
99
-    }
90
+	/**
91
+	 * Generate ASN.1 structure.
92
+	 *
93
+	 * @return Sequence
94
+	 */
95
+	public function toASN1(): Sequence
96
+	{
97
+		return new Sequence(new ObjectIdentifier($this->_oid),
98
+			$this->_qualifierASN1());
99
+	}
100 100
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/CertificatePolicy/PolicyInformation.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $qualifiers = array();
65 65
         if (count($seq) > 1) {
66 66
             $qualifiers = array_map(
67
-                function (UnspecifiedType $el) {
67
+                function(UnspecifiedType $el) {
68 68
                     return PolicyQualifierInfo::fromASN1($el->asSequence());
69 69
                 },
70 70
                 $seq->at(1)
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         $elements = array(new ObjectIdentifier($this->_oid));
189 189
         if (count($this->_qualifiers)) {
190 190
             $qualifiers = array_map(
191
-                function (PolicyQualifierInfo $pqi) {
191
+                function(PolicyQualifierInfo $pqi) {
192 192
                     return $pqi->toASN1();
193 193
                 }, array_values($this->_qualifiers));
194 194
             $elements[] = new Sequence(...$qualifiers);
Please login to merge, or discard this patch.
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -16,207 +16,207 @@
 block discarded – undo
16 16
  */
17 17
 class PolicyInformation implements \Countable, \IteratorAggregate
18 18
 {
19
-    /**
20
-     * Wildcard policy.
21
-     *
22
-     * @var string
23
-     */
24
-    const OID_ANY_POLICY = "2.5.29.32.0";
25
-    
26
-    /**
27
-     * Policy identifier.
28
-     *
29
-     * @var string $_oid
30
-     */
31
-    protected $_oid;
32
-    
33
-    /**
34
-     * Policy qualifiers.
35
-     *
36
-     * @var PolicyQualifierInfo[] $_qualifiers
37
-     */
38
-    protected $_qualifiers;
39
-    
40
-    /**
41
-     * Constructor.
42
-     *
43
-     * @param string $oid
44
-     * @param PolicyQualifierInfo ...$qualifiers
45
-     */
46
-    public function __construct(string $oid, PolicyQualifierInfo ...$qualifiers)
47
-    {
48
-        $this->_oid = $oid;
49
-        $this->_qualifiers = array();
50
-        foreach ($qualifiers as $qual) {
51
-            $this->_qualifiers[$qual->oid()] = $qual;
52
-        }
53
-    }
54
-    
55
-    /**
56
-     * Initialize from ASN.1.
57
-     *
58
-     * @param Sequence $seq
59
-     * @return self
60
-     */
61
-    public static function fromASN1(Sequence $seq): self
62
-    {
63
-        $oid = $seq->at(0)
64
-            ->asObjectIdentifier()
65
-            ->oid();
66
-        $qualifiers = array();
67
-        if (count($seq) > 1) {
68
-            $qualifiers = array_map(
69
-                function (UnspecifiedType $el) {
70
-                    return PolicyQualifierInfo::fromASN1($el->asSequence());
71
-                },
72
-                $seq->at(1)
73
-                    ->asSequence()
74
-                    ->elements());
75
-        }
76
-        return new self($oid, ...$qualifiers);
77
-    }
78
-    
79
-    /**
80
-     * Get policy identifier.
81
-     *
82
-     * @return string
83
-     */
84
-    public function oid(): string
85
-    {
86
-        return $this->_oid;
87
-    }
88
-    
89
-    /**
90
-     * Check whether this policy is anyPolicy.
91
-     *
92
-     * @return bool
93
-     */
94
-    public function isAnyPolicy(): bool
95
-    {
96
-        return self::OID_ANY_POLICY === $this->_oid;
97
-    }
98
-    
99
-    /**
100
-     * Get policy qualifiers.
101
-     *
102
-     * @return PolicyQualifierInfo[]
103
-     */
104
-    public function qualifiers(): array
105
-    {
106
-        return array_values($this->_qualifiers);
107
-    }
108
-    
109
-    /**
110
-     * Check whether qualifier is present.
111
-     *
112
-     * @param string $oid
113
-     * @return boolean
114
-     */
115
-    public function has(string $oid): bool
116
-    {
117
-        return isset($this->_qualifiers[$oid]);
118
-    }
119
-    
120
-    /**
121
-     * Get qualifier by OID.
122
-     *
123
-     * @param string $oid
124
-     * @throws \OutOfBoundsException
125
-     * @return PolicyQualifierInfo
126
-     */
127
-    public function get(string $oid): PolicyQualifierInfo
128
-    {
129
-        if (!$this->has($oid)) {
130
-            throw new \LogicException("No $oid qualifier.");
131
-        }
132
-        return $this->_qualifiers[$oid];
133
-    }
134
-    
135
-    /**
136
-     * Check whether CPS qualifier is present.
137
-     *
138
-     * @return bool
139
-     */
140
-    public function hasCPSQualifier(): bool
141
-    {
142
-        return $this->has(PolicyQualifierInfo::OID_CPS);
143
-    }
144
-    
145
-    /**
146
-     * Get CPS qualifier.
147
-     *
148
-     * @throws \LogicException
149
-     * @return CPSQualifier
150
-     */
151
-    public function CPSQualifier(): CPSQualifier
152
-    {
153
-        if (!$this->hasCPSQualifier()) {
154
-            throw new \LogicException("CPS qualifier not set.");
155
-        }
156
-        return $this->get(PolicyQualifierInfo::OID_CPS);
157
-    }
158
-    
159
-    /**
160
-     * Check whether user notice qualifier is present.
161
-     *
162
-     * @return bool
163
-     */
164
-    public function hasUserNoticeQualifier(): bool
165
-    {
166
-        return $this->has(PolicyQualifierInfo::OID_UNOTICE);
167
-    }
168
-    
169
-    /**
170
-     * Get user notice qualifier.
171
-     *
172
-     * @throws \LogicException
173
-     * @return UserNoticeQualifier
174
-     */
175
-    public function userNoticeQualifier(): UserNoticeQualifier
176
-    {
177
-        if (!$this->hasUserNoticeQualifier()) {
178
-            throw new \LogicException("User notice qualifier not set.");
179
-        }
180
-        return $this->get(PolicyQualifierInfo::OID_UNOTICE);
181
-    }
182
-    
183
-    /**
184
-     * Get ASN.1 structure.
185
-     *
186
-     * @return Sequence
187
-     */
188
-    public function toASN1(): Sequence
189
-    {
190
-        $elements = array(new ObjectIdentifier($this->_oid));
191
-        if (count($this->_qualifiers)) {
192
-            $qualifiers = array_map(
193
-                function (PolicyQualifierInfo $pqi) {
194
-                    return $pqi->toASN1();
195
-                }, array_values($this->_qualifiers));
196
-            $elements[] = new Sequence(...$qualifiers);
197
-        }
198
-        return new Sequence(...$elements);
199
-    }
200
-    
201
-    /**
202
-     * Get number of qualifiers.
203
-     *
204
-     * @see \Countable::count()
205
-     * @return int
206
-     */
207
-    public function count(): int
208
-    {
209
-        return count($this->_qualifiers);
210
-    }
211
-    
212
-    /**
213
-     * Get iterator for qualifiers.
214
-     *
215
-     * @see \IteratorAggregate::getIterator()
216
-     * @return \ArrayIterator
217
-     */
218
-    public function getIterator(): \ArrayIterator
219
-    {
220
-        return new \ArrayIterator($this->_qualifiers);
221
-    }
19
+	/**
20
+	 * Wildcard policy.
21
+	 *
22
+	 * @var string
23
+	 */
24
+	const OID_ANY_POLICY = "2.5.29.32.0";
25
+    
26
+	/**
27
+	 * Policy identifier.
28
+	 *
29
+	 * @var string $_oid
30
+	 */
31
+	protected $_oid;
32
+    
33
+	/**
34
+	 * Policy qualifiers.
35
+	 *
36
+	 * @var PolicyQualifierInfo[] $_qualifiers
37
+	 */
38
+	protected $_qualifiers;
39
+    
40
+	/**
41
+	 * Constructor.
42
+	 *
43
+	 * @param string $oid
44
+	 * @param PolicyQualifierInfo ...$qualifiers
45
+	 */
46
+	public function __construct(string $oid, PolicyQualifierInfo ...$qualifiers)
47
+	{
48
+		$this->_oid = $oid;
49
+		$this->_qualifiers = array();
50
+		foreach ($qualifiers as $qual) {
51
+			$this->_qualifiers[$qual->oid()] = $qual;
52
+		}
53
+	}
54
+    
55
+	/**
56
+	 * Initialize from ASN.1.
57
+	 *
58
+	 * @param Sequence $seq
59
+	 * @return self
60
+	 */
61
+	public static function fromASN1(Sequence $seq): self
62
+	{
63
+		$oid = $seq->at(0)
64
+			->asObjectIdentifier()
65
+			->oid();
66
+		$qualifiers = array();
67
+		if (count($seq) > 1) {
68
+			$qualifiers = array_map(
69
+				function (UnspecifiedType $el) {
70
+					return PolicyQualifierInfo::fromASN1($el->asSequence());
71
+				},
72
+				$seq->at(1)
73
+					->asSequence()
74
+					->elements());
75
+		}
76
+		return new self($oid, ...$qualifiers);
77
+	}
78
+    
79
+	/**
80
+	 * Get policy identifier.
81
+	 *
82
+	 * @return string
83
+	 */
84
+	public function oid(): string
85
+	{
86
+		return $this->_oid;
87
+	}
88
+    
89
+	/**
90
+	 * Check whether this policy is anyPolicy.
91
+	 *
92
+	 * @return bool
93
+	 */
94
+	public function isAnyPolicy(): bool
95
+	{
96
+		return self::OID_ANY_POLICY === $this->_oid;
97
+	}
98
+    
99
+	/**
100
+	 * Get policy qualifiers.
101
+	 *
102
+	 * @return PolicyQualifierInfo[]
103
+	 */
104
+	public function qualifiers(): array
105
+	{
106
+		return array_values($this->_qualifiers);
107
+	}
108
+    
109
+	/**
110
+	 * Check whether qualifier is present.
111
+	 *
112
+	 * @param string $oid
113
+	 * @return boolean
114
+	 */
115
+	public function has(string $oid): bool
116
+	{
117
+		return isset($this->_qualifiers[$oid]);
118
+	}
119
+    
120
+	/**
121
+	 * Get qualifier by OID.
122
+	 *
123
+	 * @param string $oid
124
+	 * @throws \OutOfBoundsException
125
+	 * @return PolicyQualifierInfo
126
+	 */
127
+	public function get(string $oid): PolicyQualifierInfo
128
+	{
129
+		if (!$this->has($oid)) {
130
+			throw new \LogicException("No $oid qualifier.");
131
+		}
132
+		return $this->_qualifiers[$oid];
133
+	}
134
+    
135
+	/**
136
+	 * Check whether CPS qualifier is present.
137
+	 *
138
+	 * @return bool
139
+	 */
140
+	public function hasCPSQualifier(): bool
141
+	{
142
+		return $this->has(PolicyQualifierInfo::OID_CPS);
143
+	}
144
+    
145
+	/**
146
+	 * Get CPS qualifier.
147
+	 *
148
+	 * @throws \LogicException
149
+	 * @return CPSQualifier
150
+	 */
151
+	public function CPSQualifier(): CPSQualifier
152
+	{
153
+		if (!$this->hasCPSQualifier()) {
154
+			throw new \LogicException("CPS qualifier not set.");
155
+		}
156
+		return $this->get(PolicyQualifierInfo::OID_CPS);
157
+	}
158
+    
159
+	/**
160
+	 * Check whether user notice qualifier is present.
161
+	 *
162
+	 * @return bool
163
+	 */
164
+	public function hasUserNoticeQualifier(): bool
165
+	{
166
+		return $this->has(PolicyQualifierInfo::OID_UNOTICE);
167
+	}
168
+    
169
+	/**
170
+	 * Get user notice qualifier.
171
+	 *
172
+	 * @throws \LogicException
173
+	 * @return UserNoticeQualifier
174
+	 */
175
+	public function userNoticeQualifier(): UserNoticeQualifier
176
+	{
177
+		if (!$this->hasUserNoticeQualifier()) {
178
+			throw new \LogicException("User notice qualifier not set.");
179
+		}
180
+		return $this->get(PolicyQualifierInfo::OID_UNOTICE);
181
+	}
182
+    
183
+	/**
184
+	 * Get ASN.1 structure.
185
+	 *
186
+	 * @return Sequence
187
+	 */
188
+	public function toASN1(): Sequence
189
+	{
190
+		$elements = array(new ObjectIdentifier($this->_oid));
191
+		if (count($this->_qualifiers)) {
192
+			$qualifiers = array_map(
193
+				function (PolicyQualifierInfo $pqi) {
194
+					return $pqi->toASN1();
195
+				}, array_values($this->_qualifiers));
196
+			$elements[] = new Sequence(...$qualifiers);
197
+		}
198
+		return new Sequence(...$elements);
199
+	}
200
+    
201
+	/**
202
+	 * Get number of qualifiers.
203
+	 *
204
+	 * @see \Countable::count()
205
+	 * @return int
206
+	 */
207
+	public function count(): int
208
+	{
209
+		return count($this->_qualifiers);
210
+	}
211
+    
212
+	/**
213
+	 * Get iterator for qualifiers.
214
+	 *
215
+	 * @see \IteratorAggregate::getIterator()
216
+	 * @return \ArrayIterator
217
+	 */
218
+	public function getIterator(): \ArrayIterator
219
+	{
220
+		return new \ArrayIterator($this->_qualifiers);
221
+	}
222 222
 }
Please login to merge, or discard this patch.
lib/X509/Feature/AttributeContainer.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     {
74 74
         $oid = AttributeType::attrNameToOID($name);
75 75
         $attrs = array_filter($this->_attributes,
76
-            function (Attribute $attr) use ($oid) {
76
+            function(Attribute $attr) use ($oid) {
77 77
                 return $attr->oid() == $oid;
78 78
             });
79 79
         return array_values($attrs);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     {
117 117
         $obj = clone $this;
118 118
         $obj->_attributes = array_filter($obj->_attributes,
119
-            function (Attribute $a) use ($attr) {
119
+            function(Attribute $a) use ($attr) {
120 120
                 return $a->oid() != $attr->oid();
121 121
             });
122 122
         $obj->_attributes[] = $attr;
Please login to merge, or discard this patch.
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -14,136 +14,136 @@
 block discarded – undo
14 14
  */
15 15
 trait AttributeContainer
16 16
 {
17
-    /**
18
-     * Array of attributes.
19
-     *
20
-     * @var Attribute[] $_attributes
21
-     */
22
-    protected $_attributes;
17
+	/**
18
+	 * Array of attributes.
19
+	 *
20
+	 * @var Attribute[] $_attributes
21
+	 */
22
+	protected $_attributes;
23 23
     
24
-    /**
25
-     * Find first attribute of given name or OID.
26
-     *
27
-     * @param string $name
28
-     * @return Attribute|null
29
-     */
30
-    protected function _findFirst(string $name)
31
-    {
32
-        $oid = AttributeType::attrNameToOID($name);
33
-        foreach ($this->_attributes as $attr) {
34
-            if ($attr->oid() == $oid) {
35
-                return $attr;
36
-            }
37
-        }
38
-        return null;
39
-    }
24
+	/**
25
+	 * Find first attribute of given name or OID.
26
+	 *
27
+	 * @param string $name
28
+	 * @return Attribute|null
29
+	 */
30
+	protected function _findFirst(string $name)
31
+	{
32
+		$oid = AttributeType::attrNameToOID($name);
33
+		foreach ($this->_attributes as $attr) {
34
+			if ($attr->oid() == $oid) {
35
+				return $attr;
36
+			}
37
+		}
38
+		return null;
39
+	}
40 40
     
41
-    /**
42
-     * Check whether attribute is present.
43
-     *
44
-     * @param string $name OID or attribute name
45
-     * @return boolean
46
-     */
47
-    public function has(string $name): bool
48
-    {
49
-        return null !== $this->_findFirst($name);
50
-    }
41
+	/**
42
+	 * Check whether attribute is present.
43
+	 *
44
+	 * @param string $name OID or attribute name
45
+	 * @return boolean
46
+	 */
47
+	public function has(string $name): bool
48
+	{
49
+		return null !== $this->_findFirst($name);
50
+	}
51 51
     
52
-    /**
53
-     * Get first attribute by OID or attribute name.
54
-     *
55
-     * @param string $name OID or attribute name
56
-     * @throws \OutOfBoundsException
57
-     * @return Attribute
58
-     */
59
-    public function firstOf(string $name): Attribute
60
-    {
61
-        $attr = $this->_findFirst($name);
62
-        if (!$attr) {
63
-            throw new \UnexpectedValueException("No $name attribute.");
64
-        }
65
-        return $attr;
66
-    }
52
+	/**
53
+	 * Get first attribute by OID or attribute name.
54
+	 *
55
+	 * @param string $name OID or attribute name
56
+	 * @throws \OutOfBoundsException
57
+	 * @return Attribute
58
+	 */
59
+	public function firstOf(string $name): Attribute
60
+	{
61
+		$attr = $this->_findFirst($name);
62
+		if (!$attr) {
63
+			throw new \UnexpectedValueException("No $name attribute.");
64
+		}
65
+		return $attr;
66
+	}
67 67
     
68
-    /**
69
-     * Get all attributes of given name.
70
-     *
71
-     * @param string $name OID or attribute name
72
-     * @return Attribute[]
73
-     */
74
-    public function allOf(string $name): array
75
-    {
76
-        $oid = AttributeType::attrNameToOID($name);
77
-        $attrs = array_filter($this->_attributes,
78
-            function (Attribute $attr) use ($oid) {
79
-                return $attr->oid() == $oid;
80
-            });
81
-        return array_values($attrs);
82
-    }
68
+	/**
69
+	 * Get all attributes of given name.
70
+	 *
71
+	 * @param string $name OID or attribute name
72
+	 * @return Attribute[]
73
+	 */
74
+	public function allOf(string $name): array
75
+	{
76
+		$oid = AttributeType::attrNameToOID($name);
77
+		$attrs = array_filter($this->_attributes,
78
+			function (Attribute $attr) use ($oid) {
79
+				return $attr->oid() == $oid;
80
+			});
81
+		return array_values($attrs);
82
+	}
83 83
     
84
-    /**
85
-     * Get all attributes.
86
-     *
87
-     * @return Attribute[]
88
-     */
89
-    public function all(): array
90
-    {
91
-        return $this->_attributes;
92
-    }
84
+	/**
85
+	 * Get all attributes.
86
+	 *
87
+	 * @return Attribute[]
88
+	 */
89
+	public function all(): array
90
+	{
91
+		return $this->_attributes;
92
+	}
93 93
     
94
-    /**
95
-     * Get self with additional attributes added.
96
-     *
97
-     * @param Attribute ...$attribs
98
-     * @return self
99
-     */
100
-    public function withAdditional(Attribute ...$attribs): self
101
-    {
102
-        $obj = clone $this;
103
-        foreach ($attribs as $attr) {
104
-            $obj->_attributes[] = $attr;
105
-        }
106
-        return $obj;
107
-    }
94
+	/**
95
+	 * Get self with additional attributes added.
96
+	 *
97
+	 * @param Attribute ...$attribs
98
+	 * @return self
99
+	 */
100
+	public function withAdditional(Attribute ...$attribs): self
101
+	{
102
+		$obj = clone $this;
103
+		foreach ($attribs as $attr) {
104
+			$obj->_attributes[] = $attr;
105
+		}
106
+		return $obj;
107
+	}
108 108
     
109
-    /**
110
-     * Get self with single unique attribute added.
111
-     *
112
-     * All previous attributes of the same type are removed.
113
-     *
114
-     * @param Attribute $attr
115
-     * @return self
116
-     */
117
-    public function withUnique(Attribute $attr): self
118
-    {
119
-        $obj = clone $this;
120
-        $obj->_attributes = array_filter($obj->_attributes,
121
-            function (Attribute $a) use ($attr) {
122
-                return $a->oid() != $attr->oid();
123
-            });
124
-        $obj->_attributes[] = $attr;
125
-        return $obj;
126
-    }
109
+	/**
110
+	 * Get self with single unique attribute added.
111
+	 *
112
+	 * All previous attributes of the same type are removed.
113
+	 *
114
+	 * @param Attribute $attr
115
+	 * @return self
116
+	 */
117
+	public function withUnique(Attribute $attr): self
118
+	{
119
+		$obj = clone $this;
120
+		$obj->_attributes = array_filter($obj->_attributes,
121
+			function (Attribute $a) use ($attr) {
122
+				return $a->oid() != $attr->oid();
123
+			});
124
+		$obj->_attributes[] = $attr;
125
+		return $obj;
126
+	}
127 127
     
128
-    /**
129
-     * Get number of attributes.
130
-     *
131
-     * @see \Countable::count()
132
-     * @return int
133
-     */
134
-    public function count(): int
135
-    {
136
-        return count($this->_attributes);
137
-    }
128
+	/**
129
+	 * Get number of attributes.
130
+	 *
131
+	 * @see \Countable::count()
132
+	 * @return int
133
+	 */
134
+	public function count(): int
135
+	{
136
+		return count($this->_attributes);
137
+	}
138 138
     
139
-    /**
140
-     * Get iterator for attributes.
141
-     *
142
-     * @see \IteratorAggregate::getIterator()
143
-     * @return \ArrayIterator
144
-     */
145
-    public function getIterator(): \ArrayIterator
146
-    {
147
-        return new \ArrayIterator($this->_attributes);
148
-    }
139
+	/**
140
+	 * Get iterator for attributes.
141
+	 *
142
+	 * @see \IteratorAggregate::getIterator()
143
+	 * @return \ArrayIterator
144
+	 */
145
+	public function getIterator(): \ArrayIterator
146
+	{
147
+		return new \ArrayIterator($this->_attributes);
148
+	}
149 149
 }
Please login to merge, or discard this patch.
lib/X509/AttributeCertificate/AttCertIssuer.php 2 patches
Switch Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,9 +72,9 @@
 block discarded – undo
72 72
         }
73 73
         $tagged = $el->asTagged();
74 74
         switch ($tagged->tag()) {
75
-            case 0:
76
-                return V2Form::fromV2ASN1(
77
-                    $tagged->asImplicit(Element::TYPE_SEQUENCE)->asSequence());
75
+        case 0:
76
+            return V2Form::fromV2ASN1(
77
+                $tagged->asImplicit(Element::TYPE_SEQUENCE)->asSequence());
78 78
         }
79 79
         throw new \UnexpectedValueException("Unsupported issuer type.");
80 80
     }
Please login to merge, or discard this patch.
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -18,66 +18,66 @@
 block discarded – undo
18 18
  */
19 19
 abstract class AttCertIssuer
20 20
 {
21
-    /**
22
-     * Generate ASN.1 element.
23
-     *
24
-     * @return Element
25
-     */
26
-    abstract public function toASN1();
21
+	/**
22
+	 * Generate ASN.1 element.
23
+	 *
24
+	 * @return Element
25
+	 */
26
+	abstract public function toASN1();
27 27
     
28
-    /**
29
-     * Check whether AttCertIssuer identifies given certificate.
30
-     *
31
-     * @param Certificate $cert
32
-     * @return bool
33
-     */
34
-    abstract public function identifiesPKC(Certificate $cert): bool;
28
+	/**
29
+	 * Check whether AttCertIssuer identifies given certificate.
30
+	 *
31
+	 * @param Certificate $cert
32
+	 * @return bool
33
+	 */
34
+	abstract public function identifiesPKC(Certificate $cert): bool;
35 35
     
36
-    /**
37
-     * Initialize from distinguished name.
38
-     *
39
-     * This conforms to RFC 5755 which states that only v2Form must be used,
40
-     * and issuerName must contain exactly one GeneralName of DirectoryName
41
-     * type.
42
-     *
43
-     * @link https://tools.ietf.org/html/rfc5755#section-4.2.3
44
-     * @param Name $name
45
-     * @return self
46
-     */
47
-    public static function fromName(Name $name): self
48
-    {
49
-        return new V2Form(new GeneralNames(new DirectoryName($name)));
50
-    }
36
+	/**
37
+	 * Initialize from distinguished name.
38
+	 *
39
+	 * This conforms to RFC 5755 which states that only v2Form must be used,
40
+	 * and issuerName must contain exactly one GeneralName of DirectoryName
41
+	 * type.
42
+	 *
43
+	 * @link https://tools.ietf.org/html/rfc5755#section-4.2.3
44
+	 * @param Name $name
45
+	 * @return self
46
+	 */
47
+	public static function fromName(Name $name): self
48
+	{
49
+		return new V2Form(new GeneralNames(new DirectoryName($name)));
50
+	}
51 51
     
52
-    /**
53
-     * Initialize from an issuer's public key certificate.
54
-     *
55
-     * @param Certificate $cert
56
-     * @return self
57
-     */
58
-    public static function fromPKC(Certificate $cert): self
59
-    {
60
-        return self::fromName($cert->tbsCertificate()->subject());
61
-    }
52
+	/**
53
+	 * Initialize from an issuer's public key certificate.
54
+	 *
55
+	 * @param Certificate $cert
56
+	 * @return self
57
+	 */
58
+	public static function fromPKC(Certificate $cert): self
59
+	{
60
+		return self::fromName($cert->tbsCertificate()->subject());
61
+	}
62 62
     
63
-    /**
64
-     * Initialize from ASN.1.
65
-     *
66
-     * @param UnspecifiedType $el CHOICE
67
-     * @throws \UnexpectedValueException
68
-     * @return self
69
-     */
70
-    public static function fromASN1(UnspecifiedType $el): self
71
-    {
72
-        if (!$el->isTagged()) {
73
-            throw new \UnexpectedValueException("v1Form issuer not supported.");
74
-        }
75
-        $tagged = $el->asTagged();
76
-        switch ($tagged->tag()) {
77
-            case 0:
78
-                return V2Form::fromV2ASN1(
79
-                    $tagged->asImplicit(Element::TYPE_SEQUENCE)->asSequence());
80
-        }
81
-        throw new \UnexpectedValueException("Unsupported issuer type.");
82
-    }
63
+	/**
64
+	 * Initialize from ASN.1.
65
+	 *
66
+	 * @param UnspecifiedType $el CHOICE
67
+	 * @throws \UnexpectedValueException
68
+	 * @return self
69
+	 */
70
+	public static function fromASN1(UnspecifiedType $el): self
71
+	{
72
+		if (!$el->isTagged()) {
73
+			throw new \UnexpectedValueException("v1Form issuer not supported.");
74
+		}
75
+		$tagged = $el->asTagged();
76
+		switch ($tagged->tag()) {
77
+			case 0:
78
+				return V2Form::fromV2ASN1(
79
+					$tagged->asImplicit(Element::TYPE_SEQUENCE)->asSequence());
80
+		}
81
+		throw new \UnexpectedValueException("Unsupported issuer type.");
82
+	}
83 83
 }
Please login to merge, or discard this patch.