Completed
Push — master ( e48266...c6a956 )
by Steven
8s
created
src/Magestead/Service/UsageApi.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
     /**
10 10
      * @var string
11 11
      */
12
-    protected $_apiUrl = "http://api.magestead.com/v1/usage";
12
+    protected $_apiUrl="http://api.magestead.com/v1/usage";
13 13
 //    protected $_apiUrl = "http://magestead-api.app/v1/usage";
14 14
 
15 15
     /**
16 16
      * @var array
17 17
      */
18
-    protected $_params = [];
18
+    protected $_params=[];
19 19
 
20 20
     /**
21 21
      * UsageApi constructor.
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function __construct($data)
25 25
     {
26
-        $this->_params['os_type']               = urlencode($data['os']);
27
-        $this->_params['server_type']           = urlencode($data['server']);
28
-        $this->_params['php_version']           = urlencode($data['phpver']);
29
-        $this->_params['application_version']   = urlencode($data['app']);
30
-        $this->_params['vm_memory_limit']       = urlencode($data['memory_limit']);
31
-        $this->_params['vm_cpu_count']          = urlencode($data['cpus']);
32
-        $this->_params['ip_address']            = urlencode($data['ip_address']);
33
-        $this->_params['box']                   = urlencode($data['box']);
34
-        $this->_params['locale']                = urlencode($data['locale']);
35
-        $this->_params['default_currency']      = urlencode($data['default_currency']);
26
+        $this->_params['os_type']=urlencode($data['os']);
27
+        $this->_params['server_type']=urlencode($data['server']);
28
+        $this->_params['php_version']=urlencode($data['phpver']);
29
+        $this->_params['application_version']=urlencode($data['app']);
30
+        $this->_params['vm_memory_limit']=urlencode($data['memory_limit']);
31
+        $this->_params['vm_cpu_count']=urlencode($data['cpus']);
32
+        $this->_params['ip_address']=urlencode($data['ip_address']);
33
+        $this->_params['box']=urlencode($data['box']);
34
+        $this->_params['locale']=urlencode($data['locale']);
35
+        $this->_params['default_currency']=urlencode($data['default_currency']);
36 36
     }
37 37
 
38 38
     /**
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function send()
42 42
     {
43
-        $fields_string = $this->getFieldsString();
43
+        $fields_string=$this->getFieldsString();
44 44
 
45
-        $ch = curl_init();
45
+        $ch=curl_init();
46 46
 
47
-        curl_setopt($ch,CURLOPT_URL, $this->_apiUrl);
48
-        curl_setopt($ch,CURLOPT_POST, count($this->_params));
49
-        curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
47
+        curl_setopt($ch, CURLOPT_URL, $this->_apiUrl);
48
+        curl_setopt($ch, CURLOPT_POST, count($this->_params));
49
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
50 50
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
51 51
 
52
-        $result = curl_exec($ch);
52
+        $result=curl_exec($ch);
53 53
 
54 54
         curl_close($ch);
55 55
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
      */
61 61
     protected function getFieldsString()
