Add FileStorageConfiguration class for file storage settings
This commit is contained in:
parent
85e20d38d2
commit
3bbeb5c5f5
1 changed files with 41 additions and 0 deletions
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace FederationServer\Classes\Configuration;
|
||||||
|
|
||||||
|
class FileStorageConfiguration
|
||||||
|
{
|
||||||
|
private string $path;
|
||||||
|
private int $maxSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FileStorageConfiguration constructor.
|
||||||
|
*
|
||||||
|
* @param array $config Array with file storage configuration values.
|
||||||
|
*/
|
||||||
|
public function __construct(array $config)
|
||||||
|
{
|
||||||
|
$this->path = $config['path'] ?? '/var/www/uploads';
|
||||||
|
$this->maxSize = $config['max_size'] ?? 52428800;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the file storage path.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPath(): string
|
||||||
|
{
|
||||||
|
return $this->path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the maximum file size allowed for uploads.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getMaxSize(): int
|
||||||
|
{
|
||||||
|
return $this->maxSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue