spunQ_IFolder Interface Reference

Extension of spunQ_IFileNode with folder-specific accessors. More...

Inheritance diagram for spunQ_IFolder:

spunQ_IFileNode spunQ_Folder spunQ_SourceFolder

List of all members.

Public Member Functions

 getParent ()
 Alias for getContainingFolder().
 getFilesRecursive (array $suffixes, &$newest)
 Gets all files with any of the given suffixes in the folder recursively.
 getFilesWithAliasRecursive (array $suffixes, &$newest, $alias)
 Almost the same as getFilesRecursive(), but generates aliases as well.
 getFilesBySuffix ($suffix, $includeHidden=true)
 Get all files in this folder with given suffix.
 getFiles ($includeHidden=true)
 Fetches all files in this folder.
 getFolders ($includeHidden=true)
 Fetches all sub-folders in this folder.
 getFile ($name)
 Gets a file in - or relative to - this folder.
 getFolder ($name)
 Gets a folder in - or relative to - this folder.
 getPathTo (spunQ_IFileNode $node)
 Will give the path from this folder to another file node.
 getBreadcrumbsTo (spunQ_IFileNode $node)
 Does the same as getPathTo(), merely the result has a different format.
 create ()
 Makes sure this folder exists - creating parent folders if necessary.
 createTemporaryFile ()
 Creates a temporary file in this folder.
 assureExists ()
 Throws an exception if this folder does not exist.
 isEmpty ()
 Checks whether this folder contains any files or folders.
 delete ()
 Deletes this folder from the file system including anything in it.
 moveTo ($folder, $overwrite, $newName=NULL)
 Moves this folder into another directory (and optionally renames it).
 exists ()
 Whether this node already exists in the file system.
 residesIn (spunQ_IFolder $folder)
 Checks whether this file is in given folder or one of its subfolders.
 isReadable ()
 Whether the node is readable.
 getPath ()
 Returns the path pointing to the node.
 getPrettyPath ()
 Returns the most unique and human-readable path.
 getContainingFolder ()
 Returns the folder this node is residing in.
 getName ()
 Returns the name of this node, deprived of its path.
 getLastAccessTime ()
 Returns the time of last access of this node.
 getLastModificationTime ()
 Returns the time of last modification of this node.


Detailed Description

Extension of spunQ_IFileNode with folder-specific accessors.

Definition at line 6 of file IFolder.interface.php.


Member Function Documentation

spunQ_IFolder::assureExists (  ) 

Throws an exception if this folder does not exist.

Returns:
void
Exceptions:
spunQ_IOException 

Implemented in spunQ_Folder.

spunQ_IFolder::create (  ) 

Makes sure this folder exists - creating parent folders if necessary.

Doesn't do anything if the node already exists.

Returns:
spunQ_IFolder $this

Implemented in spunQ_Folder.

spunQ_IFolder::createTemporaryFile (  ) 

Creates a temporary file in this folder.

Returns:
spunQ_IFile
Exceptions:
spunQ_IOException 

Implemented in spunQ_Folder.

spunQ_IFolder::delete (  ) 

Deletes this folder from the file system including anything in it.

Returns:
spunQ_IFolder $this

Implemented in spunQ_Folder.

spunQ_IFileNode::exists (  )  [inherited]

Whether this node already exists in the file system.

It is perfectly valid for an object to describe a non-existent node.

Returns:
bool

Implemented in spunQ_FileNode.

spunQ_IFolder::getBreadcrumbsTo ( spunQ_IFileNode node  ) 

Does the same as getPathTo(), merely the result has a different format.

Parameters:
$node Another file node.
Returns:
array<string>

Implemented in spunQ_Folder.

spunQ_IFileNode::getContainingFolder (  )  [inherited]

Returns the folder this node is residing in.

Returns:
spunQ_IFolder

Implemented in spunQ_FileNode.

spunQ_IFolder::getFile ( name  ) 

Gets a file in - or relative to - this folder.

Note that this function does not ensure that the file actually exists. This can be achieved by a later call to exists() or create().

Parameters:
$name A string describing a file relative to this folder.
Returns:
spunQ_IFile

Implemented in spunQ_Folder.

spunQ_IFolder::getFiles ( includeHidden = true  ) 

Fetches all files in this folder.

Parameters:
$includeHidden Whether hidden files should be returned, too.
See also:
isHidden()
Returns:
array

Implemented in spunQ_Folder.

spunQ_IFolder::getFilesBySuffix ( suffix,
includeHidden = true 
)

Get all files in this folder with given suffix.

Parameters:
$suffix Either a suffix string or an array of suffixes. Not dot is prepended to the suffix, so if this value is 'ml', all files ending on 'html' will match, too. Whether to return hidden files.
Returns:
array<string> Paths of the files.

Implemented in spunQ_Folder.

spunQ_IFolder::getFilesRecursive ( array $  suffixes,
&$  newest 
)

