Completed
Pull Request — develop (#47)
by Steven
05:50 queued 02:48
created
src/Magestead/Service/UsageApi.php 2 patches
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.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
     /**
11 11
      * @var string
12 12
      */
13
-    protected $_apiUrl = 'http://api.magestead.com/v1/usage';
13
+    protected $_apiUrl='http://api.magestead.com/v1/usage';
14 14
 //    protected $_apiUrl = "http://magestead-api.app/v1/usage";
15 15
 
16 16
     /**
17 17
      * @var array
18 18
      */
19
-    protected $_params = [];
19
+    protected $_params=[];
20 20
 
21 21
     /**
22 22
      * UsageApi constructor.
@@ -25,30 +25,30 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function __construct($data)
27 27
     {
28
-        $this->_params['os_type'] = urlencode($data['os']);
29
-        $this->_params['server_type'] = urlencode($data['server']);
30
-        $this->_params['php_version'] = urlencode($data['phpver']);
31
-        $this->_params['application_version'] = urlencode($data['app']);
32
-        $this->_params['vm_memory_limit'] = urlencode($data['memory_limit']);
33
-        $this->_params['vm_cpu_count'] = urlencode($data['cpus']);
34
-        $this->_params['ip_address'] = urlencode($data['ip_address']);
35
-        $this->_params['box'] = urlencode($data['box']);
36
-        $this->_params['locale'] = urlencode($data['locale']);
37
-        $this->_params['default_currency'] = urlencode($data['default_currency']);
28
+        $this->_params['os_type']=urlencode($data['os']);
29
+        $this->_params['server_type']=urlencode($data['server']);
30
+        $this->_params['php_version']=urlencode($data['phpver']);
31
+        $this->_params['application_version']=urlencode($data['app']);
32
+        $this->_params['vm_memory_limit']=urlencode($data['memory_limit']);
33
+        $this->_params['vm_cpu_count']=urlencode($data['cpus']);
34
+        $this->_params['ip_address']=urlencode($data['ip_address']);
35
+        $this->_params['box']=urlencode($data['box']);
36
+        $this->_params['locale']=urlencode($data['locale']);
37
+        $this->_params['default_currency']=urlencode($data['default_currency']);
38 38
     }
39 39
 
40 40
     public function send()
41 41
     {
42
-        $fields_string = $this->getFieldsString();
42
+        $fields_string=$this->getFieldsString();
43 43
 
44
-        $ch = curl_init();
44
+        $ch=curl_init();
45 45
 
46 46
         curl_setopt($ch, CURLOPT_URL, $this->_apiUrl);
47 47
         curl_setopt($ch, CURLOPT_POST, count($this->_params));
48 48
         curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
49 49
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
50 50
 
51
-        $result = curl_exec($ch);
51
+        $result=curl_exec($ch);
52 52
 
53 53
         curl_close($ch);
54 54
     }
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
      */
59 59
     protected function getFieldsString()
60 60
     {
61
-        $fields_string = '';
61
+        $fields_string='';
62 62
         foreach ($this->_params as $key => $value) {
63
-            $fields_string .= $key.'='.$value.'&';
63
+            $fields_string.=$key.'='.$value.'&';
64 64
         }
65 65
         rtrim($fields_string, '&');
66 66
 
Please login to merge, or discard this patch.
src/Magestead/Command/Log/ViewCommand.php 2 patches
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.
Spacing   +10 added lines, -10 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->_projectPath = getcwd();
25
+        $this->_projectPath=getcwd();
26 26
         $this->setName('log:view');
27 27
         $this->setDescription('View a specific server log');
28 28
         $this->addArgument('log', InputArgument::REQUIRED, 'access or error');
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
      */
37 37
     protected function execute(InputInterface $input, OutputInterface $output)
38 38
     {
39
-        $log = $input->getArgument('log');
39
+        $log=$input->getArgument('log');
40 40
 
41 41
         $output->writeln('<info>Viewing '.ucwords($log).' Log</info>');
42
-        $command = $this->getCommand(new Config($output), $log);
42
+        $command=$this->getCommand(new Config($output), $log);
43 43
         if (!$command) {
44 44
             return $output->writeln('<error>Command not available for this application</error>');
45 45
         }
46 46
 
47
-        $pCommand = "vagrant ssh -c '".$command."'";
47
+        $pCommand="vagrant ssh -c '".$command."'";
48 48
 
49 49
         return new ProcessCommand($pCommand, $this->_projectPath, $output);
50 50
     }
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
      */
58 58
     private function getCommand(Config $config, $log)
59 59
     {
60
-        $server = $config->_config['magestead']['server'];
61
-        $os = $config->_config['magestead']['os'];
60
+        $server=$config->_config['magestead']['server'];
61
+        $os=$config->_config['magestead']['os'];
62 62
 
63
-        $location = $this->getLogLocation($server, $os);
64
-        $command = 'cat /var/log/'.$location.'/'.$config->base_url.'-'.$log.'.log';
63
+        $location=$this->getLogLocation($server, $os);
64
+        $command='cat /var/log/'.$location.'/'.$config->base_url.'-'.$log.'.log';
65 65
 
66 66
         return $command;
67 67
     }
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
      */
75 75
     private function getLogLocation($server, $os)
76 76
     {
77
-        $location = 'nginx';
77
+        $location='nginx';
78 78
         if ($server != 'nginx') {
79
-            $location = ($os == 'ubuntu14') ? 'apache2' : 'httpd';
79
+            $location=($os == 'ubuntu14') ? 'apache2' : 'httpd';
80 80
         }
81 81
 
82 82
         return $location;
Please login to merge, or discard this patch.
src/Magestead/Command/Log/StreamCommand.php 2 patches
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.
Spacing   +10 added lines, -10 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->_projectPath = getcwd();
25
+        $this->_projectPath=getcwd();
26 26
         $this->setName('log:stream');
27 27
         $this->setDescription('Stream a specific server log');
28 28
         $this->addArgument('log', InputArgument::REQUIRED, 'access or error');
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
      */
37 37
     protected function execute(InputInterface $input, OutputInterface $output)
38 38
     {
39
-        $log = $input->getArgument('log');
39
+        $log=$input->getArgument('log');
40 40
 
41 41
         $output->writeln('<info>Streaming '.ucwords($log).' Log</info>');
42
-        $command = $this->getCommand(new Config($output), $log);
42
+        $command=$this->getCommand(new Config($output), $log);
43 43
         if (!$command) {
44 44
             return $output->writeln('<error>Command not available for this application</error>');
45 45
         }
46 46
 
47
-        $pCommand = "vagrant ssh -c '".$command."'";
47
+        $pCommand="vagrant ssh -c '".$command."'";
48 48
 
49 49
         return new ProcessCommand($pCommand, $this->_projectPath, $output);
50 50
     }
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
      */
58 58
     private function getCommand(Config $config, $log)
59 59
     {
60
-        $server = $config->_config['magestead']['server'];
61
-        $os = $config->_config['magestead']['os'];
60
+        $server=$config->_config['magestead']['server'];
61
+        $os=$config->_config['magestead']['os'];
62 62
 
63
-        $location = $this->getLogLocation($server, $os);
64
-        $command = 'tail -f /var/log/'.$location.'/'.$config->base_url.'-'.$log.'.log';
63
+        $location=$this->getLogLocation($server, $os);
64
+        $command='tail -f /var/log/'.$location.'/'.$config->base_url.'-'.$log.'.log';
65 65
 
66 66
         return $command;
67 67
     }
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
      */
75 75
     private function getLogLocation($server, $os)
76 76
     {
77
-        $location = 'nginx';
77
+        $location='nginx';
78 78
         if ($server != 'nginx') {
79
-            $location = ($os == 'ubuntu14') ? 'apache2' : 'httpd';
79
+            $location=($os == 'ubuntu14') ? 'apache2' : 'httpd';
80 80
         }
81 81
 
82 82
         return $location;
Please login to merge, or discard this patch.
src/Magestead/Service/VersionControl.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function __construct($repoUrl, $projectPath, OutputInterface $output)
22 22
     {
23
-        $this->_repoUrl = $repoUrl;
24
-        $this->_projectPath = $projectPath;
25
-        $this->_output = $output;
23
+        $this->_repoUrl=$repoUrl;
24
+        $this->_projectPath=$projectPath;
25
+        $this->_output=$output;
26 26
 
27 27
         $this->execute($output);
28 28
     }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function init()
54 54
     {
55
-        $command = 'git init; git remote add origin '.$this->_repoUrl;
55
+        $command='git init; git remote add origin '.$this->_repoUrl;
56 56
         new ProcessCommand($command, $this->_projectPath, $this->_output);
57 57
 
58 58
         return $this;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function addFiles()
67 67
     {
68
-        $command = 'git add -A';
68
+        $command='git add -A';
69 69
         new ProcessCommand($command, $this->_projectPath, $this->_output);
70 70
 
71 71
         return $this;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function commitFiles()
80 80
     {
81
-        $command = "git commit -m 'Initial commit'";
81
+        $command="git commit -m 'Initial commit'";
82 82
         new ProcessCommand($command, $this->_projectPath, $this->_output);
83 83
 
84 84
         return $this;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function pushFiles()
93 93
     {
94
-        $command = 'git push -u origin master';
94
+        $command='git push -u origin master';
95 95
         new ProcessCommand($command, $this->_projectPath, $this->_output);
96 96
 
97 97
         return $this;
Please login to merge, or discard this patch.
src/Magestead/Service/Notification.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
17 17
      */
18 18
     public static function send($message)
19 19
     {
20
-        $notifier = NotifierFactory::create();
21
-        $basePath = dirname(__FILE__).'/../../../';
22
-        $notification =
20
+        $notifier=NotifierFactory::create();
21
+        $basePath=dirname(__FILE__).'/../../../';
22
+        $notification=
23 23
             (new Notify())
24 24
                 ->setTitle('Magestead')
25 25
                 ->setBody($message)
Please login to merge, or discard this patch.
src/Magestead/Command/Redis/FlushallCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     protected function configure()
19 19
     {
20
-        $this->_projectPath = getcwd();
20
+        $this->_projectPath=getcwd();
21 21
         $this->setName('redis:flush-all');
22 22
         $this->setDescription('Flush redis storage');
23 23
     }
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
     {
33 33
         $output->writeln('<info>Flushing Redis Storage</info>');
34 34
 
35
-        $command = 'redis-cli flushall';
36
-        $pCommand = "vagrant ssh -c '".$command."'";
35
+        $command='redis-cli flushall';
36
+        $pCommand="vagrant ssh -c '".$command."'";
37 37
 
38 38
         return new ProcessCommand($pCommand, $this->_projectPath, $output);
39 39
     }
Please login to merge, or discard this patch.
src/Magestead/Command/VM/RunCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     protected function configure()
19 19
     {
20
-        $this->_projectPath = getcwd();
20
+        $this->_projectPath=getcwd();
21 21
 
22 22
         $this->setName('vm:run');
23 23
         $this->setDescription('Run commands on your development machine via SSH');
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
      */
33 33
     protected function execute(InputInterface $input, OutputInterface $output)
34 34
     {
35
-        $command = $input->getArgument('ssh-command');
35
+        $command=$input->getArgument('ssh-command');
36 36
         $output->writeln('<info>Running "'.$command.'" on Magestead</info>');
37 37
 
38
-        $passedCommand = "vagrant ssh -c '".$command."'";
38
+        $passedCommand="vagrant ssh -c '".$command."'";
39 39
 
40 40
         return new ProcessCommand($passedCommand, $this->_projectPath, $output);
41 41
     }
Please login to merge, or discard this patch.
src/Magestead/Command/Index/SetModeCommand.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
     protected function configure()
21 21
     {
22
-        $this->_projectPath = getcwd();
22
+        $this->_projectPath=getcwd();
23 23
         $this->setName('index:mode:set');
24 24
         $this->setDescription('Set index mode type');
25 25
         $this->addArgument('mode', InputArgument::REQUIRED, '{realtime|schedule} [indexer]');
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
      */
34 34
     protected function execute(InputInterface $input, OutputInterface $output)
35 35
     {
36
-        $indexMode = $input->getArgument('mode');
37
-        $command = $this->getCommand(new Config($output), $indexMode);
36
+        $indexMode=$input->getArgument('mode');
37
+        $command=$this->getCommand(new Config($output), $indexMode);
38 38
         if ($command) {
39 39
             $output->writeln('<info>Setting index mode</info>');
40
-            $pCommand = "vagrant ssh -c '".$command."'";
40
+            $pCommand="vagrant ssh -c '".$command."'";
41 41
 
42 42
             return new ProcessCommand($pCommand, $this->_projectPath, $output);
43 43
         }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     protected function getCommand(Config $config, $mode)
55 55
     {
56
-        $type = $config->type;
56
+        $type=$config->type;
57 57
         switch ($type) {
58 58
             case 'magento2':
59 59
                 return "cd /var/www/public;bin/magento indexer:set-mode $mode";
Please login to merge, or discard this patch.
src/Magestead/Command/Index/ReindexCommand.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
     protected function configure()
21 21
     {
22
-        $this->_projectPath = getcwd();
22
+        $this->_projectPath=getcwd();
23 23
         $this->setName('index:reindex');
24 24
         $this->setDescription('Reindex data');
25 25
         $this->addArgument('index', InputArgument::OPTIONAL, '[indexer]');
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
     protected function execute(InputInterface $input, OutputInterface $output)
35 35
     {
36 36
         $output->writeln('<info>Reindexing data</info>');
37
-        $index = $input->getArgument('index');
37
+        $index=$input->getArgument('index');
38 38
 
39
-        $command = $this->getCommand(new Config($output), $index);
40
-        $pCommand = "vagrant ssh -c '".$command."'";
39
+        $command=$this->getCommand(new Config($output), $index);
40
+        $pCommand="vagrant ssh -c '".$command."'";
41 41
 
42 42
         return new ProcessCommand($pCommand, $this->_projectPath, $output);
43 43
     }
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
      */
51 51
     protected function getCommand(Config $config, $index)
52 52
     {
53
-        $type = $config->type;
53
+        $type=$config->type;
54 54
         switch ($type) {
55 55
             case 'magento':
56
-                $index = (!is_null($index)) ? ' '.$index : ':all';
56
+                $index=(!is_null($index)) ? ' '.$index : ':all';
57 57
 
58 58
                 return "cd /var/www/public;../bin/n98-magerun.phar index:reindex$index";
59 59
                 break;
Please login to merge, or discard this patch.