public function __construct($path, callable $handler) { if (!is_string($path)) { throw new InvalidArgumentException('Path must be a string'); } $this->path = $path; $this->handler = $handler; }