Passed
Push — master ( 1b58c8...5bb8d0 )
by Aleksandr
02:30
created

extract_bssid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 6
dl 0
loc 11
rs 10
c 1
b 0
f 1
cc 1
nc 1
nop 2
1
<?php
2
3
if (!function_exists('extract_bssid')) {
4
    /**
5
     * Extracting bssid from passed string.
6
     *
7
     * @param string $string
8
     * @param int $matchColumn
9
     *
10
     * @return array
11
     */
12
    function extract_bssid(string $string, int $matchColumn): array
13
    {
14
        $extractedBssid = [];
15
16
        preg_match_all(
17
            '/(\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2})/',
18
            $string,
19
            $extractedBssid
20
        );
21
22
        return array_unique(array_column($extractedBssid, $matchColumn));
23
    }
24
}
25