PropertyFilter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A filterByProperty() 0 11 4
1
<?php
2
3
namespace CodeZero\BrowserLocale\Filters;
4
5
abstract class PropertyFilter
6
{
7
    /**
8
     * Filter by a Locale property.
9
     *
10
     * @param array $locales
11
     * @param string $property
12
     *
13
     * @return array
14
     */
15 8
    protected function filterByProperty(array $locales, $property)
16
    {
17 8
        $filtered = [];
18
19 8
        foreach ($locales as $locale) {
20 4
            if ( ! empty($locale->$property) && ! in_array($locale->$property, $filtered)) {
21 4
                $filtered[] = $locale->$property;
22
            }
23
        }
24
25 8
        return $filtered;
26
    }
27
}
28