function vfsStream::newDirectory
returns a new directory with given name
If the name contains slashes, a new directory structure will be created. The returned directory will always be the parent directory of this directory structure.
Parameters
string $name name of directory to create:
int $permissions permissions of directory to create:
Return value
2 calls to vfsStream::newDirectory()
- vfsStream::setup in vendor/
mikey179/ vfsstream/ src/ main/ php/ org/ bovigo/ vfs/ vfsStream.php - helper method for setting up vfsStream in unit tests
- vfsStreamWrapper::mkdir in vendor/
mikey179/ vfsstream/ src/ main/ php/ org/ bovigo/ vfs/ vfsStreamWrapper.php - creates a new directory
File
-
vendor/
mikey179/ vfsstream/ src/ main/ php/ org/ bovigo/ vfs/ vfsStream.php, line 352
Class
- vfsStream
- Some utility methods for vfsStream.
Namespace
org\bovigo\vfsCode
public static function newDirectory($name, $permissions = null) {
if ('/' === substr($name, 0, 1)) {
$name = substr($name, 1);
}
$firstSlash = strpos($name, '/');
if (false === $firstSlash) {
return new vfsStreamDirectory($name, $permissions);
}
$ownName = substr($name, 0, $firstSlash);
$subDirs = substr($name, $firstSlash + 1);
$directory = new vfsStreamDirectory($ownName, $permissions);
if (is_string($subDirs) && strlen($subDirs) > 0) {
self::newDirectory($subDirs, $permissions)->at($directory);
}
return $directory;
}