1 | <?php |
||
13 | class MultiFileMetadataSourceImpl implements MetadataSourceInterface |
||
14 | { |
||
15 | private static $metaDataFilePrefix = PhoneNumberUtil::META_DATA_FILE_PREFIX; |
||
16 | |||
17 | /** |
||
18 | * A mapping from a region code to the PhoneMetadata for that region. |
||
19 | * @var PhoneMetadata[] |
||
20 | */ |
||
21 | private $regionToMetadataMap = array(); |
||
22 | |||
23 | /** |
||
24 | * A mapping from a country calling code for a non-geographical entity to the PhoneMetadata for |
||
25 | * that country calling code. Examples of the country calling codes include 800 (International |
||
26 | * Toll Free Service) and 808 (International Shared Cost Service). |
||
27 | * @var PhoneMetadata[] |
||
28 | */ |
||
29 | private $countryCodeToNonGeographicalMetadataMap = array(); |
||
30 | |||
31 | /** |
||
32 | * The prefix of the metadata files from which region data is loaded. |
||
33 | * @var String |
||
34 | */ |
||
35 | private $currentFilePrefix; |
||
36 | |||
37 | |||
38 | /** |
||
39 | * The metadata loader used to inject alternative metadata sources. |
||
40 | * @var MetadataLoaderInterface |
||
41 | */ |
||
42 | private $metadataLoader; |
||
43 | |||
44 | /** |
||
45 | * @param MetadataLoaderInterface $metadataLoader |
||
46 | * @param string|null $currentFilePrefix |
||
47 | */ |
||
48 | 403 | public function __construct(MetadataLoaderInterface $metadataLoader, $currentFilePrefix = null) |
|
57 | |||
58 | /** |
||
59 | * @inheritdoc |
||
60 | */ |
||
61 | 4037 | public function getMetadataForRegion($regionCode) |
|
71 | |||
72 | /** |
||
73 | * @inheritdoc |
||
74 | */ |
||
75 | 31 | public function getMetadataForNonGeographicalRegion($countryCallingCode) |
|
83 | |||
84 | /** |
||
85 | * @param string $filePrefix |
||
86 | * @param string $regionCode |
||
87 | * @param int $countryCallingCode |
||
88 | * @param MetadataLoaderInterface $metadataLoader |
||
89 | * @throws \RuntimeException |
||
90 | */ |
||
91 | 611 | public function loadMetadataFromFile($filePrefix, $regionCode, $countryCallingCode, MetadataLoaderInterface $metadataLoader) |
|
108 | |||
109 | } |
||
110 |