Completed
Pull Request — master (#39)
by Elias
13:10
created
src/views/layouts/plain.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 /* @var $this \yii\web\View */
25 25
 /* @var $content string */
26 26
 
27
-$this->title .= ' - ' . getenv('APP_TITLE');
28
-$this->title = (getenv('APP_PAGES_TITLE_PREFIX') ?? '') . $this->title;
27
+$this->title .= ' - '.getenv('APP_TITLE');
28
+$this->title = (getenv('APP_PAGES_TITLE_PREFIX') ?? '').$this->title;
29 29
 
30 30
 SettingsAsset::register($this);
31 31
 
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
     Event::on(
34 34
         View::class,
35 35
         View::EVENT_AFTER_RENDER,
36
-        function ($e) {
36
+        function($e) {
37 37
             // disable unbundled asset
38
-            $e->sender->assetBundles['yii\\bootstrap\\BootstrapAsset'] = null;
38
+            $e->sender->assetBundles[ 'yii\\bootstrap\\BootstrapAsset' ] = null;
39 39
             // disable bundled asset
40
-            $e->sender->assetBundles['bootstrap'] = null;
40
+            $e->sender->assetBundles[ 'bootstrap' ] = null;
41 41
         }
42 42
     );
43 43
 }
44 44
 
45 45
 // Favicon
46 46
 if ($favicon = \Yii::$app->settings->get('faviconPng', 'app.assets')) {
47
-    $this->registerLinkTag(['rel' => 'shortcut icon', 'type' => 'image/png', 'href' => $favicon]);
47
+    $this->registerLinkTag([ 'rel' => 'shortcut icon', 'type' => 'image/png', 'href' => $favicon ]);
48 48
 }
49 49
 
50 50
 ?>
Please login to merge, or discard this patch.
src/views/layouts/_navbar.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -8,25 +8,25 @@  discard block
 block discarded – undo
8 8
 use Yii;
9 9
 
10 10
 // initialize local variables
11
-$menuItems = [];
12
-$languageItems = [];
11
+$menuItems = [ ];
12
+$languageItems = [ ];
13 13
 
14 14
 
15 15
 // prepare languages
16 16
 foreach (Yii::$app->urlManager->languages as $language) {
17
-    $languageItems[] = [
18
-        'url' => ['/', Yii::$app->urlManager->languageParam => $language],
17
+    $languageItems[ ] = [
18
+        'url' => [ '/', Yii::$app->urlManager->languageParam => $language ],
19 19
         'label' => $language,
20 20
     ];
21 21
 }
22 22
 
23 23
 // add language items to menu
24
-$menuItems[] = [
24
+$menuItems[ ] = [
25 25
     'label' =>  Yii::t('app', '{icon} {language}', [
26 26
         'icon' => '<i class="glyphicon glyphicon-globe"></i>',
27 27
         'language' => Yii::$app->language
28 28
     ]),
29
-    'options' => ['id' => 'link-languages-menu'],
29
+    'options' => [ 'id' => 'link-languages-menu' ],
30 30
     'items' => $languageItems,
31 31
 ];
32 32
 
@@ -35,39 +35,39 @@  discard block
 block discarded – undo
35 35
     if (Yii::$app->user->isGuest) {
36 36
         // unauthorized users
37 37
         //$menuItems[] = ['label' => 'Signup', 'url' => ['/user/registration/register']];
38
-        $menuItems[] = [
38
+        $menuItems[ ] = [
39 39
             'label' => Yii::t('app', 'Login'),
40
-            'url' => ['/user/security/login'],
41
-            'linkOptions' => ['id' => 'link-login'],
40
+            'url' => [ '/user/security/login' ],
41
+            'linkOptions' => [ 'id' => 'link-login' ],
42 42
         ];
43 43
     } else {
44 44
         // logged in users
45
-        $menuItems[] = [
45
+        $menuItems[ ] = [
46 46
             'label' => Yii::t('app', '{icon} {username}', [
47 47
                 'icon' => '<i class="glyphicon glyphicon-user"></i>',
48 48
                 'username' => Yii::$app->user->identity->username
49 49
             ]),
50
-            'options' => ['id' => 'link-user-menu'],
50
+            'options' => [ 'id' => 'link-user-menu' ],
51 51
             'items' => [
52 52
                 [
53 53
                     'label' => Yii::t('app', '{icon} Profile', [
54 54
                         'icon' => '<i class="glyphicon glyphicon-user"></i>'
55 55
                     ]),
56
-                    'url' => ['/user/profile/show', 'id' => Yii::$app->user->id],
56
+                    'url' => [ '/user/profile/show', 'id' => Yii::$app->user->id ],
57 57
                 ],
58 58
                 [
59 59
                     'label' => Yii::t('app', '{icon} Settings', [
60 60
                         'icon' => '<i class="glyphicon glyphicon-cog"></i>'
61 61
                     ]),
62
-                    'url' => ['/user/settings/profile'],
62
+                    'url' => [ '/user/settings/profile' ],
63 63
                 ],
64 64
                 '<li class="divider"></li>',
65 65
                 [
66 66
                     'label' => Yii::t('app', '{icon} Logout', [
67 67
                         'icon' => '<i class="glyphicon glyphicon-log-out"></i>'
68 68
                     ]),
69
-                    'url' => ['/user/security/logout'],
70
-                    'linkOptions' => ['data-method' => 'post', 'id' => 'link-logout'],
69
+                    'url' => [ '/user/security/logout' ],
70
+                    'linkOptions' => [ 'data-method' => 'post', 'id' => 'link-logout' ],
71 71
                 ],
72 72
             ],
73 73
         ];
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 // render root pages
89 89
 echo Nav::widget(
90 90
     [
91
-        'options' => ['class' => 'navbar-nav'],
91
+        'options' => [ 'class' => 'navbar-nav' ],
92 92
         'encodeLabels' => false,
93 93
         'items' => Tree::getMenuItems('root'),
94 94
     ]
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 // render additional menu items (languages, user)
98 98
 echo Nav::widget(
99 99
     [
100
-        'options' => ['class' => 'navbar-nav navbar-right'],
100
+        'options' => [ 'class' => 'navbar-nav navbar-right' ],
101 101
         'encodeLabels' => false,
102 102
         'items' => $menuItems,
103 103
     ]
Please login to merge, or discard this patch.
src/views/layouts/container-fluid.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 
12 12
     <div class="container-layout">
13 13
         <div class="container-fluid">
14
-            <?= Breadcrumbs::widget(['links' => $this->params['breadcrumbs'] ?? []]) ?>
14
+            <?= Breadcrumbs::widget([ 'links' => $this->params[ 'breadcrumbs' ] ?? [ ] ]) ?>
15 15
         </div>
16 16
 
17 17
         <div class="container-fluid">
Please login to merge, or discard this patch.
src/views/layouts/container.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     <div class="container-layout">
13 13
         <div class="container">
14 14
             <?=
15
-            Breadcrumbs::widget(['links' => $this->params['breadcrumbs'] ?? []]) ?>
15
+            Breadcrumbs::widget([ 'links' => $this->params[ 'breadcrumbs' ] ?? [ ] ]) ?>
16 16
         </div>
17 17
 
18 18
         <div class="container">
Please login to merge, or discard this patch.
src/commands/AppController.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
     public function actionConfig($key = null)
29 29
     {
30 30
         // get config from global variable (TODO)
31
-        $data = $GLOBALS['config'];
31
+        $data = $GLOBALS[ 'config' ];
32 32
         if ($key) {
33 33
             $keys = explode('.', $key);
34
-            if (isset($keys[0])) {
35
-                $data = $GLOBALS['config'][$keys[0]];
34
+            if (isset($keys[ 0 ])) {
35
+                $data = $GLOBALS[ 'config' ][ $keys[ 0 ] ];
36 36
             }
37
-            if (isset($keys[1])) {
38
-                $data = $GLOBALS['config'][$keys[0]][$keys[1]];
37
+            if (isset($keys[ 1 ])) {
38
+                $data = $GLOBALS[ 'config' ][ $keys[ 0 ] ][ $keys[ 1 ] ];
39 39
             }
40 40
         }
41 41
         $this->stdout(VarDumper::dumpAsString($data));
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
     public function actionVersion()
58 58
     {
59 59
         $this->stdout('Application Version: ');
60
-        $this->stdout(getenv('APP_NAME') . ' ');
61
-        $this->stdout(APP_VERSION . "\n");
60
+        $this->stdout(getenv('APP_NAME').' ');
61
+        $this->stdout(APP_VERSION."\n");
62 62
     }
63 63
 
64 64
     /**
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
         $this->stdout("=====================\n");
72 72
         $this->stdout("Initializing application\n");
73 73
 
74
-        $this->interactive = (bool)getenv('APP_INTERACTIVE');
74
+        $this->interactive = (bool) getenv('APP_INTERACTIVE');
75 75
 
76 76
         $this->stdout("\nDatabase\n");
77 77
         $this->stdout("--------\n");
78
-        $this->run('db/create', [getenv('DB_ENV_MYSQL_ROOT_USER'),getenv('DB_ENV_MYSQL_ROOT_PASSWORD')]);
79
-        $this->run('migrate/up', ['interactive' => (bool)getenv('APP_INTERACTIVE')]);
78
+        $this->run('db/create', [ getenv('DB_ENV_MYSQL_ROOT_USER'), getenv('DB_ENV_MYSQL_ROOT_PASSWORD') ]);
79
+        $this->run('migrate/up', [ 'interactive' => (bool) getenv('APP_INTERACTIVE') ]);
80 80
 
81 81
         $this->stdout("\nUser\n");
82 82
         $this->stdout("----\n");
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                 'default' => getenv('APP_ADMIN_PASSWORD') ?: Yii::$app->security->generateRandomString(8),
87 87
             ]
88 88
         );
89
-        $this->run('user/create', [getenv('APP_ADMIN_EMAIL'), 'admin', $adminPassword]);
89
+        $this->run('user/create', [ getenv('APP_ADMIN_EMAIL'), 'admin', $adminPassword ]);
90 90
 
91 91
         $this->stdout('Initializing modules');
92 92
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
         $this->stdout("\nCleanup\n");
102 102
         $this->stdout("-------\n");
103 103
         $this->run('cache/flush-all');
104
-        $this->run('audit/cleanup', ['age' => 30, 'interactive' => (bool)getenv('APP_INTERACTIVE')]);
105
-        $this->run('app/clear-assets', ['interactive' => (bool)getenv('APP_INTERACTIVE')]);
104
+        $this->run('audit/cleanup', [ 'age' => 30, 'interactive' => (bool) getenv('APP_INTERACTIVE') ]);
105
+        $this->run('app/clear-assets', [ 'interactive' => (bool) getenv('APP_INTERACTIVE') ]);
106 106
     }
107 107
 
108 108
     /**
@@ -116,20 +116,20 @@  discard block
 block discarded – undo
116 116
         $matchRegex = '"^[a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9]\?[a-z0-9]$"';
117 117
 
118 118
         // create $cmd command
119
-        $cmd = 'cd "' . $assets . '" && ls | grep -e ' . $matchRegex . ' | xargs rm -rf ';
119
+        $cmd = 'cd "'.$assets.'" && ls | grep -e '.$matchRegex.' | xargs rm -rf ';
120 120
 
121 121
         // Set command
122 122
         $command = new Command($cmd);
123 123
 
124 124
         // Prompt user
125
-        $delete = $this->confirm("\nDo you really want to delete web assets?", ['default' => true]);
125
+        $delete = $this->confirm("\nDo you really want to delete web assets?", [ 'default' => true ]);
126 126
 
127 127
         if ($delete) {
128 128
             // Try to execute $command
129 129
             if ($command->execute()) {
130 130
                 $this->stdout("Web assets have been deleted.\n\n");
131 131
             } else {
132
-                $this->stderr("\n" . $command->getError() . "\n");
132
+                $this->stderr("\n".$command->getError()."\n");
133 133
                 $this->stderr($command->getStdErr());
134 134
             }
135 135
         }
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
         $message = $mailer->compose();
143 143
         $message
144 144
             ->setTo($to)
145
-            ->setSubject('Test-Mail from ' . getenv('APP_NAME'))
146
-            ->setTextBody(getenv('APP_TITLE') . ' | ' . getenv('HOSTNAME'));
145
+            ->setSubject('Test-Mail from '.getenv('APP_NAME'))
146
+            ->setTextBody(getenv('APP_TITLE').' | '.getenv('HOSTNAME'));
147 147
 
148 148
         if ($message->send()) {
149 149
             $this->stdout('Mail sent');
Please login to merge, or discard this patch.
config/common.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 $languages = explode(',', getenv('APP_LANGUAGES'));
75 75
 
76 76
 // prepare asset bundle config
77
-$bundles = [];
77
+$bundles = [ ];
78 78
 if (getenv('APP_ASSET_USE_BUNDLED')) {
79 79
     // include generated asset-bundle configuration
80
-    $bundles = include Yii::getAlias('@web/bundles') . '/config.php';
80
+    $bundles = include Yii::getAlias('@web/bundles').'/config.php';
81 81
     // disable loading of bundles skin file, when using bundled assets
82 82
     Yii::$container->set(
83 83
         AdminLteAsset::class,
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 ];
95 95
 
96 96
 if (getenv('MYSQL_ATTR_SSL_CA')) {
97
-    $dbAttributes[PDO::MYSQL_ATTR_SSL_CA] = getenv('MYSQL_ATTR_SSL_CA');
97
+    $dbAttributes[ PDO::MYSQL_ATTR_SSL_CA ] = getenv('MYSQL_ATTR_SSL_CA');
98 98
 }
99 99
 
100 100
 $boxLayout = '@backend/views/layouts/box';
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 return [
104 104
     'id' => 'app',
105 105
     'name' => getenv('APP_TITLE'),
106
-    'language' => $languages[0],
106
+    'language' => $languages[ 0 ],
107 107
     'basePath' => '@app',
108 108
     'vendorPath' => '@root/vendor',
109 109
     'runtimePath' => '@root/runtime',
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     ],
122 122
     'params' => [
123 123
         'adminEmail' => getenv('APP_ADMIN_EMAIL'),
124
-        'context.menuItems' => [],
124
+        'context.menuItems' => [ ],
125 125
         'backend.iframe.name' => getenv('APP_PARAMS_BACKEND_IFRAME_NAME') ?: '_self',
126 126
         'backend.browserSupport' => [
127 127
             'Chrome' => 87,
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     'container' => [
138 138
         'definitions' => [
139 139
             AuthDbManagerComponent::class => [
140
-                'defaultRoles' => ['Default'],
140
+                'defaultRoles' => [ 'Default' ],
141 141
                 'cache' => 'cache'
142 142
             ],
143 143
             AdminController::class => [
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             'key' => getenv('AMAZON_S3_BUCKET_PUBLIC_KEY'),
202 202
             'secret' => getenv('AMAZON_S3_BUCKET_SECRET_KEY'),
203 203
             'bucket' => getenv('AMAZON_S3_BUCKET_NAME'),
204
-            'prefix' => getenv('APP_NAME') . '/public',
204
+            'prefix' => getenv('APP_NAME').'/public',
205 205
             'region' => getenv('AMAZON_S3_BUCKET_REGION')
206 206
         ],
207 207
         'fsRuntime' => [
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
                 'common' => [
236 236
                     'class' => Target::class,
237 237
                     'url' => 'php://stderr',
238
-                    'levels' => ['error', 'warning'],
239
-                    'logVars' => [],
238
+                    'levels' => [ 'error', 'warning' ],
239
+                    'logVars' => [ ],
240 240
                     'replaceNewline' => APP_TYPE === 'console' ? null : ''
241 241
                 ]
242 242
             ]
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
             'messageConfig' => [
258 258
                 'charset' => 'UTF-8',
259 259
                 'returnPath' => getenv('APP_MAILER_RETURN_PATH'),
260
-                'from' => [getenv('APP_MAILER_FROM') => getenv('APP_TITLE')]
260
+                'from' => [ getenv('APP_MAILER_FROM') => getenv('APP_TITLE') ]
261 261
             ]
262 262
         ],
263 263
         'queue' => [
@@ -284,9 +284,9 @@  discard block
 block discarded – undo
284 284
         'user' => [
285 285
             'class' => User::class,
286 286
             'enableAutoLogin' => true,
287
-            'loginUrl' => ['/user/security/login'],
287
+            'loginUrl' => [ '/user/security/login' ],
288 288
             'identityClass' => UserModel::class,
289
-            'rootUsers' => ['admin']
289
+            'rootUsers' => [ 'admin' ]
290 290
         ],
291 291
         'urlManager' => [
292 292
             'class' => UrlManager::class,
@@ -320,18 +320,18 @@  discard block
 block discarded – undo
320 320
                         'auto_reload' => true
321 321
                     ],
322 322
                     'globals' => [
323
-                        'Html' => ['class' => Html::class],
324
-                        'Json' => ['class' => Json::class],
325
-                        'Tree' => ['class' => Tree::class],
326
-                        'FA' => ['class' => FA::class],
327
-                        'Url' => ['class' => Url::class],
328
-                        'Markdown' => ['class' => Markdown::class]
323
+                        'Html' => [ 'class' => Html::class ],
324
+                        'Json' => [ 'class' => Json::class ],
325
+                        'Tree' => [ 'class' => Tree::class ],
326
+                        'FA' => [ 'class' => FA::class ],
327
+                        'Url' => [ 'class' => Url::class ],
328
+                        'Markdown' => [ 'class' => Markdown::class ]
329 329
                     ],
330 330
                     'functions' => [
331
-                        'image' => function ($imageSource, $preset = null) {
331
+                        'image' => function($imageSource, $preset = null) {
332 332
                             return ImageUrlHelper::image($imageSource, $preset);
333 333
                         },
334
-                        't' => function ($category, $message, $params = [], $language = null) {
334
+                        't' => function($category, $message, $params = [ ], $language = null) {
335 335
                             return Yii::t($category, $message, $params, $language);
336 336
                         }
337 337
                     ],
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     'modules' => [
346 346
         'audit' => [
347 347
             'class' => AuditModule::class,
348
-            'accessRoles' => ['audit-module'],
348
+            'accessRoles' => [ 'audit-module' ],
349 349
             'layout' => $boxLayout,
350 350
             'panels' => [
351 351
                 'audit/trail' => [
@@ -447,12 +447,12 @@  discard block
 block discarded – undo
447 447
                 [
448 448
                     'connection' => 'db',
449 449
                     'table' => '{{%hrzg_widget_template}}',
450
-                    'columns' => ['twig_template']
450
+                    'columns' => [ 'twig_template' ]
451 451
                 ],
452 452
                 [
453 453
                     'connection' => 'db',
454 454
                     'table' => '{{%twig}}',
455
-                    'columns' => ['value']
455
+                    'columns' => [ 'value' ]
456 456
                 ]
457 457
             ],
458 458
             'scanners' => [
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
                 ScannerJavaScriptFunction::class,
462 462
                 ScannerDatabase::class
463 463
             ],
464
-            'allowedIPs' => ['*'],
465
-            'roles' => ['translate-module']
464
+            'allowedIPs' => [ '*' ],
465
+            'roles' => [ 'translate-module' ]
466 466
         ],
467 467
         'user' => [
468 468
             'class' => UserModule::class,
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
             'enableGdprCompliance' => true,
471 471
             'defaultRoute' => 'admin',
472 472
             'administratorPermissionName' => 'user-module',
473
-            'administrators' => ['admin'],
473
+            'administrators' => [ 'admin' ],
474 474
             'enableFlashMessages' => false,
475 475
             'enableRegistration' => getenv('APP_USER_ENABLE_REGISTRATION'),
476 476
             'mailParams' => [
Please login to merge, or discard this patch.