Directory
extends Node
in package
implements
ICollection, IQuota, IMoveTarget
Directory class.
Tags
Interfaces, Classes and Traits
- ICollection
- The ICollection Interface.
- IQuota
- IQuota interface.
- IMoveTarget
- By implementing this interface, a collection can effectively say "other nodes may be moved into this collection".
Table of Contents
- $overrideName : string
- The overridden name of the node.
- $path : string
- The path to the current node.
- __construct() : mixed
- Sets up the node, expects a full path name.
- childExists() : bool
- Checks if a child exists.
- createDirectory() : mixed
- Creates a new subdirectory.
- createFile() : string|null
- Creates a new file in the directory.
- delete() : bool
- Deletes all files in this directory, and then itself.
- getChild() : INode
- Returns a specific child node, referenced by its name.
- getChildren() : array<string|int, INode>
- Returns an array with all the child nodes.
- getLastModified() : int
- Returns the last modification time, as a unix timestamp.
- getName() : string
- Returns the name of the node.
- getQuotaInfo() : array<string|int, mixed>
- Returns available diskspace information.
- moveInto() : bool
- Moves a node into this collection.
- setName() : mixed
- Renames the node.
Properties
$overrideName
The overridden name of the node.
protected
string
$overrideName
$path
The path to the current node.
protected
string
$path
Methods
__construct()
Sets up the node, expects a full path name.
public
__construct(string $path[, string $overrideName = null ]) : mixed
If $overrideName is set, this node shows up in the tree under a different name. In this case setName() will be disabled.
Parameters
- $path : string
- $overrideName : string = null
Return values
mixed —childExists()
Checks if a child exists.
public
childExists(string $name) : bool
Parameters
- $name : string
Return values
bool —createDirectory()
Creates a new subdirectory.
public
createDirectory(string $name) : mixed
Parameters
- $name : string
Return values
mixed —createFile()
Creates a new file in the directory.
public
createFile(string $name[, resource|string $data = null ]) : string|null
Data will either be supplied as a stream resource, or in certain cases as a string. Keep in mind that you may have to support either.
After successful creation of the file, you may choose to return the ETag of the new file here.
The returned ETag must be surrounded by double-quotes (The quotes should be part of the actual string).
If you cannot accurately determine the ETag, you should not return it. If you don't store the file exactly as-is (you're transforming it somehow) you should also not return an ETag.
This means that if a subsequent GET to this new file does not exactly return the same contents of what was submitted here, you are strongly recommended to omit the ETag.
Parameters
- $name : string
-
Name of the file
- $data : resource|string = null
-
Initial payload
Return values
string|null —delete()
Deletes all files in this directory, and then itself.
public
delete() : bool
Return values
bool —getChild()
Returns a specific child node, referenced by its name.
public
getChild(string $name) : INode
This method must throw Sabre\DAV\Exception\NotFound if the node does not exist.
Parameters
- $name : string
Tags
Return values
INode —getChildren()
Returns an array with all the child nodes.
public
getChildren() : array<string|int, INode>
Return values
array<string|int, INode> —getLastModified()
Returns the last modification time, as a unix timestamp.
public
getLastModified() : int
Return values
int —getName()
Returns the name of the node.
public
getName() : string
Return values
string —getQuotaInfo()
Returns available diskspace information.
public
getQuotaInfo() : array<string|int, mixed>
Return values
array<string|int, mixed> —moveInto()
Moves a node into this collection.
public
moveInto(string $targetName, string $sourcePath, INode $sourceNode) : bool
It is up to the implementors to:
- Create the new resource.
- Remove the old resource.
- Transfer any properties or other data.
Generally you should make very sure that your collection can easily move the move.
If you don't, just return false, which will trigger sabre/dav to handle the move itself. If you return true from this function, the assumption is that the move was successful.
Parameters
- $targetName : string
-
new local file/collection name
- $sourcePath : string
-
Full path to source node
- $sourceNode : INode
-
Source node itself
Return values
bool —setName()
Renames the node.
public
setName(string $name) : mixed
Parameters
- $name : string
-
The new name