Skip to content

Commit e32b673

Browse files
committed
Updates GithubAdapter class to changes from other classes.
1 parent d71619f commit e32b673

1 file changed

Lines changed: 26 additions & 18 deletions

File tree

src/GithubAdapter.php

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,21 @@ class GithubAdapter extends AbstractAdapter
2121
const VISIBILITY_PRIVATE = 'private';
2222
const VISIBILITY_PUBLIC = 'public';
2323

24-
/** @var Client */
24+
/** @var ClientInterface */
2525
private $client;
2626

2727
/**
28-
* @param Client $client
28+
* @return ClientInterface
2929
*/
30-
public function __construct(Client $client)
30+
final public function getClient()
31+
{
32+
return $this->client;
33+
}
34+
35+
/**
36+
* @param ClientInterface $client
37+
*/
38+
public function __construct(ClientInterface $client)
3139
{
3240
$this->client = $client;
3341
}
@@ -44,7 +52,7 @@ public function __construct(Client $client)
4452
public function write($path, $contents, Config $config)
4553
{
4654
throw new Exception('Write action are not (yet) supported');
47-
//@TODO: return $this->client->create($path, $contents);
55+
//@TODO: return $this->getClient()->create($path, $contents);
4856
}
4957

5058
/**
@@ -59,7 +67,7 @@ public function write($path, $contents, Config $config)
5967
public function update($path, $contents, Config $config)
6068
{
6169
throw new Exception('Write action are not (yet) supported');
62-
// @TODO: return $this->client->update($path, $contents);
70+
// @TODO: return $this->getClient()->update($path, $contents);
6371
}
6472

6573
/**
@@ -73,7 +81,7 @@ public function update($path, $contents, Config $config)
7381
public function rename($path, $newpath)
7482
{
7583
throw new Exception('Write action are not (yet) supported');
76-
// @TODO: return $this->client->rename($path, $newPath);
84+
// @TODO: return $this->getClient()->rename($path, $newPath);
7785
}
7886

7987
/**
@@ -87,7 +95,7 @@ public function rename($path, $newpath)
8795
public function copy($path, $newpath)
8896
{
8997
throw new Exception('Write action are not (yet) supported');
90-
// @TODO: return $this->client->copy($path, $newPath);
98+
// @TODO: return $this->getClient()->copy($path, $newPath);
9199
}
92100

93101
/**
@@ -100,7 +108,7 @@ public function copy($path, $newpath)
100108
public function delete($path)
101109
{
102110
throw new Exception('Write action are not (yet) supported');
103-
// @TODO: return $this->client->delete($path);
111+
// @TODO: return $this->getClient()->delete($path);
104112
}
105113

106114
/**
@@ -113,7 +121,7 @@ public function delete($path)
113121
public function deleteDir($dirname)
114122
{
115123
throw new Exception('Write action are not (yet) supported');
116-
// @TODO: return $this->client->deleteDir($dirname);
124+
// @TODO: return $this->getClient()->deleteDir($dirname);
117125
}
118126

119127
/**
@@ -127,7 +135,7 @@ public function deleteDir($dirname)
127135
public function createDir($dirname, Config $config)
128136
{
129137
throw new Exception('Write action are not (yet) supported');
130-
// @TODO: return $this->client->createDir($dirname);
138+
// @TODO: return $this->getClient()->createDir($dirname);
131139
}
132140

133141
/**
@@ -152,7 +160,7 @@ public function setVisibility($path, $visibility)
152160
*/
153161
public function has($path)
154162
{
155-
return $this->client->exists($path);
163+
return $this->getClient()->exists($path);
156164
}
157165

158166
/**
@@ -164,7 +172,7 @@ public function has($path)
164172
*/
165173
public function read($path)
166174
{
167-
return [Client::KEY_CONTENTS => $this->client->download($path)];
175+
return [ClientInterface::KEY_CONTENTS => $this->getClient()->getFileContents($path)];
168176
}
169177

170178
/**
@@ -177,7 +185,7 @@ public function read($path)
177185
*/
178186
public function listContents($path = '/', $recursive = false)
179187
{
180-
return $this->client->metadata($path, $recursive);
188+
return $this->getClient()->getRecursiveMetadata($path, $recursive);
181189
}
182190

183191
/**
@@ -189,7 +197,7 @@ public function listContents($path = '/', $recursive = false)
189197
*/
190198
public function getMetadata($path)
191199
{
192-
return $this->client->show($path);
200+
return $this->getClient()->getMetaData($path);
193201
}
194202

195203
/**
@@ -201,7 +209,7 @@ public function getMetadata($path)
201209
*/
202210
public function getSize($path)
203211
{
204-
return $this->client->getMetaData($path);
212+
return $this->getClient()->getMetaData($path);
205213
}
206214

207215
/**
@@ -213,7 +221,7 @@ public function getSize($path)
213221
*/
214222
public function getMimetype($path)
215223
{
216-
return ['mimetype' => $this->client->guessMimeType($path)];
224+
return ['mimetype' => $this->getClient()->guessMimeType($path)];
217225
}
218226

219227
/**
@@ -225,7 +233,7 @@ public function getMimetype($path)
225233
*/
226234
public function getTimestamp($path)
227235
{
228-
return $this->client->updated($path);
236+
return $this->getClient()->getLastUpdatedTimestamp($path);
229237
}
230238

231239
/**
@@ -238,7 +246,7 @@ public function getTimestamp($path)
238246
public function getVisibility($path)
239247
{
240248
$recursive = false;
241-
$metadata = $this->client->metadata($path, $recursive);
249+
$metadata = $this->getClient()->getRecursiveMetadata($path, $recursive);
242250
return $metadata[0];
243251
}
244252
}

0 commit comments

Comments
 (0)