original_string: protected function validateSet($key, $value)
      {
          $maxItems = $this->getMaxItems();
          if ((is_null($key) || !array_key_exists($key, $this->items)) && $maxItems != 0 && $this->count() >= $maxItems) {
              throw new ItemCountException('The maximum number of items has been reached on this field.');
          }
  
          if (is_null($key) && is_null($value)) {
              throw new NullValueException('You cannot add a null value');
          }
      }
code: protected function validateSet($key, $value)
      {
          $maxItems = $this->getMaxItems();
          if ((is_null($key) || !array_key_exists($key, $this->items)) && $maxItems != 0 && $this->count() >= $maxItems) {
              throw new ItemCountException('The maximum number of items has been reached on this field.');
          }
  
          if (is_null($key) && is_null($value)) {
              throw new NullValueException('You cannot add a null value');
          }
      }
code_tokens: protected function validateSet ( $ key , $ value ) { $ maxItems = $ this -> getMaxItems ( ) ; if ( ( is_null ( $ key ) || ! array_key_exists ( $ key , $ this -> items ) ) && $ maxItems != 0 && $ this -> count ( ) >= $ maxItems ) { throw new ItemCountException ( 'The maximum number of items has been reached on this field.' ) ; } if ( is_null ( $ key ) && is_null ( $ value ) ) { throw new NullValueException ( 'You cannot add a null value' ) ; } }
docstring: Validate input of OffsetSet
  
  @param $key
  @param $value
  @throws ItemCountException
  @throws NullValueException
docstring_tokens: Validate input of OffsetSet