ConfigurationFilterUtil   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 24
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 1 1
A matches() 0 10 3
1
<?php
2
/*
3
 * This file is part of the Exchange Rate package, an RunOpenCode project.
4
 *
5
 * (c) 2017 RunOpenCode
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace RunOpenCode\ExchangeRate\Utils;
11
12
use RunOpenCode\ExchangeRate\Configuration;
13
14
/**
15
 * Class ConfigurationFilterUtil
16
 *
17
 * Utility to check if configuration matches filter.
18
 *
19
 * @package RunOpenCode\ExchangeRate\Utils
20
 */
21
final class ConfigurationFilterUtil
22
{
23
    use FilterUtilHelper;
24
25
    private function __construct() { /* noop */ }
26
27
    /**
28
     * Check if rate matches filters.
29
     *
30
     * @param Configuration $configuration Configuration to filter.
31
     * @param array $criteria Filter criteria.
32
     * @return bool TRUE if filter criteria is matched.
33
     */
34 4
    public static function matches(Configuration $configuration, array $criteria)
35
    {
36
        return
37 4
            self::matchesArrayCriteria('currencyCode', $configuration, $criteria)
38
            &&
39 4
            self::matchesArrayCriteria('sourceName', $configuration, $criteria)
40
            &&
41 4
            self::matchesArrayCriteria('rateType', $configuration, $criteria)
42
            ;
43
    }
44
}
45