|
@@ 287-301 (lines=15) @@
|
| 284 |
|
* @return string |
| 285 |
|
* @throws \App\Satis\Exceptions\RepositoryNotFoundException |
| 286 |
|
*/ |
| 287 |
|
public function getRepositories($repositoryId = null) { |
| 288 |
|
$repositoryCollection = $this->satis->getRepositories(); |
| 289 |
|
|
| 290 |
|
if($repositoryId !== null) { |
| 291 |
|
if(!$repositoryCollection->has($repositoryId)) { |
| 292 |
|
throw new RepositoryNotFoundException('Repository with ID "' . $repositoryId . '" does not exist.'); |
| 293 |
|
} |
| 294 |
|
|
| 295 |
|
$output = $repositoryCollection->get($repositoryId); |
| 296 |
|
} else { |
| 297 |
|
$output = $repositoryCollection; |
| 298 |
|
} |
| 299 |
|
|
| 300 |
|
return $this->serializer->serialize($output, 'json'); |
| 301 |
|
} |
| 302 |
|
|
| 303 |
|
/** |
| 304 |
|
* @param string|null $packageId |
|
@@ 308-322 (lines=15) @@
|
| 305 |
|
* @return string |
| 306 |
|
* @throws \App\Satis\Exceptions\PackageNotFoundException |
| 307 |
|
*/ |
| 308 |
|
public function getPackages($packageId = null) { |
| 309 |
|
$packageCollection = $this->satis->getPackages(); |
| 310 |
|
|
| 311 |
|
if($packageId !== null) { |
| 312 |
|
if(!$packageCollection->has($packageId)) { |
| 313 |
|
throw new PackageNotFoundException('Package with ID "' . $packageId . '" does not exist.'); |
| 314 |
|
} |
| 315 |
|
|
| 316 |
|
$output = $packageCollection->get($packageId); |
| 317 |
|
} else { |
| 318 |
|
$output = $packageCollection; |
| 319 |
|
} |
| 320 |
|
|
| 321 |
|
return $this->serializer->serialize($output, 'json'); |
| 322 |
|
} |
| 323 |
|
|
| 324 |
|
/** |
| 325 |
|
* @param \App\Satis\BuildContext $buildContext |