Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Sep 26, 2023
1 parent 6492910 commit e5864f9
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 85 deletions.
25 changes: 12 additions & 13 deletions src/Console/Command/VersioningHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ class VersioningHelper extends Command
protected $description = 'Helper Command to set your applications version.';

/**
* Current Version
*
* Current Version.
*/
public SemVer\Version $version;

/**
* Defines the modification date of our current revision
* Defines the modification date of our current revision.
*
* @var Carbon
*/
public Carbon $modificationDate;

/**
* Defines the current PHP runtime at which our application runs
* Defines the current PHP runtime at which our application runs.
*
* @var string
*/
public string $runtime;
Expand All @@ -69,8 +69,9 @@ public function __construct()
/**
* Execute the console command.
*
* @return int
* @throws SemVer\Exceptions\InvalidVersionException
*
* @return int
*/
public function handle(): int
{
Expand All @@ -83,8 +84,8 @@ public function handle(): int

$this->applyOptions();

$this->info("Current Version: " . $currentVersion);
$this->line("New Version: " . $this->version);
$this->info('Current Version: '.$currentVersion);
$this->line('New Version: '.$this->version);

$this->parseBuild();

Expand All @@ -94,8 +95,7 @@ public function handle(): int
}

/**
* Helper Method to apply our Commands Options
*
* Helper Method to apply our Commands Options.
*/
private function applyOptions()
{
Expand Down Expand Up @@ -129,8 +129,7 @@ private function applyOptions()
}

/**
* Helper Method to assemble a version string based on our used repository system
*
* Helper Method to assemble a version string based on our used repository system.
*/
private function parseBuild()
{
Expand Down Expand Up @@ -173,12 +172,12 @@ private function parseBuild()
}

if (!App::environment('production')) {
$this->runtime = 'PHP v' . PHP_VERSION;
$this->runtime = 'PHP v'.PHP_VERSION;
}
}

/**
* Helper Method to save our applications version within the system
* Helper Method to save our applications version within the system.
*/
private function saveVersion()
{
Expand Down
12 changes: 6 additions & 6 deletions src/LaravelVersioningHelperServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ public function boot()

// Registering package commands.
$this->commands([
VersioningHelper::class
VersioningHelper::class,
]);
}

$this->loadViewComponentsAs('versioning-helper', [
ApplicationName::class,
BuildString::class,
Copyright::class,
Version::class
]);
ApplicationName::class,
BuildString::class,
Copyright::class,
Version::class,
]);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Views/Components/ApplicationName.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
class ApplicationName extends Component
{
/**
* Defines the applications url
* Defines the applications url.
*
* @var string
*/
public string $url;

/**
* Defines the applications name
* Defines the applications name.
*
* @var string
*/
Expand All @@ -27,7 +27,7 @@ class ApplicationName extends Component
* @param null $url
* @param null $name
*/
public function __construct($url=null, $name = null)
public function __construct($url = null, $name = null)
{
$this->url = $url ?? config('app.url');
$this->name = $name ?? config('app.name');
Expand Down
12 changes: 6 additions & 6 deletions src/Views/Components/Copyright.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,34 @@
class Copyright extends Component
{
/**
* Defines the applications author/company/vendor what ever it is ;)
* Defines the applications author/company/vendor what ever it is ;).
*
* @var string
*/
public string $author;

/**
* Supplies a link to our authors website
* Supplies a link to our authors website.
*
* @var string
*/
public string $authorURL;

/**
* Defines the "start" date for our copyright notice
* Defines the "start" date for our copyright notice.
*
* @var string
*/
public string $startDate;

/**
* Defines the "end" date for our copyright notice
* Defines the "end" date for our copyright notice.
*
* @var string
*/
public string $endDate;
/**
* Defines the date string for our copyright notice
* Defines the date string for our copyright notice.
*
* @var string
*/
Expand All @@ -52,7 +52,7 @@ class Copyright extends Component
public function __construct($author = null, $url = null, $startDate = null, $endDate = null)
{
$this->author = $author ?? config('laravel-versioning-helper.author');
$this->authorURL = $url ?? config('laravel-versioning-helper.author_url');
$this->authorURL = $url ?? config('laravel-versioning-helper.author_url');
$this->startDate = $startDate ?? config('laravel-versioning-helper.creation_date');
$this->endDate = $endDate ?? date('Y');

Expand Down
17 changes: 10 additions & 7 deletions src/Views/Components/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,40 @@
class Version extends Component
{
/**
* Defines the modification date of our current revision
* Defines the modification date of our current revision.
*
* @var Carbon
*/
public Carbon $modificationDate;

/**
* Defines the current version of our application
* Defines the current version of our application.
*
* @var string
*/
public string $version;

/**
* Defines the current PHP runtime at which our application runs
* Defines the current PHP runtime at which our application runs.
*
* @var string
*/
public string $runtime;

/**
* Defines the URL which contains our applications changelog
* Defines the URL which contains our applications changelog.
*
* @var string|Application|UrlGenerator
*/
public string $changelogURL;

/**
* Defines the full Version String of our build, its version number including our revision & runtime
* Defines the full Version String of our build, its version number including our revision & runtime.
*
* @var string
*/
public string $build;


/**
* Create a new component instance.
*
Expand All @@ -57,7 +60,7 @@ public function __construct($changelogURL = null)

$this->build = sprintf('v%s (%s)', $this->version, $this->modificationDate->format('d/m/y H:i'));
if (!App::environment('production')) {
$this->runtime = Cache::pull(config('laravel-versioning-helper.runtime_key')) ?? 'PHP v' . PHP_VERSION;
$this->runtime = Cache::pull(config('laravel-versioning-helper.runtime_key')) ?? 'PHP v'.PHP_VERSION;
$this->build .= " $this->runtime";
} else {
$this->runtime = '';
Expand Down
4 changes: 2 additions & 2 deletions tests/BladeComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function application_name_is_loaded()
/** @test */
public function application_name_does_render()
{
$expected = <<<HTML
$expected = <<<'HTML'
<span>
<a href="http://localhost" target="_self" class="text-primary dim no-underline">Laravel</a>
</span>
Expand Down Expand Up @@ -155,7 +155,7 @@ public function version_does_render()
{
$date = Carbon::now();
$dateString = $date->format('d/m/y H:i');
$phpVersion = 'PHP v' . PHP_VERSION;
$phpVersion = 'PHP v'.PHP_VERSION;

Cache::put('laravel-versioning-helper.version', '0.0.1');
Cache::put('laravel-versioning-helper.modificationDate', $date);
Expand Down

0 comments on commit e5864f9

Please sign in to comment.