Class Folder
Folder structure browser, lists folders and files.
Provides an Object interface for Common directory related tasks. Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
Licensed under The MIT License For full copyright and license information, please see the LICENSE.txt Redistributions of files must retain the above copyright notice.
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Since: 0.2.9
Link: http://book.cakephp.org/3.0/en/core-libraries/file-folder.html#folder-api
Located at Liberty/Folder.php
public
|
#
__construct( string|null $path = null, boolean $create = false, integer|boolean $mode = false )
Constructor. |
public
string
|
|
public
string|boolean
|
|
public
array
|
#
read( string|boolean $sort =
Returns an array of the contents of the current directory. The returned array holds two arrays: One of directories and one of files. |
public
array
|
|
public
array
|
#
findRecursive( string $pattern = '.*', boolean $sort = false )
Returns an array of all matching files in and below current directory. |
protected
array
|
#
_findRecursive( string $pattern, boolean $sort = false )
Private helper function for findRecursive. |
public static
boolean
|
|
public static
boolean
|
|
public static
boolean
|
#
isRegisteredStreamWrapper( string $path )
Returns true if given $path is a registered stream wrapper. |
public static
string
|
#
normalizePath( string $path )
Returns a correct set of slashes for given $path. (\ for Windows paths and / for other paths.) |
public static
string
|
#
correctSlashFor( string $path )
Returns a correct set of slashes for given $path. (\ for Windows paths and / for other paths.) |
public static
string
|
|
public static
string
|
#
addPathElement( string $path, string|array $element )
Returns $path with $element added, with correct slash in-between. |
public
boolean
|
|
public
boolean
|
|
public
array
|
#
subdirectories( string|null $path = null, boolean $fullPath = true )
Returns an array of subdirectories for the provided or current path. |
public
array
|
|
public
boolean
|
|
public
integer
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
array
|
|
public
array
|
|
public
string|boolean
|
|
public static
boolean
|
#
isSlashTerm( string $path )
Returns true if given $path ends in a slash (i.e. is slash-terminated). |
string |
MERGE
Default scheme for Folder::copy Recursively merges subfolders with the same name |
#
'merge'
|
string |
OVERWRITE
Overwrite scheme for Folder::copy subfolders with the same name will be replaced |
#
'overwrite'
|
string |
SKIP
Skip scheme for Folder::copy if a subfolder with the same name exists it will be skipped |
#
'skip'
|
string |
SORT_NAME
Sort mode by name |
#
'name'
|
string |
SORT_TIME
Sort mode by time |
#
'time'
|
public
string
|
$path
Path to Folder. |
|
public
boolean
|
$sort
Sortedness. Whether or not list results should be sorted by name. |
#
false
|
public
integer
|
$mode
Mode to be used on create. Does nothing on windows platforms. |
#
0755
|
protected
array
|
$_fsorts
Functions array to be called depending on the sort type chosen. |
#
[
self::SORT_NAME => 'getPathname',
self::SORT_TIME => 'getCTime'
]
|
protected
array
|
$_messages
Holds messages from last method. |
#
[]
|
protected
array
|
$_errors
Holds errors from last method. |
#
[]
|
protected
array
|
$_directories
Holds array of complete directory paths. |
|
protected
array
|
$_files
Holds array of complete file paths. |