src/Generator.php
public function getAddress($state_code = null, $zip = null)
	{
		$address = new Entities\Address;

		if (!empty($zip) && !empty($state_code)) {
			$result = Zipcode::where('zip', $zip)->where('state_code', $state_code)->orderByRaw(Database::random())->first();
		} elseif (!empty($zip)) {
			$result = Zipcode::where('zip', $zip)->orderByRaw(Database::random())->first();
		} elseif (!empty($state_code)) {
			$result = Zipcode::where('state_code', $state_code)->orderByRaw(Database::random())->first();
		} else {
			$result = Zipcode::orderByRaw(Database::random())->first();
		}

		$address->line_1 = $this->getStreet();

		// @codeCoverageIgnoreStart
		if ($this->getBool(true, false)) {
			$address->line_2 = $this->getApartment();
		} else {
			$address->line_2 = null;
		}
		// @codeCoverageIgnoreEnd

		$address->city = $result->city;
		$address->zip = $result->zip;
		$address->county = $result->county;
		
		$address->state = new Entities\State;
		$address->state->code = $result->state_code;
		$address->state->name = $result->state;
		
		return $address;
	}
public function getAddress($state_code = null, $zip = null)
	{
		$address = new Entities\Address;

		if (!empty($zip) && !empty($state_code)) {
			$result = Zipcode::where('zip', $zip)->where('state_code', $state_code)->orderByRaw(Database::random())->first();
		} elseif (!empty($zip)) {
			$result = Zipcode::where('zip', $zip)->orderByRaw(Database::random())->first();
		} elseif (!empty($state_code)) {
			$result = Zipcode::where('state_code', $state_code)->orderByRaw(Database::random())->first();
		} else {
			$result = Zipcode::orderByRaw(Database::random())->first();
		}

		$address->line_1 = $this->getStreet();

		// @codeCoverageIgnoreStart
		if ($this->getBool(true, false)) {
			$address->line_2 = $this->getApartment();
		} else {
			$address->line_2 = null;
		}
		// @codeCoverageIgnoreEnd

		$address->city = $result->city;
		$address->zip = $result->zip;
		$address->county = $result->county;
		
		$address->state = new Entities\State;
		$address->state->code = $result->state_code;
		$address->state->name = $result->state;
		
		return $address;
	}
public function getAddress ( $ state_code = null , $ zip = null ) { $ address = new Entities \ Address ; if ( ! empty ( $ zip ) && ! empty ( $ state_code ) ) { $ result = Zipcode :: where ( 'zip' , $ zip ) -> where ( 'state_code' , $ state_code ) -> orderByRaw ( Database :: random ( ) ) -> first ( ) ; } elseif ( ! empty ( $ zip ) ) { $ result = Zipcode :: where ( 'zip' , $ zip ) -> orderByRaw ( Database :: random ( ) ) -> first ( ) ; } elseif ( ! empty ( $ state_code ) ) { $ result = Zipcode :: where ( 'state_code' , $ state_code ) -> orderByRaw ( Database :: random ( ) ) -> first ( ) ; } else { $ result = Zipcode :: orderByRaw ( Database :: random ( ) ) -> first ( ) ; } $ address -> line_1 = $ this -> getStreet ( ) ; // @codeCoverageIgnoreStart if ( $ this -> getBool ( true , false ) ) { $ address -> line_2 = $ this -> getApartment ( ) ; } else { $ address -> line_2 = null ; } // @codeCoverageIgnoreEnd $ address -> city = $ result -> city ; $ address -> zip = $ result -> zip ; $ address -> county = $ result -> county ; $ address -> state = new Entities \ State ; $ address -> state -> code = $ result -> state_code ; $ address -> state -> name = $ result -> state ; return $ address ; }
Return object with full street info

@param null $state_code
@param null $zip
@return \joshmoody\Mock\Entities\Address
Return object with full street info