-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SDK-3636] Add PSR-14 Event Dispatcher, for ultra customizable sessio…
…n storage purposes (#646) * [SDK-3636] Add PSR-14 Event Dispatcher, for ultra customizable session storage purposes * test: Linter fixes
- Loading branch information
Showing
10 changed files
with
803 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Auth0\SDK\Event\Psr14Store; | ||
|
||
use Auth0\SDK\Contract\Auth0Event; | ||
use Auth0\SDK\Contract\StoreInterface; | ||
|
||
final class Boot implements Auth0Event | ||
{ | ||
private StoreInterface $store; | ||
private string $prefix; | ||
|
||
public function __construct( | ||
StoreInterface $store, | ||
string $prefix | ||
) { | ||
$this->store = $store; | ||
$this->prefix = $prefix; | ||
} | ||
|
||
public function getStore(): StoreInterface | ||
{ | ||
return $this->store; | ||
} | ||
|
||
public function getPrefix(): string | ||
{ | ||
return $this->prefix; | ||
} | ||
|
||
public function setPrefix( | ||
string $prefix | ||
): self { | ||
$this->prefix = $prefix; | ||
return $this; | ||
} | ||
} |
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,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Auth0\SDK\Event\Psr14Store; | ||
|
||
use Auth0\SDK\Contract\Auth0Event; | ||
use Auth0\SDK\Contract\StoreInterface; | ||
|
||
final class Clear implements Auth0Event | ||
{ | ||
private StoreInterface $store; | ||
private ?bool $success = null; | ||
|
||
public function __construct( | ||
StoreInterface $store | ||
) { | ||
$this->store = $store; | ||
} | ||
|
||
public function getStore(): StoreInterface | ||
{ | ||
return $this->store; | ||
} | ||
|
||
public function getSuccess(): ?bool | ||
{ | ||
return $this->success; | ||
} | ||
|
||
public function setSuccess( | ||
?bool $success | ||
): self { | ||
$this->success = $success; | ||
return $this; | ||
} | ||
} |
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,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Auth0\SDK\Event\Psr14Store; | ||
|
||
use Auth0\SDK\Contract\Auth0Event; | ||
use Auth0\SDK\Contract\StoreInterface; | ||
|
||
final class Defer implements Auth0Event | ||
{ | ||
private StoreInterface $store; | ||
private bool $state; | ||
|
||
public function __construct( | ||
StoreInterface $store, | ||
bool $state | ||
) { | ||
$this->store = $store; | ||
$this->state = $state; | ||
} | ||
|
||
public function getStore(): StoreInterface | ||
{ | ||
return $this->store; | ||
} | ||
|
||
public function getState(): bool | ||
{ | ||
return $this->state; | ||
} | ||
} |
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,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Auth0\SDK\Event\Psr14Store; | ||
|
||
use Auth0\SDK\Contract\Auth0Event; | ||
use Auth0\SDK\Contract\StoreInterface; | ||
|
||
final class Delete implements Auth0Event | ||
{ | ||
private StoreInterface $store; | ||
private string $key; | ||
private ?bool $success = null; | ||
|
||
public function __construct( | ||
StoreInterface $store, | ||
string $key | ||
) { | ||
$this->store = $store; | ||
$this->key = $key; | ||
} | ||
|
||
public function getStore(): StoreInterface | ||
{ | ||
return $this->store; | ||
} | ||
|
||
public function getKey(): string | ||
{ | ||
return $this->key; | ||
} | ||
|
||
public function getSuccess(): ?bool | ||
{ | ||
return $this->success; | ||
} | ||
|
||
public function setSuccess( | ||
?bool $success | ||
): self { | ||
$this->success = $success; | ||
return $this; | ||
} | ||
} |
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,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Auth0\SDK\Event\Psr14Store; | ||
|
||
use Auth0\SDK\Contract\Auth0Event; | ||
use Auth0\SDK\Contract\StoreInterface; | ||
|
||
final class Destruct implements Auth0Event | ||
{ | ||
private StoreInterface $store; | ||
|
||
public function __construct( | ||
StoreInterface $store | ||
) { | ||
$this->store = $store; | ||
} | ||
|
||
public function getStore(): StoreInterface | ||
{ | ||
return $this->store; | ||
} | ||
} |
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,81 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Auth0\SDK\Event\Psr14Store; | ||
|
||
use Auth0\SDK\Contract\Auth0Event; | ||
use Auth0\SDK\Contract\StoreInterface; | ||
|
||
final class Get implements Auth0Event | ||
{ | ||
private StoreInterface $store; | ||
private ?bool $missed = null; | ||
private ?bool $success = null; | ||
private string $key; | ||
|
||
/** | ||
* @var mixed | ||
*/ | ||
private $value; | ||
|
||
public function __construct( | ||
StoreInterface $store, | ||
string $key | ||
) { | ||
$this->store = $store; | ||
$this->key = $key; | ||
} | ||
|
||
public function getStore(): StoreInterface | ||
{ | ||
return $this->store; | ||
} | ||
|
||
public function getKey(): string | ||
{ | ||
return $this->key; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getValue() | ||
{ | ||
return $this->value ?? null; | ||
} | ||
|
||
/** | ||
* @param mixed $value | ||
*/ | ||
public function setValue( | ||
$value | ||
): self { | ||
$this->value = $value; | ||
return $this; | ||
} | ||
|
||
public function getMissed(): ?bool | ||
{ | ||
return $this->missed; | ||
} | ||
|
||
public function setMissed( | ||
bool $missed | ||
): self { | ||
$this->missed = $missed; | ||
return $this; | ||
} | ||
|
||
public function getSuccess(): ?bool | ||
{ | ||
return $this->success; | ||
} | ||
|
||
public function setSuccess( | ||
bool $success | ||
): self { | ||
$this->success = $success; | ||
return $this; | ||
} | ||
} |
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,65 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Auth0\SDK\Event\Psr14Store; | ||
|
||
use Auth0\SDK\Contract\Auth0Event; | ||
use Auth0\SDK\Contract\StoreInterface; | ||
|
||
final class Set implements Auth0Event | ||
{ | ||
private StoreInterface $store; | ||
private string $key; | ||
private ?bool $success = null; | ||
|
||
/** | ||
* @var mixed | ||
*/ | ||
private $value; | ||
|
||
/** | ||
* @param StoreInterface $store | ||
* @param string $key | ||
* @param mixed $value | ||
*/ | ||
public function __construct( | ||
StoreInterface $store, | ||
string $key, | ||
$value | ||
) { | ||
$this->store = $store; | ||
$this->key = $key; | ||
$this->value = $value; | ||
} | ||
|
||
public function getStore(): StoreInterface | ||
{ | ||
return $this->store; | ||
} | ||
|
||
public function getKey(): string | ||
{ | ||
return $this->key; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getValue() | ||
{ | ||
return $this->value; | ||
} | ||
|
||
public function getSuccess(): ?bool | ||
{ | ||
return $this->success; | ||
} | ||
|
||
public function setSuccess( | ||
?bool $success | ||
): self { | ||
$this->success = $success; | ||
return $this; | ||
} | ||
} |
Oops, something went wrong.