$cachePool
$cachePool : \Psr\Cache\CacheItemPoolInterface
The PSR-6 caching service.
Load metadata from JSON file(s).
The Metadata Loader is different than the FileLoader
class it extends mainly because
it tries to find all files matching the "ident" in all search path and merge them together
in an array, to be filled in a Metadata
object.
If ident
is an actual class name, then it will also try to load all the JSON matching
the class' parents and interfaces.
load(string $ident, \Charcoal\Model\MetadataInterface $metadata, array|null $interfaces = null) : array
Load the metadata for the given identifier or interfaces.
string | $ident | The metadata identifier to load or to use as the cache key if $interfaces is provided. |
\Charcoal\Model\MetadataInterface | $metadata | The metadata object to load into. |
array|null | $interfaces | One or more metadata identifiers to load. |
If the identifier is not a string.
Returns the cached metadata instance or if it's stale or empty, loads a fresh copy of the data into $metadata and returns it;
setCachePool(\Psr\Cache\CacheItemPoolInterface $cache) : \Charcoal\Model\Service\MetadataLoader
Set the cache service.
\Psr\Cache\CacheItemPoolInterface | $cache | A PSR-6 compliant cache pool instance. |
Chainable
setBasePath(string $basePath) : \Charcoal\Model\Service\MetadataLoader
Assign a base path for relative search paths.
string | $basePath | The base path to use. |
If the base path parameter is not a string.
Chainable