public function error($code, $desc): void
{
- $response = null;
-
- switch ($this->type) {
- case 'csv':
- $response = $this->csvError($desc);
- break;
- case 'html':
- $response = $this->htmlError($code, $desc);
- break;
- case 'json':
- $response = $this->jsonError($code, $desc);
- break;
- case 'text':
- $response = $this->textError($code, $desc);
- break;
- }
+ $response = match ($this->type) {
+ 'csv' => $this->csvError($desc),
+ 'html' => $this->htmlError($code, $desc),
+ 'json' => $this->jsonError($code, $desc),
+ 'text' => $this->textError($code, $desc),
+ };
http_response_code($code);
echo $response;
}
public function send($files): void
{
- $response = null;
-
- switch ($this->type) {
- case 'csv':
- $response = $this->csvSuccess($files);
- break;
- case 'html':
- $response = $this->htmlSuccess($files);
- break;
- case 'json':
- $response = $this->jsonSuccess($files);
- break;
- case 'text':
- $response = $this->textSuccess($files);
- break;
- }
+ $response = match ($this->type) {
+ 'csv' => $this->csvSuccess($files),
+ 'html' => $this->htmlSuccess($files),
+ 'json' => $this->jsonSuccess($files),
+ 'text' => $this->textSuccess($files),
+ };
http_response_code(200); // "200 OK". Success.
echo $response;
$this->Connector->checkFileBlacklist($this->FILE_INFO);
}
- if ($this->Connector->CONFIG['FILTER_MODE'] and empty($this->FILE_INFO['EXTENSION'])) {
+ if ($this->Connector->CONFIG['FILTER_MODE'] && empty($this->FILE_INFO['EXTENSION'])) {
$this->checkMimeBlacklist();
}
- if ($this->Connector->CONFIG['FILTER_MODE'] and !empty($this->FILE_INFO['EXTENSION'])) {
+ if ($this->Connector->CONFIG['FILTER_MODE'] && !empty($this->FILE_INFO['EXTENSION'])) {
$this->checkMimeBlacklist();
$this->checkExtensionBlacklist();
}