public static function createDirectories(string $path, int $mode = 0777) : void
    {
        $exception = null;

        try {
            $success = ErrorCatcher::run(static function() use ($path, $mode) {
                return mkdir($path, $mode, true);
            });

            if ($success === true) {
                return;
            }
        } catch (\ErrorException $e) {
            $exception = $e;
        }

        if (self::isDirectory($path)) {
            return;
        }

        throw new IoException('Error creating directories ' . $path, 0, $exception);
    }
public static function createDirectories(string $path, int $mode = 0777) : void
    {
        $exception = null;

        try {
            $success = ErrorCatcher::run(static function() use ($path, $mode) {
                return mkdir($path, $mode, true);
            });

            if ($success === true) {
                return;
            }
        } catch (\ErrorException $e) {
            $exception = $e;
        }

        if (self::isDirectory($path)) {
            return;
        }

        throw new IoException('Error creating directories ' . $path, 0, $exception);
    }
public static function createDirectories ( string $ path , int $ mode = 0777 ) : void { $ exception = null ; try { $ success = ErrorCatcher :: run ( static function ( ) use ( $ path , $ mode ) { return mkdir ( $ path , $ mode , true ) ; } ) ; if ( $ success === true ) { return ; } } catch ( \ ErrorException $ e ) { $ exception = $ e ; } if ( self :: isDirectory ( $ path ) ) { return ; } throw new IoException ( 'Error creating directories ' . $ path , 0 , $ exception ) ; }
Creates a directory by creating all nonexistent parent directories first.

Unlike the `createDirectory` method, an exception is not thrown if the directory could not be created because it
already exists.

@param string $path The directory path.
@param int    $mode The access mode. The mode is 0777 by default, which means the widest possible access.

@return void

@throws IoException If an error occurs.
Creates a directory by creating all nonexistent parent directories first .