Files
2026-09-15 10:35:56 +08:00

38 lines
899 B
PHP

<?php
declare(strict_types=1);
namespace Esun\FileManager\ViewModel;
use Magento\Framework\View\Element\Block\ArgumentInterface;
use Magento\Framework\File\Size;
use Esun\FileManager\Model\Config as ModuleConfig;
class Config implements ArgumentInterface
{
public function __construct(
private readonly ModuleConfig $config,
private readonly Size $fileSize
) {
}
public function isEnabled(): bool
{
return $this->config->isEnabled();
}
public function getAllowedExtensions(): string
{
return implode(', ', $this->config->getAllowedExtensions());
}
public function getMaximumFileSizeMb(): string
{
$maximumBytes = min(
$this->config->getMaximumFileSizeBytes(),
$this->fileSize->getMaxFileSize()
);
return number_format($maximumBytes / 1024 / 1024, 2, '.', '');
}
}