-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VSVGVQ-51: add UrlSuffixGenerator and interface, add timezone to date…
…time in registration, remove find on user in registrationdoctrinerepository
- Loading branch information
Showing
14 changed files
with
201 additions
and
64 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,10 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace VSV\GVQ_API\Registration; | ||
|
||
use VSV\GVQ_API\Registration\ValueObjects\UrlSuffix; | ||
|
||
interface UrlSuffixGenerator | ||
{ | ||
public function createUrlSuffix(): UrlSuffix; | ||
} |
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,13 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace VSV\GVQ_API\Registration; | ||
|
||
use VSV\GVQ_API\Registration\ValueObjects\UrlSuffix; | ||
|
||
class UrlSuffixHashGenerator implements UrlSuffixGenerator | ||
{ | ||
public function createUrlSuffix(): UrlSuffix | ||
{ | ||
return new UrlSuffix(bin2hex(random_bytes(11))); | ||
} | ||
} |
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,47 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace VSV\GVQ_API\Registration\ValueObjects; | ||
|
||
class UrlSuffix | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $value; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
private $minLimit = 22; | ||
|
||
/** | ||
* @param string $value | ||
*/ | ||
public function __construct(string $value) | ||
{ | ||
if (strlen($value) < $this->minLimit) { | ||
throw new \InvalidArgumentException( | ||
'Value has to be at least '.$this->minLimit.' characters long, '.strlen($value).' given.' | ||
); | ||
} | ||
|
||
$this->value = $value; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function toNative(): string | ||
{ | ||
return $this->value; | ||
} | ||
|
||
/** | ||
* @param UrlSuffix $suffix | ||
* @return bool | ||
*/ | ||
public function equals(UrlSuffix $suffix): bool | ||
{ | ||
return $this->toNative() === $suffix->toNative(); | ||
} | ||
} |
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
Oops, something went wrong.