@@ -23,13 +23,16 @@ class MaxMindDatabase extends AbstractService
23
23
public function boot ()
24
24
{
25
25
$ path = $ this ->config ('database_path ' );
26
+
26
27
// Copy test database for now
27
- if (file_exists ($ path ) === false ) {
28
+ if (is_file ($ path ) === false ) {
28
29
mkdir (str_replace ('/geoip.mmdb ' , '' , $ path ));
29
30
copy (__DIR__ . '/../../resources/geoip.mmdb ' , $ path );
30
31
}
31
32
32
- $ this ->reader = new Reader ( $ path , $ this ->config ('locales ' , ['en ' ]));
33
+ $ this ->reader = new Reader (
34
+ $ path , $ this ->config ('locales ' , ['en ' ])
35
+ );
33
36
}
34
37
35
38
/**
@@ -89,7 +92,8 @@ public function update()
89
92
* Provide a temporary directory to perform operations in and and ensure
90
93
* it is removed afterwards.
91
94
*
92
- * @param callable $callback
95
+ * @param callable $callback
96
+ *
93
97
* @return void
94
98
*/
95
99
protected function withTemporaryDirectory (callable $ callback )
@@ -112,7 +116,8 @@ protected function withTemporaryDirectory(callable $callback)
112
116
/**
113
117
* Recursively search the given archive to find the .mmdb file.
114
118
*
115
- * @param \PharData $archive
119
+ * @param \PharData $archive
120
+ *
116
121
* @return mixed
117
122
* @throws \Exception
118
123
*/
@@ -134,16 +139,17 @@ protected function findDatabaseFile($archive)
134
139
/**
135
140
* Recursively delete the given directory.
136
141
*
137
- * @param string $directory
142
+ * @param string $directory
143
+ *
138
144
* @return mixed
139
145
*/
140
146
protected function deleteDirectory (string $ directory )
141
147
{
142
- if (!file_exists ($ directory )) {
148
+ if (! file_exists ($ directory )) {
143
149
return true ;
144
150
}
145
151
146
- if (!is_dir ($ directory )) {
152
+ if (! is_dir ($ directory )) {
147
153
return unlink ($ directory );
148
154
}
149
155
@@ -152,7 +158,7 @@ protected function deleteDirectory(string $directory)
152
158
continue ;
153
159
}
154
160
155
- if (!$ this ->deleteDirectory ($ directory . DIRECTORY_SEPARATOR . $ item )) {
161
+ if (! $ this ->deleteDirectory ($ directory . DIRECTORY_SEPARATOR . $ item )) {
156
162
return false ;
157
163
}
158
164
}
0 commit comments