File "MaxRule.php"
Full Path: /home/warrior1/public_html/languages/wp-content-20241001222009/plugins/file-manager/vendor/bitapps/wp-validator/src/Rules/MaxRule.php
File size: 757 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
namespace BitApps\WPValidator\Rules;
use BitApps\WPValidator\Helpers;
use BitApps\WPValidator\Rule;
class MaxRule extends Rule
{
use Helpers;
protected $message = "The :attribute may not be greater than :max characters";
protected $requireParameters = ['max'];
public function validate($value)
{
$this->checkRequiredParameter($this->requireParameters);
$max = (int) $this->getParameter('max');
$length = $this->getValueLength($value);
if ($length) {
return $length <= $max;
}
return false;
}
public function getParamKeys()
{
return $this->requireParameters;
}
public function message()
{
return $this->message;
}
}