Collection
class Collection implements CollectionInterface (View source)
A resource collection
Properties
protected string | $name | ||
protected StorageInterface | $storage | ||
protected TargetInterface | $target | ||
protected array | $pathPatterns | ||
protected ResourceRepository | $resourceRepository |
Methods
Constructor
Returns the name of this collection
Returns the storage used for this collection
Returns the publication target defined for this collection
Imports a resource (file) from the given URI or PHP resource stream into this collection.
Imports a resource from the given string content into this collection.
Publishes the whole collection to the corresponding publishing target
Returns all internal data objects of the storage attached to this collection.
Returns a stream handle of the given persistent resource which allows for opening / copying the resource's data. Note that this stream handle may only be used read-only.
Details
__construct(string $name, StorageInterface $storage, TargetInterface $target, array $pathPatterns)
Constructor
string
getName()
Returns the name of this collection
StorageInterface
getStorage()
Returns the storage used for this collection
TargetInterface
getTarget()
Returns the publication target defined for this collection
PersistentResource
importResource(string|resource $source)
Imports a resource (file) from the given URI or PHP resource stream into this collection.
On a successful import this method returns a PersistentResource object representing the newly imported persistent resource.
Note that this collection must have a writable storage in order to import resources.
PersistentResource
importResourceFromContent(string $content)
Imports a resource from the given string content into this collection.
On a successful import this method returns a PersistentResource object representing the newly imported persistent resource.
Note that this collection must have a writable storage in order to import resources.
The specified filename will be used when presenting the resource to a user. Its file extension is important because the resource management will derive the IANA Media Type from it.
void
publish()
Publishes the whole collection to the corresponding publishing target
StorageObject>
getObjects(callable $callback = null)
Returns all internal data objects of the storage attached to this collection.
resource|bool
getStreamByResource(PersistentResource $resource)
Returns a stream handle of the given persistent resource which allows for opening / copying the resource's data. Note that this stream handle may only be used read-only.