-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
958b982
commit 64ddbb5
Showing
23 changed files
with
333 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Answear\FanCourierBundle\DTO; | ||
|
||
use Webmozart\Assert\Assert; | ||
|
||
class AddressDTO | ||
{ | ||
public function __construct( | ||
public readonly string $locality, | ||
public readonly string $county, | ||
public readonly string $street, | ||
public readonly string $streetNo, | ||
public readonly string $zipCode, | ||
public readonly string $floor, | ||
public readonly string $reference, | ||
) { | ||
} | ||
|
||
/** | ||
* @param array{locality: string, county: string, street: string, streetNo: string, zipCode: string, floor: string, reference: string} $addressArray | ||
*/ | ||
public static function fromArray(array $addressArray): self | ||
{ | ||
Assert::stringNotEmpty($addressArray['locality']); | ||
Assert::stringNotEmpty($addressArray['county']); | ||
Assert::stringNotEmpty($addressArray['street']); | ||
Assert::stringNotEmpty($addressArray['streetNo']); | ||
Assert::stringNotEmpty($addressArray['zipCode']); | ||
|
||
return new self( | ||
$addressArray['locality'], | ||
$addressArray['county'], | ||
$addressArray['street'], | ||
$addressArray['streetNo'], | ||
$addressArray['zipCode'], | ||
$addressArray['floor'], | ||
$addressArray['reference'], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Answear\FanCourierBundle\Request; | ||
|
||
class LoginRequest implements RequestInterface | ||
{ | ||
private const ENDPOINT = '/login'; | ||
private const HTTP_METHOD = 'POST'; | ||
|
||
public function __construct( | ||
private readonly string $username, | ||
private readonly string $password, | ||
) { | ||
} | ||
|
||
public function getEndpoint(): string | ||
{ | ||
return self::ENDPOINT; | ||
} | ||
|
||
public function getMethod(): string | ||
{ | ||
return self::HTTP_METHOD; | ||
} | ||
|
||
public function getOptions(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function getBody(): array | ||
{ | ||
return [ | ||
'username' => $this->username, | ||
'password' => $this->password, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.