code: public function setEntity(?string $entity)
      {
          if (null !== $entity) {
              if (!preg_match('/^[a-z]+$/i', $entity)) {
                  throw new DomainException('Entity is not valid.');
              }
          }
  
          $this->entity = $entity;
  
          return $this;
      }
docs: Set entity
  
  @param string $entity
  @return object
  @throws \DomainException