for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Quantum PHP Framework
*
* An open source software development framework for PHP
* @package Quantum
* @author Arman Ag. <[email protected]>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 2.9.8
*/
namespace Quantum\Libraries\Validation\Traits;
* Trait Length
* @package Quantum\Libraries\Validation\Rules
trait Length
{
* Checks the min Length
* @param string $field
* @param string $value
* @param int $minLength
* @return bool
protected function minLen(string $field, string $value, int $minLength): bool
$field
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
protected function minLen(/** @scrutinizer ignore-unused */ string $field, string $value, int $minLength): bool
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return mb_strlen($value) >= $minLength;
}
* Checks the max Length
* @param int $maxLength
protected function maxLen(string $field, string $value, int $maxLength): bool
protected function maxLen(/** @scrutinizer ignore-unused */ string $field, string $value, int $maxLength): bool
return mb_strlen($value) <= $maxLength;
* Checks the exact length
* @param int $exactLength
protected function exactLen(string $field, string $value, int $exactLength): bool
protected function exactLen(/** @scrutinizer ignore-unused */ string $field, string $value, int $exactLength): bool
return mb_strlen($value) === $exactLength;
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.