9
9
use Magento \Customer \Model \Metadata \ElementFactory ;
10
10
use Magento \Directory \Helper \Data as DirectoryHelper ;
11
11
use Magento \Framework \Api \ArrayObjectSearch ;
12
+ use Magento \Framework \Stdlib \StringUtils ;
12
13
use Magento \Framework \Locale \ResolverInterface ;
13
14
use Psr \Log \LoggerInterface as PsrLogger ;
14
15
use Magento \Framework \Stdlib \DateTime \TimezoneInterface as MagentoTimezone ;
@@ -24,7 +25,7 @@ class Postcode extends AbstractData
24
25
protected $ directoryHelper ;
25
26
26
27
/**
27
- * @var \Magento\Framework\Stdlib\ StringUtils
28
+ * @var StringUtils
28
29
*/
29
30
protected $ _string ;
30
31
@@ -37,7 +38,7 @@ class Postcode extends AbstractData
37
38
* @param string $entityTypeCode
38
39
* @param bool $isAjax
39
40
* @param DirectoryHelper $directoryHelper
40
- * @param \Magento\Framework\Stdlib\ StringUtils $stringHelper
41
+ * @param StringUtils|null $stringHelper
41
42
*/
42
43
public function __construct (
43
44
MagentoTimezone $ localeDate ,
@@ -48,9 +49,12 @@ public function __construct(
48
49
$ entityTypeCode ,
49
50
$ isAjax ,
50
51
DirectoryHelper $ directoryHelper ,
51
- \ Magento \ Framework \ Stdlib \ StringUtils $ stringHelper
52
+ StringUtils $ stringHelper = null
52
53
) {
53
54
$ this ->directoryHelper = $ directoryHelper ;
55
+ if (is_null ($ stringHelper )) {
56
+ $ stringHelper = \Magento \Framework \App \ObjectManager::getInstance ()->get (StringUtils::class);
57
+ }
54
58
$ this ->_string = $ stringHelper ;
55
59
parent ::__construct (
56
60
$ localeDate ,
@@ -65,6 +69,7 @@ public function __construct(
65
69
66
70
/**
67
71
* Validate postal/zip code
72
+ *
68
73
* Return true and skip validation if country zip code is optional
69
74
*
70
75
* @param array|null|string $value
@@ -99,31 +104,31 @@ public function validateValue($value)
99
104
}
100
105
101
106
/**
102
- * { @inheritdoc}
107
+ * @inheritdoc
103
108
*/
104
109
public function extractValue (\Magento \Framework \App \RequestInterface $ request )
105
110
{
106
111
return $ this ->_applyInputFilter ($ this ->_getRequestValue ($ request ));
107
112
}
108
113
109
114
/**
110
- * { @inheritdoc}
115
+ * @inheritdoc
111
116
*/
112
117
public function compactValue ($ value )
113
118
{
114
119
return $ value ;
115
120
}
116
121
117
122
/**
118
- * { @inheritdoc}
123
+ * @inheritdoc
119
124
*/
120
125
public function restoreValue ($ value )
121
126
{
122
127
return $ this ->compactValue ($ value );
123
128
}
124
129
125
130
/**
126
- * { @inheritdoc}
131
+ * @inheritdoc
127
132
*/
128
133
public function outputValue ($ format = ElementFactory::OUTPUT_FORMAT_TEXT )
129
134
{
0 commit comments