public static function fromDirectory(string $directory) : self { if (!file_exists($directory . '/.git')) { throw new \InvalidArgumentException(sprintf('"%s" is not a valid repository path', $directory)); } return new self($directory); }