@@ -61,7 +61,6 @@ discard block |
||
61 | 61 | * Write a string as warning output. |
62 | 62 | * |
63 | 63 | * @param string $string |
64 | - * @param null|int|string $verbosity |
|
65 | 64 | * @return void |
66 | 65 | */ |
67 | 66 | public function note($string) |
@@ -124,6 +123,9 @@ discard block |
||
124 | 123 | return $level; |
125 | 124 | } |
126 | 125 | |
126 | + /** |
|
127 | + * @param string $message |
|
128 | + */ |
|
127 | 129 | public function addInput($message) |
128 | 130 | { |
129 | 131 | $this->info('>>> ' . $message . ' :'); |
@@ -117,7 +117,7 @@ discard block |
||
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 |
||
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 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | ->setDescription('Start the lamp services - [ Just for Linux ]'); |
24 | 24 | } |
25 | 25 | |
26 | - protected function execute(InputInterface $input , OutputInterface $output) |
|
26 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
27 | 27 | { |
28 | 28 | $command = new Style($input, $output); |
29 | 29 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | ->setDescription('Show the locally ip address'); |
25 | 25 | } |
26 | 26 | |
27 | - protected function execute(InputInterface $input , OutputInterface $output) |
|
27 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
28 | 28 | { |
29 | 29 | $command = new Style($input, $output); |
30 | 30 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | ->setDescription('Show the public ip address'); |
25 | 25 | } |
26 | 26 | |
27 | - protected function execute(InputInterface $input , OutputInterface $output) |
|
27 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
28 | 28 | { |
29 | 29 | $command = new Style($input, $output); |
30 | 30 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $this->addArgument('directory', InputArgument::REQUIRED, 'Get the directory'); |
28 | 28 | } |
29 | 29 | |
30 | - protected function execute(InputInterface $input , OutputInterface $output) |
|
30 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
31 | 31 | { |
32 | 32 | $command = new Style($input, $output); |
33 | 33 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $this->setName('hook:setup') |
32 | 32 | ->setDescription('Setup hook of your packagist package'); |
33 | 33 | |
34 | - $this->addOption('clear' , 'c', InputOption::VALUE_NONE, 'Clear default details'); |
|
34 | + $this->addOption('clear', 'c', InputOption::VALUE_NONE, 'Clear default details'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -40,28 +40,28 @@ discard block |
||
40 | 40 | * @param InputInterface $input |
41 | 41 | * @param OutputInterface $output |
42 | 42 | */ |
43 | - protected function execute(InputInterface $input , OutputInterface $output) |
|
43 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
44 | 44 | { |
45 | - $authFile = $this->getHomeDir() . '/.Josh/auth.json'; |
|
45 | + $authFile = $this->getHomeDir().'/.Josh/auth.json'; |
|
46 | 46 | |
47 | - if($input->getOption('clear')){ |
|
47 | + if ($input->getOption('clear')) { |
|
48 | 48 | unlink($authFile); |
49 | 49 | } |
50 | 50 | |
51 | 51 | $command = new Style($input, $output); |
52 | 52 | |
53 | - if(! file_exists($authFile)){ |
|
53 | + if (!file_exists($authFile)) { |
|
54 | 54 | |
55 | 55 | $username = $command->addInput('Enter your packagist username'); |
56 | 56 | |
57 | - if(empty($username)) { |
|
57 | + if (empty($username)) { |
|
58 | 58 | $command->error("Packagist username is required !"); |
59 | 59 | exit; |
60 | 60 | } |
61 | 61 | |
62 | 62 | $api = $command->addInput('Enter your packagist API'); |
63 | 63 | |
64 | - if(empty($api)) { |
|
64 | + if (empty($api)) { |
|
65 | 65 | $command->error("Packagist API is required !"); |
66 | 66 | exit; |
67 | 67 | } |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | |
76 | 76 | $answer = $helper->ask($input, $output, $question); |
77 | 77 | |
78 | - if($answer){ |
|
79 | - mkdir($this->getHomeDir() . "/.Josh",0777); |
|
78 | + if ($answer) { |
|
79 | + mkdir($this->getHomeDir()."/.Josh", 0777); |
|
80 | 80 | touch($authFile); |
81 | - chmod($authFile,0777); |
|
82 | - file_put_contents($authFile,json_encode([ |
|
81 | + chmod($authFile, 0777); |
|
82 | + file_put_contents($authFile, json_encode([ |
|
83 | 83 | 'api' => $api, |
84 | 84 | 'username' => $username |
85 | 85 | ])); |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | |
94 | 94 | $command->line(""); |
95 | 95 | |
96 | - $command->line("Packagist API : ". $auth['api']); |
|
96 | + $command->line("Packagist API : ".$auth['api']); |
|
97 | 97 | |
98 | - $command->line('Packagist Username : '. $auth['username']); |
|
98 | + $command->line('Packagist Username : '.$auth['username']); |
|
99 | 99 | |
100 | 100 | $command->note( |
101 | 101 | 'If you want change your details type `josh hook:setup --clear` ' |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $username = $auth['username']; |
107 | 107 | } |
108 | 108 | |
109 | - $this->sendRequest($command,$api,$username); |
|
109 | + $this->sendRequest($command, $api, $username); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | { |
121 | 121 | $package = $command->addInput('Enter your package-url'); |
122 | 122 | |
123 | - if(empty(trim($package))) { |
|
123 | + if (empty(trim($package))) { |
|
124 | 124 | $command->error("Package-url is required !"); |
125 | 125 | exit; |
126 | 126 | } |
127 | 127 | |
128 | 128 | $command->info("Sending request ..."); |
129 | 129 | |
130 | - $data = [ 'repository' => [ 'url' => $package ] ]; |
|
130 | + $data = ['repository' => ['url' => $package]]; |
|
131 | 131 | |
132 | 132 | $client = new Guzzle([ |
133 | 133 | 'base_uri' => 'https://packagist.org/', |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | ] |
137 | 137 | ]); |
138 | 138 | |
139 | - $result = $client->post('/api/update-package?username=' . $username . |
|
140 | - '&apiToken=' . $api,[ 'json' => $data ]); |
|
139 | + $result = $client->post('/api/update-package?username='.$username. |
|
140 | + '&apiToken='.$api, ['json' => $data]); |
|
141 | 141 | |
142 | 142 | $result = json_decode($result->getBody()->getContents(), true); |
143 | 143 | |
144 | - if($result['status'] !== 'success') { |
|
144 | + if ($result['status'] !== 'success') { |
|
145 | 145 | $command->error("Message : ".$result['message']." | Failed "); |
146 | 146 | exit; |
147 | 147 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function getHomeDir() |
157 | 157 | { |
158 | - if(empty($_SERVER['HOME'])){ |
|
158 | + if (empty($_SERVER['HOME'])) { |
|
159 | 159 | return posix_getpwuid(posix_getuid()); |
160 | 160 | } |
161 | 161 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | /** |
41 | 41 | * Register all commands |
42 | 42 | * |
43 | - * @return object |
|
43 | + * @return integer |
|
44 | 44 | */ |
45 | 45 | public function start() |
46 | 46 | { |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $this->addArgument('directory', InputArgument::REQUIRED, 'Get the directory'); |
28 | 28 | } |
29 | 29 | |
30 | - protected function execute(InputInterface $input , OutputInterface $output) |
|
30 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
31 | 31 | { |
32 | 32 | $command = new Style($input, $output); |
33 | 33 |