Skip to content

Commit 3cd2555

Browse files
committed
Tackle the Style CI
1 parent b8ccb49 commit 3cd2555

File tree

6 files changed

+18
-21
lines changed

6 files changed

+18
-21
lines changed

src/CLIPrinter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
43
namespace Tohidplus\Translation;
54

65
class CLIPrinter
@@ -38,6 +37,6 @@ public static function print($message, $foreground = self::FOREGROUND_WHITE, $ba
3837

3938
public static function clear()
4039
{
41-
echo chr(27) . chr(91) . 'H' . chr(27) . chr(91) . 'J';
40+
echo chr(27).chr(91).'H'.chr(27).chr(91).'J';
4241
}
4342
}

src/Console/Commands/Translation.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use ElementaryFramework\FireFS\Watcher\FileSystemWatcher;
66
use Illuminate\Console\Command;
7-
use function MongoDB\BSON\toJSON;
87
use Tohidplus\Translation\Facades\VueTranslation;
98
use Tohidplus\Translation\FileWatcher\Listener;
109

src/Contract/TranslationFileHelper.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php
22

3-
43
namespace Tohidplus\Translation\Contract;
54

6-
75
interface TranslationFileHelper
86
{
97
public function fetch();

src/FileWatcher/Listener.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,21 @@
33

44
namespace Tohidplus\Translation\FileWatcher;
55

6-
76
use ElementaryFramework\FireFS\Events\FileSystemEvent;
87
use ElementaryFramework\FireFS\Listener\IFileSystemListener;
98
use Tohidplus\Translation\CLIPrinter;
109
use Tohidplus\Translation\Facades\VueTranslation;
1110

1211
class Listener implements IFileSystemListener
1312
{
14-
1513
/**
1614
* Action called on any event.
1715
*
1816
* @param FileSystemEvent $event The raised event.
1917
*
20-
* @return boolean true to propagate the event, false otherwise.
18+
* @return bool true to propagate the event, false otherwise.
2119
*/
22-
function onAny(FileSystemEvent $event): bool
20+
public function onAny(FileSystemEvent $event): bool
2321
{
2422
try {
2523
VueTranslation::compile();
@@ -38,7 +36,7 @@ function onAny(FileSystemEvent $event): bool
3836
*
3937
* @return void
4038
*/
41-
function onCreated(FileSystemEvent $event)
39+
public function onCreated(FileSystemEvent $event)
4240
{
4341
// TODO: Implement onCreated() method.
4442
}
@@ -51,7 +49,7 @@ function onCreated(FileSystemEvent $event)
5149
*
5250
* @return void
5351
*/
54-
function onModified(FileSystemEvent $event)
52+
public function onModified(FileSystemEvent $event)
5553
{
5654

5755
}
@@ -64,7 +62,7 @@ function onModified(FileSystemEvent $event)
6462
*
6563
* @return void
6664
*/
67-
function onDeleted(FileSystemEvent $event)
65+
public function onDeleted(FileSystemEvent $event)
6866
{
6967
// TODO: Implement onDeleted() method.
7068
}

src/LaravelVueTranslation.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
use Tohidplus\Translation\Contract\TranslationFileHelper;
66

77
class LaravelVueTranslation
8-
98
{
109
/**
11-
* @var array $translations
10+
* @var array
1211
*/
1312
private $translations = [];
1413
/**
@@ -18,6 +17,7 @@ class LaravelVueTranslation
1817

1918
/**
2019
* LaravelJSTranslation constructor.
20+
*
2121
* @param TranslationFileHelper $translationFileHelper
2222
*/
2323
public function __construct(TranslationFileHelper $translationFileHelper)
@@ -43,6 +43,7 @@ private function addArrayLevels(array $keys, array $target, $data)
4343
$target[$key] = $this->addArrayLevels($keys, [], $data);
4444
}
4545
}
46+
4647
return $target;
4748
}
4849

@@ -53,17 +54,19 @@ private function setTranslations()
5354
$path = $file->getRelativePathName();
5455
$this->printFileCompiled($path);
5556
$delimiter = strpos($path, '/') !== false ? '/' : '\\';
56-
57+
5758
$array = array_map(function ($key) use ($file) {
58-
return str_replace('.' . $file->getExtension(), '', $key);
59+
return str_replace('.'.$file->getExtension(), '', $key);
5960
}, explode($delimiter, $path));
6061

61-
$nestedArray = $this->addArrayLevels($array, [],
62+
$nestedArray = $this->addArrayLevels(
63+
$array,
64+
[],
6265
$file->getExtension() === 'json'
6366
? json_decode(file_get_contents($file->getPathName()), true)
6467
: require $file->getPathName()
6568
);
66-
69+
6770
$this->translations = array_merge_recursive($this->translations, $nestedArray);
6871
}
6972
}

src/TranslationServiceProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ public function boot()
1313
{
1414
if ($this->app->runningInConsole()) {
1515
$this->commands([
16-
Translation::class
16+
Translation::class,
1717
]);
1818
}
1919
$this->publishes([
20-
__DIR__ . '/resources/js/VueTranslation' => resource_path('js/VueTranslation')
20+
__DIR__.'/resources/js/VueTranslation' => resource_path('js/VueTranslation'),
2121
]);
2222
}
2323

@@ -29,8 +29,8 @@ public function register()
2929
$this->app->bind('watcher', function () {
3030
$fireFS = new FireFS();
3131
$watcher = new FileSystemWatcher($fireFS);
32+
3233
return $watcher;
3334
});
3435
}
35-
3636
}

0 commit comments

Comments
 (0)