pattern = $pattern; return $this; } public function setWeight(float $weight): static { $this->weight = $weight; return $this; } public function detect(): bool|float { $path = $this->logFile->getPath(); if ($path === null || $this->pattern === null) { return false; } if (preg_match($this->pattern, $path) === 1) { return $this->weight; } return false; } }