FakeFile
extends File
in package
A file in the file system.
Table of Contents
- $realpath : mixed
- __construct() : mixed
- Constructs a new file from the given path.
- getMimeType() : string|null
- Returns the mime type of the file.
- getMTime() : mixed
- getRealpath() : mixed
- getSize() : mixed
- guessExtension() : string|null
- Returns the extension based on the mime type.
- isReadable() : mixed
- move() : self
- Moves the file to a new location.
- getName() : string
- Returns locale independent base name of the given path.
- getTargetFile() : mixed
Properties
$realpath
private
mixed
$realpath
Methods
__construct()
Constructs a new file from the given path.
public
__construct(mixed $realpath, mixed $path) : mixed
Parameters
- $realpath : mixed
- $path : mixed
-
The path to the file
Return values
mixed —getMimeType()
Returns the mime type of the file.
public
getMimeType() : string|null
The mime type is guessed using a MimeTypeGuesser instance, which uses finfo(), mime_content_type() and the system binary "file" (in this order), depending on which of those are available.
Tags
Return values
string|null —The guessed mime type (e.g. "application/pdf")
getMTime()
public
getMTime() : mixed
Return values
mixed —getRealpath()
public
getRealpath() : mixed
Return values
mixed —getSize()
public
getSize() : mixed
Return values
mixed —guessExtension()
Returns the extension based on the mime type.
public
guessExtension() : string|null
If the mime type is unknown, returns null.
This method uses the mime type as guessed by getMimeType() to guess the file extension.
Tags
Return values
string|null —The guessed extension or null if it cannot be guessed
isReadable()
public
isReadable() : mixed
Return values
mixed —move()
Moves the file to a new location.
public
move(string $directory[, string $name = null ]) : self
Parameters
- $directory : string
-
The destination folder
- $name : string = null
-
The new file name
Tags
Return values
self —A File object representing the new file
getName()
Returns locale independent base name of the given path.
protected
getName(string $name) : string
Parameters
- $name : string
-
The new file name
Return values
string —containing
getTargetFile()
protected
getTargetFile(mixed $directory[, mixed $name = null ]) : mixed
Parameters
- $directory : mixed
- $name : mixed = null