Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. System.php

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

System::_dirToStruct()

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal