-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
edfc1c3
commit 340d759
Showing
4 changed files
with
44 additions
and
47 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Copyright © OpenGento, All rights reserved. | ||
* See LICENSE bundled with this library for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Opengento\Gdpr\Service\Anonymize\Anonymizer; | ||
|
||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\Framework\Math\Random; | ||
use Opengento\Gdpr\Service\Anonymize\AnonymizerInterface; | ||
use function sprintf; | ||
|
||
final class Street implements AnonymizerInterface | ||
{ | ||
private const STREET_LENGTH = 5; | ||
private const MIN_NUM = 0; | ||
private const MAX_NUM = 100; | ||
|
||
/** | ||
* @var Random | ||
*/ | ||
private $random; | ||
|
||
public function __construct( | ||
Random $random | ||
) { | ||
$this->random = $random; | ||
} | ||
|
||
/** | ||
* @throws LocalizedException | ||
*/ | ||
public function anonymize($value): array | ||
{ | ||
return [sprintf( | ||
'%s %s', | ||
Random::getRandomNumber(self::MIN_NUM, self::MAX_NUM), | ||
$this->random->getRandomString(self::STREET_LENGTH) | ||
)]; | ||
} | ||
} |
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