elFinderVolumeFTP::normalizeRawWindows PHP Method

normalizeRawWindows() protected method

Normalize MS-DOS style FTP LIST Raw line
Author: Naoki Sawada
protected normalizeRawWindows ( string $raw ) : array
$raw string line from FTP LIST (MS-DOS style)
return array
    protected function normalizeRawWindows($raw)
    {
        $info = array_pad(array(), 9, '');
        $item = preg_replace('#\\s+#', ' ', trim($raw), 3);
        list($date, $time, $size, $name) = explode(' ', $item, 4);
        $format = strlen($date) === 8 ? 'm-d-yH:iA' : 'Y-m-dH:i';
        $dateObj = DateTime::createFromFormat($format, $date . $time);
        $info[5] = strtotime($dateObj->format('Y-m-d H:i'));
        $info[8] = $name;
        if ($size === '<DIR>') {
            $info[4] = 0;
            $info[0] = 'drwxr-xr-x';
        } else {
            $info[4] = (int) $size;
            $info[0] = '-rw-r--r--';
        }
        return $info;
    }