248 lines
No EOL
6.1 KiB
PHP
248 lines
No EOL
6.1 KiB
PHP
<?php
|
|
/**
|
|
* Classe StationFolderValidate.class.php
|
|
* @filesource
|
|
* @autor Kenio de Souza
|
|
* @copyright Copyright 2024 - Souza Consultoria Tecnológica
|
|
* @package vendor
|
|
* @subpackage controller/station_folder
|
|
* @version 1.0
|
|
* @date 07/08/2024
|
|
*/
|
|
|
|
|
|
/** Defino o local onde esta a classe */
|
|
namespace vendor\controller\station_folder;
|
|
|
|
/** Importação de classes */
|
|
use vendor\controller\main\Main;
|
|
|
|
class StationFolderValidate
|
|
{
|
|
/** Declaro as variavéis da classe */
|
|
private $Main = null;
|
|
private $errors = array();
|
|
private $info = null;
|
|
private $stationFolderId = null;
|
|
private $stationId = null;
|
|
private $folderPath = null;
|
|
private $amountOfFiles = null;
|
|
private $amountOfFilesCurrent = null;
|
|
private $dateRegister = null;
|
|
private $lastUpdate = null;
|
|
|
|
/** Construtor da classe */
|
|
function __construct()
|
|
{
|
|
|
|
/** Instânciamento da classe de validação */
|
|
$this->Main = new Main();
|
|
|
|
}
|
|
|
|
/** Método trata campo station_folder_id */
|
|
public function setStationFolderId(int $stationFolderId) : void
|
|
{
|
|
|
|
/** Trata a entrada da informação */
|
|
$this->stationFolderId = isset($stationFolderId) ? $this->Main->antiInjection($stationFolderId) : null;
|
|
|
|
/** Verifica se a informação foi informada */
|
|
if(empty($this->stationFolderId))
|
|
{
|
|
|
|
/** Adição de elemento */
|
|
array_push($this->errors, 'O campo "station_folder_id", deve ser informado');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** Método trata campo station_id */
|
|
public function setStationId(int $stationId) : void
|
|
{
|
|
|
|
/** Trata a entrada da informação */
|
|
$this->stationId = isset($stationId) ? $this->Main->antiInjection($stationId) : null;
|
|
|
|
/** Verifica se a informação foi informada */
|
|
if(empty($this->stationId))
|
|
{
|
|
|
|
/** Adição de elemento */
|
|
array_push($this->errors, 'O campo "station_id", deve ser informado');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** Método trata campo folder_path */
|
|
public function setFolderPath(string $folderPath) : void
|
|
{
|
|
|
|
/** Trata a entrada da informação */
|
|
$this->folderPath = isset($folderPath) ? $this->Main->antiInjection($folderPath) : null;
|
|
|
|
/** Verifica se a informação foi informada */
|
|
if(empty($this->folderPath))
|
|
{
|
|
|
|
/** Adição de elemento */
|
|
array_push($this->errors, 'O campo "folder_path", deve ser informado');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** Método trata campo amount_of_files */
|
|
public function setAmountOfFiles(int $amountOfFiles) : void
|
|
{
|
|
|
|
/** Trata a entrada da informação */
|
|
$this->amountOfFiles = isset($amountOfFiles) ? $this->Main->antiInjection($amountOfFiles) : null;
|
|
|
|
/** Verifica se a informação foi informada */
|
|
if(empty($this->amountOfFiles))
|
|
{
|
|
|
|
/** Adição de elemento */
|
|
array_push($this->errors, 'O campo "amount_of_files", deve ser informado');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** Método trata campo amount_of_files_current */
|
|
public function setAmountOfFilesCurrent(int $amountOfFilesCurrent) : void
|
|
{
|
|
|
|
/** Trata a entrada da informação */
|
|
$this->amountOfFilesCurrent = isset($amountOfFilesCurrent) ? $this->Main->antiInjection($amountOfFilesCurrent) : null;
|
|
|
|
/** Verifica se a informação foi informada */
|
|
if(empty($this->amountOfFilesCurrent))
|
|
{
|
|
|
|
/** Adição de elemento */
|
|
array_push($this->errors, 'O campo "amount_of_files_current", deve ser informado');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** Método trata campo date_register */
|
|
public function setDateRegister(string $dateRegister) : void
|
|
{
|
|
|
|
/** Trata a entrada da informação */
|
|
$this->dateRegister = isset($dateRegister) ? $this->Main->antiInjection($dateRegister) : null;
|
|
|
|
/** Verifica se a informação foi informada */
|
|
if(empty($this->dateRegister))
|
|
{
|
|
|
|
/** Adição de elemento */
|
|
array_push($this->errors, 'O campo "date_register", deve ser informado');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** Método trata campo last_update */
|
|
public function setLastUpdate(string $lastUpdate) : void
|
|
{
|
|
|
|
/** Trata a entrada da informação */
|
|
$this->lastUpdate = isset($lastUpdate) ? $this->Main->antiInjection($lastUpdate) : null;
|
|
|
|
/** Verifica se a informação foi informada */
|
|
if(empty($this->lastUpdate))
|
|
{
|
|
|
|
/** Adição de elemento */
|
|
array_push($this->errors, 'O campo "last_update", deve ser informado');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** Método retorna campo station_folder_id */
|
|
public function getStationFolderId() : ? int
|
|
{
|
|
|
|
/** Retorno da informação */
|
|
return (int)$this->stationFolderId;
|
|
|
|
}
|
|
|
|
/** Método retorna campo station_id */
|
|
public function getStationId() : ? int
|
|
{
|
|
|
|
/** Retorno da informação */
|
|
return (int)$this->stationId;
|
|
|
|
}
|
|
|
|
/** Método retorna campo folder_path */
|
|
public function getFolderPath() : ? string
|
|
{
|
|
|
|
/** Retorno da informação */
|
|
return (string)$this->folderPath;
|
|
|
|
}
|
|
|
|
/** Método retorna campo amount_of_files */
|
|
public function getAmountOfFiles() : ? int
|
|
{
|
|
|
|
/** Retorno da informação */
|
|
return (int)$this->amountOfFiles;
|
|
|
|
}
|
|
|
|
/** Método retorna campo amount_of_files_current */
|
|
public function getAmountOfFilesCurrent() : ? int
|
|
{
|
|
|
|
/** Retorno da informação */
|
|
return (int)$this->amountOfFilesCurrent;
|
|
|
|
}
|
|
|
|
/** Método retorna campo date_register */
|
|
public function getDateRegister() : ? string
|
|
{
|
|
|
|
/** Retorno da informação */
|
|
return (string)$this->dateRegister;
|
|
|
|
}
|
|
|
|
/** Método retorna campo last_update */
|
|
public function getLastUpdate() : ? string
|
|
{
|
|
|
|
/** Retorno da informação */
|
|
return (string)$this->lastUpdate;
|
|
|
|
}
|
|
|
|
public function getErrors(): ? string
|
|
{
|
|
|
|
/** Verifico se deve informar os erros */
|
|
if (count($this->errors)) {
|
|
|
|
/** Verifica a quantidade de erros para informar a legenda */
|
|
$this->info = count($this->errors) > 1 ? '<center>Os seguintes erros foram encontrados</center>' : '<center>O seguinte erro foi encontrado</center>';
|
|
|
|
/** Lista os erros */
|
|
foreach ($this->errors as $keyError => $error) {
|
|
|
|
/** Monto a mensagem de erro */
|
|
$this->info .= '</br>' . ($keyError + 1) . ' - ' . $error;
|
|
|
|
}
|
|
|
|
/** Retorno os erros encontrados */
|
|
return (string)$this->info;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function __destruct(){}
|
|
|
|
}
|