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 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
         $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.
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/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/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.
X509/AttributeCertificate/Attribute/AuthenticationInfoAttributeValue.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@
 block discarded – undo
11 11
  */
12 12
 class AuthenticationInfoAttributeValue extends SvceAuthInfo
13 13
 {
14
-    const OID = "1.3.6.1.5.5.7.10.1";
14
+	const OID = "1.3.6.1.5.5.7.10.1";
15 15
     
16
-    /**
17
-     * Constructor.
18
-     *
19
-     * @param GeneralName $service
20
-     * @param GeneralName $ident
21
-     * @param string|null $auth_info
22
-     */
23
-    public function __construct(GeneralName $service, GeneralName $ident,
24
-        $auth_info = null)
25
-    {
26
-        parent::__construct($service, $ident, $auth_info);
27
-        $this->_oid = self::OID;
28
-    }
16
+	/**
17
+	 * Constructor.
18
+	 *
19
+	 * @param GeneralName $service
20
+	 * @param GeneralName $ident
21
+	 * @param string|null $auth_info
22
+	 */
23
+	public function __construct(GeneralName $service, GeneralName $ident,
24
+		$auth_info = null)
25
+	{
26
+		parent::__construct($service, $ident, $auth_info);
27
+		$this->_oid = self::OID;
28
+	}
29 29
 }
Please login to merge, or discard this patch.
lib/X509/AttributeCertificate/Attribute/ChargingIdentityAttributeValue.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@
 block discarded – undo
9 9
  */
10 10
 class ChargingIdentityAttributeValue extends IetfAttrSyntax
11 11
 {
12
-    const OID = "1.3.6.1.5.5.7.10.3";
12
+	const OID = "1.3.6.1.5.5.7.10.3";
13 13
     
14
-    /**
15
-     * Constructor.
16
-     *
17
-     * @param IetfAttrValue ...$values
18
-     */
19
-    public function __construct(IetfAttrValue ...$values)
20
-    {
21
-        parent::__construct(...$values);
22
-        $this->_oid = self::OID;
23
-    }
14
+	/**
15
+	 * Constructor.
16
+	 *
17
+	 * @param IetfAttrValue ...$values
18
+	 */
19
+	public function __construct(IetfAttrValue ...$values)
20
+	{
21
+		parent::__construct(...$values);
22
+		$this->_oid = self::OID;
23
+	}
24 24
 }
Please login to merge, or discard this patch.
lib/X509/AttributeCertificate/Attribute/AccessIdentityAttributeValue.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@
 block discarded – undo
11 11
  */
12 12
 class AccessIdentityAttributeValue extends SvceAuthInfo
13 13
 {
14
-    const OID = "1.3.6.1.5.5.7.10.2";
14
+	const OID = "1.3.6.1.5.5.7.10.2";
15 15
     
16
-    /**
17
-     * Constructor.
18
-     *
19
-     * @param GeneralName $service
20
-     * @param GeneralName $ident
21
-     */
22
-    public function __construct(GeneralName $service, GeneralName $ident)
23
-    {
24
-        parent::__construct($service, $ident, null);
25
-        $this->_oid = self::OID;
26
-    }
16
+	/**
17
+	 * Constructor.
18
+	 *
19
+	 * @param GeneralName $service
20
+	 * @param GeneralName $ident
21
+	 */
22
+	public function __construct(GeneralName $service, GeneralName $ident)
23
+	{
24
+		parent::__construct($service, $ident, null);
25
+		$this->_oid = self::OID;
26
+	}
27 27
 }
Please login to merge, or discard this patch.