Passed
Push — master ( 707ddf...aa8b2f )
by Sebastian
04:56
created

ConvertHelper_URLFinder_Detector_IPV4   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 7
c 1
b 0
f 0
dl 0
loc 23
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getRunPosition() 0 3 1
A filterSubject() 0 3 1
A detect() 0 6 1
A isValidFor() 0 3 1
1
<?php
2
/**
3
 * File containing the class {@see ConvertHelper_URLFinder_Detector_IPV4}.
4
 *
5
 * @package AppUtils
6
 * @subpackage URLInfo
7
 * @see ConvertHelper_URLFinder_Detector_IPV4
8
 */
9
10
declare(strict_types=1);
11
12
namespace AppUtils;
13
14
/**
15
 *
16
 * @package AppUtils
17
 * @subpackage URLInfo
18
 * @author Sebastian Mordziol <[email protected]>
19
 */
20
class ConvertHelper_URLFinder_Detector_IPV4 extends ConvertHelper_URLFinder_Detector
21
{
22
    public function getRunPosition() : string
23
    {
24
        return self::RUN_AFTER;
25
    }
26
27
    public function isValidFor(string $subject) : bool
28
    {
29
        return true;
30
    }
31
32
    protected function filterSubject(string $subject) : string
33
    {
34
        return $subject;
35
    }
36
37
    protected function detect(string $subject) : array
38
    {
39
        $matches = array();
40
        preg_match_all(RegexHelper::REGEX_IPV4, $subject, $matches, PREG_PATTERN_ORDER);
41
42
        return array_unique($matches[0]);
43
    }
44
}
45