Completed
Pull Request — master (#2012)
by
unknown
02:08
created
core/console/commands/ThemeController.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -124,6 +124,9 @@  discard block
 block discarded – undo
124 124
         return Json::encode($themeConfig->toArray(), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
125 125
     }
126 126
     
127
+    /**
128
+     * @param string $themeName
129
+     */
127 130
     private function renderAssetClass($themeName)
128 131
     {
129 132
         $className = ucfirst($themeName) . 'Asset';
@@ -153,6 +156,9 @@  discard block
 block discarded – undo
153 156
         return true;
154 157
     }
155 158
     
159
+    /**
160
+     * @param string $themeName
161
+     */
156 162
     private function renderLayout($themeName)
157 163
     {
158 164
         $className = ucfirst($themeName) . 'Asset';
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         
48 48
         $availableModules = implode(', ', array_column(Yii::$app->getFrontendModules(), 'id'));
49 49
         $themeLocation = $this->prompt("Enter the theme location where to generate (as path alias e.g. app, $availableModules):", ['default' => 'app']);
50
-        $themeLocation = '@' . ltrim($themeLocation, '@');
50
+        $themeLocation = '@'.ltrim($themeLocation, '@');
51 51
         
52 52
         preg_match("#^@[A-z]+#", $themeLocation, $newThemeLocation);
53 53
         
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
             }
60 60
         }
61 61
         
62
-        $basePath = $themeLocation . '/themes/' . $themeName;
62
+        $basePath = $themeLocation.'/themes/'.$themeName;
63 63
         $themeFolder = Yii::getAlias($basePath);
64 64
         
65 65
         if (file_exists($themeFolder)) {
66
-            return $this->outputError("The folder " . $themeFolder . " exists already.");
66
+            return $this->outputError("The folder ".$themeFolder." exists already.");
67 67
         }
68 68
         
69
-        $this->outputInfo("Theme path alias: " . $basePath);
70
-        $this->outputInfo("Theme real path: " . $themeFolder);
69
+        $this->outputInfo("Theme path alias: ".$basePath);
70
+        $this->outputInfo("Theme real path: ".$themeFolder);
71 71
         if (!$this->confirm("Do you want continue?")) {
72 72
             return $this->outputError('Abort by user.');
73 73
         }
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
         ];
82 82
         
83 83
         foreach ($folders as $folder) {
84
-            FileHelper::createDirectory($themeFolder . DIRECTORY_SEPARATOR . $folder);
84
+            FileHelper::createDirectory($themeFolder.DIRECTORY_SEPARATOR.$folder);
85 85
         }
86 86
         
87 87
         $contents = [
88
-            $themeFolder. DIRECTORY_SEPARATOR . 'theme.json' => $this->renderJson($basePath, $themeName),
89
-            $themeFolder. DIRECTORY_SEPARATOR . ucfirst($themeName) . 'Asset.php' => $this->renderAssetClass($themeName),
90
-            $themeFolder. DIRECTORY_SEPARATOR . 'resources/'. $themeName .'-asset/style.css' => '',
91
-            $themeFolder. DIRECTORY_SEPARATOR . 'views/layouts/theme.php' => $this->renderLayout($themeName),
92
-            $themeFolder. DIRECTORY_SEPARATOR . 'views/cmslayouts/theme.php' => $this->renderCmsLayout($themeName),
88
+            $themeFolder.DIRECTORY_SEPARATOR.'theme.json' => $this->renderJson($basePath, $themeName),
89
+            $themeFolder.DIRECTORY_SEPARATOR.ucfirst($themeName).'Asset.php' => $this->renderAssetClass($themeName),
90
+            $themeFolder.DIRECTORY_SEPARATOR.'resources/'.$themeName.'-asset/style.css' => '',
91
+            $themeFolder.DIRECTORY_SEPARATOR.'views/layouts/theme.php' => $this->renderLayout($themeName),
92
+            $themeFolder.DIRECTORY_SEPARATOR.'views/cmslayouts/theme.php' => $this->renderCmsLayout($themeName),
93 93
         ];
94 94
         
95 95
         foreach ($contents as $fileName => $content) {
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     
127 127
     private function renderAssetClass($themeName)
128 128
     {
129
-        $className = ucfirst($themeName) . 'Asset';
129
+        $className = ucfirst($themeName).'Asset';
130 130
         return "<?php
131 131
 namespace app\\themes\\{$themeName};
132 132
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     
156 156
     private function renderLayout($themeName)
157 157
     {
158
-        $className = ucfirst($themeName) . 'Asset';
158
+        $className = ucfirst($themeName).'Asset';
159 159
     
160 160
         return '<?php
161 161
 /**
Please login to merge, or discard this patch.