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