2010-09-23 21:46:46 +02:00
|
|
|
<?php
|
2015-06-08 16:47:14 +02:00
|
|
|
|
2015-06-08 17:09:25 +02:00
|
|
|
/*
|
|
|
|
* This file is part of Respect/Validation.
|
|
|
|
*
|
|
|
|
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
|
|
|
*
|
2019-05-23 16:21:34 +02:00
|
|
|
* For the full copyright and license information, please view the LICENSE file
|
|
|
|
* that was distributed with this source code.
|
2015-06-08 17:09:25 +02:00
|
|
|
*/
|
|
|
|
|
2017-11-19 19:01:31 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2010-09-23 21:46:46 +02:00
|
|
|
namespace Respect\Validation;
|
|
|
|
|
2018-06-01 10:34:21 +02:00
|
|
|
use Respect\Validation\Exceptions\ValidationException;
|
|
|
|
|
2012-03-23 03:53:06 +01:00
|
|
|
/** Interface for validation rules */
|
2018-11-25 17:56:04 +01:00
|
|
|
/**
|
|
|
|
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
|
|
|
* @author Henrique Moody <henriquemoody@gmail.com>
|
|
|
|
*/
|
2010-09-23 21:46:46 +02:00
|
|
|
interface Validatable
|
|
|
|
{
|
2019-02-07 21:22:10 +01:00
|
|
|
/**
|
|
|
|
* @param mixed $input
|
|
|
|
*/
|
2018-01-28 17:16:53 +01:00
|
|
|
public function assert($input): void;
|
2010-09-23 21:46:46 +02:00
|
|
|
|
2019-02-07 21:22:10 +01:00
|
|
|
/**
|
|
|
|
* @param mixed $input
|
|
|
|
*/
|
2018-01-28 16:14:00 +01:00
|
|
|
public function check($input): void;
|
2010-12-06 20:05:36 +01:00
|
|
|
|
2018-05-24 08:07:55 +02:00
|
|
|
public function getName(): ?string;
|
2011-02-07 11:52:18 +01:00
|
|
|
|
2019-02-07 21:22:10 +01:00
|
|
|
/**
|
|
|
|
* @param mixed $input
|
|
|
|
* @param mixed[] $extraParameters
|
|
|
|
*/
|
2018-08-02 11:13:48 +02:00
|
|
|
public function reportError($input, array $extraParameters = []): ValidationException;
|
2011-02-07 11:52:18 +01:00
|
|
|
|
2018-05-24 08:07:55 +02:00
|
|
|
public function setName(string $name): Validatable;
|
2011-02-06 23:21:15 +01:00
|
|
|
|
2018-06-01 10:37:45 +02:00
|
|
|
public function setTemplate(string $template): Validatable;
|
2011-04-17 17:29:48 +02:00
|
|
|
|
2019-02-07 21:22:10 +01:00
|
|
|
/**
|
|
|
|
* @param mixed $input
|
|
|
|
*/
|
2018-01-28 15:41:31 +01:00
|
|
|
public function validate($input): bool;
|
2011-02-06 23:21:15 +01:00
|
|
|
}
|