protected static function vfsStream::addStructure in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/vfsStream.php \org\bovigo\vfs\vfsStream::addStructure()
helper method to create subdirectories recursively
Parameters
array $structure subdirectory structure to add:
vfsStreamDirectory $baseDir directory to add the structure to:
Return value
1 call to vfsStream::addStructure()
- vfsStream::create in vendor/
mikey179/ vfsStream/ src/ main/ php/ org/ bovigo/ vfs/ vfsStream.php - creates vfsStream directory structure from an array and adds it to given base dir
File
- vendor/
mikey179/ vfsStream/ src/ main/ php/ org/ bovigo/ vfs/ vfsStream.php, line 221
Class
- vfsStream
- Some utility methods for vfsStream.
Namespace
org\bovigo\vfsCode
protected static function addStructure(array $structure, vfsStreamDirectory $baseDir) {
foreach ($structure as $name => $data) {
$name = (string) $name;
if (is_array($data) === true) {
self::addStructure($data, self::newDirectory($name)
->at($baseDir));
}
elseif (is_string($data) === true) {
$matches = null;
preg_match('/^\\[(.*)\\]$/', $name, $matches);
if ($matches !== array()) {
self::newBlock($matches[1])
->withContent($data)
->at($baseDir);
}
else {
self::newFile($name)
->withContent($data)
->at($baseDir);
}
}
}
return $baseDir;
}