diff --git a/Algorithm/CoinMatching/MinimumCoinProblem.php b/Algorithm/CoinMatching/MinimumCoinProblem.php index 645e3dd88..5f439fb3b 100644 --- a/Algorithm/CoinMatching/MinimumCoinProblem.php +++ b/Algorithm/CoinMatching/MinimumCoinProblem.php @@ -22,28 +22,32 @@ namespace phpOMS\Algorithm\CoinMatching; * @link https://orange-management.org * @since 1.0.0 */ -class MinimumCoinProblem +final class MinimumCoinProblem { - private function __construct() - { + /** + * Constructure + * + * @since 1.0.0 + */ + private function __construct() + { + } - } - - /** - * Find the minimum amount of coins that are required to match a value - * - * @param array $coins Types of coins available (every coin has infinite availablity) - * @param int $value Value to match with the coins - * - * @return array - * - * @since 1.0.0 - */ + /** + * Find the minimum amount of coins that are required to match a value + * + * @param array $coins Types of coins available (every coin has infinite availablity) + * @param int $value Value to match with the coins + * + * @return array + * + * @since 1.0.0 + */ public static function getMinimumCoinsForValueI(array $coins, int $value) : array { // amount of required coins for different values - $table = [0]; - $usedCoins = []; + $table = [0]; + $usedCoins = []; for ($i = 1; $i <= $value; ++$i) { $table[$i] = \PHP_INT_MAX; @@ -67,5 +71,5 @@ class MinimumCoinProblem } return $usedCoins[$value] ?? []; - } + } } diff --git a/Algorithm/PathFinding/AStar.php b/Algorithm/PathFinding/AStar.php index 9da7b39bd..64b898053 100644 --- a/Algorithm/PathFinding/AStar.php +++ b/Algorithm/PathFinding/AStar.php @@ -66,7 +66,7 @@ class JumpPointSearch implements PathFinderInterface if (!$neighbor->isOpened() || $ng < $neighbor->getG()) { $neighbor->setG($ng); - $neighbor->setH($neighbor->getG() ?? $neighbor->getWeight() * Heuristic::heuristic($neighbor->getCoordinates(), $endNode->getCoordinates(), $heuristic)); + $neighbor->setH($neighbor->getG() ?? $neighbor->getWeight() * Heuristic::metric($neighbor->getCoordinates(), $endNode->getCoordinates(), $heuristic)); $neighbor->setF($neighbor->getG() + $neighbor->getH()); $neighbor->setParent($node); diff --git a/Algorithm/PathFinding/Heuristic.php b/Algorithm/PathFinding/Heuristic.php index e70eb42ce..3ce2fe7a0 100644 --- a/Algorithm/PathFinding/Heuristic.php +++ b/Algorithm/PathFinding/Heuristic.php @@ -26,7 +26,7 @@ use phpOMS\Math\Topology\Metrics2D; */ class Heuristic { - public static function heuristic(array $node1, array $node2, int $heuristic) : float + public static function metric(array $node1, array $node2, int $heuristic) : float { if ($heuristic === HeuristicType::MANHATTAN) { return Metrics2D::manhattan($node1, $node2); diff --git a/Algorithm/PathFinding/JumpPointSearch.php b/Algorithm/PathFinding/JumpPointSearch.php index 771a59175..88c7792fa 100644 --- a/Algorithm/PathFinding/JumpPointSearch.php +++ b/Algorithm/PathFinding/JumpPointSearch.php @@ -79,12 +79,12 @@ class JumpPointSearch implements PathFinderInterface continue; } - $d = Heuristic::heuristic($node->getCoordinates(), $jumpPoint->getCoordinates(), HeuristicType::OCTILE); + $d = Heuristic::metric($node->getCoordinates(), $jumpPoint->getCoordinates(), HeuristicType::OCTILE); $ng = $node->getG() + $d; if (!$jumpPoint->isOpened() || $ng < $jumpPoint->getG()) { $jumpPoint->setG($ng); - $jumpPoint->setH($jumpPoint->getH() ?? Heuristic::heuristic($jumpPoint->getCoordinates(), $endNode->getCoordinates(), $heuristic)); + $jumpPoint->setH($jumpPoint->getH() ?? Heuristic::metric($jumpPoint->getCoordinates(), $endNode->getCoordinates(), $metric)); $jumpPoint->setF($jumpPoint->getG() + $jumpPoint->getH()); $jumpPoint->setParent($node); diff --git a/Algorithm/Sort/BitonicSort.php b/Algorithm/Sort/BitonicSort.php index a5803a59c..1f57ee36a 100644 --- a/Algorithm/Sort/BitonicSort.php +++ b/Algorithm/Sort/BitonicSort.php @@ -24,6 +24,9 @@ namespace phpOMS\Algorithm\Sort; */ class BitonicSort implements SortInterface { + /** + * {@inheritdoc} + */ public static function sort(array $list, int $order = SortOrder::ASC) : array { $n = \count($list); @@ -38,7 +41,7 @@ class BitonicSort implements SortInterface return self::merge(\array_merge($first, $second), $order); } - public static function merge(array $list, int $order) : array + private static function merge(array $list, int $order) : array { $n = \count($list); diff --git a/Algorithm/Sort/BubbleSort.php b/Algorithm/Sort/BubbleSort.php index 261ccef1b..400eaa34c 100644 --- a/Algorithm/Sort/BubbleSort.php +++ b/Algorithm/Sort/BubbleSort.php @@ -24,6 +24,9 @@ namespace phpOMS\Algorithm\Sort; */ class BubbleSort implements SortInterface { + /** + * {@inheritdoc} + */ public static function sort(array $list, int $order = SortOrder::ASC) : array { $n = \count($list); diff --git a/Algorithm/Sort/BucketSort.php b/Algorithm/Sort/BucketSort.php index 422edfb44..0fe2d861d 100644 --- a/Algorithm/Sort/BucketSort.php +++ b/Algorithm/Sort/BucketSort.php @@ -24,6 +24,18 @@ namespace phpOMS\Algorithm\Sort; */ class BucketSort { + /** + * Sort array + * + * @param array $list List of sortable elements + * @param int $bucketCount Buckets to divide the list into + * @param string $algo Algorithm to use for sort + * @param int $order Sort order + * + * @return array Sorted array + * + * @since 1.0.0 + */ public static function sort(array $list, int $bucketCount, string $algo = InsertionSort::class, int $order = SortOrder::ASC) : array { $buckets = []; diff --git a/Algorithm/Sort/CocktailShakerSort.php b/Algorithm/Sort/CocktailShakerSort.php index e29c663db..1ec833aec 100644 --- a/Algorithm/Sort/CocktailShakerSort.php +++ b/Algorithm/Sort/CocktailShakerSort.php @@ -24,6 +24,9 @@ namespace phpOMS\Algorithm\Sort; */ class CocktailShakerSort implements SortInterface { + /** + * {@inheritdoc} + */ public static function sort(array $list, int $order = SortOrder::ASC) : array { $start = 0; diff --git a/Algorithm/Sort/CombSort.php b/Algorithm/Sort/CombSort.php index 2ff687797..e2dc9b1d5 100644 --- a/Algorithm/Sort/CombSort.php +++ b/Algorithm/Sort/CombSort.php @@ -24,6 +24,9 @@ namespace phpOMS\Algorithm\Sort; */ class CombSort implements SortInterface { + /** + * {@inheritdoc} + */ public static function sort(array $list, int $order = SortOrder::ASC) : array { $sorted = false; diff --git a/Algorithm/Sort/CycleSort.php b/Algorithm/Sort/CycleSort.php index e6817e036..781613479 100644 --- a/Algorithm/Sort/CycleSort.php +++ b/Algorithm/Sort/CycleSort.php @@ -24,6 +24,9 @@ namespace phpOMS\Algorithm\Sort; */ class CycleSort implements SortInterface { + /** + * {@inheritdoc} + */ public static function sort(array $list, int $order = SortOrder::ASC) : array { $writes = 0; diff --git a/Algorithm/Sort/FlashSort.php b/Algorithm/Sort/FlashSort.php index 983f50cf8..3411218ef 100644 --- a/Algorithm/Sort/FlashSort.php +++ b/Algorithm/Sort/FlashSort.php @@ -24,6 +24,9 @@ namespace phpOMS\Algorithm\Sort; */ class FlashSort implements SortInterface { + /** + * {@inheritdoc} + */ public static function sort(array $list, int $order = SortOrder::ASC) : array { $n = \count($list); diff --git a/Algorithm/Sort/GnomeSort.php b/Algorithm/Sort/GnomeSort.php index 98f3b223d..18f9a21b0 100644 --- a/Algorithm/Sort/GnomeSort.php +++ b/Algorithm/Sort/GnomeSort.php @@ -24,6 +24,9 @@ namespace phpOMS\Algorithm\Sort; */ class GnomeSort implements SortInterface { + /** + * {@inheritdoc} + */ public static function sort(array $list, int $order = SortOrder::ASC) : array { $n = \count($list); diff --git a/Algorithm/Sort/OddEvenSort.php b/Algorithm/Sort/OddEvenSort.php index 8f34f96d2..da6566fc2 100644 --- a/Algorithm/Sort/OddEvenSort.php +++ b/Algorithm/Sort/OddEvenSort.php @@ -24,6 +24,9 @@ namespace phpOMS\Algorithm\Sort; */ class OddEvenSort implements SortInterface { + /** + * {@inheritdoc} + */ public static function sort(array $list, int $order = SortOrder::ASC) : array { $sorted = false; diff --git a/Algorithm/Sort/QuickSort.php b/Algorithm/Sort/QuickSort.php index 3a80d56c4..72fd65583 100644 --- a/Algorithm/Sort/QuickSort.php +++ b/Algorithm/Sort/QuickSort.php @@ -24,6 +24,9 @@ namespace phpOMS\Algorithm\Sort; */ class QuickSort implements SortInterface { + /** + * {@inheritdoc} + */ public static function sort(array $list, int $order = SortOrder::ASC) : array { $copy = $list; diff --git a/Algorithm/Sort/SelectionSort.php b/Algorithm/Sort/SelectionSort.php index f610de56a..1dfa2403d 100644 --- a/Algorithm/Sort/SelectionSort.php +++ b/Algorithm/Sort/SelectionSort.php @@ -24,6 +24,9 @@ namespace phpOMS\Algorithm\Sort; */ class SelectionSort implements SortInterface { + /** + * {@inheritdoc} + */ public static function sort(array $list, int $order = SortOrder::ASC) : array { $n = \count($list); diff --git a/Algorithm/Sort/SortInterface.php b/Algorithm/Sort/SortInterface.php index 06c5a3386..8bbd05718 100644 --- a/Algorithm/Sort/SortInterface.php +++ b/Algorithm/Sort/SortInterface.php @@ -24,5 +24,15 @@ namespace phpOMS\Algorithm\Sort; */ interface SortInterface { + /** + * Sort array + * + * @param array $list List of sortable elements + * @param int $order Sort order + * + * @return array Sorted array + * + * @since 1.0.0 + */ public static function sort(array $list, int $order = SortOrder::ASC) : array; } diff --git a/Algorithm/Sort/SortableInterface.php b/Algorithm/Sort/SortableInterface.php index 7afa1b6d3..a4530ccdf 100644 --- a/Algorithm/Sort/SortableInterface.php +++ b/Algorithm/Sort/SortableInterface.php @@ -24,11 +24,46 @@ namespace phpOMS\Algorithm\Sort; */ interface SortableInterface { + /** + * Compare current object with other object + * + * @param SortableInterface $obj Object to compare with + * @param int $order Sort order + * + * @return bool + * + * @since 1.0.0 + */ public function compare(self $obj, int $order = SortOrder::ASC) : bool; + /** + * Get element value + * + * @return mixed + * + * @since 1.0.0 + */ public function getValue(); + /** + * Get maximum element + * + * @param SortableInterface[] $list List to order + * + * @return mixed + * + * @since 1.0.0 + */ public static function max(array $list); + /** + * Get minimum element + * + * @param SortableInterface[] $list List to order + * + * @return mixed + * + * @since 1.0.0 + */ public static function min(array $list); } diff --git a/Business/Marketing/Metrics.php b/Business/Marketing/Metrics.php index 480d1f44a..a2c763b8a 100644 --- a/Business/Marketing/Metrics.php +++ b/Business/Marketing/Metrics.php @@ -26,6 +26,15 @@ namespace phpOMS\Business\Marketing; */ final class Metrics { + /** + * Constructure + * + * @since 1.0.0 + */ + private function __construct() + { + } + /** * Calculate customer retention * diff --git a/Business/Programming/Metrics.php b/Business/Programming/Metrics.php index 307e110e6..d984481f9 100644 --- a/Business/Programming/Metrics.php +++ b/Business/Programming/Metrics.php @@ -26,6 +26,15 @@ namespace phpOMS\Business\Programming; */ final class Metrics { + /** + * Constructure + * + * @since 1.0.0 + */ + private function __construct() + { + } + /** * Calculate ABC metric score * diff --git a/Business/Sales/MarketShareEstimation.php b/Business/Sales/MarketShareEstimation.php index 355d51fac..0892aa4ce 100644 --- a/Business/Sales/MarketShareEstimation.php +++ b/Business/Sales/MarketShareEstimation.php @@ -27,6 +27,15 @@ namespace phpOMS\Business\Sales; */ final class MarketShareEstimation { + /** + * Constructure + * + * @since 1.0.0 + */ + private function __construct() + { + } + /** * Calculate rank (r) based on market share (m) * diff --git a/Dispatcher/DispatcherInterface.php b/Dispatcher/DispatcherInterface.php index 4593e881b..cb36799d3 100644 --- a/Dispatcher/DispatcherInterface.php +++ b/Dispatcher/DispatcherInterface.php @@ -14,6 +14,14 @@ declare(strict_types=1); namespace phpOMS\Dispatcher; +/** + * Dispatcher interface + * + * @package phpOMS\Dispatcher + * @license OMS License 1.0 + * @link https://orange-management.org + * @since 1.0.0 + */ interface DispatcherInterface { /** diff --git a/Utils/NumericUtils.php b/Utils/NumericUtils.php index ea7025813..5565ed17e 100644 --- a/Utils/NumericUtils.php +++ b/Utils/NumericUtils.php @@ -35,6 +35,16 @@ final class NumericUtils { } + /** + * Unsigned right shift + * + * @param int $a Value to shift + * @param int $b Shift by + * + * @return int unsigned int + * + * @since 1.0.0 + */ public static function uRightShift(int $a, int $b) : int { if ($b === 0) { diff --git a/Views/PaginationView.php b/Views/PaginationView.php index 35ed994ad..7f25d4df5 100644 --- a/Views/PaginationView.php +++ b/Views/PaginationView.php @@ -1,4 +1,4 @@ -