mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-16 03:58:39 +00:00
Test extensions
This commit is contained in:
parent
092e480903
commit
cfadeb5e36
|
|
@ -17,5 +17,51 @@ namespace phpOMS\Business\Finance;
|
|||
|
||||
class Depreciation
|
||||
{
|
||||
public static function getLinearDepreciationRate(float $start, int $duration) : float
|
||||
{
|
||||
return $start / $duration;
|
||||
}
|
||||
|
||||
public static function getLinearDepreciationResidualInT(float $start, int $duration, int $t) : float
|
||||
{
|
||||
return $start - self::getLinearDepreciationRate($start, $duration) * $t;
|
||||
}
|
||||
|
||||
public static function getArithmeticProgressivDepreciationRate(float $start, int $duration) : float
|
||||
{
|
||||
return $start / ($duration * ($duration+1) / 2);
|
||||
}
|
||||
|
||||
public static function getArithmeticProgressivDepreciationInT(float $start, int $duration, int $t) : float
|
||||
{
|
||||
return $t * self::getArithmeticProgressivDepreciationRate($start, $duration);
|
||||
}
|
||||
|
||||
public static function getArithmeticProgressivDepreciationResidualInT(float $start, int $duration, int $t) : float
|
||||
{
|
||||
return $start - self::getArithmeticProgressivDepreciationRate($start, $duration) * $t * ($t + 1) / 2;
|
||||
}
|
||||
|
||||
public static function getGeometicProgressivDepreciationRate(float $start, float $residual, int $duration) : float
|
||||
{
|
||||
return (1-pow($residual / $start, 1 / $duration));
|
||||
}
|
||||
|
||||
public static function getGeometicDegressivDepreciationInT(float $start, float $residual, int $duration, int $t) : float
|
||||
{
|
||||
return $start * (1 - self::getGeometicDegressivDepreciationRate($start, $residual, $duration)) ** $t;
|
||||
}
|
||||
|
||||
public static function getGeometicDegressivDepreciationResidualInT(float $start, float $residual, int $duration, int $t) : float
|
||||
{
|
||||
}
|
||||
|
||||
public static function getGeometicProgressivDepreciationInT(float $start, float $residual, int $duration, int $t) : float
|
||||
{
|
||||
return $start * (1 - self::getGeometicProgressivDepreciationRate($start, $residual, $duration)) ** ($duration - $t + 1);
|
||||
}
|
||||
|
||||
public static function getGeometicProgressivDepreciationResidualInT(float $start, float $residual, int $duration, int $t) : float
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -40,4 +40,22 @@ class Metrics {
|
|||
{
|
||||
return (int) sqrt($a*$a+$b*$b+$c*$c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the C.R.A.P score
|
||||
*
|
||||
* @latex r = \sqrt{a^{2} + b^{2} + c^{2}}
|
||||
*
|
||||
* @param int $a Assignments
|
||||
* @param int $b Branches
|
||||
* @param int $c Conditionals
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function CRAP(int $complexity, float $coverage) : int
|
||||
{
|
||||
return (int) ($complexity ** 2 * (1 - $coverage) ** 3 + $complexity);
|
||||
}
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ namespace phpOMS\DataStorage\Database\Exception;
|
|||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class InvalidConnectionConfigException extends \RuntimeException
|
||||
class InvalidConnectionConfigException extends \InvalidArgumentException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user