Completed
Push — master ( 98f502...267c50 )
by Alexpts
01:26
created

RegExpFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace PTS\Tools;
5
6
class RegExpFactory
7
{
8
    public function create(string $pattern, string $replacement = ''): callable
9
    {
10 1
        return function ($value) use ($pattern, $replacement): string {
11 1
            return preg_replace($pattern, $replacement, $value);
12 1
        };
13
    }
14
}
15