Completed
Pull Request — develop (#86)
by Igor
03:56
created
src/Magestead/Exceptions/AuthSavePermissionsException.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 class AuthSavePermissionsException extends \RuntimeException
8 8
 {
9
-    const TPL = "\n\nFile auth.json is not writable. Please add the following content manually: \n%s\n";
9
+    const TPL="\n\nFile auth.json is not writable. Please add the following content manually: \n%s\n";
10 10
 
11 11
     /**
12 12
      * @param array $auth
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      */
15 15
     public function setAuthObject(array $auth)
16 16
     {
17
-        $this->message = sprintf(static::TPL, json_encode($auth, JSON_PRETTY_PRINT));
17
+        $this->message=sprintf(static::TPL, json_encode($auth, JSON_PRETTY_PRINT));
18 18
         return $this;
19 19
     }
20 20
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
12 12
      * @param array $auth
13 13
      * @return self
14 14
      */
15
-    public function setAuthObject(array $auth)
16
-    {
15
+    public function setAuthObject(array $auth) {
17 16
         $this->message = sprintf(static::TPL, json_encode($auth, JSON_PRETTY_PRINT));
18 17
         return $this;
19 18
     }
Please login to merge, or discard this patch.
src/Magestead/Helper/Options.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  */
14 14
 class Options
15 15
 {
16
-    const BOX_PREFIX = 'richdynamix/magestead-';
16
+    const BOX_PREFIX='richdynamix/magestead-';
17 17
 
18
-    protected $_app = 'magento2';
19
-    protected $_phpVer = '56';
20
-    protected $_os = 'centos65';
18
+    protected $_app='magento2';
19
+    protected $_phpVer='56';
20
+    protected $_os='centos65';
21 21
     protected $_server;
22 22
     protected $_box;
23 23
     protected $_m2Username;
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
     protected $_locale;
29 29
     protected $_currency;
30 30
     protected $_baseUrl;
31
-    protected $_repoUrl = '';
32
-    protected $installSampleData = false;
31
+    protected $_repoUrl='';
32
+    protected $installSampleData=false;
33 33
 
34 34
     /**
35 35
      * Options constructor.
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
     {
85 85
         $output->writeln('<comment>Lets configure your project\'s VM</comment>');
86 86
 
87
-        $ipQuestion       = new Question("Configure the IP for your VM (192.168.47.47): ", '192.168.47.47');
88
-        $this->_ipAddress = strtolower($helper->ask($input, $output, $ipQuestion));
87
+        $ipQuestion=new Question("Configure the IP for your VM (192.168.47.47): ", '192.168.47.47');
88
+        $this->_ipAddress=strtolower($helper->ask($input, $output, $ipQuestion));
89 89
 
90
-        $cpuQuestion = new Question("How many CPU's would you like to use? (1): ", '1');
91
-        $this->_cpus = strtolower($helper->ask($input, $output, $cpuQuestion));
90
+        $cpuQuestion=new Question("How many CPU's would you like to use? (1): ", '1');
91
+        $this->_cpus=strtolower($helper->ask($input, $output, $cpuQuestion));
92 92
 
93
-        $memoryQuestion     = new Question("Define the VM memory limit (2048): ", '2048');
94
-        $this->_memorylimit = strtolower($helper->ask($input, $output, $memoryQuestion));
93
+        $memoryQuestion=new Question("Define the VM memory limit (2048): ", '2048');
94
+        $this->_memorylimit=strtolower($helper->ask($input, $output, $memoryQuestion));
95 95
     }
96 96
 
97 97
     /**
@@ -103,22 +103,22 @@  discard block
 block discarded – undo
103 103
     protected function setApplicationSettings($helper, InputInterface $input, OutputInterface $output, $project)
104 104
     {
105 105
         $output->writeln('<comment>Lets configure your project\'s application</comment>');
106
-        $appQuestion = new ChoiceQuestion(
106
+        $appQuestion=new ChoiceQuestion(
107 107
             "Which application do you want to install?",
108 108
             ['Magento', 'Magento2'],
109 109
             0
110 110
         );
111 111
 
112
-        $this->_app = strtolower($helper->ask($input, $output, $appQuestion));
112
+        $this->_app=strtolower($helper->ask($input, $output, $appQuestion));
113 113
 
114
-        $baseUrlQuestion = new Question("Enter your application's base_url ($project.dev): ", $project.'.dev');
115
-        $this->_baseUrl  = strtolower($helper->ask($input, $output, $baseUrlQuestion));
114
+        $baseUrlQuestion=new Question("Enter your application's base_url ($project.dev): ", $project.'.dev');
115
+        $this->_baseUrl=strtolower($helper->ask($input, $output, $baseUrlQuestion));
116 116
 
117
-        $currenyQuestion = new Question("Enter your application's default currency (GBP): ", 'GBP');
118
-        $this->_currency = $helper->ask($input, $output, $currenyQuestion);
117
+        $currenyQuestion=new Question("Enter your application's default currency (GBP): ", 'GBP');
118
+        $this->_currency=$helper->ask($input, $output, $currenyQuestion);
119 119
 
120
-        $localeQuestion = new Question("Enter your application's default locale (en_GB): ", 'en_GB');
121
-        $this->_locale  = $helper->ask($input, $output, $localeQuestion);
120
+        $localeQuestion=new Question("Enter your application's default locale (en_GB): ", 'en_GB');
121
+        $this->_locale=$helper->ask($input, $output, $localeQuestion);
122 122
     }
123 123
 
124 124
     /**
@@ -144,18 +144,18 @@  discard block
 block discarded – undo
144 144
      */
145 145
     protected function setVersionControlSettings($helper, InputInterface $input, OutputInterface $output)
146 146
     {
147
-        $versionControl = new ConfirmationQuestion("Would you like to add your project to GIT? (no/yes) ", false);
148
-        $versioning     = $helper->ask($input, $output, $versionControl);
147
+        $versionControl=new ConfirmationQuestion("Would you like to add your project to GIT? (no/yes) ", false);
148
+        $versioning=$helper->ask($input, $output, $versionControl);
149 149
         if ($versioning) {
150
-            $repoQuestion   = new Question("Enter your full GitHub/BitBucket repo URL: ", '');
151
-            $this->_repoUrl = strtolower($helper->ask($input, $output, $repoQuestion));
150
+            $repoQuestion=new Question("Enter your full GitHub/BitBucket repo URL: ", '');
151
+            $this->_repoUrl=strtolower($helper->ask($input, $output, $repoQuestion));
152 152
         }
153 153
     }
154 154
 
155 155
     protected function installSampleData($helper, InputInterface $input, OutputInterface $output)
156 156
     {
157
-        $sampleInstall = new ConfirmationQuestion("Would you like to install sample data? (no/yes) ", false);
158
-        $this->installSampleData = $helper->ask($input, $output, $sampleInstall);
157
+        $sampleInstall=new ConfirmationQuestion("Would you like to install sample data? (no/yes) ", false);
158
+        $this->installSampleData=$helper->ask($input, $output, $sampleInstall);
159 159
     }
160 160
 
161 161
     /**
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
      */
166 166
     protected function askForAuth($helper, InputInterface $input, OutputInterface $output)
167 167
     {
168
-        $username          = new Question("Please enter your Magento username (public key): ", '');
169
-        $this->_m2Username = $helper->ask($input, $output, $username);
168
+        $username=new Question("Please enter your Magento username (public key): ", '');
169
+        $this->_m2Username=$helper->ask($input, $output, $username);
170 170
 
171
-        $password          = new Question("Please enter your Magento password (private key): ", '');
172
-        $this->_m2Password = $helper->ask($input, $output, $password);
171
+        $password=new Question("Please enter your Magento password (private key): ", '');
172
+        $this->_m2Password=$helper->ask($input, $output, $password);
173 173
     }
174 174
 
175 175
     /**
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
      */
181 181
     protected function verifyAuth($helper, InputInterface $input, OutputInterface $output)
182 182
     {
183
-        $composerHome = (new Config($output))->getComposerHomeDir();
184
-        $authFile = $composerHome . "/auth.json";
183
+        $composerHome=(new Config($output))->getComposerHomeDir();
184
+        $authFile=$composerHome."/auth.json";
185 185
 
186
-        $authObj = [];
186
+        $authObj=[];
187 187
         if (file_exists($authFile) && is_readable($authFile)) {
188
-            $authJson = file_get_contents($authFile);
189
-            $authObj  = (array)json_decode($authJson, true);
188
+            $authJson=file_get_contents($authFile);
189
+            $authObj=(array) json_decode($authJson, true);
190 190
 
191 191
             if (isset($authObj['http-basic']) && isset($authObj['http-basic']->{'repo.magento.com'})) {
192 192
                 return true;
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 
196 196
         $this->askForAuth($helper, $input, $output);
197 197
 
198
-        $authObj['http-basic']['repo.magento.com']['username'] = $this->_m2Username;
199
-        $authObj['http-basic']['repo.magento.com']['password'] = $this->_m2Password;
198
+        $authObj['http-basic']['repo.magento.com']['username']=$this->_m2Username;
199
+        $authObj['http-basic']['repo.magento.com']['password']=$this->_m2Password;
200 200
 
201
-        $authJson = json_encode($authObj);
201
+        $authJson=json_encode($authObj);
202 202
 
203 203
         // check writable first
204 204
         if (!is_writable($authFile)) {
205
-            $e = new AuthSavePermissionsException();
205
+            $e=new AuthSavePermissionsException();
206 206
             throw $e->setAuthObject($authObj);
207 207
         }
208 208
 
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
      */
217 217
     protected function setPhp($helper, InputInterface $input, OutputInterface $output)
218 218
     {
219
-        $phpVerQuestion = new ChoiceQuestion(
219
+        $phpVerQuestion=new ChoiceQuestion(
220 220
             "Which version of PHP should be installed?",
221 221
             ['56', '70'],
222 222
             0
223 223
         );
224 224
 
225
-        $this->_phpVer = $helper->ask($input, $output, $phpVerQuestion);
225
+        $this->_phpVer=$helper->ask($input, $output, $phpVerQuestion);
226 226
     }
227 227
 
228 228
     /**
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
      */
231 231
     protected function setVagrantBox()
232 232
     {
233
-        $this->_box = self::BOX_PREFIX . $this->_os . "-$this->_server-php$this->_phpVer";
233
+        $this->_box=self::BOX_PREFIX.$this->_os."-$this->_server-php$this->_phpVer";
234 234
     }
235 235
 
236 236
     /**
@@ -253,13 +253,13 @@  discard block
 block discarded – undo
253 253
      */
254 254
     protected function setWebServer($helper, InputInterface $input, OutputInterface $output)
255 255
     {
256
-        $serverQuestion = new ChoiceQuestion(
256
+        $serverQuestion=new ChoiceQuestion(
257 257
             "Which webserver would you like?",
258 258
             ['NGINX', 'Apache'],
259 259
             0
260 260
         );
261 261
 
262
-        $this->_server = strtolower($helper->ask($input, $output, $serverQuestion));
262
+        $this->_server=strtolower($helper->ask($input, $output, $serverQuestion));
263 263
     }
264 264
 
265 265
     /**
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
      */
270 270
     protected function setOperatingSystem($helper, InputInterface $input, OutputInterface $output)
271 271
     {
272
-        $osQuestion = new ChoiceQuestion(
272
+        $osQuestion=new ChoiceQuestion(
273 273
             "Which OS would you like to install?",
274 274
             ['CentOS 6.5', 'Ubuntu 14'],
275 275
             0
276 276
         );
277 277
 
278
-        $this->_os = str_replace(' ', '', str_replace('.', '', strtolower($helper->ask($input, $output, $osQuestion))));
278
+        $this->_os=str_replace(' ', '', str_replace('.', '', strtolower($helper->ask($input, $output, $osQuestion))));
279 279
     }
280 280
 }
Please login to merge, or discard this patch.