Currencies   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
dl 0
loc 51
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getISONumber() 0 3 1
A getIndexDefinition() 0 5 1
A arrayToEntry() 0 6 1
A getByLetterCode() 0 3 1
A getByNumericCode() 0 3 1
1
<?php
2
3
namespace Sokil\IsoCodes\Database;
4
5
use Sokil\IsoCodes\AbstractDatabase;
6
use Sokil\IsoCodes\Database\Currencies\Currency;
7
8
class Currencies extends AbstractDatabase
9
{
10
    /**
11
     * @return string
12
     */
13
    public static function getISONumber()
14
    {
15
        return '4217';
16
    }
17
18
    /**
19
     * @param array $entry
20
     *
21
     * @return Currency
22
     */
23
    protected function arrayToEntry(array $entry)
24
    {
25
        return new Currency(
26
            $entry['name'],
27
            $entry['alpha_3'],
28
            (int)$entry['numeric']
29
        );
30
    }
31
32
    /**
33
     * @return array
34
     */
35
    protected function getIndexDefinition()
36
    {
37
        return [
38
            'alpha_3',
39
            'numeric'
40
        ];
41
    }
42
43
    /**
44
     * @param string $code
45
     * @return null|Currency
46
     */
47
    public function getByLetterCode($code)
48
    {
49
        return $this->find('alpha_3', $code);
50
    }
51
52
    /**
53
     * @param int $code
54
     * @return null|Currency
55
     */
56
    public function getByNumericCode($code)
57
    {
58
        return $this->find('numeric', $code);
59
    }
60
}
61