public function setPattern(string $pattern) : self { if (empty($pattern)) { throw new Exception('Pattern could not be empty'); } $this->pattern = $pattern; return $this; }