| 1: | <?php |
| 2: | |
| 3: | namespace LaravelUi5\Core\Infrastructure; |
| 4: | |
| 5: | use JsonException; |
| 6: | use LaravelUi5\Core\Infrastructure\Contracts\Ui5SourceStrategyInterface; |
| 7: | use LaravelUi5\Core\Introspection\App\Ui5AppSource; |
| 8: | use LaravelUi5\Core\Introspection\Library\Ui5LibrarySource; |
| 9: | |
| 10: | final readonly class PackageStrategy implements Ui5SourceStrategyInterface |
| 11: | { |
| 12: | public function __construct( |
| 13: | private string $srcPath |
| 14: | ) |
| 15: | { |
| 16: | } |
| 17: | |
| 18: | public function getSourcePath(): string |
| 19: | { |
| 20: | return $this->srcPath; |
| 21: | } |
| 22: | |
| 23: | |
| 24: | |
| 25: | |
| 26: | public function createAppSource(string $vendor): Ui5AppSource |
| 27: | { |
| 28: | return Ui5AppSource::fromPackage($this->getSourcePath(), $vendor); |
| 29: | } |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | public function createLibrarySource(string $vendor): Ui5LibrarySource |
| 35: | { |
| 36: | return Ui5LibrarySource::fromPackage($this->getSourcePath(), $vendor); |
| 37: | } |
| 38: | } |
| 39: | |