Added metrics

This commit is contained in:
Dennis Eichhorn 2017-08-18 21:12:04 +02:00
parent 0787b00736
commit d4eea68b11
2 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,43 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace phpOMS\Business\Marketing;
/**
* Net Promoter Score
*
* @category Framework
* @package phpOMS\Business
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Metrics {
/**
* Calculate customer retention
*
* @param int $ce Customer at the end of the period
* @param int $cn New customers during period
* @param int $cs Customers at the start of the period
*
* @return float
*
* @since 1.0.0
*/
public static function getCustomerRetention(int $ce, int $cn, int $cs) : float
{
return ($ce - $cn) / $cs;
}
}

View File

@ -0,0 +1,43 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
declare(strict_types=1);
namespace phpOMS\Business\Programming;
/**
* Programming metrics
*
* @category Framework
* @package phpOMS\Business
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class Metrics {
/**
* Calculate ABC metric 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 abcScore(int $a, int $b, int $c) : int
{
return (int) sqrt($a*$a+$b*$b+$c*$c);
}
}