| @@ 24-58 (lines=35) @@ | ||
| 21 | * |
|
| 22 | * Allows sourcing components from a local filesystem. |
|
| 23 | */ |
|
| 24 | class FilesystemPackageRepository extends AbstractPackageRepository |
|
| 25 | implements PackageRepository { |
|
| 26 | /** |
|
| 27 | * @inheritdoc PackageRepository |
|
| 28 | */ |
|
| 29 | public function getId() { |
|
| 30 | return 'Filesystem'; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @inheritdoc PackageRepository |
|
| 35 | */ |
|
| 36 | public function getName() { |
|
| 37 | return 'Filesystem package repository'; |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @inheritdoc PackageRepository |
|
| 42 | */ |
|
| 43 | public function resolveComponent(ComponentSpecification $componentSpecification, |
|
| 44 | LoggerInterface $logger) { |
|
| 45 | return new Component($componentSpecification->getName(), [ |
|
| 46 | new ComponentVersion(null, null, null, [ |
|
| 47 | new DirectoryComponentSource($componentSpecification->getExtra('directory')), |
|
| 48 | ]), |
|
| 49 | ], $this); |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * @inheritdoc PackageRepository |
|
| 54 | */ |
|
| 55 | public function satisfiesVersion($versionSpecification, ComponentVersion $version) { |
|
| 56 | return true; |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||
| @@ 24-58 (lines=35) @@ | ||
| 21 | * |
|
| 22 | * Allows sourcing components from arbitrary Git repositories. |
|
| 23 | */ |
|
| 24 | class GitPackageRepository extends AbstractCachingPackageRepository |
|
| 25 | implements PackageRepository { |
|
| 26 | /** |
|
| 27 | * @inheritdoc PackageRepository |
|
| 28 | */ |
|
| 29 | public function getId() { |
|
| 30 | return 'Git'; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @inheritdoc PackageRepository |
|
| 35 | */ |
|
| 36 | public function getName() { |
|
| 37 | return 'Git package repository'; |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @inheritdoc PackageRepository |
|
| 42 | */ |
|
| 43 | public function resolveComponent(ComponentSpecification $componentSpecification, |
|
| 44 | LoggerInterface $logger) { |
|
| 45 | return new Component($componentSpecification->getName(), [ |
|
| 46 | new ComponentVersion(null, null, null, [ |
|
| 47 | new GitComponentSource($componentSpecification->getExtra('uri'), $componentSpecification->getVersion()) |
|
| 48 | ]), |
|
| 49 | ], $this); |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * @inheritdoc PackageRepository |
|
| 54 | */ |
|
| 55 | public function satisfiesVersion($versionSpecification, ComponentVersion $version) { |
|
| 56 | return true; |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||