Completed
Push — master ( 716db6...a32038 )
by Alireza
02:53
created
src/ConsoleStyle.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     {
118 118
         if (isset($this->verbosityMap[$level])) {
119 119
             $level = $this->verbosityMap[$level];
120
-        } elseif (! is_int($level)) {
120
+        } elseif (!is_int($level)) {
121 121
             $level = $this->verbosity;
122 122
         }
123 123
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
     public function addInput($message)
128 128
     {
129
-        $this->info('>>> ' . $message . ' :');
129
+        $this->info('>>> '.$message.' :');
130 130
 
131 131
         $userHandle = fopen("php://stdin", "r");
132 132
 
Please login to merge, or discard this patch.
src/Console.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
         try {
55 55
 
56 56
             $this->run();
57
-        } catch (\Exception $e){}
57
+        } catch (\Exception $e) {}
58 58
     }
59 59
 }
60 60
 
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(! function_exists("package_path")){
3
+if (!function_exists("package_path")) {
4 4
 
5 5
     /**
6 6
      * Get package path
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
      */
13 13
     function package_path($path = null)
14 14
     {
15
-        if(empty($_SERVER['HOME'])){
16
-            return posix_getpwuid(posix_getuid()) . "/.Josh/" . ( is_null($path) ?: $path );
15
+        if (empty($_SERVER['HOME'])) {
16
+            return posix_getpwuid(posix_getuid())."/.Josh/".(is_null($path) ?: $path);
17 17
         }
18 18
 
19
-        return $_SERVER['HOME'] . "/.Josh/" . ( is_null($path) ?: $path );
19
+        return $_SERVER['HOME']."/.Josh/".(is_null($path) ?: $path);
20 20
     }
21 21
 }
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
src/Commands/HookSetupCommand.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         $this->setName('hook:setup')
30 30
             ->setDescription('Setup hook of your packagist package');
31 31
 
32
-        $this->addOption('clear' , 'c', InputOption::VALUE_NONE, 'Clear default details');
32
+        $this->addOption('clear', 'c', InputOption::VALUE_NONE, 'Clear default details');
33 33
     }
34 34
 
35 35
     /**
@@ -38,28 +38,28 @@  discard block
 block discarded – undo
38 38
      * @param InputInterface $input
39 39
      * @param OutputInterface $output
40 40
      */
41
-    protected function execute(InputInterface $input , OutputInterface $output)
41
+    protected function execute(InputInterface $input, OutputInterface $output)
42 42
     {
43 43
         $authFile = package_path('/auth.json');
44 44
 
45
-        if($input->getOption('clear')){
45
+        if ($input->getOption('clear')) {
46 46
             unlink($authFile);
47 47
         }
48 48
 
49 49
         $command = new Style($input, $output);
50 50
 
51
-        if(! file_exists($authFile)){
51
+        if (!file_exists($authFile)) {
52 52
 
53 53
             $username = $command->addInput('Enter your packagist username');
54 54
 
55
-            if(empty($username)) {
55
+            if (empty($username)) {
56 56
                 $command->error("Packagist username is required !");
57 57
                 exit;
58 58
             }
59 59
 
60 60
             $api = $command->addInput('Enter your packagist API');
61 61
 
62
-            if(empty($api)) {
62
+            if (empty($api)) {
63 63
                 $command->error("Packagist API is required !");
64 64
                 exit;
65 65
             }
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 
74 74
             $answer = $helper->ask($input, $output, $question);
75 75
 
76
-            if($answer){
77
-                mkdir(package_path(),0777);
76
+            if ($answer) {
77
+                mkdir(package_path(), 0777);
78 78
                 touch($authFile);
79
-                chmod($authFile,0777);
80
-                file_put_contents($authFile,json_encode([
79
+                chmod($authFile, 0777);
80
+                file_put_contents($authFile, json_encode([
81 81
                     'api' => $api,
82 82
                     'username' => $username
83 83
                 ]));
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
             $auth = json_decode(file_get_contents($authFile));
89 89
 
90 90
             $command->line("");
91
-            $command->line("Packagist API : ". $auth->api);
91
+            $command->line("Packagist API : ".$auth->api);
92 92
 
93
-            $command->line('Packagist Username : '. $auth->username);
93
+            $command->line('Packagist Username : '.$auth->username);
94 94
             $command->note(
95 95
                 'If you want change your details type `josh hook:setup --clear` '
96 96
             );
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             $username = $auth->username;
100 100
         }
101 101
 
102
-        $this->sendRequest($command,$api,$username);
102
+        $this->sendRequest($command, $api, $username);
103 103
     }
104 104
 
105 105
     /**
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $package = $command->addInput('Enter your package-url');
115 115
 
116
-        if(empty(trim($package))) {
116
+        if (empty(trim($package))) {
117 117
             $command->error("Package-url is required !");
118 118
             exit;
119 119
         }
120 120
 
121 121
         $command->info("Sending request ...");
122 122
 
123
-        $data = [ 'repository' => [ 'url' => $package ] ];
123
+        $data = ['repository' => ['url' => $package]];
124 124
 
125 125
         $client = new Guzzle([
126 126
             'base_uri' => 'https://packagist.org/',
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
             ]
130 130
         ]);
131 131
 
132
-        $result = $client->post('/api/update-package?username=' . $username .
133
-            '&apiToken=' . $api,[ 'json' => $data ]);
132
+        $result = $client->post('/api/update-package?username='.$username.
133
+            '&apiToken='.$api, ['json' => $data]);
134 134
 
135 135
         $result = json_decode($result->getBody()->getContents(), true);
136 136
 
137
-        if($result['status'] !== 'success') {
137
+        if ($result['status'] !== 'success') {
138 138
             $command->error("Message : ".$result['message']." | Failed ");
139 139
             exit;
140 140
         }
Please login to merge, or discard this patch.
src/Commands/ServerAddCommand.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
         $this->addOption('name', 'e', InputOption::VALUE_REQUIRED, 'Server name');
31 31
 
32
-        $this->addOption('ip', 'i',  InputOption::VALUE_REQUIRED, 'Server ip address');
32
+        $this->addOption('ip', 'i', InputOption::VALUE_REQUIRED, 'Server ip address');
33 33
     }
34 34
 
35 35
     /**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * @param InputInterface $input
39 39
      * @param OutputInterface $output
40 40
      */
41
-    protected function execute(InputInterface $input , OutputInterface $output)
41
+    protected function execute(InputInterface $input, OutputInterface $output)
42 42
     {
43 43
         $command = new Style($input, $output);
44 44
 
@@ -47,25 +47,25 @@  discard block
 block discarded – undo
47 47
         $ip = $input->getOption('ip');
48 48
         $name = $input->getOption('name');
49 49
 
50
-        if (empty($name) || empty($ip)){
50
+        if (empty($name) || empty($ip)) {
51 51
 
52 52
             $command->error("Server name and ip address is required. use [server:add --ip=***.***.*** --name=example]");
53 53
         } else {
54 54
 
55 55
             /** @var Server $server */
56
-            foreach ($servers as $server){
57
-                if ( $server->getAttribute("name") == $name ) {
56
+            foreach ($servers as $server) {
57
+                if ($server->getAttribute("name") == $name) {
58 58
                     $command->error("Server {$name} already exists.");
59 59
                     exit;
60 60
                 }
61 61
 
62
-                if ( $server->getAttribute("ip") == $ip ) {
62
+                if ($server->getAttribute("ip") == $ip) {
63 63
                     $command->error("Server IP {$ip} already exists.");
64 64
                     exit;
65 65
                 }
66 66
             }
67 67
 
68
-            $id = ( $servers->count() == 0 ? 1 : array_reverse($servers->toArray())[0]->id + 1 );
68
+            $id = ($servers->count() == 0 ? 1 : array_reverse($servers->toArray())[0]->id + 1);
69 69
 
70 70
             $this->model->create(compact("id", "ip", "name"));
71 71
 
Please login to merge, or discard this patch.
src/Commands/ServerSSHCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @param InputInterface $input
37 37
      * @param OutputInterface $output
38 38
      */
39
-    protected function execute(InputInterface $input , OutputInterface $output)
39
+    protected function execute(InputInterface $input, OutputInterface $output)
40 40
     {
41 41
         $command = new Style($input, $output);
42 42
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
             $server = $this->model->findBy("name", $serverIdOrName);
50 50
 
51
-            $server = ( $server->exists() ? $server : $this->model->findBy("id", $serverIdOrName) );
51
+            $server = ($server->exists() ? $server : $this->model->findBy("id", $serverIdOrName));
52 52
 
53 53
             $ip = $server->getAttribute("ip");
54 54
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function getHomeDir()
70 70
     {
71
-        if(empty($_SERVER['HOME'])){
71
+        if (empty($_SERVER['HOME'])) {
72 72
             return posix_getpwuid(posix_getuid());
73 73
         }
74 74
 
Please login to merge, or discard this patch.
src/Commands/ServerListCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      * @param InputInterface $input
35 35
      * @param OutputInterface $output
36 36
      */
37
-    protected function execute(InputInterface $input , OutputInterface $output)
37
+    protected function execute(InputInterface $input, OutputInterface $output)
38 38
     {
39 39
         $command = new Style($input, $output);
40 40
 
Please login to merge, or discard this patch.