Skip to content

Commit

Permalink
Unify collections
Browse files Browse the repository at this point in the history
  • Loading branch information
odan committed May 29, 2020
1 parent 7fd2cf4 commit 8929e43
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 70 deletions.
2 changes: 1 addition & 1 deletion src/Method/NovaConfirmReceiptsMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private function createResult(XmlDocument $xml): NovaConfirmReceiptsResult
$serviceItem->vatAmount = $xml->getAttributeValue('verkaufsPreis/mwstAnteil/@betrag', $serviceNode);
$serviceItem->vatPercent = $xml->getAttributeValue('verkaufsPreis/mwstAnteil/@mwstSatz', $serviceNode);

$result->addService($serviceItem);
$result->services[] = $serviceItem;
}

return $result;
Expand Down
2 changes: 1 addition & 1 deletion src/Method/NovaCreateOffersMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ private function createResult(XmlDocument $xml): NovaCreateOffersResult
$travelClass = $xml->getAttributeValue('produktEinflussFaktoren/@klasse', $offerNode);
$offer->travelClass = $travelClass;

$result->addOffer($offer);
$result->offers[] = $offer;
}

return $result;
Expand Down
2 changes: 1 addition & 1 deletion src/Method/NovaCreateServicesMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private function createResult(XmlDocument $xml): NovaCreateServicesResult
$serviceItem->vatAmount = $xml->getAttributeValue('verkaufsPreis/mwstAnteil/@betrag', $serviceNode);
$serviceItem->vatPercent = $xml->getAttributeValue('verkaufsPreis/mwstAnteil/@mwstSatz', $serviceNode);

$result->addService($serviceItem);
$result->services[] = $serviceItem;
}

return $result;
Expand Down
24 changes: 1 addition & 23 deletions src/Result/NovaConfirmReceiptsResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,5 @@ final class NovaConfirmReceiptsResult
*
* @var NovaServiceItem[]
*/
private $services = [];

/**
* Add service.
*
* @param NovaServiceItem $novaService The nova service
*
* @return void
*/
public function addService(NovaServiceItem $novaService)
{
$this->services[] = $novaService;
}

/**
* Get services.
*
* @return array|NovaServiceItem[] The items
*/
public function getServices(): array
{
return $this->services;
}
public $services = [];
}
24 changes: 1 addition & 23 deletions src/Result/NovaCreateOffersResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,5 @@ final class NovaCreateOffersResult
*
* @var NovaOffer[]
*/
private $offers = [];

/**
* Set value.
*
* @param NovaOffer $offer The nova offer
*
* @return void
*/
public function addOffer(NovaOffer $offer)
{
$this->offers[] = $offer;
}

/**
* Get a list of offers.
*
* @return array|NovaOffer[] The offers
*/
public function getOffers(): array
{
return $this->offers;
}
public $offers = [];
}
14 changes: 1 addition & 13 deletions src/Result/NovaCreateServicesResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,7 @@ final class NovaCreateServicesResult
*
* @var NovaServiceItem[]
*/
private $services = [];

/**
* Add service.
*
* @param NovaServiceItem $novaService The nova service
*
* @return void
*/
public function addService(NovaServiceItem $novaService)
{
$this->services[] = $novaService;
}
public $services = [];

/**
* Get services.
Expand Down
16 changes: 8 additions & 8 deletions tests/TestCase/Client/NovaApiClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ public function testCreateOffersClass2()

$actual = $client->createOffers($parameter);

static::assertCount(1, $actual->getOffers());
static::assertCount(1, $actual->offers);

$offer = $actual->getOffers()[0];
$offer = $actual->offers[0];

static::assertSame('_5c63dc7d-62e5-4f3a-a761-464488e92000', $offer->novaOfferId);
static::assertSame('105.00', $offer->price);
Expand Down Expand Up @@ -365,10 +365,10 @@ public function testCreateService()

$actual = $client->createService($parameter);

static::assertCount(1, $actual->getServices());
static::assertSame('OFFERIERT', $actual->getServices()[0]->serviceStatus);
static::assertCount(1, $actual->services);
static::assertSame('OFFERIERT', $actual->services[0]->serviceStatus);

$service = (array)$actual->getServices()[0];
$service = (array)$actual->services[0];

static::assertSame(
[
Expand Down Expand Up @@ -500,10 +500,10 @@ public function testConfirmReceipt()

$actual = $client->confirmReceipt($parameter);

static::assertCount(1, $actual->getServices());
static::assertSame('PRODUKTION_ERFOLGREICH', $actual->getServices()[0]->serviceStatus);
static::assertCount(1, $actual->services);
static::assertSame('PRODUKTION_ERFOLGREICH', $actual->services[0]->serviceStatus);

$service = (array)$actual->getServices()[0];
$service = (array)$actual->services[0];

static::assertSame(
[
Expand Down

0 comments on commit 8929e43

Please sign in to comment.