Util
in package
Table of Contents
- contentSize() : int
- Get content size.
- dirname() : string
- Get a normalized dirname from a path.
- emulateDirectories() : array<string|int, mixed>
- Emulate directories.
- ensureConfig() : Config
- Ensure a Config instance.
- getStreamSize() : int|null
- Get the size of a stream.
- guessMimeType() : string|null
- Guess MIME Type based on the path of the file and it's content.
- isSeekableStream() : mixed
- map() : array<string|int, mixed>
- Map result arrays.
- normalizeDirname() : string
- Normalize a dirname return value.
- normalizePath() : string
- Normalize path.
- normalizePrefix() : string
- Normalize prefix.
- normalizeRelativePath() : string
- Normalize relative directories in a path.
- pathinfo() : array<string|int, mixed>
- Get normalized pathinfo.
- rewindStream() : mixed
- Rewind a stream.
- emulateObjectDirectories() : array<string|int, mixed>
- Emulate the directories of a single object.
- removeFunkyWhiteSpace() : string
- Rejects unprintable characters and invalid unicode characters.
- basename() : string
- Returns the trailing name component of the path.
Methods
contentSize()
Get content size.
public
static contentSize(string $contents) : int
Parameters
- $contents : string
Return values
int —content size
dirname()
Get a normalized dirname from a path.
public
static dirname(string $path) : string
Parameters
- $path : string
Return values
string —dirname
emulateDirectories()
Emulate directories.
public
static emulateDirectories(array<string|int, mixed> $listing) : array<string|int, mixed>
Parameters
- $listing : array<string|int, mixed>
Return values
array<string|int, mixed> —listing with emulated directories
ensureConfig()
Ensure a Config instance.
public
static ensureConfig(null|array<string|int, mixed>|Config $config) : Config
Parameters
- $config : null|array<string|int, mixed>|Config
Tags
Return values
Config —config instance
getStreamSize()
Get the size of a stream.
public
static getStreamSize(resource $resource) : int|null
Parameters
- $resource : resource
Return values
int|null —stream size
guessMimeType()
Guess MIME Type based on the path of the file and it's content.
public
static guessMimeType(string $path, string|resource $content) : string|null
Parameters
- $path : string
- $content : string|resource
Return values
string|null —MIME Type or NULL if no extension detected
isSeekableStream()
public
static isSeekableStream(mixed $resource) : mixed
Parameters
- $resource : mixed
Return values
mixed —map()
Map result arrays.
public
static map(array<string|int, mixed> $object, array<string|int, mixed> $map) : array<string|int, mixed>
Parameters
- $object : array<string|int, mixed>
- $map : array<string|int, mixed>
Return values
array<string|int, mixed> —mapped result
normalizeDirname()
Normalize a dirname return value.
public
static normalizeDirname(string $dirname) : string
Parameters
- $dirname : string
Return values
string —normalized dirname
normalizePath()
Normalize path.
public
static normalizePath(string $path) : string
Parameters
- $path : string
Tags
Return values
string —normalizePrefix()
Normalize prefix.
public
static normalizePrefix(string $prefix, string $separator) : string
Parameters
- $prefix : string
- $separator : string
Return values
string —normalized path
normalizeRelativePath()
Normalize relative directories in a path.
public
static normalizeRelativePath(string $path) : string
Parameters
- $path : string
Tags
Return values
string —pathinfo()
Get normalized pathinfo.
public
static pathinfo(string $path) : array<string|int, mixed>
Parameters
- $path : string
Return values
array<string|int, mixed> —pathinfo
rewindStream()
Rewind a stream.
public
static rewindStream(resource $resource) : mixed
Parameters
- $resource : resource
Return values
mixed —emulateObjectDirectories()
Emulate the directories of a single object.
protected
static emulateObjectDirectories(array<string|int, mixed> $object, array<string|int, mixed> $directories, array<string|int, mixed> $listedDirectories) : array<string|int, mixed>
Parameters
- $object : array<string|int, mixed>
- $directories : array<string|int, mixed>
- $listedDirectories : array<string|int, mixed>
Return values
array<string|int, mixed> —removeFunkyWhiteSpace()
Rejects unprintable characters and invalid unicode characters.
protected
static removeFunkyWhiteSpace(string $path) : string
Parameters
- $path : string
Return values
string —$path
basename()
Returns the trailing name component of the path.
private
static basename(string $path) : string
Parameters
- $path : string