class Directory
Directory helper
As for all helpers, all methods are statics.
For convenience, the best practice is to use:
use Library\Helper\Directory as DirectoryHelper;
Constants
DEFAULT_UNIX_CHMOD_DIRECTORIES |
|
DEFAULT_UNIX_CHMOD_FILES |
|
Methods
static string |
slashDirname(string $dirname = null)
Get a dirname with one and only trailing slash |
|
static bool |
isGitClone(string $path = null)
Test if a path seems to be a git clone |
|
static bool |
isDotPath(string $path = null)
Test if a filename seems to have a dot as first character |
|
static bool |
ensureExists(string $path = null, int $mode = self::DEFAULT_UNIX_CHMOD_DIRECTORIES, bool $recursive = true)
Build a directory with its whole hierarchy if necessary |
|
static bool |
create(string $path = null, int $mode = self::DEFAULT_UNIX_CHMOD_DIRECTORIES, bool $recursive = true)
Create a directory if necessary |
|
static bool |
remove(string $path = null, array $logs = array())
Remove a directory with its whole contents |
|
static bool |
purge(string $path = null, array $logs = array())
Remove a directory contents but not the directory itself |
|
static bool |
chmod(string $path = null, int $mode = self::DEFAULT_UNIX_CHMOD_DIRECTORIES, bool $recursive = true, int $file_mode = self::DEFAULT_UNIX_CHMOD_FILES, array $logs = array())
Change rights on a directory |
Details
at line 56
static public string
slashDirname(string $dirname = null)
Get a dirname with one and only trailing slash
at line 70
static public bool
isGitClone(string $path = null)
Test if a path seems to be a git clone
at line 85
static public bool
isDotPath(string $path = null)
Test if a filename seems to have a dot as first character
at line 105
static public bool
ensureExists(string $path = null, int $mode = self::DEFAULT_UNIX_CHMOD_DIRECTORIES, bool $recursive = true)
Build a directory with its whole hierarchy if necessary
at line 124
static public bool
create(string $path = null, int $mode = self::DEFAULT_UNIX_CHMOD_DIRECTORIES, bool $recursive = true)
Create a directory if necessary
at line 139
static public bool
remove(string $path = null, array $logs = array())
Remove a directory with its whole contents
at line 181
static public bool
purge(string $path = null, array $logs = array())
Remove a directory contents but not the directory itself
at line 227
static public bool
chmod(string $path = null, int $mode = self::DEFAULT_UNIX_CHMOD_DIRECTORIES, bool $recursive = true, int $file_mode = self::DEFAULT_UNIX_CHMOD_FILES, array $logs = array())
Change rights on a directory