for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Kontrolio\Rules\Core;
use Kontrolio\Rules\AbstractRule;
/**
* Class IsIn
* @package Kontrolio\Rules\Core
* @author maximkou <[email protected]>
*/
class IsIn extends AbstractRule
{
* @var bool
protected $strictCompare;
* @var array
protected $haystack;
* IsIn constructor.
* @param array $haystack
* @param bool $strictCompare
public function __construct(array $haystack = [], $strictCompare = true)
$this->haystack = $haystack;
$this->strictCompare = $strictCompare;
}
* @inheritdoc
public function isValid($input = null)
return in_array($input, $this->haystack, $this->strictCompare);