@@ -92,16 +92,16 @@ |
||
| 92 | 92 | { |
| 93 | 93 | $dt = $this->_dt; |
| 94 | 94 | switch ($this->_type) { |
| 95 | - case Element::TYPE_UTC_TIME: |
|
| 96 | - return new UTCTime($dt); |
|
| 97 | - case Element::TYPE_GENERALIZED_TIME: |
|
| 98 | - // GeneralizedTime must not contain fractional seconds |
|
| 99 | - // (rfc5280 4.1.2.5.2) |
|
| 100 | - if (0 !== intval($dt->format('u'))) { |
|
| 101 | - // remove fractional seconds (round down) |
|
| 102 | - $dt = self::_roundDownFractionalSeconds($dt); |
|
| 103 | - } |
|
| 104 | - return new GeneralizedTime($dt); |
|
| 95 | + case Element::TYPE_UTC_TIME: |
|
| 96 | + return new UTCTime($dt); |
|
| 97 | + case Element::TYPE_GENERALIZED_TIME: |
|
| 98 | + // GeneralizedTime must not contain fractional seconds |
|
| 99 | + // (rfc5280 4.1.2.5.2) |
|
| 100 | + if (0 !== intval($dt->format('u'))) { |
|
| 101 | + // remove fractional seconds (round down) |
|
| 102 | + $dt = self::_roundDownFractionalSeconds($dt); |
|
| 103 | + } |
|
| 104 | + return new GeneralizedTime($dt); |
|
| 105 | 105 | } |
| 106 | 106 | throw new \UnexpectedValueException( |
| 107 | 107 | 'Time type ' . Element::tagToName($this->_type) . ' not supported.'); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Sop\X509\Certificate\Extension\Target; |
| 6 | 6 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | public static function fromASN1(Sequence $seq): self |
| 42 | 42 | { |
| 43 | 43 | $targets = array_map( |
| 44 | - function (UnspecifiedType $el) { |
|
| 44 | + function(UnspecifiedType $el) { |
|
| 45 | 45 | return Target::fromASN1($el->asTagged()); |
| 46 | 46 | }, $seq->elements()); |
| 47 | 47 | return new self(...$targets); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | public function toASN1(): Sequence |
| 103 | 103 | { |
| 104 | 104 | $elements = array_map( |
| 105 | - function (Target $target) { |
|
| 105 | + function(Target $target) { |
|
| 106 | 106 | return $target->toASN1(); |
| 107 | 107 | }, $this->_targets); |
| 108 | 108 | return new Sequence(...$elements); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | { |
| 142 | 142 | return array_values( |
| 143 | 143 | array_filter($this->_targets, |
| 144 | - function (Target $target) use ($type) { |
|
| 144 | + function(Target $target) use ($type) { |
|
| 145 | 145 | return $target->type() === $type; |
| 146 | 146 | })); |
| 147 | 147 | } |