mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Added metrics
This commit is contained in:
parent
0787b00736
commit
d4eea68b11
43
Business/Marketing/Metrics.php
Normal file
43
Business/Marketing/Metrics.php
Normal 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;
|
||||
}
|
||||
}
|
||||
43
Business/Programming/Metrics.php
Normal file
43
Business/Programming/Metrics.php
Normal 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);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user