Completed
Push — master ( 628ca0...425df1 )
by Tobias
12:24
created
src/commands/AppController.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
     public function actionConfig($key = null)
30 30
     {
31 31
         // get config from global variable (TODO)
32
-        $data = $GLOBALS['config'];
32
+        $data = $GLOBALS[ 'config' ];
33 33
         if ($key) {
34 34
             $keys = explode('.', $key);
35
-            if (isset($keys[0])) {
36
-                $data = $GLOBALS['config'][$keys[0]];
35
+            if (isset($keys[ 0 ])) {
36
+                $data = $GLOBALS[ 'config' ][ $keys[ 0 ] ];
37 37
             }
38
-            if (isset($keys[1])) {
39
-                $data = $GLOBALS['config'][$keys[0]][$keys[1]];
38
+            if (isset($keys[ 1 ])) {
39
+                $data = $GLOBALS[ 'config' ][ $keys[ 0 ] ][ $keys[ 1 ] ];
40 40
             }
41 41
         }
42 42
         $this->stdout(VarDumper::dumpAsString($data));
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     public function actionVersion()
59 59
     {
60 60
         $this->stdout('Application Version: ');
61
-        $this->stdout(getenv('APP_NAME') . ' ');
61
+        $this->stdout(getenv('APP_NAME').' ');
62 62
         $this->stdout(APP_VERSION);
63 63
         echo "\n";
64 64
     }
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
         $this->stdout("=====================\n");
74 74
         $this->stdout("Initializing application\n");
75 75
 
76
-        $this->interactive = (bool)getenv('APP_INTERACTIVE');
76
+        $this->interactive = (bool) getenv('APP_INTERACTIVE');
77 77
 
78 78
         $this->stdout("\nDatabase\n");
79 79
         $this->stdout("--------\n");
80 80
         $this->run('db/create');
81
-        $this->run('migrate/up', ['interactive' => (bool)getenv('APP_INTERACTIVE')]);
81
+        $this->run('migrate/up', [ 'interactive' => (bool) getenv('APP_INTERACTIVE') ]);
82 82
 
83 83
         $this->stdout("\nUser\n");
84 84
         $this->stdout("----\n");
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 'default' => getenv('APP_ADMIN_PASSWORD') ?: \Yii::$app->security->generateRandomString(8),
89 89
             ]
90 90
         );
91
-        $this->run('user/create', [getenv('APP_ADMIN_EMAIL'), 'admin', $adminPassword]);
91
+        $this->run('user/create', [ getenv('APP_ADMIN_EMAIL'), 'admin', $adminPassword ]);
92 92
 
93 93
         $this->stdout('Initializing modules');
94 94
 
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public function actionInitModules()
102 102
     {
103
-        $this->stdout('Initializing modules...' . PHP_EOL);
103
+        $this->stdout('Initializing modules...'.PHP_EOL);
104 104
         foreach (Yii::$app->getModules() as $name => $module) {
105 105
             if (is_array($module)) {
106 106
                 $this->stdout("{$name}");
107 107
                 Yii::$app->getModule($name)->init();
108
-                $this->stdout(" [OK]" . PHP_EOL);
108
+                $this->stdout(" [OK]".PHP_EOL);
109 109
             }
110 110
         }
111
-        $this->stdout(PHP_EOL . "Done." . PHP_EOL);
111
+        $this->stdout(PHP_EOL."Done.".PHP_EOL);
112 112
     }
113 113
 
114 114
     /**
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
         $this->stdout("\nCleanup\n");
120 120
         $this->stdout("-------\n");
121 121
         $this->run('cache/flush-all');
122
-        $this->run('audit/cleanup', ['age' => 30, 'interactive' => (bool)getenv('APP_INTERACTIVE')]);
123
-        $this->run('app/clear-assets', ['interactive' => (bool)getenv('APP_INTERACTIVE')]);
122
+        $this->run('audit/cleanup', [ 'age' => 30, 'interactive' => (bool) getenv('APP_INTERACTIVE') ]);
123
+        $this->run('app/clear-assets', [ 'interactive' => (bool) getenv('APP_INTERACTIVE') ]);
124 124
     }
125 125
 
126 126
     /**
@@ -134,20 +134,20 @@  discard block
 block discarded – undo
134 134
         $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]$"';
135 135
 
136 136
         // create $cmd command
137
-        $cmd = 'cd "' . $assets . '" && ls | grep -e ' . $matchRegex . ' | xargs rm -rf ';
137
+        $cmd = 'cd "'.$assets.'" && ls | grep -e '.$matchRegex.' | xargs rm -rf ';
138 138
 
139 139
         // Set command
140 140
         $command = new Command($cmd);
141 141
 
142 142
         // Prompt user
143
-        $delete = $this->confirm("\nDo you really want to delete web assets?", ['default' => true]);
143
+        $delete = $this->confirm("\nDo you really want to delete web assets?", [ 'default' => true ]);
144 144
 
145 145
         if ($delete) {
146 146
             // Try to execute $command
147 147
             if ($command->execute()) {
148 148
                 echo "Web assets have been deleted.\n\n";
149 149
             } else {
150
-                echo "\n" . $command->getError() . "\n";
150
+                echo "\n".$command->getError()."\n";
151 151
                 echo $command->getStdErr();
152 152
             }
153 153
         }
Please login to merge, or discard this patch.