Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-novotny committed Nov 17, 2019
1 parent cb17aca commit 39dc9a4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
11 changes: 7 additions & 4 deletions src/Services/Balikobot.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function trackPackageLastStatus(OrderedPackage $package): PackageStatus
/**
* Track package last status
*
* @param \Inspirum\Balikobot\Model\Aggregates\OrderedPackageCollection $package
* @param \Inspirum\Balikobot\Model\Aggregates\OrderedPackageCollection $packages
*
* @return \Inspirum\Balikobot\Model\Values\PackageStatus[]
*
Expand Down Expand Up @@ -451,8 +451,11 @@ public function getBranchesForShipperService(string $shipper, ?string $service,
*
* @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
*/
public function getBranchesForShipperServiceForCountries(string $shipper, ?string $service, array $countries): iterable
{
public function getBranchesForShipperServiceForCountries(
string $shipper,
?string $service,
array $countries
): iterable {
foreach ($countries as $country) {
yield from $this->getBranchesForShipperService($shipper, $service, $country);
}
Expand Down Expand Up @@ -628,7 +631,7 @@ public function orderB2AShipment(PackageCollection $packages): OrderedPackageCol
/**
* Get PDF link with signed consignment delivery document by the recipient
*
* @param \Inspirum\Balikobot\Model\Aggregates\OrderedPackageCollection $packages
* @param \Inspirum\Balikobot\Model\Values\OrderedPackage $package
*
* @return string
*
Expand Down
8 changes: 6 additions & 2 deletions src/Services/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,12 @@ public function getManipulationUnits(string $shipper): array
*
* @throws \Inspirum\Balikobot\Contracts\ExceptionInterface
*/
public function getBranches(string $shipper, string $service = null, bool $fullData = false, string $country = null): array
{
public function getBranches(
string $shipper,
string $service = null,
bool $fullData = false,
string $country = null
): array {
$request = $fullData ? Request::FULL_BRANCHES : Request::BRANCHES;

$response = $this->requester->call(API::V1, $shipper, $request . '/' . $service . '/' . $country);
Expand Down
8 changes: 5 additions & 3 deletions tests/Unit/Balikobot/GetBranchesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ public function testGetBranchesForShipperCallForEmptyServices()
);

$service->shouldReceive('getServices')->with('zasilkovna')->andReturn([]);
$service->shouldReceive('getBranchesForShipperService')->with('zasilkovna', null, null)->andReturnUsing(function () {
yield from $this->branchesGenerator(2);
});
$service->shouldReceive('getBranchesForShipperService')
->with('zasilkovna', null, null)
->andReturnUsing(function () {
yield from $this->branchesGenerator(2);
});

$count = 0;
foreach ($service->getBranchesForShipper('zasilkovna') as $branch) {
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/OrderedPackageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testStaticConstructorWithFinalTrackUrl()
$orderedPackage = OrderedPackage::newInstanceFromData('cp', '0001', [
'package_id' => 1234,
'carrier_id_final' => '00605444103',
'track_url_final' => 'https://online.gls-slovakia.sk/tt_page.php?tt_value=00605444103',
'track_url_final' => 'https://online.gls-slovakia.sk/tt_page.php',
]);

$this->assertEquals('cp', $orderedPackage->getShipper());
Expand All @@ -78,7 +78,7 @@ public function testStaticConstructorWithFinalTrackUrl()
$this->assertEquals(null, $orderedPackage->getLabelUrl());
$this->assertEquals(null, $orderedPackage->getCarrierIdSwap());
$this->assertEquals('00605444103', $orderedPackage->getFinalCarrierId());
$this->assertEquals('https://online.gls-slovakia.sk/tt_page.php?tt_value=00605444103', $orderedPackage->getFinalTrackUrl());
$this->assertEquals('https://online.gls-slovakia.sk/tt_page.php', $orderedPackage->getFinalTrackUrl());
$this->assertEquals([], $orderedPackage->getPieces());
}
}

0 comments on commit 39dc9a4

Please sign in to comment.