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