for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author: Abdul Qureshi. <[email protected]>
*
* This file has been modified from the original source.
* See original here:
* @link: https://github.com/progsmile/request-validator
*/
namespace TheSupportGroup\Common\Validator\Rules;
use TheSupportGroup\Common\Validator\Contracts\Rules\RuleInterface;
class Size extends BaseRule implements RuleInterface
{
public function isValid()
if ($this->isNotRequiredAndEmpty()) {
return true;
}
$value = trim($this->getParams()[1]);
return mb_strlen($value) == $this->getParams()[2];
* Returns error message from rule.
* @return string
public function getMessage()
return 'Field :field: should has exact size :param:';