function System::_multipleToStruct
Creates a nested array representing the structure of a directory and files
@static
Parameters
array $files Array listing files and dirs:
Return value
array
See also
1 call to System::_multipleToStruct()
- System::rm in vendor/
pear/ pear-core-minimal/ src/ System.php - The rm command for removing files. Supports multiple files and dirs and also recursive deletes
File
-
vendor/
pear/ pear-core-minimal/ src/ System.php, line 184
Class
- System
- System offers cross platform compatible system functions
Code
protected static function _multipleToStruct($files) {
$struct = array(
'dirs' => array(),
'files' => array(),
);
settype($files, 'array');
foreach ($files as $file) {
if (is_dir($file) && !is_link($file)) {
$tmp = System::_dirToStruct($file, 0);
$struct = array_merge_recursive($tmp, $struct);
}
else {
if (!in_array($file, $struct['files'])) {
$struct['files'][] = $file;
}
}
}
return $struct;
}