RegExp   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 0
cbo 0
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFirstMatch() 0 6 2
A getAllMatch() 0 6 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: vincenzo.ciaccio
5
 * Date: 29/10/2015
6
 * Time: 16:58
7
 */
8
9
namespace App\Lib\Helpers;
10
11
12
/**
13
 * Class RegExp
14
 * @package App\Lib\Helpers
15
 */
16
class RegExp
17
{
18
    /**
19
     * @param $regexp
20
     * @param $target
21
     * @return null
22
     */
23
    public static function getFirstMatch($regexp, $target)
24
	{
25
		preg_match_all($regexp, $target, $matches);
26
		$match = array_key_exists(0,$matches[1]) ? $matches[1][0] : null;
27
		return $match;
28
	}
29
30
    /**
31
     * @param $regexp
32
     * @param $target
33
     * @return null
34
     */
35
    public static function getAllMatch($regexp, $target)
36
	{
37
		$matches = null;
38
		preg_match_all($regexp, $target, $matches);
39
		return $matches;
40
	}
41
42
}