public function _buildFakeModule() { $location = 'temporary://fake';
if (is_dir($location)) { $ret = 0;
$output =
[];
exec('rm -Rf ' .
escapeshellarg($location),
$output,
$ret);
if ($ret != 0
) { throw new \
Exception('Error removing fake module directory.'
);
} } $files =
$this->
_getFakeModuleFiles();
$this->
_writeDirectory($location,
$files);
return $location;
} public function _writeDirectory($base,
$files =
[]) { mkdir($base);
foreach ($files as $key =>
$file) { if (is_array($file)) { $this->
_writeDirectory($base . DIRECTORY_SEPARATOR .
$key,
$file);
} else {