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 Filename.
protected string $disposition Content disposition.
protected string $contentType Content type.
protected Closure $callback Callback.

Methods

__construct(FileSystem $fileSystem, string $file)

Constructor.

setName(string $name)

Sets the filename.

setDisposition(string $disposition)

Sets the content disposition.

setType(string $type)

Sets the response content type.

done(Closure $callback)

Sets the callback closure.

string
getName()

Returns the filename.

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 setName(string $name)

Sets the filename.

Parameters

string $name Filename

Return Value

File

at line 128
File setDisposition(string $disposition)

Sets the content disposition.

Parameters

string $disposition Content disposition

Return Value

File

at line 141
File setType(string $type)

Sets the response 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 filename.

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