StrlenMin   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 25
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 2
1
<?php
2
/**
3
 *
4
 * This file is part of Aura for PHP.
5
 *
6
 * @license http://opensource.org/licenses/bsd-license.php BSD
7
 *
8
 */
9
namespace Aura\Filter\Rule\Validate;
10
11
use Aura\Filter\Rule\AbstractStrlen;
12
13
/**
14
 *
15
 * Validates that a value is no longer than a certain length.
16
 *
17
 * @package Aura.Filter
18
 *
19
 */
20
class StrlenMin extends AbstractStrlen
21
{
22
    /**
23
     *
24
     * Validates that a value is no longer than a certain length.
25
     *
26
     * @param object $subject The subject to be filtered.
27
     *
28
     * @param string $field The subject field name.
29
     *
30
     * @param mixed $min The value must have at least this many characters.
31
     *
32
     * @return bool True if valid, false if not.
33
     *
34
     */
35 17
    public function __invoke($subject, $field, $min)
36
    {
37 17
        $value = $subject->$field;
38 17
        if (! is_scalar($value)) {
39 1
            return false;
40
        }
41
42 16
        return $this->strlen($value) >= $min;
43
    }
44
}
45