class avatar extends controller

Controller for /download/avatar/{file} routes

Properties

protected service $cache from  controller
protected driver_interface $db from  controller
protected extension_guesser $extension_guesser from  controller
protected storage $storage from  controller
protected Request $symfony_request from  controller
protected config $config
protected array $allowed_extensions

Methods

__construct(service $cache, config $config, driver_interface $db, extension_guesser $extension_guesser, storage $storage, Request $symfony_request)

Constructor

Response
handle(string $file)

Handler

bool
is_allowed(string $file)

If the user is allowed to download the file

bool
file_exists(string $file)

Check if file exists

void
prepare(StreamedResponse $response, string $file)

Prepare response

void
file_gc()

Garbage Collection

string
decode_filename(string $file)

Decode avatar filename

Details

at line 47
__construct(service $cache, config $config, driver_interface $db, extension_guesser $extension_guesser, storage $storage, Request $symfony_request)

Constructor

Parameters

service $cache
config $config
driver_interface $db
extension_guesser $extension_guesser
storage $storage
Request $symfony_request

at line 57
Response handle(string $file)

Handler

Parameters

string $file

File path

Return Value

Response

a Symfony response object

Exceptions

http_exception
storage_exception

at line 67
protected bool is_allowed(string $file)

If the user is allowed to download the file

Parameters

string $file

File path

Return Value

bool

in controller at line 116
protected bool file_exists(string $file)

Check if file exists

Parameters

string $file

File path

Return Value

bool

at line 101
protected void prepare(StreamedResponse $response, string $file)

Prepare response

Parameters

StreamedResponse $response
string $file

File path

Return Value

void

Exceptions

storage_exception

in controller at line 186
protected void file_gc()

Garbage Collection

Return Value

void

at line 82
protected string decode_filename(string $file)

Decode avatar filename

Parameters

string $file Filename

Return Value

string

Filename in filesystem