Passed
Push — master ( 30d0f9...a8ef92 )
by Andrey
07:18
created
config/test_db.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2
-$db = require __DIR__ . '/db.php';
2
+$db = require __DIR__.'/db.php';
3 3
 // test database! Important not to run tests on production or development databases
4
-$db['dsn'] = 'mysql:host=localhost;dbname=yii2_basic_tests';
4
+$db[ 'dsn' ] = 'mysql:host=localhost;dbname=yii2_basic_tests';
5 5
 
6 6
 return $db;
Please login to merge, or discard this patch.
config/test.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-$params = require __DIR__ . '/params.php';
3
-$db = require __DIR__ . '/test_db.php';
2
+$params = require __DIR__.'/params.php';
3
+$db = require __DIR__.'/test_db.php';
4 4
 
5 5
 /**
6 6
  * Application configuration shared by all test types
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
             'useFileTransport' => true,
20 20
         ],
21 21
         'assetManager' => [
22
-            'basePath' => __DIR__ . '/../web/assets',
22
+            'basePath' => __DIR__.'/../web/assets',
23 23
         ],
24 24
         'urlManager' => [
25 25
             'showScriptName' => true,
Please login to merge, or discard this patch.
config/web.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-$params = require __DIR__ . '/params.php';
4
-$db = require __DIR__ . '/db.php';
3
+$params = require __DIR__.'/params.php';
4
+$db = require __DIR__.'/db.php';
5 5
 
6 6
 $config = [
7 7
     'id' => 'yii2_template_multilanguage',
8 8
     'version' => '1.0.0',
9 9
     'basePath' => dirname(__DIR__),
10 10
     'homeUrl' => YII_DEBUG ? 'http://yii2-template-multilanguage' : 'http://yii2-template-multilanguage',
11
-    'bootstrap' => ['log'],
11
+    'bootstrap' => [ 'log' ],
12 12
     'language' => 'en-US',
13 13
     'aliases' => [
14 14
         '@bower' => '@vendor/bower-asset',
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             'targets' => [
51 51
                 [
52 52
                     'class' => 'yii\log\FileTarget',
53
-                    'levels' => ['error', 'warning'],
53
+                    'levels' => [ 'error', 'warning' ],
54 54
                 ],
55 55
             ],
56 56
         ],
@@ -207,18 +207,18 @@  discard block
 block discarded – undo
207 207
 
208 208
 if (YII_ENV_DEV) {
209 209
     // configuration adjustments for 'dev' environment
210
-    $config['bootstrap'][] = 'debug';
211
-    $config['modules']['debug'] = [
210
+    $config[ 'bootstrap' ][ ] = 'debug';
211
+    $config[ 'modules' ][ 'debug' ] = [
212 212
         'class' => 'yii\debug\Module',
213 213
         // uncomment the following to add your IP if you are not connecting from localhost.
214
-        'allowedIPs' => ['127.0.0.1', '::1', '*'],
214
+        'allowedIPs' => [ '127.0.0.1', '::1', '*' ],
215 215
     ];
216 216
 
217
-    $config['bootstrap'][] = 'gii';
218
-    $config['modules']['gii'] = [
217
+    $config[ 'bootstrap' ][ ] = 'gii';
218
+    $config[ 'modules' ][ 'gii' ] = [
219 219
         'class' => 'yii\gii\Module',
220 220
         // uncomment the following to add your IP if you are not connecting from localhost.
221
-        'allowedIPs' => ['127.0.0.1', '::1', '*'],
221
+        'allowedIPs' => [ '127.0.0.1', '::1', '*' ],
222 222
     ];
223 223
 }
224 224
 
Please login to merge, or discard this patch.
traits/ResponseTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
         int $statusCode = 200): array {
53 53
 
54 54
         if (null === $data) {
55
-            $data = (object)[];
55
+            $data = (object)[ ];
56 56
         }
57 57
 
58 58
         \Yii::$app->response->statusCode = $statusCode;
Please login to merge, or discard this patch.
traits/AdminBeforeActionTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,24 +34,24 @@
 block discarded – undo
34 34
      */
