code: public function setState(?int $state)
      {
          if (null !== $state && $this->getStates() && !in_array($state, $this->getStates(), true)) {
              throw new DomainException('State "'.$state.'" does not exist.');
          }
  
          $this->state = $state;
  
          return $this;
      }
docs: Set state
  
  @param integer $state
  @return object
  @throws \DomainException