Conditions | 6 |
Paths | 1 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
47 | public function at(string $date): ?RegionCurrency |
||
48 | { |
||
49 | $currencies = array_filter( |
||
50 | $this->currencies, |
||
51 | function (RegionCurrency $currency) use ($date) { |
||
52 | return $currency->tender |
||
53 | && ($currency->to === null || $currency->to >= $date) |
||
54 | && ($currency->from === null || $currency->from <= $date); |
||
55 | } |
||
56 | ); |
||
57 | |||
58 | $currencies = array_values($currencies); |
||
59 | |||
60 | return current($currencies) ?: null; |
||
61 | } |
||
63 |