/** * Returns all filenames of all (direct) children. * * @param string $pathname The full abstracted pathname * @param string $local The adapter local path * @return array<Filicious\File> * @throws FileStateException If the file does not exists or is not a * directory * @throws AdapterException If the access to the underlying filesystem fails * due to technical reasons like connection problems or timeouts */ public function ls(Pathname $pathname) { $files = $this->getConnection()->nlist($this->getBasepath() . $pathname->local()); natcasesort($files); return array_values(array_filter($files, function ($file) { return $file !== '.' && $file !== '..'; })); }
/** * {@inheritdoc} */ public function exists(Pathname $pathname) { try { $exists = file_exists($this->getBasePath() . $pathname->local()); } catch (\ErrorException $e) { throw new AdapterException(sprintf('Could not get exists state of %s', $pathname), $e->getCode(), $e); } return $exists; }