35 35
     public function beforeAction($action)
36 36
     {
37
-        $this->view->mainMenuConfig = require __DIR__ . '/../config/admin/main-menu.php';
37
+        $this->view->mainMenuConfig = require __DIR__.'/../config/admin/main-menu.php';
38 38
 
39
-        $this->view->homeUrl = '/' . $this->shortLanguage . '/admin';
39
+        $this->view->homeUrl = '/'.$this->shortLanguage.'/admin';
40 40
 
41
-        $this->view->signOutLink = '/' . $this->shortLanguage . '/logout';
41
+        $this->view->signOutLink = '/'.$this->shortLanguage.'/logout';
42 42
 
43
-        $this->view->profileLink = '/' . $this->shortLanguage . '/admin/users/view?id='.Yii::$app->getUser()->id;
43
+        $this->view->profileLink = '/'.$this->shortLanguage.'/admin/users/view?id='.Yii::$app->getUser()->id;
44 44
 
45
-        Yii::$app->getUser()->loginUrl = '/' . $this->shortLanguage . '/login';
45
+        Yii::$app->getUser()->loginUrl = '/'.$this->shortLanguage.'/login';
46 46
 
47
-        $this->urlPrefix = '/' . $this->shortLanguage . '/' . $this->module->id . '/' . $action->controller->id . '/';
47
+        $this->urlPrefix = '/'.$this->shortLanguage.'/'.$this->module->id.'/'.$action->controller->id.'/';
48 48
 
49 49
         if (array_key_exists($action->controller->id, $this->neighborControllers)) {
50
-            $this->urlPrefixNeighbor = '/' . $this->shortLanguage . '/' . $this->module->id . '/' .
51
-                $this->neighborControllers[$action->controller->id] . '/';
50
+            $this->urlPrefixNeighbor = '/'.$this->shortLanguage.'/'.$this->module->id.'/'.
51
+                $this->neighborControllers[ $action->controller->id ].'/';
52 52
         }
53 53
 
54
-        $this->view->userBody = ArrayHelper::map($this->languages, 'name', function ($item) {
54
+        $this->view->userBody = ArrayHelper::map($this->languages, 'name', function($item) {
55 55
             /* @var Language $item */
56 56
             return BaseHelper::getSwitchLanguageLink($item->getShortName(), Yii::$app->request);
57 57
         });
Please login to merge, or discard this patch.
traits/LanguageTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@
 block discarded – undo
41 41
             '!=', 'shortName', $this->shortLanguage
42 42
         ])->all();
43 43
 
44
-        $this->view->params['languages'] = $this->languages;
44
+        $this->view->params[ 'languages' ] = $this->languages;
45 45
 
46
-        $this->view->params['shortLanguage'] = $this->shortLanguage;
46
+        $this->view->params[ 'shortLanguage' ] = $this->shortLanguage;
47 47
 
48 48
         parent::init();
49 49
     }
Please login to merge, or discard this patch.
helpers/BaseHelper.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 
40 40
         $urlArray = explode('/', $url);
41 41
 
42
-        $urlArray[0] = $newShortLanguage;
42
+        $urlArray[ 0 ] = $newShortLanguage;
43 43
 
44
-        return '/' . implode('/', $urlArray);
44
+        return '/'.implode('/', $urlArray);
45 45
     }
46 46
 
