Skip to content

Commit

Permalink
Apply fixes from StyleCI (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
codedge authored Feb 4, 2020
1 parent 8bc0806 commit 65ab58a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
8 changes: 4 additions & 4 deletions src/AbstractRepositoryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace Codedge\Updater;

use Codedge\Updater\Events\HasWrongPermissions;
use Illuminate\Support\Facades\File;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\File;
use Symfony\Component\Finder\Finder;

/**
Expand Down Expand Up @@ -45,7 +45,7 @@ abstract class AbstractRepositoryType
*
* @return bool
*/
protected function unzipArchive($file = '', $targetDir = '', $deleteZipArchive = true) : bool
protected function unzipArchive($file = '', $targetDir = '', $deleteZipArchive = true): bool
{
if (empty($file) || ! File::exists($file)) {
throw new \InvalidArgumentException("Archive [{$file}] cannot be found or is empty.");
Expand Down Expand Up @@ -80,7 +80,7 @@ protected function unzipArchive($file = '', $targetDir = '', $deleteZipArchive =
*
* @return bool
*/
protected function hasCorrectPermissionForUpdate() : bool
protected function hasCorrectPermissionForUpdate(): bool
{
if (! $this->pathToUpdate) {
throw new \Exception('No directory set for update. Please set the update with: setPathToUpdate(path).');
Expand Down Expand Up @@ -133,7 +133,7 @@ protected function downloadRelease(Client $client, $source, $storagePath)
*
* @return bool
*/
protected function isSourceAlreadyFetched($version) : bool
protected function isSourceAlreadyFetched($version): bool
{
$storagePath = $this->config['download_path'].'/'.$version;
if (! File::exists($storagePath) || empty(File::directories($storagePath))
Expand Down
8 changes: 4 additions & 4 deletions src/Contracts/SourceRepositoryTypeContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function fetch($version = '');
*
* @return bool
*/
public function update() : bool;
public function update(): bool;

/**
* Check repository if a newer version than the installed one is available.
Expand All @@ -29,7 +29,7 @@ public function update() : bool;
*
* @return bool
*/
public function isNewVersionAvailable($currentVersion = '') : bool;
public function isNewVersionAvailable($currentVersion = ''): bool;

/**
* Get the version that is currenly installed.
Expand All @@ -40,7 +40,7 @@ public function isNewVersionAvailable($currentVersion = '') : bool;
*
* @return string
*/
public function getVersionInstalled($prepend = '', $append = '') : string;
public function getVersionInstalled($prepend = '', $append = ''): string;

/**
* Get the latest version that has been published in a certain repository.
Expand All @@ -51,5 +51,5 @@ public function getVersionInstalled($prepend = '', $append = '') : string;
*
* @return string
*/
public function getVersionAvailable($prepend = '', $append = '') : string;
public function getVersionAvailable($prepend = '', $append = ''): string;
}
8 changes: 4 additions & 4 deletions src/SourceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function fetch($version = '')
*
* @return bool
*/
public function update($version = '', $forceFetching = true) : bool
public function update($version = '', $forceFetching = true): bool
{
$version = $version ?: $this->getVersionAvailable();

Expand All @@ -72,7 +72,7 @@ public function update($version = '', $forceFetching = true) : bool
*
* @return bool
*/
public function isNewVersionAvailable($currentVersion = '') : bool
public function isNewVersionAvailable($currentVersion = ''): bool
{
return $this->sourceRepository->isNewVersionAvailable($currentVersion);
}
Expand All @@ -86,7 +86,7 @@ public function isNewVersionAvailable($currentVersion = '') : bool
*
* @return string
*/
public function getVersionInstalled($prepend = '', $append = '') : string
public function getVersionInstalled($prepend = '', $append = ''): string
{
return $this->sourceRepository->getVersionInstalled($prepend, $append);
}
Expand All @@ -100,7 +100,7 @@ public function getVersionInstalled($prepend = '', $append = '') : string
*
* @return string
*/
public function getVersionAvailable($prepend = '', $append = '') : string
public function getVersionAvailable($prepend = '', $append = ''): string
{
return $this->sourceRepository->getVersionAvailable($prepend, $append);
}
Expand Down
20 changes: 10 additions & 10 deletions src/SourceRepositoryTypes/GithubRepositoryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
use Codedge\Updater\Events\UpdateAvailable;
use Codedge\Updater\Events\UpdateFailed;
use Codedge\Updater\Events\UpdateSucceeded;
use Illuminate\Support\Facades\File;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\File;
use Storage;
use Symfony\Component\Finder\Finder;

Expand Down Expand Up @@ -56,7 +56,7 @@ public function __construct(Client $client, array $config)
*
* @return bool
*/
public function isNewVersionAvailable($currentVersion = '') : bool
public function isNewVersionAvailable($currentVersion = ''): bool
{
$version = $currentVersion ?: $this->getVersionInstalled();

Expand Down Expand Up @@ -124,7 +124,7 @@ public function fetch($version = '')
*
* @return bool
*/
public function update($version = '') : bool
public function update($version = ''): bool
{
$this->setPathToUpdate(base_path(), $this->config['exclude_folders']);

Expand All @@ -139,7 +139,7 @@ public function update($version = '') : bool
collect((new Finder())->in($sourcePath)->exclude($this->config['exclude_folders'])->directories()->sort(function ($a, $b) {
return strlen($b->getRealpath()) - strlen($a->getRealpath());
}))->each(function (/** @var \SplFileInfo $directory */ $directory) {
if (!$this->isDirectoryExcluded(
if (! $this->isDirectoryExcluded(
File::directories($directory->getRealPath()), $this->config['exclude_folders'])
) {
File::copyDirectory(
Expand Down Expand Up @@ -179,7 +179,7 @@ public function update($version = '') : bool
*
* @return string
*/
public function getVersionInstalled($prepend = '', $append = '') : string
public function getVersionInstalled($prepend = '', $append = ''): string
{
return $prepend.$this->config['version_installed'].$append;
}
Expand All @@ -193,7 +193,7 @@ public function getVersionInstalled($prepend = '', $append = '') : string
*
* @return string
*/
public function getVersionAvailable($prepend = '', $append = '') : string
public function getVersionAvailable($prepend = '', $append = ''): string
{
if ($this->versionFileExists()) {
$version = $prepend.$this->getVersionFile().$append;
Expand Down Expand Up @@ -241,7 +241,7 @@ protected function getRepositoryReleases()
*
* @return bool
*/
protected function versionFileExists() : bool
protected function versionFileExists(): bool
{
return Storage::exists(static::NEW_VERSION_FILE);
}
Expand All @@ -253,7 +253,7 @@ protected function versionFileExists() : bool
*
* @return bool
*/
protected function setVersionFile(string $content) : bool
protected function setVersionFile(string $content): bool
{
return Storage::put(static::NEW_VERSION_FILE, $content);
}
Expand All @@ -263,7 +263,7 @@ protected function setVersionFile(string $content) : bool
*
* @return string
*/
protected function getVersionFile() : string
protected function getVersionFile(): string
{
return Storage::get(static::NEW_VERSION_FILE);
}
Expand All @@ -273,7 +273,7 @@ protected function getVersionFile() : string
*
* @return bool
*/
protected function deleteVersionFile() : bool
protected function deleteVersionFile(): bool
{
return Storage::delete(static::NEW_VERSION_FILE);
}
Expand Down
20 changes: 10 additions & 10 deletions src/SourceRepositoryTypes/HttpRepositoryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
use Codedge\Updater\Events\UpdateAvailable;
use Codedge\Updater\Events\UpdateFailed;
use Codedge\Updater\Events\UpdateSucceeded;
use Illuminate\Support\Facades\File;
use GuzzleHttp\Client;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\File;
use Psr\Http\Message\ResponseInterface;
use Storage;
use Symfony\Component\Finder\Finder;
Expand Down Expand Up @@ -70,7 +70,7 @@ public function __construct(Client $client, array $config)
*
* @return bool
*/
public function isNewVersionAvailable($currentVersion = '') : bool
public function isNewVersionAvailable($currentVersion = ''): bool
{
$version = $currentVersion ?: $this->getVersionInstalled();

Expand Down Expand Up @@ -139,7 +139,7 @@ public function fetch($version = '')
*
* @return bool
*/
public function update($version = '') : bool
public function update($version = ''): bool
{
$this->setPathToUpdate(base_path(), $this->config['exclude_folders']);

Expand All @@ -153,7 +153,7 @@ public function update($version = '') : bool
collect((new Finder())->in($sourcePath)->exclude($this->config['exclude_folders'])->directories()->sort(function ($a, $b) {
return strlen($b->getRealpath()) - strlen($a->getRealpath());
}))->each(function ($directory) { /** @var \SplFileInfo $directory */
if (!$this->isDirectoryExcluded(
if (! $this->isDirectoryExcluded(
File::directories($directory->getRealPath()), $this->config['exclude_folders'])
) {
File::copyDirectory(
Expand Down Expand Up @@ -191,7 +191,7 @@ public function update($version = '') : bool
*
* @return string
*/
public function getVersionInstalled($prepend = '', $append = '') : string
public function getVersionInstalled($prepend = '', $append = ''): string
{
return $this->config['version_installed'];
}
Expand All @@ -207,7 +207,7 @@ public function getVersionInstalled($prepend = '', $append = '') : string
*
* @return string
*/
public function getVersionAvailable($prepend = '', $append = '') : string
public function getVersionAvailable($prepend = '', $append = ''): string
{
$version = '';
if ($this->versionFileExists()) {
Expand Down Expand Up @@ -266,7 +266,7 @@ protected function getPackageReleases()
*
* @return bool
*/
protected function versionFileExists() : bool
protected function versionFileExists(): bool
{
return Storage::exists(static::NEW_VERSION_FILE);
}
Expand All @@ -278,7 +278,7 @@ protected function versionFileExists() : bool
*
* @return bool
*/
protected function setVersionFile(string $content) : bool
protected function setVersionFile(string $content): bool
{
return Storage::put(static::NEW_VERSION_FILE, $content);
}
Expand All @@ -288,7 +288,7 @@ protected function setVersionFile(string $content) : bool
*
* @return string
*/
protected function getVersionFile() : string
protected function getVersionFile(): string
{
return Storage::get(static::NEW_VERSION_FILE);
}
Expand All @@ -298,7 +298,7 @@ protected function getVersionFile() : string
*
* @return bool
*/
protected function deleteVersionFile() : bool
protected function deleteVersionFile(): bool
{
return Storage::delete(static::NEW_VERSION_FILE);
}
Expand Down
2 changes: 1 addition & 1 deletion src/UpdaterManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(Application $app)
*
* @return SourceRepository
*/
public function source($name = '') : SourceRepository
public function source($name = ''): SourceRepository
{
$name = $name ?: $this->getDefaultSourceRepository();

Expand Down

0 comments on commit 65ab58a

Please sign in to comment.