Completed
Push — master ( aca90e...8ef0e7 )
by Alejandro
10s
created

InputFactoryTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 10
c 0
b 0
f 0
ccs 6
cts 6
cp 1
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A createInput() 0 8 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Shlinkio\Shlink\Core\Validation;
5
6
use Zend\Filter\StringTrim;
7
use Zend\Filter\StripTags;
8
use Zend\InputFilter\Input;
9
10
trait InputFactoryTrait
11
{
12 7
    public function createInput($name, $required = true): Input
13
    {
14 7
        $input = new Input($name);
15 7
        $input->setRequired($required)
16 7
              ->getFilterChain()->attach(new StripTags())
17 7
                                ->attach(new StringTrim());
18 7
        return $input;
19
    }
20
}
21