2016-08-21 04:51:39 +05:30
|
|
|
<?php
|
2019-12-04 23:40:15 +05:30
|
|
|
declare(strict_types=1);
|
|
|
|
|
2016-08-21 04:51:39 +05:30
|
|
|
namespace api\modules\authserver\validators;
|
|
|
|
|
|
|
|
use api\modules\authserver\exceptions\IllegalArgumentException;
|
|
|
|
|
|
|
|
/**
|
2019-07-15 04:29:56 +05:30
|
|
|
* For this module, it is not important for us what the error is: if at least one parameter is missing,
|
|
|
|
* we immediately throw an exception and that's it.
|
2016-08-21 04:51:39 +05:30
|
|
|
*/
|
|
|
|
class RequiredValidator extends \yii\validators\RequiredValidator {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $value
|
|
|
|
* @return null
|
|
|
|
* @throws \api\modules\authserver\exceptions\AuthserverException
|
|
|
|
*/
|
2019-12-04 23:40:15 +05:30
|
|
|
protected function validateValue($value): ?array {
|
2016-08-21 04:51:39 +05:30
|
|
|
if (parent::validateValue($value) !== null) {
|
|
|
|
throw new IllegalArgumentException();
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|