From 929e015c98ed43560e3d9b893e250d4503de7e8d Mon Sep 17 00:00:00 2001 From: Josh Bruce Date: Thu, 16 Jul 2020 11:47:54 -0500 Subject: [PATCH] Update ESGitHubClient.php --- src/ESGitHubClient.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) 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()