Completed
Push — master ( ec55c5...b062f4 )
by Lars
01:21
created

MaxLength   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A validate() 0 6 1
1
<?php
2
3
namespace voku\HtmlFormValidator\Rules;
4
5
use Respect\Validation\Rules\AbstractRule;
6
use Respect\Validation\Rules\Length;
7
8
class MaxLength extends AbstractRule
9
{
10
  protected $maxLength;
11
12 4
  public function __construct($maxLength = null) {
13 4
    $this->maxLength = $maxLength;
14 4
  }
15
16 4
  public function validate($input)
17
  {
18 4
    $internValidate = new Length(null, $this->maxLength);
19
20 4
    return $internValidate->validate($input);
21
  }
22
}
23