Completed
Push — master ( c2e6ca...ff3def )
by Tobias
11:05
created
src/commands/AppController.php 1 patch
Spacing   +17 added lines, -17 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,7 +57,7 @@  discard block
 block discarded – undo
57 57
     public function actionVersion()
58 58
     {
59 59
         $this->stdout('Application Version: ');
60
-        $this->stdout(getenv('APP_NAME') . ' ');
60
+        $this->stdout(getenv('APP_NAME').' ');
61 61
         $this->stdout(APP_VERSION);
62 62
         echo "\n";
63 63
     }
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
         $this->stdout("=====================\n");
73 73
         $this->stdout("Initializing application\n");
74 74
 
75
-        $this->interactive = (bool)getenv('APP_INTERACTIVE');
75
+        $this->interactive = (bool) getenv('APP_INTERACTIVE');
76 76
 
77 77
         $this->stdout("\nDatabase\n");
78 78
         $this->stdout("--------\n");
79
-        $this->run('db/create', [getenv('DB_ENV_MYSQL_ROOT_USER'),getenv('DB_ENV_MYSQL_ROOT_PASSWORD')]);
80
-        $this->run('migrate/up', ['interactive' => (bool)getenv('APP_INTERACTIVE')]);
79
+        $this->run('db/create', [ getenv('DB_ENV_MYSQL_ROOT_USER'), getenv('DB_ENV_MYSQL_ROOT_PASSWORD') ]);
80
+        $this->run('migrate/up', [ 'interactive' => (bool) getenv('APP_INTERACTIVE') ]);
81 81
 
82 82
         $this->stdout("\nUser\n");
83 83
         $this->stdout("----\n");
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                 'default' => getenv('APP_ADMIN_PASSWORD') ?: \Yii::$app->security->generateRandomString(8),
88 88
             ]
89 89
         );
90
-        $this->run('user/create', [getenv('APP_ADMIN_EMAIL'), 'admin', $adminPassword]);
90
+        $this->run('user/create', [ getenv('APP_ADMIN_EMAIL'), 'admin', $adminPassword ]);
91 91
 
92 92
         $this->stdout('Initializing modules');
93 93
 
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
         $this->stdout("\nCleanup\n");
103 103
         $this->stdout("-------\n");
104 104
         $this->run('cache/flush-all');
105
-        $this->run('audit/cleanup', ['age' => 30, 'interactive' => (bool)getenv('APP_INTERACTIVE')]);
106
-        $this->run('app/clear-assets', ['interactive' => (bool)getenv('APP_INTERACTIVE')]);
105
+        $this->run('audit/cleanup', [ 'age' => 30, 'interactive' => (bool) getenv('APP_INTERACTIVE') ]);
106
+        $this->run('app/clear-assets', [ 'interactive' => (bool) getenv('APP_INTERACTIVE') ]);
107 107
     }
108 108
 
109 109
     /**
@@ -117,20 +117,20 @@  discard block
 block discarded – undo
117 117
         $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]$"';
118 118
 
119 119
         // create $cmd command
120
-        $cmd = 'cd "' . $assets . '" && ls | grep -e ' . $matchRegex . ' | xargs rm -rf ';
120
+        $cmd = 'cd "'.$assets.'" && ls | grep -e '.$matchRegex.' | xargs rm -rf ';
121 121
 
122 122
         // Set command
123 123
         $command = new Command($cmd);
124 124
 
125 125
         // Prompt user
126
-        $delete = $this->confirm("\nDo you really want to delete web assets?", ['default' => true]);
126
+        $delete = $this->confirm("\nDo you really want to delete web assets?", [ 'default' => true ]);
127 127
 
128 128
         if ($delete) {
129 129
             // Try to execute $command
130 130
             if ($command->execute()) {
131 131
                 echo "Web assets have been deleted.\n\n";
132 132
             } else {
133
-                echo "\n" . $command->getError() . "\n";
133
+                echo "\n".$command->getError()."\n";
134 134
                 echo $command->getStdErr();
135 135
             }
136 136
         }
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
         $message = $mailer->compose();
144 144
         $message
145 145
             ->setTo($to)
146
-            ->setSubject('Test-Mail from ' . getenv('APP_NAME'))
147
-            ->setTextBody(getenv('APP_TITLE') . ' | ' . getenv('HOSTNAME'));
146
+            ->setSubject('Test-Mail from '.getenv('APP_NAME'))
147
+            ->setTextBody(getenv('APP_TITLE').' | '.getenv('HOSTNAME'));
148 148
 
149 149
         if ($message->send()) {
150 150
             $this->stdout('Mail sent');
Please login to merge, or discard this patch.