diff --git a/Account/Account.php b/Account/Account.php
index 5c53f8cc7..68b79b519 100644
--- a/Account/Account.php
+++ b/Account/Account.php
@@ -320,7 +320,7 @@ class Account implements ArrayableInterface, \JsonSerializable
*/
public function hasPermission(int $permission, int $unit = null, string $app = null, string $module = null, int $type = null, int $element = null, int $component = null) : bool
{
- $app = $app !== null ? strtolower($app) : $app;
+ $app = $app !== null ? \strtolower($app) : $app;
foreach ($this->permissions as $p) {
if (($p->getUnit() === $unit || $p->getUnit() === null || $unit === null)
diff --git a/Account/AccountManager.php b/Account/AccountManager.php
index dfdbb99be..28ed96d0d 100644
--- a/Account/AccountManager.php
+++ b/Account/AccountManager.php
@@ -131,6 +131,6 @@ final class AccountManager implements \Countable
*/
public function count() : int
{
- return count($this->accounts);
+ return \count($this->accounts);
}
}
diff --git a/Asset/AssetManager.php b/Asset/AssetManager.php
index 5743d1cb6..eda483791 100644
--- a/Asset/AssetManager.php
+++ b/Asset/AssetManager.php
@@ -111,6 +111,6 @@ final class AssetManager implements \Countable
*/
public function count() : int
{
- return count($this->assets);
+ return \count($this->assets);
}
}
diff --git a/Business/Finance/Depreciation.php b/Business/Finance/Depreciation.php
index 08cf01016..94fc1f6ab 100644
--- a/Business/Finance/Depreciation.php
+++ b/Business/Finance/Depreciation.php
@@ -176,7 +176,7 @@ final class Depreciation
*/
public static function getGeometicProgressivDepreciationRate(float $start, float $residual, int $duration) : float
{
- return (1 - pow($residual / $start, 1 / $duration));
+ return (1 - \pow($residual / $start, 1 / $duration));
}
/**
@@ -234,7 +234,7 @@ final class Depreciation
*/
public static function getGeometicDegressivDepreciationRate(float $start, float $residual, int $duration) : float
{
- return (1 - pow($residual / $start, 1 / $duration));
+ return (1 - \pow($residual / $start, 1 / $duration));
}
/**
diff --git a/Business/Finance/FinanceFormulas.php b/Business/Finance/FinanceFormulas.php
index 3f80c7ef3..a09480a18 100644
--- a/Business/Finance/FinanceFormulas.php
+++ b/Business/Finance/FinanceFormulas.php
@@ -48,7 +48,7 @@ final class FinanceFormulas
*/
public static function getAnnualPercentageYield(float $r, int $n) : float
{
- return pow(1 + $r / $n, $n) - 1;
+ return \pow(1 + $r / $n, $n) - 1;
}
/**
@@ -65,7 +65,7 @@ final class FinanceFormulas
*/
public static function getStateAnnualInterestRateOfAPY(float $apy, int $n) : float
{
- return (pow($apy + 1, 1 / $n) - 1) * $n;
+ return (\pow($apy + 1, 1 / $n) - 1) * $n;
}
/**
@@ -81,7 +81,7 @@ final class FinanceFormulas
*/
public static function getFutureValueOfAnnuity(float $P, float $r, int $n) : float
{
- return $P * (pow(1 + $r, $n) - 1) / $r;
+ return $P * (\pow(1 + $r, $n) - 1) / $r;
}
/**
@@ -97,7 +97,7 @@ final class FinanceFormulas
*/
public static function getNumberOfPeriodsOfFVA(float $fva, float $P, float $r) : int
{
- return (int) round(log($fva / $P * $r + 1) / log(1 + $r));
+ return (int) \round(\log($fva / $P * $r + 1) / \log(1 + $r));
}
/**
@@ -113,7 +113,7 @@ final class FinanceFormulas
*/
public static function getPeriodicPaymentOfFVA(float $fva, float $r, int $n) : float
{
- return $fva / ((pow(1 + $r, $n) - 1) / $r);
+ return $fva / ((\pow(1 + $r, $n) - 1) / $r);
}
/**
@@ -129,7 +129,7 @@ final class FinanceFormulas
*/
public static function getFutureValueOfAnnuityConinuousCompounding(float $cf, float $r, int $t) : float
{
- return $cf * (exp($r * $t) - 1) / (exp($r) - 1);
+ return $cf * (\exp($r * $t) - 1) / (\exp($r) - 1);
}
/**
@@ -145,7 +145,7 @@ final class FinanceFormulas
*/
public static function getCashFlowOfFVACC(float $fvacc, float $r, int $t) : float
{
- return $fvacc / ((exp($r * $t) - 1) / (exp($r) - 1));
+ return $fvacc / ((\exp($r * $t) - 1) / (\exp($r) - 1));
}
/**
@@ -161,7 +161,7 @@ final class FinanceFormulas
*/
public static function getTimeOfFVACC(float $fvacc, float $cf, float $r) : int
{
- return (int) round(log($fvacc / $cf * (exp($r) - 1) + 1) / $r);
+ return (int) \round(\log($fvacc / $cf * (\exp($r) - 1) + 1) / $r);
}
/**
@@ -177,7 +177,7 @@ final class FinanceFormulas
*/
public static function getAnnuityPaymentPV(float $pv, float $r, int $n) : float
{
- return $r * $pv / (1 - pow(1 + $r, -$n));
+ return $r * $pv / (1 - \pow(1 + $r, -$n));
}
/**
@@ -193,7 +193,7 @@ final class FinanceFormulas
*/
public static function getNumberOfAPPV(float $p, float $pv, float $r) : int
{
- return (int) round(-log(-($r * $pv / $p - 1)) / log(1 + $r));
+ return (int) \round(-log(-($r * $pv / $p - 1)) / \log(1 + $r));
}
/**
@@ -209,7 +209,7 @@ final class FinanceFormulas
*/
public static function getPresentValueOfAPPV(float $p, float $r, int $n) : float
{
- return $p / $r * (1 - pow(1 + $r, -$n));
+ return $p / $r * (1 - \pow(1 + $r, -$n));
}
/**
@@ -225,7 +225,7 @@ final class FinanceFormulas
*/
public static function getAnnuityPaymentFV(float $fv, float $r, int $n) : float
{
- return $r * $fv / (pow(1 + $r, $n) - 1);
+ return $r * $fv / (\pow(1 + $r, $n) - 1);
}
/**
@@ -241,7 +241,7 @@ final class FinanceFormulas
*/
public static function getNumberOfAPFV(float $p, float $fv, float $r) : int
{
- return (int) round(log($fv * $r / $p + 1) / log(1 + $r));
+ return (int) \round(\log($fv * $r / $p + 1) / \log(1 + $r));
}
/**
@@ -257,7 +257,7 @@ final class FinanceFormulas
*/
public static function getFutureValueOfAPFV(float $p, float $r, int $n) : float
{
- return $p / $r * (pow(1 + $r, $n) - 1);
+ return $p / $r * (\pow(1 + $r, $n) - 1);
}
/**
@@ -272,7 +272,7 @@ final class FinanceFormulas
*/
public static function getAnnutiyPaymentFactorPV(float $r, int $n) : float
{
- return $r / (1 - pow(1 + $r, -$n));
+ return $r / (1 - \pow(1 + $r, -$n));
}
/**
@@ -287,7 +287,7 @@ final class FinanceFormulas
*/
public static function getNumberOfAPFPV(float $p, float $r) : int
{
- return (int) round(-log(-($r / $p - 1)) / log(1 + $r));
+ return (int) \round(-log(-($r / $p - 1)) / \log(1 + $r));
}
/**
@@ -303,7 +303,7 @@ final class FinanceFormulas
*/
public static function getPresentValueOfAnnuity(float $P, float $r, int $n) : float
{
- return $P * (1 - pow(1 + $r, -$n)) / $r;
+ return $P * (1 - \pow(1 + $r, -$n)) / $r;
}
/**
@@ -319,7 +319,7 @@ final class FinanceFormulas
*/
public static function getNumberOfPeriodsOfPVA(float $pva, float $P, float $r) : int
{
- return (int) round(-log(-($pva / $P * $r - 1)) / log(1 + $r));
+ return (int) \round(-log(-($pva / $P * $r - 1)) / \log(1 + $r));
}
/**
@@ -335,7 +335,7 @@ final class FinanceFormulas
*/
public static function getPeriodicPaymentOfPVA(float $pva, float $r, int $n) : float
{
- return $pva / ((1 - pow(1 + $r, -$n)) / $r);
+ return $pva / ((1 - \pow(1 + $r, -$n)) / $r);
}
/**
@@ -350,7 +350,7 @@ final class FinanceFormulas
*/
public static function getPresentValueAnnuityFactor(float $r, int $n) : float
{
- return (1 - pow(1 + $r, -$n)) / $r;
+ return (1 - \pow(1 + $r, -$n)) / $r;
}
/**
@@ -365,7 +365,7 @@ final class FinanceFormulas
*/
public static function getPeriodsOfPVAF(float $p, float $r) : int
{
- return (int) round(-log(-($p * $r - 1)) / log(1 + $r));
+ return (int) \round(-log(-($p * $r - 1)) / \log(1 + $r));
}
/**
@@ -381,7 +381,7 @@ final class FinanceFormulas
*/
public static function getPresentValueOfAnnuityDue(float $P, float $r, int $n) : float
{
- return $P + $P * ((1 - pow(1 + $r, -($n - 1))) / $r);
+ return $P + $P * ((1 - \pow(1 + $r, -($n - 1))) / $r);
}
/**
@@ -399,7 +399,7 @@ final class FinanceFormulas
*/
public static function getPeriodicPaymentOfPVAD(float $PV, float $r, int $n) : float
{
- return $PV * $r / (1 - pow(1 + $r, -$n)) * 1 / (1 + $r);
+ return $PV * $r / (1 - \pow(1 + $r, -$n)) * 1 / (1 + $r);
}
/**
@@ -415,7 +415,7 @@ final class FinanceFormulas
*/
public static function getPeriodsOfPVAD(float $PV, float $P, float $r) : int
{
- return (int) round(-(log(-($PV - $P) / $P * $r + 1) / log(1 + $r) - 1));
+ return (int) \round(-(\log(-($PV - $P) / $P * $r + 1) / \log(1 + $r) - 1));
}
/**
@@ -431,7 +431,7 @@ final class FinanceFormulas
*/
public static function getFutureValueOfAnnuityDue(float $P, float $r, int $n) : float
{
- return (1 + $r) * $P * (pow(1 + $r, $n) - 1) / $r;
+ return (1 + $r) * $P * (\pow(1 + $r, $n) - 1) / $r;
}
/**
@@ -447,7 +447,7 @@ final class FinanceFormulas
*/
public static function getPeriodicPaymentOfFVAD(float $FV, float $r, int $n) : float
{
- return $FV / ((1 + $r) * ((pow(1 + $r, $n) - 1) / $r));
+ return $FV / ((1 + $r) * ((\pow(1 + $r, $n) - 1) / $r));
}
/**
@@ -463,7 +463,7 @@ final class FinanceFormulas
*/
public static function getPeriodsOfFVAD(float $FV, float $P, float $r) : int
{
- return (int) round(log($FV / (1 + $r) / $P * $r + 1) / log(1 + $r));
+ return (int) \round(\log($FV / (1 + $r) / $P * $r + 1) / \log(1 + $r));
}
/**
@@ -539,7 +539,7 @@ final class FinanceFormulas
*/
public static function getCompoundInterest(float $P, float $r, int $n) : float
{
- return $P * (pow(1 + $r, $n) - 1);
+ return $P * (\pow(1 + $r, $n) - 1);
}
/**
@@ -555,7 +555,7 @@ final class FinanceFormulas
*/
public static function getPrincipalOfCompundInterest(float $C, float $r, int $n) : float
{
- return $C / (pow(1 + $r, $n) - 1);
+ return $C / (\pow(1 + $r, $n) - 1);
}
/**
@@ -571,7 +571,7 @@ final class FinanceFormulas
*/
public static function getPeriodsOfCompundInterest(float $P, float $C, float $r) : float
{
- return log($C / $P + 1) / log(1 + $r);
+ return \log($C / $P + 1) / \log(1 + $r);
}
/**
@@ -587,7 +587,7 @@ final class FinanceFormulas
*/
public static function getContinuousCompounding(float $P, float $r, int $t) : float
{
- return $P * exp($r * $t);
+ return $P * \exp($r * $t);
}
/**
@@ -603,7 +603,7 @@ final class FinanceFormulas
*/
public static function getPrincipalOfContinuousCompounding(float $C, float $r, int $t) : float
{
- return $C / exp($r * $t);
+ return $C / \exp($r * $t);
}
/**
@@ -619,7 +619,7 @@ final class FinanceFormulas
*/
public static function getPeriodsOfContinuousCompounding(float $P, float $C, float $r) : float
{
- return log($C / $P) / $r;
+ return \log($C / $P) / $r;
}
/**
@@ -635,7 +635,7 @@ final class FinanceFormulas
*/
public static function getRateOfContinuousCompounding(float $P, float $C, float $t) : float
{
- return log($C / $P) / $t;
+ return \log($C / $P) / $t;
}
/**
@@ -740,7 +740,7 @@ final class FinanceFormulas
*/
public static function getDiscountedPaybackPeriod(float $CF, float $O1, float $r) : float
{
- return log(1 / (1 - $O1 * $r / $CF)) / log(1 + $r);
+ return \log(1 / (1 - $O1 * $r / $CF)) / \log(1 + $r);
}
/**
@@ -754,7 +754,7 @@ final class FinanceFormulas
*/
public static function getDoublingTime(float $r) : float
{
- return log(2) / log(1 + $r);
+ return \log(2) / \log(1 + $r);
}
/**
@@ -768,7 +768,7 @@ final class FinanceFormulas
*/
public static function getDoublingRate(float $t) : float
{
- return exp(log(2) / $t) - 1;
+ return \exp(\log(2) / $t) - 1;
}
/**
@@ -782,7 +782,7 @@ final class FinanceFormulas
*/
public static function getDoublingTimeContinuousCompounding(float $r) : float
{
- return log(2) / $r;
+ return \log(2) / $r;
}
/**
@@ -798,7 +798,7 @@ final class FinanceFormulas
*/
public static function getEquivalentAnnualAnnuity(float $NPV, float $r, int $n) : float
{
- return $r * $NPV / (1 - pow(1 + $r, -$n));
+ return $r * $NPV / (1 - \pow(1 + $r, -$n));
}
/**
@@ -814,7 +814,7 @@ final class FinanceFormulas
*/
public static function getPeriodsOfEAA(float $C, float $NPV, float $r) : int
{
- return (int) round(-log(1 - $r * $NPV / $C) / log(1 + $r));
+ return (int) \round(-log(1 - $r * $NPV / $C) / \log(1 + $r));
}
/**
@@ -830,7 +830,7 @@ final class FinanceFormulas
*/
public static function getNetPresentValueOfEAA(float $C, float $r, int $n) : float
{
- return $C * (1 - pow(1 + $r, -$n)) / $r;
+ return $C * (1 - \pow(1 + $r, -$n)) / $r;
}
/**
@@ -886,7 +886,7 @@ final class FinanceFormulas
*/
public static function getFutureValue(float $C, float $r, int $n) : float
{
- return $C * pow(1 + $r, $n);
+ return $C * \pow(1 + $r, $n);
}
/**
@@ -902,7 +902,7 @@ final class FinanceFormulas
*/
public static function getFutureValueContinuousCompounding(float $PV, float $r, int $t) : float
{
- return $PV * exp($r * $t);
+ return $PV * \exp($r * $t);
}
/**
@@ -922,7 +922,7 @@ final class FinanceFormulas
*/
public static function getFutureValueFactor(float $r, int $n) : float
{
- return pow(1 + $r, $n);
+ return \pow(1 + $r, $n);
}
/**
@@ -953,7 +953,7 @@ final class FinanceFormulas
*/
public static function getGrowingAnnuityFV(float $P, float $r, float $g, int $n) : float
{
- return $P * (pow(1 + $r, $n) - pow(1 + $g, $n)) / ($r - $g);
+ return $P * (\pow(1 + $r, $n) - \pow(1 + $g, $n)) / ($r - $g);
}
/**
@@ -970,7 +970,7 @@ final class FinanceFormulas
*/
public static function getGrowingAnnuityPaymentPV(float $PV, float $r, float $g, int $n) : float
{
- return $PV * ($r - $g) / (1 - pow((1 + $g) / (1 + $r), $n));
+ return $PV * ($r - $g) / (1 - \pow((1 + $g) / (1 + $r), $n));
}
/**
@@ -987,7 +987,7 @@ final class FinanceFormulas
*/
public static function getGrowingAnnuityPaymentFV(float $FV, float $r, float $g, int $n) : float
{
- return $FV * ($r - $g) / (pow(1 + $r, $n) - pow(1 + $g, $n));
+ return $FV * ($r - $g) / (\pow(1 + $r, $n) - \pow(1 + $g, $n));
}
/**
@@ -1004,7 +1004,7 @@ final class FinanceFormulas
*/
public static function getGrowingAnnuityPV(float $P, float $r, float $g, int $n) : float
{
- return $P / ($r - $g) * (1 - pow((1 + $g) / (1 + $r), $n));
+ return $P / ($r - $g) * (1 - \pow((1 + $g) / (1 + $r), $n));
}
/**
@@ -1067,7 +1067,7 @@ final class FinanceFormulas
*/
public static function getNetPresentValue(array $C, float $r) : float
{
- $count = count($C);
+ $count = \count($C);
if ($count === 0) {
throw new \UnexpectedValueException((string) $count);
@@ -1076,7 +1076,7 @@ final class FinanceFormulas
$npv = -$C[0];
for ($i = 1; $i < $count; ++$i) {
- $npv += $C[$i] / pow(1 + $r, $i);
+ $npv += $C[$i] / \pow(1 + $r, $i);
}
return $npv;
@@ -1125,7 +1125,7 @@ final class FinanceFormulas
*/
public static function getNumberOfPeriodsPVFV(float $FV, float $PV, float $r) : float
{
- return log($FV / $PV) / log(1 + $r);
+ return \log($FV / $PV) / \log(1 + $r);
}
/**
@@ -1171,7 +1171,7 @@ final class FinanceFormulas
*/
public static function getPresentValue(float $C, float $r, int $n) : float
{
- return $C / pow(1 + $r, $n);
+ return $C / \pow(1 + $r, $n);
}
/**
@@ -1187,7 +1187,7 @@ final class FinanceFormulas
*/
public static function getPresentValueContinuousCompounding(float $C, float $r, int $t) : float
{
- return $C / exp($r * $t);
+ return $C / \exp($r * $t);
}
/**
@@ -1202,7 +1202,7 @@ final class FinanceFormulas
*/
public static function getPresentValueFactor(float $r, int $n) : float
{
- return 1 / pow(1 + $r, $n);
+ return 1 / \pow(1 + $r, $n);
}
/**
@@ -1386,7 +1386,7 @@ final class FinanceFormulas
*/
public static function getSimpleInterestTime(float $I, float $P, float $r) : int
{
- return (int) round($I / ($P * $r));
+ return (int) \round($I / ($P * $r));
}
/**
diff --git a/Business/Finance/Forecasting/ARIMA.php b/Business/Finance/Forecasting/ARIMA.php
index 62e863dea..8c26a2bc3 100644
--- a/Business/Finance/Forecasting/ARIMA.php
+++ b/Business/Finance/Forecasting/ARIMA.php
@@ -110,7 +110,7 @@ class ARIMA
private function getPrelimRemainder(array $centeredRatios, array $prelimSeasonalComponent) : array
{
$remainder = [];
- $count = count($prelimSeasonalComponent);
+ $count = \count($prelimSeasonalComponent);
for ($i = 0; $i < $count; ++$i) {
// +1 since 3x3 MA
@@ -136,7 +136,7 @@ class ARIMA
private function getModifiedCenteredRatios(array $seasonal, array $remainder) : array
{
$centeredRatio = [];
- $count = count($seasonal);
+ $count = \count($seasonal);
for ($i = 0; $i < $count; ++$i) {
// +1 since 3x3 MA
@@ -148,7 +148,7 @@ class ARIMA
private function getTrendCycleEstimation(array $seasonal) : array
{
- $count = count($seasonal);
+ $count = \count($seasonal);
if ($count >= 12) {
$weight = Average::MAH23;
@@ -166,8 +166,8 @@ class ARIMA
private function getSeasonalAdjustedSeries(array $seasonal) : array
{
$adjusted = [];
- $count = count($seasonal);
- $start = ClassicalDecomposition::getStartOfDecomposition(count($this->data), $count);
+ $count = \count($seasonal);
+ $start = ClassicalDecomposition::getStartOfDecomposition(\count($this->data), $count);
for ($i = 0; $i < $count; ++$i) {
$adjusted[] = $this->data[$start + $i] / $seasonal[$i];
@@ -189,7 +189,7 @@ class ARIMA
private function getModifiedData(array $trendCycleComponent, array $seasonalAdjustedSeries, array $remainder) : array
{
$data = [];
- $count = count($trendCycleComponent);
+ $count = \count($trendCycleComponent);
for ($i = 0; $i < $count; ++$i) {
$data[] = $trendCycleComponent[$i] * $seasonalAdjustedSeries[$i] * $remainder[$i];
diff --git a/Business/Finance/Forecasting/ClassicalDecomposition.php b/Business/Finance/Forecasting/ClassicalDecomposition.php
index 8c44011bf..0a55cdca5 100644
--- a/Business/Finance/Forecasting/ClassicalDecomposition.php
+++ b/Business/Finance/Forecasting/ClassicalDecomposition.php
@@ -92,7 +92,7 @@ class ClassicalDecomposition
$this->data = $data;
$this->order = $order;
- $this->dataSize = count($data);
+ $this->dataSize = \count($data);
}
/**
@@ -148,8 +148,8 @@ class ClassicalDecomposition
public static function computeDetrendedSeries(array $data, array $trendCycleComponent, int $mode) : array
{
$detrended = [];
- $count = count($trendCycleComponent);
- $start = self::getStartOfDecomposition(count($data), $count);
+ $count = \count($trendCycleComponent);
+ $start = self::getStartOfDecomposition(\count($data), $count);
for ($i = 0; $i < $count; ++$i) {
$detrended[] = $mode === self::ADDITIVE ? $data[$start + $i] - $trendCycleComponent[$i] : $data[$start + $i] / $trendCycleComponent[$i];
@@ -190,7 +190,7 @@ class ClassicalDecomposition
private function computeSeasonalComponent(array $detrendedSeries, int $order) : array
{
$seasonalComponent = [];
- $count = count($detrendedSeries);
+ $count = \count($detrendedSeries);
for ($i = 0; $i < $order; ++$i) {
$temp = [];
@@ -219,11 +219,11 @@ class ClassicalDecomposition
*/
public static function computeRemainderComponent(array $data, array $trendCycleComponent, array $seasonalComponent, int $mode = self::ADDITIVE) : array
{
- $dataSize = count($data);
+ $dataSize = \count($data);
$remainderComponent = [];
- $count = count($trendCycleComponent);
+ $count = \count($trendCycleComponent);
$start = self::getStartOfDecomposition($dataSize, $count);
- $seasons = count($seasonalComponent);
+ $seasons = \count($seasonalComponent);
for ($i = 0; $i < $count; ++$i) {
$remainderComponent[] = $mode === self::ADDITIVE ? $data[$start + $i] - $trendCycleComponent[$i] - $seasonalComponent[$i % $seasons] : $data[$start + $i] / ($trendCycleComponent[$i] * $seasonalComponent[$i % $seasons]);
diff --git a/Business/Finance/Loan.php b/Business/Finance/Loan.php
index 8b4df68fd..9a729641c 100644
--- a/Business/Finance/Loan.php
+++ b/Business/Finance/Loan.php
@@ -41,7 +41,7 @@ final class Loan
*/
public static function getPaymentsOnBalloonLoan(float $PV, float $r, int $n, float $balloon = 0) : float
{
- return ($PV - $balloon / pow(1 + $r, $n)) * $r / (1 - pow(1 + $r, -$n));
+ return ($PV - $balloon / \pow(1 + $r, $n)) * $r / (1 - \pow(1 + $r, -$n));
}
/**
@@ -58,7 +58,7 @@ final class Loan
*/
public static function getBalloonBalanceOfLoan(float $PV, float $P, float $r, int $n) : float
{
- return $PV * pow(1 + $r, $n) - $P * (pow(1 + $r, $n) - 1) / $r;
+ return $PV * \pow(1 + $r, $n) - $P * (\pow(1 + $r, $n) - 1) / $r;
}
/**
@@ -74,7 +74,7 @@ final class Loan
*/
public static function getLoanPayment(float $PV, float $r, int $n) : float
{
- return $r * $PV / (1 - pow(1 + $r, -$n));
+ return $r * $PV / (1 - \pow(1 + $r, -$n));
}
/**
@@ -91,7 +91,7 @@ final class Loan
*/
public static function getRemainingBalanceLoan(float $PV, float $P, float $r, int $n) : float
{
- return $PV * pow(1 + $r, $n) - $P * (pow(1 + $r, $n) - 1) / $r;
+ return $PV * \pow(1 + $r, $n) - $P * (\pow(1 + $r, $n) - 1) / $r;
}
/**
diff --git a/Business/Finance/Lorenzkurve.php b/Business/Finance/Lorenzkurve.php
index 3d64eae7a..9968b3ee8 100644
--- a/Business/Finance/Lorenzkurve.php
+++ b/Business/Finance/Lorenzkurve.php
@@ -38,7 +38,7 @@ final class Lorenzkurve
$sum1 = 0;
$sum2 = 0;
$i = 1;
- $n = count($data);
+ $n = \count($data);
sort($data);
diff --git a/Business/Finance/StockBonds.php b/Business/Finance/StockBonds.php
index 54f6d1721..fad0a5b1c 100644
--- a/Business/Finance/StockBonds.php
+++ b/Business/Finance/StockBonds.php
@@ -353,7 +353,7 @@ final class StockBonds
*/
public static function getZeroCouponBondValue(float $F, float $r, int $t) : float
{
- return $F / pow(1 + $r, $t);
+ return $F / \pow(1 + $r, $t);
}
/**
@@ -369,6 +369,6 @@ final class StockBonds
*/
public static function getZeroCouponBondEffectiveYield(float $F, float $PV, int $n) : float
{
- return pow($F / $PV, 1 / $n) - 1;
+ return \pow($F / $PV, 1 / $n) - 1;
}
}
diff --git a/Business/Programming/Metrics.php b/Business/Programming/Metrics.php
index 76075c1fe..382df3983 100644
--- a/Business/Programming/Metrics.php
+++ b/Business/Programming/Metrics.php
@@ -41,7 +41,7 @@ final class Metrics
*/
public static function abcScore(int $a, int $b, int $c) : int
{
- return (int) sqrt($a * $a + $b * $b + $c * $c);
+ return (int) \sqrt($a * $a + $b * $b + $c * $c);
}
/**
diff --git a/Business/Sales/MarketShareEstimation.php b/Business/Sales/MarketShareEstimation.php
index 6d60784c2..6563ed5cf 100644
--- a/Business/Sales/MarketShareEstimation.php
+++ b/Business/Sales/MarketShareEstimation.php
@@ -44,10 +44,10 @@ final class MarketShareEstimation
{
$sum = 0.0;
for ($i = 0; $i < $participants; ++$i) {
- $sum += 1 / pow($i + 1, $modifier);
+ $sum += 1 / \pow($i + 1, $modifier);
}
- return (int) round(pow(1 / ($marketShare * $sum), 1 / $modifier));
+ return (int) \round(\pow(1 / ($marketShare * $sum), 1 / $modifier));
}
/**
@@ -67,9 +67,9 @@ final class MarketShareEstimation
{
$sum = 0.0;
for ($i = 0; $i < $participants; ++$i) {
- $sum += 1 / pow($i + 1, $modifier);
+ $sum += 1 / \pow($i + 1, $modifier);
}
- return (1 / pow($rank, $modifier)) / $sum;
+ return (1 / \pow($rank, $modifier)) / $sum;
}
}
diff --git a/Config/SettingsAbstract.php b/Config/SettingsAbstract.php
index f23ecd39a..e93b2c7f6 100644
--- a/Config/SettingsAbstract.php
+++ b/Config/SettingsAbstract.php
@@ -114,7 +114,7 @@ abstract class SettingsAbstract implements OptionsInterface
break;
}
- return count($options) > 1 ? $options : reset($options);
+ return \count($options) > 1 ? $options : \reset($options);
} catch (\PDOException $e) {
$exception = DatabaseExceptionFactory::createException($e);
$message = DatabaseExceptionFactory::createExceptionMessage($e);
diff --git a/DataStorage/Cache/CachePool.php b/DataStorage/Cache/CachePool.php
index 3daf22cfc..2056ef882 100644
--- a/DataStorage/Cache/CachePool.php
+++ b/DataStorage/Cache/CachePool.php
@@ -106,7 +106,7 @@ final class CachePool implements DataStoragePoolInterface
}
if (empty($key)) {
- return reset($this->pool);
+ return \reset($this->pool);
}
return $this->pool[$key];
diff --git a/DataStorage/Database/DataMapperAbstract.php b/DataStorage/Database/DataMapperAbstract.php
index ce749e46e..943831a12 100644
--- a/DataStorage/Database/DataMapperAbstract.php
+++ b/DataStorage/Database/DataMapperAbstract.php
@@ -1494,7 +1494,7 @@ class DataMapperAbstract implements DataMapperInterface
if (empty($result)) {
$parts = \explode('\\', $class);
- $name = $parts[$c = (count($parts) - 1)];
+ $name = $parts[$c = (\count($parts) - 1)];
$parts[$c] = 'Null' . $name;
$class = \implode('\\', $parts);
}
@@ -1914,7 +1914,7 @@ class DataMapperAbstract implements DataMapperInterface
$primaryKey = (array) $primaryKey;
$fill = (array) $fill;
$obj = [];
- $fCount = count($fill);
+ $fCount = \count($fill);
$toFill = null;
foreach ($primaryKey as $key => $value) {
@@ -1924,8 +1924,8 @@ class DataMapperAbstract implements DataMapperInterface
}
if ($fCount > 0) {
- $toFill = current($fill);
- next($fill);
+ $toFill = \current($fill);
+ \next($fill);
}
$obj[$value] = self::populate(self::getRaw($value), $toFill);
@@ -1940,12 +1940,12 @@ class DataMapperAbstract implements DataMapperInterface
self::fillRelations($obj, $relations, --$depth);
self::clear();
- $countResulsts = count($obj);
+ $countResulsts = \count($obj);
if ($countResulsts === 0) {
return self::getNullModelObj();
} elseif ($countResulsts === 1) {
- return reset($obj);
+ return \reset($obj);
}
return $obj;
@@ -1963,7 +1963,7 @@ class DataMapperAbstract implements DataMapperInterface
$class = static::class;
$class = \str_replace('Mapper', '', $class);
$parts = \explode('\\', $class);
- $name = $parts[$c = (count($parts) - 1)];
+ $name = $parts[$c = (\count($parts) - 1)];
$parts[$c] = 'Null' . $name;
$class = \implode('\\', $parts);
@@ -2010,7 +2010,7 @@ class DataMapperAbstract implements DataMapperInterface
self::fillRelationsArray($obj, $relations, --$depth);
self::clear();
- return count($obj) === 1 ? reset($obj) : $obj;
+ return \count($obj) === 1 ? \reset($obj) : $obj;
}
/**
@@ -2053,12 +2053,12 @@ class DataMapperAbstract implements DataMapperInterface
$obj[$value] = self::get($toLoad, $relations, $fill, --$depth);
}
- $countResulsts = count($obj);
+ $countResulsts = \count($obj);
if ($countResulsts === 0) {
return self::getNullModelObj();
} elseif ($countResulsts === 1) {
- return reset($obj);
+ return \reset($obj);
}
return $obj;
@@ -2099,7 +2099,7 @@ class DataMapperAbstract implements DataMapperInterface
$obj[$value] = self::get($toLoad, $relations, $fill);
}
- return count($obj) === 1 ? reset($obj) : $obj;
+ return \count($obj) === 1 ? \reset($obj) : $obj;
}
/**
@@ -2591,7 +2591,7 @@ class DataMapperAbstract implements DataMapperInterface
if ($request->getData('id') !== null) {
$result = static::get((int) $request->getData('id'));
} elseif (($filter = ((string) $request->getData('filter'))) !== null) {
- $filter = strtolower($filter);
+ $filter = \strtolower($filter);
if ($filter === 'all') {
$result = static::getAll();
@@ -2709,7 +2709,7 @@ class DataMapperAbstract implements DataMapperInterface
$results = $sth->fetchAll(\PDO::FETCH_ASSOC);
- return $results && count($results) === 0;
+ return $results && \count($results) === 0;
}
/**
diff --git a/DataStorage/Database/DatabasePool.php b/DataStorage/Database/DatabasePool.php
index 5668f8222..558555b03 100644
--- a/DataStorage/Database/DatabasePool.php
+++ b/DataStorage/Database/DatabasePool.php
@@ -86,7 +86,7 @@ final class DatabasePool implements DataStoragePoolInterface
}
if (empty($key)) {
- return reset($this->pool);
+ return \reset($this->pool);
}
return $this->pool[$key];
diff --git a/DataStorage/Database/GrammarAbstract.php b/DataStorage/Database/GrammarAbstract.php
index 7b85dfcd9..fa9077826 100644
--- a/DataStorage/Database/GrammarAbstract.php
+++ b/DataStorage/Database/GrammarAbstract.php
@@ -93,8 +93,8 @@ abstract class GrammarAbstract
*/
public function compileQuery(BuilderAbstract $query) : string
{
- return trim(
- implode(' ',
+ return \trim(
+ \implode(' ',
\array_filter(
$this->compileComponents($query),
function ($value) {
@@ -186,7 +186,7 @@ abstract class GrammarAbstract
}
}
- return rtrim($expression, ', ');
+ return \rtrim($expression, ', ');
}
/**
@@ -217,7 +217,7 @@ abstract class GrammarAbstract
}
}
- return rtrim($expression, ', ');
+ return \rtrim($expression, ', ');
}
/**
@@ -234,7 +234,7 @@ abstract class GrammarAbstract
*/
protected function compileSystem(string $system, string $prefix = '') : string
{
- // todo: this is a bad way to handle select count(*) which doesn't need a prefix. Maybe remove prefixes in total?
+ // todo: this is a bad way to handle select \count(*) which doesn't need a prefix. Maybe remove prefixes in total?
$identifier = $this->systemIdentifier;
foreach ($this->specialKeywords as $keyword) {
@@ -245,7 +245,7 @@ abstract class GrammarAbstract
}
// todo: move remaining * test also here not just if .* but also if * (should be done in else?)
- if (count($split = \explode('.', $system)) === 2) {
+ if (\count($split = \explode('.', $system)) === 2) {
$system = $split[1] === '*' ? $split[1] : $this->compileSystem($split[1]);
return $this->compileSystem($prefix . $split[0]) . '.' . $system;
diff --git a/DataStorage/Database/Query/Builder.php b/DataStorage/Database/Query/Builder.php
index 291f91b3f..3bac0a3d6 100644
--- a/DataStorage/Database/Query/Builder.php
+++ b/DataStorage/Database/Query/Builder.php
@@ -819,7 +819,7 @@ final class Builder extends BuilderAbstract
*/
public function count(string $table = '*') : Builder
{
- // todo: don't do this as string, create new object new Count(); this can get handled by the grammar parser WAY better
+ // todo: don't do this as string, create new object new \count(); this can get handled by the grammar parser WAY better
return $this->select('COUNT(' . $table . ')');
}
@@ -949,10 +949,10 @@ final class Builder extends BuilderAbstract
*/
public function value($value, string $type = 'string') : Builder
{
- end($this->values);
- $key = key($this->values);
+ \end($this->values);
+ $key = \key($this->values);
$this->values[$key][] = $value;
- reset($this->values);
+ \reset($this->values);
return $this;
}
@@ -985,7 +985,7 @@ final class Builder extends BuilderAbstract
*/
public function set($set, string $type = 'string') : Builder
{
- $this->sets[key($set)] = current($set);
+ $this->sets[key($set)] = \current($set);
return $this;
}
diff --git a/DataStorage/Database/Query/Grammar/Grammar.php b/DataStorage/Database/Query/Grammar/Grammar.php
index 2552e7684..04aabfdf7 100644
--- a/DataStorage/Database/Query/Grammar/Grammar.php
+++ b/DataStorage/Database/Query/Grammar/Grammar.php
@@ -122,7 +122,7 @@ class Grammar extends GrammarAbstract
/* Loop all possible query components and if they exist compile them. */
foreach ($components as $component) {
if (isset($query->{$component}) && !empty($query->{$component})) {
- $sql[$component] = $this->{'compile' . ucfirst($component)}($query, $query->{$component});
+ $sql[$component] = $this->{'compile' . \ucfirst($component)}($query, $query->{$component});
}
}
@@ -286,7 +286,7 @@ class Grammar extends GrammarAbstract
if (\is_string($element['column'])) {
// handle bug when no table is specified in the where column
- if (count($query->from) === 1 && \stripos($element['column'], '.') === false) {
+ if (\count($query->from) === 1 && \stripos($element['column'], '.') === false) {
$element['column'] = $query->from[0] . '.' . $element['column'];
}
@@ -359,7 +359,7 @@ class Grammar extends GrammarAbstract
} elseif ($value instanceof Column) {
return $this->compileSystem($value->getColumn(), $prefix);
} else {
- throw new \InvalidArgumentException(gettype($value));
+ throw new \InvalidArgumentException(\gettype($value));
}
}
diff --git a/DataStorage/Database/Query/Grammar/MysqlGrammar.php b/DataStorage/Database/Query/Grammar/MysqlGrammar.php
index aeb017f82..e19f1a524 100644
--- a/DataStorage/Database/Query/Grammar/MysqlGrammar.php
+++ b/DataStorage/Database/Query/Grammar/MysqlGrammar.php
@@ -53,6 +53,6 @@ class MysqlGrammar extends Grammar
$expression = '*';
}
- return 'SELECT ' . $expression . ' ' . $this->compileFrom($query, $query->from) . ' ORDER BY RAND() ' . $this->compileLimit($query, $query->limit);
+ return 'SELECT ' . $expression . ' ' . $this->compileFrom($query, $query->from) . ' ORDER BY \rand() ' . $this->compileLimit($query, $query->limit);
}
}
diff --git a/DataStorage/Database/Schema/Grammar/Grammar.php b/DataStorage/Database/Schema/Grammar/Grammar.php
index f7e5060c0..bc5742988 100644
--- a/DataStorage/Database/Schema/Grammar/Grammar.php
+++ b/DataStorage/Database/Schema/Grammar/Grammar.php
@@ -73,7 +73,7 @@ class Grammar extends GrammarAbstract
/* Loop all possible query components and if they exist compile them. */
foreach ($components as $component) {
if (isset($query->{$component}) && !empty($query->{$component})) {
- $sql[$component] = $this->{'compile' . ucfirst($component)}($query, $query->{$component});
+ $sql[$component] = $this->{'compile' . \ucfirst($component)}($query, $query->{$component});
}
}
diff --git a/DataStorage/Web/Builder.php b/DataStorage/Web/Builder.php
index 268029182..9999ff59b 100644
--- a/DataStorage/Web/Builder.php
+++ b/DataStorage/Web/Builder.php
@@ -66,9 +66,9 @@ class Builder
private function createTable($node) : array
{
- if (strtolower($node->tagName) === 'table') {
+ if (\strtolower($node->tagName) === 'table') {
return $this->createTableFromTable();
- } elseif (strtolower($node->tagName) === 'li') {
+ } elseif (\strtolower($node->tagName) === 'li') {
return $this->createTableFromList();
} else {
return $this->createTableFromContent();
diff --git a/Dispatcher/Dispatcher.php b/Dispatcher/Dispatcher.php
index 04d5285b4..0c3a34174 100644
--- a/Dispatcher/Dispatcher.php
+++ b/Dispatcher/Dispatcher.php
@@ -109,7 +109,7 @@ final class Dispatcher
throw new PathException($path);
}
- if (($c = count($dispatch)) === 3) {
+ if (($c = \count($dispatch)) === 3) {
/* Handling static functions */
$function = $dispatch[0] . '::' . $dispatch[2];
@@ -183,7 +183,7 @@ final class Dispatcher
{
if (!isset($this->controllers[$controller])) {
// If module controller use module manager for initialization
- if (strpos('\Modules\Controller', $controller) === 0) {
+ if (\strpos('\Modules\Controller', $controller) === 0) {
$split = \explode('\\', $controller);
$this->controllers[$controller] = $this->app->moduleManager->get($split[2]);
} else {
diff --git a/Event/EventManager.php b/Event/EventManager.php
index 84d02ec8a..c86eeee42 100644
--- a/Event/EventManager.php
+++ b/Event/EventManager.php
@@ -234,6 +234,6 @@ final class EventManager
*/
public function count() : int
{
- return count($this->callbacks);
+ return \count($this->callbacks);
}
}
diff --git a/Localization/Money.php b/Localization/Money.php
index 3301677cd..90da81e40 100644
--- a/Localization/Money.php
+++ b/Localization/Money.php
@@ -116,7 +116,7 @@ final class Money implements \Serializable
$left = \str_replace($thousands, '', $left);
$right = '';
- if (count($split) > 1) {
+ if (\count($split) > 1) {
$right = $split[1];
}
@@ -191,7 +191,7 @@ final class Money implements \Serializable
*/
public function getAmount(int $decimals = 2) : string
{
- $value = (string) round($this->value, -self::MAX_DECIMALS + $decimals);
+ $value = (string) \round($this->value, -self::MAX_DECIMALS + $decimals);
$left = \substr($value, 0, -self::MAX_DECIMALS);
$right = \substr($value, -self::MAX_DECIMALS);
diff --git a/Log/FileLogger.php b/Log/FileLogger.php
index 33e4fcac4..149387ef1 100644
--- a/Log/FileLogger.php
+++ b/Log/FileLogger.php
@@ -396,7 +396,7 @@ final class FileLogger implements LoggerInterface
$line = \fgetcsv($this->fp, 0, ';');
while ($line !== false && $line !== null) {
- if (count($line) < 2) {
+ if (\count($line) < 2) {
continue;
}
@@ -443,7 +443,7 @@ final class FileLogger implements LoggerInterface
$line = \fgetcsv($this->fp, 0, ';');
while ($line !== false && $line !== null) {
- if (count($line) < 3) {
+ if (\count($line) < 3) {
continue;
}
@@ -501,7 +501,7 @@ final class FileLogger implements LoggerInterface
}
if ($limit <= 0) {
- reset($logs);
+ \reset($logs);
unset($logs[key($logs)]);
}
diff --git a/Math/Functions/Fibunacci.php b/Math/Functions/Fibunacci.php
index f40c0aff9..9165e0cba 100644
--- a/Math/Functions/Fibunacci.php
+++ b/Math/Functions/Fibunacci.php
@@ -91,6 +91,6 @@ final class Fibunacci
*/
public static function binet(int $n) : int
{
- return (int) (((1 + sqrt(5)) ** $n - (1 - sqrt(5)) ** $n) / (2 ** $n * sqrt(5)));
+ return (int) (((1 + \sqrt(5)) ** $n - (1 - \sqrt(5)) ** $n) / (2 ** $n * \sqrt(5)));
}
}
diff --git a/Math/Functions/Functions.php b/Math/Functions/Functions.php
index 36d1702b1..b8564895b 100644
--- a/Math/Functions/Functions.php
+++ b/Math/Functions/Functions.php
@@ -74,11 +74,11 @@ final class Functions
*/
public static function binomialCoefficient(int $n, int $k) : int
{
- $max = max([$k, $n - $k]);
- $min = min([$k, $n - $k]);
+ $max = \max([$k, $n - $k]);
+ $min = \min([$k, $n - $k]);
$fact = 1;
- $range = array_reverse(range(1, $min));
+ $range = array_reverse(\range(1, $min));
for ($i = $max + 1; $i < $n + 1; ++$i) {
$div = 1;
@@ -138,7 +138,7 @@ final class Functions
$abs = [];
foreach ($values as $value) {
- $abs[] = abs($value);
+ $abs[] = \abs($value);
}
return $abs;
@@ -293,7 +293,7 @@ final class Functions
$squared = [];
foreach ($values as $value) {
- $squared[] = sqrt($value);
+ $squared[] = \sqrt($value);
}
return $squared;
@@ -315,6 +315,6 @@ final class Functions
*/
public static function getRelativeDegree(int $value, int $length, int $start = 0) : int
{
- return abs(self::mod($value - $start, $length));
+ return \abs(self::mod($value - $start, $length));
}
}
diff --git a/Math/Functions/Gamma.php b/Math/Functions/Gamma.php
index 4e5201e61..35669ffc4 100644
--- a/Math/Functions/Gamma.php
+++ b/Math/Functions/Gamma.php
@@ -58,7 +58,7 @@ final class Gamma
public static function lanczosApproximationReal($z) : float
{
if ($z < 0.5) {
- return M_PI / (sin(M_PI * $z) * self::lanczosApproximationReal(1 - $z));
+ return M_PI / (\sin(M_PI * $z) * self::lanczosApproximationReal(1 - $z));
}
$z -= 1;
@@ -69,7 +69,7 @@ final class Gamma
$a += self::LANCZOSAPPROXIMATION[$i] / ($z + $i);
}
- return sqrt(2 * M_PI) * pow($t, $z + 0.5) * exp(-$t) * $a;
+ return \sqrt(2 * M_PI) * \pow($t, $z + 0.5) * \exp(-$t) * $a;
}
/**
@@ -83,7 +83,7 @@ final class Gamma
*/
public static function stirlingApproximation($x) : float
{
- return sqrt(2.0 * M_PI / $x) * pow($x / M_E, $x);
+ return \sqrt(2.0 * M_PI / $x) * \pow($x / M_E, $x);
}
/**
@@ -101,7 +101,7 @@ final class Gamma
$c = [sqrt(2.0 * M_PI)];
for ($k = 1; $k < 12; ++$k) {
- $c[$k] = exp(12 - $k) * pow(12 - $k, $k - 0.5) / $k1_fact;
+ $c[$k] = \exp(12 - $k) * \pow(12 - $k, $k - 0.5) / $k1_fact;
$k1_fact *= -$k;
}
@@ -110,7 +110,7 @@ final class Gamma
$accm += $c[$k] / ($z + $k);
}
- $accm *= exp(-$z - 12) * pow($z + 12, $z + 0.5);
+ $accm *= \exp(-$z - 12) * \pow($z + 12, $z + 0.5);
return $accm / $z;
}
diff --git a/Math/Geometry/ConvexHull/MonotoneChain.php b/Math/Geometry/ConvexHull/MonotoneChain.php
index f2068baf6..06f6cc4df 100644
--- a/Math/Geometry/ConvexHull/MonotoneChain.php
+++ b/Math/Geometry/ConvexHull/MonotoneChain.php
@@ -46,7 +46,7 @@ final class MonotoneChain
*/
public static function createConvexHull(array $points) : array
{
- if (($n = count($points)) > 1) {
+ if (($n = \count($points)) > 1) {
uasort($points, [self::class, 'sort']);
$k = 0;
diff --git a/Math/Geometry/Shape/D2/Circle.php b/Math/Geometry/Shape/D2/Circle.php
index b933cd97a..953b32d42 100644
--- a/Math/Geometry/Shape/D2/Circle.php
+++ b/Math/Geometry/Shape/D2/Circle.php
@@ -64,7 +64,7 @@ final class Circle implements D2ShapeInterface
*/
public static function getRadiusBySurface(float $surface) : float
{
- return sqrt($surface / pi());
+ return \sqrt($surface / pi());
}
/**
diff --git a/Math/Geometry/Shape/D2/Ellipse.php b/Math/Geometry/Shape/D2/Ellipse.php
index f1d417ba9..0e04803e9 100644
--- a/Math/Geometry/Shape/D2/Ellipse.php
+++ b/Math/Geometry/Shape/D2/Ellipse.php
@@ -62,6 +62,6 @@ final class Ellipse implements D2ShapeInterface
*/
public static function getPerimeter(float $a, float $b) : float
{
- return pi() * ($a + $b) * (3 * ($a - $b) ** 2 / (($a + $b) ** 2 * (sqrt(-3 * ($a - $b) ** 2 / (($a + $b) ** 2) + 4) + 10)) + 1);
+ return pi() * ($a + $b) * (3 * ($a - $b) ** 2 / (($a + $b) ** 2 * (\sqrt(-3 * ($a - $b) ** 2 / (($a + $b) ** 2) + 4) + 10)) + 1);
}
}
diff --git a/Math/Geometry/Shape/D2/Polygon.php b/Math/Geometry/Shape/D2/Polygon.php
index f718507c3..d860436c9 100644
--- a/Math/Geometry/Shape/D2/Polygon.php
+++ b/Math/Geometry/Shape/D2/Polygon.php
@@ -86,7 +86,7 @@ final class Polygon implements D2ShapeInterface
*/
public static function isPointInPolygon(array $point, array $polygon) : int
{
- $length = count($polygon);
+ $length = \count($polygon);
// Polygon has to start and end with same point
if ($polygon[0]['x'] !== $polygon[$length - 1]['x'] || $polygon[0]['y'] !== $polygon[$length - 1]['y']) {
@@ -100,32 +100,32 @@ final class Polygon implements D2ShapeInterface
// Inside or ontop?
$countIntersect = 0;
- $polygonCount = count($polygon);
+ $polygonCount = \count($polygon);
for ($i = 1; $i < $polygonCount; ++$i) {
$vertex1 = $polygon[$i - 1];
$vertex2 = $polygon[$i];
- if (abs($vertex1['y'] - $vertex2['y']) < self::EPSILON
- && abs($vertex1['y'] - $point['y']) < self::EPSILON
- && $point['x'] > min($vertex1['x'], $vertex2['x'])
- && $point['x'] < max($vertex1['x'], $vertex2['x'])
+ if (\abs($vertex1['y'] - $vertex2['y']) < self::EPSILON
+ && \abs($vertex1['y'] - $point['y']) < self::EPSILON
+ && $point['x'] > \min($vertex1['x'], $vertex2['x'])
+ && $point['x'] < \max($vertex1['x'], $vertex2['x'])
) {
return 0; // boundary
}
- if ($point['y'] > min($vertex1['y'], $vertex2['y'])
- && $point['y'] <= max($vertex1['y'], $vertex2['y'])
- && $point['x'] <= max($vertex1['x'], $vertex2['x'])
- && abs($vertex1['y'] - $vertex2['y']) >= self::EPSILON
+ if ($point['y'] > \min($vertex1['y'], $vertex2['y'])
+ && $point['y'] <= \max($vertex1['y'], $vertex2['y'])
+ && $point['x'] <= \max($vertex1['x'], $vertex2['x'])
+ && \abs($vertex1['y'] - $vertex2['y']) >= self::EPSILON
) {
$xinters = ($point['y'] - $vertex1['y']) * ($vertex2['x'] - $vertex1['x']) / ($vertex2['y'] - $vertex1['y']) + $vertex1['x'];
- if (abs($xinters - $point['x']) < self::EPSILON) {
+ if (\abs($xinters - $point['x']) < self::EPSILON) {
return 0; // boundary
}
- if (abs($vertex1['x'] - $vertex2['x']) < self::EPSILON || $point['x'] < $xinters) {
+ if (\abs($vertex1['x'] - $vertex2['x']) < self::EPSILON || $point['x'] < $xinters) {
$countIntersect++;
}
}
@@ -151,7 +151,7 @@ final class Polygon implements D2ShapeInterface
private static function isOnVertex(array $point, array $polygon) : bool
{
foreach ($polygon as $vertex) {
- if (abs($point['x'] - $vertex['x']) < self::EPSILON && abs($point['y'] - $vertex['y']) < self::EPSILON) {
+ if (\abs($point['x'] - $vertex['x']) < self::EPSILON && \abs($point['y'] - $vertex['y']) < self::EPSILON) {
return true;
}
}
@@ -168,7 +168,7 @@ final class Polygon implements D2ShapeInterface
*/
public function getInteriorAngleSum() : int
{
- return (count($this->coord) - 2) * 180;
+ return (\count($this->coord) - 2) * 180;
}
/**
@@ -192,7 +192,7 @@ final class Polygon implements D2ShapeInterface
*/
public function getSurface() : float
{
- return abs($this->getSignedSurface());
+ return \abs($this->getSignedSurface());
}
/**
@@ -204,7 +204,7 @@ final class Polygon implements D2ShapeInterface
*/
private function getSignedSurface() : float
{
- $count = count($this->coord);
+ $count = \count($this->coord);
$surface = 0;
for ($i = 0; $i < $count - 1; ++$i) {
@@ -226,11 +226,11 @@ final class Polygon implements D2ShapeInterface
*/
public function getPerimeter() : float
{
- $count = count($this->coord);
- $perimeter = sqrt(($this->coord[0]['x'] - $this->coord[$count - 1]['x']) ** 2 + ($this->coord[0]['y'] - $this->coord[$count - 1]['y']) ** 2);
+ $count = \count($this->coord);
+ $perimeter = \sqrt(($this->coord[0]['x'] - $this->coord[$count - 1]['x']) ** 2 + ($this->coord[0]['y'] - $this->coord[$count - 1]['y']) ** 2);
for ($i = 0; $i < $count - 1; ++$i) {
- $perimeter += sqrt(($this->coord[$i + 1]['x'] - $this->coord[$i]['x']) ** 2 + ($this->coord[$i + 1]['y'] - $this->coord[$i]['y']) ** 2);
+ $perimeter += \sqrt(($this->coord[$i + 1]['x'] - $this->coord[$i]['x']) ** 2 + ($this->coord[$i + 1]['y'] - $this->coord[$i]['y']) ** 2);
}
return $perimeter;
@@ -246,7 +246,7 @@ final class Polygon implements D2ShapeInterface
public function getBarycenter() : array
{
$barycenter = ['x' => 0, 'y' => 0];
- $count = count($this->coord);
+ $count = \count($this->coord);
for ($i = 0; $i < $count - 1; ++$i) {
$mult = ($this->coord[$i]['x'] * $this->coord[$i + 1]['y'] - $this->coord[$i + 1]['x'] * $this->coord[$i]['y']);
diff --git a/Math/Geometry/Shape/D2/Rectangle.php b/Math/Geometry/Shape/D2/Rectangle.php
index 8501309d4..89b70fce3 100644
--- a/Math/Geometry/Shape/D2/Rectangle.php
+++ b/Math/Geometry/Shape/D2/Rectangle.php
@@ -67,6 +67,6 @@ final class Rectangle implements D2ShapeInterface
*/
public static function getDiagonal(float $a, float $b) : float
{
- return sqrt($a * $a + $b * $b);
+ return \sqrt($a * $a + $b * $b);
}
}
diff --git a/Math/Geometry/Shape/D3/Cone.php b/Math/Geometry/Shape/D3/Cone.php
index 6ce8b28d7..f3297ea1f 100644
--- a/Math/Geometry/Shape/D3/Cone.php
+++ b/Math/Geometry/Shape/D3/Cone.php
@@ -52,7 +52,7 @@ final class Cone implements D3ShapeInterface
*/
public static function getSurface(float $r, float $h) : float
{
- return pi() * $r * ($r + sqrt($h ** 2 + $r ** 2));
+ return pi() * $r * ($r + \sqrt($h ** 2 + $r ** 2));
}
/**
@@ -67,7 +67,7 @@ final class Cone implements D3ShapeInterface
*/
public static function getSlantHeight(float $r, float $h) : float
{
- return sqrt($h ** 2 + $r ** 2);
+ return \sqrt($h ** 2 + $r ** 2);
}
/**
diff --git a/Math/Geometry/Shape/D3/RectangularPyramid.php b/Math/Geometry/Shape/D3/RectangularPyramid.php
index a14f24909..f0d607d47 100644
--- a/Math/Geometry/Shape/D3/RectangularPyramid.php
+++ b/Math/Geometry/Shape/D3/RectangularPyramid.php
@@ -54,7 +54,7 @@ final class RectangularPyramid implements D3ShapeInterface
*/
public static function getSurface(float $a, float $b, float $h) : float
{
- return $a * $b + $a * sqrt(($b / 2) ** 2 + $h ** 2) + $b * sqrt(($a / 2) ** 2 + $h ** 2);
+ return $a * $b + $a * \sqrt(($b / 2) ** 2 + $h ** 2) + $b * \sqrt(($a / 2) ** 2 + $h ** 2);
}
/**
@@ -70,6 +70,6 @@ final class RectangularPyramid implements D3ShapeInterface
*/
public static function getLateralSurface(float $a, float $b, float $h) : float
{
- return $a * sqrt(($b / 2) ** 2 + $h ** 2) + $b * sqrt(($a / 2) ** 2 + $h ** 2);
+ return $a * \sqrt(($b / 2) ** 2 + $h ** 2) + $b * \sqrt(($a / 2) ** 2 + $h ** 2);
}
}
diff --git a/Math/Geometry/Shape/D3/Sphere.php b/Math/Geometry/Shape/D3/Sphere.php
index 64debdbb1..39498dfdd 100644
--- a/Math/Geometry/Shape/D3/Sphere.php
+++ b/Math/Geometry/Shape/D3/Sphere.php
@@ -67,12 +67,12 @@ final class Sphere implements D3ShapeInterface
//$latDelta = $latTo - $latFrom;
$lonDelta = $lonTo - $lonFrom;
- $a = pow(cos($latTo) * sin($lonDelta), 2) + pow(cos($latFrom) * sin($latTo) - sin($latFrom) * cos($latTo) * cos($lonDelta), 2);
- $b = sin($latFrom) * sin($latTo) + cos($latFrom) * cos($latTo) * cos($lonDelta);
+ $a = \pow(\cos($latTo) * \sin($lonDelta), 2) + \pow(\cos($latFrom) * \sin($latTo) - \sin($latFrom) * \cos($latTo) * \cos($lonDelta), 2);
+ $b = \sin($latFrom) * \sin($latTo) + \cos($latFrom) * \cos($latTo) * \cos($lonDelta);
- $angle = atan2(sqrt($a), $b);
+ $angle = atan2(\sqrt($a), $b);
// Approximation (very good for short distances)
- // $angle = 2 * asin(sqrt(pow(sin($latDelta / 2), 2) + cos($latFrom) * cos($latTo) * pow(sin($lonDelta / 2), 2)));
+ // $angle = 2 * asin(\sqrt(\pow(\sin($latDelta / 2), 2) + \cos($latFrom) * \cos($latTo) * \pow(\sin($lonDelta / 2), 2)));
return $angle * $radius;
}
@@ -116,7 +116,7 @@ final class Sphere implements D3ShapeInterface
*/
public static function getRadiusByVolume(float $v) : float
{
- return pow($v * 3 / (4 * pi()), 1 / 3);
+ return \pow($v * 3 / (4 * pi()), 1 / 3);
}
/**
@@ -147,7 +147,7 @@ final class Sphere implements D3ShapeInterface
*/
public static function getRadiusBySurface(float $S) : float
{
- return sqrt($S / (4 * pi()));
+ return \sqrt($S / (4 * pi()));
}
/**
diff --git a/Math/Geometry/Shape/D3/Tetrahedron.php b/Math/Geometry/Shape/D3/Tetrahedron.php
index 70ce08e6d..9b99774fc 100644
--- a/Math/Geometry/Shape/D3/Tetrahedron.php
+++ b/Math/Geometry/Shape/D3/Tetrahedron.php
@@ -36,7 +36,7 @@ final class Tetrahedron implements D3ShapeInterface
*/
public static function getVolume(float $a) : float
{
- return $a ** 3 / (6 * sqrt(2));
+ return $a ** 3 / (6 * \sqrt(2));
}
/**
@@ -50,7 +50,7 @@ final class Tetrahedron implements D3ShapeInterface
*/
public static function getSurface(float $a) : float
{
- return sqrt(3) * $a ** 2;
+ return \sqrt(3) * $a ** 2;
}
/**
@@ -64,6 +64,6 @@ final class Tetrahedron implements D3ShapeInterface
*/
public static function getFaceArea(float $a) : float
{
- return sqrt(3) / 4 * $a ** 2;
+ return \sqrt(3) / 4 * $a ** 2;
}
}
diff --git a/Math/Matrix/CholeskyDecomposition.php b/Math/Matrix/CholeskyDecomposition.php
index 8b19164e4..fc86eca55 100644
--- a/Math/Matrix/CholeskyDecomposition.php
+++ b/Math/Matrix/CholeskyDecomposition.php
@@ -72,7 +72,7 @@ final class CholeskyDecomposition
if ($i === $j) {
if ($sum >= 0) {
- $this->L[$i][$i] = sqrt($sum);
+ $this->L[$i][$i] = \sqrt($sum);
} else {
$this->isSpd = false;
}
diff --git a/Math/Matrix/EigenvalueDecomposition.php b/Math/Matrix/EigenvalueDecomposition.php
index 9ba9ba3e6..9fe6269bf 100644
--- a/Math/Matrix/EigenvalueDecomposition.php
+++ b/Math/Matrix/EigenvalueDecomposition.php
@@ -401,7 +401,7 @@ final class EigenvalueDecomposition
$h += $this->ort[$i] * $this->ort[$i];
}
- $g = $this->ort[$m] > 0 ? -sqrt($h) : sqrt($h);
+ $g = $this->ort[$m] > 0 ? -sqrt($h) : \sqrt($h);
$h -= $this->ort[$m] * $g;
$this->ort[$m] -= $g;
@@ -466,7 +466,7 @@ final class EigenvalueDecomposition
$r = 0.0;
$d = 0.0;
- if (abs($yr) > \abs($yi)) {
+ if (\abs($yr) > \abs($yi)) {
$r = $yi / $yr;
$d = $yr + $r * $yi;
@@ -506,7 +506,7 @@ final class EigenvalueDecomposition
$this->E[$i] = 0.0;
}
- for ($j = max($i - 1, 0); $j < $nn; ++$j) {
+ for ($j = \max($i - 1, 0); $j < $nn; ++$j) {
$norm += \abs($this->H[$i][$j]);
}
}
@@ -520,7 +520,7 @@ final class EigenvalueDecomposition
$s = $norm;
}
- if (abs($this->H[$l][$l - 1]) < $eps * $s) {
+ if (\abs($this->H[$l][$l - 1]) < $eps * $s) {
break;
}
@@ -538,7 +538,7 @@ final class EigenvalueDecomposition
$w = $this->H[$n][$n - 1] * $this->H[$n - 1][$n];
$p = ($this->H[$n - 1][$n - 1] - $this->H[$n][$n]) / 2.0;
$q = $p * $p + $w;
- $z = sqrt(abs($q));
+ $z = \sqrt(\abs($q));
$this->H[$n][$n] += $exshift;
$this->H[$n - 1][$n - 1] += $exshift;
@@ -556,7 +556,7 @@ final class EigenvalueDecomposition
$s = \abs($x) + \abs($z);
$p = $x / $s;
$q = $z / $s;
- $r = sqrt($p * $p + $q * $q);
+ $r = \sqrt($p * $p + $q * $q);
$p = $p / $r;
$q = $q / $r;
diff --git a/Math/Matrix/LUDecomposition.php b/Math/Matrix/LUDecomposition.php
index 9a3dbe97f..cf187c8c5 100644
--- a/Math/Matrix/LUDecomposition.php
+++ b/Math/Matrix/LUDecomposition.php
@@ -95,7 +95,7 @@ final class LUDecomposition
for ($i = 0; $i < $this->m; ++$i) {
$LUrowi = $this->LU[$i];
- $kmax = min($i, $j);
+ $kmax = \min($i, $j);
$s = 0.0;
for ($k = 0; $k < $kmax; ++$k) {
@@ -106,7 +106,7 @@ final class LUDecomposition
$p = $j;
for ($i = $j + 1; $i < $this->m; ++$i) {
- if (abs($LUcolj[$i]) > abs($LUcolj[$p])) {
+ if (\abs($LUcolj[$i]) > \abs($LUcolj[$p])) {
$p = $i;
}
}
diff --git a/Math/Matrix/Matrix.php b/Math/Matrix/Matrix.php
index 135de8fba..d18e86a35 100644
--- a/Math/Matrix/Matrix.php
+++ b/Math/Matrix/Matrix.php
@@ -186,8 +186,8 @@ class Matrix implements \ArrayAccess, \Iterator
public function getSubMatrixByColumnsRows(array $rows, array $cols) : Matrix
{
$X = [[]];
- $rlength = count($rows);
- $clength = count($cols);
+ $rlength = \count($rows);
+ $clength = \count($cols);
for ($i = 0; $i <= $rlength; ++$i) {
for ($j = 0; $j <= $clength; ++$j) {
@@ -215,7 +215,7 @@ class Matrix implements \ArrayAccess, \Iterator
public function getSubMatrixByColumns(int $iRow, int $lRow, array $cols) : Matrix
{
$X = [[]];
- $length = count($cols);
+ $length = \count($cols);
for ($i = $iRow; $i <= $lRow; ++$i) {
for ($j = 0; $j <= $length; ++$j) {
@@ -243,7 +243,7 @@ class Matrix implements \ArrayAccess, \Iterator
public function getSubMatrixByRows(array $rows, int $iCol, int $lCol) : Matrix
{
$X = [[]];
- $length = count($rows);
+ $length = \count($rows);
for ($i = 0; $i < $length; ++$i) {
for ($j = $iCol; $j <= $lCol; ++$j) {
@@ -380,8 +380,8 @@ class Matrix implements \ArrayAccess, \Iterator
*/
public function setMatrix(array $matrix) : Matrix
{
- $this->m = count($matrix);
- $this->n = count($matrix[0] ?? 1);
+ $this->m = \count($matrix);
+ $this->n = \count($matrix[0] ?? 1);
$this->matrix = $matrix;
return $this;
@@ -640,7 +640,7 @@ class Matrix implements \ArrayAccess, \Iterator
$max = 0;
for ($j = $i; $j < $n; ++$j) {
- if (abs($arr[$j][$i]) > abs($arr[$max][$i])) {
+ if (\abs($arr[$j][$i]) > \abs($arr[$max][$i])) {
$max = $j;
}
}
diff --git a/Math/Number/Complex.php b/Math/Number/Complex.php
index c4a8c74c5..9f5fce944 100644
--- a/Math/Number/Complex.php
+++ b/Math/Number/Complex.php
@@ -117,8 +117,8 @@ final class Complex
public function sqrt() : Complex
{
return new self(
- sqrt(($this->re + sqrt($this->re ** 2 + $this->im ** 2)) / 2),
- ($this->im <=> 0) * sqrt((-$this->re + sqrt($this->re ** 2 + $this->im ** 2)) / 2)
+ \sqrt(($this->re + \sqrt($this->re ** 2 + $this->im ** 2)) / 2),
+ ($this->im <=> 0) * \sqrt((-$this->re + \sqrt($this->re ** 2 + $this->im ** 2)) / 2)
);
}
@@ -131,7 +131,7 @@ final class Complex
*/
public function abs()
{
- return sqrt($this->re ** 2 + $this->im ** 2);
+ return \sqrt($this->re ** 2 + $this->im ** 2);
}
/**
@@ -411,7 +411,7 @@ final class Complex
. ($this->im < 0 && $this->re !== 0 ? ' -' : '')
. ($this->im !== 0 ? (
($this->re !== 0 ? ' ' : '') . number_format(
- ($this->im < 0 && $this->re === 0 ? $this->im : abs($this->im)), $precision
+ ($this->im < 0 && $this->re === 0 ? $this->im : \abs($this->im)), $precision
) . 'i'
) : '');
}
diff --git a/Math/Number/Integer.php b/Math/Number/Integer.php
index 91a7f6586..fdcf3f977 100644
--- a/Math/Number/Integer.php
+++ b/Math/Number/Integer.php
@@ -127,8 +127,8 @@ final class Integer
*/
public static function greatestCommonDivisor(int $n, int $m) : int
{
- $n = abs($n);
- $m = abs($m);
+ $n = \abs($n);
+ $m = \abs($m);
while ($n !== $m) {
if ($n > $m) {
@@ -159,7 +159,7 @@ final class Integer
throw new \Exception('Only odd integers are allowed');
}
- $a = (int) ceil(sqrt($value));
+ $a = (int) ceil(\sqrt($value));
$b2 = ($a * $a - $value);
$i = 1;
@@ -169,6 +169,6 @@ final class Integer
$b2 = ($a * $a - $value);
}
- return [(int) round($a - sqrt($b2)), (int) round($a + sqrt($b2))];
+ return [(int) \round($a - \sqrt($b2)), (int) \round($a + \sqrt($b2))];
}
}
diff --git a/Math/Number/Numbers.php b/Math/Number/Numbers.php
index 0eb76b044..8edae0f62 100644
--- a/Math/Number/Numbers.php
+++ b/Math/Number/Numbers.php
@@ -95,7 +95,7 @@ final class Numbers
*/
public static function isSquare(int $n) : bool
{
- return abs(((int) sqrt($n)) * ((int) sqrt($n)) - $n) < 0.001;
+ return \abs(((int) \sqrt($n)) * ((int) \sqrt($n)) - $n) < 0.001;
}
/**
diff --git a/Math/Number/OperationInterface.php b/Math/Number/OperationInterface.php
index 2c73e7256..d484f923b 100644
--- a/Math/Number/OperationInterface.php
+++ b/Math/Number/OperationInterface.php
@@ -77,7 +77,7 @@ interface OperationInterface
*
* @since 1.0.0
*/
- public function pow($p);
+ public function \pow($p);
/**
* Abs of value.
@@ -86,5 +86,5 @@ interface OperationInterface
*
* @since 1.0.0
*/
- public function abs();
+ public function \abs();
}
diff --git a/Math/Number/Prime.php b/Math/Number/Prime.php
index b2de1c394..1ea3b4493 100644
--- a/Math/Number/Prime.php
+++ b/Math/Number/Prime.php
@@ -46,7 +46,7 @@ final class Prime
*/
public static function isMersenne(int $n) : bool
{
- $mersenne = log($n + 1, 2);
+ $mersenne = \log($n + 1, 2);
return $mersenne - (int) $mersenne < 0.00001;
}
@@ -96,14 +96,14 @@ final class Prime
for ($i = 0; $i < $k; ++$i) {
$a = mt_rand(2, $n - 1);
- $x = bcpowmod((string) $a, (string) $d, (string) $n);
+ $x = \bcpowmod((string) $a, (string) $d, (string) $n);
if ($x == 1 || $x == $n - 1) {
continue;
}
for ($j = 1; $j < $s; ++$j) {
- $x = bcmod(bcmul($x, $x), (string) $n);
+ $x = \bcmod(\bcmul($x, $x), (string) $n);
if ($x == 1) {
return false;
@@ -132,7 +132,7 @@ final class Prime
public static function sieveOfEratosthenes(int $n) : array
{
$number = 2;
- $range = range(2, $n);
+ $range = \range(2, $n);
$primes = array_combine($range, $range);
while ($number * $number < $n) {
@@ -144,7 +144,7 @@ final class Prime
unset($primes[$i]);
}
- $number = next($primes);
+ $number = \next($primes);
}
return array_values($primes);
@@ -167,7 +167,7 @@ final class Prime
return true;
}
- $sqrtN = sqrt($n);
+ $sqrtN = \sqrt($n);
while ($i <= $sqrtN) {
if ($n % $i === 0) {
return false;
diff --git a/Math/Parser/Evaluator.php b/Math/Parser/Evaluator.php
index f26f0819d..0868d5de8 100644
--- a/Math/Parser/Evaluator.php
+++ b/Math/Parser/Evaluator.php
@@ -121,21 +121,21 @@ class Evaluator
$output[] = $token;
} elseif (\strpbrk($token, '^*/+-') !== false) {
$o1 = $token;
- $o2 = end($stack);
+ $o2 = \end($stack);
while ($o2 !== false && \strpbrk($o2, '^*/+-') !== false
&& (($operators[$o1]['order'] === -1 && $operators[$o1]['precedence'] <= $operators[$o2]['precedence'])
|| ($operators[$o1]['order'] === 1 && $operators[$o1]['precedence'] < $operators[$o2]['precedence']))
) {
$output[] = \array_pop($stack);
- $o2 = end($stack);
+ $o2 = \end($stack);
}
$stack[] = $o1;
} elseif ($token === '(') {
$stack[] = $token;
} elseif ($token === ')') {
- while (end($stack) !== '(') {
+ while (\end($stack) !== '(') {
$output[] = \array_pop($stack);
}
@@ -143,7 +143,7 @@ class Evaluator
}
}
- while (count($stack) > 0) {
+ while (\count($stack) > 0) {
$output[] = \array_pop($stack);
}
diff --git a/Math/Statistic/Average.php b/Math/Statistic/Average.php
index 8f52a7233..b07f62a9f 100644
--- a/Math/Statistic/Average.php
+++ b/Math/Statistic/Average.php
@@ -63,7 +63,7 @@ final class Average
*/
public static function averageDatasetChange(array $x, int $h = 1) : float
{
- $count = count($x);
+ $count = \count($x);
return $h * ($x[$count - 1] - $x[0]) / ($count - 1);
}
@@ -85,7 +85,7 @@ final class Average
public static function totalMovingAverage(array $x, int $order, array $weight = null, bool $symmetric = false) : array
{
$periods = (int) ($order / 2);
- $count = count($x) - ($symmetric ? $periods : 0);
+ $count = \count($x) - ($symmetric ? $periods : 0);
$avg = [];
for ($i = $periods; $i < $count; ++$i) {
@@ -113,7 +113,7 @@ final class Average
public static function movingAverage(array $x, int $t, int $order, array $weight = null, bool $symmetric = false) : float
{
$periods = (int) ($order / 2);
- $count = count($x);
+ $count = \count($x);
if ($t < $periods || ($count < $periods) || ($symmetric && $t + $periods < $count)) {
throw new \Exception('Periods');
@@ -146,8 +146,8 @@ final class Average
*/
public static function weightedAverage(array $values, array $weight) : float
{
- if (($count = count($values)) !== count($weight)) {
- throw new InvalidDimensionException(count($values) . 'x' . count($weight));
+ if (($count = \count($values)) !== \count($weight)) {
+ throw new InvalidDimensionException(\count($values) . 'x' . \count($weight));
}
$avg = 0.0;
@@ -174,7 +174,7 @@ final class Average
*/
public static function arithmeticMean(array $values) : float
{
- $count = count($values);
+ $count = \count($values);
if ($count === 0) {
throw new ZeroDevisionException();
@@ -197,7 +197,7 @@ final class Average
public static function mode(array $values) : float
{
$count = array_count_values($values);
- $best = max($count);
+ $best = \max($count);
return (float) (array_keys($count, $best)[0] ?? 0.0);
}
@@ -216,7 +216,7 @@ final class Average
public static function median(array $values) : float
{
sort($values);
- $count = count($values);
+ $count = \count($values);
$middleval = (int) floor(($count - 1) / 2);
if ($count % 2) {
@@ -246,13 +246,13 @@ final class Average
*/
public static function geometricMean(array $values, int $offset = 0) : float
{
- $count = count($values);
+ $count = \count($values);
if ($count === 0) {
throw new ZeroDevisionException();
}
- return pow(\array_product($values), 1 / $count);
+ return \pow(\array_product($values), 1 / $count);
}
/**
@@ -277,7 +277,7 @@ final class Average
$values = array_slice($values, $offset, -$offset);
}
- $count = count($values);
+ $count = \count($values);
$sum = 0.0;
foreach ($values as $value) {
@@ -307,11 +307,11 @@ final class Average
{
$y = 0;
$x = 0;
- $size = count($angles);
+ $size = \count($angles);
for ($i = 0; $i < $size; ++$i) {
- $x += cos(deg2rad($angles[$i]));
- $y += sin(deg2rad($angles[$i]));
+ $x += \cos(deg2rad($angles[$i]));
+ $y += \sin(deg2rad($angles[$i]));
}
$x /= $size;
@@ -344,12 +344,12 @@ final class Average
$coss = 0.0;
foreach ($angles as $a) {
- $sins += sin(deg2rad($a));
- $coss += cos(deg2rad($a));
+ $sins += \sin(deg2rad($a));
+ $coss += \cos(deg2rad($a));
}
- $avgsin = $sins / (0.0 + count($angles));
- $avgcos = $coss / (0.0 + count($angles));
+ $avgsin = $sins / (0.0 + \count($angles));
+ $avgcos = $coss / (0.0 + \count($angles));
$avgang = rad2deg(atan2($avgsin, $avgcos));
while ($avgang < 0.0) {
diff --git a/Math/Statistic/Basic.php b/Math/Statistic/Basic.php
index 2215a233f..385494b6a 100644
--- a/Math/Statistic/Basic.php
+++ b/Math/Statistic/Basic.php
@@ -51,7 +51,7 @@ final class Basic
$freaquency = [];
$sum = 1;
- if (!($isArray = is_array(reset($values)))) {
+ if (!($isArray = is_array(\reset($values)))) {
$sum = array_sum($values);
}
diff --git a/Math/Statistic/Correlation.php b/Math/Statistic/Correlation.php
index e98f47d3f..cdab96310 100644
--- a/Math/Statistic/Correlation.php
+++ b/Math/Statistic/Correlation.php
@@ -66,7 +66,7 @@ final class Correlation
{
$squaredMeanDeviation = MeasureOfDispersion::squaredMeanDeviation($x);
$mean = Average::arithmeticMean($x);
- $count = count($x);
+ $count = \count($x);
$sum = 0.0;
for ($i = $k; $i < $count; ++$i) {
diff --git a/Math/Statistic/Forecast/Error.php b/Math/Statistic/Forecast/Error.php
index 2b362f062..886a55cb9 100644
--- a/Math/Statistic/Forecast/Error.php
+++ b/Math/Statistic/Forecast/Error.php
@@ -139,7 +139,7 @@ class Error
*/
public static function getRootMeanSquaredError(array $errors) : float
{
- return sqrt(Average::arithmeticMean(Functions::powerInt($errors, 2)));
+ return \sqrt(Average::arithmeticMean(Functions::powerInt($errors, 2)));
}
/**
@@ -158,8 +158,8 @@ class Error
*/
public static function getCoefficientOfDetermination(array $observed, array $forecasted) : float
{
- $countO = count($observed);
- $countF = count($forecasted);
+ $countO = \count($observed);
+ $countF = \count($forecasted);
$sum1 = 0;
$sum2 = 0;
$meanY = Average::arithmeticMean($observed);
@@ -224,7 +224,7 @@ class Error
*/
public static function getAkaikeInformationCriterion(float $sse, int $observations, int $predictors) : float
{
- return $observations * log($sse / $observations) + 2 * ($predictors + 2);
+ return $observations * \log($sse / $observations) + 2 * ($predictors + 2);
}
/**
@@ -258,7 +258,7 @@ class Error
*/
public static function getSchwarzBayesianInformationCriterion(float $sse, int $observations, int $predictors) : float
{
- return $observations * log($sse / $observations) + ($predictors + 2) * log($observations);
+ return $observations * \log($sse / $observations) + ($predictors + 2) * \log($observations);
}
/**
@@ -291,7 +291,7 @@ class Error
$error = [];
foreach ($observed as $key => $value) {
- $error[] = 200 * abs($value - $forecasted[$key]) / ($value + $forecasted[$key]);
+ $error[] = 200 * \abs($value - $forecasted[$key]) / ($value + $forecasted[$key]);
}
return Average::arithmeticMean($error);
@@ -335,7 +335,7 @@ class Error
$sum = 0.0;
foreach ($observed as $value) {
- $sum += abs($value - $mean);
+ $sum += \abs($value - $mean);
}
return $error / MeasureOfDispersion::meanDeviation($observed);
@@ -383,7 +383,7 @@ class Error
public static function getScaledErrorArray(array $errors, array $observed, int $m = 1) : array
{
$scaled = [];
- $naive = 1 / (count($observed) - $m) * self::getNaiveForecast($observed, $m);
+ $naive = 1 / (\count($observed) - $m) * self::getNaiveForecast($observed, $m);
foreach ($errors as $error) {
$error[] = $error / $naive;
@@ -405,7 +405,7 @@ class Error
*/
public static function getScaledError(float $error, array $observed, int $m = 1) : float
{
- return $error / (1 / (count($observed) - $m) * self::getNaiveForecast($observed, $m));
+ return $error / (1 / (\count($observed) - $m) * self::getNaiveForecast($observed, $m));
}
/**
@@ -421,10 +421,10 @@ class Error
private static function getNaiveForecast(array $observed, int $m = 1) : float
{
$sum = 0.0;
- $count = count($observed);
+ $count = \count($observed);
for ($i = 0 + $m; $i < $count; ++$i) {
- $sum += abs($observed[$i] - $observed[$i - $m]);
+ $sum += \abs($observed[$i] - $observed[$i - $m]);
}
return $sum;
diff --git a/Math/Statistic/Forecast/Regression/LevelLogRegression.php b/Math/Statistic/Forecast/Regression/LevelLogRegression.php
index ad95249b0..3c3e4368f 100644
--- a/Math/Statistic/Forecast/Regression/LevelLogRegression.php
+++ b/Math/Statistic/Forecast/Regression/LevelLogRegression.php
@@ -31,12 +31,12 @@ class LevelLogRegression extends RegressionAbstract
*/
public static function getRegression(array $x, array $y) : array
{
- if (($c = count($x)) !== count($y)) {
- throw new InvalidDimensionException($c . 'x' . count($y));
+ if (($c = \count($x)) !== \count($y)) {
+ throw new InvalidDimensionException($c . 'x' . \count($y));
}
for ($i = 0; $i < $c; ++$i) {
- $x[$i] = log($x[$i]);
+ $x[$i] = \log($x[$i]);
}
return parent::getRegression($x, $y);
diff --git a/Math/Statistic/Forecast/Regression/LogLevelRegression.php b/Math/Statistic/Forecast/Regression/LogLevelRegression.php
index 2b58b923b..47040cd9d 100644
--- a/Math/Statistic/Forecast/Regression/LogLevelRegression.php
+++ b/Math/Statistic/Forecast/Regression/LogLevelRegression.php
@@ -31,12 +31,12 @@ class LogLevelRegression extends RegressionAbstract
*/
public static function getRegression(array $x, array $y) : array
{
- if (($c = count($x)) !== count($y)) {
- throw new InvalidDimensionException($c . 'x' . count($y));
+ if (($c = \count($x)) !== \count($y)) {
+ throw new InvalidDimensionException($c . 'x' . \count($y));
}
for ($i = 0; $i < $c; ++$i) {
- $y[$i] = log($y[$i]);
+ $y[$i] = \log($y[$i]);
}
return parent::getRegression($x, $y);
diff --git a/Math/Statistic/Forecast/Regression/LogLogRegression.php b/Math/Statistic/Forecast/Regression/LogLogRegression.php
index a942e9db7..c023989ab 100644
--- a/Math/Statistic/Forecast/Regression/LogLogRegression.php
+++ b/Math/Statistic/Forecast/Regression/LogLogRegression.php
@@ -31,13 +31,13 @@ class LogLogRegression extends RegressionAbstract
*/
public static function getRegression(array $x, array $y) : array
{
- if (($c = count($x)) !== count($y)) {
- throw new InvalidDimensionException($c . 'x' . count($y));
+ if (($c = \count($x)) !== \count($y)) {
+ throw new InvalidDimensionException($c . 'x' . \count($y));
}
for ($i = 0; $i < $c; ++$i) {
- $x[$i] = log($x[$i]);
- $y[$i] = log($y[$i]);
+ $x[$i] = \log($x[$i]);
+ $y[$i] = \log($y[$i]);
}
return parent::getRegression($x, $y);
diff --git a/Math/Statistic/Forecast/Regression/MultipleLinearRegression.php b/Math/Statistic/Forecast/Regression/MultipleLinearRegression.php
index 197fefe37..f55c33154 100644
--- a/Math/Statistic/Forecast/Regression/MultipleLinearRegression.php
+++ b/Math/Statistic/Forecast/Regression/MultipleLinearRegression.php
@@ -22,11 +22,11 @@ class MultipleLinearRegression
*/
public static function getRegression(array $x, array $y) : array
{
- $X = new Matrix(count($x), count($x[0]));
+ $X = new Matrix(\count($x), \count($x[0]));
$X->setMatrix($x);
$XT = $X->transpose();
- $Y = new Matrix(count($y));
+ $Y = new Matrix(\count($y));
$Y->setMatrix($y);
return $XT->mult($X)->inverse()->mult($XT)->mult($Y)->getMatrix();
diff --git a/Math/Statistic/Forecast/Regression/RegressionAbstract.php b/Math/Statistic/Forecast/Regression/RegressionAbstract.php
index 9d333ad6b..aac740631 100644
--- a/Math/Statistic/Forecast/Regression/RegressionAbstract.php
+++ b/Math/Statistic/Forecast/Regression/RegressionAbstract.php
@@ -44,8 +44,8 @@ abstract class RegressionAbstract
*/
public static function getRegression(array $x, array $y) : array
{
- if (count($x) !== count($y)) {
- throw new InvalidDimensionException(count($x) . 'x' . count($y));
+ if (\count($x) !== \count($y)) {
+ throw new InvalidDimensionException(\count($x) . 'x' . \count($y));
}
$b1 = self::getBeta1($x, $y);
@@ -68,7 +68,7 @@ abstract class RegressionAbstract
*/
public static function getStandardErrorOfRegression(array $errors) : float
{
- $count = count($errors);
+ $count = \count($errors);
$sum = 0.0;
for ($i = 0; $i < $count; ++$i) {
@@ -76,7 +76,7 @@ abstract class RegressionAbstract
}
// todo: could this be - 1 depending on the different definitions?!
- return sqrt(1 / ($count - 2) * $sum);
+ return \sqrt(1 / ($count - 2) * $sum);
}
/**
@@ -93,7 +93,7 @@ abstract class RegressionAbstract
*/
public static function getPredictionInterval(float $forecasted, array $x, array $errors, float $multiplier = ForecastIntervalMultiplier::P_95) : array
{
- $count = count($x);
+ $count = \count($x);
$meanX = Average::arithmeticMean($x);
$sum = 0.0;
@@ -101,7 +101,7 @@ abstract class RegressionAbstract
$sum += ($x[$i] - $meanX) ** 2;
}
- $interval = $multiplier * self::getStandardErrorOfRegression($errors) * sqrt(1 + 1 / $count + $sum / (($count - 1) * MeasureOfDispersion::standardDeviation($x) ** 2));
+ $interval = $multiplier * self::getStandardErrorOfRegression($errors) * \sqrt(1 + 1 / $count + $sum / (($count - 1) * MeasureOfDispersion::standardDeviation($x) ** 2));
return [$forecasted - $interval, $forecasted + $interval];
}
@@ -120,7 +120,7 @@ abstract class RegressionAbstract
*/
private static function getBeta1(array $x, array $y) : float
{
- $count = count($x);
+ $count = \count($x);
$meanX = Average::arithmeticMean($x);
$meanY = Average::arithmeticMean($y);
diff --git a/Math/Statistic/MeasureOfDispersion.php b/Math/Statistic/MeasureOfDispersion.php
index c93bbce1f..6f6fb71b1 100644
--- a/Math/Statistic/MeasureOfDispersion.php
+++ b/Math/Statistic/MeasureOfDispersion.php
@@ -52,8 +52,8 @@ final class MeasureOfDispersion
public static function range(array $values) : float
{
sort($values);
- $end = end($values);
- $start = reset($values);
+ $end = \end($values);
+ $start = \reset($values);
return $end - $start;
}
@@ -106,7 +106,7 @@ final class MeasureOfDispersion
$sum += ($value - $mean) ** 2;
}
- return sqrt($sum / (count($values) - 1));
+ return \sqrt($sum / (\count($values) - 1));
}
/**
@@ -129,7 +129,7 @@ final class MeasureOfDispersion
*/
public static function sampleVariance(array $values, float $mean = null) : float
{
- $count = count($values);
+ $count = \count($values);
if ($count < 2) {
throw new ZeroDevisionException();
@@ -159,7 +159,7 @@ final class MeasureOfDispersion
*/
public static function empiricalVariance(array $values, array $probabilities = [], float $mean = null) : float
{
- $count = count($values);
+ $count = \count($values);
$hasProbability = !empty($probabilities);
if ($count === 0) {
@@ -196,14 +196,14 @@ final class MeasureOfDispersion
*/
public static function empiricalCovariance(array $x, array $y, float $meanX = null, float $meanY = null) : float
{
- $count = count($x);
+ $count = \count($x);
if ($count < 2) {
throw new ZeroDevisionException();
}
- if ($count !== count($y)) {
- throw new InvalidDimensionException($count . 'x' . count($y));
+ if ($count !== \count($y)) {
+ throw new InvalidDimensionException($count . 'x' . \count($y));
}
$xMean = $meanX !== null ? $meanX : Average::arithmeticMean($x);
@@ -251,7 +251,7 @@ final class MeasureOfDispersion
$sum += ($xi - $mean);
}
- return $sum / count($x);
+ return $sum / \count($x);
}
/**
@@ -270,10 +270,10 @@ final class MeasureOfDispersion
$sum = 0.0;
foreach ($x as $xi) {
- $sum += abs($xi - $mean);
+ $sum += \abs($xi - $mean);
}
- return $sum / count($x);
+ return $sum / \count($x);
}
/**
@@ -295,6 +295,6 @@ final class MeasureOfDispersion
$sum += ($xi - $mean) ** 2;
}
- return $sum / count($x);
+ return $sum / \count($x);
}
}
diff --git a/Math/Stochastic/Distribution/BernoulliDistribution.php b/Math/Stochastic/Distribution/BernoulliDistribution.php
index 62d663cf9..ea0fb71f3 100644
--- a/Math/Stochastic/Distribution/BernoulliDistribution.php
+++ b/Math/Stochastic/Distribution/BernoulliDistribution.php
@@ -148,7 +148,7 @@ class BernoulliDistribution
*/
public static function getMgf(float $p, float $t) : float
{
- return (1 - $p) + $p * exp($t);
+ return (1 - $p) + $p * \exp($t);
}
/**
@@ -162,7 +162,7 @@ class BernoulliDistribution
*/
public static function getSkewness(float $p) : float
{
- return (1 - 2 * $p) / sqrt($p * (1 - $p));
+ return (1 - 2 * $p) / \sqrt($p * (1 - $p));
}
/**
@@ -176,7 +176,7 @@ class BernoulliDistribution
*/
public static function getEntropy(float $p) : float
{
- return -(1 - $p) * log(1 - $p) - $p * log($p);
+ return -(1 - $p) * \log(1 - $p) - $p * \log($p);
}
/**
diff --git a/Math/Stochastic/Distribution/BinomialDistribution.php b/Math/Stochastic/Distribution/BinomialDistribution.php
index 82a49127c..e3ed6c904 100644
--- a/Math/Stochastic/Distribution/BinomialDistribution.php
+++ b/Math/Stochastic/Distribution/BinomialDistribution.php
@@ -57,7 +57,7 @@ class BinomialDistribution
*/
public static function getMgf(int $n, float $t, float $p) : float
{
- return pow(1 - $p + $p * exp($t), $n);
+ return \pow(1 - $p + $p * \exp($t), $n);
}
/**
@@ -72,7 +72,7 @@ class BinomialDistribution
*/
public static function getSkewness(int $n, float $p) : float
{
- return (1 - 2 * $p) / sqrt($n * $p * (1 - $p));
+ return (1 - 2 * $p) / \sqrt($n * $p * (1 - $p));
}
/**
@@ -142,7 +142,7 @@ class BinomialDistribution
*/
public static function getPmf(int $n, int $k, float $p) : float
{
- return Functions::binomialCoefficient($n, $k) * pow($p, $k) * pow(1 - $p, $n - $k);
+ return Functions::binomialCoefficient($n, $k) * \pow($p, $k) * \pow(1 - $p, $n - $k);
}
/**
diff --git a/Math/Stochastic/Distribution/CauchyDistribution.php b/Math/Stochastic/Distribution/CauchyDistribution.php
index 6dbb6a68a..16a3a6ce2 100644
--- a/Math/Stochastic/Distribution/CauchyDistribution.php
+++ b/Math/Stochastic/Distribution/CauchyDistribution.php
@@ -95,7 +95,7 @@ class CauchyDistribution
*/
public static function getEntropy(float $gamma) : float
{
- return log(4 * M_PI * $gamma);
+ return \log(4 * M_PI * $gamma);
}
public static function getRandom()
diff --git a/Math/Stochastic/Distribution/ChiSquaredDistribution.php b/Math/Stochastic/Distribution/ChiSquaredDistribution.php
index 18547f119..d01a69bda 100644
--- a/Math/Stochastic/Distribution/ChiSquaredDistribution.php
+++ b/Math/Stochastic/Distribution/ChiSquaredDistribution.php
@@ -90,7 +90,7 @@ class ChiSquaredDistribution
*/
public static function testHypothesis(array $dataset, array $expected, float $significance = 0.05, int $df = 0) : array
{
- if (($count = count($dataset)) !== count($expected)) {
+ if (($count = \count($dataset)) !== \count($expected)) {
throw new \Exception('Dimension');
}
@@ -117,7 +117,7 @@ class ChiSquaredDistribution
}
}
- $key = key(end(self::TABLE[$df]));
+ $key = \key(\end(self::TABLE[$df]));
$p = 1 - ($p ?? ($key === false ? 1 : (float) $key));
return ['P' => $p, 'H0' => ($p > $significance), 'df' => $df];
@@ -134,10 +134,10 @@ class ChiSquaredDistribution
*/
public static function getDegreesOfFreedom(array $values) : int
{
- if (is_array($first = reset($values))) {
- return (count($values) - 1) * (count($first) - 1);
+ if (is_array($first = \reset($values))) {
+ return (\count($values) - 1) * (\count($first) - 1);
} else {
- return count($values) - 1;
+ return \count($values) - 1;
}
}
@@ -159,7 +159,7 @@ class ChiSquaredDistribution
throw new \Exception('Out of bounds');
}
- return 1 / (pow(2, $df / 2) * Gamma::lanczosApproximationReal(($df / 2))) * pow($x, $df / 2 - 1) * exp(-$x / 2);
+ return 1 / (\pow(2, $df / 2) * Gamma::lanczosApproximationReal(($df / 2))) * \pow($x, $df / 2 - 1) * \exp(-$x / 2);
}
/**
@@ -173,7 +173,7 @@ class ChiSquaredDistribution
*/
public static function getMode(int $df) : int
{
- return max([$df - 2, 0]);
+ return \max([$df - 2, 0]);
}
/**
@@ -236,7 +236,7 @@ class ChiSquaredDistribution
throw new \Exception('Out of bounds');
}
- return pow(1 - 2 * $t, -$df / 2);
+ return \pow(1 - 2 * $t, -$df / 2);
}
/**
@@ -250,7 +250,7 @@ class ChiSquaredDistribution
*/
public static function getSkewness(int $df) : float
{
- return sqrt(8 / $df);
+ return \sqrt(8 / $df);
}
/**
diff --git a/Math/Stochastic/Distribution/ExponentialDistribution.php b/Math/Stochastic/Distribution/ExponentialDistribution.php
index 43be19014..a00ef1fe0 100644
--- a/Math/Stochastic/Distribution/ExponentialDistribution.php
+++ b/Math/Stochastic/Distribution/ExponentialDistribution.php
@@ -36,7 +36,7 @@ class ExponentialDistribution
*/
public static function getPdf(float $x, float $lambda) : float
{
- return $x >= 0 ? $lambda * exp(-$lambda * $x) : 0;
+ return $x >= 0 ? $lambda * \exp(-$lambda * $x) : 0;
}
/**
@@ -51,7 +51,7 @@ class ExponentialDistribution
*/
public static function getCdf(float $x, float $lambda) : float
{
- return $x >= 0 ? 1 - exp($lambda * $x) : 0;
+ return $x >= 0 ? 1 - \exp($lambda * $x) : 0;
}
/**
@@ -105,7 +105,7 @@ class ExponentialDistribution
*/
public static function getVariance(float $lambda) : float
{
- return pow($lambda, -2);
+ return \pow($lambda, -2);
}
/**
diff --git a/Math/Stochastic/Distribution/GeometricDistribution.php b/Math/Stochastic/Distribution/GeometricDistribution.php
index fdbca94ad..08dc4017b 100644
--- a/Math/Stochastic/Distribution/GeometricDistribution.php
+++ b/Math/Stochastic/Distribution/GeometricDistribution.php
@@ -36,7 +36,7 @@ class GeometricDistribution
*/
public static function getPmf(float $p, int $k) : float
{
- return pow(1 - $p, $k - 1) * $p;
+ return \pow(1 - $p, $k - 1) * $p;
}
/**
@@ -51,7 +51,7 @@ class GeometricDistribution
*/
public static function getCdf(float $p, int $k) : float
{
- return 1 - pow(1 - $p, $k);
+ return 1 - \pow(1 - $p, $k);
}
/**
@@ -91,7 +91,7 @@ class GeometricDistribution
*/
public static function getMedian(float $p) : float
{
- return ceil(-1 / (log(1 - $p, 2)));
+ return ceil(-1 / (\log(1 - $p, 2)));
}
/**
@@ -120,7 +120,7 @@ class GeometricDistribution
*/
public static function getMgf(float $p, float $t) : float
{
- return $p * exp($t) / (1 - (1 - $p) * exp($t));
+ return $p * \exp($t) / (1 - (1 - $p) * \exp($t));
}
/**
@@ -134,7 +134,7 @@ class GeometricDistribution
*/
public static function getSkewness(float $lambda) : float
{
- return (2 - $lambda) / sqrt(1 - $lambda);
+ return (2 - $lambda) / \sqrt(1 - $lambda);
}
/**
diff --git a/Math/Stochastic/Distribution/LaplaceDistribution.php b/Math/Stochastic/Distribution/LaplaceDistribution.php
index 4599f493a..12b14ab8f 100644
--- a/Math/Stochastic/Distribution/LaplaceDistribution.php
+++ b/Math/Stochastic/Distribution/LaplaceDistribution.php
@@ -37,7 +37,7 @@ class LaplaceDistribution
*/
public static function getPdf(float $x, float $mu, float $b) : float
{
- return 1 / (2 * $b) * exp(-abs($x - $mu) / $b);
+ return 1 / (2 * $b) * \exp(-abs($x - $mu) / $b);
}
/**
@@ -53,7 +53,7 @@ class LaplaceDistribution
*/
public static function getCdf(float $x, float $mu, float $b) : float
{
- return $x < $mu ? exp(($x - $mu) / $b) / 2 : 1 - exp(-($x - $mu) / $b) / 2;
+ return $x < $mu ? \exp(($x - $mu) / $b) / 2 : 1 - \exp(-($x - $mu) / $b) / 2;
}
/**
@@ -131,7 +131,7 @@ class LaplaceDistribution
throw new \Exception('Out of bounds');
}
- return exp($mu * $t) / (1 - $b ** 2 * $t ** 2);
+ return \exp($mu * $t) / (1 - $b ** 2 * $t ** 2);
}
/**
diff --git a/Math/Stochastic/Distribution/NormalDistribution.php b/Math/Stochastic/Distribution/NormalDistribution.php
index d56dca752..681d558b5 100644
--- a/Math/Stochastic/Distribution/NormalDistribution.php
+++ b/Math/Stochastic/Distribution/NormalDistribution.php
@@ -38,7 +38,7 @@ class NormalDistribution
*/
public static function getPdf(float $x, float $mu, float $sig) : float
{
- return 1 / ($sig * sqrt(2 * pi())) * exp(-($x - $mu) ** 2 / (2 * $sig ** 2));
+ return 1 / ($sig * \sqrt(2 * pi())) * \exp(-($x - $mu) ** 2 / (2 * $sig ** 2));
}
/**
@@ -110,7 +110,7 @@ class NormalDistribution
*/
public static function getMgf(float $t, float $mu, float $sig) : float
{
- return exp($mu * $t + ($sig ** 2 * $t ** 2) / 2);
+ return \exp($mu * $t + ($sig ** 2 * $t ** 2) / 2);
}
/**
diff --git a/Math/Stochastic/Distribution/PoissonDistribution.php b/Math/Stochastic/Distribution/PoissonDistribution.php
index 94d6d9088..fa76ee1d8 100644
--- a/Math/Stochastic/Distribution/PoissonDistribution.php
+++ b/Math/Stochastic/Distribution/PoissonDistribution.php
@@ -30,7 +30,7 @@ class PoissonDistribution
/**
* Get density.
*
- * Formula: e^(k * ln(lambda) - lambda - log(gamma(k+1))
+ * Formula: e^(k * ln(lambda) - lambda - \log(gamma(k+1))
*
* @param int $k Value k
* @param float $lambda Lambda
@@ -41,7 +41,7 @@ class PoissonDistribution
*/
public static function getPmf(int $k, float $lambda) : float
{
- return exp($k * log($lambda) - $lambda - log(Gamma::getGammaInteger($k + 1)));
+ return \exp($k * \log($lambda) - $lambda - \log(Gamma::getGammaInteger($k + 1)));
}
/**
@@ -59,10 +59,10 @@ class PoissonDistribution
$sum = 0.0;
for ($i = 0; $i < $k + 1; ++$i) {
- $sum += pow($lambda, $i) / Functions::fact($i);
+ $sum += \pow($lambda, $i) / Functions::fact($i);
}
- return exp(-$lambda) * $sum;
+ return \exp(-$lambda) * $sum;
}
/**
@@ -133,7 +133,7 @@ class PoissonDistribution
*/
public static function getMgf(float $lambda, float $t) : float
{
- return exp($lambda * (exp($t) - 1));
+ return \exp($lambda * (\exp($t) - 1));
}
/**
@@ -147,7 +147,7 @@ class PoissonDistribution
*/
public static function getSkewness(float $lambda) : float
{
- return pow($lambda, -1 / 2);
+ return \pow($lambda, -1 / 2);
}
/**
@@ -161,7 +161,7 @@ class PoissonDistribution
*/
public static function getFisherInformation(float $lambda) : float
{
- return pow($lambda, -1);
+ return \pow($lambda, -1);
}
/**
@@ -175,7 +175,7 @@ class PoissonDistribution
*/
public static function getExKurtosis(float $lambda) : float
{
- return pow($lambda, -1);
+ return \pow($lambda, -1);
}
public static function getRandom()
diff --git a/Math/Stochastic/Distribution/UniformDistributionContinuous.php b/Math/Stochastic/Distribution/UniformDistributionContinuous.php
index 055be52cb..76df96271 100644
--- a/Math/Stochastic/Distribution/UniformDistributionContinuous.php
+++ b/Math/Stochastic/Distribution/UniformDistributionContinuous.php
@@ -91,7 +91,7 @@ class UniformDistributionContinuous
*/
public static function getMgf(int $t, float $a, float $b) : float
{
- return $t === 0 ? 1 : (exp($t * $b) - exp($t * $a)) / ($t * ($b - $a));
+ return $t === 0 ? 1 : (\exp($t * $b) - \exp($t * $a)) / ($t * ($b - $a));
}
/**
diff --git a/Math/Stochastic/Distribution/UniformDistributionDiscrete.php b/Math/Stochastic/Distribution/UniformDistributionDiscrete.php
index a153a83d7..4c6654aeb 100644
--- a/Math/Stochastic/Distribution/UniformDistributionDiscrete.php
+++ b/Math/Stochastic/Distribution/UniformDistributionDiscrete.php
@@ -59,7 +59,7 @@ class UniformDistributionDiscrete
throw new \Exception('Out of bounds');
}
- return (floor($k) - $a + 1) / ($b - $a + 1);
+ return (\floor($k) - $a + 1) / ($b - $a + 1);
}
/**
@@ -75,7 +75,7 @@ class UniformDistributionDiscrete
*/
public static function getMgf(int $t, float $a, float $b) : float
{
- return (exp($a * $t) - exp(($b + 1) * $t)) / (($b - $a + 1) * (1 - exp($t)));
+ return (\exp($a * $t) - \exp(($b + 1) * $t)) / (($b - $a + 1) * (1 - \exp($t)));
}
/**
diff --git a/Math/Stochastic/NaiveBayesFilter.php b/Math/Stochastic/NaiveBayesFilter.php
index af4de2858..057067380 100644
--- a/Math/Stochastic/NaiveBayesFilter.php
+++ b/Math/Stochastic/NaiveBayesFilter.php
@@ -44,11 +44,11 @@ class NaiveBayesFilter
$n = 0.0;
foreach ($toMatch as $element) {
if (isset($normalizedDict[$element])) {
- $n += log(1 - $normalizedDict[$element]['match'] / $normalizedDict[$element]['total']) - log($normalizedDict[$element]['match'] / $normalizedDict[$element]['total']);
+ $n += \log(1 - $normalizedDict[$element]['match'] / $normalizedDict[$element]['total']) - \log($normalizedDict[$element]['match'] / $normalizedDict[$element]['total']);
}
}
- return 1 / (1 + exp($n));
+ return 1 / (1 + \exp($n));
}
private function normalizeDictionary() : array
diff --git a/Message/Console/Header.php b/Message/Console/Header.php
index 7b7d56c01..c9ca5e4a7 100644
--- a/Message/Console/Header.php
+++ b/Message/Console/Header.php
@@ -77,7 +77,7 @@ final class Header extends HeaderAbstract
return false;
}
- $key = strtolower($key);
+ $key = \strtolower($key);
if (!$overwrite && isset($this->header[$key])) {
return false;
@@ -105,7 +105,7 @@ final class Header extends HeaderAbstract
*/
public static function isSecurityHeader(string $key) : bool
{
- $key = strtolower($key);
+ $key = \strtolower($key);
return $key === 'content-security-policy'
|| $key === 'x-xss-protection'
diff --git a/Message/Mail/EmailAbstract.php b/Message/Mail/EmailAbstract.php
index 4e66fcb9e..1df49f4e2 100644
--- a/Message/Mail/EmailAbstract.php
+++ b/Message/Mail/EmailAbstract.php
@@ -145,7 +145,7 @@ class EmailAbstract
*/
public function connect(string $user = '', string $pass = '') : void
{
- $this->mailbox = substr($this->mailbox, 0, -1) . ($this->ssl ? '/ssl/validate-cert' : '/novalidate-cert') . '}';
+ $this->mailbox = \substr($this->mailbox, 0, -1) . ($this->ssl ? '/ssl/validate-cert' : '/novalidate-cert') . '}';
// /novalidate-cert
if ($this->con === null) {
@@ -235,7 +235,7 @@ class EmailAbstract
{
$ids = imap_search($this->con, $option, SE_FREE, 'UTF-8');
- return is_array($ids) ? imap_fetch_overview($this->con, implode(',', $ids)) : [];
+ return is_array($ids) ? imap_fetch_overview($this->con, \implode(',', $ids)) : [];
}
/**
diff --git a/Model/Html/Meta.php b/Model/Html/Meta.php
index f9a06bfcd..1d6ccb189 100644
--- a/Model/Html/Meta.php
+++ b/Model/Html/Meta.php
@@ -240,7 +240,7 @@ class Meta implements RenderableInterface
*/
public function render() : string
{
- return (count($this->keywords) > 0 ? '"' : '')
+ return (\count($this->keywords) > 0 ? '"' : '')
. (!empty($this->author) ? '' : '')
. (!empty($this->description) ? '' : '')
. (!empty($this->charset) ? '' : '')
diff --git a/Module/ModuleManager.php b/Module/ModuleManager.php
index f3e099b5f..d5d9770f6 100644
--- a/Module/ModuleManager.php
+++ b/Module/ModuleManager.php
@@ -147,14 +147,14 @@ final class ModuleManager
$uriPdo = '';
$i = 1;
- $c = count($uriHash);
+ $c = \count($uriHash);
for ($k = 0; $k < $c; ++$k) {
$uriPdo .= ':pid' . $i . ',';
++$i;
}
- $uriPdo = rtrim($uriPdo, ',');
+ $uriPdo = \rtrim($uriPdo, ',');
/* TODO: make join in order to see if they are active */
$sth = $this->app->dbPool->get('select')->con->prepare(
@@ -250,8 +250,8 @@ final class ModuleManager
{
if (empty($this->all)) {
chdir($this->modulePath);
- $files = glob('*', GLOB_ONLYDIR);
- $c = count($files);
+ $files = \glob('*', GLOB_ONLYDIR);
+ $c = \count($files);
for ($i = 0; $i < $c; ++$i) {
$path = $this->modulePath . '/' . $files[$i] . '/info.json';
diff --git a/Socket/Client/Client.php b/Socket/Client/Client.php
index 69ba36cc5..4dc0c932d 100644
--- a/Socket/Client/Client.php
+++ b/Socket/Client/Client.php
@@ -76,7 +76,7 @@ class Client extends SocketAbstract
try {
$i++;
$msg = 'disconnect';
- socket_write($this->sock, $msg, strlen($msg));
+ socket_write($this->sock, $msg, \strlen($msg));
$read = [$this->sock];
@@ -86,7 +86,7 @@ class Client extends SocketAbstract
// socket_strerror(socket_last_error());
//}
- if (count($read) > 0) {
+ if (\count($read) > 0) {
$data = socket_read($this->sock, 1024);
/* Server no data */
@@ -95,7 +95,7 @@ class Client extends SocketAbstract
}
/* Normalize */
- $data = trim($data);
+ $data = \trim($data);
if (!empty($data)) {
$data = \explode(' ', $data);
diff --git a/Socket/Server/ClientManager.php b/Socket/Server/ClientManager.php
index 1c285f3b1..0eb423377 100644
--- a/Socket/Server/ClientManager.php
+++ b/Socket/Server/ClientManager.php
@@ -28,7 +28,7 @@ class ClientManager
public function get($id)
{
- return $this->clients[$id] ?? new NullClientConnection(uniqid(), null);
+ return $this->clients[$id] ?? new NullClientConnection(\uniqid(), null);
}
public function getBySocket($socket)
@@ -39,7 +39,7 @@ class ClientManager
}
}
- return new NullClientConnection(uniqid(), null);
+ return new NullClientConnection(\uniqid(), null);
}
public function remove($id)
diff --git a/Socket/Server/Server.php b/Socket/Server/Server.php
index 74bc4bfca..64244f7f6 100644
--- a/Socket/Server/Server.php
+++ b/Socket/Server/Server.php
@@ -223,7 +223,7 @@ class Server extends SocketAbstract
public function connectClient($socket) : void
{
$this->app->logger->debug('Connecting client...');
- $this->clientManager->add($client = new ClientConnection(uniqid(), $socket));
+ $this->clientManager->add($client = new ClientConnection(\uniqid(), $socket));
$this->conn[$client->getId()] = $socket;
$this->app->logger->debug('Connected client.');
}
@@ -262,19 +262,19 @@ class Server extends SocketAbstract
private function unmask($payload) : string
{
- $length = ord($payload[1]) & 127;
+ $length = \ord($payload[1]) & 127;
if ($length == 126) {
- $masks = substr($payload, 4, 4);
- $data = substr($payload, 8);
+ $masks = \substr($payload, 4, 4);
+ $data = \substr($payload, 8);
} elseif ($length == 127) {
- $masks = substr($payload, 10, 4);
- $data = substr($payload, 14);
+ $masks = \substr($payload, 10, 4);
+ $data = \substr($payload, 14);
} else {
- $masks = substr($payload, 2, 4);
- $data = substr($payload, 6);
+ $masks = \substr($payload, 2, 4);
+ $data = \substr($payload, 6);
}
$text = '';
- for ($i = 0; $i < strlen($data); ++$i) {
+ for ($i = 0; $i < \strlen($data); ++$i) {
$text .= $data[$i] ^ $masks[$i % 4];
}
diff --git a/Stdlib/Base/Enum.php b/Stdlib/Base/Enum.php
index 71e877623..239c9c959 100644
--- a/Stdlib/Base/Enum.php
+++ b/Stdlib/Base/Enum.php
@@ -71,7 +71,7 @@ abstract class Enum
$constants = self::getConstants();
$keys = array_keys($constants);
- return $constants[$keys[mt_rand(0, count($constants) - 1)]];
+ return $constants[$keys[mt_rand(0, \count($constants) - 1)]];
}
/**
@@ -135,7 +135,7 @@ abstract class Enum
*/
public static function count() : int
{
- return count(self::getConstants());
+ return \count(self::getConstants());
}
/**
diff --git a/Stdlib/Base/Iban.php b/Stdlib/Base/Iban.php
index 6fea5acdf..f4419c723 100644
--- a/Stdlib/Base/Iban.php
+++ b/Stdlib/Base/Iban.php
@@ -75,7 +75,7 @@ class Iban implements \Serializable
*/
public static function normalize(string $iban) : string
{
- return strtoupper(\str_replace(' ', '', $iban));
+ return \strtoupper(\str_replace(' ', '', $iban));
}
/**
@@ -87,7 +87,7 @@ class Iban implements \Serializable
*/
public function getLength() : int
{
- return strlen($this->iban);
+ return \strlen($this->iban);
}
/**
diff --git a/Stdlib/Base/SmartDateTime.php b/Stdlib/Base/SmartDateTime.php
index d0a95f317..feb1284b1 100644
--- a/Stdlib/Base/SmartDateTime.php
+++ b/Stdlib/Base/SmartDateTime.php
@@ -163,7 +163,7 @@ class SmartDateTime extends \DateTime
*/
public function getFirstDayOfMonth() : int
{
- return getdate(mktime(0, 0, 0, (int) $this->format('m'), 1, (int) $this->format('Y')))['wday'];
+ return getdate(\mktime(0, 0, 0, (int) $this->format('m'), 1, (int) $this->format('Y')))['wday'];
}
/**
diff --git a/Stdlib/Graph/Graph.php b/Stdlib/Graph/Graph.php
index 0fefccb39..11fd08f27 100644
--- a/Stdlib/Graph/Graph.php
+++ b/Stdlib/Graph/Graph.php
@@ -369,7 +369,7 @@ class Graph
*/
public function getOrder() : int
{
- return count($this->nodes);
+ return \count($this->nodes);
}
/**
@@ -383,7 +383,7 @@ class Graph
*/
public function getSize() : int
{
- return count($this->edges);
+ return \count($this->edges);
}
/**
@@ -405,7 +405,7 @@ class Graph
continue;
}
- $diameter = max($diameter, $this->getFloydWarshallShortestPath($node1, $node2));
+ $diameter = \max($diameter, $this->getFloydWarshallShortestPath($node1, $node2));
}
}
diff --git a/Stdlib/Graph/Tree.php b/Stdlib/Graph/Tree.php
index 23e5073ce..812688862 100644
--- a/Stdlib/Graph/Tree.php
+++ b/Stdlib/Graph/Tree.php
@@ -82,7 +82,7 @@ class Tree extends Graph
$neighbors = $this->getNeighbors($currentNode);
foreach ($neighbors as $neighbor) {
- $depth = max($depth, $depth + $this->getMaxDepth($neighbor));
+ $depth = \max($depth, $depth + $this->getMaxDepth($neighbor));
}
return $depth;
@@ -114,7 +114,7 @@ class Tree extends Graph
$depth = empty($depth) ? 0 : $depth;
- return min($depth) + 1;
+ return \min($depth) + 1;
}
/**
@@ -148,7 +148,7 @@ class Tree extends Graph
*/
public function isLeaf(Node $node) : bool
{
- return count($this->getEdgesOfNode($node)) === 1;
+ return \count($this->getEdgesOfNode($node)) === 1;
}
/**
@@ -189,12 +189,12 @@ class Tree extends Graph
*/
public function isFull(int $type) : bool
{
- if (count($this->edges) % $type !== 0) {
+ if (\count($this->edges) % $type !== 0) {
return false;
}
foreach ($this->nodes as $node) {
- $neighbors = count($this->getNeighbors($node));
+ $neighbors = \count($this->getNeighbors($node));
if ($neighbors !== $type && $neighbors !== 0) {
return false;
@@ -216,7 +216,7 @@ class Tree extends Graph
*/
public function preOrder(Node $node, \Closure $callback) : void
{
- if (count($this->nodes) === 0) {
+ if (\count($this->nodes) === 0) {
return;
}
@@ -241,7 +241,7 @@ class Tree extends Graph
*/
public function postOrder(Node $node, \Closure $callback) : void
{
- if (count($this->nodes) === 0) {
+ if (\count($this->nodes) === 0) {
return;
}
diff --git a/Stdlib/Map/MultiMap.php b/Stdlib/Map/MultiMap.php
index 013ced169..2e4f99e96 100644
--- a/Stdlib/Map/MultiMap.php
+++ b/Stdlib/Map/MultiMap.php
@@ -86,7 +86,7 @@ class MultiMap implements \Countable
*/
public function add(array $keys, $value, bool $overwrite = true) : bool
{
- $id = count($this->values);
+ $id = \count($this->values);
$inserted = false;
if ($this->keyType !== KeyType::SINGLE) {
@@ -205,14 +205,14 @@ class MultiMap implements \Countable
$keys = Permutation::permut($key);
foreach ($keys as $key => $value) {
- $key = implode(':', $value);
+ $key = \implode(':', $value);
if (isset($this->keys[$key])) {
return $this->values[$this->keys[$key]];
}
}
} else {
- $key = implode(':', $key);
+ $key = \implode(':', $key);
}
}
@@ -558,6 +558,6 @@ class MultiMap implements \Countable
*/
public function count() : int
{
- return count($this->values);
+ return \count($this->values);
}
}
diff --git a/Stdlib/Queue/PriorityQueue.php b/Stdlib/Queue/PriorityQueue.php
index 71357896e..f5bf53426 100644
--- a/Stdlib/Queue/PriorityQueue.php
+++ b/Stdlib/Queue/PriorityQueue.php
@@ -64,7 +64,7 @@ class PriorityQueue implements \Countable, \Serializable
public function insert($data, string $job, float $priority = 1.0) : int
{
do {
- $key = rand();
+ $key = \rand();
} while (array_key_exists($key, $this->queue));
if ($this->count === 0) {
@@ -201,6 +201,6 @@ class PriorityQueue implements \Countable, \Serializable
public function unserialize($data)
{
$this->queue = \json_decode($data);
- $this->count = count($this->queue);
+ $this->count = \count($this->queue);
}
}
diff --git a/System/File/FileUtils.php b/System/File/FileUtils.php
index d7b35825d..bd984329d 100644
--- a/System/File/FileUtils.php
+++ b/System/File/FileUtils.php
@@ -56,7 +56,7 @@ final class FileUtils
*/
public static function getExtensionType(string $extension) : int
{
- $extension = strtolower($extension);
+ $extension = \strtolower($extension);
if (\in_array($extension, self::CODE_EXTENSION)) {
return ExtensionType::CODE;
@@ -93,7 +93,7 @@ final class FileUtils
public static function absolute(string $origPath) : string
{
if (!\file_exists($origPath) || \realpath($origPath) === false) {
- $startsWithSlash = strpos($origPath, '/') === 0 ? '/' : '';
+ $startsWithSlash = \strpos($origPath, '/') === 0 ? '/' : '';
$path = [];
$parts = \explode('/', $origPath);
diff --git a/System/File/Ftp/Directory.php b/System/File/Ftp/Directory.php
index e12b9c441..bfb434010 100644
--- a/System/File/Ftp/Directory.php
+++ b/System/File/Ftp/Directory.php
@@ -36,17 +36,17 @@ class Directory extends FileAbstract implements DirectoryInterface
{
public static function ftpConnect(Http $http)
{
- $con = ftp_connect($http->getBase() . $http->getPath(), $http->getPort());
+ $con = \ftp_connect($http->getBase() . $http->getPath(), $http->getPort());
- ftp_login($con, $http->getUser(), $http->getPass());
- ftp_chdir($con, $http->getPath()); // todo: is this required ?
+ \ftp_login($con, $http->getUser(), $http->getPass());
+ \ftp_chdir($con, $http->getPath()); // todo: is this required ?
return $con;
}
public static function ftpExists($con, string $path)
{
- $list = ftp_nlist($con, LocalFile::parent($path));
+ $list = \ftp_nlist($con, LocalFile::parent($path));
return \in_array(LocalFile::name($path), $list);
}
@@ -54,13 +54,13 @@ class Directory extends FileAbstract implements DirectoryInterface
public static function ftpCreate($con, string $path, int $permission, bool $recursive)
{
$parts = \explode('/', $path);
- ftp_chdir($con, '/' . $parts[0]);
+ \ftp_chdir($con, '/' . $parts[0]);
foreach ($parts as $part) {
if (self::ftpExists($con, $part)) {
- ftp_\mkdir($con, $part);
- ftp_chdir($con, $part);
- ftp_chmod($con, $permission, $part);
+ \ftp_\kdir($con, $part);
+ \ftp_chdir($con, $part);
+ \ftp_chmod($con, $permission, $part);
}
}
}
@@ -274,7 +274,7 @@ class Directory extends FileAbstract implements DirectoryInterface
*/
public function rewind()
{
- reset($this->nodes);
+ \reset($this->nodes);
}
/**
@@ -282,7 +282,7 @@ class Directory extends FileAbstract implements DirectoryInterface
*/
public function current()
{
- return current($this->nodes);
+ return \current($this->nodes);
}
/**
@@ -290,7 +290,7 @@ class Directory extends FileAbstract implements DirectoryInterface
*/
public function key()
{
- return key($this->nodes);
+ return \key($this->nodes);
}
/**
@@ -298,7 +298,7 @@ class Directory extends FileAbstract implements DirectoryInterface
*/
public function next()
{
- return next($this->nodes);
+ return \next($this->nodes);
}
/**
@@ -306,7 +306,7 @@ class Directory extends FileAbstract implements DirectoryInterface
*/
public function valid()
{
- $key = key($this->nodes);
+ $key = \key($this->nodes);
return ($key !== null && $key !== false);
}
diff --git a/System/File/Local/Directory.php b/System/File/Local/Directory.php
index f07bcd5e3..fa7ea59b7 100644
--- a/System/File/Local/Directory.php
+++ b/System/File/Local/Directory.php
@@ -136,7 +136,7 @@ final class Directory extends FileAbstract implements DirectoryInterface
parent::index();
foreach (\glob($this->path . DIRECTORY_SEPARATOR . $this->filter) as $filename) {
- if (!StringUtils::endsWith(trim($filename), '.')) {
+ if (!StringUtils::endsWith(\trim($filename), '.')) {
$file = \is_dir($filename) ? new self($filename) : new File($filename);
$this->addNode($file);
diff --git a/System/File/Local/FileAbstract.php b/System/File/Local/FileAbstract.php
index 1e4bbf37c..40ca920c5 100644
--- a/System/File/Local/FileAbstract.php
+++ b/System/File/Local/FileAbstract.php
@@ -101,8 +101,8 @@ abstract class FileAbstract implements ContainerInterface
*/
public function __construct(string $path)
{
- $this->path = rtrim($path, '/\\');
- $this->name = basename($path);
+ $this->path = \rtrim($path, '/\\');
+ $this->name = \basename($path);
$this->createdAt = new \DateTime('now');
$this->changedAt = new \DateTime('now');
diff --git a/System/File/Storage.php b/System/File/Storage.php
index 67dba2e00..607f5d619 100644
--- a/System/File/Storage.php
+++ b/System/File/Storage.php
@@ -68,7 +68,7 @@ final class Storage
}
} else {
$stg = $env;
- $env = ucfirst(strtolower($env));
+ $env = \ucfirst(\strtolower($env));
$env = __NAMESPACE__ . '\\' . $env . '\\' . $env . 'Storage';
try {
diff --git a/System/OperatingSystem.php b/System/OperatingSystem.php
index 16b71970a..ab0d71b14 100644
--- a/System/OperatingSystem.php
+++ b/System/OperatingSystem.php
@@ -43,11 +43,11 @@ final class OperatingSystem
*/
public static function getSystem() : int
{
- if (stristr(PHP_OS, 'DAR') !== false) {
+ if (\stristr(PHP_OS, 'DAR') !== false) {
return SystemType::OSX;
- } elseif (stristr(PHP_OS, 'WIN') !== false) {
+ } elseif (\stristr(PHP_OS, 'WIN') !== false) {
return SystemType::WIN;
- } elseif (stristr(PHP_OS, 'LINUX') !== false) {
+ } elseif (\stristr(PHP_OS, 'LINUX') !== false) {
return SystemType::LINUX;
}
diff --git a/System/SystemUtils.php b/System/SystemUtils.php
index 729e9a1d3..d834aa852 100644
--- a/System/SystemUtils.php
+++ b/System/SystemUtils.php
@@ -90,7 +90,7 @@ final class SystemUtils
return $memUsage;
}
- $free = trim($free);
+ $free = \trim($free);
$freeArr = \explode("\n", $free);
$mem = \explode(' ', $freeArr[1]);
$mem = \array_values(\array_filter($mem));
diff --git a/Uri/Argument.php b/Uri/Argument.php
index 1b5196197..dbe139ee3 100644
--- a/Uri/Argument.php
+++ b/Uri/Argument.php
@@ -257,7 +257,7 @@ final class Argument implements UriInterface
*/
public function getPathElement(int $pos = null) : string
{
- return explode('/', $this->path)[$pos] ?? '';
+ return \explode('/', $this->path)[$pos] ?? '';
}
/**
@@ -265,7 +265,7 @@ final class Argument implements UriInterface
*/
public function getPathElements() : array
{
- return explode('/', $this->path);
+ return \explode('/', $this->path);
}
/**
diff --git a/Uri/UriFactory.php b/Uri/UriFactory.php
index 0afe90c10..87ddbd8f4 100644
--- a/Uri/UriFactory.php
+++ b/Uri/UriFactory.php
@@ -116,7 +116,7 @@ final class UriFactory
{
self::setQuery('/scheme', $uri->getScheme());
self::setQuery('/host', $uri->getHost());
- self::setQuery('/base', rtrim($uri->getBase(), '/'));
+ self::setQuery('/base', \rtrim($uri->getBase(), '/'));
self::setQuery('/rootPath', $uri->getRootPath());
self::setQuery('?', $uri->getQuery());
self::setQuery('%', $uri->__toString());
@@ -189,10 +189,10 @@ final class UriFactory
{
$parts = \explode('&', \str_replace('?', '&', $url));
- if (count($parts) >= 2) {
+ if (\count($parts) >= 2) {
$pars = \array_slice($parts, 1);
$comps = [];
- $length = count($pars);
+ $length = \count($pars);
for ($i = 0; $i < $length; ++$i) {
$spl = \explode('=', $pars[$i]);
diff --git a/Utils/ArrayUtils.php b/Utils/ArrayUtils.php
index 839bb9eae..76f785766 100644
--- a/Utils/ArrayUtils.php
+++ b/Utils/ArrayUtils.php
@@ -48,7 +48,7 @@ final class ArrayUtils
*/
public static function unsetArray(string $path, array $data, string $delim = '/') : array
{
- $nodes = \explode($delim, trim($path, $delim));
+ $nodes = \explode($delim, \trim($path, $delim));
$prevEl = null;
$el = &$data;
$node = null;
@@ -89,7 +89,7 @@ final class ArrayUtils
*/
public static function setArray(string $path, array $data, $value, string $delim = '/', bool $overwrite = false) : array
{
- $pathParts = \explode($delim, trim($path, $delim));
+ $pathParts = \explode($delim, \trim($path, $delim));
$current = &$data;
if ($pathParts === false) {
@@ -128,7 +128,7 @@ final class ArrayUtils
*/
public static function getArray(string $path, array $data, string $delim = '/')
{
- $pathParts = \explode($delim, trim($path, $delim));
+ $pathParts = \explode($delim, \trim($path, $delim));
$current = $data;
if ($pathParts === false) {
@@ -237,7 +237,7 @@ final class ArrayUtils
$key = '\'' . $key . '\'';
}
- switch (gettype($value)) {
+ switch (\gettype($value)) {
case 'array':
$str .= $key . ' => ' . self::stringify($value) . ', ';
break;
@@ -306,11 +306,11 @@ final class ArrayUtils
*/
public static function getArg(string $id, array $args) : ?string
{
- if (($key = \array_search($id, $args)) === false || $key === count($args) - 1) {
+ if (($key = \array_search($id, $args)) === false || $key === \count($args) - 1) {
return null;
}
- return trim($args[(int) $key + 1], '" ');
+ return \trim($args[(int) $key + 1], '" ');
}
/**
@@ -375,7 +375,7 @@ final class ArrayUtils
*/
public static function arraySum(array $array, int $start = 0, int $count = 0)
{
- $count = $count === 0 ? count($array) : $start + $count;
+ $count = $count === 0 ? \count($array) : $start + $count;
$sum = 0;
$array = array_values($array);
diff --git a/Utils/Barcode/C128Abstract.php b/Utils/Barcode/C128Abstract.php
index e66572cea..95bb29f0f 100644
--- a/Utils/Barcode/C128Abstract.php
+++ b/Utils/Barcode/C128Abstract.php
@@ -285,7 +285,7 @@ abstract class C128Abstract
$checksum += $values[$activeKey] * $pos;
}
- $codeString .= static::$CODEARRAY[$keys[($checksum - (intval($checksum / 103) * 103))]];
+ $codeString .= static::$CODEARRAY[$keys[($checksum - (\intval($checksum / 103) * 103))]];
return $codeString;
}
diff --git a/Utils/Barcode/C128a.php b/Utils/Barcode/C128a.php
index 6677e4ae8..0d2b0b4ff 100644
--- a/Utils/Barcode/C128a.php
+++ b/Utils/Barcode/C128a.php
@@ -91,6 +91,6 @@ class C128a extends C128Abstract
*/
public function setContent(string $content) : void
{
- parent::setContent(strtoupper($content));
+ parent::setContent(\strtoupper($content));
}
}
diff --git a/Utils/Barcode/C128c.php b/Utils/Barcode/C128c.php
index 7b605f1cc..0ba679fd2 100644
--- a/Utils/Barcode/C128c.php
+++ b/Utils/Barcode/C128c.php
@@ -91,15 +91,15 @@ class C128c extends C128Abstract
$keys = array_keys(self::$CODEARRAY);
$values = array_flip($keys);
$codeString = '';
- $length = strlen($this->content);
+ $length = \strlen($this->content);
$checksum = self::$CHECKSUM;
$checkPos = 1;
for ($pos = 1; $pos <= $length; $pos += 2) {
if ($pos + 1 <= $length) {
- $activeKey = substr($this->content, ($pos - 1), 2);
+ $activeKey = \substr($this->content, ($pos - 1), 2);
} else {
- $activeKey = substr($this->content, ($pos - 1), 1) . '0';
+ $activeKey = \substr($this->content, ($pos - 1), 1) . '0';
}
$codeString .= self::$CODEARRAY[$activeKey];
@@ -107,7 +107,7 @@ class C128c extends C128Abstract
$checkPos++;
}
- $codeString .= self::$CODEARRAY[$keys[($checksum - (intval($checksum / 103) * 103))]];
+ $codeString .= self::$CODEARRAY[$keys[($checksum - (\intval($checksum / 103) * 103))]];
return $codeString;
}
diff --git a/Utils/Barcode/C25.php b/Utils/Barcode/C25.php
index d54333d62..cd2119817 100644
--- a/Utils/Barcode/C25.php
+++ b/Utils/Barcode/C25.php
@@ -109,13 +109,13 @@ class C25 extends C128Abstract
protected function generateCodeString() : string
{
$codeString = '';
- $length = strlen($this->content);
- $arrayLength = count(self::$CODEARRAY);
+ $length = \strlen($this->content);
+ $arrayLength = \count(self::$CODEARRAY);
$temp = [];
for ($posX = 1; $posX <= $length; $posX++) {
for ($posY = 0; $posY < $arrayLength; $posY++) {
- if (substr($this->content, ($posX - 1), 1) == self::$CODEARRAY[$posY]) {
+ if (\substr($this->content, ($posX - 1), 1) == self::$CODEARRAY[$posY]) {
$temp[$posX] = self::$CODEARRAY2[$posY];
}
}
@@ -126,7 +126,7 @@ class C25 extends C128Abstract
$temp1 = \explode('-', $temp[$posX]);
$temp2 = \explode('-', $temp[($posX + 1)]);
- $count = count($temp1);
+ $count = \count($temp1);
for ($posY = 0; $posY < $count; $posY++) {
$codeString .= $temp1[$posY] . $temp2[$posY];
}
diff --git a/Utils/Barcode/C39.php b/Utils/Barcode/C39.php
index d5c776b78..5435489e4 100644
--- a/Utils/Barcode/C39.php
+++ b/Utils/Barcode/C39.php
@@ -72,7 +72,7 @@ class C39 extends C128Abstract
*/
public function setContent(string $content) : void
{
- parent::setContent(strtoupper($content));
+ parent::setContent(\strtoupper($content));
}
/**
@@ -85,7 +85,7 @@ class C39 extends C128Abstract
protected function generateCodeString() : string
{
$codeString = '';
- $length = strlen($this->content);
+ $length = \strlen($this->content);
for ($X = 1; $X <= $length; $X++) {
$codeString .= self::$CODEARRAY[substr($this->content, ($X - 1), 1)] . '1';
diff --git a/Utils/Barcode/Codebar.php b/Utils/Barcode/Codebar.php
index 571eff9e0..7517ced54 100644
--- a/Utils/Barcode/Codebar.php
+++ b/Utils/Barcode/Codebar.php
@@ -73,7 +73,7 @@ class Codebar extends C128Abstract
*/
public function setContent(string $content) : void
{
- parent::setContent(strtoupper($content));
+ parent::setContent(\strtoupper($content));
}
/**
@@ -86,12 +86,12 @@ class Codebar extends C128Abstract
protected function generateCodeString() : string
{
$codeString = '';
- $length = strlen($this->content);
- $lenCodearr = count(self::$CODEARRAY);
+ $length = \strlen($this->content);
+ $lenCodearr = \count(self::$CODEARRAY);
for ($posX = 1; $posX <= $length; $posX++) {
for ($posY = 0; $posY < $lenCodearr; $posY++) {
- if (substr($this->content, ($posX - 1), 1) == self::$CODEARRAY[$posY]) {
+ if (\substr($this->content, ($posX - 1), 1) == self::$CODEARRAY[$posY]) {
$codeString .= self::$CODEARRAY2[$posY] . '1';
}
}
diff --git a/Utils/Compression/LZW.php b/Utils/Compression/LZW.php
index 5757f9fe8..1cff6d65d 100644
--- a/Utils/Compression/LZW.php
+++ b/Utils/Compression/LZW.php
@@ -75,12 +75,12 @@ class LZW implements CompressionInterface
}
for ($i = 0; $i < 256; ++$i) {
- $dictionary[$i] = chr($i);
+ $dictionary[$i] = \chr($i);
}
- $w = chr((int) $compressed[0]);
+ $w = \chr((int) $compressed[0]);
$result = $dictionary[(int) ($compressed[0])] ?? 0;
- $count = count($compressed);
+ $count = \count($compressed);
for ($i = 1; $i < $count; ++$i) {
$k = (int) $compressed[$i];
diff --git a/Utils/Converter/Currency.php b/Utils/Converter/Currency.php
index 21218a117..38a35fa46 100644
--- a/Utils/Converter/Currency.php
+++ b/Utils/Converter/Currency.php
@@ -76,7 +76,7 @@ class Currency
public static function fromEurTo(float $value, string $to) : float
{
$currencies = self::getEcbEuroRates();
- $to = strtoupper($to);
+ $to = \strtoupper($to);
if (!isset($currencies[$to])) {
throw new \InvalidArgumentException('Currency doesn\'t exists');
@@ -131,7 +131,7 @@ class Currency
public static function fromToEur(float $value, string $from) : float
{
$currencies = self::getEcbEuroRates();
- $from = strtoupper($from);
+ $from = \strtoupper($from);
if (!isset($currencies[$from])) {
throw new \InvalidArgumentException('Currency doesn\'t exists');
@@ -154,8 +154,8 @@ class Currency
public static function convertCurrency(float $value, string $from, string $to) : float
{
$currencies = self::getEcbEuroRates();
- $from = strtoupper($from);
- $to = strtoupper($to);
+ $from = \strtoupper($from);
+ $to = \strtoupper($to);
if ((!isset($currencies[$from]) && $from !== ISO4217CharEnum::_EUR) || (!isset($currencies[$to]) && $to !== ISO4217CharEnum::_EUR)) {
throw new \InvalidArgumentException('Currency doesn\'t exists');
diff --git a/Utils/Converter/Numeric.php b/Utils/Converter/Numeric.php
index f0d929b5a..b36f3ca85 100644
--- a/Utils/Converter/Numeric.php
+++ b/Utils/Converter/Numeric.php
@@ -80,7 +80,7 @@ class Numeric
$newOutput = '0';
for ($i = 1; $i <= $numberLen; ++$i) {
- $newOutput = bcadd(
+ $newOutput = \bcadd(
$newOutput,
bcmul(
(string) \array_search($number[$i - 1], $fromBase),
@@ -99,8 +99,8 @@ class Numeric
}
while ($base10 !== '0') {
- $newOutput = $toBase[(int) bcmod((string) $base10, (string) $toLen)] . $newOutput;
- $base10 = bcdiv((string) $base10, (string) $toLen, 0);
+ $newOutput = $toBase[(int) \bcmod((string) $base10, (string) $toLen)] . $newOutput;
+ $base10 = \bcdiv((string) $base10, (string) $toLen, 0);
}
return $newOutput;
@@ -177,8 +177,8 @@ class Numeric
$alpha = '';
for ($i = 1; $number >= 0 && $i < 10; ++$i) {
- $alpha = chr(0x41 + (int) ($number % pow(26, $i) / pow(26, $i - 1))) . $alpha;
- $number -= pow(26, $i);
+ $alpha = \chr(0x41 + (int) ($number % \pow(26, $i) / \pow(26, $i - 1))) . $alpha;
+ $number -= \pow(26, $i);
}
return $alpha;
@@ -199,7 +199,7 @@ class Numeric
$length = \strlen($alpha);
for ($i = 0; $i < $length; ++$i) {
- $numeric += pow(26, $i) * (ord($alpha[$length - $i - 1]) - 0x40);
+ $numeric += \pow(26, $i) * (\ord($alpha[$length - $i - 1]) - 0x40);
}
return (int) $numeric - 1;
diff --git a/Utils/Encoding/Caesar.php b/Utils/Encoding/Caesar.php
index d6a517d1e..578fd8774 100644
--- a/Utils/Encoding/Caesar.php
+++ b/Utils/Encoding/Caesar.php
@@ -46,21 +46,21 @@ class Caesar
public static function encode(string $source, string $key) : string
{
$result = '';
- $length = strlen($source);
- $keyLength = strlen($key) - 1;
+ $length = \strlen($source);
+ $keyLength = \strlen($key) - 1;
for ($i = 0, $j = 0; $i < $length; ++$i, $j++) {
if ($j > $keyLength) {
$j = 0;
}
- $ascii = ord($source[$i]) + ord($key[$j]);
+ $ascii = \ord($source[$i]) + \ord($key[$j]);
if ($ascii > self::LIMIT_UPPER) {
$ascii = self::LIMIT_LOWER + ($ascii - self::LIMIT_UPPER);
}
- $result .= chr($ascii);
+ $result .= \chr($ascii);
}
return $result;
@@ -72,21 +72,21 @@ class Caesar
public static function decode(string $raw, string $key) : string
{
$result = '';
- $length = strlen($raw);
- $keyLength = strlen($key) - 1;
+ $length = \strlen($raw);
+ $keyLength = \strlen($key) - 1;
for ($i = 0, $j = 0; $i < $length; ++$i, $j++) {
if ($j > $keyLength) {
$j = 0;
}
- $ascii = ord($raw[$i]) - ord($key[$j]);
+ $ascii = \ord($raw[$i]) - \ord($key[$j]);
if ($ascii < self::LIMIT_LOWER) {
$ascii = self::LIMIT_UPPER + ($ascii - self::LIMIT_LOWER);
}
- $result .= chr($ascii);
+ $result .= \chr($ascii);
}
return $result;
diff --git a/Utils/Encoding/Huffman/Dictionary.php b/Utils/Encoding/Huffman/Dictionary.php
index 45fdd5446..2ed7c48be 100644
--- a/Utils/Encoding/Huffman/Dictionary.php
+++ b/Utils/Encoding/Huffman/Dictionary.php
@@ -84,7 +84,7 @@ final class Dictionary
}
sort($count);
- while (count($count) > 1) {
+ while (\count($count) > 1) {
$row1 = array_shift($count);
$row2 = array_shift($count);
$count[] = [$row1[0] + $row2[0], [$row1, $row2]];
@@ -136,7 +136,7 @@ final class Dictionary
*/
public function set(string $entry, string $value) : void
{
- if (strlen($entry) !== 1) {
+ if (\strlen($entry) !== 1) {
throw new \InvalidArgumentException('Must be a character.');
}
@@ -144,11 +144,11 @@ final class Dictionary
throw new \InvalidArgumentException('Character already exists');
}
- if (strlen(\str_replace('0', '', \str_replace('1', '', $value))) !== 0) {
+ if (\strlen(\str_replace('0', '', \str_replace('1', '', $value))) !== 0) {
throw new \InvalidArgumentException('Bad formatting.');
}
- $length = strlen($value);
+ $length = \strlen($value);
if ($this->min === -1 || $length < $this->min) {
$this->min = $length;
@@ -174,7 +174,7 @@ final class Dictionary
*/
public function get(string $entry) : string
{
- if (strlen($entry) !== 1) {
+ if (\strlen($entry) !== 1) {
throw new \InvalidArgumentException('Must be a character.');
}
@@ -196,17 +196,17 @@ final class Dictionary
*/
public function getEntry(&$value) : ?string
{
- $length = strlen($value);
+ $length = \strlen($value);
if ($length < $this->min) {
return null;
}
for ($i = $this->min; $i <= $this->max; ++$i) {
- $needle = substr($value, 0, $i);
+ $needle = \substr($value, 0, $i);
foreach ($this->dictionary as $key => $val) {
if ($needle === $val) {
- $value = substr($value, $i);
+ $value = \substr($value, $i);
return $key;
}
diff --git a/Utils/Encoding/Huffman/Huffman.php b/Utils/Encoding/Huffman/Huffman.php
index 165a1c73e..ed4d6e909 100644
--- a/Utils/Encoding/Huffman/Huffman.php
+++ b/Utils/Encoding/Huffman/Huffman.php
@@ -94,7 +94,7 @@ final class Huffman
$c .= '0';
}
- $binary .= chr(bindec($c));
+ $binary .= \chr(\bindec($c));
}
return $binary;
@@ -120,7 +120,7 @@ final class Huffman
$source = '';
for ($i = 0; $i < $rawLenght; ++$i) {
- $decbin = decbin(ord($raw[$i]));
+ $decbin = \decbin(\ord($raw[$i]));
while (\strlen($decbin) < 8) {
$decbin = '0' . $decbin;
diff --git a/Utils/Encoding/XorEncoding.php b/Utils/Encoding/XorEncoding.php
index 2d8cc5c59..888c0c4f1 100644
--- a/Utils/Encoding/XorEncoding.php
+++ b/Utils/Encoding/XorEncoding.php
@@ -39,16 +39,16 @@ final class XorEncoding
public static function encode(string $source, string $key) : string
{
$result = '';
- $length = strlen($source);
- $keyLength = strlen($key) - 1;
+ $length = \strlen($source);
+ $keyLength = \strlen($key) - 1;
for ($i = 0, $j = 0; $i < $length; ++$i, $j++) {
if ($j > $keyLength) {
$j = 0;
}
- $ascii = ord($source[$i]) ^ ord($key[$j]);
- $result .= chr($ascii);
+ $ascii = \ord($source[$i]) ^ \ord($key[$j]);
+ $result .= \chr($ascii);
}
return $result;
diff --git a/Utils/Git/Repository.php b/Utils/Git/Repository.php
index fd84f731c..88b28a3cd 100644
--- a/Utils/Git/Repository.php
+++ b/Utils/Git/Repository.php
@@ -127,9 +127,9 @@ class Repository
{
$branches = $this->getBranches();
$active = \preg_grep('/^\*/', $branches);
- reset($active);
+ \reset($active);
- return new Branch(current($active));
+ return new Branch(\current($active));
}
/**
@@ -145,7 +145,7 @@ class Repository
$result = [];
foreach ($branches as $key => $branch) {
- $branch = trim($branch, '* ');
+ $branch = \trim($branch, '* ');
if ($branch !== '') {
$result[] = $branch;
@@ -204,7 +204,7 @@ class Repository
throw new \Exception($stderr);
}
- return $this->parseLines(trim($stdout));
+ return $this->parseLines(\trim($stdout));
}
/**
@@ -226,7 +226,7 @@ class Repository
}
foreach ($lineArray as $key => $line) {
- $temp = \preg_replace('/\s+/', ' ', trim($line, ' '));
+ $temp = \preg_replace('/\s+/', ' ', \trim($line, ' '));
if (!empty($temp)) {
$lines[] = $temp;
@@ -474,7 +474,7 @@ class Repository
$result = [];
foreach ($branches as $key => $branch) {
- $branch = trim($branch, '* ');
+ $branch = \trim($branch, '* ');
if ($branch !== '') {
$result[] = $branch;
@@ -592,7 +592,7 @@ class Repository
*/
public function pull(string $remote, Branch $branch) : string
{
- $remote = escapeshellarg($remote);
+ $remote = \escapeshellarg($remote);
return \implode("\n", $this->run('pull ' . $remote . ' ' . $branch->getName()));
}
@@ -636,7 +636,7 @@ class Repository
{
$lines = $this->run('ls-files');
- return count($lines);
+ return \count($lines);
}
/**
@@ -836,7 +836,7 @@ class Repository
. '" --after="' . $start->format('Y-m-d') . '"'
. $author . ' --reverse --date=short');
- $count = count($lines);
+ $count = \count($lines);
$commits = [];
for ($i = 0; $i < $count; ++$i) {
@@ -864,8 +864,8 @@ class Repository
*/
public function getCommit(string $commit) : Commit
{
- $lines = $this->run('show --name-only ' . escapeshellarg($commit));
- $count = count($lines);
+ $lines = $this->run('show --name-only ' . \escapeshellarg($commit));
+ $count = \count($lines);
if (empty($lines)) {
return new NullCommit();
@@ -882,10 +882,10 @@ class Repository
}
$author = \explode(':', $lines[1] ?? '');
- if (count($author) < 2) {
+ if (\count($author) < 2) {
$author = ['none', 'none'];
} else {
- $author = \explode('<', trim($author[1] ?? ''));
+ $author = \explode('<', \trim($author[1] ?? ''));
}
$date = \substr($lines[2] ?? '', 6);
@@ -894,8 +894,8 @@ class Repository
}
$commit = new Commit($matches[0]);
- $commit->setAuthor(new Author(trim($author[0] ?? ''), rtrim($author[1] ?? '', '>')));
- $commit->setDate(new \DateTime(trim($date ?? 'now')));
+ $commit->setAuthor(new Author(\trim($author[0] ?? ''), \rtrim($author[1] ?? '', '>')));
+ $commit->setDate(new \DateTime(\trim($date ?? 'now')));
$commit->setMessage($lines[3]);
$commit->setTag(new Tag());
$commit->setRepository($this);
diff --git a/Utils/IO/Csv/CsvSettings.php b/Utils/IO/Csv/CsvSettings.php
index f001235a9..09be16c2d 100644
--- a/Utils/IO/Csv/CsvSettings.php
+++ b/Utils/IO/Csv/CsvSettings.php
@@ -54,7 +54,7 @@ class CsvSettings
return ';';
}
- if (count($fields) > 1) {
+ if (\count($fields) > 1) {
if (!empty($results[$delimiter])) {
$results[$delimiter]++;
} else {
@@ -64,7 +64,7 @@ class CsvSettings
}
}
- $results = \array_keys($results, max($results));
+ $results = \array_keys($results, \max($results));
return $results[0];
}
diff --git a/Utils/Parser/Markdown/Markdown.php b/Utils/Parser/Markdown/Markdown.php
index f81edd4de..b42fe89ad 100644
--- a/Utils/Parser/Markdown/Markdown.php
+++ b/Utils/Parser/Markdown/Markdown.php
@@ -541,7 +541,7 @@ class Markdown
return [
'element' => [
- 'name' => 'h' . min(6, $level),
+ 'name' => 'h' . \min(6, $level),
'text' => \trim($lineArray['text'], '# '),
'handler' => 'line',
],
@@ -575,7 +575,7 @@ class Markdown
];
if ($name === 'ol') {
- $listStart = stristr($matches[0], '.', true);
+ $listStart = \stristr($matches[0], '.', true);
if ($listStart !== '1') {
$block['element']['attributes'] = ['start' => $listStart];
@@ -816,7 +816,7 @@ class Markdown
$alignment = 'left';
}
- if (substr($dividerCell, -1) === ':') {
+ if (\substr($dividerCell, -1) === ':') {
$alignment = $alignment === 'left' ? 'center' : 'right';
}
diff --git a/Utils/Permutation.php b/Utils/Permutation.php
index b49dfc1b0..80a629e35 100644
--- a/Utils/Permutation.php
+++ b/Utils/Permutation.php
@@ -50,7 +50,7 @@ final class Permutation
$permutations = [];
if (empty($toPermute)) {
- $permutations[] = implode('', $result);
+ $permutations[] = \implode('', $result);
} else {
foreach ($toPermute as $key => $val) {
$newArr = $toPermute;
@@ -93,9 +93,9 @@ final class Permutation
*/
public static function isPalindrome(string $a, string $filter = 'a-zA-Z0-9') : bool
{
- $a = strtolower(preg_replace('/[^' . $filter . ']/', '', $a));
+ $a = \strtolower(preg_replace('/[^' . $filter . ']/', '', $a));
- return $a === strrev($a);
+ return $a === \strrev($a);
}
/**
@@ -116,9 +116,9 @@ final class Permutation
throw new \InvalidArgumentException('Parameter has to be array or string');
}
- $length = is_array($toPermute) ? count($toPermute) : strlen($toPermute);
+ $length = is_array($toPermute) ? \count($toPermute) : \strlen($toPermute);
- if (count($key) > $length) {
+ if (\count($key) > $length) {
throw new \InvalidArgumentException('There mustn not be more keys than permutation elements.');
}
diff --git a/Utils/RnG/ArrayRandomize.php b/Utils/RnG/ArrayRandomize.php
index d22e7dba0..4eff85252 100644
--- a/Utils/RnG/ArrayRandomize.php
+++ b/Utils/RnG/ArrayRandomize.php
@@ -59,7 +59,7 @@ class ArrayRandomize
{
$shuffled = [];
- for ($i = count($arr) - 1; $i > 0; $i--) {
+ for ($i = \count($arr) - 1; $i > 0; $i--) {
$rnd = mt_rand(0, $i);
$shuffled[$i] = $arr[$rnd];
$shuffled[$rnd] = $arr[$i];
diff --git a/Utils/RnG/File.php b/Utils/RnG/File.php
index b2a0d2d22..66c16ab94 100644
--- a/Utils/RnG/File.php
+++ b/Utils/RnG/File.php
@@ -63,7 +63,7 @@ class File
switch ($distribution) {
case DistributionType::UNIFORM:
- $key = rand(0, count($source) - 1);
+ $key = \rand(0, \count($source) - 1);
break;
default:
return false;
diff --git a/Utils/RnG/Name.php b/Utils/RnG/Name.php
index ea48fb868..c5ae68892 100644
--- a/Utils/RnG/Name.php
+++ b/Utils/RnG/Name.php
@@ -493,8 +493,8 @@ class Name
*/
public static function generateName(array $type, string $origin = 'western') : string
{
- $rndType = mt_rand(0, count($type) - 1);
+ $rndType = mt_rand(0, \count($type) - 1);
- return self::$names[$origin][$type[$rndType]][mt_rand(0, count(self::$names[$origin][$type[$rndType]]) - 1)];
+ return self::$names[$origin][$type[$rndType]][mt_rand(0, \count(self::$names[$origin][$type[$rndType]]) - 1)];
}
}
diff --git a/Utils/RnG/Phone.php b/Utils/RnG/Phone.php
index c3ae1bba2..2496e3bd3 100644
--- a/Utils/RnG/Phone.php
+++ b/Utils/RnG/Phone.php
@@ -50,7 +50,7 @@ class Phone
$countries = ['de' => 49, 'us' => 1];
}
- $numberString = \str_replace('$1', $countries[array_keys($countries)[rand(0, count($countries))]], $numberString);
+ $numberString = \str_replace('$1', $countries[array_keys($countries)[rand(0, \count($countries))]], $numberString);
}
$numberParts = substr_count($layout['struct'], '$');
diff --git a/Utils/RnG/StringUtils.php b/Utils/RnG/StringUtils.php
index 623ff7638..75b292891 100644
--- a/Utils/RnG/StringUtils.php
+++ b/Utils/RnG/StringUtils.php
@@ -41,7 +41,7 @@ class StringUtils
) : string
{
$length = mt_rand($min, $max);
- $charactersLength = strlen($charset);
+ $charactersLength = \strlen($charset);
$randomString = '';
for ($i = 0; $i < $length; ++$i) {
diff --git a/Utils/RnG/Text.php b/Utils/RnG/Text.php
index cf7cec1eb..c5714d433 100644
--- a/Utils/RnG/Text.php
+++ b/Utils/RnG/Text.php
@@ -158,7 +158,7 @@ class Text
$text = '';
$puid = 0;
$paid = 0;
- $wordCount = count($words);
+ $wordCount = \count($words);
for ($i = 0; $i < $length + 1; ++$i) {
$newSentence = false;
@@ -226,24 +226,24 @@ class Text
$punctuation = [];
for ($i = 0; $i < $length;) {
- $sentenceLength = rand($minSentences, $maxSentences);
+ $sentenceLength = \rand($minSentences, $maxSentences);
if ($i + $sentenceLength > $length || $length - ($i + $sentenceLength) < $minSentences) {
$sentenceLength = $length - $i;
}
/* Handle comma */
- $commaHere = (rand(0, 100) <= $probComma * 100 && $sentenceLength >= 2 * $minCommaSpacing ? true : false);
+ $commaHere = (\rand(0, 100) <= $probComma * 100 && $sentenceLength >= 2 * $minCommaSpacing ? true : false);
$posComma = [];
if ($commaHere) {
- $posComma[] = rand($minCommaSpacing, $sentenceLength - $minCommaSpacing);
+ $posComma[] = \rand($minCommaSpacing, $sentenceLength - $minCommaSpacing);
$punctuation[] = [$i + $posComma[0], ','];
- $commaHere = (rand(0, 100) <= $probComma * 100 && $posComma[0] + $minCommaSpacing * 2 < $sentenceLength ? true : false);
+ $commaHere = (\rand(0, 100) <= $probComma * 100 && $posComma[0] + $minCommaSpacing * 2 < $sentenceLength ? true : false);
if ($commaHere) {
- $posComma[] = rand($posComma[0] + $minCommaSpacing, $sentenceLength - $minCommaSpacing);
+ $posComma[] = \rand($posComma[0] + $minCommaSpacing, $sentenceLength - $minCommaSpacing);
$punctuation[] = [$i + $posComma[1], ','];
}
}
@@ -251,14 +251,14 @@ class Text
$i += $sentenceLength;
/* Handle sentence ending */
- $isDot = (rand(0, 100) <= $probDot * 100 ? true : false);
+ $isDot = (\rand(0, 100) <= $probDot * 100 ? true : false);
if ($isDot) {
$punctuation[] = [$i, '.'];
continue;
}
- $isEx = (rand(0, 100) <= $probExc * 100 ? true : false);
+ $isEx = (\rand(0, 100) <= $probExc * 100 ? true : false);
if ($isEx) {
$punctuation[] = [$i, '!'];
@@ -288,7 +288,7 @@ class Text
$paragraph = [];
for ($i = 0; $i < $length;) {
- $paragraphLength = rand($minSentence, $maxSentence);
+ $paragraphLength = \rand($minSentence, $maxSentence);
if ($i + $paragraphLength > $length || $length - ($i + $paragraphLength) < $minSentence) {
$paragraphLength = $length - $i;
@@ -319,9 +319,9 @@ class Text
$formatting = [];
for ($i = 0; $i < $length; ++$i) {
- $isCursive = (rand(0, 1000) <= 1000 * $probCursive ? true : false);
- $isBold = (rand(0, 1000) <= 1000 * $probBold ? true : false);
- $isUline = (rand(0, 1000) <= 1000 * $probUline ? true : false);
+ $isCursive = (\rand(0, 1000) <= 1000 * $probCursive ? true : false);
+ $isBold = (\rand(0, 1000) <= 1000 * $probBold ? true : false);
+ $isUline = (\rand(0, 1000) <= 1000 * $probUline ? true : false);
if ($isUline) {
$formatting[$i] = 'u';
diff --git a/Utils/StringCompare.php b/Utils/StringCompare.php
index 6009214f4..7918f6d31 100644
--- a/Utils/StringCompare.php
+++ b/Utils/StringCompare.php
@@ -155,7 +155,7 @@ final class StringCompare
*/
public static function valueLength(string $s1, string $s2) : int
{
- return abs(\strlen($s1) - \strlen($s2));
+ return \abs(\strlen($s1) - \strlen($s2));
}
/**
@@ -184,8 +184,8 @@ final class StringCompare
$wordValue = self::valueWords($s1, $s2);
$lengthValue = self::valueLength($s1, $s2);
- return min($phraseValue * $phraseWeight, $wordValue * $wordWeight) * $minWeight
- + max($phraseValue * $phraseWeight, $wordValue * $wordWeight) * $maxWeight
+ return \min($phraseValue * $phraseWeight, $wordValue * $wordWeight) * $minWeight
+ + \max($phraseValue * $phraseWeight, $wordValue * $wordWeight) * $maxWeight
+ $lengthValue * $lengthWeight;
}
}
diff --git a/Utils/StringUtils.php b/Utils/StringUtils.php
index 3ef63e202..f18f63181 100644
--- a/Utils/StringUtils.php
+++ b/Utils/StringUtils.php
@@ -58,7 +58,7 @@ final class StringUtils
public static function contains(string $haystack, array $needles) : bool
{
foreach ($needles as $needle) {
- if (strpos($haystack, $needle) !== false) {
+ if (\strpos($haystack, $needle) !== false) {
return true;
}
}
@@ -113,7 +113,7 @@ final class StringUtils
}
foreach ($needles as $needle) {
- if ($needle === '' || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false)) {
+ if ($needle === '' || (($temp = \strlen($haystack) - \strlen($needle)) >= 0 && \strpos($haystack, $needle, $temp) !== false)) {
return true;
}
}
@@ -262,7 +262,7 @@ final class StringUtils
public static function mb_trim(string $string, string $charlist = ' ') : string
{
if ($charlist === ' ') {
- return trim($string);
+ return \trim($string);
} else {
$charlist = \str_replace('/', '\/', preg_quote($charlist));
@@ -283,7 +283,7 @@ final class StringUtils
public static function mb_rtrim(string $string, string $charlist = ' ') : string
{
if ($charlist === ' ') {
- return rtrim($string);
+ return \rtrim($string);
} else {
$charlist = \str_replace('/', '\/', preg_quote($charlist));
@@ -328,7 +328,7 @@ final class StringUtils
public static function countCharacterFromStart(string $string, string $character) : int
{
$count = 0;
- $length = strlen($string);
+ $length = \strlen($string);
for ($i = 0; $i < $length; ++$i) {
if ($string[$i] !== $character) {
@@ -358,7 +358,7 @@ final class StringUtils
foreach ($countChars as $v) {
$p = $v / $size;
- $entroy -= $p * log($p) / log(2);
+ $entroy -= $p * \log($p) / \log(2);
}
return $entroy;
diff --git a/Utils/TaskSchedule/Interval.php b/Utils/TaskSchedule/Interval.php
index 12864ba0c..9640e14ab 100644
--- a/Utils/TaskSchedule/Interval.php
+++ b/Utils/TaskSchedule/Interval.php
@@ -116,7 +116,7 @@ class Interval implements \Serializable
*/
public function unserialize($serialized)
{
- $elements = \explode(' ', trim($serialized));
+ $elements = \explode(' ', \trim($serialized));
$this->minute = $this->parseMinute($elements[0]);
$this->hour = $this->parseHour($elements[1]);
@@ -622,8 +622,8 @@ class Interval implements \Serializable
*/
public function serializeTime($time, $step) : string
{
- if (($count = count($time)) > 0) {
- $serialize = implode(',', $time);
+ if (($count = \count($time)) > 0) {
+ $serialize = \implode(',', $time);
} else {
$serialize = '*';
$count = 1;
@@ -645,8 +645,8 @@ class Interval implements \Serializable
*/
public function serializeDayOfMonth() : string
{
- if (($count = count($this->dayOfMonth['dayOfMonth'])) > 0) {
- $serialize = implode(',', $this->dayOfMonth['dayOfMonth']);
+ if (($count = \count($this->dayOfMonth['dayOfMonth'])) > 0) {
+ $serialize = \implode(',', $this->dayOfMonth['dayOfMonth']);
} else {
$serialize = '*';
$count = 1;
@@ -672,8 +672,8 @@ class Interval implements \Serializable
*/
public function serializeDayOfWeek() : string
{
- if (($count = count($this->dayOfWeek['dayOfWeek'])) > 0) {
- $serialize = implode(',', $this->dayOfWeek['dayOfWeek']);
+ if (($count = \count($this->dayOfWeek['dayOfWeek'])) > 0) {
+ $serialize = \implode(',', $this->dayOfWeek['dayOfWeek']);
} else {
$serialize = '*';
$count = 1;
diff --git a/Utils/TaskSchedule/SchedulerAbstract.php b/Utils/TaskSchedule/SchedulerAbstract.php
index 86bd2b094..092dc5848 100644
--- a/Utils/TaskSchedule/SchedulerAbstract.php
+++ b/Utils/TaskSchedule/SchedulerAbstract.php
@@ -167,7 +167,7 @@ abstract class SchedulerAbstract
throw new \Exception($stderr);
}
- return trim($stdout);
+ return \trim($stdout);
}
/**
diff --git a/Validation/Finance/CreditCard.php b/Validation/Finance/CreditCard.php
index 6fb29dbb8..880cd3f99 100644
--- a/Validation/Finance/CreditCard.php
+++ b/Validation/Finance/CreditCard.php
@@ -35,7 +35,7 @@ final class CreditCard extends ValidatorAbstract
$value = preg_replace('/\D/', '', $value);
// Set the string length and parity
- $numberLength = strlen($value);
+ $numberLength = \strlen($value);
$parity = $numberLength % 2;
// Loop through each digit and do the maths
@@ -69,11 +69,11 @@ final class CreditCard extends ValidatorAbstract
*/
public static function luhnTest(string $num) : bool
{
- $len = strlen($num);
+ $len = \strlen($num);
$sum = 0;
for ($i = $len - 1; $i >= 0; $i--) {
- $ord = ord($num[$i]);
+ $ord = \ord($num[$i]);
if (($len - 1) & $i) {
$sum += $ord;
diff --git a/Validation/Network/Hostname.php b/Validation/Network/Hostname.php
index ea8123a75..c1835c7ff 100644
--- a/Validation/Network/Hostname.php
+++ b/Validation/Network/Hostname.php
@@ -42,6 +42,6 @@ abstract class Hostname extends ValidatorAbstract
*/
public static function isValid($value, array $constraints = null) : bool
{
- return filter_var(gethostbyname($value), FILTER_VALIDATE_IP) !== false;
+ return filter_var(\gethostbyname($value), FILTER_VALIDATE_IP) !== false;
}
}
diff --git a/Validation/Validator.php b/Validation/Validator.php
index 9c2c917f8..0cfb7922c 100644
--- a/Validation/Validator.php
+++ b/Validation/Validator.php
@@ -101,7 +101,7 @@ final class Validator extends ValidatorAbstract
*/
public static function hasLength(string $var, int $min = 0, int $max = PHP_INT_MAX) : bool
{
- $length = strlen($var);
+ $length = \strlen($var);
if ($length <= $max && $length >= $min) {
return true;
@@ -122,7 +122,7 @@ final class Validator extends ValidatorAbstract
*/
public static function contains(string $var, $substr) : bool
{
- return is_string($substr) ? strpos($var, $substr) !== false : StringUtils::contains($var, $substr);
+ return is_string($substr) ? \strpos($var, $substr) !== false : StringUtils::contains($var, $substr);
}
/**
diff --git a/tests/Account/AccountStatusTest.php b/tests/Account/AccountStatusTest.php
index 12e47af41..0aaf0d940 100644
--- a/tests/Account/AccountStatusTest.php
+++ b/tests/Account/AccountStatusTest.php
@@ -21,7 +21,7 @@ class AccountStatusTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(4, count(AccountStatus::getConstants()));
+ self::assertEquals(4, \count(AccountStatus::getConstants()));
self::assertEquals(1, AccountStatus::ACTIVE);
self::assertEquals(2, AccountStatus::INACTIVE);
self::assertEquals(3, AccountStatus::TIMEOUT);
diff --git a/tests/Account/AccountTest.php b/tests/Account/AccountTest.php
index 5e6b16cc5..3f470b6d1 100644
--- a/tests/Account/AccountTest.php
+++ b/tests/Account/AccountTest.php
@@ -97,7 +97,7 @@ class AccountTest extends \PHPUnit\Framework\TestCase
$array = $account->toArray();
self::assertTrue(is_array($array));
- self::assertGreaterThan(0, count($array));
+ self::assertGreaterThan(0, \count($array));
self::assertEquals(\json_encode($array), $account->__toString());
self::assertEquals($array, $account->jsonSerialize());
}
@@ -110,7 +110,7 @@ class AccountTest extends \PHPUnit\Framework\TestCase
$account->generatePassword('abcd');
$account->addGroup(new Group());
- self::assertEquals(1, count($account->getGroups()));
+ self::assertEquals(1, \count($account->getGroups()));
$account->setName('Login');
self::assertEquals('Login', $account->getName());
@@ -137,19 +137,19 @@ class AccountTest extends \PHPUnit\Framework\TestCase
self::assertEquals(AccountType::GROUP, $account->getType());
$account->addPermission(new class extends PermissionAbstract {});
- self::assertEquals(1, count($account->getPermissions()));
+ self::assertEquals(1, \count($account->getPermissions()));
$account->setPermissions([
new class extends PermissionAbstract {},
new class extends PermissionAbstract {},
]);
- self::assertEquals(2, count($account->getPermissions()));
+ self::assertEquals(2, \count($account->getPermissions()));
$account->addPermissions([
new class extends PermissionAbstract {},
new class extends PermissionAbstract {},
]);
- self::assertEquals(4, count($account->getPermissions()));
+ self::assertEquals(4, \count($account->getPermissions()));
self::assertFalse($account->hasPermission(PermissionType::READ, 1, 'a', 1, 1, 1, 1));
self::assertTrue($account->hasPermission(PermissionType::NONE));
diff --git a/tests/Account/AccountTypeTest.php b/tests/Account/AccountTypeTest.php
index bba16f481..cd0b689a4 100644
--- a/tests/Account/AccountTypeTest.php
+++ b/tests/Account/AccountTypeTest.php
@@ -21,7 +21,7 @@ class AccountTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(2, count(AccountType::getConstants()));
+ self::assertEquals(2, \count(AccountType::getConstants()));
self::assertEquals(0, AccountType::USER);
self::assertEquals(1, AccountType::GROUP);
}
diff --git a/tests/Account/GroupStatusTest.php b/tests/Account/GroupStatusTest.php
index f3d7705aa..033cf5ccd 100644
--- a/tests/Account/GroupStatusTest.php
+++ b/tests/Account/GroupStatusTest.php
@@ -21,7 +21,7 @@ class GroupStatusTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(3, count(GroupStatus::getConstants()));
+ self::assertEquals(3, \count(GroupStatus::getConstants()));
self::assertEquals(1, GroupStatus::ACTIVE);
self::assertEquals(2, GroupStatus::INACTIVE);
self::assertEquals(4, GroupStatus::HIDDEN);
diff --git a/tests/Account/GroupTest.php b/tests/Account/GroupTest.php
index e2b163c75..838961dcf 100644
--- a/tests/Account/GroupTest.php
+++ b/tests/Account/GroupTest.php
@@ -54,7 +54,7 @@ class GroupTest extends \PHPUnit\Framework\TestCase
$array = $group->toArray();
self::assertTrue(is_array($array));
- self::assertGreaterThan(0, count($array));
+ self::assertGreaterThan(0, \count($array));
self::assertEquals(\json_encode($array), $group->__toString());
self::assertEquals($array, $group->jsonSerialize());
}
diff --git a/tests/Account/PermissionTypeTest.php b/tests/Account/PermissionTypeTest.php
index 9627be94a..7b4a3b691 100644
--- a/tests/Account/PermissionTypeTest.php
+++ b/tests/Account/PermissionTypeTest.php
@@ -21,7 +21,7 @@ class PermissionTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(6, count(PermissionType::getConstants()));
+ self::assertEquals(6, \count(PermissionType::getConstants()));
self::assertEquals(PermissionType::getConstants(), array_unique(PermissionType::getConstants()));
self::assertEquals(1, PermissionType::NONE);
diff --git a/tests/Asset/AssetTypeTest.php b/tests/Asset/AssetTypeTest.php
index 841322007..4b05dfc93 100644
--- a/tests/Asset/AssetTypeTest.php
+++ b/tests/Asset/AssetTypeTest.php
@@ -21,7 +21,7 @@ class AssetTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(3, count(AssetType::getConstants()));
+ self::assertEquals(3, \count(AssetType::getConstants()));
self::assertEquals(0, AssetType::CSS);
self::assertEquals(1, AssetType::JS);
self::assertEquals(2, AssetType::JSLATE);
diff --git a/tests/Auth/LoginReturnTypeTest.php b/tests/Auth/LoginReturnTypeTest.php
index 874cb3517..d43af49b8 100644
--- a/tests/Auth/LoginReturnTypeTest.php
+++ b/tests/Auth/LoginReturnTypeTest.php
@@ -21,7 +21,7 @@ class LoginReturnTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(11, count(LoginReturnType::getConstants()));
+ self::assertEquals(11, \count(LoginReturnType::getConstants()));
self::assertEquals(0, LoginReturnType::OK);
self::assertEquals(-1, LoginReturnType::FAILURE);
self::assertEquals(-2, LoginReturnType::WRONG_PASSWORD);
diff --git a/tests/Business/Finance/FinanceFormulasTest.php b/tests/Business/Finance/FinanceFormulasTest.php
index 71e50a10b..d82810cd4 100644
--- a/tests/Business/Finance/FinanceFormulasTest.php
+++ b/tests/Business/Finance/FinanceFormulasTest.php
@@ -25,7 +25,7 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
$n = 12;
$apy = FinanceFormulas::getAnnualPercentageYield($r, $n);
- self::assertEquals(round($expected, 5), round($apy, 5));
+ self::assertEquals(round($expected, 5), \round($apy, 5));
self::assertEquals(round($r, 2), FinanceFormulas::getStateAnnualInterestRateOfAPY($apy, $n));
}
@@ -38,9 +38,9 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
$n = 5;
$fva = FinanceFormulas::getFutureValueOfAnnuity($P, $r, $n);
- self::assertEquals(round($expected, 2), round($fva, 2));
+ self::assertEquals(round($expected, 2), \round($fva, 2));
self::assertEquals($n, FinanceFormulas::getNumberOfPeriodsOfFVA($fva, $P, $r));
- self::assertEquals(round($P, 2), round(FinanceFormulas::getPeriodicPaymentOfFVA($fva, $r, $n), 2));
+ self::assertEquals(round($P, 2), \round(FinanceFormulas::getPeriodicPaymentOfFVA($fva, $r, $n), 2));
}
public function testFutureValueOfAnnuityContinuousCompounding()
@@ -52,8 +52,8 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
$t = 12;
$fvacc = FinanceFormulas::getFutureValueOfAnnuityConinuousCompounding($cf, $r, $t);
- self::assertEquals(round($expected, 2), round($fvacc, 2));
- self::assertEquals(round($cf, 2), round(FinanceFormulas::getCashFlowOfFVACC($fvacc, $r, $t), 2));
+ self::assertEquals(round($expected, 2), \round($fvacc, 2));
+ self::assertEquals(round($cf, 2), \round(FinanceFormulas::getCashFlowOfFVACC($fvacc, $r, $t), 2));
self::assertEquals($t, FinanceFormulas::getTimeOfFVACC($fvacc, $cf, $r));
}
@@ -66,9 +66,9 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
$n = 5;
$p = FinanceFormulas::getAnnuityPaymentPV($pv, $r, $n);
- self::assertEquals(round($expected, 2), round($p, 2));
+ self::assertEquals(round($expected, 2), \round($p, 2));
self::assertEquals($n, FinanceFormulas::getNumberOfAPPV($p, $pv, $r));
- self::assertEquals(round($pv, 2), round(FinanceFormulas::getPresentValueOfAPPV($p, $r, $n), 2));
+ self::assertEquals(round($pv, 2), \round(FinanceFormulas::getPresentValueOfAPPV($p, $r, $n), 2));
}
public function testAnnuityPaymentFV()
@@ -80,9 +80,9 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
$n = 5;
$p = FinanceFormulas::getAnnuityPaymentFV($fv, $r, $n);
- self::assertEquals(round($expected, 2), round($p, 2));
+ self::assertEquals(round($expected, 2), \round($p, 2));
self::assertEquals($n, FinanceFormulas::getNumberOfAPFV($p, $fv, $r));
- self::assertEquals(round($fv, 2), round(FinanceFormulas::getFutureValueOfAPFV($p, $r, $n), 2));
+ self::assertEquals(round($fv, 2), \round(FinanceFormulas::getFutureValueOfAPFV($p, $r, $n), 2));
}
public function testAnnutiyPaymentFactorPV()
@@ -93,7 +93,7 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
$n = 5;
$p = FinanceFormulas::getAnnutiyPaymentFactorPV($r, $n);
- self::assertEquals(round($expected, 5), round($p, 5));
+ self::assertEquals(round($expected, 5), \round($p, 5));
self::assertEquals($n, FinanceFormulas::getNumberOfAPFPV($p, $r));
}
@@ -106,9 +106,9 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
$n = 5;
$pva = FinanceFormulas::getPresentValueOfAnnuity($P, $r, $n);
- self::assertEquals(round($expected, 2), round($pva, 2));
+ self::assertEquals(round($expected, 2), \round($pva, 2));
self::assertEquals($n, FinanceFormulas::getNumberOfPeriodsOfPVA($pva, $P, $r));
- self::assertEquals(round($P, 2), round(FinanceFormulas::getPeriodicPaymentOfPVA($pva, $r, $n), 2));
+ self::assertEquals(round($P, 2), \round(FinanceFormulas::getPeriodicPaymentOfPVA($pva, $r, $n), 2));
}
public function testPresentValueAnnuityFactor()
@@ -119,7 +119,7 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
$n = 5;
$p = FinanceFormulas::getPresentValueAnnuityFactor($r, $n);
- self::assertEquals(round($expected, 4), round($p, 4));
+ self::assertEquals(round($expected, 4), \round($p, 4));
self::assertEquals($n, FinanceFormulas::getPeriodsOfPVAF($p, $r));
}
@@ -133,7 +133,7 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
$PV = FinanceFormulas::getPresentValueOfAnnuityDue($P, $r, $n);
- self::assertEquals(round($expected, 2), round($PV, 2));
+ self::assertEquals(round($expected, 2), \round($PV, 2));
self::assertEquals(round($P, 2), FinanceFormulas::getPeriodicPaymentOfPVAD($PV, $r, $n));
self::assertEquals($n, FinanceFormulas::getPeriodsOfPVAD($PV, $P, $r));
}
@@ -148,7 +148,7 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
$FV = FinanceFormulas::getFutureValueOfAnnuityDue($P, $r, $n);
- self::assertEquals(round($expected, 2), round($FV, 2));
+ self::assertEquals(round($expected, 2), \round($FV, 2));
self::assertEquals(round($P, 2), FinanceFormulas::getPeriodicPaymentOfFVAD($FV, $r, $n));
self::assertEquals($n, FinanceFormulas::getPeriodsOfFVAD($FV, $P, $r));
}
@@ -196,11 +196,11 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
$r = 0.05;
$t = 3;
- $C = round(FinanceFormulas::getCompoundInterest($P, $r, $t), 2);
+ $C = \round(FinanceFormulas::getCompoundInterest($P, $r, $t), 2);
self::assertEquals(round($expected, 2), $C);
- self::assertTrue(abs($P - FinanceFormulas::getPrincipalOfCompundInterest($C, $r, $t)) < 0.1);
- self::assertEquals($t, (int) round(FinanceFormulas::getPeriodsOfCompundInterest($P, $C, $r), 0));
+ self::assertTrue(\abs($P - FinanceFormulas::getPrincipalOfCompundInterest($C, $r, $t)) < 0.1);
+ self::assertEquals($t, (int) \round(FinanceFormulas::getPeriodsOfCompundInterest($P, $C, $r), 0));
}
public function testContinuousCompounding()
@@ -211,12 +211,12 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
$r = 0.05;
$t = 3;
- $C = round(FinanceFormulas::getContinuousCompounding($P, $r, $t), 2);
+ $C = \round(FinanceFormulas::getContinuousCompounding($P, $r, $t), 2);
self::assertEquals(round($expected, 2), $C);
- self::assertEquals(round($P, 2), round(FinanceFormulas::getPrincipalOfContinuousCompounding($C, $r, $t), 2));
- self::assertTrue(abs($t - FinanceFormulas::getPeriodsOfContinuousCompounding($P, $C, $r)) < 0.01);
- self::assertTrue(abs($r - FinanceFormulas::getRateOfContinuousCompounding($P, $C, $t)) < 0.01);
+ self::assertEquals(round($P, 2), \round(FinanceFormulas::getPrincipalOfContinuousCompounding($C, $r, $t), 2));
+ self::assertTrue(\abs($t - FinanceFormulas::getPeriodsOfContinuousCompounding($P, $C, $r)) < 0.01);
+ self::assertTrue(\abs($r - FinanceFormulas::getRateOfContinuousCompounding($P, $C, $t)) < 0.01);
}
public function testSimpleInterest()
@@ -227,9 +227,9 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
$I = $P * $r * $t;
- self::assertTrue(abs($I - FinanceFormulas::getSimpleInterest($P, $r, $t)) < 0.01);
- self::assertTrue(abs($P - FinanceFormulas::getSimpleInterestPrincipal($I, $r, $t)) < 0.01);
- self::assertTrue(abs($r - FinanceFormulas::getSimpleInterestRate($I, $P, $t)) < 0.01);
+ self::assertTrue(\abs($I - FinanceFormulas::getSimpleInterest($P, $r, $t)) < 0.01);
+ self::assertTrue(\abs($P - FinanceFormulas::getSimpleInterestPrincipal($I, $r, $t)) < 0.01);
+ self::assertTrue(\abs($r - FinanceFormulas::getSimpleInterestRate($I, $P, $t)) < 0.01);
self::assertEquals($t, FinanceFormulas::getSimpleInterestTime($I, $P, $r));
}
@@ -239,15 +239,15 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
$r = 0.05;
$CF = 1000;
- self::assertTrue(abs(5.896 - FinanceFormulas::getDiscountedPaybackPeriod($CF, $O1, $r)) < 0.01);
+ self::assertTrue(\abs(5.896 - FinanceFormulas::getDiscountedPaybackPeriod($CF, $O1, $r)) < 0.01);
}
public function testDoublingTime()
{
$r = 0.05;
- self::assertTrue(abs(14.207 - FinanceFormulas::getDoublingTime($r)) < 0.01);
- self::assertTrue(abs($r - FinanceFormulas::getDoublingRate(14.207)) < 0.01);
+ self::assertTrue(\abs(14.207 - FinanceFormulas::getDoublingTime($r)) < 0.01);
+ self::assertTrue(\abs($r - FinanceFormulas::getDoublingRate(14.207)) < 0.01);
}
public function testDoublingTimeContinuousCompounding()
diff --git a/tests/Business/Finance/Forecasting/ExponentialSmoothing/SeasonalTypeTest.php b/tests/Business/Finance/Forecasting/ExponentialSmoothing/SeasonalTypeTest.php
index 1d86084d4..1140f4833 100644
--- a/tests/Business/Finance/Forecasting/ExponentialSmoothing/SeasonalTypeTest.php
+++ b/tests/Business/Finance/Forecasting/ExponentialSmoothing/SeasonalTypeTest.php
@@ -19,7 +19,7 @@ class SeasonalTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(4, count(SeasonalType::getConstants()));
+ self::assertEquals(4, \count(SeasonalType::getConstants()));
self::assertEquals(SeasonalType::getConstants(), array_unique(SeasonalType::getConstants()));
self::assertEquals(0, SeasonalType::ALL);
diff --git a/tests/Business/Finance/Forecasting/ExponentialSmoothing/TrendTypeTest.php b/tests/Business/Finance/Forecasting/ExponentialSmoothing/TrendTypeTest.php
index 1ff134b49..5df58ca69 100644
--- a/tests/Business/Finance/Forecasting/ExponentialSmoothing/TrendTypeTest.php
+++ b/tests/Business/Finance/Forecasting/ExponentialSmoothing/TrendTypeTest.php
@@ -19,7 +19,7 @@ class TrendTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(4, count(TrendType::getConstants()));
+ self::assertEquals(4, \count(TrendType::getConstants()));
self::assertEquals(TrendType::getConstants(), array_unique(TrendType::getConstants()));
self::assertEquals(0, TrendType::ALL);
diff --git a/tests/Business/Finance/Forecasting/SmoothingTypeTest.php b/tests/Business/Finance/Forecasting/SmoothingTypeTest.php
index c28d4a300..e41c4f445 100644
--- a/tests/Business/Finance/Forecasting/SmoothingTypeTest.php
+++ b/tests/Business/Finance/Forecasting/SmoothingTypeTest.php
@@ -19,7 +19,7 @@ class SmoothingTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(1, count(SmoothingType::getConstants()));
+ self::assertEquals(1, \count(SmoothingType::getConstants()));
self::assertEquals(SmoothingType::getConstants(), array_unique(SmoothingType::getConstants()));
self::assertEquals(1, SmoothingType::CENTERED_MOVING_AVERAGE);
diff --git a/tests/Business/Finance/LorenzkurveTest.php b/tests/Business/Finance/LorenzkurveTest.php
index d747e4670..449eccd86 100644
--- a/tests/Business/Finance/LorenzkurveTest.php
+++ b/tests/Business/Finance/LorenzkurveTest.php
@@ -21,6 +21,6 @@ class LorenzkurveTest extends \PHPUnit\Framework\TestCase
{
$arr = [1, 1, 1, 1, 1, 1, 1, 10, 33, 50];
- self::assertTrue(abs(0.71 - LorenzKurve::getGiniCoefficient($arr)) < 0.01);
+ self::assertTrue(\abs(0.71 - LorenzKurve::getGiniCoefficient($arr)) < 0.01);
}
}
diff --git a/tests/Business/Programming/MetricsTest.php b/tests/Business/Programming/MetricsTest.php
index 71a414ef6..a55f9d87a 100644
--- a/tests/Business/Programming/MetricsTest.php
+++ b/tests/Business/Programming/MetricsTest.php
@@ -19,7 +19,7 @@ class MetricsTest extends \PHPUnit\Framework\TestCase
{
public function testMetrics()
{
- self::assertEquals((int) sqrt(5 * 5 + 11 * 11 + 9 * 9), Metrics::abcScore(5, 11, 9));
+ self::assertEquals((int) \sqrt(5 * 5 + 11 * 11 + 9 * 9), Metrics::abcScore(5, 11, 9));
self::assertEquals(1, Metrics::CRAP(1, 1.0));
self::assertEquals(10100, Metrics::CRAP(100, 0.0));
diff --git a/tests/Business/Sales/MarketShareEstimationTest.php b/tests/Business/Sales/MarketShareEstimationTest.php
index 8b2b2b4e3..46ee72def 100644
--- a/tests/Business/Sales/MarketShareEstimationTest.php
+++ b/tests/Business/Sales/MarketShareEstimationTest.php
@@ -25,8 +25,8 @@ class MarketShareEstimationTest extends \PHPUnit\Framework\TestCase
public function testZipfShare()
{
- self::assertTrue(abs(0.01 - MarketShareEstimation::getMarketShareFromRank(1000, 13)) < 0.01);
- self::assertTrue(abs(0.01 - MarketShareEstimation::getMarketShareFromRank(100, 19)) < 0.01);
- self::assertTrue(abs(0.01 - MarketShareEstimation::getMarketShareFromRank(100000, 8)) < 0.01);
+ self::assertTrue(\abs(0.01 - MarketShareEstimation::getMarketShareFromRank(1000, 13)) < 0.01);
+ self::assertTrue(\abs(0.01 - MarketShareEstimation::getMarketShareFromRank(100, 19)) < 0.01);
+ self::assertTrue(\abs(0.01 - MarketShareEstimation::getMarketShareFromRank(100000, 8)) < 0.01);
}
}
diff --git a/tests/DataStorage/Cache/CacheStatusTest.php b/tests/DataStorage/Cache/CacheStatusTest.php
index 5dc782d66..797951f84 100644
--- a/tests/DataStorage/Cache/CacheStatusTest.php
+++ b/tests/DataStorage/Cache/CacheStatusTest.php
@@ -19,7 +19,7 @@ class CacheStatusTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(4, count(CacheStatus::getConstants()));
+ self::assertEquals(4, \count(CacheStatus::getConstants()));
self::assertEquals(0, CacheStatus::ACTIVE);
self::assertEquals(1, CacheStatus::INACTIVE);
self::assertEquals(2, CacheStatus::ERROR);
diff --git a/tests/DataStorage/Cache/CacheTypeTest.php b/tests/DataStorage/Cache/CacheTypeTest.php
index eaf6609a9..306c64fbb 100644
--- a/tests/DataStorage/Cache/CacheTypeTest.php
+++ b/tests/DataStorage/Cache/CacheTypeTest.php
@@ -19,7 +19,7 @@ class CacheTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(5, count(CacheType::getConstants()));
+ self::assertEquals(5, \count(CacheType::getConstants()));
self::assertEquals('file', CacheType::FILE);
self::assertEquals('mem', CacheType::MEMCACHED);
self::assertEquals('redis', CacheType::REDIS);
diff --git a/tests/DataStorage/Cache/Connection/CacheValueTypeTest.php b/tests/DataStorage/Cache/Connection/CacheValueTypeTest.php
index 2e8eeba45..c88bc9541 100644
--- a/tests/DataStorage/Cache/Connection/CacheValueTypeTest.php
+++ b/tests/DataStorage/Cache/Connection/CacheValueTypeTest.php
@@ -19,7 +19,7 @@ class CacheValueTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(8, count(CacheValueType::getConstants()));
+ self::assertEquals(8, \count(CacheValueType::getConstants()));
self::assertEquals(0, CacheValueType::_INT);
self::assertEquals(1, CacheValueType::_STRING);
self::assertEquals(2, CacheValueType::_ARRAY);
diff --git a/tests/DataStorage/Database/DataMapperAbstractTest.php b/tests/DataStorage/Database/DataMapperAbstractTest.php
index db281f850..558aef60a 100644
--- a/tests/DataStorage/Database/DataMapperAbstractTest.php
+++ b/tests/DataStorage/Database/DataMapperAbstractTest.php
@@ -122,10 +122,10 @@ class DataMapperAbstractTest extends \PHPUnit\Framework\TestCase
//self::assertEquals($this->model->json, $modelR->json);
//self::assertEquals([1, 2, 3], $modelR->jsonSerializable);
- self::assertEquals(2, count($modelR->hasManyDirect));
- self::assertEquals(2, count($modelR->hasManyRelations));
- self::assertEquals(reset($this->model->hasManyDirect)->string, reset($modelR->hasManyDirect)->string);
- self::assertEquals(reset($this->model->hasManyRelations)->string, reset($modelR->hasManyRelations)->string);
+ self::assertEquals(2, \count($modelR->hasManyDirect));
+ self::assertEquals(2, \count($modelR->hasManyRelations));
+ self::assertEquals(\reset($this->model->hasManyDirect)->string, \reset($modelR->hasManyDirect)->string);
+ self::assertEquals(\reset($this->model->hasManyRelations)->string, \reset($modelR->hasManyRelations)->string);
self::assertEquals($this->model->ownsOneSelf->string, $modelR->ownsOneSelf->string);
self::assertEquals($this->model->belongsToOne->string, $modelR->belongsToOne->string);
}
diff --git a/tests/DataStorage/Database/DatabaseStatusTest.php b/tests/DataStorage/Database/DatabaseStatusTest.php
index 459b3ee26..f23d294fb 100644
--- a/tests/DataStorage/Database/DatabaseStatusTest.php
+++ b/tests/DataStorage/Database/DatabaseStatusTest.php
@@ -19,7 +19,7 @@ class DatabaseStatusTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(6, count(DatabaseStatus::getConstants()));
+ self::assertEquals(6, \count(DatabaseStatus::getConstants()));
self::assertEquals(0, DatabaseStatus::OK);
self::assertEquals(1, DatabaseStatus::MISSING_DATABASE);
self::assertEquals(2, DatabaseStatus::MISSING_TABLE);
diff --git a/tests/DataStorage/Database/DatabaseTypeTest.php b/tests/DataStorage/Database/DatabaseTypeTest.php
index ec4e75460..3754c038a 100644
--- a/tests/DataStorage/Database/DatabaseTypeTest.php
+++ b/tests/DataStorage/Database/DatabaseTypeTest.php
@@ -19,7 +19,7 @@ class DatabaseTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(5, count(DatabaseType::getConstants()));
+ self::assertEquals(5, \count(DatabaseType::getConstants()));
self::assertEquals('mysql', DatabaseType::MYSQL);
self::assertEquals('sqlite', DatabaseType::SQLITE);
self::assertEquals('mssql', DatabaseType::SQLSRV);
diff --git a/tests/DataStorage/Database/Query/JoinTypeTest.php b/tests/DataStorage/Database/Query/JoinTypeTest.php
index be420f1a0..5bc814195 100644
--- a/tests/DataStorage/Database/Query/JoinTypeTest.php
+++ b/tests/DataStorage/Database/Query/JoinTypeTest.php
@@ -19,7 +19,7 @@ class JoinTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(11, count(JoinType::getConstants()));
+ self::assertEquals(11, \count(JoinType::getConstants()));
self::assertEquals(JoinType::getConstants(), array_unique(JoinType::getConstants()));
self::assertEquals('JOIN', JoinType::JOIN);
diff --git a/tests/DataStorage/Database/Query/QueryTypeTest.php b/tests/DataStorage/Database/Query/QueryTypeTest.php
index 5d67acef2..d0cc32139 100644
--- a/tests/DataStorage/Database/Query/QueryTypeTest.php
+++ b/tests/DataStorage/Database/Query/QueryTypeTest.php
@@ -19,7 +19,7 @@ class QueryTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(7, count(QueryType::getConstants()));
+ self::assertEquals(7, \count(QueryType::getConstants()));
self::assertEquals(QueryType::getConstants(), array_unique(QueryType::getConstants()));
self::assertEquals(0, QueryType::SELECT);
diff --git a/tests/DataStorage/Database/RelationTypeTest.php b/tests/DataStorage/Database/RelationTypeTest.php
index 45ce33800..b4b7aed6c 100644
--- a/tests/DataStorage/Database/RelationTypeTest.php
+++ b/tests/DataStorage/Database/RelationTypeTest.php
@@ -19,7 +19,7 @@ class RelationTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(7, count(RelationType::getConstants()));
+ self::assertEquals(7, \count(RelationType::getConstants()));
self::assertEquals(1, RelationType::NONE);
self::assertEquals(2, RelationType::NEWEST);
self::assertEquals(4, RelationType::BELONGS_TO);
diff --git a/tests/DataStorage/Database/Schema/QueryTypeTest.php b/tests/DataStorage/Database/Schema/QueryTypeTest.php
index a1cc7b4fb..a427f7c39 100644
--- a/tests/DataStorage/Database/Schema/QueryTypeTest.php
+++ b/tests/DataStorage/Database/Schema/QueryTypeTest.php
@@ -19,7 +19,7 @@ class QueryTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(4, count(QueryType::getConstants()));
+ self::assertEquals(4, \count(QueryType::getConstants()));
self::assertEquals(QueryType::getConstants(), array_unique(QueryType::getConstants()));
self::assertEquals(0, QueryType::SELECT);
diff --git a/tests/Localization/ISO3166CharEnumTest.php b/tests/Localization/ISO3166CharEnumTest.php
index e57e48f83..74913eb8d 100644
--- a/tests/Localization/ISO3166CharEnumTest.php
+++ b/tests/Localization/ISO3166CharEnumTest.php
@@ -26,13 +26,13 @@ class ISO3166CharEnumTest extends \PHPUnit\Framework\TestCase
$enum = ISO3166CharEnum::getConstants();
foreach ($enum as $code) {
- if (strlen($code) !== 3) {
+ if (\strlen($code) !== 3) {
$ok = false;
break;
}
}
self::assertTrue($ok);
- self::assertEquals(count($enum), count(array_unique($enum)));
+ self::assertEquals(\count($enum), \count(array_unique($enum)));
}
}
diff --git a/tests/Localization/ISO3166NameEnumTest.php b/tests/Localization/ISO3166NameEnumTest.php
index af70e5cc3..804211b14 100644
--- a/tests/Localization/ISO3166NameEnumTest.php
+++ b/tests/Localization/ISO3166NameEnumTest.php
@@ -22,6 +22,6 @@ class ISO3166NameEnumTest extends \PHPUnit\Framework\TestCase
public function testEnums()
{
$enum = ISO3166NameEnum::getConstants();
- self::assertEquals(count($enum), count(array_unique($enum)));
+ self::assertEquals(\count($enum), \count(array_unique($enum)));
}
}
diff --git a/tests/Localization/ISO3166NumEnumTest.php b/tests/Localization/ISO3166NumEnumTest.php
index 49da9f905..d7ceed888 100644
--- a/tests/Localization/ISO3166NumEnumTest.php
+++ b/tests/Localization/ISO3166NumEnumTest.php
@@ -26,13 +26,13 @@ class ISO3166NumEnumTest extends \PHPUnit\Framework\TestCase
$enum = ISO3166NumEnum::getConstants();
foreach ($enum as $code) {
- if (strlen($code) !== 3) {
+ if (\strlen($code) !== 3) {
$ok = false;
break;
}
}
self::assertTrue($ok);
- self::assertEquals(count($enum), count(array_unique($enum)));
+ self::assertEquals(\count($enum), \count(array_unique($enum)));
}
}
diff --git a/tests/Localization/ISO3166TwoEnumTest.php b/tests/Localization/ISO3166TwoEnumTest.php
index 57c6fd45e..b35cfebdd 100644
--- a/tests/Localization/ISO3166TwoEnumTest.php
+++ b/tests/Localization/ISO3166TwoEnumTest.php
@@ -26,13 +26,13 @@ class ISO3166TwoEnumTest extends \PHPUnit\Framework\TestCase
$countryCodes = ISO3166TwoEnum::getConstants();
foreach ($countryCodes as $code) {
- if (strlen($code) !== 2) {
+ if (\strlen($code) !== 2) {
$ok = false;
break;
}
}
self::assertTrue($ok);
- self::assertEquals(count($countryCodes), count(array_unique($countryCodes)));
+ self::assertEquals(\count($countryCodes), \count(array_unique($countryCodes)));
}
}
diff --git a/tests/Localization/ISO4217CharEnumTest.php b/tests/Localization/ISO4217CharEnumTest.php
index a65f8bf73..906996b09 100644
--- a/tests/Localization/ISO4217CharEnumTest.php
+++ b/tests/Localization/ISO4217CharEnumTest.php
@@ -26,13 +26,13 @@ class ISO4217CharEnumTest extends \PHPUnit\Framework\TestCase
$enum = ISO4217CharEnum::getConstants();
foreach ($enum as $code) {
- if (strlen($code) !== 3) {
+ if (\strlen($code) !== 3) {
$ok = false;
break;
}
}
self::assertTrue($ok);
- self::assertEquals(count($enum), count(array_unique($enum)));
+ self::assertEquals(\count($enum), \count(array_unique($enum)));
}
}
diff --git a/tests/Localization/ISO4217EnumTest.php b/tests/Localization/ISO4217EnumTest.php
index 9f4c7cb5b..db41d58e1 100644
--- a/tests/Localization/ISO4217EnumTest.php
+++ b/tests/Localization/ISO4217EnumTest.php
@@ -22,6 +22,6 @@ class ISO4217EnumTest extends \PHPUnit\Framework\TestCase
public function testEnums()
{
$enum = ISO4217Enum::getConstants();
- self::assertEquals(count($enum), count(array_unique($enum)));
+ self::assertEquals(\count($enum), \count(array_unique($enum)));
}
}
diff --git a/tests/Localization/ISO4217NumEnumTest.php b/tests/Localization/ISO4217NumEnumTest.php
index e1707106e..58715e072 100644
--- a/tests/Localization/ISO4217NumEnumTest.php
+++ b/tests/Localization/ISO4217NumEnumTest.php
@@ -26,13 +26,13 @@ class ISO4217NumEnumTest extends \PHPUnit\Framework\TestCase
$enum = ISO4217NumEnum::getConstants();
foreach ($enum as $code) {
- if (strlen($code) !== 3) {
+ if (\strlen($code) !== 3) {
$ok = false;
break;
}
}
self::assertTrue($ok);
- self::assertEquals(count($enum), count(array_unique($enum)));
+ self::assertEquals(\count($enum), \count(array_unique($enum)));
}
}
diff --git a/tests/Localization/ISO4217SymbolEnumTest.php b/tests/Localization/ISO4217SymbolEnumTest.php
index 7836e2045..e0b509c43 100644
--- a/tests/Localization/ISO4217SymbolEnumTest.php
+++ b/tests/Localization/ISO4217SymbolEnumTest.php
@@ -22,6 +22,6 @@ class ISO4217SymbolEnumTest extends \PHPUnit\Framework\TestCase
public function testEnum()
{
$enum = ISO4217SymbolEnum::getConstants();
- self::assertEquals(109, count($enum));
+ self::assertEquals(109, \count($enum));
}
}
diff --git a/tests/Localization/ISO639EnumTest.php b/tests/Localization/ISO639EnumTest.php
index 4c324d13b..d5a5b5e94 100644
--- a/tests/Localization/ISO639EnumTest.php
+++ b/tests/Localization/ISO639EnumTest.php
@@ -22,6 +22,6 @@ class ISO639EnumTest extends \PHPUnit\Framework\TestCase
public function testEnums()
{
$enum = ISO639Enum::getConstants();
- self::assertEquals(count($enum), count(array_unique($enum)));
+ self::assertEquals(\count($enum), \count(array_unique($enum)));
}
}
diff --git a/tests/Localization/ISO639x1EnumTest.php b/tests/Localization/ISO639x1EnumTest.php
index 0c47e53e1..1395c5c2e 100644
--- a/tests/Localization/ISO639x1EnumTest.php
+++ b/tests/Localization/ISO639x1EnumTest.php
@@ -26,13 +26,13 @@ class ISO639x1EnumTest extends \PHPUnit\Framework\TestCase
$enum = ISO639x1Enum::getConstants();
foreach ($enum as $code) {
- if (strlen($code) !== 2) {
+ if (\strlen($code) !== 2) {
$ok = false;
break;
}
}
self::assertTrue($ok);
- self::assertEquals(count($enum), count(array_unique($enum)));
+ self::assertEquals(\count($enum), \count(array_unique($enum)));
}
}
diff --git a/tests/Localization/ISO639x2EnumTest.php b/tests/Localization/ISO639x2EnumTest.php
index 7bd541c25..a8c8121a7 100644
--- a/tests/Localization/ISO639x2EnumTest.php
+++ b/tests/Localization/ISO639x2EnumTest.php
@@ -26,13 +26,13 @@ class ISO639x2EnumTest extends \PHPUnit\Framework\TestCase
$enum = ISO639x2Enum::getConstants();
foreach ($enum as $code) {
- if (strlen($code) !== 3) {
+ if (\strlen($code) !== 3) {
$ok = false;
break;
}
}
self::assertTrue($ok);
- self::assertEquals(count($enum), count(array_unique($enum)));
+ self::assertEquals(\count($enum), \count(array_unique($enum)));
}
}
diff --git a/tests/Localization/ISO8601EnumArrayTest.php b/tests/Localization/ISO8601EnumArrayTest.php
index 54b073254..001a2764c 100644
--- a/tests/Localization/ISO8601EnumArrayTest.php
+++ b/tests/Localization/ISO8601EnumArrayTest.php
@@ -21,6 +21,6 @@ class ISO8601EnumArrayTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(4, count(ISO8601EnumArray::getConstants()));
+ self::assertEquals(4, \count(ISO8601EnumArray::getConstants()));
}
}
diff --git a/tests/Localization/PhoneEnumTest.php b/tests/Localization/PhoneEnumTest.php
index 92c46f59d..6d21029c9 100644
--- a/tests/Localization/PhoneEnumTest.php
+++ b/tests/Localization/PhoneEnumTest.php
@@ -26,7 +26,7 @@ class PhoneEnumTest extends \PHPUnit\Framework\TestCase
$countryCodes = PhoneEnum::getConstants();
foreach ($countryCodes as $code) {
- if (strlen($code) < 0 || $code > 9999) {
+ if (\strlen($code) < 0 || $code > 9999) {
$ok = false;
break;
}
diff --git a/tests/Localization/TimeZoneEnumArrayTest.php b/tests/Localization/TimeZoneEnumArrayTest.php
index 186db3990..8c71cf254 100644
--- a/tests/Localization/TimeZoneEnumArrayTest.php
+++ b/tests/Localization/TimeZoneEnumArrayTest.php
@@ -21,6 +21,6 @@ class TimeZoneEnumArrayTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(count(TimeZoneEnumArray::getConstants()), count(array_unique(TimeZoneEnumArray::getConstants())));
+ self::assertEquals(\count(TimeZoneEnumArray::getConstants()), \count(array_unique(TimeZoneEnumArray::getConstants())));
}
}
diff --git a/tests/Log/FileLoggerTest.php b/tests/Log/FileLoggerTest.php
index a9e07e858..ed275d4a4 100644
--- a/tests/Log/FileLoggerTest.php
+++ b/tests/Log/FileLoggerTest.php
@@ -132,12 +132,12 @@ class FileLoggerTest extends \PHPUnit\Framework\TestCase
]);
$ob = ob_get_clean();
self::assertEquals(1, $log->countLogs()['info'] ?? 0);
- self::assertTrue(stripos($ob, 'msg;') !== false);
+ self::assertTrue(\stripos($ob, 'msg;') !== false);
ob_start();
$log->console('test', true);
$ob = ob_get_clean();
- self::assertEquals(date('[Y-m-d H:i:s] ') . "test\r\n", $ob);
+ self::assertEquals(\date('[Y-m-d H:i:s] ') . "test\r\n", $ob);
unlink(__DIR__ . '/test.log');
diff --git a/tests/Log/LogLevelTest.php b/tests/Log/LogLevelTest.php
index 8ac4ddb1d..94624f3ef 100644
--- a/tests/Log/LogLevelTest.php
+++ b/tests/Log/LogLevelTest.php
@@ -21,7 +21,7 @@ class LogLevelTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(8, count(LogLevel::getConstants()));
+ self::assertEquals(8, \count(LogLevel::getConstants()));
self::assertEquals('emergency', LogLevel::EMERGENCY);
self::assertEquals('alert', LogLevel::ALERT);
self::assertEquals('critical', LogLevel::CRITICAL);
diff --git a/tests/Math/Matrix/InverseTypeTest.php b/tests/Math/Matrix/InverseTypeTest.php
index 2777459ca..b2a3310ad 100644
--- a/tests/Math/Matrix/InverseTypeTest.php
+++ b/tests/Math/Matrix/InverseTypeTest.php
@@ -19,7 +19,7 @@ class InverseTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(1, count(InverseType::getConstants()));
+ self::assertEquals(1, \count(InverseType::getConstants()));
self::assertEquals(InverseType::getConstants(), array_unique(InverseType::getConstants()));
self::assertEquals(0, InverseType::GAUSS_JORDAN);
diff --git a/tests/Math/Matrix/VectorTest.php b/tests/Math/Matrix/VectorTest.php
index bb311d93b..0e52bec60 100644
--- a/tests/Math/Matrix/VectorTest.php
+++ b/tests/Math/Matrix/VectorTest.php
@@ -22,6 +22,6 @@ class VectorTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\phpOMS\Math\Matrix\Vector', new Vector());
$vec = new Vector(5);
- self::assertEquals(5, count($vec->toArray()));
+ self::assertEquals(5, \count($vec->toArray()));
}
}
diff --git a/tests/Math/Number/NumberTypeTest.php b/tests/Math/Number/NumberTypeTest.php
index c12187aa6..e4cb2f742 100644
--- a/tests/Math/Number/NumberTypeTest.php
+++ b/tests/Math/Number/NumberTypeTest.php
@@ -19,7 +19,7 @@ class NumberTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(9, count(NumberType::getConstants()));
+ self::assertEquals(9, \count(NumberType::getConstants()));
self::assertEquals(NumberType::getConstants(), array_unique(NumberType::getConstants()));
self::assertEquals(0, NumberType::N_INTEGER);
diff --git a/tests/Math/Stochastic/Distribution/BernoulliDistributionTest.php b/tests/Math/Stochastic/Distribution/BernoulliDistributionTest.php
index 80036a711..11231bd37 100644
--- a/tests/Math/Stochastic/Distribution/BernoulliDistributionTest.php
+++ b/tests/Math/Stochastic/Distribution/BernoulliDistributionTest.php
@@ -62,7 +62,7 @@ class BernoulliDistributionTest extends \PHPUnit\Framework\TestCase
$p = 0.3;
$q = 1 - $p;
- self::assertEquals((1 - 2 * $p) / sqrt($p * $q), BernoulliDistribution::getSkewness($p), '', 0.01);
+ self::assertEquals((1 - 2 * $p) / \sqrt($p * $q), BernoulliDistribution::getSkewness($p), '', 0.01);
}
public function testExKurtosis()
@@ -78,7 +78,7 @@ class BernoulliDistributionTest extends \PHPUnit\Framework\TestCase
$p = 0.3;
$q = 1 - $p;
- self::assertEquals(-$q * log($q) - $p * log($p), BernoulliDistribution::getEntropy($p), '', 0.01);
+ self::assertEquals(-$q * \log($q) - $p * \log($p), BernoulliDistribution::getEntropy($p), '', 0.01);
}
public function testMgf()
@@ -87,7 +87,7 @@ class BernoulliDistributionTest extends \PHPUnit\Framework\TestCase
$q = 1 - $p;
$t = 2;
- self::assertEquals($q + $p * exp($t), BernoulliDistribution::getMgf($p, $t), '', 0.01);
+ self::assertEquals($q + $p * \exp($t), BernoulliDistribution::getMgf($p, $t), '', 0.01);
}
public function testFisherInformation()
diff --git a/tests/Math/Stochastic/Distribution/BinomialDistributionTest.php b/tests/Math/Stochastic/Distribution/BinomialDistributionTest.php
index d739b84fd..e4bf25676 100644
--- a/tests/Math/Stochastic/Distribution/BinomialDistributionTest.php
+++ b/tests/Math/Stochastic/Distribution/BinomialDistributionTest.php
@@ -48,7 +48,7 @@ class BinomialDistributionTest extends \PHPUnit\Framework\TestCase
$n = 20;
$p = 0.4;
- self::assertEquals(floor($n * $p), BinomialDistribution::getMedian($n, $p), '', 0.01);
+ self::assertEquals(\floor($n * $p), BinomialDistribution::getMedian($n, $p), '', 0.01);
}
public function testMode()
@@ -56,7 +56,7 @@ class BinomialDistributionTest extends \PHPUnit\Framework\TestCase
$n = 20;
$p = 0.4;
- self::assertEquals(floor(($n + 1) * $p), BinomialDistribution::getMode($n, $p), '', 0.01);
+ self::assertEquals(\floor(($n + 1) * $p), BinomialDistribution::getMode($n, $p), '', 0.01);
}
public function testVariance()
@@ -72,7 +72,7 @@ class BinomialDistributionTest extends \PHPUnit\Framework\TestCase
$n = 20;
$p = 0.4;
- self::assertEquals((1 - 2 * $p) / sqrt($n * $p * (1 - $p)), BinomialDistribution::getSkewness($n, $p), '', 0.01);
+ self::assertEquals((1 - 2 * $p) / \sqrt($n * $p * (1 - $p)), BinomialDistribution::getSkewness($n, $p), '', 0.01);
}
public function testExKurtosis()
@@ -89,7 +89,7 @@ class BinomialDistributionTest extends \PHPUnit\Framework\TestCase
$p = 0.4;
$t = 3;
- self::assertEquals((1 - $p + $p * exp($t)) ** $n, BinomialDistribution::getMgf($n, $t, $p), '', 0.01);
+ self::assertEquals((1 - $p + $p * \exp($t)) ** $n, BinomialDistribution::getMgf($n, $t, $p), '', 0.01);
}
public function testFisherInformation()
diff --git a/tests/Math/Stochastic/Distribution/CauchyDistributionTest.php b/tests/Math/Stochastic/Distribution/CauchyDistributionTest.php
index 79d010e88..942f324f3 100644
--- a/tests/Math/Stochastic/Distribution/CauchyDistributionTest.php
+++ b/tests/Math/Stochastic/Distribution/CauchyDistributionTest.php
@@ -45,6 +45,6 @@ class CauchyDistributionTest extends \PHPUnit\Framework\TestCase
{
$gamma = 1.5;
- self::assertEquals(log(4 * M_PI * $gamma), CauchyDistribution::getEntropy($gamma), '', 0.01);
+ self::assertEquals(\log(4 * M_PI * $gamma), CauchyDistribution::getEntropy($gamma), '', 0.01);
}
}
diff --git a/tests/Message/Http/OSTypeTest.php b/tests/Message/Http/OSTypeTest.php
index e291180c7..ec2d9451b 100644
--- a/tests/Message/Http/OSTypeTest.php
+++ b/tests/Message/Http/OSTypeTest.php
@@ -19,7 +19,7 @@ class OSTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(24, count(OSType::getConstants()));
+ self::assertEquals(24, \count(OSType::getConstants()));
self::assertEquals(OSType::getConstants(), array_unique(OSType::getConstants()));
}
}
diff --git a/tests/Message/Http/RequestMethodTest.php b/tests/Message/Http/RequestMethodTest.php
index ba74b71b3..cee370155 100644
--- a/tests/Message/Http/RequestMethodTest.php
+++ b/tests/Message/Http/RequestMethodTest.php
@@ -19,7 +19,7 @@ class RequestMethodTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(6, count(RequestMethod::getConstants()));
+ self::assertEquals(6, \count(RequestMethod::getConstants()));
self::assertEquals(RequestMethod::getConstants(), array_unique(RequestMethod::getConstants()));
self::assertEquals('GET', RequestMethod::GET);
diff --git a/tests/Message/Http/RequestStatusCodeTest.php b/tests/Message/Http/RequestStatusCodeTest.php
index 8ff9e3a2a..0019420a1 100644
--- a/tests/Message/Http/RequestStatusCodeTest.php
+++ b/tests/Message/Http/RequestStatusCodeTest.php
@@ -19,7 +19,7 @@ class RequestStatusCodeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(55, count(RequestStatusCode::getConstants()));
+ self::assertEquals(55, \count(RequestStatusCode::getConstants()));
self::assertEquals(RequestStatusCode::getConstants(), array_unique(RequestStatusCode::getConstants()));
self::assertEquals(100, RequestStatusCode::R_100);
diff --git a/tests/Message/Http/RequestStatusTest.php b/tests/Message/Http/RequestStatusTest.php
index 430b316d8..308bd184f 100644
--- a/tests/Message/Http/RequestStatusTest.php
+++ b/tests/Message/Http/RequestStatusTest.php
@@ -19,7 +19,7 @@ class RequestStatusTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(55, count(RequestStatus::getConstants()));
+ self::assertEquals(55, \count(RequestStatus::getConstants()));
self::assertEquals(RequestStatus::getConstants(), array_unique(RequestStatus::getConstants()));
self::assertEquals('Continue', RequestStatus::R_100);
diff --git a/tests/Message/RequestSourceTest.php b/tests/Message/RequestSourceTest.php
index cbac7bedc..a46db3c36 100644
--- a/tests/Message/RequestSourceTest.php
+++ b/tests/Message/RequestSourceTest.php
@@ -21,7 +21,7 @@ class RequestSourceTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(4, count(RequestSource::getConstants()));
+ self::assertEquals(4, \count(RequestSource::getConstants()));
self::assertEquals(0, RequestSource::WEB);
self::assertEquals(1, RequestSource::CONSOLE);
self::assertEquals(2, RequestSource::SOCKET);
diff --git a/tests/Message/ResponseTypeTest.php b/tests/Message/ResponseTypeTest.php
index 18802338c..863f6665b 100644
--- a/tests/Message/ResponseTypeTest.php
+++ b/tests/Message/ResponseTypeTest.php
@@ -21,7 +21,7 @@ class ResponseTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(3, count(ResponseType::getConstants()));
+ self::assertEquals(3, \count(ResponseType::getConstants()));
self::assertEquals(0, ResponseType::HTTP);
self::assertEquals(1, ResponseType::SOCKET);
self::assertEquals(2, ResponseType::CONSOLE);
diff --git a/tests/Router/RouteVerbTest.php b/tests/Router/RouteVerbTest.php
index 8fc3a17eb..c103b0e6b 100644
--- a/tests/Router/RouteVerbTest.php
+++ b/tests/Router/RouteVerbTest.php
@@ -21,16 +21,16 @@ class RouteVerbTest extends \PHPUnit\Framework\TestCase
{
public function testEnum()
{
- self::assertTrue(defined('phpOMS\Router\RouteVerb::GET'));
- self::assertTrue(defined('phpOMS\Router\RouteVerb::PUT'));
- self::assertTrue(defined('phpOMS\Router\RouteVerb::SET'));
- self::assertTrue(defined('phpOMS\Router\RouteVerb::DELETE'));
- self::assertTrue(defined('phpOMS\Router\RouteVerb::ANY'));
+ self::assertTrue(\defined('phpOMS\Router\RouteVerb::GET'));
+ self::assertTrue(\defined('phpOMS\Router\RouteVerb::PUT'));
+ self::assertTrue(\defined('phpOMS\Router\RouteVerb::SET'));
+ self::assertTrue(\defined('phpOMS\Router\RouteVerb::DELETE'));
+ self::assertTrue(\defined('phpOMS\Router\RouteVerb::ANY'));
}
public function testEnumUnique()
{
$values = RouteVerb::getConstants();
- self::assertEquals(count($values), array_sum(array_count_values($values)));
+ self::assertEquals(\count($values), array_sum(array_count_values($values)));
}
}
diff --git a/tests/Stdlib/Base/AddressTypeTest.php b/tests/Stdlib/Base/AddressTypeTest.php
index b3e5a53c9..083f26127 100644
--- a/tests/Stdlib/Base/AddressTypeTest.php
+++ b/tests/Stdlib/Base/AddressTypeTest.php
@@ -19,7 +19,7 @@ class AddressTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(7, count(AddressType::getconstants()));
+ self::assertEquals(7, \count(AddressType::getconstants()));
self::assertEquals(1, AddressType::HOME);
self::assertEquals(2, AddressType::BUSINESS);
self::assertEquals(3, AddressType::SHIPPING);
diff --git a/tests/Stdlib/Base/PhoneTypeTest.php b/tests/Stdlib/Base/PhoneTypeTest.php
index 399ffe989..a76b7a4bf 100644
--- a/tests/Stdlib/Base/PhoneTypeTest.php
+++ b/tests/Stdlib/Base/PhoneTypeTest.php
@@ -19,7 +19,7 @@ class PhoneTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(4, count(PhoneType::getConstants()));
+ self::assertEquals(4, \count(PhoneType::getConstants()));
self::assertEquals(1, PhoneType::HOME);
self::assertEquals(2, PhoneType::BUSINESS);
self::assertEquals(3, PhoneType::MOBILE);
diff --git a/tests/Stdlib/Base/SmartDateTimeTest.php b/tests/Stdlib/Base/SmartDateTimeTest.php
index f7176a219..0f699566f 100644
--- a/tests/Stdlib/Base/SmartDateTimeTest.php
+++ b/tests/Stdlib/Base/SmartDateTimeTest.php
@@ -46,18 +46,18 @@ class SmartDateTimeTest extends \PHPUnit\Framework\TestCase
$expected = new \DateTime('now');
$obj = SmartDateTime::createFromDateTime($expected);
self::assertEquals($expected->format('Y-m-d H:i:s'), $obj->format('Y-m-d H:i:s'));
- self::assertEquals(date("Y-m-t", strtotime($expected->format('Y-m-d'))), $obj->getEndOfMonth()->format('Y-m-d'));
- self::assertEquals(date("Y-m-01", strtotime($expected->format('Y-m-d'))), $obj->getStartOfMonth()->format('Y-m-d'));
+ self::assertEquals(\date("Y-m-t", strtotime($expected->format('Y-m-d'))), $obj->getEndOfMonth()->format('Y-m-d'));
+ self::assertEquals(\date("Y-m-01", strtotime($expected->format('Y-m-d'))), $obj->getStartOfMonth()->format('Y-m-d'));
self::assertFalse((new SmartDateTime('2103-07-20'))->isLeapYear());
self::assertTrue((new SmartDateTime('2104-07-20'))->isLeapYear());
self::assertFalse(SmartDateTime::leapYear(2103));
self::assertTrue(SmartDateTime::leapYear(2104));
- self::assertEquals(date('w', $expected->getTimestamp()), SmartDateTime::getDayOfWeek((int) $expected->format('Y'), (int) $expected->format('m'), (int) $expected->format('d')));
- self::assertEquals(date('w', $expected->getTimestamp()), $obj->getFirstDayOfWeek());
+ self::assertEquals(\date('w', $expected->getTimestamp()), SmartDateTime::getDayOfWeek((int) $expected->format('Y'), (int) $expected->format('m'), (int) $expected->format('d')));
+ self::assertEquals(\date('w', $expected->getTimestamp()), $obj->getFirstDayOfWeek());
- self::assertEquals(42, count($obj->getMonthCalendar()));
- self::assertEquals(42, count($obj->getMonthCalendar(1)));
+ self::assertEquals(42, \count($obj->getMonthCalendar()));
+ self::assertEquals(42, \count($obj->getMonthCalendar(1)));
}
}
diff --git a/tests/Stdlib/Map/KeyTypeTest.php b/tests/Stdlib/Map/KeyTypeTest.php
index a486342ab..1e5e32c5c 100644
--- a/tests/Stdlib/Map/KeyTypeTest.php
+++ b/tests/Stdlib/Map/KeyTypeTest.php
@@ -19,7 +19,7 @@ class KeyTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(2, count(KeyType::getConstants()));
+ self::assertEquals(2, \count(KeyType::getConstants()));
self::assertEquals(0, KeyType::SINGLE);
self::assertEquals(1, KeyType::MULTIPLE);
}
diff --git a/tests/Stdlib/Map/MultiMapTest.php b/tests/Stdlib/Map/MultiMapTest.php
index 923698943..94a905391 100644
--- a/tests/Stdlib/Map/MultiMapTest.php
+++ b/tests/Stdlib/Map/MultiMapTest.php
@@ -152,8 +152,8 @@ class MultiMapTest extends \PHPUnit\Framework\TestCase
$set = $map->set('d', 'val4');
$set = $map->set('b', 'val4');
- self::assertEquals(3, count($map->keys()));
- self::assertEquals(2, count($map->values()));
+ self::assertEquals(3, \count($map->keys()));
+ self::assertEquals(2, \count($map->values()));
self::assertTrue(is_array($map->keys()));
self::assertTrue(is_array($map->values()));
@@ -170,10 +170,10 @@ class MultiMapTest extends \PHPUnit\Framework\TestCase
$siblings = $map->getSiblings('d');
self::assertEmpty($siblings);
- self::assertEquals(0, count($siblings));
+ self::assertEquals(0, \count($siblings));
$siblings = $map->getSiblings('b');
- self::assertEquals(1, count($siblings));
+ self::assertEquals(1, \count($siblings));
self::assertEquals(['a'], $siblings);
}
@@ -195,15 +195,15 @@ class MultiMapTest extends \PHPUnit\Framework\TestCase
$removed = $map->remove('c');
self::assertTrue($removed);
- self::assertEquals(2, count($map->keys()));
- self::assertEquals(1, count($map->values()));
+ self::assertEquals(2, \count($map->keys()));
+ self::assertEquals(1, \count($map->values()));
$removed = $map->removeKey('d');
self::assertFalse($removed);
$removed = $map->removeKey('a');
self::assertTrue($removed);
- self::assertEquals(1, count($map->keys()));
- self::assertEquals(1, count($map->values()));
+ self::assertEquals(1, \count($map->keys()));
+ self::assertEquals(1, \count($map->values()));
}
}
diff --git a/tests/Stdlib/Map/OrderTypeTest.php b/tests/Stdlib/Map/OrderTypeTest.php
index d8fefd5c6..8d94dbdd1 100644
--- a/tests/Stdlib/Map/OrderTypeTest.php
+++ b/tests/Stdlib/Map/OrderTypeTest.php
@@ -19,7 +19,7 @@ class OrderTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(2, count(OrderType::getConstants()));
+ self::assertEquals(2, \count(OrderType::getConstants()));
self::assertEquals(0, OrderType::LOOSE);
self::assertEquals(1, OrderType::STRICT);
}
diff --git a/tests/Stdlib/Queue/PriorityModeTest.php b/tests/Stdlib/Queue/PriorityModeTest.php
index 6e8659794..050189206 100644
--- a/tests/Stdlib/Queue/PriorityModeTest.php
+++ b/tests/Stdlib/Queue/PriorityModeTest.php
@@ -19,7 +19,7 @@ class PriorityModeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(6, count(PriorityMode::getConstants()));
+ self::assertEquals(6, \count(PriorityMode::getConstants()));
self::assertEquals(1, PriorityMode::FIFO);
self::assertEquals(2, PriorityMode::LIFO);
self::assertEquals(4, PriorityMode::EARLIEST_DEADLINE);
diff --git a/tests/System/File/ContentPutModeTest.php b/tests/System/File/ContentPutModeTest.php
index c18944f73..b210486b7 100644
--- a/tests/System/File/ContentPutModeTest.php
+++ b/tests/System/File/ContentPutModeTest.php
@@ -19,7 +19,7 @@ class ContentPutModeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(4, count(ContentPutMode::getConstants()));
+ self::assertEquals(4, \count(ContentPutMode::getConstants()));
self::assertEquals(ContentPutMode::getConstants(), array_unique(ContentPutMode::getConstants()));
self::assertEquals(1, ContentPutMode::APPEND);
diff --git a/tests/System/File/ExtensionTypeTest.php b/tests/System/File/ExtensionTypeTest.php
index 684f71558..0e3061842 100644
--- a/tests/System/File/ExtensionTypeTest.php
+++ b/tests/System/File/ExtensionTypeTest.php
@@ -19,7 +19,7 @@ class ExtensionTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(10, count(ExtensionType::getConstants()));
+ self::assertEquals(10, \count(ExtensionType::getConstants()));
self::assertEquals(ExtensionType::getConstants(), array_unique(ExtensionType::getConstants()));
self::assertEquals(1, ExtensionType::UNKNOWN);
diff --git a/tests/System/File/Ftp/DirectoryTest.php b/tests/System/File/Ftp/DirectoryTest.php
index 43411d9cb..6a412a562 100644
--- a/tests/System/File/Ftp/DirectoryTest.php
+++ b/tests/System/File/Ftp/DirectoryTest.php
@@ -74,8 +74,8 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
self::assertEquals(4, Directory::count($dirTestPath));
self::assertEquals(1, Directory::count($dirTestPath, false));
- self::assertEquals(6, count(Directory::list($dirTestPath)));
- self::assertEquals(3, count(Directory::listByExtension($dirTestPath, 'txt')));
+ self::assertEquals(6, \count(Directory::list($dirTestPath)));
+ self::assertEquals(3, \count(Directory::listByExtension($dirTestPath, 'txt')));
}
/**
diff --git a/tests/System/File/Ftp/FileTest.php b/tests/System/File/Ftp/FileTest.php
index bc5ba193b..f6c097060 100644
--- a/tests/System/File/Ftp/FileTest.php
+++ b/tests/System/File/Ftp/FileTest.php
@@ -48,8 +48,8 @@ class FileTest extends \PHPUnit\Framework\TestCase
self::assertEquals('txt', File::extension($testFile));
self::assertEquals('test', File::name($testFile));
self::assertEquals('test.txt', File::basename($testFile));
- self::assertEquals(basename(realpath(self::BASE)), File::dirname($testFile));
- self::assertEquals(realpath(self::BASE), File::dirpath($testFile));
+ self::assertEquals(\basename(\realpath(self::BASE)), File::dirname($testFile));
+ self::assertEquals(\realpath(self::BASE), File::dirpath($testFile));
self::assertEquals(1, File::count($testFile));
$now = new \DateTime('now');
diff --git a/tests/System/File/Ftp/FtpStorageTest.php b/tests/System/File/Ftp/FtpStorageTest.php
index 511cacefe..266198657 100644
--- a/tests/System/File/Ftp/FtpStorageTest.php
+++ b/tests/System/File/Ftp/FtpStorageTest.php
@@ -48,8 +48,8 @@ class FtpStorageTest extends \PHPUnit\Framework\TestCase
self::assertEquals('txt', FtpStorage::extension($testFile));
self::assertEquals('test', FtpStorage::name($testFile));
self::assertEquals('test.txt', FtpStorage::basename($testFile));
- self::assertEquals(basename(realpath(self::BASE)), FtpStorage::dirname($testFile));
- self::assertEquals(realpath(self::BASE), FtpStorage::dirpath($testFile));
+ self::assertEquals(\basename(\realpath(self::BASE)), FtpStorage::dirname($testFile));
+ self::assertEquals(\realpath(self::BASE), FtpStorage::dirpath($testFile));
self::assertEquals(1, FtpStorage::count($testFile));
$now = new \DateTime('now');
@@ -138,7 +138,7 @@ class FtpStorageTest extends \PHPUnit\Framework\TestCase
self::assertEquals(4, FtpStorage::count($dirTestPath));
self::assertEquals(1, FtpStorage::count($dirTestPath, false));
- self::assertEquals(6, count(FtpStorage::list($dirTestPath)));
+ self::assertEquals(6, \count(FtpStorage::list($dirTestPath)));
}
/**
diff --git a/tests/System/File/Local/DirectoryTest.php b/tests/System/File/Local/DirectoryTest.php
index 9728b1210..4ef0c7676 100644
--- a/tests/System/File/Local/DirectoryTest.php
+++ b/tests/System/File/Local/DirectoryTest.php
@@ -63,8 +63,8 @@ class DirectoryTest extends \PHPUnit\Framework\TestCase
self::assertEquals(4, Directory::count($dirTestPath));
self::assertEquals(1, Directory::count($dirTestPath, false));
- self::assertEquals(6, count(Directory::list($dirTestPath)));
- self::assertEquals(3, count(Directory::listByExtension($dirTestPath, 'txt')));
+ self::assertEquals(6, \count(Directory::list($dirTestPath)));
+ self::assertEquals(3, \count(Directory::listByExtension($dirTestPath, 'txt')));
}
/**
diff --git a/tests/System/File/Local/FileTest.php b/tests/System/File/Local/FileTest.php
index a834ed91d..3f19b827f 100644
--- a/tests/System/File/Local/FileTest.php
+++ b/tests/System/File/Local/FileTest.php
@@ -41,8 +41,8 @@ class FileTest extends \PHPUnit\Framework\TestCase
self::assertEquals('txt', File::extension($testFile));
self::assertEquals('test', File::name($testFile));
self::assertEquals('test.txt', File::basename($testFile));
- self::assertEquals(basename(realpath(__DIR__)), File::dirname($testFile));
- self::assertEquals(realpath(__DIR__), File::dirpath($testFile));
+ self::assertEquals(\basename(\realpath(__DIR__)), File::dirname($testFile));
+ self::assertEquals(\realpath(__DIR__), File::dirpath($testFile));
self::assertEquals(1, File::count($testFile));
$now = new \DateTime('now');
diff --git a/tests/System/File/Local/LocalStorageTest.php b/tests/System/File/Local/LocalStorageTest.php
index 37b4a37ca..6d8e33cee 100644
--- a/tests/System/File/Local/LocalStorageTest.php
+++ b/tests/System/File/Local/LocalStorageTest.php
@@ -41,8 +41,8 @@ class LocalStorageTest extends \PHPUnit\Framework\TestCase
self::assertEquals('txt', LocalStorage::extension($testFile));
self::assertEquals('test', LocalStorage::name($testFile));
self::assertEquals('test.txt', LocalStorage::basename($testFile));
- self::assertEquals(basename(realpath(__DIR__)), LocalStorage::dirname($testFile));
- self::assertEquals(realpath(__DIR__), LocalStorage::dirpath($testFile));
+ self::assertEquals(\basename(\realpath(__DIR__)), LocalStorage::dirname($testFile));
+ self::assertEquals(\realpath(__DIR__), LocalStorage::dirpath($testFile));
self::assertEquals(1, LocalStorage::count($testFile));
$now = new \DateTime('now');
@@ -123,7 +123,7 @@ class LocalStorageTest extends \PHPUnit\Framework\TestCase
self::assertEquals(4, LocalStorage::count($dirTestPath));
self::assertEquals(1, LocalStorage::count($dirTestPath, false));
- self::assertEquals(6, count(LocalStorage::list($dirTestPath)));
+ self::assertEquals(6, \count(LocalStorage::list($dirTestPath)));
}
/**
diff --git a/tests/System/MimeTypeTest.php b/tests/System/MimeTypeTest.php
index 91de41d2b..44baf7827 100644
--- a/tests/System/MimeTypeTest.php
+++ b/tests/System/MimeTypeTest.php
@@ -24,7 +24,7 @@ class MimeTypeTest extends \PHPUnit\Framework\TestCase
$enums = MimeType::getConstants();
foreach ($enums as $key => $value) {
- if (stripos($value, '/') === false) {
+ if (\stripos($value, '/') === false) {
self::assertFalse(true);
}
}
diff --git a/tests/System/SystemTypeTest.php b/tests/System/SystemTypeTest.php
index 1d8600310..d30b38f0c 100644
--- a/tests/System/SystemTypeTest.php
+++ b/tests/System/SystemTypeTest.php
@@ -21,7 +21,7 @@ class SystemTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(4, count(SystemType::getConstants()));
+ self::assertEquals(4, \count(SystemType::getConstants()));
self::assertEquals(1, SystemType::UNKNOWN);
self::assertEquals(2, SystemType::WIN);
self::assertEquals(3, SystemType::LINUX);
diff --git a/tests/System/SystemUtilsTest.php b/tests/System/SystemUtilsTest.php
index 8059bf804..859957230 100644
--- a/tests/System/SystemUtilsTest.php
+++ b/tests/System/SystemUtilsTest.php
@@ -24,7 +24,7 @@ class SystemUtilsTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThan(0, SystemUtils::getRAM());
self::assertGreaterThan(0, SystemUtils::getCpuUsage());
- if (stristr(PHP_OS, 'WIN')) {
+ if (\stristr(PHP_OS, 'WIN')) {
self::assertEquals(0, SystemUtils::getRAMUsage());
}
diff --git a/tests/Uri/UriSchemeTest.php b/tests/Uri/UriSchemeTest.php
index e188dc03e..6e65809cc 100644
--- a/tests/Uri/UriSchemeTest.php
+++ b/tests/Uri/UriSchemeTest.php
@@ -21,26 +21,26 @@ class UriSchemeTest extends \PHPUnit\Framework\TestCase
{
public function testEnum()
{
- self::assertTrue(defined('phpOMS\Uri\UriScheme::HTTP'));
- self::assertTrue(defined('phpOMS\Uri\UriScheme::FILE'));
- self::assertTrue(defined('phpOMS\Uri\UriScheme::MAILTO'));
- self::assertTrue(defined('phpOMS\Uri\UriScheme::FTP'));
- self::assertTrue(defined('phpOMS\Uri\UriScheme::HTTPS'));
- self::assertTrue(defined('phpOMS\Uri\UriScheme::IRC'));
- self::assertTrue(defined('phpOMS\Uri\UriScheme::TEL'));
- self::assertTrue(defined('phpOMS\Uri\UriScheme::TELNET'));
- self::assertTrue(defined('phpOMS\Uri\UriScheme::SSH'));
- self::assertTrue(defined('phpOMS\Uri\UriScheme::SKYPE'));
- self::assertTrue(defined('phpOMS\Uri\UriScheme::SSL'));
- self::assertTrue(defined('phpOMS\Uri\UriScheme::NFS'));
- self::assertTrue(defined('phpOMS\Uri\UriScheme::GEO'));
- self::assertTrue(defined('phpOMS\Uri\UriScheme::MARKET'));
- self::assertTrue(defined('phpOMS\Uri\UriScheme::ITMS'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::HTTP'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::FILE'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::MAILTO'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::FTP'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::HTTPS'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::IRC'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::TEL'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::TELNET'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::SSH'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::SKYPE'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::SSL'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::NFS'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::GEO'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::MARKET'));
+ self::assertTrue(\defined('phpOMS\Uri\UriScheme::ITMS'));
}
public function testEnumUnique()
{
$values = UriScheme::getConstants();
- self::assertEquals(count($values), array_sum(array_count_values($values)));
+ self::assertEquals(\count($values), array_sum(array_count_values($values)));
}
}
diff --git a/tests/Utils/ArrayUtilsTest.php b/tests/Utils/ArrayUtilsTest.php
index bd1e59a06..8db395924 100644
--- a/tests/Utils/ArrayUtilsTest.php
+++ b/tests/Utils/ArrayUtilsTest.php
@@ -127,7 +127,7 @@ class ArrayUtilsTest extends \PHPUnit\Framework\TestCase
if (ArrayUtils::getArg('--configuration', $_SERVER['argv']) !== null) {
self::assertGreaterThan(0, ArrayUtils::hasArg('--configuration', $_SERVER['argv']));
- self::assertTrue(stripos(ArrayUtils::getArg('--configuration', $_SERVER['argv']), '.xml') !== false);
+ self::assertTrue(\stripos(ArrayUtils::getArg('--configuration', $_SERVER['argv']), '.xml') !== false);
}
}
}
diff --git a/tests/Utils/Barcode/OrientationTypeTest.php b/tests/Utils/Barcode/OrientationTypeTest.php
index 3d35d0b74..89172969f 100644
--- a/tests/Utils/Barcode/OrientationTypeTest.php
+++ b/tests/Utils/Barcode/OrientationTypeTest.php
@@ -19,7 +19,7 @@ class OrientationTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(2, count(OrientationType::getConstants()));
+ self::assertEquals(2, \count(OrientationType::getConstants()));
self::assertEquals(OrientationType::getConstants(), array_unique(OrientationType::getConstants()));
self::assertEquals(0, OrientationType::HORIZONTAL);
diff --git a/tests/Utils/Converter/AngleTypeTest.php b/tests/Utils/Converter/AngleTypeTest.php
index 3cad497f3..4d0f6b948 100644
--- a/tests/Utils/Converter/AngleTypeTest.php
+++ b/tests/Utils/Converter/AngleTypeTest.php
@@ -19,7 +19,7 @@ class AngleTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(10, count(AngleType::getConstants()));
+ self::assertEquals(10, \count(AngleType::getConstants()));
self::assertEquals(AngleType::getConstants(), array_unique(AngleType::getConstants()));
self::assertEquals('deg', AngleType::DEGREE);
diff --git a/tests/Utils/Converter/AreaTypeTest.php b/tests/Utils/Converter/AreaTypeTest.php
index aca9f3bab..5f56ff887 100644
--- a/tests/Utils/Converter/AreaTypeTest.php
+++ b/tests/Utils/Converter/AreaTypeTest.php
@@ -19,7 +19,7 @@ class AreaTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(13, count(AreaType::getConstants()));
+ self::assertEquals(13, \count(AreaType::getConstants()));
self::assertEquals(AreaType::getConstants(), array_unique(AreaType::getConstants()));
self::assertEquals('ft', AreaType::SQUARE_FEET);
diff --git a/tests/Utils/Converter/EnergyPowerTypeTest.php b/tests/Utils/Converter/EnergyPowerTypeTest.php
index f4a93a04b..202e9bcf1 100644
--- a/tests/Utils/Converter/EnergyPowerTypeTest.php
+++ b/tests/Utils/Converter/EnergyPowerTypeTest.php
@@ -19,7 +19,7 @@ class EnergyPowerTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(9, count(EnergyPowerType::getConstants()));
+ self::assertEquals(9, \count(EnergyPowerType::getConstants()));
self::assertEquals(EnergyPowerType::getConstants(), array_unique(EnergyPowerType::getConstants()));
self::assertEquals('kWh', EnergyPowerType::KILOWATT_HOUERS);
diff --git a/tests/Utils/Converter/FileSizeTypeTest.php b/tests/Utils/Converter/FileSizeTypeTest.php
index e09ea660e..460d75bfd 100644
--- a/tests/Utils/Converter/FileSizeTypeTest.php
+++ b/tests/Utils/Converter/FileSizeTypeTest.php
@@ -19,7 +19,7 @@ class FileSizeTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(10, count(FileSizeType::getConstants()));
+ self::assertEquals(10, \count(FileSizeType::getConstants()));
self::assertEquals('TB', FileSizeType::TERRABYTE);
self::assertEquals('GB', FileSizeType::GIGABYTE);
self::assertEquals('MB', FileSizeType::MEGABYTE);
diff --git a/tests/Utils/Converter/IpTest.php b/tests/Utils/Converter/IpTest.php
index 0756091f7..fa43a2f9b 100644
--- a/tests/Utils/Converter/IpTest.php
+++ b/tests/Utils/Converter/IpTest.php
@@ -19,6 +19,6 @@ class IpTest extends \PHPUnit\Framework\TestCase
{
public function testIp()
{
- self::assertTrue(abs(1527532998.0 - Ip::ip2Float('91.12.77.198')) < 1);
+ self::assertTrue(\abs(1527532998.0 - Ip::ip2Float('91.12.77.198')) < 1);
}
}
diff --git a/tests/Utils/Converter/LengthTypeTest.php b/tests/Utils/Converter/LengthTypeTest.php
index 8a4561861..b16ce6d86 100644
--- a/tests/Utils/Converter/LengthTypeTest.php
+++ b/tests/Utils/Converter/LengthTypeTest.php
@@ -19,7 +19,7 @@ class LengthTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(21, count(LengthType::getConstants()));
+ self::assertEquals(21, \count(LengthType::getConstants()));
self::assertEquals(LengthType::getConstants(), array_unique(LengthType::getConstants()));
self::assertEquals('mi', LengthType::MILES);
diff --git a/tests/Utils/Converter/PressureTypeTest.php b/tests/Utils/Converter/PressureTypeTest.php
index 88f69e023..c81ae9d32 100644
--- a/tests/Utils/Converter/PressureTypeTest.php
+++ b/tests/Utils/Converter/PressureTypeTest.php
@@ -19,7 +19,7 @@ class PressureTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(13, count(PressureType::getConstants()));
+ self::assertEquals(13, \count(PressureType::getConstants()));
self::assertEquals(PressureType::getConstants(), array_unique(PressureType::getConstants()));
self::assertEquals('Pa', PressureType::PASCALS);
diff --git a/tests/Utils/Converter/SpeedTypeTest.php b/tests/Utils/Converter/SpeedTypeTest.php
index 713ceb3be..898760b90 100644
--- a/tests/Utils/Converter/SpeedTypeTest.php
+++ b/tests/Utils/Converter/SpeedTypeTest.php
@@ -19,7 +19,7 @@ class SpeedTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(34, count(SpeedType::getConstants()));
+ self::assertEquals(34, \count(SpeedType::getConstants()));
self::assertEquals(SpeedType::getConstants(), array_unique(SpeedType::getConstants()));
self::assertEquals('mpd', SpeedType::MILES_PER_DAY);
diff --git a/tests/Utils/Converter/TemperatureTypeTest.php b/tests/Utils/Converter/TemperatureTypeTest.php
index 51061d7aa..c35389c42 100644
--- a/tests/Utils/Converter/TemperatureTypeTest.php
+++ b/tests/Utils/Converter/TemperatureTypeTest.php
@@ -19,7 +19,7 @@ class TemperatureTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(8, count(TemperatureType::getConstants()));
+ self::assertEquals(8, \count(TemperatureType::getConstants()));
self::assertEquals(TemperatureType::getConstants(), array_unique(TemperatureType::getConstants()));
self::assertEquals('celsius', TemperatureType::CELSIUS);
diff --git a/tests/Utils/Converter/TimeTypeTest.php b/tests/Utils/Converter/TimeTypeTest.php
index f043d717c..f8dc938fc 100644
--- a/tests/Utils/Converter/TimeTypeTest.php
+++ b/tests/Utils/Converter/TimeTypeTest.php
@@ -19,7 +19,7 @@ class TimeTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(9, count(TimeType::getConstants()));
+ self::assertEquals(9, \count(TimeType::getConstants()));
self::assertEquals(TimeType::getConstants(), array_unique(TimeType::getConstants()));
self::assertEquals('ms', TimeType::MILLISECONDS);
diff --git a/tests/Utils/Converter/VolumeTypeTest.php b/tests/Utils/Converter/VolumeTypeTest.php
index 11a9e1ac5..62cb5d63d 100644
--- a/tests/Utils/Converter/VolumeTypeTest.php
+++ b/tests/Utils/Converter/VolumeTypeTest.php
@@ -19,7 +19,7 @@ class VolumeTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(38, count(VolumeType::getConstants()));
+ self::assertEquals(38, \count(VolumeType::getConstants()));
self::assertEquals(VolumeType::getConstants(), array_unique(VolumeType::getConstants()));
self::assertEquals('UK gal', VolumeType::UK_GALLON);
diff --git a/tests/Utils/Converter/WeightTypeTest.php b/tests/Utils/Converter/WeightTypeTest.php
index 248c12a55..485d12f53 100644
--- a/tests/Utils/Converter/WeightTypeTest.php
+++ b/tests/Utils/Converter/WeightTypeTest.php
@@ -19,7 +19,7 @@ class WeightTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(14, count(WeightType::getConstants()));
+ self::assertEquals(14, \count(WeightType::getConstants()));
self::assertEquals(WeightType::getConstants(), array_unique(WeightType::getConstants()));
self::assertEquals('mg', WeightType::MICROGRAM);
diff --git a/tests/Utils/Git/CommitTest.php b/tests/Utils/Git/CommitTest.php
index 689531b6a..8f975b6be 100644
--- a/tests/Utils/Git/CommitTest.php
+++ b/tests/Utils/Git/CommitTest.php
@@ -97,7 +97,7 @@ class CommitTest extends \PHPUnit\Framework\TestCase
{
$commit = new Commit();
- $commit->setRepository(new Repository(realpath(__DIR__ . '/../../../')));
- self::assertEquals(realpath(__DIR__ . '/../../../'), $commit->getRepository()->getPath());
+ $commit->setRepository(new Repository(\realpath(__DIR__ . '/../../../')));
+ self::assertEquals(\realpath(__DIR__ . '/../../../'), $commit->getRepository()->getPath());
}
}
diff --git a/tests/Utils/Git/RepositoryTest.php b/tests/Utils/Git/RepositoryTest.php
index fe9f2e9a4..cc3afb32c 100644
--- a/tests/Utils/Git/RepositoryTest.php
+++ b/tests/Utils/Git/RepositoryTest.php
@@ -19,9 +19,9 @@ class RepositoryTest extends \PHPUnit\Framework\TestCase
{
public function testDefault()
{
- $repo = new Repository(realpath(__DIR__ . '/../../../'));
+ $repo = new Repository(\realpath(__DIR__ . '/../../../'));
self::assertTrue('phpOMS' === $repo->getName() || 'build' === $repo->getName());
self::assertEquals(\str_replace('\\', '/', realpath(__DIR__ . '/../../../.git')), \str_replace('\\', '/', $repo->getDirectoryPath()));
- self::assertEquals(realpath(__DIR__ . '/../../../'), $repo->getPath());
+ self::assertEquals(\realpath(__DIR__ . '/../../../'), $repo->getPath());
}
}
diff --git a/tests/Utils/RnG/DistributionTypeTest.php b/tests/Utils/RnG/DistributionTypeTest.php
index d4cb00def..d0390fbba 100644
--- a/tests/Utils/RnG/DistributionTypeTest.php
+++ b/tests/Utils/RnG/DistributionTypeTest.php
@@ -19,7 +19,7 @@ class DistributionTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(2, count(DistributionType::getConstants()));
+ self::assertEquals(2, \count(DistributionType::getConstants()));
self::assertEquals(DistributionType::getConstants(), array_unique(DistributionType::getConstants()));
self::assertEquals(0, DistributionType::UNIFORM);
diff --git a/tests/Utils/RnG/StringUtilsTest.php b/tests/Utils/RnG/StringUtilsTest.php
index ff5b0c8f6..86dc12597 100644
--- a/tests/Utils/RnG/StringUtilsTest.php
+++ b/tests/Utils/RnG/StringUtilsTest.php
@@ -29,7 +29,7 @@ class StringUtilsTest extends \PHPUnit\Framework\TestCase
for ($i = 0; $i < 10000; ++$i) {
$random = StringUtils::generateString(5, 12, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_?><|;"');
- if (strlen($random) > 12 || strlen($random) < 5) {
+ if (\strlen($random) > 12 || \strlen($random) < 5) {
$outOfBounds = true;
}
diff --git a/tests/Utils/StringUtilsTest.php b/tests/Utils/StringUtilsTest.php
index d1471bb44..c62f62af1 100644
--- a/tests/Utils/StringUtilsTest.php
+++ b/tests/Utils/StringUtilsTest.php
@@ -21,7 +21,7 @@ class StringUtilsTest extends \PHPUnit\Framework\TestCase
{
public function testEvaluation()
{
- self::assertTrue(abs(2.5 - StringUtils::getEntropy('akj@!0aj')) < 0.1);
+ self::assertTrue(\abs(2.5 - StringUtils::getEntropy('akj@!0aj')) < 0.1);
}
public function testStartsEnds()
diff --git a/tests/Validation/Finance/IbanEnumTest.php b/tests/Validation/Finance/IbanEnumTest.php
index e5a1f697b..3f52edcb7 100644
--- a/tests/Validation/Finance/IbanEnumTest.php
+++ b/tests/Validation/Finance/IbanEnumTest.php
@@ -23,7 +23,7 @@ class IbanEnumTest extends \PHPUnit\Framework\TestCase
$ok = true;
foreach ($enums as $enum) {
- $temp = substr($enum, 2);
+ $temp = \substr($enum, 2);
if (\preg_match('/[^kbsxcinm0at\ ]/', $temp) === 1) {
$ok = false;
diff --git a/tests/Validation/Finance/IbanErrorTypeTest.php b/tests/Validation/Finance/IbanErrorTypeTest.php
index c14209ab0..b411356be 100644
--- a/tests/Validation/Finance/IbanErrorTypeTest.php
+++ b/tests/Validation/Finance/IbanErrorTypeTest.php
@@ -19,7 +19,7 @@ class IbanErrorTypeTest extends \PHPUnit\Framework\TestCase
{
public function testEnums()
{
- self::assertEquals(5, count(IbanErrorType::getConstants()));
+ self::assertEquals(5, \count(IbanErrorType::getConstants()));
self::assertEquals(1, IbanErrorType::INVALID_COUNTRY);
self::assertEquals(2, IbanErrorType::INVALID_LENGTH);
self::assertEquals(4, IbanErrorType::INVALID_CHECKSUM);
diff --git a/tests/Views/ViewTest.php b/tests/Views/ViewTest.php
index d0a5319c1..cba8d4eb4 100644
--- a/tests/Views/ViewTest.php
+++ b/tests/Views/ViewTest.php
@@ -102,7 +102,7 @@ class ViewTest extends \PHPUnit\Framework\TestCase
$tView = new View($this->app, $request, $response);
self::assertTrue($view->addView('test', $tView));
self::assertEquals($tView, $view->getView('test'));
- self::assertEquals(1, count($view->getViews()));
+ self::assertEquals(1, \count($view->getViews()));
self::assertTrue($view->removeView('test'));
self::assertFalse($view->removeView('test'));
self::assertFalse($view->getView('test'));