-
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
Showing
10 changed files
with
1,435 additions
and
490 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MiBo\Prices\Contracts; | ||
|
||
/** | ||
* Interface PriceCalculatorHelper | ||
* | ||
* @package MiBo\Prices\Contracts | ||
* | ||
* @author Michal Boris <[email protected]> | ||
* | ||
* @since 1.2 | ||
* | ||
* @no-named-arguments Parameter names are not covered by the backward compatibility promise. | ||
*/ | ||
interface PriceCalculatorHelper | ||
{ | ||
/** | ||
* Rounds the price. | ||
* | ||
* @param \MiBo\Prices\Contracts\PriceInterface $price Price to round. | ||
* @param int $precision Precision of the rounding. | ||
* @param int<1, 4> $mode Rounding mode. | ||
* | ||
* @return array<string, int|float> Rounded prices for each VAT category. | ||
*/ | ||
public function round(PriceInterface $price, int $precision = 0, int $mode = PHP_ROUND_HALF_UP): array; | ||
|
||
/** | ||
* Rounds the price up. | ||
* | ||
* @param \MiBo\Prices\Contracts\PriceInterface $price Price to round. | ||
* @param int $precision Precision of the rounding. | ||
* | ||
* @return array<string, int|float> Rounded prices for each VAT category. | ||
*/ | ||
public function ceil(PriceInterface $price, int $precision = 0): array; | ||
|
||
/** | ||
* Rounds the price down. | ||
* | ||
* @param \MiBo\Prices\Contracts\PriceInterface $price Price to round. | ||
* @param int $precision Precision of the rounding. | ||
* | ||
* @return array<string, int|float> Rounded prices for each VAT category. | ||
*/ | ||
public function floor(PriceInterface $price, int $precision = 0): array; | ||
} |
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,84 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MiBo\Prices\Contracts; | ||
|
||
use MiBo\Prices\Price; | ||
use MiBo\Properties\Contracts\NumericalProperty; | ||
|
||
/** | ||
* Class PriceComparer | ||
* | ||
* @package MiBo\Prices\Contracts | ||
* | ||
* @author Michal Boris <[email protected]> | ||
* | ||
* @since 1.2 | ||
* | ||
* @no-named-arguments Parameter names are not covered by the backward compatibility promise. | ||
*/ | ||
interface PriceComparer | ||
{ | ||
public function checkThat(PriceInterface $price): static; | ||
|
||
public function isLessThan(PriceInterface|int|float $price): bool; | ||
|
||
public function isNotLessThan(PriceInterface|int|float $price): bool; | ||
|
||
public function isLessThanOrEqualTo(PriceInterface|int|float $price): bool; | ||
|
||
public function isNotLessThanOrEqualTo(PriceInterface|int|float $price): bool; | ||
|
||
public function isGreaterThan(PriceInterface|int|float $price): bool; | ||
|
||
public function isNotGreaterThan(PriceInterface|int|float $price): bool; | ||
|
||
public function isGreaterThanOrEqualTo(PriceInterface|int|float $price): bool; | ||
|
||
public function isNotGreaterThanOrEqualTo(PriceInterface|int|float $price): bool; | ||
|
||
public function isEqualTo(PriceInterface|int|float $price): bool; | ||
|
||
public function isNotEqualTo(PriceInterface|int|float $price): bool; | ||
|
||
public function isBetween(PriceInterface|int|float $first, PriceInterface|int|float $second): bool; | ||
|
||
public function isNotBetween(PriceInterface|int|float $first, PriceInterface|int|float $second): bool; | ||
|
||
public function isBetweenOrEqualTo(PriceInterface|int|float $first, PriceInterface|int|float $second): bool; | ||
|
||
public function isNotBetweenOrEqualTo(PriceInterface|int|float $first, PriceInterface|int|float $second): bool; | ||
|
||
public function isInteger(): bool; | ||
|
||
public function isNotInteger(): bool; | ||
|
||
public function isFloat(): bool; | ||
|
||
public function isNotFloat(): bool; | ||
|
||
public function isEven(): bool; | ||
|
||
public function isNotEven(): bool; | ||
|
||
public function isOdd(): bool; | ||
|
||
public function isNotOdd(): bool; | ||
|
||
public function hasSameValueAs(NumericalProperty|int|float $price): bool; | ||
|
||
public function hasNotSameValueAs(NumericalProperty|int|float $price): bool; | ||
|
||
public function hasSameValueWithVATAs(NumericalProperty|int|float $price): bool; | ||
|
||
public function hasNotSameValueWithVATAs(NumericalProperty|int|float $price): bool; | ||
|
||
public function isWithVATEqualTo(PriceInterface|int|float $price): bool; | ||
|
||
public function isWithVATNotEqualTo(PriceInterface|int|float $price): bool; | ||
|
||
public function is(PriceInterface $price, bool $strict = false): bool; | ||
|
||
public function isNot(PriceInterface $price, bool $strict = false): bool; | ||
} |
Oops, something went wrong.