Completed
Push — master ( 862be6...6b5941 )
by Nikola
50:19 queued 47:05
created

ConfigurationFilterUtil   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 24
rs 10

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) 2016 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() { }
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
    public static function matches(Configuration $configuration, array $criteria)
35
    {
36
        return
37
            self::matchesArrayCriteria('currencyCode', $configuration, $criteria)
38
            &&
39
            self::matchesArrayCriteria('sourceName', $configuration, $criteria)
40
            &&
41
            self::matchesArrayCriteria('rateType', $configuration, $criteria)
42
            ;
43
    }
44
}
45