@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException |
| 27 | 27 | */ |
| 28 | 28 | protected function getLockFile() { |
| 29 | - if($this->filesystem->exists($this->lockFilename)) { |
|
| 29 | + if ($this->filesystem->exists($this->lockFilename)) { |
|
| 30 | 30 | $configLock = $this->serializer->deserialize( |
| 31 | 31 | $this->filesystem->get($this->lockFilename), |
| 32 | 32 | 'App\Satis\Model\ConfigLock', |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | public function lock($repositoryId) { |
| 79 | 79 | $lockedRepositories = $this->getLockedRepositories(); |
| 80 | 80 | |
| 81 | - if(!is_null($repositoryId) && !$lockedRepositories->contains($repositoryId)) { |
|
| 81 | + if (!is_null($repositoryId) && !$lockedRepositories->contains($repositoryId)) { |
|
| 82 | 82 | $lockedRepositories->push($repositoryId); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | public function unlock($repositoryId = null) { |
| 100 | 100 | $lockedRepositories = $this->getLockedRepositories(); |
| 101 | 101 | |
| 102 | - if($repositoryId !== null && $lockedRepositories->contains($repositoryId)) { |
|
| 102 | + if ($repositoryId !== null && $lockedRepositories->contains($repositoryId)) { |
|
| 103 | 103 | $lockedRepositories = $lockedRepositories->filter(function($id) use($repositoryId) { |
| 104 | 104 | return $id !== $repositoryId; |
| 105 | 105 | }); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | * @return $this |
| 36 | 36 | */ |
| 37 | 37 | public function isLocked($locked = null) { |
| 38 | - if($locked === null) { |
|
| 38 | + if ($locked === null) { |
|
| 39 | 39 | return $this->locked; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | ] |
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | - if($validator->fails()) { |
|
| 37 | + if ($validator->fails()) { |
|
| 38 | 38 | Response::json($validator->errors()->first('url')) |
| 39 | 39 | ->setStatusCode(400) |
| 40 | 40 | ->send(); |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | Response::json(['command_output' => $output]) |
| 46 | 46 | ->send(); |
| 47 | - } catch(PackageBuildFailedException $e) { |
|
| 47 | + } catch (PackageBuildFailedException $e) { |
|
| 48 | 48 | Response::json() |
| 49 | 49 | ->setStatusCode(500) |
| 50 | 50 | ->send(); |
| 51 | - } catch(RepositoryNotFoundException $e) { |
|
| 51 | + } catch (RepositoryNotFoundException $e) { |
|
| 52 | 52 | Response::json() |
| 53 | 53 | ->setStatusCode(404) |
| 54 | 54 | ->send(); |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | Response::make($repositories) |
| 68 | 68 | ->send(); |
| 69 | - } catch(RepositoryNotFoundException $e) { |
|
| 69 | + } catch (RepositoryNotFoundException $e) { |
|
| 70 | 70 | Response::json() |
| 71 | 71 | ->setStatusCode(404) |
| 72 | 72 | ->send(); |
| 73 | - } catch(PackageBuildFailedException $e) { |
|
| 73 | + } catch (PackageBuildFailedException $e) { |
|
| 74 | 74 | Response::json($e->getMessage()) |
| 75 | 75 | ->setStatusCode(500) |
| 76 | 76 | ->send(); |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | Response::json() |
| 110 | 110 | ->send(); |
| 111 | - } catch(RepositoryNotFoundException $e) { |
|
| 111 | + } catch (RepositoryNotFoundException $e) { |
|
| 112 | 112 | Response::json() |
| 113 | 113 | ->setStatusCode(404) |
| 114 | 114 | ->send(); |
| 115 | - } catch(PackageBuildFailedException $e) { |
|
| 115 | + } catch (PackageBuildFailedException $e) { |
|
| 116 | 116 | Response::json($e->getMessage()) |
| 117 | 117 | ->setStatusCode(500) |
| 118 | 118 | ->send(); |
@@ -89,16 +89,16 @@ discard block |
||
| 89 | 89 | $repository->setUrl($input->get('url')); |
| 90 | 90 | $repository->setType($input->get('type', config('satis.default_repository_type'))); |
| 91 | 91 | |
| 92 | - if($input->has('async_mode')) { |
|
| 92 | + if ($input->has('async_mode')) { |
|
| 93 | 93 | $this->configBuilder->setAsyncMode(filter_var($input->get('async_mode'), FILTER_VALIDATE_BOOLEAN)); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if($input->has('disable_build')) { |
|
| 96 | + if ($input->has('disable_build')) { |
|
| 97 | 97 | $this->setDisableBuild(filter_var($input->get('disable_build'), FILTER_VALIDATE_BOOLEAN)); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if($repositoryId !== null) { |
|
| 101 | - if($repositoryCollection->has($repositoryId)) { |
|
| 100 | + if ($repositoryId !== null) { |
|
| 101 | + if ($repositoryCollection->has($repositoryId)) { |
|
| 102 | 102 | $repositoryCollection->put($repositoryId, $repository); |
| 103 | 103 | } else { |
| 104 | 104 | throw new RepositoryNotFoundException('Repository with ID "' . $repositoryId . '" does not exist.'); |
@@ -130,16 +130,16 @@ discard block |
||
| 130 | 130 | $package = new Package(); |
| 131 | 131 | $package->setName($input->get('name')); |
| 132 | 132 | |
| 133 | - if($input->has('async_mode')) { |
|
| 133 | + if ($input->has('async_mode')) { |
|
| 134 | 134 | $this->configBuilder->setAsyncMode(filter_var($input->get('async_mode'), FILTER_VALIDATE_BOOLEAN)); |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if($input->has('disable_build')) { |
|
| 137 | + if ($input->has('disable_build')) { |
|
| 138 | 138 | $this->setDisableBuild(filter_var($input->get('disable_build'), FILTER_VALIDATE_BOOLEAN)); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if($packageId !== null) { |
|
| 142 | - if($packageCollection->has($packageId)) { |
|
| 141 | + if ($packageId !== null) { |
|
| 142 | + if ($packageCollection->has($packageId)) { |
|
| 143 | 143 | $packageCollection->put($packageId, $package); |
| 144 | 144 | } else { |
| 145 | 145 | throw new PackageNotFoundException('Package with ID "' . $packageId . '" does not exist.'); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @throws \App\Satis\Exceptions\RepositoryNotFoundException |
| 166 | 166 | */ |
| 167 | 167 | protected function _deleteRepository(RepositoryCollection $repositoryCollection, $repositoryId) { |
| 168 | - if($repositoryCollection->has($repositoryId)) { |
|
| 168 | + if ($repositoryCollection->has($repositoryId)) { |
|
| 169 | 169 | $repositoryCollection->forget($repositoryId); |
| 170 | 170 | } else { |
| 171 | 171 | throw new RepositoryNotFoundException('Repository with ID "' . $repositoryId . '" does not exist.'); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * @throws \App\Satis\Exceptions\RepositoryNotFoundException |
| 184 | 184 | */ |
| 185 | 185 | protected function _deletePackage(PackageCollection $packageCollection, $packageId) { |
| 186 | - if($packageCollection->has($packageId)) { |
|
| 186 | + if ($packageCollection->has($packageId)) { |
|
| 187 | 187 | $packageCollection->forget($packageId); |
| 188 | 188 | } else { |
| 189 | 189 | throw new RepositoryNotFoundException('Package with ID "' . $packageId . '" does not exist.'); |
@@ -226,11 +226,11 @@ discard block |
||
| 226 | 226 | public function __call($method, array $arguments) { |
| 227 | 227 | $method = $this->hiddenEntityPrefix . $method; |
| 228 | 228 | |
| 229 | - if(method_exists($this, $method)) { |
|
| 229 | + if (method_exists($this, $method)) { |
|
| 230 | 230 | $logger = $this->getLogger(); |
| 231 | 231 | |
| 232 | 232 | $logger->info(str_repeat('=', 30)); |
| 233 | - $logger->info('Request => ' . \Request::method() . ' (' . $method .') => '. json_encode($arguments)); |
|
| 233 | + $logger->info('Request => ' . \Request::method() . ' (' . $method . ') => ' . json_encode($arguments)); |
|
| 234 | 234 | |
| 235 | 235 | $type = str_plural(last(explode('_', snake_case($method))), 2); |
| 236 | 236 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | try { |
| 240 | 240 | $items = call_user_func_array([$this, $method], $arguments); |
| 241 | - } catch(\Exception $e) { |
|
| 241 | + } catch (\Exception $e) { |
|
| 242 | 242 | $logger->info('Response => ' . $e->getMessage()); |
| 243 | 243 | $logger->info(str_repeat('=', 30)); |
| 244 | 244 | |
@@ -258,9 +258,9 @@ discard block |
||
| 258 | 258 | * @return mixed |
| 259 | 259 | */ |
| 260 | 260 | public function __get($property) { |
| 261 | - $property = $this->hiddenEntityPrefix.$property; |
|
| 261 | + $property = $this->hiddenEntityPrefix . $property; |
|
| 262 | 262 | |
| 263 | - if(isset($this->lazyLoadedProperties[$property])) { |
|
| 263 | + if (isset($this->lazyLoadedProperties[$property])) { |
|
| 264 | 264 | $this->{$property} = $this->{$this->lazyLoadedProperties[$property]}(); |
| 265 | 265 | |
| 266 | 266 | unset($this->lazyLoadedProperties[$property]); |
@@ -287,8 +287,8 @@ discard block |
||
| 287 | 287 | public function getRepositories($repositoryId = null) { |
| 288 | 288 | $repositoryCollection = $this->satis->getRepositories(); |
| 289 | 289 | |
| 290 | - if($repositoryId !== null) { |
|
| 291 | - if(!$repositoryCollection->has($repositoryId)) { |
|
| 290 | + if ($repositoryId !== null) { |
|
| 291 | + if (!$repositoryCollection->has($repositoryId)) { |
|
| 292 | 292 | throw new RepositoryNotFoundException('Repository with ID "' . $repositoryId . '" does not exist.'); |
| 293 | 293 | } |
| 294 | 294 | |
@@ -308,8 +308,8 @@ discard block |
||
| 308 | 308 | public function getPackages($packageId = null) { |
| 309 | 309 | $packageCollection = $this->satis->getPackages(); |
| 310 | 310 | |
| 311 | - if($packageId !== null) { |
|
| 312 | - if(!$packageCollection->has($packageId)) { |
|
| 311 | + if ($packageId !== null) { |
|
| 312 | + if (!$packageCollection->has($packageId)) { |
|
| 313 | 313 | throw new PackageNotFoundException('Package with ID "' . $packageId . '" does not exist.'); |
| 314 | 314 | } |
| 315 | 315 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | * @param \App\Satis\BuildContext $buildContext |
| 326 | 326 | */ |
| 327 | 327 | public function forceBuild(BuildContext $buildContext) { |
| 328 | - if($buildContext->getItemName() !== null) { |
|
| 328 | + if ($buildContext->getItemName() !== null) { |
|
| 329 | 329 | $buildContext->setItemId(self::nameToId($buildContext->getItemName())); |
| 330 | 330 | } |
| 331 | 331 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | |
| 357 | 357 | $this->configPersister->updateWith($satisConfig); |
| 358 | 358 | |
| 359 | - if($this->disableBuild === false) { |
|
| 359 | + if ($this->disableBuild === false) { |
|
| 360 | 360 | return $this->configBuilder->build(); |
| 361 | 361 | } |
| 362 | 362 | |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | 'json', |
| 56 | 56 | function(VisitorInterface $visitor, Collection $collection, array $type, Context $context) { |
| 57 | 57 | $output = []; |
| 58 | - foreach($collection->values() as $package) { |
|
| 58 | + foreach ($collection->values() as $package) { |
|
| 59 | 59 | /** @var Package $package */ |
| 60 | 60 | |
| 61 | 61 | $output[$package->getName()] = $package->getVersion(); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if(!$output) { |
|
| 64 | + if (!$output) { |
|
| 65 | 65 | return null; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $repositories = $visitor->visitArray($data, $type, $context); |
| 82 | 82 | |
| 83 | 83 | $collection = new RepositoryCollection(); |
| 84 | - foreach($repositories as $repository) { |
|
| 84 | + foreach ($repositories as $repository) { |
|
| 85 | 85 | $collection->put($repository->getId(), $repository); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | 'json', |
| 96 | 96 | function(VisitorInterface $visitor, array $data, array $type, Context $context) { |
| 97 | 97 | $temp = []; |
| 98 | - foreach($data as $name => $version) { |
|
| 98 | + foreach ($data as $name => $version) { |
|
| 99 | 99 | $temp[] = ['name' => $name, 'version' => $version]; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $packages = $visitor->visitArray($temp, $type, $context); |
| 104 | 104 | |
| 105 | 105 | $collection = new PackageCollection(); |
| 106 | - foreach($packages as $package) { |
|
| 106 | + foreach ($packages as $package) { |
|
| 107 | 107 | $collection->put($package->getId(), $package); |
| 108 | 108 | } |
| 109 | 109 | |