Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Torann committed Mar 9, 2020
1 parent 08e5721 commit 73f3864
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/Services/MaxMindDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ class MaxMindDatabase extends AbstractService
public function boot()
{
$path = $this->config('database_path');

// Copy test database for now
if (file_exists($path) === false) {
if (is_file($path) === false) {
mkdir(str_replace('/geoip.mmdb', '', $path));
copy(__DIR__ . '/../../resources/geoip.mmdb', $path);
}

$this->reader = new Reader( $path, $this->config('locales', ['en']));
$this->reader = new Reader(
$path, $this->config('locales', ['en'])
);
}

/**
Expand Down Expand Up @@ -89,7 +92,8 @@ public function update()
* Provide a temporary directory to perform operations in and and ensure
* it is removed afterwards.
*
* @param callable $callback
* @param callable $callback
*
* @return void
*/
protected function withTemporaryDirectory(callable $callback)
Expand All @@ -112,7 +116,8 @@ protected function withTemporaryDirectory(callable $callback)
/**
* Recursively search the given archive to find the .mmdb file.
*
* @param \PharData $archive
* @param \PharData $archive
*
* @return mixed
* @throws \Exception
*/
Expand All @@ -134,16 +139,17 @@ protected function findDatabaseFile($archive)
/**
* Recursively delete the given directory.
*
* @param string $directory
* @param string $directory
*
* @return mixed
*/
protected function deleteDirectory(string $directory)
{
if (!file_exists($directory)) {
if (! file_exists($directory)) {
return true;
}

if (!is_dir($directory)) {
if (! is_dir($directory)) {
return unlink($directory);
}

Expand All @@ -152,7 +158,7 @@ protected function deleteDirectory(string $directory)
continue;
}

if (!$this->deleteDirectory($directory . DIRECTORY_SEPARATOR . $item)) {
if (! $this->deleteDirectory($directory . DIRECTORY_SEPARATOR . $item)) {
return false;
}
}
Expand Down

0 comments on commit 73f3864

Please sign in to comment.