SystemResourceFactory
Read onlyYes
This is the heart of system resource handling and the most important API to be used in userland code and throughout the core.
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Methods
- __construct() : mixed
- createPublicResource() : PublicResourceInterface
- Use this method to obtain a resource that is public, which means, that a URI can be generated for it.
- createResource() : StaticResourceInterface
- Use this method, when generating a URI is not required for the resource and only e.g. file contents like for templates is required.
Methods
__construct()
public
__construct(SystemResourceIdentifierFactory $identifierFactory, PackageManager $packageManager, StorageRepository|null $storageRepository, ResourceFactory|null $resourceFactory) : mixed
Parameters
- $identifierFactory : SystemResourceIdentifierFactory
- $packageManager : PackageManager
- $storageRepository : StorageRepository|null
- $resourceFactory : ResourceFactory|null
createPublicResource()
Use this method to obtain a resource that is public, which means, that a URI can be generated for it.
public
createPublicResource(string $resourceString) : PublicResourceInterface
Always use it when the goal is to generate a URI, as it checks, whether the resolved resource can/ is indeed published or not and throws an exception otherwise.
Parameters
- $resourceString : string
Tags
Return values
PublicResourceInterfacecreateResource()
Use this method, when generating a URI is not required for the resource and only e.g. file contents like for templates is required.
public
createResource(string $resourceString) : StaticResourceInterface
Parameters
- $resourceString : string