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: use LogicException;
10:
11: final readonly class SelfContainedStrategy implements Ui5SourceStrategyInterface
12: {
13: public function __construct(
14: private string $srcPath
15: )
16: {
17: }
18:
19: public function getSourcePath(): string
20: {
21: return $this->srcPath;
22: }
23:
24: /**
25: * @throws JsonException
26: */
27: public function createAppSource(string $vendor): Ui5AppSource
28: {
29: return Ui5AppSource::fromPackage($this->getSourcePath(), $vendor);
30: }
31:
32: public function createLibrarySource(string $vendor): Ui5LibrarySource
33: {
34: throw new LogicException('Self-contained libraries are not supported.');
35: }
36: }
37: