for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace LAShowroom\TaxJarBundle\Model;
class Address
{
/**
* @var string
*/
private $street;
private $city;
private $state;
private $zip;
private $country;
* @param string $street
* @param string $city
* @param string $state
* @param string $zip
* @param string $country
public function __construct($street, $city, $state, $zip, $country)
$this->street = $street;
$this->city = $city;
$this->state = $state;
$this->zip = $zip;
$this->country = $country;
}
* @return string
public function getStreet()
return $this->street;
public function getCity()
return $this->city;
public function getState()
return $this->state;
public function getZip()
return $this->zip;
public function getCountry()
return $this->country;
public function toArray($prefix = '')
$result = [];
if (!empty($this->getStreet())) {
$result[sprintf('%sstreet', $prefix)] = $this->getStreet();
if (!empty($this->getCity())) {
$result[sprintf('%scity', $prefix)] = $this->getCity();
if (!empty($this->getState())) {
$result[sprintf('%sstate', $prefix)] = $this->getState();
if (!empty($this->getZip())) {
$result[sprintf('%szip', $prefix)] = $this->getZip();
if (!empty($this->getCountry())) {
$result[sprintf('%scountry', $prefix)] = $this->getCountry();
return $result;