1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Someshwer\WorldCountries\Data; |
4
|
|
|
|
5
|
|
|
use DateTimeZone; |
6
|
|
|
use Illuminate\Support\Facades\File; |
|
|
|
|
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Author: Someshwer Bandapally |
10
|
|
|
* Date: 25-05-2018. |
11
|
|
|
* |
12
|
|
|
* This class contains all the data that need |
13
|
|
|
* to be returned up on the request. |
14
|
|
|
* |
15
|
|
|
* Class DataRepository |
16
|
|
|
*/ |
17
|
|
|
class DataRepository |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* Path to data files. |
21
|
|
|
* |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
private $base_path = __DIR__.'/../Res/'; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* This method contains countries data |
28
|
|
|
* such as all country names. |
29
|
|
|
* |
30
|
|
|
* @return array |
31
|
|
|
*/ |
32
|
|
|
public function countries() |
33
|
|
|
{ |
34
|
|
|
$path = $this->base_path.'country_names.txt'; |
35
|
|
|
|
36
|
|
|
return File::get($path); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* This method reads country ISO data from a file. |
41
|
|
|
* |
42
|
|
|
* @return mixed |
43
|
|
|
*/ |
44
|
|
|
public function countriesISOData() |
45
|
|
|
{ |
46
|
|
|
$path = $this->base_path.'country_iso.txt'; |
47
|
|
|
|
48
|
|
|
return File::get($path); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* This method reads the continents data from a file. |
53
|
|
|
* |
54
|
|
|
* @return mixed |
55
|
|
|
*/ |
56
|
|
|
public function continents() |
57
|
|
|
{ |
58
|
|
|
$path = $path = $this->base_path.'continents.txt'; |
|
|
|
|
59
|
|
|
|
60
|
|
|
return File::get($path); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Reading oceans data from a file. |
65
|
|
|
* |
66
|
|
|
* @return mixed |
67
|
|
|
*/ |
68
|
|
|
public function oceans() |
69
|
|
|
{ |
70
|
|
|
$path = $path = $this->base_path.'oceans.txt'; |
|
|
|
|
71
|
|
|
|
72
|
|
|
return File::get($path); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Reading union territories data from a file. |
77
|
|
|
* |
78
|
|
|
* @return mixed |
79
|
|
|
*/ |
80
|
|
|
public function unionTerritories() |
81
|
|
|
{ |
82
|
|
|
$path = $path = $this->base_path.'territories.txt'; |
|
|
|
|
83
|
|
|
|
84
|
|
|
return File::get($path); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Reading wonders data from a file. |
89
|
|
|
* |
90
|
|
|
* @return mixed |
91
|
|
|
*/ |
92
|
|
|
public function wonders() |
93
|
|
|
{ |
94
|
|
|
$path = $path = $this->base_path.'wonders.txt'; |
|
|
|
|
95
|
|
|
|
96
|
|
|
return File::get($path); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Reading all timezones from predefined php library. |
101
|
|
|
* |
102
|
|
|
* timezone_identifiers_list() is also returns same list of timezones. |
103
|
|
|
* It is just an alias for 'DateTimeZone::listIdentifiers(DateTimeZone::ALL)' |
104
|
|
|
* |
105
|
|
|
* @return array |
106
|
|
|
*/ |
107
|
|
|
public function timezones() |
108
|
|
|
{ |
109
|
|
|
// timezone_identifiers_list() is also returns same list of timezones. |
110
|
|
|
return DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Reading all currencies from a text file. |
115
|
|
|
* |
116
|
|
|
* @return mixed |
117
|
|
|
*/ |
118
|
|
|
public function currencies() |
119
|
|
|
{ |
120
|
|
|
$path = $path = $this->base_path.'currencies.txt'; |
|
|
|
|
121
|
|
|
|
122
|
|
|
return File::get($path); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Reading all std codes from a text file. |
127
|
|
|
* |
128
|
|
|
* @return mixed |
129
|
|
|
*/ |
130
|
|
|
public function stdCodes() |
131
|
|
|
{ |
132
|
|
|
$path = $path = $this->base_path.'std_codes.txt'; |
|
|
|
|
133
|
|
|
|
134
|
|
|
return File::get($path); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Reading all states from a text file. |
139
|
|
|
* |
140
|
|
|
* @return mixed |
141
|
|
|
*/ |
142
|
|
|
public function states() |
143
|
|
|
{ |
144
|
|
|
$path = $path = $this->base_path.'states.txt'; |
|
|
|
|
145
|
|
|
|
146
|
|
|
return File::get($path); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Reading all countries from countries helper for states. |
151
|
|
|
* |
152
|
|
|
* @return mixed |
153
|
|
|
*/ |
154
|
|
|
public function countriesHelper() |
155
|
|
|
{ |
156
|
|
|
$path = $path = $this->base_path.'countries_helper.txt'; |
|
|
|
|
157
|
|
|
|
158
|
|
|
return File::get($path); |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
public function cities() |
162
|
|
|
{ |
163
|
|
|
$path = $path = $this->base_path.'cities.txt'; |
|
|
|
|
164
|
|
|
|
165
|
|
|
return File::get($path); |
166
|
|
|
} |
167
|
|
|
} |
168
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths