Completed
Pull Request — epic/2.0.0 (#37)
by Steven
03:03
created
src/Magestead/Command/SetupCommand.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
     }
49 49
 
50 50
     /**
51
-     * @param $source
52
-     * @param $target
51
+     * @param string $source
52
+     * @param string $target
53 53
      * @param OutputInterface $output
54 54
      */
55 55
     protected function copyConfigFiles($source, $target, OutputInterface $output)
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
     /**
134 134
      * @param OutputInterface $output
135
-     * @param $options
135
+     * @param Options $options
136 136
      */
137 137
     protected function setupProject(OutputInterface $output, $options)
138 138
     {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
     protected function configure()
24 24
     {
25
-        $this->_basePath = dirname( __FILE__ ) . '/../../../';
25
+        $this->_basePath = dirname(__FILE__).'/../../../';
26 26
         $this->_projectPath = getcwd();
27 27
 
28 28
         $this->setName("setup");
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
                     \RecursiveIteratorIterator::SELF_FIRST) as $item
64 64
             ) {
65 65
                 if ($item->isDir()) {
66
-                    mkdir($target . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
66
+                    mkdir($target.DIRECTORY_SEPARATOR.$iterator->getSubPathName());
67 67
                 } else {
68
-                    copy($item, $target . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
68
+                    copy($item, $target.DIRECTORY_SEPARATOR.$iterator->getSubPathName());
69 69
                 }
70 70
                 $progress->advance();
71 71
             }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     {
108 108
         $yaml = new Parser();
109 109
         try {
110
-            return $yaml->parse(file_get_contents($this->_projectPath . '/magestead.yaml'));
110
+            return $yaml->parse(file_get_contents($this->_projectPath.'/magestead.yaml'));
111 111
         } catch (ParseException $e) {
112 112
             $output->writeln('<error>Unable to parse the YAML string</error>');
113 113
             printf("Unable to parse the YAML string: %s", $e->getMessage());
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $yaml = $dumper->dump($config, 6);
125 125
 
126 126
         try {
127
-            file_put_contents($this->_projectPath . '/magestead.yaml', $yaml);
127
+            file_put_contents($this->_projectPath.'/magestead.yaml', $yaml);
128 128
         } catch (\Exception $e) {
129 129
             $output->writeln('<error>Unable to write to the YAML file</error>');
130 130
         }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     protected function setupProject(OutputInterface $output, $options)
138 138
     {
139 139
         $output->writeln('<info>Setting up project structure</info>');
140
-        $provisionFolder = $this->_basePath . "provision";
140
+        $provisionFolder = $this->_basePath."provision";
141 141
         $this->copyConfigFiles($provisionFolder, $this->_projectPath, $output);
142 142
         $this->configureProject($options->getAllOptions(), $output);
143 143
     }
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@  discard block
 block discarded – undo
20 20
     protected $_projectPath;
21 21
     protected $_magesteadConfig;
22 22
 
23
-    protected function configure()
24
-    {
23
+    protected function configure() {
25 24
         $this->_basePath = dirname( __FILE__ ) . '/../../../';
26 25
         $this->_projectPath = getcwd();
27 26
 
@@ -34,8 +33,7 @@  discard block
 block discarded – undo
34 33
      * @param OutputInterface $output
35 34
      * @return \Magestead\Installers\Magento2Project|\Magestead\Installers\MagentoProject
36 35
      */
37
-    protected function execute(InputInterface $input, OutputInterface $output)
38
-    {
36
+    protected function execute(InputInterface $input, OutputInterface $output) {
39 37
         $helper = $this->getHelper('question');
40 38
         $options = new Options($helper, $input, $output);
41 39
 
@@ -52,8 +50,7 @@  discard block
 block discarded – undo
52 50
      * @param $target
53 51
      * @param OutputInterface $output
54 52
      */
55
-    protected function copyConfigFiles($source, $target, OutputInterface $output)
56
-    {
53
+    protected function copyConfigFiles($source, $target, OutputInterface $output) {
57 54
         try {
58 55
             $progress = new ProgressBar($output, 3720);
59 56
             $progress->start();
@@ -80,8 +77,7 @@  discard block
 block discarded – undo
80 77
      * @param array $options
81 78
      * @param OutputInterface $output
82 79
      */
83
-    protected function configureProject(array $options, OutputInterface $output)
84
-    {
80
+    protected function configureProject(array $options, OutputInterface $output) {
85 81
         $this->_magesteadConfig = $this->getConfigFile($output);
86 82
 
87 83
         $this->_magesteadConfig['vagrantfile']['vm']['box'] = $options['box'];
@@ -103,8 +99,7 @@  discard block
 block discarded – undo
103 99
      * @param OutputInterface $output
104 100
      * @return mixed
105 101
      */
106
-    protected function getConfigFile(OutputInterface $output)
107
-    {
102
+    protected function getConfigFile(OutputInterface $output) {
108 103
         $yaml = new Parser();
109 104
         try {
110 105
             return $yaml->parse(file_get_contents($this->_projectPath . '/magestead.yaml'));
@@ -118,8 +113,7 @@  discard block
 block discarded – undo
118 113
      * @param array $config
119 114
      * @param OutputInterface $output
120 115
      */
121
-    protected function saveConfigFile(array $config, OutputInterface $output)
122
-    {
116
+    protected function saveConfigFile(array $config, OutputInterface $output) {
123 117
         $dumper = new Dumper();
124 118
         $yaml = $dumper->dump($config, 6);
125 119
 
@@ -134,8 +128,7 @@  discard block
 block discarded – undo
134 128
      * @param OutputInterface $output
135 129
      * @param $options
136 130
      */
137
-    protected function setupProject(OutputInterface $output, $options)
138
-    {
131
+    protected function setupProject(OutputInterface $output, $options) {
139 132
         $output->writeln('<info>Setting up project structure</info>');
140 133
         $provisionFolder = $this->_basePath . "provision";
141 134
         $this->copyConfigFiles($provisionFolder, $this->_projectPath, $output);
Please login to merge, or discard this patch.
src/Magestead/Helper/Options.php 4 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -53,20 +53,20 @@
 block discarded – undo
53 53
     public function getAllOptions()
54 54
     {
55 55
         return [
56
-          'app' => $this->_app,
57
-          'server' => $this->_server,
58
-          'phpver' => $this->_phpVer,
59
-          'os' => $this->_os,
60
-          'box' => $this->_box,
61
-          'm2user' => $this->_m2Username,
62
-          'm2pass' => $this->_m2Password,
63
-          'repo_url' => $this->_repoUrl,
64
-          'ip_address' => $this->_ipAddress,
65
-          'cpus' => $this->_cpus,
66
-          'memory_limit' => $this->_memorylimit,
67
-          'locale' => $this->_locale,
68
-          'default_currency' => $this->_currency,
69
-          'base_url' => $this->_baseUrl,
56
+            'app' => $this->_app,
57
+            'server' => $this->_server,
58
+            'phpver' => $this->_phpVer,
59
+            'os' => $this->_os,
60
+            'box' => $this->_box,
61
+            'm2user' => $this->_m2Username,
62
+            'm2pass' => $this->_m2Password,
63
+            'repo_url' => $this->_repoUrl,
64
+            'ip_address' => $this->_ipAddress,
65
+            'cpus' => $this->_cpus,
66
+            'memory_limit' => $this->_memorylimit,
67
+            'locale' => $this->_locale,
68
+            'default_currency' => $this->_currency,
69
+            'base_url' => $this->_baseUrl,
70 70
         ];
71 71
     }
72 72
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
      */
169 169
     protected function verifyAuth($helper, InputInterface $input, OutputInterface $output)
170 170
     {
171
-        $authFile = $_SERVER['HOME'] . "/.composer/auth.json";
171
+        $authFile = $_SERVER['HOME']."/.composer/auth.json";
172 172
 
173 173
         $authObj = [];
174 174
         if (file_exists($authFile)) {
175 175
             $authJson = file_get_contents($authFile);
176
-            $authObj = (array)json_decode($authJson);
176
+            $authObj = (array) json_decode($authJson);
177 177
 
178 178
             if (isset($authObj['http-basic']) && isset($authObj['http-basic']->{'repo.magento.com'})) {
179 179
                 return true;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      */
212 212
     protected function setVagrantBox()
213 213
     {
214
-        $this->_box = self::BOX_PREFIX . $this->_os . "-$this->_server-php$this->_phpVer";
214
+        $this->_box = self::BOX_PREFIX.$this->_os."-$this->_server-php$this->_phpVer";
215 215
     }
216 216
 
217 217
     /**
Please login to merge, or discard this patch.
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@  discard block
 block discarded – undo
34 34
      * @param InputInterface $input
35 35
      * @param OutputInterface $output
36 36
      */
37
-    public function __construct($helper, InputInterface $input, OutputInterface $output)
38
-    {
37
+    public function __construct($helper, InputInterface $input, OutputInterface $output) {
39 38
         $this->setVagrantSettings($helper, $input, $output);
40 39
 
41 40
         $this->setServerConfig($helper, $input, $output);
@@ -50,8 +49,7 @@  discard block
 block discarded – undo
50 49
     /**
51 50
      * @return array
52 51
      */
53
-    public function getAllOptions()
54
-    {
52
+    public function getAllOptions() {
55 53
         return [
56 54
           'app' => $this->_app,
57 55
           'server' => $this->_server,
@@ -75,8 +73,7 @@  discard block
 block discarded – undo
75 73
      * @param InputInterface $input
76 74
      * @param OutputInterface $output
77 75
      */
78
-    protected function setVagrantSettings($helper, InputInterface $input, OutputInterface $output)
79
-    {
76
+    protected function setVagrantSettings($helper, InputInterface $input, OutputInterface $output) {
80 77
         $output->writeln('<comment>Lets configure your project\'s VM</comment>');
81 78
 
82 79
         $ipQuestion = new Question("Configure the IP for your VM (192.168.47.47): ", '192.168.47.47');
@@ -94,8 +91,7 @@  discard block
 block discarded – undo
94 91
      * @param InputInterface $input
95 92
      * @param OutputInterface $output
96 93
      */
97
-    protected function setApplicationSettings($helper, InputInterface $input, OutputInterface $output)
98
-    {
94
+    protected function setApplicationSettings($helper, InputInterface $input, OutputInterface $output) {
99 95
         $output->writeln('<comment>Lets configure your project\'s application</comment>');
100 96
         if ($this->_phpVer !== '70') {
101 97
             $appQuestion = new ChoiceQuestion(
@@ -122,8 +118,7 @@  discard block
 block discarded – undo
122 118
      * @param OutputInterface $output
123 119
      * @return bool
124 120
      */
125
-    protected function setMagento2Settings($helper, InputInterface $input, OutputInterface $output)
126
-    {
121
+    protected function setMagento2Settings($helper, InputInterface $input, OutputInterface $output) {
127 122
         if ($this->_app === 'magento2') {
128 123
             return $this->verifyAuth($helper, $input, $output);
129 124
         }
@@ -136,8 +131,7 @@  discard block
 block discarded – undo
136 131
      * @param InputInterface $input
137 132
      * @param OutputInterface $output
138 133
      */
139
-    protected function setVersionControlSettings($helper, InputInterface $input, OutputInterface $output)
140
-    {
134
+    protected function setVersionControlSettings($helper, InputInterface $input, OutputInterface $output) {
141 135
         $versionControl = new ConfirmationQuestion("Would you like to add your project to GIT? (no/yes) ", false);
142 136
         $versioning = $helper->ask($input, $output, $versionControl);
143 137
         if ($versioning) {
@@ -151,8 +145,7 @@  discard block
 block discarded – undo
151 145
      * @param InputInterface $input
152 146
      * @param OutputInterface $output
153 147
      */
154
-    protected function askForAuth($helper, InputInterface $input, OutputInterface $output)
155
-    {
148
+    protected function askForAuth($helper, InputInterface $input, OutputInterface $output) {
156 149
         $username = new Question("Please enter your Magento username (public key): ", '');
157 150
         $this->_m2Username = $helper->ask($input, $output, $username);
158 151
 
@@ -166,8 +159,7 @@  discard block
 block discarded – undo
166 159
      * @param OutputInterface $output
167 160
      * @return bool
168 161
      */
169
-    protected function verifyAuth($helper, InputInterface $input, OutputInterface $output)
170
-    {
162
+    protected function verifyAuth($helper, InputInterface $input, OutputInterface $output) {
171 163
         $authFile = $_SERVER['HOME'] . "/.composer/auth.json";
172 164
 
173 165
         $authObj = [];
@@ -194,8 +186,7 @@  discard block
 block discarded – undo
194 186
      * @param InputInterface $input
195 187
      * @param OutputInterface $output
196 188
      */
197
-    protected function setPhp($helper, InputInterface $input, OutputInterface $output)
198
-    {
189
+    protected function setPhp($helper, InputInterface $input, OutputInterface $output) {
199 190
         $output->writeln('<info>Keep in mind PHP7 is only available for Magento 2</info>');
200 191
         $phpVerQuestion = new ChoiceQuestion(
201 192
             "Which version of PHP should be installed?",
@@ -209,8 +200,7 @@  discard block
 block discarded – undo
209 200
     /**
210 201
      * Set box name from concat user options
211 202
      */
212
-    protected function setVagrantBox()
213
-    {
203
+    protected function setVagrantBox() {
214 204
         $this->_box = self::BOX_PREFIX . $this->_os . "-$this->_server-php$this->_phpVer";
215 205
     }
216 206
 
@@ -219,8 +209,7 @@  discard block
 block discarded – undo
219 209
      * @param InputInterface $input
220 210
      * @param OutputInterface $output
221 211
      */
222
-    protected function setServerConfig($helper, InputInterface $input, OutputInterface $output)
223
-    {
212
+    protected function setServerConfig($helper, InputInterface $input, OutputInterface $output) {
224 213
         $output->writeln('<comment>Lets configure your server</comment>');
225 214
         $this->setOperatingSystem($helper, $input, $output);
226 215
         $this->setWebServer($helper, $input, $output);
@@ -232,8 +221,7 @@  discard block
 block discarded – undo
232 221
      * @param InputInterface $input
233 222
      * @param OutputInterface $output
234 223
      */
235
-    protected function setWebServer($helper, InputInterface $input, OutputInterface $output)
236
-    {
224
+    protected function setWebServer($helper, InputInterface $input, OutputInterface $output) {
237 225
         $serverQuestion = new ChoiceQuestion(
238 226
             "Which webserver would you like?",
239 227
             ['NGINX', 'Apache'],
@@ -247,8 +235,7 @@  discard block
 block discarded – undo
247 235
      * @param InputInterface $input
248 236
      * @param OutputInterface $output
249 237
      */
250
-    protected function setOperatingSystem($helper, InputInterface $input, OutputInterface $output)
251
-    {
238
+    protected function setOperatingSystem($helper, InputInterface $input, OutputInterface $output) {
252 239
         $osQuestion = new ChoiceQuestion(
253 240
             "Which OS would you like to install?",
254 241
             ['CentOS 6.5', 'Ubuntu 14'],
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             return $this->verifyAuth($helper, $input, $output);
129 129
         }
130 130
 
131
-        return true;
131
+        return TRUE;
132 132
     }
133 133
 
134 134
     /**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     protected function setVersionControlSettings($helper, InputInterface $input, OutputInterface $output)
140 140
     {
141
-        $versionControl = new ConfirmationQuestion("Would you like to add your project to GIT? (no/yes) ", false);
141
+        $versionControl = new ConfirmationQuestion("Would you like to add your project to GIT? (no/yes) ", FALSE);
142 142
         $versioning = $helper->ask($input, $output, $versionControl);
143 143
         if ($versioning) {
144 144
             $repoQuestion = new Question("Enter your full GitHub/BitBucket repo URL: ", '');
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
             $authObj = (array)json_decode($authJson);
177 177
 
178 178
             if (isset($authObj['http-basic']) && isset($authObj['http-basic']->{'repo.magento.com'})) {
179
-                return true;
179
+                return TRUE;
180 180
             }
181 181
         }
182 182
 
Please login to merge, or discard this patch.