20 $pathinfo[
'dirname'] = array_key_exists(
'dirname', $pathinfo)
21 ? static::normalizeDirname($pathinfo[
'dirname']) :
'';
35 return $dirname ===
'.' ?
'' : $dirname;
62 foreach ($map as
$from => $to) {
63 if ( ! isset($object[
$from])) {
84 return static::normalizeRelativePath(
$path);
103 foreach (explode(
'/',
$path) as $part) {
112 'Path is outside of the defined root, path: [' .
$path .
']' 124 return implode(
'/', $parts);
137 while (preg_match(
'#\p{C}+|^\./#u',
$path)) {
138 $path = preg_replace(
'#\p{C}+|^\./#u',
'',
$path);
154 return rtrim($prefix, $separator) . $separator;
181 if ( ! (empty($mimeType) || in_array($mimeType, [
'application/x-empty',
'text/plain',
'text/x-asm']))) {
198 $listedDirectories = [];
200 foreach ($listing as $object) {
201 list($directories, $listedDirectories) = static::emulateObjectDirectories(
208 $directories = array_diff(array_unique($directories), array_unique($listedDirectories));
210 foreach ($directories as $directory) {
211 $listing[] = static::pathinfo($directory) + [
'type' =>
'dir'];
240 throw new LogicException(
'A config should either be an array or a Flysystem\Config object.');
250 if (ftell($resource) !== 0 && static::isSeekableStream($resource)) {
257 $metadata = stream_get_meta_data($resource);
271 $stat = fstat($resource);
273 return $stat[
'size'];
287 if ($object[
'type'] ===
'dir') {
288 $listedDirectories[] = $object[
'path'];
291 if (empty($object[
'dirname'])) {
292 return [$directories, $listedDirectories];
295 $parent = $object[
'dirname'];
297 while ( ! empty($parent) && ! in_array($parent, $directories)) {
298 $directories[] = $parent;
299 $parent = static::dirname($parent);
302 if (isset($object[
'type']) && $object[
'type'] ===
'dir') {
303 $listedDirectories[] = $object[
'path'];
305 return [$directories, $listedDirectories];
308 return [$directories, $listedDirectories];
static normalizePath($path)
Normalize path.
static normalizeRelativePath($path)
Normalize relative directories in a path.
static detectByFilename($filename)
static rewindStream($resource)
Rewind a stream.
static contentSize($contents)
Get content size.
static removeFunkyWhiteSpace($path)
Removes unprintable characters and invalid unicode characters.
static dirname($path)
Get a normalized dirname from a path.
static guessMimeType($path, $content)
Guess MIME Type based on the path of the file and it's content.
$metadata['__DYNAMIC:1__']
static emulateDirectories(array $listing)
Emulate directories.
static pathinfo($path)
Get normalized pathinfo.
static map(array $object, array $map)
Map result arrays.
static emulateObjectDirectories(array $object, array $directories, array $listedDirectories)
Emulate the directories of a single object.
static ensureConfig($config)
Ensure a Config instance.
static normalizeDirname($dirname)
Normalize a dirname return value.
Create styles array
The data for the language used.
static isSeekableStream($resource)
static normalizePrefix($prefix, $separator)
Normalize prefix.
static detectByContent($content)
Detects MIME Type based on given content.
static getStreamSize($resource)
Get the size of a stream.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'