Completed
Push — master ( 54b8d1...ceafd9 )
by Avtandil
02:36
created
src/MultiLang/Console/ExportCommand.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -168,6 +168,7 @@  discard block
 block discarded – undo
168 168
     /**
169 169
      * Get a texts from file.
170 170
      *
171
+     * @param string $scope
171 172
      * @return array
172 173
      */
173 174
     protected function getTextsFromFile($scope)
@@ -189,6 +190,7 @@  discard block
 block discarded – undo
189 190
     /**
190 191
      * Get a texts from database.
191 192
      *
193
+     * @param string $scope
192 194
      * @return array
193 195
      */
194 196
     protected function getTextsFromDb($scope)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
         $this->db    = $this->getDatabase();
85 85
 
86 86
         $lang = $this->option('lang');
87
-        if (! empty($lang)) {
87
+        if (!empty($lang)) {
88 88
             $this->langs = explode(',', $lang);
89 89
         }
90 90
 
91 91
         $scopes = $this->scopes;
92 92
         $scope  = $this->option('scope');
93
-        if (! empty($scope)) {
93
+        if (!empty($scope)) {
94 94
             $scopes = explode(',', $scope);
95 95
             foreach ($scopes as $scope) {
96
-                if (! in_array($scope, $this->scopes)) {
96
+                if (!in_array($scope, $this->scopes)) {
97 97
                     throw new InvalidArgumentException('Scope "' . $scope . '" is not found! Available scopes is ' . implode(', ', $this->scopes));
98 98
                 }
99 99
             }
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 
102 102
         $path       = $this->option('path', 'storage/multilang');
103 103
         $this->path = base_path($path);
104
-        if (! is_dir($this->path)) {
104
+        if (!is_dir($this->path)) {
105 105
             throw new InvalidArgumentException('Folder "' . $this->path . '" is not accessible!');
106 106
         }
107
-        if (! is_writable($this->path)) {
107
+        if (!is_writable($this->path)) {
108 108
             throw new InvalidArgumentException('Folder "' . $this->path . '" is not writable!');
109 109
         }
110 110
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     {
148 148
         $dbTexts = $this->getTextsFromDb($scope);
149 149
 
150
-        $fileTexts = ! $clear ? $this->getTextsFromFile($scope) : [];
150
+        $fileTexts = !$clear ? $this->getTextsFromFile($scope) : [];
151 151
 
152 152
         $textsToWrite = $force ? array_replace_recursive($fileTexts, $dbTexts) : array_replace_recursive($dbTexts, $fileTexts);
153 153
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
         $path    = $this->path . '/' . $scope . '.yml';
160 160
         $written = file_put_contents($path, $yaml);
161
-        if (! $written) {
161
+        if (!$written) {
162 162
             $this->error('Export texts of "' . $scope . '" is failed!');
163 163
         }
164 164
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         foreach ($dbTexts as $text) {
203 203
             $key  = $text->key;
204 204
             $lang = $text->lang;
205
-            if (! isset($formattedDbTexts[$key])) {
205
+            if (!isset($formattedDbTexts[$key])) {
206 206
                 $formattedDbTexts[$key] = ['key' => $key];
207 207
             }
208 208
             $formattedDbTexts[$key]['texts'][$lang] = $text->value;
Please login to merge, or discard this patch.
src/MultiLang/Console/ImportCommand.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
         $this->db    = $this->getDatabase();
84 84
 
85 85
         $lang = $this->option('lang');
86
-        if (! empty($lang)) {
86
+        if (!empty($lang)) {
87 87
             $this->langs = explode(',', $lang);
88 88
         }
89 89
 
90 90
         $scopes = $this->scopes;
91 91
         $scope  = $this->option('scope');
92
-        if (! empty($scope)) {
92
+        if (!empty($scope)) {
93 93
             $scopes = explode(',', $scope);
94 94
             foreach ($scopes as $scope) {
95
-                if (! in_array($scope, $this->scopes)) {
95
+                if (!in_array($scope, $this->scopes)) {
96 96
                     throw new InvalidArgumentException('Scope "' . $scope . '" is not found! Available scopes is ' . implode(', ', $this->scopes));
97 97
                 }
98 98
             }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
         $path       = $this->option('path', 'storage/multilang');
102 102
         $this->path = base_path($path);
103
-        if (! is_dir($this->path)) {
103
+        if (!is_dir($this->path)) {
104 104
             throw new InvalidArgumentException('Folder "' . $this->path . '" is not accessible!');
105 105
         }
106 106
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     protected function import($scope = 'global', $force = false)
114 114
     {
115 115
         $path = $this->path . '/' . $scope . '.yml';
116
-        if (! is_readable($path)) {
116
+        if (!is_readable($path)) {
117 117
             $this->warn('File "' . $path . '" is not readable!');
118 118
             return false;
119 119
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             $key = $text['key'];
132 132
 
133 133
             foreach ($text['texts'] as $lang => $value) {
134
-                if (! empty($this->langs) && ! in_array($lang, $this->langs)) {
134
+                if (!empty($this->langs) && !in_array($lang, $this->langs)) {
135 135
                     continue;
136 136
                 }
137 137
 
Please login to merge, or discard this patch.
src/MultiLang/MultiLangServiceProvider.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
         );
50 50
 
51 51
         // Register blade directives
52
-        Blade::directive('t', function ($expression) {
52
+        Blade::directive('t', function($expression) {
53 53
             return "<?php echo e(t({$expression})); ?>";
54 54
         });
55 55
 
56
-        $this->app['events']->listen(RouteMatched::class, function () {
56
+        $this->app['events']->listen(RouteMatched::class, function() {
57 57
             $scope = $this->app['config']->get('app.scope');
58 58
             if ($scope && $scope != 'global') {
59 59
                 $this->app['multilang']->setScope($scope);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $configPath = __DIR__ . '/../config/config.php';
75 75
         $this->mergeConfigFrom($configPath, 'debugbar');
76 76
 
77
-        $this->app->singleton('multilang', function ($app) {
77
+        $this->app->singleton('multilang', function($app) {
78 78
             $environment = $app->environment();
79 79
             $config      = $app['config']->get('multilang');
80 80
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             );
87 87
 
88 88
             if ($multilang->autoSaveIsAllowed()) {
89
-                $app->terminating(function () use ($multilang) {
89
+                $app->terminating(function() use ($multilang) {
90 90
                     $scope = $this->app['config']->get('app.scope');
91 91
                     if ($scope && $scope != 'global') {
92 92
                         $multilang->setScope($scope);
@@ -101,25 +101,25 @@  discard block
 block discarded – undo
101 101
         $this->app->alias('multilang', 'Longman\LaravelMultiLang\MultiLang');
102 102
 
103 103
         $this->app['command.multilang.migration'] = $this->app->share(
104
-            function () {
104
+            function() {
105 105
                 return new MigrationCommand();
106 106
             }
107 107
         );
108 108
 
109 109
         $this->app['command.multilang.texts'] = $this->app->share(
110
-            function () {
110
+            function() {
111 111
                 return new TextsCommand();
112 112
             }
113 113
         );
114 114
 
115 115
         $this->app['command.multilang.import'] = $this->app->share(
116
-            function () {
116
+            function() {
117 117
                 return new ImportCommand();
118 118
             }
119 119
         );
120 120
 
121 121
         $this->app['command.multilang.export'] = $this->app->share(
122
-            function () {
122
+            function() {
123 123
                 return new ExportCommand();
124 124
             }
125 125
         );
Please login to merge, or discard this patch.