/home/techb158/exp.abdallabala.com/vendor/respect/validation/library/Rules
Edit: /home/techb158/exp.abdallabala.com/vendor/respect/validation/library/Rules/Optional.php (1068B)
*
* For the full copyright and license information, please view the "LICENSE.md"
* file that was distributed with this source code.
*/
namespace Respect\Validation\Rules;
use Respect\Validation\Validatable;
class Optional extends AbstractWrapper
{
public function __construct(Validatable $rule)
{
$this->validatable = $rule;
}
private function isOptional($input)
{
return in_array($input, [null, ''], true);
}
public function assert($input)
{
if ($this->isOptional($input)) {
return true;
}
return parent::assert($input);
}
public function check($input)
{
if ($this->isOptional($input)) {
return true;
}
return parent::check($input);
}
public function validate($input)
{
if ($this->isOptional($input)) {
return true;
}
return parent::validate($input);
}
}