initial commit; version 22.5.12042
This commit is contained in:
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace PhpUnitsOfMeasure\Exception;
|
||||
|
||||
use Exception;
|
||||
|
||||
abstract class AbstractPhysicalQuantityException extends Exception
|
||||
{
|
||||
/**
|
||||
* The error message template for this exception.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $error = '';
|
||||
|
||||
/**
|
||||
* given an array of replacement values, assemble the error message for
|
||||
* this exception.
|
||||
*
|
||||
* @param array $parameters key/value replacement pairs for the error message.
|
||||
*/
|
||||
public function __construct(array $parameters = [])
|
||||
{
|
||||
$message = strtr($this->error, $parameters);
|
||||
parent::__construct($message);
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
namespace PhpUnitsOfMeasure\Exception;
|
||||
|
||||
class DuplicateUnitNameOrAlias extends AbstractPhysicalQuantityException
|
||||
{
|
||||
protected $error = 'The unit has a name or alias (:labels) which is already a registered unit for this quantity.';
|
||||
}
|
7
libs/PhpUnitsOfMeasure/Exception/NonNumericValue.php
Normal file
7
libs/PhpUnitsOfMeasure/Exception/NonNumericValue.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
namespace PhpUnitsOfMeasure\Exception;
|
||||
|
||||
class NonNumericValue extends AbstractPhysicalQuantityException
|
||||
{
|
||||
protected $error = 'Value (:value) must be numeric.';
|
||||
}
|
7
libs/PhpUnitsOfMeasure/Exception/NonStringUnitName.php
Normal file
7
libs/PhpUnitsOfMeasure/Exception/NonStringUnitName.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
namespace PhpUnitsOfMeasure\Exception;
|
||||
|
||||
class NonStringUnitName extends AbstractPhysicalQuantityException
|
||||
{
|
||||
protected $error = 'Unit name or alias (:name) must be a string value.';
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
namespace PhpUnitsOfMeasure\Exception;
|
||||
|
||||
class PhysicalQuantityMismatch extends AbstractPhysicalQuantityException
|
||||
{
|
||||
protected $error = '(:lhs) and (:rhs) cannot be added or subtracted because they are not the same physical quantity.';
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
namespace PhpUnitsOfMeasure\Exception;
|
||||
|
||||
class UnknownUnitOfMeasure extends AbstractPhysicalQuantityException
|
||||
{
|
||||
protected $error = 'Unknown unit of measure (:unit).';
|
||||
}
|
Reference in New Issue
Block a user