pattern = $pattern; $this->errorMessage = $errorMessage; } public function isSatisfiedBy(string $value): bool { return preg_match($this->pattern, $value) === 1; } public function getErrorMessage(): string { return $this->errorMessage; } }