new appraoch

This commit is contained in:
Tim Bendt
2025-11-26 13:22:58 -05:00
parent de3d100844
commit c520b7df89
6760 changed files with 1009780 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
<?php
namespace Money\Exception;
use Money\Exception;
/**
* Thrown when a Money object cannot be formatted into a string.
*
* @author Frederik Bosch <f.bosch@genkgo.nl>
*/
final class FormatterException extends \RuntimeException implements Exception
{
}

View File

@@ -0,0 +1,14 @@
<?php
namespace Money\Exception;
use Money\Exception;
/**
* Thrown when a string cannot be parsed to a Money object.
*
* @author Frederik Bosch <f.bosch@genkgo.nl>
*/
final class ParserException extends \RuntimeException implements Exception
{
}

View File

@@ -0,0 +1,14 @@
<?php
namespace Money\Exception;
use Money\Exception;
/**
* Thrown when trying to get ISO currency that does not exists.
*
* @author Frederik Bosch <f.bosch@genkgo.nl>
*/
final class UnknownCurrencyException extends \DomainException implements Exception
{
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Money\Exception;
use Money\Currency;
use Money\Exception;
/**
* Thrown when there is no currency pair (rate) available for the given currencies.
*
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
*/
final class UnresolvableCurrencyPairException extends \InvalidArgumentException implements Exception
{
/**
* Creates an exception from Currency objects.
*
* @return UnresolvableCurrencyPairException
*/
public static function createFromCurrencies(Currency $baseCurrency, Currency $counterCurrency)
{
$message = sprintf(
'Cannot resolve a currency pair for currencies: %s/%s',
$baseCurrency->getCode(),
$counterCurrency->getCode()
);
return new self($message);
}
}