Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. vfsStream.php

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

vfsStreamDirectory

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\vfs

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal