public function parseDir($output, $basePath) { //last line is used space array_pop($output); $regex = '/^\\s*(.*?)\\s\\s\\s\\s+(?:([NDHARS]*)\\s+)?([0-9]+)\\s+(.*)$/'; //2 spaces, filename, optional type, size, date $content = array(); foreach ($output as $line) { if (preg_match($regex, $line, $matches)) { list(, $name, $mode, $size, $time) = $matches; if ($name !== '.' and $name !== '..') { $mode = $this->parseMode($mode); $time = strtotime($time . ' ' . $this->timeZoneProvider->get()); $content[] = new FileInfo($basePath . '/' . $name, $name, $size, $time, $mode); } } } return $content; }
/** * @return string */ public function getTimeZone() { return $this->timezoneProvider->get(); }