Skip to content

Commit 65ab58a

Browse files
authored
Apply fixes from StyleCI (#72)
1 parent 8bc0806 commit 65ab58a

6 files changed

+33
-33
lines changed

src/AbstractRepositoryType.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace Codedge\Updater;
66

77
use Codedge\Updater\Events\HasWrongPermissions;
8-
use Illuminate\Support\Facades\File;
98
use GuzzleHttp\Client;
9+
use Illuminate\Support\Facades\File;
1010
use Symfony\Component\Finder\Finder;
1111

1212
/**
@@ -45,7 +45,7 @@ abstract class AbstractRepositoryType
4545
*
4646
* @return bool
4747
*/
48-
protected function unzipArchive($file = '', $targetDir = '', $deleteZipArchive = true) : bool
48+
protected function unzipArchive($file = '', $targetDir = '', $deleteZipArchive = true): bool
4949
{
5050
if (empty($file) || ! File::exists($file)) {
5151
throw new \InvalidArgumentException("Archive [{$file}] cannot be found or is empty.");
@@ -80,7 +80,7 @@ protected function unzipArchive($file = '', $targetDir = '', $deleteZipArchive =
8080
*
8181
* @return bool
8282
*/
83-
protected function hasCorrectPermissionForUpdate() : bool
83+
protected function hasCorrectPermissionForUpdate(): bool
8484
{
8585
if (! $this->pathToUpdate) {
8686
throw new \Exception('No directory set for update. Please set the update with: setPathToUpdate(path).');
@@ -133,7 +133,7 @@ protected function downloadRelease(Client $client, $source, $storagePath)
133133
*
134134
* @return bool
135135
*/
136-
protected function isSourceAlreadyFetched($version) : bool
136+
protected function isSourceAlreadyFetched($version): bool
137137
{
138138
$storagePath = $this->config['download_path'].'/'.$version;
139139
if (! File::exists($storagePath) || empty(File::directories($storagePath))

src/Contracts/SourceRepositoryTypeContract.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function fetch($version = '');
1818
*
1919
* @return bool
2020
*/
21-
public function update() : bool;
21+
public function update(): bool;
2222

2323
/**
2424
* Check repository if a newer version than the installed one is available.
@@ -29,7 +29,7 @@ public function update() : bool;
2929
*
3030
* @return bool
3131
*/
32-
public function isNewVersionAvailable($currentVersion = '') : bool;
32+
public function isNewVersionAvailable($currentVersion = ''): bool;
3333

3434
/**
3535
* Get the version that is currenly installed.
@@ -40,7 +40,7 @@ public function isNewVersionAvailable($currentVersion = '') : bool;
4040
*
4141
* @return string
4242
*/
43-
public function getVersionInstalled($prepend = '', $append = '') : string;
43+
public function getVersionInstalled($prepend = '', $append = ''): string;
4444

4545
/**
4646
* Get the latest version that has been published in a certain repository.
@@ -51,5 +51,5 @@ public function getVersionInstalled($prepend = '', $append = '') : string;
5151
*
5252
* @return string
5353
*/
54-
public function getVersionAvailable($prepend = '', $append = '') : string;
54+
public function getVersionAvailable($prepend = '', $append = ''): string;
5555
}

src/SourceRepository.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function fetch($version = '')
5050
*
5151
* @return bool
5252
*/
53-
public function update($version = '', $forceFetching = true) : bool
53+
public function update($version = '', $forceFetching = true): bool
5454
{
5555
$version = $version ?: $this->getVersionAvailable();
5656

@@ -72,7 +72,7 @@ public function update($version = '', $forceFetching = true) : bool
7272
*
7373
* @return bool
7474
*/
75-
public function isNewVersionAvailable($currentVersion = '') : bool
75+
public function isNewVersionAvailable($currentVersion = ''): bool
7676
{
7777
return $this->sourceRepository->isNewVersionAvailable($currentVersion);
7878
}
@@ -86,7 +86,7 @@ public function isNewVersionAvailable($currentVersion = '') : bool
8686
*
8787
* @return string
8888
*/
89-
public function getVersionInstalled($prepend = '', $append = '') : string
89+
public function getVersionInstalled($prepend = '', $append = ''): string
9090
{
9191
return $this->sourceRepository->getVersionInstalled($prepend, $append);
9292
}
@@ -100,7 +100,7 @@ public function getVersionInstalled($prepend = '', $append = '') : string
100100
*
101101
* @return string
102102
*/
103-
public function getVersionAvailable($prepend = '', $append = '') : string
103+
public function getVersionAvailable($prepend = '', $append = ''): string
104104
{
105105
return $this->sourceRepository->getVersionAvailable($prepend, $append);
106106
}

src/SourceRepositoryTypes/GithubRepositoryType.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
use Codedge\Updater\Events\UpdateAvailable;
1010
use Codedge\Updater\Events\UpdateFailed;
1111
use Codedge\Updater\Events\UpdateSucceeded;
12-
use Illuminate\Support\Facades\File;
1312
use GuzzleHttp\Client;
13+
use Illuminate\Support\Facades\File;
1414
use Storage;
1515
use Symfony\Component\Finder\Finder;
1616

@@ -56,7 +56,7 @@ public function __construct(Client $client, array $config)
5656
*
5757
* @return bool
5858
*/
59-
public function isNewVersionAvailable($currentVersion = '') : bool
59+
public function isNewVersionAvailable($currentVersion = ''): bool
6060
{
6161
$version = $currentVersion ?: $this->getVersionInstalled();
6262

@@ -124,7 +124,7 @@ public function fetch($version = '')
124124
*
125125
* @return bool
126126
*/
127-
public function update($version = '') : bool
127+
public function update($version = ''): bool
128128
{
129129
$this->setPathToUpdate(base_path(), $this->config['exclude_folders']);
130130

@@ -139,7 +139,7 @@ public function update($version = '') : bool
139139
collect((new Finder())->in($sourcePath)->exclude($this->config['exclude_folders'])->directories()->sort(function ($a, $b) {
140140
return strlen($b->getRealpath()) - strlen($a->getRealpath());
141141
}))->each(function (/** @var \SplFileInfo $directory */ $directory) {
142-
if (!$this->isDirectoryExcluded(
142+
if (! $this->isDirectoryExcluded(
143143
File::directories($directory->getRealPath()), $this->config['exclude_folders'])
144144
) {
145145
File::copyDirectory(
@@ -179,7 +179,7 @@ public function update($version = '') : bool
179179
*
180180
* @return string
181181
*/
182-
public function getVersionInstalled($prepend = '', $append = '') : string
182+
public function getVersionInstalled($prepend = '', $append = ''): string
183183
{
184184
return $prepend.$this->config['version_installed'].$append;
185185
}
@@ -193,7 +193,7 @@ public function getVersionInstalled($prepend = '', $append = '') : string
193193
*
194194
* @return string
195195
*/
196-
public function getVersionAvailable($prepend = '', $append = '') : string
196+
public function getVersionAvailable($prepend = '', $append = ''): string
197197
{
198198
if ($this->versionFileExists()) {
199199
$version = $prepend.$this->getVersionFile().$append;
@@ -241,7 +241,7 @@ protected function getRepositoryReleases()
241241
*
242242
* @return bool
243243
*/
244-
protected function versionFileExists() : bool
244+
protected function versionFileExists(): bool
245245
{
246246
return Storage::exists(static::NEW_VERSION_FILE);
247247
}
@@ -253,7 +253,7 @@ protected function versionFileExists() : bool
253253
*
254254
* @return bool
255255
*/
256-
protected function setVersionFile(string $content) : bool
256+
protected function setVersionFile(string $content): bool
257257
{
258258
return Storage::put(static::NEW_VERSION_FILE, $content);
259259
}
@@ -263,7 +263,7 @@ protected function setVersionFile(string $content) : bool
263263
*
264264
* @return string
265265
*/
266-
protected function getVersionFile() : string
266+
protected function getVersionFile(): string
267267
{
268268
return Storage::get(static::NEW_VERSION_FILE);
269269
}
@@ -273,7 +273,7 @@ protected function getVersionFile() : string
273273
*
274274
* @return bool
275275
*/
276-
protected function deleteVersionFile() : bool
276+
protected function deleteVersionFile(): bool
277277
{
278278
return Storage::delete(static::NEW_VERSION_FILE);
279279
}

src/SourceRepositoryTypes/HttpRepositoryType.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
use Codedge\Updater\Events\UpdateAvailable;
1010
use Codedge\Updater\Events\UpdateFailed;
1111
use Codedge\Updater\Events\UpdateSucceeded;
12-
use Illuminate\Support\Facades\File;
1312
use GuzzleHttp\Client;
1413
use Illuminate\Database\Eloquent\Collection;
14+
use Illuminate\Support\Facades\File;
1515
use Psr\Http\Message\ResponseInterface;
1616
use Storage;
1717
use Symfony\Component\Finder\Finder;
@@ -70,7 +70,7 @@ public function __construct(Client $client, array $config)
7070
*
7171
* @return bool
7272
*/
73-
public function isNewVersionAvailable($currentVersion = '') : bool
73+
public function isNewVersionAvailable($currentVersion = ''): bool
7474
{
7575
$version = $currentVersion ?: $this->getVersionInstalled();
7676

@@ -139,7 +139,7 @@ public function fetch($version = '')
139139
*
140140
* @return bool
141141
*/
142-
public function update($version = '') : bool
142+
public function update($version = ''): bool
143143
{
144144
$this->setPathToUpdate(base_path(), $this->config['exclude_folders']);
145145

@@ -153,7 +153,7 @@ public function update($version = '') : bool
153153
collect((new Finder())->in($sourcePath)->exclude($this->config['exclude_folders'])->directories()->sort(function ($a, $b) {
154154
return strlen($b->getRealpath()) - strlen($a->getRealpath());
155155
}))->each(function ($directory) { /** @var \SplFileInfo $directory */
156-
if (!$this->isDirectoryExcluded(
156+
if (! $this->isDirectoryExcluded(
157157
File::directories($directory->getRealPath()), $this->config['exclude_folders'])
158158
) {
159159
File::copyDirectory(
@@ -191,7 +191,7 @@ public function update($version = '') : bool
191191
*
192192
* @return string
193193
*/
194-
public function getVersionInstalled($prepend = '', $append = '') : string
194+
public function getVersionInstalled($prepend = '', $append = ''): string
195195
{
196196
return $this->config['version_installed'];
197197
}
@@ -207,7 +207,7 @@ public function getVersionInstalled($prepend = '', $append = '') : string
207207
*
208208
* @return string
209209
*/
210-
public function getVersionAvailable($prepend = '', $append = '') : string
210+
public function getVersionAvailable($prepend = '', $append = ''): string
211211
{
212212
$version = '';
213213
if ($this->versionFileExists()) {
@@ -266,7 +266,7 @@ protected function getPackageReleases()
266266
*
267267
* @return bool
268268
*/
269-
protected function versionFileExists() : bool
269+
protected function versionFileExists(): bool
270270
{
271271
return Storage::exists(static::NEW_VERSION_FILE);
272272
}
@@ -278,7 +278,7 @@ protected function versionFileExists() : bool
278278
*
279279
* @return bool
280280
*/
281-
protected function setVersionFile(string $content) : bool
281+
protected function setVersionFile(string $content): bool
282282
{
283283
return Storage::put(static::NEW_VERSION_FILE, $content);
284284
}
@@ -288,7 +288,7 @@ protected function setVersionFile(string $content) : bool
288288
*
289289
* @return string
290290
*/
291-
protected function getVersionFile() : string
291+
protected function getVersionFile(): string
292292
{
293293
return Storage::get(static::NEW_VERSION_FILE);
294294
}
@@ -298,7 +298,7 @@ protected function getVersionFile() : string
298298
*
299299
* @return bool
300300
*/
301-
protected function deleteVersionFile() : bool
301+
protected function deleteVersionFile(): bool
302302
{
303303
return Storage::delete(static::NEW_VERSION_FILE);
304304
}

src/UpdaterManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(Application $app)
5353
*
5454
* @return SourceRepository
5555
*/
56-
public function source($name = '') : SourceRepository
56+
public function source($name = ''): SourceRepository
5757
{
5858
$name = $name ?: $this->getDefaultSourceRepository();
5959

0 commit comments

Comments
 (0)