original_string: protected function validateUnitProduct()
      {
          $allowed = array(
              'size_unit' => $this->convertor->getUnitNames('size'),
              'weight_unit' => $this->convertor->getUnitNames('weight')
          );
  
          $fields = array(
              'size_unit' => $this->translation->text('Size unit'),
              'weight_unit' => $this->translation->text('Weight unit')
          );
  
          $errors = 0;
  
          foreach ($fields as $field => $label) {
  
              $value = $this->getSubmitted($field);
  
              if (isset($value) && !isset($allowed[$field][$value])) {
                  $errors++;
                  $this->setErrorUnavailable($field, $label);
              }
          }
  
          return empty($errors);
      }
code: protected function validateUnitProduct()
      {
          $allowed = array(
              'size_unit' => $this->convertor->getUnitNames('size'),
              'weight_unit' => $this->convertor->getUnitNames('weight')
          );
  
          $fields = array(
              'size_unit' => $this->translation->text('Size unit'),
              'weight_unit' => $this->translation->text('Weight unit')
          );
  
          $errors = 0;
  
          foreach ($fields as $field => $label) {
  
              $value = $this->getSubmitted($field);
  
              if (isset($value) && !isset($allowed[$field][$value])) {
                  $errors++;
                  $this->setErrorUnavailable($field, $label);
              }
          }
  
          return empty($errors);
      }
code_tokens: protected function validateUnitProduct ( ) { $ allowed = array ( 'size_unit' => $ this -> convertor -> getUnitNames ( 'size' ) , 'weight_unit' => $ this -> convertor -> getUnitNames ( 'weight' ) ) ; $ fields = array ( 'size_unit' => $ this -> translation -> text ( 'Size unit' ) , 'weight_unit' => $ this -> translation -> text ( 'Weight unit' ) ) ; $ errors = 0 ; foreach ( $ fields as $ field => $ label ) { $ value = $ this -> getSubmitted ( $ field ) ; if ( isset ( $ value ) && ! isset ( $ allowed [ $ field ] [ $ value ] ) ) { $ errors ++ ; $ this -> setErrorUnavailable ( $ field , $ label ) ; } } return empty ( $ errors ) ; }
docstring: Validates measurement units
  @return boolean
docstring_tokens: Validates measurement units