Refactor to use InformativeValidators instead of ModelValidation.
continuous-integration/drone/push Build is failing

This commit is contained in:
2023-09-08 13:51:31 +03:00
parent 5c40bc6bf3
commit cdf26ca9a9
10 changed files with 3 additions and 252 deletions
@@ -1,25 +0,0 @@
<?php
namespace App\Models\Validation\Messages;
use App\Models\Validation\ValidationStatus;
class BaseMessages
{
protected array $messages;
public function __construct($messages)
{
$this->messages = $messages;
}
public function getMessage($status): string
{
return match($status)
{
ValidationStatus::FOUND => $this->messages['found'],
ValidationStatus::NOT_FOUND => $this->messages['not_found'],
ValidationStatus::INVALID_NAME => $this->messages['invalid_name'],
};
}
}
@@ -1,20 +0,0 @@
<?php
namespace App\Models\Validation\Messages;
use App\Models\Validation\Messages\BaseMessages;
class CityMessagesFactory
{
protected array $messages = [
'found' => 'A city with the name is valid.',
'not_found' => 'A city with the name does not exist!!!',
'invalid_name' => 'The city name is empty, please, write the name!!!',
];
public function create()
{
return new BaseMessages($this->messages);
}
}