/** * Outputs the entire address as a string. * * This returns the address in a standard format, with the lines separated * by carriage returns. * Address line 1 * Address line 2 * City, State * Postal Code/Zip * Country * * @param T_Filter output filter * @return string formatted address */ function asString($filter = null) { $output = ''; if (strlen($this->line_one) > 0) { $output .= $this->line_one . EOL; } if (strlen($this->line_two) > 0) { $output .= $this->line_two . EOL; } $line3 = array(); if (strlen($this->city) > 0) { $line3[] = $this->city; } if (strlen($this->state) > 0) { $line3[] = $this->state; } if (count($line3) > 0) { $output .= implode(', ', $line3) . EOL; } if (strlen($this->post_code) > 0) { $output .= $this->post_code . EOL; } if (!is_null($this->ctry)) { $output .= $this->ctry->getName(); } return _transform(mb_trim($output), $filter); }
function testNameCanBeFilteredOnRetrieval() { $f = new T_Test_Filter_Suffix(); $ctry = new T_Geo_Country(13, 'GB', 'United Kingdom', 'uk'); $this->assertSame($f->transform('United Kingdom'), $ctry->getName($f)); }