diff --git a/src/ESGitHubClient.php b/src/ESGitHubClient.php index bc93e42..5affe52 100644 --- a/src/ESGitHubClient.php +++ b/src/ESGitHubClient.php @@ -40,12 +40,25 @@ public function __construct($main, ...$args) $this->ghToken = $args[0]; $this->ghUsername = $args[1]; $this->ghRepo = $args[2]; + + if (isset($args[3]) and strlen($args[3]) > 0) { + $this->useCache = true; + $this->cacheRootPath = $args[3]; + $this->cacheFolderName = $args[4]; + } } public function plus(...$parts) { $path = $this->parts()->plus(...$parts)->join("/")->start("/"); - return static::fold($path, $this->ghToken, $this->ghUsername, $this->ghRepo); + return static::fold( + $path, + $this->ghToken, + $this->ghUsername, + $this->ghRepo, + $this->cacheRootPath, + $this->cacheFolderName + ); } public function client() @@ -77,7 +90,14 @@ function($result, $cacheRootPath) use ($cacheFolderName) { } return ""; }); - return $this; + return static::fold( + $this->value(), + $this->ghToken, + $this->ghUsername, + $this->ghRepo, + $this->cacheRootPath, + $this->cacheFolderName + ); } public function exists()