RockLobsterInc\FormDataTree

File::buildTree │ public static │ CF7 1.0

Creates a tree structure based on the $_FILES superglobal. A terminal node of the tree must be a File object.

Метод класса: File{}

Хуков нет.

Возвращает

array. Tree created based on $_FILES.

Использование

$result = File::buildTree(): array;

Код File::buildTree() CF7 6.2.4.1

public static function buildTree(): array
{
    static $output = [];

    if (!empty($output)) {
        return $output;
    }

    $original = $_FILES;

    foreach ($original as $name => $props) {
        $in_process_array = [];

        foreach ($props as $key => $value) {
            $in_process_array[] = scalar_to_map($key, $value);
        }

        $in_process_array = array_replace_recursive(...$in_process_array);

        $output[$name] = self::walkToFindSelf($in_process_array);
    }

    return $output;
}