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

MaxLength::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 3
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 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