From b9f70d7d3a8463c3a5a124905ba79d7f06d4f719 Mon Sep 17 00:00:00 2001 From: Claudio Dekker Date: Tue, 11 Feb 2020 11:09:06 +0100 Subject: [PATCH] Align code-style to Laravel's --- resources/config/laravel-phraseapp-client.php | 3 +- src/Client/PhraseAppClient.php | 1 - src/Commands/DownloadCommand.php | 6 ++-- src/Exceptions/PhraseAppRequestException.php | 2 +- src/PhraseAppServiceProvider.php | 4 +-- tests/TestCase.php | 36 +++++++++---------- tests/Unit/Client/PhraseAppClientTest.php | 4 +-- tests/Unit/Commands/UpdateCommandTest.php | 6 +--- 8 files changed, 28 insertions(+), 34 deletions(-) diff --git a/resources/config/laravel-phraseapp-client.php b/resources/config/laravel-phraseapp-client.php index d8ab5bd..e85ac4a 100644 --- a/resources/config/laravel-phraseapp-client.php +++ b/resources/config/laravel-phraseapp-client.php @@ -2,7 +2,6 @@ return [ - /* * Master switch to enable or disable the prasheapp client. * Default is true @@ -82,4 +81,4 @@ */ 'sleep' => 1, ], -]; \ No newline at end of file +]; diff --git a/src/Client/PhraseAppClient.php b/src/Client/PhraseAppClient.php index 5557544..4ece295 100644 --- a/src/Client/PhraseAppClient.php +++ b/src/Client/PhraseAppClient.php @@ -45,7 +45,6 @@ public function __construct( float $timeout = 5.0, string $format = 'laravel' ) { - $this->withProject($projectId); $this->withAuthorization($apiKey); $this->withIdentification($identification); diff --git a/src/Commands/DownloadCommand.php b/src/Commands/DownloadCommand.php index bed11e9..66dd3b9 100644 --- a/src/Commands/DownloadCommand.php +++ b/src/Commands/DownloadCommand.php @@ -34,8 +34,9 @@ public function handle() $tags = $this->config->get('laravel-phraseapp.tags'); $seconds = $this->config->get('laravel-phraseapp.api.sleep'); - if (!$enabled) { + if (! $enabled) { $this->warn('laravel-phraseapp not enabled! Check config!'); + return; } @@ -45,7 +46,6 @@ public function handle() // Fetch translation per tag per locale foreach ($locales as $locale) { foreach ($tags as $tag) { - $this->info(sprintf('Fetching [%s] [tag:%s]', $locale, $tag)); $content = $client->downloadLocale($locale, $tag); @@ -80,4 +80,4 @@ protected function makeClient():PhraseAppClient $this->config->get('laravel-phraseapp.api.format', 'laravel') ); } -} \ No newline at end of file +} diff --git a/src/Exceptions/PhraseAppRequestException.php b/src/Exceptions/PhraseAppRequestException.php index ce6080d..1028b9a 100644 --- a/src/Exceptions/PhraseAppRequestException.php +++ b/src/Exceptions/PhraseAppRequestException.php @@ -5,4 +5,4 @@ class PhraseAppRequestException extends \Exception { // void as intended -} \ No newline at end of file +} diff --git a/src/PhraseAppServiceProvider.php b/src/PhraseAppServiceProvider.php index f5db53c..3e00921 100644 --- a/src/PhraseAppServiceProvider.php +++ b/src/PhraseAppServiceProvider.php @@ -2,8 +2,8 @@ namespace Ajaaleixo\PhraseApp; -use Illuminate\Support\ServiceProvider; use Ajaaleixo\PhraseApp\Commands\DownloadCommand; +use Illuminate\Support\ServiceProvider; class PhraseAppServiceProvider extends ServiceProvider { @@ -24,4 +24,4 @@ public function register() { $this->mergeConfigFrom(__DIR__.'/../resources/config/laravel-phraseapp-client.php', 'laravel-phraseapp'); } -} \ No newline at end of file +} diff --git a/tests/TestCase.php b/tests/TestCase.php index c139748..772c745 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -29,25 +29,25 @@ protected function makeMockLocalesList() { return [ [ - "id" => "abcd1234cdef1234abcd1234cdef1234", - "name" => "de", - "code" => "de-DE", - "default" => true, - "main" => false, - "rtl" => false, - "plural_forms" => [ - "zero", - "one", - "other" + 'id' => 'abcd1234cdef1234abcd1234cdef1234', + 'name' => 'de', + 'code' => 'de-DE', + 'default' => true, + 'main' => false, + 'rtl' => false, + 'plural_forms' => [ + 'zero', + 'one', + 'other', ], - "source_locale" => [ - "id" => "abcd1234cdef1234abcd1234cdef1234", - "name" => "en", - "code" => "en-GB" + 'source_locale' => [ + 'id' => 'abcd1234cdef1234abcd1234cdef1234', + 'name' => 'en', + 'code' => 'en-GB', ], - "created_at" => "2015-01-28T09:52:53Z", - "updated_at" => "2015-01-28T09:52:53Z", - ] + 'created_at' => '2015-01-28T09:52:53Z', + 'updated_at' => '2015-01-28T09:52:53Z', + ], ]; } -} \ No newline at end of file +} diff --git a/tests/Unit/Client/PhraseAppClientTest.php b/tests/Unit/Client/PhraseAppClientTest.php index f4465a9..18d6731 100644 --- a/tests/Unit/Client/PhraseAppClientTest.php +++ b/tests/Unit/Client/PhraseAppClientTest.php @@ -16,7 +16,7 @@ public function testCanFetchLocales() $this->assertEquals($localesExpectedList, $result); } - + public function testClientCanBeInitializedWithoutIdentificationAndTimeout() { $projectId = 'xpto'; @@ -76,4 +76,4 @@ protected function getDefaultHeadersAfterConstructorWithKey($apiKey) 'Authorization' => sprintf('token %s', $apiKey), ]; } -} \ No newline at end of file +} diff --git a/tests/Unit/Commands/UpdateCommandTest.php b/tests/Unit/Commands/UpdateCommandTest.php index c2c9e22..9ec7f34 100644 --- a/tests/Unit/Commands/UpdateCommandTest.php +++ b/tests/Unit/Commands/UpdateCommandTest.php @@ -3,15 +3,11 @@ namespace Tests\Unit\Commands; use Tests\TestCase; -use Tests\Unit\Client\PhraseAppClientTest; -use Ajaaleixo\PhraseApp\Client\PhraseAppClient; class UpdateCommandTest extends TestCase { public function testUpdateLocaleFiles() { - - + // } - }