Gets all files with any of the given suffixes in the folder recursively.

This function is optimized for speed, so it will not return objects.

Parameters:
$folder The folder to search in. Sub-folders of this folder will be processed recursively.
$suffixes List of file suffixes. Any file having one of the suffixes matches and will be returned.
$newest Out-parameter containing the highest mtime (last modification time) value of all returned files and each folder that was processed in recursive calls. This value will be used to verify the validity of caches holding the result of this function.
Returns:
array<string> Absolute file paths matching the criteria given above. This is not returned as spunQ_IFile objects to avoid a performance impact due to object creation.

Implemented in spunQ_Folder.

spunQ_IFolder::getFilesWithAliasRecursive ( array $  suffixes,
&$  newest,
alias 
)

Almost the same as getFilesRecursive(), but generates aliases as well.

The alias consists of three parts, which are separated by dots:

  • a root alias part
  • a list of folder names
  • the name of the filed, stripped of the matching suffix.
So this file would have the alias 'spunQ.file.Folder', if $spunQFolder->getFilesRecursive(array('.class.php'), $newest, 'spunQ') was called.
Parameters:
$suffixes List of file suffixes. Any file having one of the suffixes matches and will be returned.
$newest Out-parameter containing the highest mtime (last modification time) value of all returned files and each folder that was processed in recursive calls. This value will be used to verify the validity of caches holding the result of this function.
$alias Alias for all files in this folder. This should be the module name, or a similar top-level string.
Returns:
array Same as getFilesRecursive(), except that the array key of each entry is the files alias.

Implemented in spunQ_Folder.

spunQ_IFolder::getFolder ( name  ) 

Gets a folder in - or relative to - this folder.

Note that this function does not ensure that the folder actually exists. This can be achieved by a later call to exists() or create().

Parameters:
$name A string describing a folder relative to this folder.
Returns:
spunQ_IFolder

Implemented in spunQ_Folder.

spunQ_IFolder::getFolders ( includeHidden = true  ) 

Fetches all sub-folders in this folder.

Parameters:
$includeHidden Whether hidden folders should be returned, too.
See also:
isHidden()
Returns:
array

Implemented in spunQ_Folder, and spunQ_SourceFolder.

spunQ_IFileNode::getLastAccessTime (  )  [inherited]

Returns the time of last access of this node.

Returns:
int The result is a unix-timestamp
Exceptions:
spunQ_IOException If the timestamp could not be read.

Implemented in spunQ_FileNode.

spunQ_IFileNode::getLastModificationTime (  )  [inherited]

Returns the time of last modification of this node.

Returns:
int The result is a unix-timestamp
Exceptions:
spunQ_IOException If the timestamp could not be read.

Implemented in spunQ_FileNode.

spunQ_IFileNode::getName (  )  [inherited]

Returns the name of this node, deprived of its path.

Returns:
string

Implemented in spunQ_FileNode.

spunQ_IFolder::getParent (  ) 

Alias for getContainingFolder().

Returns:
spunQ_IFolder

Implemented in spunQ_Folder.

spunQ_IFileNode::getPath (  )  [inherited]

Returns the path pointing to the node.

Returns:
string

Implemented in spunQ_FileNode.

spunQ_IFolder::getPathTo ( spunQ_IFileNode node  ) 

Will give the path from this folder to another file node.

Parameters:
$node Another file node.
Returns:
string

Implemented in spunQ_Folder.

spunQ_IFileNode::getPrettyPath (  )  [inherited]

Returns the most unique and human-readable path.

If the file exists, the builtin function realpath() is used. Otherwise, a better-looking path is achieved through string manipulation, i.e. '../a/../d/./' becomes '../d/'.

Returns:
string

Implemented in spunQ_FileNode.

spunQ_IFolder::isEmpty (  ) 

Checks whether this folder contains any files or folders.

Returns:
bool

Implemented in spunQ_Folder.

spunQ_IFileNode::isReadable (  )  [inherited]

Whether the node is readable.

Returns:
bool

Implemented in spunQ_FileNode.

spunQ_IFolder::moveTo ( folder,
overwrite,
newName = NULL 
)

Moves this folder into another directory (and optionally renames it).

Parameters:
$folder the folder to move to. Either a spunQ_IFolder or a string.
$overwrite Whether the destination folder should be overwritten. Warning: The destination folder will be replaced(!), not extended.
$newName The folder will be renamed, too if this is set.
Returns:
spunQ_IFolder $this

Implemented in spunQ_Folder.

spunQ_IFileNode::residesIn ( spunQ_IFolder folder  )  [inherited]

Checks whether this file is in given folder or one of its subfolders.

Parameters:
$folder The folder to test against.
Returns:
bool

Implemented in spunQ_FileNode.


The documentation for this interface was generated from the following file:

Generated on Fri Jul 1 11:12:41 2011 for spunQ3 by  doxygen 1.5.9