original_string: protected function validateNumericCodeCurrency()
      {
          $field = 'numeric_code';
  
          if ($this->isExcluded($field)) {
              return null;
          }
  
          $value = $this->getSubmitted($field);
  
          if ($this->isUpdating() && !isset($value)) {
              $this->unsetSubmitted($field);
              return null;
          }
  
          $label = $this->translation->text('Numeric code');
  
          if (empty($value)) {
              $this->setErrorRequired($field, $label);
              return false;
          }
  
          if (preg_match('/^[0-9]{3}$/', $value) !== 1) {
              $this->setErrorInvalid($field, $label);
              return false;
          }
  
          $updating = $this->getUpdating();
  
          if (isset($updating['numeric_code']) && $updating['numeric_code'] == $value) {
              return true;
          }
  
          foreach ($this->currency->getList() as $currency) {
              if ($currency['numeric_code'] == $value) {
                  $this->setErrorExists($field, $label);
                  return false;
              }
          }
  
          return true;
      }
code: protected function validateNumericCodeCurrency()
      {
          $field = 'numeric_code';
  
          if ($this->isExcluded($field)) {
              return null;
          }
  
          $value = $this->getSubmitted($field);
  
          if ($this->isUpdating() && !isset($value)) {
              $this->unsetSubmitted($field);
              return null;
          }
  
          $label = $this->translation->text('Numeric code');
  
          if (empty($value)) {
              $this->setErrorRequired($field, $label);
              return false;
          }
  
          if (preg_match('/^[0-9]{3}$/', $value) !== 1) {
              $this->setErrorInvalid($field, $label);
              return false;
          }
  
          $updating = $this->getUpdating();
  
          if (isset($updating['numeric_code']) && $updating['numeric_code'] == $value) {
              return true;
          }
  
          foreach ($this->currency->getList() as $currency) {
              if ($currency['numeric_code'] == $value) {
                  $this->setErrorExists($field, $label);
                  return false;
              }
          }
  
          return true;
      }
code_tokens: protected function validateNumericCodeCurrency ( ) { $ field = 'numeric_code' ; if ( $ this -> isExcluded ( $ field ) ) { return null ; } $ value = $ this -> getSubmitted ( $ field ) ; if ( $ this -> isUpdating ( ) && ! isset ( $ value ) ) { $ this -> unsetSubmitted ( $ field ) ; return null ; } $ label = $ this -> translation -> text ( 'Numeric code' ) ; if ( empty ( $ value ) ) { $ this -> setErrorRequired ( $ field , $ label ) ; return false ; } if ( preg_match ( '/^[0-9]{3}$/' , $ value ) !== 1 ) { $ this -> setErrorInvalid ( $ field , $ label ) ; return false ; } $ updating = $ this -> getUpdating ( ) ; if ( isset ( $ updating [ 'numeric_code' ] ) && $ updating [ 'numeric_code' ] == $ value ) { return true ; } foreach ( $ this -> currency -> getList ( ) as $ currency ) { if ( $ currency [ 'numeric_code' ] == $ value ) { $ this -> setErrorExists ( $ field , $ label ) ; return false ; } } return true ; }
docstring: Validates currency numeric code
  @return boolean|null
docstring_tokens: Validates currency numeric code