-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from realtimeregister/ssl
Add SSL support
- Loading branch information
Showing
31 changed files
with
883 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace SandwaveIo\RealtimeRegister\Domain; | ||
|
||
use DateTime; | ||
|
||
class AuthKey implements DomainObjectInterface | ||
{ | ||
public function __construct( | ||
public readonly string $authKey, | ||
public readonly DateTime $validity | ||
) { | ||
} | ||
|
||
public function toArray(): array | ||
{ | ||
return [ | ||
'authKey' => $this->authKey, | ||
'validity' => $this->validity->format('Y-m-d\TH:i:s\Z'), | ||
]; | ||
} | ||
|
||
public static function fromArray(array $json): AuthKey | ||
{ | ||
return new AuthKey($json['authKey'], new DateTime($json['validity'])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace SandwaveIo\RealtimeRegister\Domain; | ||
|
||
class CertificateInfoProcess implements DomainObjectInterface | ||
{ | ||
public function __construct( | ||
public string $commonName, | ||
public bool $requiresAttention, | ||
public ?int $certificateId, | ||
public ?CertificateValidation $validations, | ||
public ?int $processId | ||
) { | ||
} | ||
|
||
public function toArray(): array | ||
{ | ||
return array_filter([ | ||
'commonName' => $this->commonName, | ||
'requiresAttention' => $this->requiresAttention, | ||
'certificateId' => $this->certificateId, | ||
'validations' => $this->validations?->toArray(), | ||
'processId' => $this->processId, | ||
], function ($x) { | ||
return ! is_null($x); | ||
}); | ||
} | ||
|
||
public static function fromArray(array $json): CertificateInfoProcess | ||
{ | ||
return new CertificateInfoProcess( | ||
$json['commonName'], | ||
$json['requiresAttention'], | ||
$json['certificateId'], | ||
CertificateValidation::fromArray($json['validations']), | ||
array_key_exists('headers', $json) ? self::getProcessId($json['headers']) : null | ||
); | ||
} | ||
|
||
private static function getProcessId(array $json): ?int | ||
{ | ||
return array_key_exists('x-process-id', $json) ? (int) $json['x-process-id'][0] : null; | ||
} | ||
} |
Oops, something went wrong.