-
Notifications
You must be signed in to change notification settings - Fork 8
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
Auto Mation
committed
Aug 19, 2020
1 parent
456e736
commit 7539e7c
Showing
35 changed files
with
1,036 additions
and
166 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
hash=e731df5dde29eb223f6396f8b01f3c95930f2362 | ||
hash=971b10acb4fa6e8cb9ea4187b4109b82725e110e |
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 |
---|---|---|
@@ -1 +1 @@ | ||
hash=e731df5dde29eb223f6396f8b01f3c95930f2362 | ||
hash=971b10acb4fa6e8cb9ea4187b4109b82725e110e |
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 |
---|---|---|
@@ -1 +1 @@ | ||
hash=e731df5dde29eb223f6396f8b01f3c95930f2362 | ||
hash=971b10acb4fa6e8cb9ea4187b4109b82725e110e |
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
27 changes: 27 additions & 0 deletions
27
lib/commercetools-import/src/Models/Common/HighPrecisionMoney.php
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,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file has been auto generated | ||
* Do not change it. | ||
*/ | ||
|
||
namespace Commercetools\Import\Models\Common; | ||
|
||
use Commercetools\Base\DateTimeImmutableCollection; | ||
use Commercetools\Base\JsonObject; | ||
|
||
interface HighPrecisionMoney extends TypedMoney | ||
{ | ||
public const FIELD_PRECISE_AMOUNT = 'preciseAmount'; | ||
|
||
/** | ||
* @return null|int | ||
*/ | ||
public function getPreciseAmount(); | ||
|
||
/** | ||
* @param ?int $preciseAmount | ||
*/ | ||
public function setPreciseAmount(?int $preciseAmount): void; | ||
} |
136 changes: 136 additions & 0 deletions
136
lib/commercetools-import/src/Models/Common/HighPrecisionMoneyBuilder.php
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,136 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file has been auto generated | ||
* Do not change it. | ||
*/ | ||
|
||
namespace Commercetools\Import\Models\Common; | ||
|
||
use Commercetools\Base\Builder; | ||
use Commercetools\Base\DateTimeImmutableCollection; | ||
use Commercetools\Base\JsonObject; | ||
use Commercetools\Base\JsonObjectModel; | ||
use Commercetools\Base\MapperFactory; | ||
use stdClass; | ||
|
||
/** | ||
* @implements Builder<HighPrecisionMoney> | ||
*/ | ||
final class HighPrecisionMoneyBuilder implements Builder | ||
{ | ||
/** | ||
* @var ?int | ||
*/ | ||
private $fractionDigits; | ||
|
||
/** | ||
* @var ?int | ||
*/ | ||
private $centAmount; | ||
|
||
/** | ||
* @var ?string | ||
*/ | ||
private $currencyCode; | ||
|
||
/** | ||
* @var ?int | ||
*/ | ||
private $preciseAmount; | ||
|
||
/** | ||
* @return null|int | ||
*/ | ||
public function getFractionDigits() | ||
{ | ||
return $this->fractionDigits; | ||
} | ||
|
||
/** | ||
* @return null|int | ||
*/ | ||
public function getCentAmount() | ||
{ | ||
return $this->centAmount; | ||
} | ||
|
||
/** | ||
* <p>The currency code compliant to <a href="https://en.wikipedia.org/wiki/ISO_4217">ISO 4217</a>.</p> | ||
* | ||
* @return null|string | ||
*/ | ||
public function getCurrencyCode() | ||
{ | ||
return $this->currencyCode; | ||
} | ||
|
||
/** | ||
* @return null|int | ||
*/ | ||
public function getPreciseAmount() | ||
{ | ||
return $this->preciseAmount; | ||
} | ||
|
||
/** | ||
* @param ?int $fractionDigits | ||
* @return $this | ||
*/ | ||
public function withFractionDigits(?int $fractionDigits) | ||
{ | ||
$this->fractionDigits = $fractionDigits; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @param ?int $centAmount | ||
* @return $this | ||
*/ | ||
public function withCentAmount(?int $centAmount) | ||
{ | ||
$this->centAmount = $centAmount; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @param ?string $currencyCode | ||
* @return $this | ||
*/ | ||
public function withCurrencyCode(?string $currencyCode) | ||
{ | ||
$this->currencyCode = $currencyCode; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @param ?int $preciseAmount | ||
* @return $this | ||
*/ | ||
public function withPreciseAmount(?int $preciseAmount) | ||
{ | ||
$this->preciseAmount = $preciseAmount; | ||
|
||
return $this; | ||
} | ||
|
||
|
||
public function build(): HighPrecisionMoney | ||
{ | ||
return new HighPrecisionMoneyModel( | ||
$this->fractionDigits, | ||
$this->centAmount, | ||
$this->currencyCode, | ||
$this->preciseAmount | ||
); | ||
} | ||
|
||
public static function of(): HighPrecisionMoneyBuilder | ||
{ | ||
return new self(); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
lib/commercetools-import/src/Models/Common/HighPrecisionMoneyCollection.php
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,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file has been auto generated | ||
* Do not change it. | ||
*/ | ||
|
||
namespace Commercetools\Import\Models\Common; | ||
|
||
use Commercetools\Base\MapperSequence; | ||
use Commercetools\Exception\InvalidArgumentException; | ||
use stdClass; | ||
|
||
/** | ||
* @extends MapperSequence<HighPrecisionMoney> | ||
* @method HighPrecisionMoney current() | ||
* @method HighPrecisionMoney at($offset) | ||
*/ | ||
class HighPrecisionMoneyCollection extends MapperSequence | ||
{ | ||
/** | ||
* @psalm-assert HighPrecisionMoney $value | ||
* @psalm-param HighPrecisionMoney|stdClass $value | ||
* @throws InvalidArgumentException | ||
* | ||
* @return HighPrecisionMoneyCollection | ||
*/ | ||
public function add($value) | ||
{ | ||
if (!$value instanceof HighPrecisionMoney) { | ||
throw new InvalidArgumentException(); | ||
} | ||
$this->store($value); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @psalm-return callable(int):?HighPrecisionMoney | ||
*/ | ||
protected function mapper() | ||
{ | ||
return function (int $index): ?HighPrecisionMoney { | ||
$data = $this->get($index); | ||
if ($data instanceof stdClass) { | ||
$data = HighPrecisionMoneyModel::of($data); | ||
$this->set($data, $index); | ||
} | ||
|
||
return $data; | ||
}; | ||
} | ||
} |
Oops, something went wrong.