protected function normalizeObject($object, $path = null) { $result = array('path' => $path ?: ltrim($object['path'], '/')); if (isset($object['modified'])) { $result['timestamp'] = strtotime($object['modified']); } $result = array_merge($result, Util::map($object, static::$resultMap)); $result['type'] = $object['is_dir'] ? 'dir' : 'file'; return $result; }
public function getMetadata($path) { $connection = $this->getConnection(); $info = $connection->stat($path); if ($info === false) { return false; } $result = Util::map($info, $this->statMap); $result['type'] = $info['type'] === NET_SFTP_TYPE_DIRECTORY ? 'dir' : 'file'; $result['visibility'] = $info['permissions'] & $this->permPublic ? 'public' : 'private'; return $result; }
protected function normalizeObject(array $object) { if (substr($object['name'], -1) === '/') { return array('path' => trim($object['name'], '/'), 'type' => 'dir'); } $result = array('type' => 'file'); return array_merge($result, Util::map($object, static::$resultMap)); }
/** * Normalize a result from AWS * * @param string $object * @param string $path * @return array file metadata */ protected function normalizeObject($object, $path = null) { $result = array('path' => $path ?: $object['Key']); if (isset($object['LastModified'])) { $result['timestamp'] = strtotime($object['LastModified']); } if (substr($result['path'], -1) === '/') { $result['type'] = 'dir'; $result['path'] = rtrim($result['path'], '/'); $result['dirname'] = Util::dirname($result['path']); return $result; } $result = array_merge($result, Util::map($object, static::$resultMap), array('type' => 'file')); $result['dirname'] = Util::dirname($result['path']); if (isset($result['contents'])) { $result['contents'] = (string) $result['contents']; } return $result; }
protected function normalizeObject($object, $path) { if (!isset($object['{DAV:}getcontentlength'])) { return array('type' => 'dir', 'path' => trim($path, '/')); } $result = Util::map($object, static::$resultMap); if (isset($object['{DAV:}getlastmodified'])) { $result['timestamp'] = strtotime($object['{DAV:}getlastmodified']); } $result['type'] = 'file'; $result['path'] = trim($path, '/'); return $result; }