You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This package provides 3 node types out of the box: Directory, File and Image. It's possible that users may want other node types in the future, each with their own set of metadata/functionality. Some possible examples: Pdf, Video, Audio.
While if enough users request a specific type, we would add to core, but some kind of extension system could be developed via a NodeFactory concept to allow 3rd party nodes.
Some ideas:
/** * @template T of Node */interfaceNodeFactory
{
/** * @return T */publicfunctioncreateFrom(Node$node): Node;
}
Change Filesystem::node() method:
interfaceFilesystem
{
/** * @template T of Node * * @param class-string<T> $type * * @return T */publicfunctionnode(string$path, string$type = Node::class): Node;
}
Add Node::ensure() method:
interfaceNode
{
/** * @template T of Node * * @param class-string<T> $type * * @return T */publicfunctionensure(string$type): Node;
}
Once such functionality exists, the existing 1st party image support could be extracted into a dedicated zenstruck/filesystem-image package. This would leave File and Directory as the only node-types provided by the core library.
The text was updated successfully, but these errors were encountered:
This package provides 3 node types out of the box:
Directory
,File
andImage
. It's possible that users may want other node types in the future, each with their own set of metadata/functionality. Some possible examples:Pdf
,Video
,Audio
.While if enough users request a specific type, we would add to core, but some kind of extension system could be developed via a
NodeFactory
concept to allow 3rd party nodes.Some ideas:
Change
Filesystem::node()
method:Add
Node::ensure()
method:Once such functionality exists, the existing 1st party image support could be extracted into a dedicated
zenstruck/filesystem-image
package. This would leaveFile
andDirectory
as the only node-types provided by the core library.The text was updated successfully, but these errors were encountered: