File tree Expand file tree Collapse file tree 4 files changed +44
-47
lines changed
Model/Customer/Anonymize/Processor
Service/Anonymize/Anonymizer Expand file tree Collapse file tree 4 files changed +44
-47
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ private function anonymizeCustomer(int $customerId): void
131
131
$ secureData = $ this ->customerRegistry ->retrieveSecureData ($ customerId );
132
132
$ dateTime = (new DateTime ())->setTimestamp (PHP_INT_MAX );
133
133
$ secureData ->setData ('lock_expires ' , $ dateTime ->format (DateTimeFormat::DATETIME_PHP_FORMAT ));
134
- $ secureData ->setPasswordHash (sha1 (uniqid (mt_rand (), true )));
134
+ $ secureData ->setPasswordHash (sha1 (uniqid (( string ) mt_rand (), true )));
135
135
136
136
$ this ->customerRepository ->save (
137
137
$ this ->anonymizer ->anonymize ($ this ->customerRepository ->getById ($ customerId ))
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © OpenGento, All rights reserved.
4
+ * See LICENSE bundled with this library for license details.
5
+ */
6
+ declare (strict_types=1 );
7
+
8
+ namespace Opengento \Gdpr \Service \Anonymize \Anonymizer ;
9
+
10
+ use Magento \Framework \Exception \LocalizedException ;
11
+ use Magento \Framework \Math \Random ;
12
+ use Opengento \Gdpr \Service \Anonymize \AnonymizerInterface ;
13
+ use function sprintf ;
14
+
15
+ final class Street implements AnonymizerInterface
16
+ {
17
+ private const STREET_LENGTH = 5 ;
18
+ private const MIN_NUM = 0 ;
19
+ private const MAX_NUM = 100 ;
20
+
21
+ /**
22
+ * @var Random
23
+ */
24
+ private $ random ;
25
+
26
+ public function __construct (
27
+ Random $ random
28
+ ) {
29
+ $ this ->random = $ random ;
30
+ }
31
+
32
+ /**
33
+ * @throws LocalizedException
34
+ */
35
+ public function anonymize ($ value ): array
36
+ {
37
+ return [sprintf (
38
+ '%s %s ' ,
39
+ Random::getRandomNumber (self ::MIN_NUM , self ::MAX_NUM ),
40
+ $ this ->random ->getRandomString (self ::STREET_LENGTH )
41
+ )];
42
+ }
43
+ }
Original file line number Diff line number Diff line change 180
180
</arguments >
181
181
</virtualType >
182
182
<!-- Anonymize Management -->
183
- <virtualType name =" Opengento\Gdpr\Service\Anonymize\Anonymizer\Street" type =" Opengento\Gdpr\Service\Anonymize\Anonymizer\ArrayValue" >
184
- <arguments >
185
- <argument name =" anonymizers" xsi : type =" array" >
186
- <item name =" 0" xsi : type =" object" >Opengento\Gdpr\Service\Anonymize\Anonymizer\Number</item >
187
- <item name =" 1" xsi : type =" object" >Opengento\Gdpr\Service\Anonymize\Anonymizer\AlphaLower</item >
188
- </argument >
189
- </arguments >
190
- </virtualType >
191
183
<type name =" Opengento\Gdpr\Service\Anonymize\AnonymizerFactory" >
192
184
<arguments >
193
185
<argument name =" anonymizers" xsi : type =" array" >
You can’t perform that action at this time.
0 commit comments