diff --git a/Ai/NeuralNetwork/Neuron.php b/Ai/NeuralNetwork/Neuron.php index 7769e4f4b..bdb5aa566 100755 --- a/Ai/NeuralNetwork/Neuron.php +++ b/Ai/NeuralNetwork/Neuron.php @@ -22,7 +22,7 @@ namespace phpOMS\Ai\NeuralNetwork; * @link https://jingga.app * @since 1.0.0 */ -class Neuron +final class Neuron { /** * Neuron inputs diff --git a/Image/Kernel.php b/Image/Kernel.php index 5a50da54d..a2eb1cf39 100755 --- a/Image/Kernel.php +++ b/Image/Kernel.php @@ -26,54 +26,116 @@ use phpOMS\Utils\NumericUtils; */ final class Kernel { + /** + * Kernel matrix for ridge + * + * @var array + * @since 1.0.0 + */ public const KERNEL_RIDGE_1 = [ [0, -1, 0], [-1, 4, -1], [0, -1, 0], ]; + /** + * Kernel matrix for ridge + * + * @var array + * @since 1.0.0 + */ public const KERNEL_RIDGE_2 = [ [-1, -1, -1], [-1, 8, -1], [-1, -1, -1], ]; + /** + * Kernel matrix for sharpening + * + * @var array + * @since 1.0.0 + */ public const KERNEL_SHARPEN = [ [0, -1, 0], [-1, 5, -1], [0, -1, 0], ]; + /** + * Kernel matrix for blurring + * + * @var array + * @since 1.0.0 + */ public const KERNEL_BOX_BLUR = [ [1 / 9, 1 / 9, 1 / 9], [1 / 9, 1 / 9, 1 / 9], [1 / 9, 1 / 9, 1 / 9], ]; + /** + * Kernel matrix for gaussian blurring + * + * @var array + * @since 1.0.0 + */ public const KERNEL_GAUSSUAN_BLUR_3 = [ [1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16], ]; + /** + * Kernel matrix for embossing + * + * @var array + * @since 1.0.0 + */ public const KERNEL_EMBOSS = [ [-2, -1, 0], [-1, 1, 1], [0, 1, 2], ]; + /** + * Kernel matrix for unsharpening + * + * @var array + * @since 1.0.0 + */ public const KERNEL_UNSHARP_MASKING = [ - [-1 / 256, -4 / 256, -6 / 256, -4 / 256, -1 / 256], - [-4 / 256, -16 / 256, -24 / 256, -16 / 256, -4 / 256], - [-6 / 256, -24 / 256, 476 / 256, -24 / 256, -6 / 256], - [-4 / 256, -16 / 256, -24 / 256, -16 / 256, -4 / 256], - [-1 / 256, -4 / 256, -6 / 256, -4 / 256, -1 / 256], + [-1 / 256, -4 / 256, -6 / 256, -4 / 256, -1 / 256], + [-4 / 256, -16 / 256, -24 / 256, -16 / 256, -4 / 256], + [-6 / 256, -24 / 256, 476 / 256, -24 / 256, -6 / 256], + [-4 / 256, -16 / 256, -24 / 256, -16 / 256, -4 / 256], + [-1 / 256, -4 / 256, -6 / 256, -4 / 256, -1 / 256], ]; /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + + /** + * Apply kernel matrix + * + * @param string $inParth Image file path + * @param string $outPath Image output path + * @param array $kernel Kernel matrix + * + * @return void + * * @see https://en.wikipedia.org/wiki/Kernel_(image_processing) * @see https://towardsdatascience.com/image-processing-with-python-blurring-and-sharpening-for-beginners-3bcebec0583a * @see https://web.eecs.umich.edu/~jjcorso/t/598F14/files/lecture_0924_filtering.pdf + * + * @since 1.0.0 */ public static function convolve(string $inPath, string $outPath, array $kernel) : void { diff --git a/Image/Skew.php b/Image/Skew.php index 22736f9b3..246939649 100755 --- a/Image/Skew.php +++ b/Image/Skew.php @@ -24,6 +24,16 @@ namespace phpOMS\Image; */ final class Skew { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Automatically rotate image based on projection profile * diff --git a/Image/Thresholding.php b/Image/Thresholding.php index 935f55e1a..4759c381e 100755 --- a/Image/Thresholding.php +++ b/Image/Thresholding.php @@ -26,6 +26,16 @@ use phpOMS\Utils\ImageUtils; */ final class Thresholding { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Perform integral thresholding * diff --git a/Math/Functions/Algebra.php b/Math/Functions/Algebra.php index b216f521d..1d85409fa 100644 --- a/Math/Functions/Algebra.php +++ b/Math/Functions/Algebra.php @@ -26,6 +26,16 @@ use phpOMS\Math\Matrix\Exception\InvalidDimensionException; */ final class Algebra { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Get the product of two arrays * diff --git a/Math/Geometry/Shape/D2/Circle.php b/Math/Geometry/Shape/D2/Circle.php index d3d67ec38..1b77b76a1 100755 --- a/Math/Geometry/Shape/D2/Circle.php +++ b/Math/Geometry/Shape/D2/Circle.php @@ -24,6 +24,16 @@ namespace phpOMS\Math\Geometry\Shape\D2; */ final class Circle implements D2ShapeInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Area * diff --git a/Math/Geometry/Shape/D2/Ellipse.php b/Math/Geometry/Shape/D2/Ellipse.php index 8bbc8eb9f..5e13daf80 100755 --- a/Math/Geometry/Shape/D2/Ellipse.php +++ b/Math/Geometry/Shape/D2/Ellipse.php @@ -24,6 +24,16 @@ namespace phpOMS\Math\Geometry\Shape\D2; */ final class Ellipse implements D2ShapeInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Area * diff --git a/Math/Geometry/Shape/D2/Quadrilateral.php b/Math/Geometry/Shape/D2/Quadrilateral.php index a7bd4f0cb..a0f8ce40c 100755 --- a/Math/Geometry/Shape/D2/Quadrilateral.php +++ b/Math/Geometry/Shape/D2/Quadrilateral.php @@ -24,6 +24,16 @@ namespace phpOMS\Math\Geometry\Shape\D2; */ final class Quadrilateral implements D2ShapeInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Calculate the surface area from the length of all sides and the angle between a and b * diff --git a/Math/Geometry/Shape/D2/Rectangle.php b/Math/Geometry/Shape/D2/Rectangle.php index 91ea83eb0..b51dd3dbc 100755 --- a/Math/Geometry/Shape/D2/Rectangle.php +++ b/Math/Geometry/Shape/D2/Rectangle.php @@ -24,6 +24,16 @@ namespace phpOMS\Math\Geometry\Shape\D2; */ final class Rectangle implements D2ShapeInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Area * diff --git a/Math/Geometry/Shape/D2/Trapezoid.php b/Math/Geometry/Shape/D2/Trapezoid.php index 7edb13496..1ec6d866b 100755 --- a/Math/Geometry/Shape/D2/Trapezoid.php +++ b/Math/Geometry/Shape/D2/Trapezoid.php @@ -24,6 +24,16 @@ namespace phpOMS\Math\Geometry\Shape\D2; */ final class Trapezoid implements D2ShapeInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Area * diff --git a/Math/Geometry/Shape/D2/Triangle.php b/Math/Geometry/Shape/D2/Triangle.php index 84f1efdf5..112934944 100755 --- a/Math/Geometry/Shape/D2/Triangle.php +++ b/Math/Geometry/Shape/D2/Triangle.php @@ -24,6 +24,16 @@ namespace phpOMS\Math\Geometry\Shape\D2; */ final class Triangle implements D2ShapeInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Area * diff --git a/Math/Geometry/Shape/D3/Cone.php b/Math/Geometry/Shape/D3/Cone.php index 5c46b079d..935bd1ac8 100755 --- a/Math/Geometry/Shape/D3/Cone.php +++ b/Math/Geometry/Shape/D3/Cone.php @@ -24,6 +24,16 @@ namespace phpOMS\Math\Geometry\Shape\D3; */ final class Cone implements D3ShapeInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Volume * diff --git a/Math/Geometry/Shape/D3/Cuboid.php b/Math/Geometry/Shape/D3/Cuboid.php index 7767ef45c..2361d9195 100755 --- a/Math/Geometry/Shape/D3/Cuboid.php +++ b/Math/Geometry/Shape/D3/Cuboid.php @@ -24,6 +24,16 @@ namespace phpOMS\Math\Geometry\Shape\D3; */ final class Cuboid implements D3ShapeInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Volume * diff --git a/Math/Geometry/Shape/D3/Cylinder.php b/Math/Geometry/Shape/D3/Cylinder.php index bef7d0812..4ea37ef6e 100755 --- a/Math/Geometry/Shape/D3/Cylinder.php +++ b/Math/Geometry/Shape/D3/Cylinder.php @@ -24,6 +24,16 @@ namespace phpOMS\Math\Geometry\Shape\D3; */ final class Cylinder implements D3ShapeInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Volume * diff --git a/Math/Geometry/Shape/D3/Prism.php b/Math/Geometry/Shape/D3/Prism.php index 5b0319e06..c90864593 100755 --- a/Math/Geometry/Shape/D3/Prism.php +++ b/Math/Geometry/Shape/D3/Prism.php @@ -26,6 +26,16 @@ use phpOMS\Math\Geometry\Shape\D2\Polygon; */ final class Prism implements D3ShapeInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Get volume of regular polygon prism by side length * diff --git a/Math/Geometry/Shape/D3/RectangularPyramid.php b/Math/Geometry/Shape/D3/RectangularPyramid.php index 0b71157cf..3016d50a9 100755 --- a/Math/Geometry/Shape/D3/RectangularPyramid.php +++ b/Math/Geometry/Shape/D3/RectangularPyramid.php @@ -24,6 +24,16 @@ namespace phpOMS\Math\Geometry\Shape\D3; */ final class RectangularPyramid implements D3ShapeInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Volume * diff --git a/Math/Geometry/Shape/D3/Tetrahedron.php b/Math/Geometry/Shape/D3/Tetrahedron.php index 80632e629..a546fa268 100755 --- a/Math/Geometry/Shape/D3/Tetrahedron.php +++ b/Math/Geometry/Shape/D3/Tetrahedron.php @@ -24,6 +24,16 @@ namespace phpOMS\Math\Geometry\Shape\D3; */ final class Tetrahedron implements D3ShapeInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Volume * diff --git a/Math/Numerics/Integration.php b/Math/Numerics/Integration.php index 4ddeb8345..352387d44 100755 --- a/Math/Numerics/Integration.php +++ b/Math/Numerics/Integration.php @@ -24,6 +24,16 @@ namespace phpOMS\Math\Numerics; */ final class Integration { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Integrate function by using rectangles from the left side * diff --git a/Math/Numerics/Interpolation/LagrangeInterpolation.php b/Math/Numerics/Interpolation/LagrangeInterpolation.php index 58f18e319..70b9a31cd 100755 --- a/Math/Numerics/Interpolation/LagrangeInterpolation.php +++ b/Math/Numerics/Interpolation/LagrangeInterpolation.php @@ -39,7 +39,8 @@ final class LagrangeInterpolation implements InterpolationInterface * * @since 1.0.0 */ - public function __construct(array $points) { + public function __construct(array $points) + { $this->points = $points; } diff --git a/Math/Numerics/Interpolation/LinearInterpolation.php b/Math/Numerics/Interpolation/LinearInterpolation.php index 26e5da4e8..0ec184965 100755 --- a/Math/Numerics/Interpolation/LinearInterpolation.php +++ b/Math/Numerics/Interpolation/LinearInterpolation.php @@ -65,7 +65,8 @@ final class LinearInterpolation implements InterpolationInterface * * @since 1.0.0 */ - public function __construct(array $points) { + public function __construct(array $points) + { $this->points = $points; $n = \count($this->points); diff --git a/Math/Optimization/Simplex.php b/Math/Optimization/Simplex.php index 5d49f4e4e..a9ca0040c 100644 --- a/Math/Optimization/Simplex.php +++ b/Math/Optimization/Simplex.php @@ -17,31 +17,113 @@ namespace phpOMS\Math\Optimization; /** * Simplex class. * + * The Simplex algorithm aims to solve a linear program - optimising a linear function subject + * to linear constraints. As such it is useful for a very wide range of applications. + * + * N.B. The linear program has to be given in *slack form*, which is as follows: + * maximise + * c_1 * x_1 + c_2 * x_2 + ... + c_n * x_n + v + * subj. to + * a_11 * x_1 + a_12 * x_2 + ... + a_1n * x_n + b_1 = s_1 + * a_21 * x_1 + a_22 * x_2 + ... + a_2n * x_n + b_2 = s_2 + * ... + * a_m1 * x_1 + a_m2 * x_2 + ... + a_mn * x_n + b_m = s_m + * and + * x_1, x_2, ..., x_n, s_1, s_2, ..., s_m >= 0 + * + * Every linear program can be translated into slack form; the parameters to specify are: + * - the number of variables, n, and the number of constraints, m; + * - the matrix A = [[A_11, A_12, ..., A_1n], ..., [A_m1, A_m2, ..., A_mn]]; + * - the vector b = [b_1, b_2, ..., b_m]; + * - the vector c = [c_1, c_2, ..., c_n] and the constant v. + * + * Complexity: O(m^(n/2)) worst case + * O(n + m) average case (common) + * * @package phpOMS\Math\Optimization + * @license Copyright (c) 2015 Petar Veličković * @license OMS License 2.0 * @link https://jingga.app * @link https://github.com/PetarV-/Algorithms/blob/master/Mathematical%20Algorithms/Simplex%20Algorithm.cpp * @since 1.0.0 */ -class Simplex +final class Simplex { + /** + * Bounding equations + * + * @var int + * @since 1.0.0 + */ private int $m = 0; + /** + * Bounding variables + * + * @var int + * @since 1.0.0 + */ private int $n = 0; + /** + * Bounding equations + * + * @var array> + * @since 1.0.0 + */ private array $A = []; + /** + * Bounds for bounding equations + * + * @var array + * @since 1.0.0 + */ private array $b = []; + /** + * Maximize vector + * + * @var array + * @since 1.0.0 + */ private array $c = []; + /** + * Maximized value + * + * @var float + * @since 1.0.0 + */ private float $v = 0.0; - private array $Basic = []; + /** + * Basic solutions + * + * @var array + * @since 1.0.0 + */ + private array $basic = []; - private array $Nonbasic = []; + /** + * Non-basic solutions + * + * @var array + * @since 1.0.0 + */ + private array $nonbasic = []; - private function pivot (int $x, int $y) : void + /** + * Pivot yth variable around xth constraint + * + * @param int $x Constraint index + * @param int $y Variable index + * + * @return void + * + * @since 1.0.0 + */ + private function pivot(int $x, int $y) : void { for ($j = 0; $j < $this->n; ++$j) { if ($j !== $y) { @@ -74,11 +156,18 @@ class Simplex $this->v += $this->c[$y] * $this->b[$x]; $this->c[$y] *= $this->A[$x][$y]; - $temp = $this->Basic[$x]; - $this->Basic[$x] = $this->Nonbasic[$y]; - $this->Nonbasic[$y] = $temp; + $temp = $this->basic[$x]; + $this->basic[$x] = $this->nonbasic[$y]; + $this->nonbasic[$y] = $temp; } + /** + * Perform simplex iteration step + * + * @return int 0 = OK, 1 = stop, -1 = unbound + * + * @since 1.0.0 + */ private function iterate() : int { $ind = -1; @@ -86,9 +175,9 @@ class Simplex for ($j = 0; $j < $this->n; ++$j) { if ($this->c[$j] > 0 - && ($best === -1 || $this->Nonbasic[$j] < $ind) + && ($best === -1 || $this->nonbasic[$j] < $ind) ) { - $ind = $this->Nonbasic[$j]; + $ind = $this->nonbasic[$j]; $best = $j; } } @@ -119,6 +208,16 @@ class Simplex return 0; } + /** + * Initialize simplex algorithm + * + * 1. possibly converts LP to slack form + * 2. find feasible basic solution + * + * @return int 0 = OK, 1 = stop, -1 = unbound + * + * @since 1.0.0 + */ private function initialize() : int { $k = -1; @@ -133,11 +232,11 @@ class Simplex if ($this->b[$k] >= 0) { for ($j = 0; $j < $this->n; ++$j) { - $this->Nonbasic[$j] = $j; + $this->nonbasic[$j] = $j; } for ($i = 0; $i < $this->m; ++$i) { - $this->Basic[$i] = $this->n + $i; + $this->basic[$i] = $this->n + $i; } return 0; @@ -145,11 +244,11 @@ class Simplex ++$this->n; for ($j = 0; $j < $this->n; ++$j) { - $this->Nonbasic[$j] = $j; + $this->nonbasic[$j] = $j; } for ($i = 0; $i < $this->m; ++$i) { - $this->Basic[$i] = $this->n + $i; + $this->basic[$i] = $this->n + $i; } $oldC = []; @@ -180,7 +279,7 @@ class Simplex $basicZ = -1; for ($i = 0; $i < $this->m; ++$i) { - if ($this->Basic[$i] === $this->n - 1) { + if ($this->basic[$i] === $this->n - 1) { $basicZ = $i; break; } @@ -192,7 +291,7 @@ class Simplex $nonbasicZ = -1; for ($j = 0; $j < $this->n; ++$j) { - if ($this->Nonbasic[$j] === $this->n - 1) { + if ($this->nonbasic[$j] === $this->n - 1) { $nonbasicZ = $j; break; } @@ -202,20 +301,20 @@ class Simplex $this->A[$i][$nonbasicZ] = $this->A[$i][$this->n - 1]; } - $temp = $this->Nonbasic[$nonbasicZ]; - $this->Nonbasic[$nonbasicZ] = $this->Nonbasic[$this->n - 1]; - $this->Nonbasic[$this->n - 1] = $temp; + $temp = $this->nonbasic[$nonbasicZ]; + $this->nonbasic[$nonbasicZ] = $this->nonbasic[$this->n - 1]; + $this->nonbasic[$this->n - 1] = $temp; --$this->n; for ($j = 0; $j < $this->n; ++$j) { - if ($this->Nonbasic[$j] > $this->n) { - --$this->Nonbasic[$j]; + if ($this->nonbasic[$j] > $this->n) { + --$this->nonbasic[$j]; } } for ($i = 0; $i < $this->m; ++$i) { - if ($this->Basic[$i] > $this->n) { - --$this->Basic[$i]; + if ($this->basic[$i] > $this->n) { + --$this->basic[$i]; } } @@ -228,7 +327,7 @@ class Simplex for ($j = 0; $j < $this->n; ++$j) { $ok = false; for ($k = 0; $k < $this->n; ++$k) { - if ($j === $this->Nonbasic[$k]) { + if ($j === $this->nonbasic[$k]) { $this->c[$k] += $oldC[$j]; $ok = true; break; @@ -240,7 +339,7 @@ class Simplex } for ($i = 0; $i < $this->m; ++$i) { - if ($j === $this->Basic[$i]) { + if ($j === $this->basic[$i]) { for ($k = 0; $k < $this->n; ++$k) { $this->c[$k] = $oldC[$j] * $this->A[$i][$k]; } @@ -254,13 +353,25 @@ class Simplex return 0; } - public function solve(array $A, array $b, array $c) + /** + * Solve simplex problem + * + * @param array> $A Bounding equations + * @param int[]|float[] $b Boundings for equations + * @param int[]|float[] $c Equation to maximize + * + * @return array{0:array, 1:float} + * + * @since 1.0.0 + */ + public function solve(array $A, array $b, array $c) : array { $this->A = $A; $this->b = $b; $this->c = $c; // @todo: createSlackForm() required? + // @todo: create minimize $this->m = \count($A); $this->n = \count(\reset($A)); @@ -278,11 +389,11 @@ class Simplex $result = []; for ($j = 0; $j < $this->n; ++$j) { - $result[$this->Nonbasic[$j]] = 0; + $result[$this->nonbasic[$j]] = 0; } for ($i = 0; $i < $this->m; ++$i) { - $result[$this->Basic[$i]] = $this->b[$i]; + $result[$this->basic[$i]] = $this->b[$i]; } return [$result, $this->v]; diff --git a/Math/Parser/Evaluator.php b/Math/Parser/Evaluator.php index e9307952f..459980ac7 100755 --- a/Math/Parser/Evaluator.php +++ b/Math/Parser/Evaluator.php @@ -24,6 +24,16 @@ namespace phpOMS\Math\Parser; */ final class Evaluator { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Evaluate function. * diff --git a/Math/Solver/Root/Bisection.php b/Math/Solver/Root/Bisection.php index 23fd7eaa7..3b29b0a45 100644 --- a/Math/Solver/Root/Bisection.php +++ b/Math/Solver/Root/Bisection.php @@ -32,6 +32,16 @@ final class Bisection */ public const EPSILON = 1e-6; + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Perform bisection to find the root of a function * diff --git a/Math/Solver/Root/Illinois.php b/Math/Solver/Root/Illinois.php index c8e87f25a..9f5ca9be9 100644 --- a/Math/Solver/Root/Illinois.php +++ b/Math/Solver/Root/Illinois.php @@ -32,6 +32,16 @@ final class Illinois */ public const EPSILON = 1e-6; + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Perform bisection to find the root of a function * diff --git a/Math/Solver/Root/RegulaFalsi.php b/Math/Solver/Root/RegulaFalsi.php index 7916b40b0..bd9a794a9 100644 --- a/Math/Solver/Root/RegulaFalsi.php +++ b/Math/Solver/Root/RegulaFalsi.php @@ -32,6 +32,16 @@ final class RegulaFalsi */ public const EPSILON = 1e-6; + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Perform bisection to find the root of a function * diff --git a/Utils/IO/Csv/CsvDatabaseMapper.php b/Utils/IO/Csv/CsvDatabaseMapper.php index f746d8683..5f884db05 100644 --- a/Utils/IO/Csv/CsvDatabaseMapper.php +++ b/Utils/IO/Csv/CsvDatabaseMapper.php @@ -26,7 +26,7 @@ use phpOMS\Utils\IO\IODatabaseMapper; * @link https://jingga.app * @since 1.0.0 */ -class CsvDatabaseMapper implements IODatabaseMapper +final class CsvDatabaseMapper implements IODatabaseMapper { /** * Database connection diff --git a/Utils/IO/Json/InvalidJsonException.php b/Utils/IO/Json/InvalidJsonException.php index 8899d571d..3a6dc412e 100755 --- a/Utils/IO/Json/InvalidJsonException.php +++ b/Utils/IO/Json/InvalidJsonException.php @@ -22,7 +22,7 @@ namespace phpOMS\Utils\IO\Json; * @link https://jingga.app * @since 1.0.0 */ -class InvalidJsonException extends \UnexpectedValueException +final class InvalidJsonException extends \UnexpectedValueException { /** * Constructor. diff --git a/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapper.php b/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapper.php index 3f460740e..efa5467d2 100755 --- a/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapper.php +++ b/Utils/IO/Spreadsheet/SpreadsheetDatabaseMapper.php @@ -27,7 +27,7 @@ use phpOMS\Utils\StringUtils; * @link https://jingga.app * @since 1.0.0 */ -class SpreadsheetDatabaseMapper implements IODatabaseMapper +final class SpreadsheetDatabaseMapper implements IODatabaseMapper { /** * Database connection diff --git a/Utils/IO/Zip/Gz.php b/Utils/IO/Zip/Gz.php index 24b8cfd95..11144277e 100755 --- a/Utils/IO/Zip/Gz.php +++ b/Utils/IO/Zip/Gz.php @@ -24,8 +24,18 @@ namespace phpOMS\Utils\IO\Zip; * @link https://jingga.app * @since 1.0.0 */ -class Gz implements ArchiveInterface +final class Gz implements ArchiveInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * {@inheritdoc} */ diff --git a/Utils/IO/Zip/Tar.php b/Utils/IO/Zip/Tar.php index 98fefacf5..283398746 100755 --- a/Utils/IO/Zip/Tar.php +++ b/Utils/IO/Zip/Tar.php @@ -31,8 +31,18 @@ use phpOMS\System\File\Local\Directory; * @link https://jingga.app * @since 1.0.0 */ -class Tar implements ArchiveInterface +final class Tar implements ArchiveInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * {@inheritdoc} */ diff --git a/Utils/IO/Zip/TarGz.php b/Utils/IO/Zip/TarGz.php index 27fcf58c5..b960a2838 100755 --- a/Utils/IO/Zip/TarGz.php +++ b/Utils/IO/Zip/TarGz.php @@ -26,8 +26,18 @@ use phpOMS\System\File\Local\File; * @link https://jingga.app * @since 1.0.0 */ -class TarGz implements ArchiveInterface +final class TarGz implements ArchiveInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * {@inheritdoc} */ diff --git a/Utils/IO/Zip/Zip.php b/Utils/IO/Zip/Zip.php index 1bb1a4132..d1b2a80ae 100755 --- a/Utils/IO/Zip/Zip.php +++ b/Utils/IO/Zip/Zip.php @@ -27,8 +27,18 @@ use phpOMS\System\File\Local\Directory; * @link https://jingga.app * @since 1.0.0 */ -class Zip implements ArchiveInterface +final class Zip implements ArchiveInterface { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * {@inheritdoc} */ diff --git a/Utils/Parser/Calendar/ICalParser.php b/Utils/Parser/Calendar/ICalParser.php index d82dc2f52..86d730bce 100755 --- a/Utils/Parser/Calendar/ICalParser.php +++ b/Utils/Parser/Calendar/ICalParser.php @@ -22,8 +22,18 @@ namespace phpOMS\Utils\Parser\Calendar; * @link https://jingga.app * @since 1.0.0 */ -class ICalParser +final class ICalParser { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Parse iCal data * diff --git a/Utils/Parser/Document/DocumentParser.php b/Utils/Parser/Document/DocumentParser.php index 894add951..6fcf2d295 100755 --- a/Utils/Parser/Document/DocumentParser.php +++ b/Utils/Parser/Document/DocumentParser.php @@ -25,8 +25,18 @@ use PhpOffice\PhpWord\Writer\HTML; * @link https://jingga.app * @since 1.0.0 */ -class DocumentParser +final class DocumentParser { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Document to string * diff --git a/Utils/Parser/Pdf/PdfParser.php b/Utils/Parser/Pdf/PdfParser.php index 6750541d2..8b38d8941 100755 --- a/Utils/Parser/Pdf/PdfParser.php +++ b/Utils/Parser/Pdf/PdfParser.php @@ -26,7 +26,7 @@ use phpOMS\Utils\StringUtils; * @link https://jingga.app * @since 1.0.0 */ -class PdfParser +final class PdfParser { /** * PDFToText path. @@ -44,6 +44,16 @@ class PdfParser */ public static string $pdftoppm = '/usr/bin/pdftoppm'; + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Pdf to text * diff --git a/Utils/Parser/Php/ArrayParser.php b/Utils/Parser/Php/ArrayParser.php index 092aa81e6..eb66bef1f 100755 --- a/Utils/Parser/Php/ArrayParser.php +++ b/Utils/Parser/Php/ArrayParser.php @@ -26,8 +26,18 @@ use phpOMS\Contract\SerializableInterface; * @link https://jingga.app * @since 1.0.0 */ -class ArrayParser +final class ArrayParser { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Serializing array (recursively). * diff --git a/Utils/Parser/Presentation/PresentationParser.php b/Utils/Parser/Presentation/PresentationParser.php index 8a75ec8e1..d68e53f21 100755 --- a/Utils/Parser/Presentation/PresentationParser.php +++ b/Utils/Parser/Presentation/PresentationParser.php @@ -24,8 +24,18 @@ use PhpOffice\PhpPresentation\IOFactory; * @link https://jingga.app * @since 1.0.0 */ -class PresentationParser +final class PresentationParser { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Presentation to string * diff --git a/Utils/Parser/Spreadsheet/SpreadsheetParser.php b/Utils/Parser/Spreadsheet/SpreadsheetParser.php index 424909c90..b5e07c63d 100755 --- a/Utils/Parser/Spreadsheet/SpreadsheetParser.php +++ b/Utils/Parser/Spreadsheet/SpreadsheetParser.php @@ -25,8 +25,18 @@ use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup; * @link https://jingga.app * @since 1.0.0 */ -class SpreadsheetParser +final class SpreadsheetParser { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Spreadsheet to string * diff --git a/Utils/RnG/ArrayRandomize.php b/Utils/RnG/ArrayRandomize.php index adfb5fbda..6619e3b11 100755 --- a/Utils/RnG/ArrayRandomize.php +++ b/Utils/RnG/ArrayRandomize.php @@ -22,8 +22,18 @@ namespace phpOMS\Utils\RnG; * @link https://jingga.app * @since 1.0.0 */ -class ArrayRandomize +final class ArrayRandomize { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Yates array shuffler. * diff --git a/Utils/RnG/DateTime.php b/Utils/RnG/DateTime.php index c288b10ff..704a8e39f 100755 --- a/Utils/RnG/DateTime.php +++ b/Utils/RnG/DateTime.php @@ -22,8 +22,18 @@ namespace phpOMS\Utils\RnG; * @link https://jingga.app * @since 1.0.0 */ -class DateTime +final class DateTime { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Get a random \DateTime. * diff --git a/Utils/RnG/Email.php b/Utils/RnG/Email.php index 4ae5ab4cf..50a71dcca 100755 --- a/Utils/RnG/Email.php +++ b/Utils/RnG/Email.php @@ -22,8 +22,18 @@ namespace phpOMS\Utils\RnG; * @link https://jingga.app * @since 1.0.0 */ -class Email +final class Email { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Get a random email. * diff --git a/Utils/RnG/File.php b/Utils/RnG/File.php index 22b951659..9262a991f 100755 --- a/Utils/RnG/File.php +++ b/Utils/RnG/File.php @@ -22,7 +22,7 @@ namespace phpOMS\Utils\RnG; * @link https://jingga.app * @since 1.0.0 */ -class File +final class File { /** * Extensions. @@ -44,6 +44,16 @@ class File ['flv'], ['fla'], ['deb'], ['py'], ['pl'], ]; + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Get a random file extension. * diff --git a/Utils/RnG/LinearCongruentialGenerator.php b/Utils/RnG/LinearCongruentialGenerator.php index bfc60986e..c10e42258 100755 --- a/Utils/RnG/LinearCongruentialGenerator.php +++ b/Utils/RnG/LinearCongruentialGenerator.php @@ -22,7 +22,7 @@ namespace phpOMS\Utils\RnG; * @link https://jingga.app * @since 1.0.0 */ -class LinearCongruentialGenerator +final class LinearCongruentialGenerator { /** * BSD seed value. @@ -40,6 +40,16 @@ class LinearCongruentialGenerator */ private static $msvcrtSeed = 0; + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * BSD random number * diff --git a/Utils/RnG/Name.php b/Utils/RnG/Name.php index f02a9faec..fddd55d8f 100755 --- a/Utils/RnG/Name.php +++ b/Utils/RnG/Name.php @@ -22,7 +22,7 @@ namespace phpOMS\Utils\RnG; * @link https://jingga.app * @since 1.0.0 */ -class Name +final class Name { private static array $names = [ 'western' => [ @@ -481,6 +481,16 @@ class Name ], ]; + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Get a random string. * diff --git a/Utils/RnG/Phone.php b/Utils/RnG/Phone.php index bdfe6f699..a16908b0c 100755 --- a/Utils/RnG/Phone.php +++ b/Utils/RnG/Phone.php @@ -22,8 +22,18 @@ namespace phpOMS\Utils\RnG; * @link https://jingga.app * @since 1.0.0 */ -class Phone +final class Phone { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Get a random phone number. * diff --git a/Utils/RnG/StringUtils.php b/Utils/RnG/StringUtils.php index 55e67dd6b..1cc6c73d0 100755 --- a/Utils/RnG/StringUtils.php +++ b/Utils/RnG/StringUtils.php @@ -22,8 +22,18 @@ namespace phpOMS\Utils\RnG; * @link https://jingga.app * @since 1.0.0 */ -class StringUtils +final class StringUtils { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Get a random string. * diff --git a/Utils/RnG/Text.php b/Utils/RnG/Text.php index 2b8b8a87b..face5e3b1 100755 --- a/Utils/RnG/Text.php +++ b/Utils/RnG/Text.php @@ -22,7 +22,7 @@ namespace phpOMS\Utils\RnG; * @link https://jingga.app * @since 1.0.0 */ -class Text +final class Text { /** * Vocabulary. diff --git a/Utils/RnG/UUID.php b/Utils/RnG/UUID.php index 3dcf94611..a7661145f 100755 --- a/Utils/RnG/UUID.php +++ b/Utils/RnG/UUID.php @@ -24,6 +24,16 @@ namespace phpOMS\Utils\RnG; */ final class UUID { + /** + * Constructor. + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + private function __construct() + { + } + /** * Get default random UUID *