@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | { |
11 | 11 | public function getPackageInformation($name) |
12 | 12 | { |
13 | - if (! $this->exists($name)) { |
|
13 | + if (!$this->exists($name)) { |
|
14 | 14 | throw new RuntimeException('Package does not exists on packagist'); |
15 | 15 | } |
16 | 16 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | public function exists($name) |
31 | 31 | { |
32 | - if (! $this->checkFormat($name)) { |
|
32 | + if (!$this->checkFormat($name)) { |
|
33 | 33 | throw new RuntimeException('Package format is invalid'); |
34 | 34 | } |
35 | 35 |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | |
19 | 19 | public function moveDir($source, $destination) |
20 | 20 | { |
21 | - if (! is_dir($source)) { |
|
21 | + if (!is_dir($source)) { |
|
22 | 22 | throw new RuntimeException('Source directory does not exists'); |
23 | 23 | } |
24 | 24 | |
25 | - if (! is_dir($destination)) { |
|
25 | + if (!is_dir($destination)) { |
|
26 | 26 | mkdir($destination, 0775, true); |
27 | 27 | } |
28 | 28 | |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function removeDir($path) |
38 | 38 | { |
39 | - if (! preg_match('#^'.$this->packagesDir().'#', $path)) { |
|
39 | + if (!preg_match('#^'.$this->packagesDir().'#', $path)) { |
|
40 | 40 | throw new RuntimeException('Folder deletion forbidden'); |
41 | 41 | } |
42 | 42 | |
43 | - if (! is_dir($path)) { |
|
43 | + if (!is_dir($path)) { |
|
44 | 44 | return true; |
45 | 45 | } |
46 | 46 |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $package = Str::lower($this->argument('package')); |
70 | 70 | $this->alert("Creating a new package $package"); |
71 | 71 | |
72 | - if (! $this->packagist->checkFormat($package)) { |
|
72 | + if (!$this->packagist->checkFormat($package)) { |
|
73 | 73 | $this->error('Package name format must be vendor/package'); |
74 | 74 | |
75 | 75 | return 1; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $this->info("Require package $vendor/$package..."); |
131 | 131 | $this->composer->require("$vendor/$package:@dev", $this->option('dev')); |
132 | 132 | |
133 | - if (! is_link(base_path("vendor/$vendor/$package"))) { |
|
133 | + if (!is_link(base_path("vendor/$vendor/$package"))) { |
|
134 | 134 | $this->error('Package installed is not the local version!'); |
135 | 135 | |
136 | 136 | return 1; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | $result = $this->ask($question, $default); |
149 | 149 | |
150 | - if (! $result) { |
|
150 | + if (!$result) { |
|
151 | 151 | $this->error('Answer cannot be empty'); |
152 | 152 | |
153 | 153 | return $this->forceAnswer($question, $default); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $list = []; |
70 | 70 | |
71 | 71 | foreach (array_diff(scandir($path), ['.', '..']) as $vendor) { |
72 | - if (! is_dir("$path/$vendor")) { |
|
72 | + if (!is_dir("$path/$vendor")) { |
|
73 | 73 | continue; |
74 | 74 | } |
75 | 75 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | 'require-dev' => '-', |
89 | 89 | ]; |
90 | 90 | |
91 | - (new Process(['git', 'branch'], "$path/$vendor/$name"))->run(function ( |
|
91 | + (new Process(['git', 'branch'], "$path/$vendor/$name"))->run(function( |
|
92 | 92 | $type, |
93 | 93 | $buffer |
94 | 94 | ) use ( |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | }); |
103 | 103 | |
104 | - (new Process(['git', 'config', '--get', 'remote.origin.url'], "$path/$vendor/$name"))->run(function ( |
|
104 | + (new Process(['git', 'config', '--get', 'remote.origin.url'], "$path/$vendor/$name"))->run(function( |
|
105 | 105 | $type, |
106 | 106 | $buffer |
107 | 107 | ) use ( |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | { |
66 | 66 | $package = $this->argument('package'); |
67 | 67 | |
68 | - if (! $package) { |
|
68 | + if (!$package) { |
|
69 | 69 | $choices = []; |
70 | 70 | $path = $this->fileHandler->packagesDir(); |
71 | 71 | foreach (array_diff(scandir($path), ['.', '..']) as $vendor) { |
72 | - if (! is_dir("$path/$vendor")) { |
|
72 | + if (!is_dir("$path/$vendor")) { |
|
73 | 73 | continue; |
74 | 74 | } |
75 | 75 | |
@@ -81,30 +81,30 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | // If is format vendor/name get information from packagist |
84 | - if (! $this->packagist->checkFormat($package)) { |
|
84 | + if (!$this->packagist->checkFormat($package)) { |
|
85 | 85 | $this->error('The package format must be vendor/name'); |
86 | 86 | |
87 | 87 | return 1; |
88 | 88 | } |
89 | 89 | |
90 | - if (! $this->composer->isInstalled($package)) { |
|
90 | + if (!$this->composer->isInstalled($package)) { |
|
91 | 91 | $this->error("The package $package is not installed!"); |
92 | 92 | |
93 | 93 | return 1; |
94 | 94 | } |
95 | 95 | |
96 | - if (! is_dir($this->fileHandler->packagesDir($package))) { |
|
96 | + if (!is_dir($this->fileHandler->packagesDir($package))) { |
|
97 | 97 | $this->error("The package $package is not a local package, you have to remove it manually!"); |
98 | 98 | |
99 | 99 | return 1; |
100 | 100 | } |
101 | 101 | |
102 | - if (! $this->confirm("<bg=red>You are about to remove the package $package, are you sure?</>")) { |
|
102 | + if (!$this->confirm("<bg=red>You are about to remove the package $package, are you sure?</>")) { |
|
103 | 103 | return 0; |
104 | 104 | } |
105 | 105 | |
106 | 106 | $this->info("Removing package $package from composer..."); |
107 | - if (! $this->composer->remove($package)) { |
|
107 | + if (!$this->composer->remove($package)) { |
|
108 | 108 | $this->error('Fail to remove from composer!'); |
109 | 109 | |
110 | 110 | return 1; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | // If is format vendor/name get information from packagist |
71 | 71 | if ($this->packagist->checkFormat($url)) { |
72 | 72 | $this->info('Getting package information from packagist.org...'); |
73 | - if (! $this->packagist->exists($url)) { |
|
73 | + if (!$this->packagist->exists($url)) { |
|
74 | 74 | $this->error('Package does not exists on packagist.org'); |
75 | 75 | |
76 | 76 | return 1; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | // Get information from the given repository URL |
85 | - if (! ($package = $this->package->parseFromUrl($url))) { |
|
85 | + if (!($package = $this->package->parseFromUrl($url))) { |
|
86 | 86 | $this->error('Package name or repository URL is invalid!'); |
87 | 87 | |
88 | 88 | return 1; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | return 1; |
95 | 95 | } |
96 | 96 | |
97 | - if (! strpos(@get_headers($url)[0], '200')) { |
|
97 | + if (!strpos(@get_headers($url)[0], '200')) { |
|
98 | 98 | $this->error('Package URL is not readable!'); |
99 | 99 | |
100 | 100 | return 1; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | exec("git clone -q $url $tempPath", $output, $exit_code); |
108 | 108 | |
109 | 109 | // Get information from composer.json |
110 | - if (! is_file($package->temp_path.'/composer.json')) { |
|
110 | + if (!is_file($package->temp_path.'/composer.json')) { |
|
111 | 111 | $this->error('Package has no composer.json file!'); |
112 | 112 | $this->fileHandler->removeDir($this->fileHandler->tempDir()); |
113 | 113 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | $this->info("Installing package $vendor/$name..."); |
122 | 122 | |
123 | 123 | if (is_dir($this->fileHandler->packagesDir("$vendor/$name"))) { |
124 | - if (! $this->confirm('<fg=yellow>The package already exists in local folder, require current local package?</>')) { |
|
125 | - if (! $this->confirm('<fg=yellow>Clear local package and install the downloaded one?</>')) { |
|
124 | + if (!$this->confirm('<fg=yellow>The package already exists in local folder, require current local package?</>')) { |
|
125 | + if (!$this->confirm('<fg=yellow>Clear local package and install the downloaded one?</>')) { |
|
126 | 126 | $this->fileHandler->removeDir($this->fileHandler->tempDir()); |
127 | 127 | |
128 | 128 | return 0; |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | $this->fileHandler->removeDir($this->fileHandler->tempDir()); |
139 | 139 | |
140 | 140 | $this->info("Require package $vendor/$name..."); |
141 | - if (! $this->composer->require("$vendor/$name:@dev", $this->option('dev'))) { |
|
141 | + if (!$this->composer->require("$vendor/$name:@dev", $this->option('dev'))) { |
|
142 | 142 | $this->error('Package installation failed, require has failed!'); |
143 | 143 | |
144 | 144 | return 1; |
145 | 145 | } |
146 | 146 | |
147 | - if (! is_link(base_path("vendor/$package->vendor/$package->name"))) { |
|
147 | + if (!is_link(base_path("vendor/$package->vendor/$package->name"))) { |
|
148 | 148 | $this->error('Package installation failed, symlink has not been created!'); |
149 | 149 | |
150 | 150 | return 1; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | parent::__construct(); |
40 | 40 | |
41 | - if (! is_dir($fileHandler->packagesDir())) { |
|
41 | + if (!is_dir($fileHandler->packagesDir())) { |
|
42 | 42 | mkdir($fileHandler->packagesDir(), 0775, true); |
43 | 43 | file_put_contents($fileHandler->packagesDir('.gitignore'), '.temp/'); |
44 | 44 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $action = $this->argument('action'); |
59 | 59 | |
60 | - if (! in_array($action, ['create', 'require', 'remove', 'list'])) { |
|
60 | + if (!in_array($action, ['create', 'require', 'remove', 'list'])) { |
|
61 | 61 | $this->help(); |
62 | 62 | |
63 | 63 | return 0; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $iterator = (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->fileHandler->tempDir()))); |
80 | 80 | foreach ($iterator as $item) { |
81 | 81 | /** @var \SplFileInfo $item */ |
82 | - if (! $item->isFile()) { |
|
82 | + if (!$item->isFile()) { |
|
83 | 83 | continue; |
84 | 84 | } |
85 | 85 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | private function moveFiles() |
96 | 96 | { |
97 | - if (! is_file($this->fileHandler->tempDir('packager.json'))) { |
|
97 | + if (!is_file($this->fileHandler->tempDir('packager.json'))) { |
|
98 | 98 | return false; |
99 | 99 | } |
100 | 100 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | private function buildLicense() |
111 | 111 | { |
112 | - if (! is_file($this->fileHandler->tempDir('license.md'))) { |
|
112 | + if (!is_file($this->fileHandler->tempDir('license.md'))) { |
|
113 | 113 | return false; |
114 | 114 | } |
115 | 115 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | private function checkFormat($package) |
62 | 62 | { |
63 | - if (! preg_match('`^([A-Za-z0-9\-]*)/([A-Za-z0-9\-]*)(:[@a-z\-]*)?$`', $package, $m)) { |
|
63 | + if (!preg_match('`^([A-Za-z0-9\-]*)/([A-Za-z0-9\-]*)(:[@a-z\-]*)?$`', $package, $m)) { |
|
64 | 64 | throw new RuntimeException('Package name is not well formatted'); |
65 | 65 | } |
66 | 66 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $process->setTimeout(config('packager.timeout', 300)); |
75 | 75 | $process->run(); |
76 | 76 | |
77 | - if (! $process->isSuccessful()) { |
|
77 | + if (!$process->isSuccessful()) { |
|
78 | 78 | throw new ProcessFailedException($process); |
79 | 79 | } |
80 | 80 |