Pop\Geo\Geo::isDbAvailable PHP Method

isDbAvailable() public method

Get an available database
public isDbAvailable ( string $name ) : boolean
$name string
return boolean
    public function isDbAvailable($name)
    {
        $key = strtolower($name);
        if (array_key_exists($key, $this->databases)) {
            return $this->databases[$key];
        } else {
            return false;
        }
    }

Usage Example

Example #1
0
 public function testGetDatabases()
 {
     if (function_exists('geoip_db_get_all_info')) {
         $g = new Geo(array('host' => 'www.google.com'));
         $this->assertEquals(10, count($g->getDatabases()));
         $this->assertTrue(is_bool($g->isDbAvailable('asnum')));
         $this->assertFalse($g->isDbAvailable('bogus'));
     }
 }