for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Fiv\Form\Validator;
/**
* @author Ivan Shcherbak <[email protected]>
*/
class In extends BaseValidator {
* @var string
protected $error = 'Invalid value';
* @var array
protected $values = [];
* @param array $values
* @return $this
public function setValues($values) {
$this->values = $values;
return $this;
}
* @param string $error
public function setError($error) {
$this->error = $error;
* @param string $value
* @return bool
public function isValid($value) {
$this->errors = [];
if (in_array($value, $this->values)) {
return true;
$this->addError($this->error);
return false;