mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-10 17:28:40 +00:00
code fixes
This commit is contained in:
parent
48c5164e12
commit
7b76d797b8
|
|
@ -102,7 +102,7 @@ final class Glicko1
|
|||
}
|
||||
|
||||
/**
|
||||
* Calcualte the glicko-1 elo
|
||||
* Calculate the glicko-1 elo
|
||||
*
|
||||
* @param int $elo Current player "elo"
|
||||
* @param int $rdOld Current player deviation (RD)
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ final class Glicko2
|
|||
public int $MIN_RD = 50;
|
||||
|
||||
/**
|
||||
* Calcualte the glicko-2 elo
|
||||
* Calculate the glicko-2 elo
|
||||
*
|
||||
* @example $glicko->elo(1500, 200, 0.06, [1,0,0], [1400,1550,1700], [30,100,300]) // 1464, 151, 0.059
|
||||
*
|
||||
|
|
|
|||
|
|
@ -134,7 +134,6 @@ final class Autoloader
|
|||
*/
|
||||
public static function findPaths(string $class) : array
|
||||
{
|
||||
$found = [];
|
||||
$class = \ltrim($class, '\\');
|
||||
$class = \strtr($class, '_\\', '//');
|
||||
|
||||
|
|
@ -143,12 +142,11 @@ final class Autoloader
|
|||
$subclass = $nspacePos === false ? '' : \substr($class, 0, $nspacePos);
|
||||
|
||||
if (isset(self::$classmap[$subclass])) {
|
||||
$found[] = self::$classmap[$subclass] . $class . '.php';
|
||||
|
||||
return $found;
|
||||
return [self::$classmap[$subclass] . $class . '.php'];
|
||||
}
|
||||
}
|
||||
|
||||
$found = [];
|
||||
foreach (self::$paths as $path) {
|
||||
if (\is_file($file = $path . $class . '.php')) {
|
||||
$found[] = $file;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ final class Depreciation
|
|||
}
|
||||
|
||||
/**
|
||||
* Calculate linear depretiation rate
|
||||
* Calculate linear depreciation rate
|
||||
*
|
||||
* @param float $start Value to depreciate
|
||||
* @param int $duration Useful life time
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ abstract class DepreciationType extends Enum
|
|||
{
|
||||
public const NONE = 1;
|
||||
|
||||
public const STAIGHT_LINE = 2;
|
||||
public const STRAIGHT_LINE = 2;
|
||||
|
||||
public const DECLINING_BALANCE = 3;
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ final class FinanceFormulas
|
|||
/**
|
||||
* Annuity - Future Value w/ Continuous Compounding
|
||||
*
|
||||
* @param float $cf Cach flow
|
||||
* @param float $cf Cashflow
|
||||
* @param float $r Rate
|
||||
* @param int $t Time
|
||||
*
|
||||
|
|
@ -143,7 +143,7 @@ final class FinanceFormulas
|
|||
/**
|
||||
* Annuity - Future Value w/ Continuous Compounding
|
||||
*
|
||||
* @param float $fvacc Future value annuity continuous compoinding
|
||||
* @param float $fvacc Future value annuity continuous compounding
|
||||
* @param float $r Rate
|
||||
* @param int $t Time
|
||||
*
|
||||
|
|
@ -159,8 +159,8 @@ final class FinanceFormulas
|
|||
/**
|
||||
* Annuity - Future Value w/ Continuous Compounding
|
||||
*
|
||||
* @param float $fvacc Future value annuity continuous compoinding
|
||||
* @param float $cf Cach flow
|
||||
* @param float $fvacc Future value annuity continuous compounding
|
||||
* @param float $cf Cashflow
|
||||
* @param float $r Rate
|
||||
*
|
||||
* @return int
|
||||
|
|
@ -766,7 +766,7 @@ final class FinanceFormulas
|
|||
}
|
||||
|
||||
/**
|
||||
* Get rate to dobule
|
||||
* Get rate to double
|
||||
*
|
||||
* @param float $t Time in which to double investment
|
||||
*
|
||||
|
|
@ -859,7 +859,7 @@ final class FinanceFormulas
|
|||
* Free Cash Flow to Equity (FCFE = FCFF - dept payments)
|
||||
*
|
||||
* @param float $income Net income
|
||||
* @param float $depamo Depreciation & amortisation
|
||||
* @param float $depamo Depreciation & amortization
|
||||
* @param float $capital Capital expenses
|
||||
* @param float $wc Change in working capital
|
||||
* @param float $borrowing Net Borrowing
|
||||
|
|
@ -878,7 +878,7 @@ final class FinanceFormulas
|
|||
*
|
||||
* @param float $ebit EBIT
|
||||
* @param float $t Tax rate
|
||||
* @param float $depamo Depreciation & amortisation
|
||||
* @param float $depamo Depreciation & amortization
|
||||
* @param float $capital Capital expenses
|
||||
* @param float $wc Change in working capital
|
||||
*
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ final class Lorenzkurve
|
|||
/**
|
||||
* Calculate Gini coefficient
|
||||
*
|
||||
* @param array<int|float> $data Datapoints (can be unsorted)
|
||||
* @param array<int|float> $data Data points (can be unsorted)
|
||||
*
|
||||
* @return float Returns the gini coefficient
|
||||
* @return float Returns the Gini coefficient
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ final class Metrics
|
|||
}
|
||||
|
||||
/**
|
||||
* Calcualte the coefficient of retention
|
||||
* Calculate the coefficient of retention
|
||||
*
|
||||
* @param float $retentionRate Observed retention rate (optionally use the average)
|
||||
* @param float $rc Retention rate ceiling
|
||||
|
|
@ -109,13 +109,13 @@ final class Metrics
|
|||
/**
|
||||
* Calculate the customer profits
|
||||
*
|
||||
* @param int $customers Amount of customers acquired
|
||||
* @param float $acquistionCost Acquisition cost per customer
|
||||
* @param float $revenue Revenues per period per customer
|
||||
* @param float $cogs COGS per period per customer
|
||||
* @param float $marketingCosts Ongoing marketing costs per period per customer
|
||||
* @param float $discountRate Discount rate
|
||||
* @param float $retentionRate Retention rate (how many customers remain)
|
||||
* @param int $customers Amount of customers acquired
|
||||
* @param float $acquisitionCost Acquisition cost per customer
|
||||
* @param float $revenue Revenues per period per customer
|
||||
* @param float $cogs COGS per period per customer
|
||||
* @param float $marketingCosts Ongoing marketing costs per period per customer
|
||||
* @param float $discountRate Discount rate
|
||||
* @param float $retentionRate Retention rate (how many customers remain)
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
|
|
@ -123,7 +123,7 @@ final class Metrics
|
|||
*/
|
||||
public static function getBerrysCustomerProfits(
|
||||
int $customers,
|
||||
float $acquistionCost,
|
||||
float $acquisitionCost,
|
||||
float $revenue,
|
||||
float $cogs,
|
||||
float $marketingCosts,
|
||||
|
|
@ -133,7 +133,7 @@ final class Metrics
|
|||
{
|
||||
return $customers * ($revenue - $cogs) * ((1 + $discountRate) / (1 + $discountRate - $retentionRate))
|
||||
- $customers * $marketingCosts * ((1 + $discountRate) / (1 + $discountRate - $retentionRate))
|
||||
- $customers * $acquistionCost;
|
||||
- $customers * $acquisitionCost;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ final class NetPromoterScore
|
|||
*
|
||||
* @latex NPS = Promoters - Detractors
|
||||
*
|
||||
* @return int Retunrs the NPS
|
||||
* @return int NPS
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ final class PageRank
|
|||
}
|
||||
|
||||
/**
|
||||
* Calcualte the rank based on a start rank for the different elements
|
||||
* Calculate the rank based on a start rank for the different elements
|
||||
*
|
||||
* A different start rank for different elements might make sense if the elements are not uniform from the very beginning
|
||||
*
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ final class ArticleCorrelationAffinity
|
|||
/**
|
||||
* Item order behavior (when are which items ordered)
|
||||
*
|
||||
* In tearms of the pearson correlation these are our random variables
|
||||
* In terms of the pearson correlation these are our random variables
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ final class ModelCF
|
|||
* the item matrix contains in every row a score for how much it belongs to a certain attribute. Each column represents an item.
|
||||
* example: users columns define how much a user likes a certain movie genre and the item rows define how much this movie belongs to a certain genre.
|
||||
* the multiplication gives a score of how much the user may like that movie.
|
||||
* A segnificant amount of attributes are required to calculate a good match
|
||||
* A significant amount of attributes are required to calculate a good match
|
||||
*
|
||||
* @param array<int|string, array<int|float>> $users A mxa matrix where each "m" defines how much the user likes a certain attribute type and "a" defines different users
|
||||
* @param array<int|string, array<int|float>> $items A bxm matrix where each "b" defines a item and "m" defines how much it belongs to a certain attribute type
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ final class MarketShareEstimation
|
|||
*
|
||||
* @latex r = \sqrt[s]{\frac{1}{m \times \sum_{n=1}^N{\frac{1}{n^{s}}}}}
|
||||
*
|
||||
* @param int $participants The amount of existing participants in the market or compentitors (N)
|
||||
* @param int $participants The amount of existing participants in the market or competitors (N)
|
||||
* @param float $marketShare The absolute own market share (m)
|
||||
* @param float $modifier Distribution modifier (s)
|
||||
*
|
||||
|
|
@ -65,7 +65,7 @@ final class MarketShareEstimation
|
|||
*
|
||||
* @latex m = \frac{\frac{1}{r^{s}}}{\sum_{n=1}^N{\frac{1}{n^{s}}}}
|
||||
*
|
||||
* @param int $participants The amount of existing participants in the market or compentitors (N)
|
||||
* @param int $participants The amount of existing participants in the market or competitors (N)
|
||||
* @param int $rank The absolute own rank in the market (r)
|
||||
* @param float $modifier Distribution modifier (s)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ final class Dispatcher implements DispatcherInterface
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ApplicationAbstract $app Appliaction
|
||||
* @param ApplicationAbstract $app Application
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -78,7 +78,7 @@ final class Dispatcher implements DispatcherInterface
|
|||
}
|
||||
|
||||
// Php void functions always return null.
|
||||
// In a different language the Api functions would reguire a return type
|
||||
// In a different language the Api functions would require a return type
|
||||
// If null is returned (i.e. void functions) these get ignored later in the response renderer as null is not "rendered"
|
||||
if (\is_string($controller)) {
|
||||
$views += $this->dispatchString($controller, $data);
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ final class FileLogger implements LoggerInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Analyse logging file.
|
||||
* Analyze logging file.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
|
|
@ -414,9 +414,9 @@ final class FileLogger implements LoggerInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Find cricitcal connections.
|
||||
* Find critical connections.
|
||||
*
|
||||
* @param int $limit Amout of perpetrators
|
||||
* @param int $limit Amount of perpetrators
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
|
|
@ -464,7 +464,7 @@ final class FileLogger implements LoggerInterface
|
|||
/**
|
||||
* Get logging messages from file.
|
||||
*
|
||||
* @param int $limit Amout of logs
|
||||
* @param int $limit Amount of logs
|
||||
* @param int $offset Offset
|
||||
*
|
||||
* @return array
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Math\Matrix\Exception\InvalidDimensionException;
|
|||
/**
|
||||
* Cholesky decomposition
|
||||
*
|
||||
* A is syymetric, positive definite then A = L*L'
|
||||
* A is symmetric, positive definite then A = L*L'
|
||||
*
|
||||
* @package phpOMS\Math\Matrix
|
||||
* @license OMS License 2.0
|
||||
|
|
@ -46,7 +46,7 @@ final class CholeskyDecomposition
|
|||
private int $m = 0;
|
||||
|
||||
/**
|
||||
* Is symmetric positiv definite
|
||||
* Is symmetric positive definite
|
||||
*
|
||||
* @var bool
|
||||
* @since 1.0.0
|
||||
|
|
@ -89,7 +89,7 @@ final class CholeskyDecomposition
|
|||
}
|
||||
|
||||
/**
|
||||
* Is matrix symmetric positiv definite.
|
||||
* Is matrix symmetric positive definite.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
|
|
|
|||
|
|
@ -78,7 +78,9 @@ class Autoloader
|
|||
$class = \ltrim($class, '\\');
|
||||
$class = \strtr($class, '_\\', '//');
|
||||
|
||||
if (\stripos($class, 'Web/Backend') !== false || \stripos($class, 'Web/Api') !== false) {
|
||||
if (\stripos($class, 'Web/Backend') !== false
|
||||
|| \stripos($class, 'Web/Api') !== false
|
||||
) {
|
||||
$class = \is_dir(__DIR__ . '/Web') ? $class : \str_replace('Web/', 'MainRepository/Web/', $class);
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +99,9 @@ class Autoloader
|
|||
}
|
||||
|
||||
foreach (self::$paths as $path) {
|
||||
if (($file = \realpath($path . $class2 . '.php')) !== false && \stripos($file, $class3) !== false) {
|
||||
if (($file = \realpath($path . $class2 . '.php')) !== false
|
||||
&& \stripos($file, $class3) !== false
|
||||
) {
|
||||
include_once $file;
|
||||
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ final class PermutationTest extends \PHPUnit\Framework\TestCase
|
|||
* @covers phpOMS\Utils\Permutation
|
||||
* @group framework
|
||||
*/
|
||||
public function testPermute() : void
|
||||
public function testPermuteAll() : void
|
||||
{
|
||||
$arr = ['a', 'b', 'c'];
|
||||
$permutations = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba'];
|
||||
|
|
@ -68,7 +68,7 @@ final class PermutationTest extends \PHPUnit\Framework\TestCase
|
|||
* @covers phpOMS\Utils\Permutation
|
||||
* @group framework
|
||||
*/
|
||||
public function testPermute() : void
|
||||
public function testPermuteBy() : void
|
||||
{
|
||||
self::assertEquals(['c', 'b', 'a'], Permutation::permuteByKey(['a', 'b', 'c'], [2, 1, 1]));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user