class File implements ResponseSenderInterface

File response.

Properties

protected FileSystem $fileSystem File system instance.
protected string $filePath File path.
protected int $fileSize File size.
protected string $fileName File name.
protected string $disposition Content disposition.
protected string $contentType Content type.
protected Closure $callback Callback.

Methods

__construct(FileSystem $fileSystem, string $file)

Constructor.

name(string $name)

Sets the file name.

disposition(string $disposition)

Sets the content disposition.

type(string $type)

Sets the content type.

done(Closure $callback)

Sets the callback closure.

string
getName()

Returns the file name.

string
getDisposition()

Returns the content disposition.

string
getContenType()

Returns the content type.

array|false
calculateRange(string $range)

Calculates the content range that should be served.

sendFile(int $start, int $end)

Sends the file.

send(Request $request, Response $response)

Sends the response.

Details

at line 95
__construct(FileSystem $fileSystem, string $file)

Constructor.

Parameters

FileSystem $fileSystem FileSytem instance
string $file File path

at line 115
File name(string $name)

Sets the file name.

Parameters

string $name File name

Return Value

File

at line 128
File disposition(string $disposition)

Sets the content disposition.

Parameters

string $disposition Content disposition

Return Value

File

at line 141
File type(string $type)

Sets the content type.

Parameters

string $type Mime type

Return Value

File

at line 154
File done(Closure $callback)

Sets the callback closure.

Parameters

Closure $callback Callback closure

Return Value

File

at line 166
protected string getName()

Returns the file name.

Return Value

string

at line 176
protected string getDisposition()

Returns the content disposition.

Return Value

string

at line 186
protected string getContenType()

Returns the content type.

Return Value

string

at line 197
protected array|false calculateRange(string $range)

Calculates the content range that should be served.

Parameters

string $range Request range

Return Value

array|false

at line 249
protected sendFile(int $start, int $end)

Sends the file.

Parameters

int $start Starting point
int $end Ending point

at line 285
send(Request $request, Response $response)

Sends the response.

Parameters

Request $request Request instance
Response $response Response instance