62 62
     {
63
-        $fields_string = '';
63
+        $fields_string='';
64 64
         foreach ($this->_params as $key => $value) {
65
-            $fields_string .= $key . '=' . $value . '&';
65
+            $fields_string.=$key.'='.$value.'&';
66 66
         }
67 67
         rtrim($fields_string, '&');
68 68
         return $fields_string;
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
      * UsageApi constructor.
22 22
      * @param $data
23 23
      */
24
-    public function __construct($data)
25
-    {
24
+    public function __construct($data) {
26 25
         $this->_params['os_type']               = urlencode($data['os']);
27 26
         $this->_params['server_type']           = urlencode($data['server']);
28 27
         $this->_params['php_version']           = urlencode($data['phpver']);
@@ -38,8 +37,7 @@  discard block
 block discarded – undo
38 37
     /**
39 38
      *
40 39
      */
41
-    public function send()
42
-    {
40
+    public function send() {
43 41
         $fields_string = $this->getFieldsString();
44 42
 
45 43
         $ch = curl_init();
@@ -58,8 +56,7 @@  discard block
 block discarded – undo
58 56
     /**
59 57
      * @return string
60 58
      */
61
-    protected function getFieldsString()
62
-    {
59
+    protected function getFieldsString() {
63 60
         $fields_string = '';
64 61
         foreach ($this->_params as $key => $value) {
65 62
             $fields_string .= $key . '=' . $value . '&';
Please login to merge, or discard this patch.
src/Magestead/Helper/Options.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class Options
14 14
 {
15
-    const BOX_PREFIX = 'richdynamix/magestead-';
15
+    const BOX_PREFIX='richdynamix/magestead-';
16 16
 
17
-    protected $_app = 'magento2';
18
-    protected $_phpVer = '56';
19
-    protected $_os = 'centos65';
17
+    protected $_app='magento2';
18
+    protected $_phpVer='56';
19
+    protected $_os='centos65';
20 20
     protected $_server;
21 21
     protected $_box;
22 22
     protected $_m2Username;
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     protected $_locale;
28 28
     protected $_currency;
29 29
     protected $_baseUrl;
30
-    protected $_repoUrl = '';
30
+    protected $_repoUrl='';
31 31
 
32 32
     /**
33 33
      * Options constructor.
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
     {
82 82
         $output->writeln('<comment>Lets configure your project\'s VM</comment>');
83 83
 
84
-        $ipQuestion       = new Question("Configure the IP for your VM (192.168.47.47): ", '192.168.47.47');
85
-        $this->_ipAddress = strtolower($helper->ask($input, $output, $ipQuestion));
84
+        $ipQuestion=new Question("Configure the IP for your VM (192.168.47.47): ", '192.168.47.47');
85
+        $this->_ipAddress=strtolower($helper->ask($input, $output, $ipQuestion));
86 86
 
87
-        $cpuQuestion = new Question("How many CPU's would you like to use? (1): ", '1');
88
-        $this->_cpus = strtolower($helper->ask($input, $output, $cpuQuestion));
87
+        $cpuQuestion=new Question("How many CPU's would you like to use? (1): ", '1');
88
+        $this->_cpus=strtolower($helper->ask($input, $output, $cpuQuestion));
89 89
 
90
-        $memoryQuestion     = new Question("Define the VM memory limit (2048): ", '2048');
91
-        $this->_memorylimit = strtolower($helper->ask($input, $output, $memoryQuestion));
90
+        $memoryQuestion=new Question("Define the VM memory limit (2048): ", '2048');
91
+        $this->_memorylimit=strtolower($helper->ask($input, $output, $memoryQuestion));
92 92
     }
93 93
 
94 94
     /**
@@ -100,22 +100,22 @@  discard block
 block discarded – undo
100 100
     protected function setApplicationSettings($helper, InputInterface $input, OutputInterface $output, $project)
101 101
     {
102 102
         $output->writeln('<comment>Lets configure your project\'s application</comment>');
103
-        $appQuestion = new ChoiceQuestion(
103
+        $appQuestion=new ChoiceQuestion(
104 104
             "Which application do you want to install?",
105 105
             ['Magento', 'Magento2'],
106 106
             0
107 107
         );
108 108
 
109
-        $this->_app = strtolower($helper->ask($input, $output, $appQuestion));
109
+        $this->_app=strtolower($helper->ask($input, $output, $appQuestion));
110 110
 
111
-        $baseUrlQuestion = new Question("Enter your application's base_url ($project.dev): ", $project.'.dev');
112
-        $this->_baseUrl  = strtolower($helper->ask($input, $output, $baseUrlQuestion));
111
+        $baseUrlQuestion=new Question("Enter your application's base_url ($project.dev): ", $project.'.dev');
112
+        $this->_baseUrl=strtolower($helper->ask($input, $output, $baseUrlQuestion));
113 113
 
114
-        $currenyQuestion = new Question("Enter your application's default currency (GBP): ", 'GBP');
115
-        $this->_currency = $helper->ask($input, $output, $currenyQuestion);
114
+        $currenyQuestion=new Question("Enter your application's default currency (GBP): ", 'GBP');
115
+        $this->_currency=$helper->ask($input, $output, $currenyQuestion);
116 116
 
117
-        $localeQuestion = new Question("Enter your application's default locale (en_GB): ", 'en_GB');
118
-        $this->_locale  = $helper->ask($input, $output, $localeQuestion);
117
+        $localeQuestion=new Question("Enter your application's default locale (en_GB): ", 'en_GB');
118
+        $this->_locale=$helper->ask($input, $output, $localeQuestion);
119 119
     }
120 120
 
121 121
     /**
@@ -140,11 +140,11 @@  discard block
 block discarded – undo
140 140
      */
141 141
     protected function setVersionControlSettings($helper, InputInterface $input, OutputInterface $output)
142 142
     {
143
-        $versionControl = new ConfirmationQuestion("Would you like to add your project to GIT? (no/yes) ", false);
144
-        $versioning     = $helper->ask($input, $output, $versionControl);
143
+        $versionControl=new ConfirmationQuestion("Would you like to add your project to GIT? (no/yes) ", false);
144
+        $versioning=$helper->ask($input, $output, $versionControl);
145 145
         if ($versioning) {
146
-            $repoQuestion   = new Question("Enter your full GitHub/BitBucket repo URL: ", '');
147
-            $this->_repoUrl = strtolower($helper->ask($input, $output, $repoQuestion));
146
+            $repoQuestion=new Question("Enter your full GitHub/BitBucket repo URL: ", '');
147
+            $this->_repoUrl=strtolower($helper->ask($input, $output, $repoQuestion));
148 148
         }
149 149
     }
150 150
 
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
      */
156 156
     protected function askForAuth($helper, InputInterface $input, OutputInterface $output)
157 157
     {
158
-        $username          = new Question("Please enter your Magento username (public key): ", '');
159
-        $this->_m2Username = $helper->ask($input, $output, $username);
158
+        $username=new Question("Please enter your Magento username (public key): ", '');
159
+        $this->_m2Username=$helper->ask($input, $output, $username);
160 160
 
161
-        $password          = new Question("Please enter your Magento password (private key): ", '');
162
-        $this->_m2Password = $helper->ask($input, $output, $password);
161
+        $password=new Question("Please enter your Magento password (private key): ", '');
162
+        $this->_m2Password=$helper->ask($input, $output, $password);
163 163
     }
164 164
 
165 165
     /**
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
      */
171 171
     protected function verifyAuth($helper, InputInterface $input, OutputInterface $output)
172 172
     {
173
-        $authFile = $_SERVER['HOME'] . "/.composer/auth.json";
173
+        $authFile=$_SERVER['HOME']."/.composer/auth.json";
174 174
 
175
-        $authObj = [];
175
+        $authObj=[];
176 176
         if (file_exists($authFile)) {
177
-            $authJson = file_get_contents($authFile);
178
-            $authObj  = (array)json_decode($authJson);
177
+            $authJson=file_get_contents($authFile);
178
+            $authObj=(array) json_decode($authJson);
179 179
 
180 180
             if (isset($authObj['http-basic']) && isset($authObj['http-basic']->{'repo.magento.com'})) {
181 181
                 return true;
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
 
185 185
         $this->askForAuth($helper, $input, $output);
186 186
 
187
-        $authObj['http-basic']['repo.magento.com']['username'] = $this->_m2Username;
188
-        $authObj['http-basic']['repo.magento.com']['password'] = $this->_m2Password;
187
+        $authObj['http-basic']['repo.magento.com']['username']=$this->_m2Username;
188
+        $authObj['http-basic']['repo.magento.com']['password']=$this->_m2Password;
189 189
 
190
-        $authJson = json_encode($authObj);
190
+        $authJson=json_encode($authObj);
191 191
         return file_put_contents($authFile, $authJson);
192 192
     }
193 193
 
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
     protected function setPhp($helper, InputInterface $input, OutputInterface $output)
200 200
     {
201 201
         $output->writeln('<info>Keep in mind PHP7 is only available for Magento 2</info>');
202
-        $phpVerQuestion = new ChoiceQuestion(
202
+        $phpVerQuestion=new ChoiceQuestion(
203 203
             "Which version of PHP should be installed?",
204 204
             ['56', '70'],
205 205
             0
206 206
         );
207 207
 
208
-        $this->_phpVer = $helper->ask($input, $output, $phpVerQuestion);
208
+        $this->_phpVer=$helper->ask($input, $output, $phpVerQuestion);
209 209
     }
210 210
 
211 211
     /**
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      */
214 214
     protected function setVagrantBox()
215 215
     {
216
-        $this->_box = self::BOX_PREFIX . $this->_os . "-$this->_server-php$this->_phpVer";
216
+        $this->_box=self::BOX_PREFIX.$this->_os."-$this->_server-php$this->_phpVer";
217 217
     }
218 218
 
219 219
     /**
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
      */
237 237
     protected function setWebServer($helper, InputInterface $input, OutputInterface $output)
238 238
     {
239
-        $serverQuestion = new ChoiceQuestion(
239
+        $serverQuestion=new ChoiceQuestion(
240 240
             "Which webserver would you like?",
241 241
             ['NGINX', 'Apache'],
242 242
             0
243 243
         );
244 244
 
245
-        $this->_server = strtolower($helper->ask($input, $output, $serverQuestion));
245
+        $this->_server=strtolower($helper->ask($input, $output, $serverQuestion));
246 246
     }
247 247
 
248 248
     /**
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
      */
253 253
     protected function setOperatingSystem($helper, InputInterface $input, OutputInterface $output)
254 254
     {
255
-        $osQuestion = new ChoiceQuestion(
255
+        $osQuestion=new ChoiceQuestion(
256 256
             "Which OS would you like to install?",
257 257
             ['CentOS 6.5', 'Ubuntu 14'],
258 258
             0
259 259
         );
260 260
 
261
-        $this->_os = str_replace(' ', '', str_replace('.', '', strtolower($helper->ask($input, $output, $osQuestion))));
261
+        $this->_os=str_replace(' ', '', str_replace('.', '', strtolower($helper->ask($input, $output, $osQuestion))));
262 262
     }
263 263
 }
264 264
\ No newline at end of file
Please login to merge, or discard this patch.
src/Magestead/Command/Log/StreamCommand.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     protected function configure()
23 23
     {
24
-        $this->_projectPath = getcwd();
24
+        $this->_projectPath=getcwd();
25 25
         $this->setName("log:stream");
26 26
         $this->setDescription("Stream a specific server log");
27 27
         $this->addArgument('log', InputArgument::REQUIRED, 'access or error');
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
      */
35 35
     protected function execute(InputInterface $input, OutputInterface $output)
36 36
     {
37
-        $log = $input->getArgument('log');
37
+        $log=$input->getArgument('log');
38 38
 
39
-        $output->writeln('<info>Streaming '. ucwords($log) . ' Log</info>');
40
-        $command = $this->getCommand(new Config($output), $log);
39
+        $output->writeln('<info>Streaming '.ucwords($log).' Log</info>');
40
+        $command=$this->getCommand(new Config($output), $log);
41 41
         if (!$command) {
42 42
             return $output->writeln('<error>Command not available for this application</error>');
43 43
         }
44 44
 
45
-        $pCommand = "vagrant ssh -c '". $command ."'";
45
+        $pCommand="vagrant ssh -c '".$command."'";
46 46
         return new ProcessCommand($pCommand, $this->_projectPath, $output);
47 47
     }
48 48
 
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
      */
54 54
     private function getCommand(Config $config, $log)
55 55
     {
56
-        $server = $config->_config['magestead']['server'];
57
-        $os = $config->_config['magestead']['os'];
56
+        $server=$config->_config['magestead']['server'];
57
+        $os=$config->_config['magestead']['os'];
58 58
 
59
-        $location = $this->getLogLocation($server, $os);
60
-        $command = 'tail -f /var/log/' . $location . '/' . $config->base_url . '-' . $log . '.log';
59
+        $location=$this->getLogLocation($server, $os);
60
+        $command='tail -f /var/log/'.$location.'/'.$config->base_url.'-'.$log.'.log';
61 61
 
62 62
         return $command;
63 63
     }
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
      */
70 70
     private function getLogLocation($server, $os)
71 71
     {
72
-        $location = 'nginx';
72
+        $location='nginx';
73 73
         if ($server != 'nginx') {
74
-            $location = ($os == 'ubuntu14') ? 'apache2' : 'httpd';
74
+            $location=($os == 'ubuntu14') ? 'apache2' : 'httpd';
75 75
         }
76 76
 
77 77
         return $location;
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * Configure the view command
21 21
      */
22
-    protected function configure()
23
-    {
22
+    protected function configure() {
24 23
         $this->_projectPath = getcwd();
25 24
         $this->setName("log:view");
26 25
         $this->setDescription("View a specific server log");
@@ -32,8 +31,7 @@  discard block
 block discarded – undo
32 31
      * @param OutputInterface $output
33 32
      * @return ProcessCommand
34 33
      */
35
-    protected function execute(InputInterface $input, OutputInterface $output)
36
-    {
34
+    protected function execute(InputInterface $input, OutputInterface $output) {
37 35
         $log = $input->getArgument('log');
38 36
 
39 37
         $output->writeln('<info>Viewing '. ucwords($log) . ' Log</info>');
@@ -51,8 +49,7 @@  discard block
 block discarded – undo
51 49
      * @param $log
52 50
      * @return string
53 51
      */
54
-    private function getCommand(Config $config, $log)
55
-    {
52
+    private function getCommand(Config $config, $log) {
56 53
         $server = $config->_config['magestead']['server'];
57 54
         $os = $config->_config['magestead']['os'];
58 55
 
@@ -67,8 +64,7 @@  discard block
 block discarded – undo
67 64
      * @param $os
68 65
      * @return string
69 66
      */
70
-    private function getLogLocation($server, $os)
71
-    {
67
+    private function getLogLocation($server, $os) {
72 68
         $location = 'nginx';
73 69
         if ($server != 'nginx') {
74 70
             $location = ($os == 'ubuntu14') ? 'apache2' : 'httpd';
Please login to merge, or discard this patch.
src/Magestead/Command/Log/ViewCommand.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     protected function configure()
23 23
     {
24
-        $this->_projectPath = getcwd();
24
+        $this->_projectPath=getcwd();
25 25
         $this->setName("log:view");
26 26
         $this->setDescription("View a specific server log");
27 27
         $this->addArgument('log', InputArgument::REQUIRED, 'access or error');
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
      */
35 35
     protected function execute(InputInterface $input, OutputInterface $output)
36 36
     {
37
-        $log = $input->getArgument('log');
37
+        $log=$input->getArgument('log');
38 38
 
39
-        $output->writeln('<info>Viewing '. ucwords($log) . ' Log</info>');
40
-        $command = $this->getCommand(new Config($output), $log);
39
+        $output->writeln('<info>Viewing '.ucwords($log).' Log</info>');
40
+        $command=$this->getCommand(new Config($output), $log);
41 41
         if (!$command) {
42 42
             return $output->writeln('<error>Command not available for this application</error>');
43 43
         }
44 44
 
45
-        $pCommand = "vagrant ssh -c '". $command ."'";
45
+        $pCommand="vagrant ssh -c '".$command."'";
46 46
         return new ProcessCommand($pCommand, $this->_projectPath, $output);
47 47
     }
48 48
 
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
      */
54 54
     private function getCommand(Config $config, $log)
55 55
     {
56
-        $server = $config->_config['magestead']['server'];
57
-        $os = $config->_config['magestead']['os'];
56
+        $server=$config->_config['magestead']['server'];
57
+        $os=$config->_config['magestead']['os'];
58 58
 
59
-        $location = $this->getLogLocation($server, $os);
60
-        $command = 'cat /var/log/' . $location . '/' . $config->base_url . '-' . $log . '.log';
59
+        $location=$this->getLogLocation($server, $os);
60
+        $command='cat /var/log/'.$location.'/'.$config->base_url.'-'.$log.'.log';
61 61
 
62 62
         return $command;
63 63
     }
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
      */
70 70
     private function getLogLocation($server, $os)
71 71
     {
72
-        $location = 'nginx';
72
+        $location='nginx';
73 73
         if ($server != 'nginx') {
74
-            $location = ($os == 'ubuntu14') ? 'apache2' : 'httpd';
74
+            $location=($os == 'ubuntu14') ? 'apache2' : 'httpd';
75 75
         }
76 76
 
77 77
         return $location;
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * Configure the view command
21 21
      */
22
-    protected function configure()
23
-    {
22
+    protected function configure() {
24 23
         $this->_projectPath = getcwd();
25 24
         $this->setName("log:view");
26 25
         $this->setDescription("View a specific server log");
@@ -32,8 +31,7 @@  discard block
 block discarded – undo
32 31
      * @param OutputInterface $output
33 32
      * @return ProcessCommand
34 33
      */
35
-    protected function execute(InputInterface $input, OutputInterface $output)
36
-    {
34
+    protected function execute(InputInterface $input, OutputInterface $output) {
37 35
         $log = $input->getArgument('log');
38 36
 
39 37
         $output->writeln('<info>Viewing '. ucwords($log) . ' Log</info>');
@@ -51,8 +49,7 @@  discard block
 block discarded – undo
51 49
      * @param $log
52 50
      * @return string
53 51
      */
54
-    private function getCommand(Config $config, $log)
55
-    {
52
+    private function getCommand(Config $config, $log) {
56 53
         $server = $config->_config['magestead']['server'];
57 54
         $os = $config->_config['magestead']['os'];
58 55
 
@@ -67,8 +64,7 @@  discard block
 block discarded – undo
67 64
      * @param $os
68 65
      * @return string
69 66
      */
70
-    private function getLogLocation($server, $os)
71
-    {
67
+    private function getLogLocation($server, $os) {
72 68
         $location = 'nginx';
73 69
         if ($server != 'nginx') {
74 70
             $location = ($os == 'ubuntu14') ? 'apache2' : 'httpd';
Please login to merge, or discard this patch.