humbug /
box
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | /* |
||
| 6 | * This file is part of the box project. |
||
| 7 | * |
||
| 8 | * (c) Kevin Herrera <[email protected]> |
||
| 9 | * Théo Fidry <[email protected]> |
||
| 10 | * |
||
| 11 | * This source file is subject to the MIT license that is bundled |
||
| 12 | * with this source code in the file LICENSE. |
||
| 13 | */ |
||
| 14 | |||
| 15 | namespace KevinGH\Box\Composer\Artifact; |
||
| 16 | |||
| 17 | use function array_filter; |
||
| 18 | use function array_map; |
||
| 19 | use function array_values; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @private |
||
| 23 | */ |
||
| 24 | final readonly class ComposerArtifacts |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 25 | { |
||
| 26 | public function __construct( |
||
| 27 | public readonly ?ComposerJson $composerJson = null, |
||
| 28 | public readonly ?ComposerLock $composerLock = null, |
||
| 29 | public readonly ?ComposerArtifact $installedJson = null, |
||
| 30 | ) { |
||
| 31 | } |
||
| 32 | |||
| 33 | public function getComposerJson(): ?ComposerJson |
||
| 34 | { |
||
| 35 | return $this->composerJson; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function getComposerLock(): ?ComposerLock |
||
| 39 | { |
||
| 40 | return $this->composerLock; |
||
| 41 | } |
||
| 42 | |||
| 43 | public function getInstalledJson(): ?ComposerArtifact |
||
| 44 | { |
||
| 45 | return $this->installedJson; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @return list<string> |
||
| 50 | */ |
||
| 51 | public function getPaths(): array |
||
| 52 | { |
||
| 53 | return array_values( |
||
| 54 | array_filter( |
||
| 55 | array_map( |
||
| 56 | static fn (null|ComposerArtifact|ComposerJson|ComposerLock $file): ?string => $file?->path, |
||
| 57 | [$this->composerJson, $this->composerLock, $this->installedJson], |
||
| 58 | ), |
||
| 59 | ), |
||
| 60 | ); |
||
| 61 | } |
||
| 62 | } |
||
| 63 |