Skip to content

Commit

Permalink
Merge pull request #11 from DavidePastore/improve-code-coverage
Browse files Browse the repository at this point in the history
Improve code coverage and use code style standard
  • Loading branch information
DavidePastore committed Jul 9, 2016
2 parents 1f88d78 + 99dfdb1 commit 3d5bc47
Show file tree
Hide file tree
Showing 3 changed files with 239 additions and 114 deletions.
45 changes: 22 additions & 23 deletions src/DavidePastore/Ipinfo/Host.php
Expand Up @@ -4,57 +4,55 @@

/**
* 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
*
* @param array $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 => ""
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.
*/
Expand All @@ -70,7 +68,7 @@ public function getIp()
{
return $this->properties[Ipinfo::IP];
}

/**
* Get the loc value.
*/
Expand All @@ -86,15 +84,15 @@ public function getOrg()
{
return $this->properties[Ipinfo::ORG];
}

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

/**
* Get the postal value.
*/
Expand All @@ -110,9 +108,10 @@ public function getRegion()
{
return $this->properties[Ipinfo::REGION];
}

/**
* Get all the properties.
*
* @return array An associative array with all the properties.
*/
public function getProperties()
Expand Down

0 comments on commit 3d5bc47

Please sign in to comment.