$resourceDefinitions */ public function __construct( private array $resourceDefinitions = [], private ?string $iconIdentifier = null, private bool $createResourcesOnTheFly = true, ) {} /** * @internal Only to be used in VirtualAppPackage. Will be removed when deprecated asset config is removed */ public function withAdditionalResources(self $resources): ResourceCollectionInterface { return new self( array_merge($this->resourceDefinitions, $resources->resourceDefinitions), $this->iconIdentifier, ); } public function definitionForPath(string $relativePath): ResourceDefinitionInterface { foreach ($this->resourceDefinitions as $config) { if ($config->matches($relativePath)) { return $config; } } if ($this->createResourcesOnTheFly) { trigger_error('Resource identifiers outside ouf Resources/Private, Resources/Public or Configuration folder of extensions are deprecated. Define custom resources if required. Used resource: ' . $relativePath, E_USER_DEPRECATED); return new ResourceDefinition($relativePath); } throw new SystemResourceDefinitionNotFoundException(sprintf('Project path "%s" is not allowed. Define custom resources if required.', $relativePath), 1763381519); } public function isPublicPath(string $relativePath): bool { return $this->definitionForPath($relativePath) instanceof PublicResourceDefinition; } public function getPublicResourceDefinitions(): array { return array_filter( array_map( static fn(ResourceDefinitionInterface $definition) => $definition instanceof PublicResourceDefinition ? $definition : null, $this->resourceDefinitions, ) ); } public function getPackageIcon(): ?string { return $this->iconIdentifier; } }