Preg   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 18
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A match() 0 10 2
1
<?php
2
3
/* this file is part of pipelines */
4
5
namespace Ktomk\Pipelines;
6
7
use UnexpectedValueException;
8
9
/**
10
 * Class Preg
11
 *
12
 * @package Ktomk\Pipelines
13
 */
14
abstract class Preg
15
{
16
    /**
17
     * @param string $pattern
18
     * @param string $subject
19
     *
20
     * @return int
21
     */
22 2
    public static function match($pattern, $subject)
23
    {
24 2
        $result = @preg_match($pattern, $subject);
25 2
        if (false === $result) {
26 1
            throw new UnexpectedValueException(
27 1
                sprintf('preg_match error (%d): "%s"', preg_last_error(), $pattern)
28
            );
29
        }
30
31 1
        return $result;
32
    }
33
}
34