Skip to content

Commit

Permalink
fixed #4
Browse files Browse the repository at this point in the history
  • Loading branch information
chaz6chez committed Jul 5, 2024
1 parent 7b83c7e commit 6a1ae6a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
*.yaml
config.reload.lock
/tests/tmp
/tests/.phpunit.result.cache
.phpunit.result.cache
composer.lock
start.php
16 changes: 16 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
bootstrap="vendor/autoload.php"
executionOrder="depends,defects"
beStrictAboutOutputDuringTests="true"
defaultTimeLimit="10"
colors="true"
testdox="true"
stopOnWarning="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
8 changes: 4 additions & 4 deletions src/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ function_exists('config') ?
$this->language = $config['language'] ?? ['en'];
$this->default = $config['default'] ?? '--';

$this->db[self::DB_COUNTRY] = $config['db-country'] ?? $this->db[self::DB_COUNTRY];
$this->db[self::DB_CITY] = $config['db-city'] ?? $this->db[self::DB_CITY];
$this->db[self::DB_ASN] = $config['db-asn'] ?? $this->db[self::DB_ASN];
$this->db[self::DB_COUNTRY] = ($config['db-country'] ?? null) ?: ($this->path . $this->db[self::DB_COUNTRY]);
$this->db[self::DB_CITY] = ($config['db-city'] ?? null) ?: ($this->path . $this->db[self::DB_CITY]);
$this->db[self::DB_ASN] = ($config['db-asn'] ?? null) ?: ($this->path . $this->db[self::DB_ASN]);
}

/**
Expand All @@ -94,7 +94,7 @@ public function createReader(string $db): Reader
}
if(!(self::$readers[$db] ?? null) instanceof Reader){
try {
self::$readers[$db] = new Reader($this->path . '/' . $this->db[$db], $this->language);
self::$readers[$db] = new Reader($this->db[$db], $this->language);
} catch (InvalidDatabaseException $e) {
throw new IpAttributionException( 'Reader Exceptions. ', -1, $e);
}
Expand Down

0 comments on commit 6a1ae6a

Please sign in to comment.