Passed
Push — master ( 679877...b03fda )
by Alexander
03:23
created
src/migrations/2017_11_27_162357_create_translator_tables.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         DB::beginTransaction();
26 26
 
27 27
         // Create table for storing roles
28
-        Schema::create('translation_identifiers', function (Blueprint $table) {
28
+        Schema::create('translation_identifiers', function(Blueprint $table) {
29 29
             $table->increments('id')->unique();
30 30
             $table->text('identifier');
31 31
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         });
40 40
 
41 41
         // Create table for storing roles
42
-        Schema::create('translations', function (Blueprint $table) {
42
+        Schema::create('translations', function(Blueprint $table) {
43 43
             $table->integer('translation_identifier_id')->unsigned();
44 44
             $table->foreign('translation_identifier_id')->references('id')->on('translation_identifiers')->onDelete('cascade')->onUpdate('no action');
45 45
 
Please login to merge, or discard this patch.
src/Commands/ClearUnusedTranslationsCommand.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
                     $this->warn('\''.$identifier.'\' is used in: \''. $file->getPath().'\'!');
136 136
 
137 137
                     foreach ($matches[0] as $match) {
138
-                         $this->warn($match);
138
+                            $this->warn($match);
139 139
                     }
140 140
                     $found = true;
141 141
                     $this->bar->display();
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -56,21 +56,21 @@  discard block
 block discarded – undo
56 56
 
57 57
         foreach ($aDB as $identifier) {
58 58
 
59
-            if(!in_array($identifier->identifier, $aFiles)) {
59
+            if (!in_array($identifier->identifier, $aFiles)) {
60 60
 
61 61
                 $found_as_plain = $this->verifyMissing($identifier->identifier);
62 62
 
63 63
                 $this->line('');
64 64
 
65 65
                 if ($found_as_plain) {
66
-                    $this->warn('\''.$identifier->identifier.'\' was not found withing Translator directives');
66
+                    $this->warn('\'' . $identifier->identifier . '\' was not found withing Translator directives');
67 67
                     $found_plain++;
68 68
                 } else {
69
-                    $this->line('\''.$identifier->identifier.'\' seems to be not used anymore');
69
+                    $this->line('\'' . $identifier->identifier . '\' seems to be not used anymore');
70 70
                     $not_used++;
71 71
                 }
72 72
 
73
-                $task = $this->choice('What do you want me to do?', ['Nothing' ,'Remove'], 0);
73
+                $task = $this->choice('What do you want me to do?', ['Nothing', 'Remove'], 0);
74 74
 
75 75
                 if ($task === 'Remove') {
76 76
                     $identifier->delete();
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
             }
81 81
         }
82 82
         
83
-        $this->table(['Num', 'Identifier'],[
84
-            [$this->found_identifier,  "In DB"],
85
-            [$not_used,     "Not Found"],
86
-            [$found_plain,  "Found Plain"],
87
-            [$removed,  "Removed"],
83
+        $this->table(['Num', 'Identifier'], [
84
+            [$this->found_identifier, "In DB"],
85
+            [$not_used, "Not Found"],
86
+            [$found_plain, "Found Plain"],
87
+            [$removed, "Removed"],
88 88
         ]);
89 89
         
90
-        $this->info($not_used.' Translations no longer used.');
90
+        $this->info($not_used . ' Translations no longer used.');
91 91
         $this->line('');
92 92
 
93 93
         $this->info('Finished in: ' . number_format(microtime(true) - $start, 2) . 'sec');
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
             'resources/assets/js',
110 110
         ];
111 111
 
112
-        foreach($folders as $folder){
113
-            $aFiles = array_merge($aFiles, File::allFiles(base_path().'/'.$folder));
112
+        foreach ($folders as $folder) {
113
+            $aFiles = array_merge($aFiles, File::allFiles(base_path() . '/' . $folder));
114 114
         }
115 115
 
116 116
         $num_files = count($aFiles);
117 117
 
118 118
         $this->bar = $this->output->createProgressBar($num_files);
119
-        $this->bar->setMessage('Analyzing '.$num_files.' files');
119
+        $this->bar->setMessage('Analyzing ' . $num_files . ' files');
120 120
         $this->bar->setFormat('very_verbose');
121 121
 
122 122
         $pattern = preg_quote($identifier, '/');
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 
128 128
             $extension = $file->getExtension();
129 129
 
130
-            if(in_array($extension, $valid_extensions)){
130
+            if (in_array($extension, $valid_extensions)) {
131 131
 
132 132
                 $content = file_get_contents($file);
133
-                if (preg_match_all($pattern, $content, $matches)){
133
+                if (preg_match_all($pattern, $content, $matches)) {
134 134
                     $this->bar->clear();
135
-                    $this->warn('\''.$identifier.'\' is used in: \''. $file->getPath().'\'!');
135
+                    $this->warn('\'' . $identifier . '\' is used in: \'' . $file->getPath() . '\'!');
136 136
 
137 137
                     foreach ($matches[0] as $match) {
138 138
                          $this->warn($match);
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
             'js'        => '/\$filter\(\'translate\'\)\(\'(?\'identifier\'.*?)\'\)/'
161 161
         ];
162 162
 
163
-        foreach($this->folders as $folder){
164
-            $aFiles = array_merge($aFiles, File::allFiles(base_path().'/'.$folder));
163
+        foreach ($this->folders as $folder) {
164
+            $aFiles = array_merge($aFiles, File::allFiles(base_path() . '/' . $folder));
165 165
         }
166 166
 
167 167
         //TranslatorFacade::setLocale('de_DE');
@@ -169,20 +169,20 @@  discard block
 block discarded – undo
169 169
         $num_files = count($aFiles);
170 170
 
171 171
         $this->bar = $this->output->createProgressBar($num_files);
172
-        $this->bar->setMessage('Analyzing '.$num_files.' files');
172
+        $this->bar->setMessage('Analyzing ' . $num_files . ' files');
173 173
         $this->bar->setFormat('very_verbose');
174 174
 
175 175
         foreach ($aFiles as $file) {
176 176
 
177 177
             $extension = $file->getExtension();
178 178
 
179
-            if(in_array($extension, $this->extensions)){
179
+            if (in_array($extension, $this->extensions)) {
180 180
                 $content = file_get_contents($file);
181 181
 
182 182
                 foreach ($regexes as $key => $regex) {
183 183
                     preg_match_all($regex, $content, $result, PREG_SET_ORDER);
184 184
 
185
-                    if(!empty($result[0])){
185
+                    if (!empty($result[0])) {
186 186
                         foreach ($result as $item) {
187 187
                             $this->found_identifier++;
188 188
                             $return[] = $item['identifier'];
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         $this->bar->finish();
197 197
         $this->line('');
198 198
 
199
-        $this->info($this->found_identifier.' Translations found.');
199
+        $this->info($this->found_identifier . ' Translations found.');
200 200
 
201 201
         return $return;
202 202
     }
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
      *
207 207
      * @return TranslationIdentifier|\Illuminate\Database\Eloquent\Collection|static[]
208 208
      */
209
-    private function loadFromDB () {
209
+    private function loadFromDB() {
210 210
         // Get all Texts with translations for the given locale
211
-        $trans_identifier =   TranslationIdentifier::select(['id', 'identifier'])->get();
211
+        $trans_identifier = TranslationIdentifier::select(['id', 'identifier'])->get();
212 212
 
213 213
         return $trans_identifier;
214 214
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,8 @@  discard block
 block discarded – undo
8 8
 use Illuminate\Support\Facades\File;
9 9
 use Illuminate\Console\Command;
10 10
 
11
-class ClearUnusedTranslationsCommand extends Command {
11
+class ClearUnusedTranslationsCommand extends Command
12
+{
12 13
 
13 14
     /**
14 15
      * The name and signature of the console command.
@@ -109,7 +110,7 @@  discard block
 block discarded – undo
109 110
             'resources/assets/js',
110 111
         ];
111 112
 
112
-        foreach($folders as $folder){
113
+        foreach($folders as $folder) {
113 114
             $aFiles = array_merge($aFiles, File::allFiles(base_path().'/'.$folder));
114 115
         }
115 116
 
@@ -160,7 +161,7 @@  discard block
 block discarded – undo
160 161
             'js'        => '/\$filter\(\'translate\'\)\(\'(?\'identifier\'.*?)\'\)/'
161 162
         ];
162 163
 
163
-        foreach($this->folders as $folder){
164
+        foreach($this->folders as $folder) {
164 165
             $aFiles = array_merge($aFiles, File::allFiles(base_path().'/'.$folder));
165 166
         }
166 167
 
Please login to merge, or discard this patch.