Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/DavidePastore/ipinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidePastore committed Jul 8, 2016
2 parents 72287b3 + b77d478 commit 1f88d78
Show file tree
Hide file tree
Showing 3 changed files with 373 additions and 351 deletions.
206 changes: 109 additions & 97 deletions src/DavidePastore/Ipinfo/Host.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,107 +4,119 @@

/**
* Represent an host with all the details.
* @author davidepastore
* @author davidepastore
*
*/
class Host {

/**
* Contains all the properties of the host.
* @var array
*/
protected $properties;

/**
* Create an Host object with all the properties.
* @param unknown $properties
*/
public function __construct($properties = array()){
if (!$properties) {
$properties = array();
}
//Merge default values
$this->properties = array_merge(array(
Ipinfo::CITY => "",
Ipinfo::COUNTRY => "",
Ipinfo::HOSTNAME => "",
Ipinfo::IP => "",
Ipinfo::LOC => "",
Ipinfo::ORG => "",
Ipinfo::PHONE => "",
Ipinfo::POSTAL => "",
Ipinfo::REGION => ""
), $properties);
}

/**
* Get the city value.
*/
public function getCity(){
return $this->properties[Ipinfo::CITY];
}

/**
* Get the country value.
*/
public function getCountry(){
return $this->properties[Ipinfo::COUNTRY];
}

/**
* Get the hostname value.
*/
public function getHostname(){
return $this->properties[Ipinfo::HOSTNAME];
}
class Host
{

/**
* Contains all the properties of the host.
* @var array
*/
protected $properties;

/**
* Create an Host object with all the properties.
* @param unknown $properties
*/
public function __construct($properties = array())
{
if (!$properties) {
$properties = array();
}
//Merge default values
$this->properties = array_merge(array(
Ipinfo::CITY => "",
Ipinfo::COUNTRY => "",
Ipinfo::HOSTNAME => "",
Ipinfo::IP => "",
Ipinfo::LOC => "",
Ipinfo::ORG => "",
Ipinfo::PHONE => "",
Ipinfo::POSTAL => "",
Ipinfo::REGION => ""
), $properties);
}

/**
* Get the city value.
*/
public function getCity()
{
return $this->properties[Ipinfo::CITY];
}

/**
* Get the country value.
*/
public function getCountry()
{
return $this->properties[Ipinfo::COUNTRY];
}

/**
* Get the hostname value.
*/
public function getHostname()
{
return $this->properties[Ipinfo::HOSTNAME];
}

/**
* Get the ip value.
*/
public function getIp(){
return $this->properties[Ipinfo::IP];
}

/**
* Get the loc value.
*/
public function getLoc(){
return $this->properties[Ipinfo::LOC];
}
/**
* Get the ip value.
*/
public function getIp()
{
return $this->properties[Ipinfo::IP];
}

/**
* Get the loc value.
*/
public function getLoc()
{
return $this->properties[Ipinfo::LOC];
}

/**
* Get the org value.
*/
public function getOrg(){
return $this->properties[Ipinfo::ORG];
}

/**
* Get the phone value.
*/
public function getPhone(){
return $this->properties[Ipinfo::PHONE];
}
/**
* Get the org value.
*/
public function getOrg()
{
return $this->properties[Ipinfo::ORG];
}

/**
* Get the postal value.
*/
public function getPostal(){
return $this->properties[Ipinfo::POSTAL];
}
* Get the phone value.
*/
public function getPhone()
{
return $this->properties[Ipinfo::PHONE];
}

/**
* Get the postal value.
*/
public function getPostal()
{
return $this->properties[Ipinfo::POSTAL];
}

/**
* Get the region value.
*/
public function getRegion(){
return $this->properties[Ipinfo::REGION];
}

/**
* Get all the properties.
* @return array An associative array with all the properties.
*/
public function getProperties(){
return $this->properties;
}
}
/**
* Get the region value.
*/
public function getRegion()
{
return $this->properties[Ipinfo::REGION];
}

/**
* Get all the properties.
* @return array An associative array with all the properties.
*/
public function getProperties()
{
return $this->properties;
}
}
Loading

0 comments on commit 1f88d78

Please sign in to comment.