/** * Normalize the file info. * * @param SplFileInfo $file * * @return array */ protected function normalizeFileInfo(SplFileInfo $file) { if ($file->isLink()) { throw NotSupportedException::forLink($file); } $normalized = ['type' => $file->getType(), 'path' => $this->getFilePath($file)]; $normalized['timestamp'] = $file->getMTime(); if ($normalized['type'] === 'file') { $normalized['size'] = $file->getSize(); } return $normalized; }
/** * Normalize a file entry. * * @param string $item * @param string $base * * @return array normalized file array * * @throws NotSupportedException */ protected function normalizeObject($item, $base) { $systemType = $this->systemType ?: $this->detectSystemType($item); if ($systemType === 'unix') { return $this->normalizeUnixObject($item, $base); } elseif ($systemType === 'windows') { return $this->normalizeWindowsObject($item, $base); } throw NotSupportedException::forFtpSystemType($systemType); }
/** * Normalize the file info. * * @param SplFileInfo $file * * @return array */ protected function normalizeFileInfo(SplFileInfo $file) { if (!$file->isLink()) { return $this->mapFileInfo($file); } if ($this->linkHandling & self::DISALLOW_LINKS) { throw NotSupportedException::forLink($file); } }