Ejemplo n.º 1
0
 /**
  * Returns a string representation of the address
  *
  * @return string
  */
 public function __toString()
 {
     $data = array();
     $data[] = implode(' ', array($this->firstName, $this->lastName));
     $data[] = $this->companyName;
     $data[] = $this->companyIdentifier;
     $data[] = $this->street;
     $region = $this->city;
     if ($this->province) {
         $provinceName = $this->province->getShortName() ? $this->province->getShortName() : $this->province->getName();
         $region .= sprintf(' (%s)', $provinceName);
     }
     $data[] = implode(' ', array($this->postCode, $region));
     if ($this->country) {
         $data[] = $this->country->getName();
     }
     for ($i = 0; $i < sizeof($data); $i++) {
         if (empty($data[$i])) {
             unset($data[$i]);
         }
     }
     return implode("\n", $data);
 }
Ejemplo n.º 2
0
 /**
  * @test
  */
 public function it_should_handle_a_name()
 {
     $name = 'Italy';
     $this->country->setName($name);
     $this->assertEquals($name, $this->country->getName());
 }