Refactor to use ItemInformativeValidatorByNameFactory.
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -36,12 +36,12 @@ abstract class InformativeValidator extends Validator {
|
||||
return $this->nextValidator->getMessage();
|
||||
}
|
||||
|
||||
public function okStatus(): array
|
||||
public function getOkStatus(): array
|
||||
{
|
||||
if(!$this->isCurrentValid())
|
||||
return ['error' => $this->message];
|
||||
|
||||
return $this->nextValidator->okStatus();
|
||||
return $this->nextValidator->getOkStatus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Validation\Messages;
|
||||
|
||||
use App\Models\Validation\Messages\BaseMessages;
|
||||
|
||||
class ItemMessagesFactory
|
||||
{
|
||||
protected array $messages = [
|
||||
'found' => 'A item with the name is valid.',
|
||||
'not_found' => 'A item with the name does not exist!!!',
|
||||
'invalid_name' => 'The item name is empty, please, write the name!!!',
|
||||
];
|
||||
|
||||
public function create()
|
||||
{
|
||||
return new BaseMessages($this->messages);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class OkInformativeValidator extends InformativeValidator {
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
public function okStatus(): array
|
||||
public function getOkStatus(): array
|
||||
{
|
||||
return ['ok' => $this->getMessage()];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user