original_string: private function assertValidWill()
      {
          if ($this->hasWill()) {
              $this->assertValidQosLevel($this->getWillQosLevel(), true);
          } else {
              if ($this->getWillQosLevel() > 0) {
                  $this->throwException(
                      sprintf(
                          'Expected a will quality of service level of zero but got %d.',
                          $this->getWillQosLevel()
                      ),
                      true
                  );
              }
  
              if ($this->isWillRetained()) {
                  $this->throwException('There is not will but the will retain flag is set.', true);
              }
          }
      }
code: private function assertValidWill()
      {
          if ($this->hasWill()) {
              $this->assertValidQosLevel($this->getWillQosLevel(), true);
          } else {
              if ($this->getWillQosLevel() > 0) {
                  $this->throwException(
                      sprintf(
                          'Expected a will quality of service level of zero but got %d.',
                          $this->getWillQosLevel()
                      ),
                      true
                  );
              }
  
              if ($this->isWillRetained()) {
                  $this->throwException('There is not will but the will retain flag is set.', true);
              }
          }
      }
code_tokens: private function assertValidWill ( ) { if ( $ this -> hasWill ( ) ) { $ this -> assertValidQosLevel ( $ this -> getWillQosLevel ( ) , true ) ; } else { if ( $ this -> getWillQosLevel ( ) > 0 ) { $ this -> throwException ( sprintf ( 'Expected a will quality of service level of zero but got %d.' , $ this -> getWillQosLevel ( ) ) , true ) ; } if ( $ this -> isWillRetained ( ) ) { $ this -> throwException ( 'There is not will but the will retain flag is set.' , true ) ; } } }
docstring: Asserts that all will flags and quality of service are correct.
  
  @throws MalformedPacketException
docstring_tokens: Asserts that all will flags and quality of service are correct .