original_string: protected function validateQuantityCart()
      {
          $field = 'quantity';
  
          if ($this->isExcluded($field)) {
              return null;
          }
  
          $value = $this->getSubmitted($field);
  
          if (!isset($value)) {
  
              if ($this->isUpdating()) {
                  return null;
              }
  
              $value = 1;
          }
  
          $label = $this->translation->text('Quantity');
  
          if (!is_numeric($value)) {
              $this->setErrorNumeric($field, $label);
              return false;
          }
  
          if (strlen($value) > 2) {
              $this->setErrorLengthRange($field, $label, 1, 2);
              return false;
          }
  
          return true;
      }
code: protected function validateQuantityCart()
      {
          $field = 'quantity';
  
          if ($this->isExcluded($field)) {
              return null;
          }
  
          $value = $this->getSubmitted($field);
  
          if (!isset($value)) {
  
              if ($this->isUpdating()) {
                  return null;
              }
  
              $value = 1;
          }
  
          $label = $this->translation->text('Quantity');
  
          if (!is_numeric($value)) {
              $this->setErrorNumeric($field, $label);
              return false;
          }
  
          if (strlen($value) > 2) {
              $this->setErrorLengthRange($field, $label, 1, 2);
              return false;
          }
  
          return true;
      }
code_tokens: protected function validateQuantityCart ( ) { $ field = 'quantity' ; if ( $ this -> isExcluded ( $ field ) ) { return null ; } $ value = $ this -> getSubmitted ( $ field ) ; if ( ! isset ( $ value ) ) { if ( $ this -> isUpdating ( ) ) { return null ; } $ value = 1 ; } $ label = $ this -> translation -> text ( 'Quantity' ) ; if ( ! is_numeric ( $ value ) ) { $ this -> setErrorNumeric ( $ field , $ label ) ; return false ; } if ( strlen ( $ value ) > 2 ) { $ this -> setErrorLengthRange ( $ field , $ label , 1 , 2 ) ; return false ; } return true ; }
docstring: Validates cart item quantity
  @return boolean|null
docstring_tokens: Validates cart item quantity