99use Magento \Customer \Model \Metadata \ElementFactory ;
1010use Magento \Directory \Helper \Data as DirectoryHelper ;
1111use Magento \Framework \Api \ArrayObjectSearch ;
12+ use Magento \Framework \Stdlib \StringUtils ;
1213use Magento \Framework \Locale \ResolverInterface ;
1314use Psr \Log \LoggerInterface as PsrLogger ;
1415use Magento \Framework \Stdlib \DateTime \TimezoneInterface as MagentoTimezone ;
@@ -24,7 +25,7 @@ class Postcode extends AbstractData
2425 protected $ directoryHelper ;
2526
2627 /**
27- * @var \Magento\Framework\Stdlib\ StringUtils
28+ * @var StringUtils
2829 */
2930 protected $ _string ;
3031
@@ -37,7 +38,7 @@ class Postcode extends AbstractData
3738 * @param string $entityTypeCode
3839 * @param bool $isAjax
3940 * @param DirectoryHelper $directoryHelper
40- * @param \Magento\Framework\Stdlib\ StringUtils $stringHelper
41+ * @param StringUtils|null $stringHelper
4142 */
4243 public function __construct (
4344 MagentoTimezone $ localeDate ,
@@ -48,9 +49,12 @@ public function __construct(
4849 $ entityTypeCode ,
4950 $ isAjax ,
5051 DirectoryHelper $ directoryHelper ,
51- \ Magento \ Framework \ Stdlib \ StringUtils $ stringHelper
52+ StringUtils $ stringHelper = null
5253 ) {
5354 $ this ->directoryHelper = $ directoryHelper ;
55+ if (is_null ($ stringHelper )) {
56+ $ stringHelper = \Magento \Framework \App \ObjectManager::getInstance ()->get (StringUtils::class);
57+ }
5458 $ this ->_string = $ stringHelper ;
5559 parent ::__construct (
5660 $ localeDate ,
@@ -65,6 +69,7 @@ public function __construct(
6569
6670 /**
6771 * Validate postal/zip code
72+ *
6873 * Return true and skip validation if country zip code is optional
6974 *
7075 * @param array|null|string $value
@@ -99,31 +104,31 @@ public function validateValue($value)
99104 }
100105
101106 /**
102- * { @inheritdoc}
107+ * @inheritdoc
103108 */
104109 public function extractValue (\Magento \Framework \App \RequestInterface $ request )
105110 {
106111 return $ this ->_applyInputFilter ($ this ->_getRequestValue ($ request ));
107112 }
108113
109114 /**
110- * { @inheritdoc}
115+ * @inheritdoc
111116 */
112117 public function compactValue ($ value )
113118 {
114119 return $ value ;
115120 }
116121
117122 /**
118- * { @inheritdoc}
123+ * @inheritdoc
119124 */
120125 public function restoreValue ($ value )
121126 {
122127 return $ this ->compactValue ($ value );
123128 }
124129
125130 /**
126- * { @inheritdoc}
131+ * @inheritdoc
127132 */
128133 public function outputValue ($ format = ElementFactory::OUTPUT_FORMAT_TEXT )
129134 {
0 commit comments