DragonBe\Vies\CheckVatResponse::toArray PHP Method

toArray() public method

public toArray ( )
    public function toArray()
    {
        return array('countryCode' => $this->getCountryCode(), 'vatNumber' => $this->getVatNumber(), 'requestDate' => $this->getRequestDate()->format('Y-m-d'), 'valid' => $this->isValid(), 'name' => $this->getName(), 'address' => $this->getAddress(), 'identifier' => $this->getIdentifier());
    }

Usage Example

Example #1
1
 /**
  * @param \DragonBe\Vies\CheckVatResponse $response
  * @depends testSuccessVatNumberValidation
  * @covers \DragonBe\Vies\CheckVatResponse::toArray
  */
 public function testConvertObjectIntoArray($response)
 {
     $array = $response->toArray();
     $this->assertSame('BE', $array['countryCode']);
     $this->assertSame('0123.456.749', $array['vatNumber']);
     $this->assertSame('1983-06-24', $array['requestDate']);
     $this->assertSame('XYZ1234567890', $array['identifier']);
     $this->assertTrue($array['valid']);
     $this->assertEmpty($array['name']);
     $this->assertEmpty($array['address']);
 }