Skip to content

Instantly share code, notes, and snippets.

@julianobailao
Created August 31, 2016 18:39
Show Gist options
  • Save julianobailao/bee3f95852bc60741c0f5a56890a59b4 to your computer and use it in GitHub Desktop.
Save julianobailao/bee3f95852bc60741c0f5a56890a59b4 to your computer and use it in GitHub Desktop.
Address class
<?php
class Address
{
protected $street;
protected $number;
protected $city;
protected $state;
/**
* Create a new address instance.
*
* @param string $streetVal
* @param string $numberVal
* @param string $cityVal
* @param string $stateVal
*/
public function __construct($streetVal, $numberVal, $cityVal, $stateVal)
{
$this->street = $streetVal;
$this->number = $numberVal;
$this->city = $cityVal;
$this->state = $stateVal;
}
/**
* Gets the full address text.
*
* @return string
*/
public function getFullAddressText()
{
return vsprintf('%s, %s - $s - %s', get_object_vars($this));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment