mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
47 lines
1.0 KiB
PHP
47 lines
1.0 KiB
PHP
<?php
|
|
/**
|
|
* Orange Management
|
|
*
|
|
* PHP Version 7.2
|
|
*
|
|
* @package phpOMS\Business\Marketing
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link https://orange-management.org
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace phpOMS\Business\Marketing;
|
|
|
|
/**
|
|
* Marketing Metrics
|
|
*
|
|
* This class provided basic marketing metric calculations
|
|
*
|
|
* @package phpOMS\Business\Marketing
|
|
* @license OMS License 1.0
|
|
* @link https://orange-management.org
|
|
* @since 1.0.0
|
|
*/
|
|
final class Metrics
|
|
{
|
|
/**
|
|
* Calculate customer retention
|
|
*
|
|
* @latex r = \frac{ce - cn}{cs}
|
|
*
|
|
* @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 Returns the customer retention
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public static function getCustomerRetention(int $ce, int $cn, int $cs) : float
|
|
{
|
|
return ($ce - $cn) / $cs;
|
|
}
|
|
}
|