Code optimalisations.

This commit is contained in:
James Cole
2018-07-05 21:18:53 +02:00
parent 1675a0d442
commit c99b7e927d
26 changed files with 216 additions and 150 deletions

View File

@@ -47,7 +47,7 @@ class UpgradeFireflyInstructions extends Command
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
if ('update' === $this->argument('task')) {
$this->updateInstructions();
@@ -62,7 +62,7 @@ class UpgradeFireflyInstructions extends Command
*
* @param string $text
*/
private function boxed(string $text)
private function boxed(string $text): void
{
$parts = explode("\n", wordwrap($text));
foreach ($parts as $string) {
@@ -75,7 +75,7 @@ class UpgradeFireflyInstructions extends Command
*
* @param string $text
*/
private function boxedInfo(string $text)
private function boxedInfo(string $text): void
{
$parts = explode("\n", wordwrap($text));
foreach ($parts as $string) {
@@ -86,7 +86,7 @@ class UpgradeFireflyInstructions extends Command
/**
* Render instructions.
*/
private function installInstructions()
private function installInstructions(): void
{
/** @var string $version */
$version = config('firefly.version');
@@ -94,8 +94,7 @@ class UpgradeFireflyInstructions extends Command
$text = '';
foreach (array_keys($config) as $compare) {
// if string starts with:
$len = \strlen($compare);
if (substr($version, 0, $len) === $compare) {
if (0 === strpos($version, $compare)) {
$text = $config[$compare];
}
}
@@ -120,7 +119,7 @@ class UpgradeFireflyInstructions extends Command
/**
* Show a line.
*/
private function showLine()
private function showLine(): void
{
$line = '+';
for ($i = 0; $i < 78; ++$i) {
@@ -133,7 +132,7 @@ class UpgradeFireflyInstructions extends Command
/**
* Render upgrade instructions.
*/
private function updateInstructions()
private function updateInstructions(): void
{
/** @var string $version */
$version = config('firefly.version');
@@ -141,8 +140,7 @@ class UpgradeFireflyInstructions extends Command
$text = '';
foreach (array_keys($config) as $compare) {
// if string starts with:
$len = \strlen($compare);
if (substr($version, 0, $len) === $compare) {
if (0 === strpos($version, $compare)) {
$text = $config[$compare];
}
}