Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Postcode.php
Go to the documentation of this file.
1 <?php
7 
8 class Postcode
9 {
13  protected $directoryHelper;
14 
18  public function __construct(\Magento\Directory\Helper\Data $directoryHelper)
19  {
20  $this->directoryHelper = $directoryHelper;
21  }
22 
30  public function isValid($countryId, $postcode)
31  {
32  return $this->directoryHelper->isZipCodeOptional($countryId) || !empty($postcode);
33  }
34 }
__construct(\Magento\Directory\Helper\Data $directoryHelper)
Definition: Postcode.php:18