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

ConvertHelper_URLFinder_Detector_IPV4::detect()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 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