47 47
     /**
@@ -73,19 +73,19 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public static function detectClientShortLanguage()
75 75
     {
76
-        if (!isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) || empty($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
76
+        if (!isset($_SERVER[ "HTTP_ACCEPT_LANGUAGE" ]) || empty($_SERVER[ "HTTP_ACCEPT_LANGUAGE" ])) {
77 77
             return null;
78 78
         }
79 79
 
80 80
         preg_match_all('/([a-z]{1,8}(?:-[a-z]{1,8})?)(?:;q=([0-9.]+))?/',
81
-            strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"]),
81
+            strtolower($_SERVER[ "HTTP_ACCEPT_LANGUAGE" ]),
82 82
             $matches
83 83
         );
84 84
 
85
-        $langs = array_combine($matches[1], $matches[2]);
85
+        $langs = array_combine($matches[ 1 ], $matches[ 2 ]);
86 86
 
87 87
         foreach ($langs as $n => $v) {
88
-            $langs[$n] = $v ? $v : 1; // If no q, then set q = 1
88
+            $langs[ $n ] = $v ? $v : 1; // If no q, then set q = 1
89 89
         }
90 90
 
91 91
         arsort($langs); // Sort descending q
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
         $fields = array('HTTP_CLIENT_IP', 'HTTP_X_REAL_IP', 'HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR');
104 104
 
105 105
         $ip = "0.0.0.0";
106
-        foreach($fields as $k)
106
+        foreach ($fields as $k)
107 107
         {
108
-            if(!empty($_SERVER[$k]) && ip2long($_SERVER[$k]) != false)
108
+            if (!empty($_SERVER[ $k ]) && ip2long($_SERVER[ $k ]) != false)
109 109
             {
110
-                $ip = $_SERVER[$k];
110
+                $ip = $_SERVER[ $k ];
111 111
             }
112 112
         }
113 113
 
Please login to merge, or discard this patch.
helpers/InitialUserSettings.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
     private static function setUserStatus(TableSchema $settingsTableSchema, $settings, IdentityInterface $user): void
64 64
     {
65 65
         if (in_array('initUserStatus', $settingsTableSchema->columnNames)) {
66
-            $user->status = is_array($settings) && null !== $settings['initUserStatus'] ?
67
-                $settings['initUserStatus'] : self::INIT_USER_STATUS;
66
+            $user->status = is_array($settings) && null !== $settings[ 'initUserStatus' ] ?
67
+                $settings[ 'initUserStatus' ] : self::INIT_USER_STATUS;
68 68
             $user->save();
69 69
         } else {
70 70
             Yii::error('Field "initUserStatus" does not exists in "settings" table to set initial user status.');
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
                 ]);
94 94
             }
95 95
 
96
-            if (!is_array($settings) || null === $settings['initUserRole']) {
96
+            if (!is_array($settings) || null === $settings[ 'initUserRole' ]) {
97 97
                 $initUserRole = self::INIT_USER_ROLE;
98 98
                 Yii::error('Can not get field value of "initUserRole" from "settings" table to set initial user role.');
99 99
             } else {
100
-                $initUserRole = $settings['initUserRole'];
100
+                $initUserRole = $settings[ 'initUserRole' ];
101 101
             }
102 102
 
103 103
             $authManager->assign(
Please login to merge, or discard this patch.
controllers/PageController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
                 'rules' => [
28 28
                     [
29 29
                         'allow' => true,
30
-                        'actions' => ['view'],
31
-                        'roles' => ['?', '@'],
30
+                        'actions' => [ 'view' ],
31
+                        'roles' => [ '?', '@' ],
32 32
                     ],
33 33
                 ],
34 34
             ],
35 35
             'verbs' => [
36 36
                 'class' => VerbFilter::class,
37 37
                 'actions' => [
38
-                    'view' => ['get'],
38
+                    'view' => [ 'get' ],
39 39
                 ],
40 40
             ],
41 41
         ]);
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
         $pagination = new Pagination([
72 72
             'totalCount' => $productsQuery->count(),
73
-            'defaultPageSize' => Yii::$app->params['defaultPageSize']
73
+            'defaultPageSize' => Yii::$app->params[ 'defaultPageSize' ]
74 74
         ]);
75 75
 
76 76
         return $this->render('view', [
Please login to merge, or discard this patch.