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