public static function create(array $structure, vfsStreamDirectory $baseDir = null): vfsStreamDirectory
    {
        if (null === $baseDir) {
            $baseDir = vfsStreamWrapper::getRoot();
        }

        if (null === $baseDir) {
            throw new \InvalidArgumentException('No baseDir given and no root directory set.');
        }

        return self::addStructure($structure, $baseDir);
    }
public static function create(array $structure, vfsStreamDirectory $baseDir = null): vfsStreamDirectory
    {
        if (null === $baseDir) {
            $baseDir = vfsStreamWrapper::getRoot();
        }

        if (null === $baseDir) {
            throw new \InvalidArgumentException('No baseDir given and no root directory set.');
        }

        return self::addStructure($structure, $baseDir);
    }
public static function create ( array $ structure , vfsStreamDirectory $ baseDir = null ) : vfsStreamDirectory { if ( null === $ baseDir ) { $ baseDir = vfsStreamWrapper :: getRoot ( ) ; } if ( null === $ baseDir ) { throw new \ InvalidArgumentException ( 'No baseDir given and no root directory set.' ) ; } return self :: addStructure ( $ structure , $ baseDir ) ; }
creates vfsStream directory structure from an array and adds it to given base dir

Assumed $structure contains an array like this:
<code>
array('Core' = array('AbstractFactory' => array('test.php'    => 'some text content',
'other.php'   => 'Some more text content',
'Invalid.csv' => 'Something else',
),
'AnEmptyFolder'   => array(),
'badlocation.php' => 'some bad content',
)
)
</code>
the resulting directory tree will look like this:
<pre>
baseDir
\- Core
|- badlocation.php
|- AbstractFactory
| |- test.php
| |- other.php
| \- Invalid.csv
\- AnEmptyFolder
</pre>
Arrays will become directories with their key as directory name, and
strings becomes files with their key as file name and their value as file
content.

If no baseDir is given it will try to add the structure to the existing
root directory without replacing existing childs except those with equal
names.

@param   array                    $structure  directory structure to add under root directory
@param   vfsStreamDirectory|null  $baseDir    base directory to add structure to
@return  vfsStreamDirectory
@throws  \InvalidArgumentException
@since   0.10.0
@see     https://github.com/mikey179/vfsStream/issues/14
@see     https://github.com/mikey179/vfsStream/issues/20
creates vfsStream directory structure from an array and adds it to given base dir