Passed
Branch develop (63b306)
by Alexander
03:47
created
src/TranslatorFacade.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@
 block discarded – undo
34 34
      *
35 35
      * @return string
36 36
      */
37
-    protected static function getFacadeAccessor()
38
-    {
37
+    protected static function getFacadeAccessor() {
39 38
         return 'Translator';
40 39
     }
41 40
 }
Please login to merge, or discard this patch.
src/Handler/CacheJSONHandler.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
      * @param string $locale The locale of the translations
23 23
      * @throws TranslationCacheNotFound
24 24
      */
25
-    public function __construct($locale)
26
-    {
25
+    public function __construct($locale) {
27 26
         parent::__construct($locale);
28 27
 
29 28
         $this->refreshCache();
@@ -37,15 +36,13 @@  discard block
 block discarded – undo
37 36
      * @throws TranslationNotInCacheException
38 37
      * @return string returns the found translation for locale and identifier
39 38
      */
40
-    public function getTranslation($identifier, $group = 'default')
41
-    {
39
+    public function getTranslation($identifier, $group = 'default') {
42 40
         // NOTE: This should never trigger the addition of the identifier to the database!
43 41
         // Because the cache will not be updated automatically.
44 42
         // the same identifier will not be found twice in the cache, which will result in a duplicate key sql error.
45 43
         if (isset($this->translations[$group][$identifier])) {
46 44
             return $this->translations[$group][$identifier];
47
-        }
48
-        else {
45
+        } else {
49 46
             throw new TranslationNotInCacheException("The translation identifier '".$identifier."' could not be found in Cache");
50 47
         }
51 48
     }
@@ -56,8 +53,7 @@  discard block
 block discarded – undo
56 53
      * @param string $group
57 54
      * @throws TranslationCacheNotFound
58 55
      */
59
-    public function refreshCache($group = 'default')
60
-    {
56
+    public function refreshCache($group = 'default') {
61 57
         $locale_dir = TranslatorFacade::getConfigValue('cache_path').$this->locale;
62 58
 
63 59
         try {
@@ -75,8 +71,7 @@  discard block
 block discarded – undo
75 71
      * @param string $group Group of the translations to return
76 72
      * @return array|mixed Translations of the given group
77 73
      */
78
-    public function getAllTranslations($group)
79
-    {
74
+    public function getAllTranslations($group) {
80 75
         return $this->translations[$group];
81 76
     }
82 77
 }
83 78
\ No newline at end of file
Please login to merge, or discard this patch.
src/Models/Translations.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,8 +60,7 @@
 block discarded – undo
60 60
      *
61 61
      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
62 62
      */
63
-    public function translationIdentifier()
64
-    {
63
+    public function translationIdentifier() {
65 64
         return $this->belongsTo(TranslationIdentifier::class);
66 65
     }
67 66
 }
68 67
\ No newline at end of file
Please login to merge, or discard this patch.
src/Models/TranslationIdentifier.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,7 @@
 block discarded – undo
62 62
      *
63 63
      * @return \Illuminate\Database\Eloquent\Relations\HasMany
64 64
      */
65
-    public function translations()
66
-    {
65
+    public function translations() {
67 66
         return $this->hasMany(Translations::class);
68 67
     }
69 68
 
Please login to merge, or discard this patch.
src/Commands/SearchTranslationsCommand.php 1 patch
Braces   +4 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@  discard block
 block discarded – undo
45 45
     /**
46 46
      * Create a new command instance.
47 47
      */
48
-    public function __construct()
49
-    {
48
+    public function __construct() {
50 49
         parent::__construct();
51 50
     }
52 51
 
@@ -56,8 +55,7 @@  discard block
 block discarded – undo
56 55
      * @return mixed
57 56
      * @throws \Exception
58 57
      */
59
-    public function handle()
60
-    {
58
+    public function handle() {
61 59
         $start = microtime(true);
62 60
 
63 61
         $this->line('');
@@ -132,8 +130,7 @@  discard block
 block discarded – undo
132 130
      * @param array $result Array with
133 131
      * @param string $group
134 132
      */
135
-    protected function addMissing($result, $group)
136
-    {
133
+    protected function addMissing($result, $group) {
137 134
         foreach ($result as $item) {
138 135
             try {
139 136
                 $identifier = trim($item['identifier']);
@@ -177,7 +174,7 @@  discard block
 block discarded – undo
177 174
                     $this->dupl_identifier++;
178 175
                 }
179 176
 
180
-            } catch(\Exception $e){
177
+            } catch(\Exception $e) {
181 178
                 $this->bar->clear();
182 179
                 $this->info($identifier.' '.strlen($identifier));
183 180
                 $this->info($e->getMessage());
Please login to merge, or discard this patch.
src/Commands/CacheTranslationCommand.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,8 +39,7 @@  discard block
 block discarded – undo
39 39
     /**
40 40
      * Create a new command instance.
41 41
      */
42
-    public function __construct()
43
-    {
42
+    public function __construct() {
44 43
         parent::__construct();
45 44
     }
46 45
 
@@ -49,8 +48,7 @@  discard block
 block discarded – undo
49 48
      *
50 49
      * @throws \Exception
51 50
      */
52
-    public function handle()
53
-    {
51
+    public function handle() {
54 52
         $locale = $this->argument('locale');
55 53
 
56 54
         if (!is_string($locale))
@@ -99,8 +97,7 @@  discard block
 block discarded – undo
99 97
      *
100 98
      * @return array
101 99
      */
102
-    protected function getGroups()
103
-    {
100
+    protected function getGroups() {
104 101
         return DB::table('translation_identifiers')->select('group')->groupBy(['group'])->get()->pluck('group');
105 102
     }
106 103
 
@@ -110,12 +107,10 @@  discard block
 block discarded – undo
110 107
      * @param string $locale The locale from which the translations to load
111 108
      * @return TranslationIdentifier|\Illuminate\Database\Eloquent\Collection|static[]
112 109
      */
113
-    protected function loadFromDB($locale)
114
-    {
110
+    protected function loadFromDB($locale) {
115 111
         $trans_identifier = new TranslationIdentifier();
116 112
 
117
-        $trans_identifier = $trans_identifier->with('translations')->whereHas('translations', function ($item) use ($locale)
118
-        {
113
+        $trans_identifier = $trans_identifier->with('translations')->whereHas('translations', function ($item) use ($locale) {
119 114
             return $item->where('locale', $locale);
120 115
         }
121 116
         )->orWhereHas('translations', null, '<=', 0)
Please login to merge, or discard this patch.
src/Provider/TranslatorProvider.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
     /**
23 23
      * Register any application services.
24 24
      */
25
-    public function register()
26
-    {
25
+    public function register() {
27 26
         $this->mergeConfigFrom(__DIR__.'/../config/translator.php', 'translator');
28 27
 
29 28
         $this->app->singleton('Translator', function () {
@@ -35,8 +34,7 @@  discard block
 block discarded – undo
35 34
     /**
36 35
      * Bootstrap any application services.
37 36
      */
38
-    public function boot()
39
-    {
37
+    public function boot() {
40 38
         $this->publishes([
41 39
                 __DIR__ . '/../config/translator.php' => config_path('translator.php'),
42 40
             ],
Please login to merge, or discard this patch.
src/Provider/TranslatorBladeProvider.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
     /**
23 23
      * Bootstrap any application services.
24 24
      */
25
-    public function boot()
26
-    {
25
+    public function boot() {
27 26
         Blade::directive('translate', function ($expression) {
28 27
 
29 28
                 $expression = $this->stripParentheses($expression);
@@ -49,8 +48,7 @@  discard block
 block discarded – undo
49 48
      * @param string $expression
50 49
      * @return string
51 50
      */
52
-    public function stripParentheses($expression)
53
-    {
51
+    public function stripParentheses($expression) {
54 52
         if (Str::startsWith($expression, '(')) {
55 53
             $expression = substr($expression, 1, -1);
56 54
         }
Please login to merge, or discard this patch.
src/Controllers/TranslatorAdminController.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,16 +27,14 @@  discard block
 block discarded – undo
27 27
      *
28 28
      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
29 29
      */
30
-    public function index()
31
-    {
30
+    public function index() {
32 31
         $search = Input::get('search', '');
33 32
         $locale = Input::get('locale', '');
34 33
 
35 34
         $query = TranslationIdentifier::with('translations');
36 35
 
37 36
         if ($locale != '') {
38
-            $query = $query->whereDoesntHave('translations', function ($query) use ($locale)
39
-                {
37
+            $query = $query->whereDoesntHave('translations', function ($query) use ($locale) {
40 38
                     $query->where('translations.locale', 'like', $locale);
41 39
                 }
42 40
             );
@@ -73,8 +71,7 @@  discard block
 block discarded – undo
73 71
      * @param integer $id ID of the translation Identifier to edit
74 72
      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
75 73
      */
76
-    public function edit($id)
77
-    {
74
+    public function edit($id) {
78 75
         $identifier = TranslationIdentifier::findOrFail($id);
79 76
 
80 77
         $available_locales = TranslatorFacade::getConfigValue('available_locales');
@@ -97,8 +94,7 @@  discard block
 block discarded – undo
97 94
      * @param Request $request Object with the values of the identifier
98 95
      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
99 96
      */
100
-    public function postEdit($id, Request $request)
101
-    {
97
+    public function postEdit($id, Request $request) {
102 98
         TranslationIdentifier::findOrFail($id);
103 99
 
104 100
         foreach ($request->all() as $key => $value) {
@@ -131,8 +127,7 @@  discard block
 block discarded – undo
131 127
      * @param Request $request Request with multiple values of identifiers to update
132 128
      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
133 129
      */
134
-    public function postIdentifier(Request $request)
135
-    {
130
+    public function postIdentifier(Request $request) {
136 131
         /** @var TranslationIdentifier $translation_identifiers */
137 132
         $translation_identifiers = TranslationIdentifier::all()->whereIn('id', array_keys($request->all()));
138 133
 
@@ -159,8 +154,7 @@  discard block
 block discarded – undo
159 154
      *
160 155
      * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
161 156
      */
162
-    public function test()
163
-    {
157
+    public function test() {
164 158
         return view('translator::test');
165 159
     }
166 160
 
@@ -168,8 +162,7 @@  discard block
 block discarded – undo
168 162
      * @param $state string 'enabled|disabled'
169 163
      * @return \Illuminate\Http\RedirectResponse
170 164
      */
171
-    public function changeLiveMode ($state)
172
-    {
165
+    public function changeLiveMode ($state) {
173 166
         if ($state == 'enable') {
174 167
             session(['translation_live_mode' => true]);
175 168
         } else {
Please login to merge, or discard this patch.