diff --git a/composer.json b/composer.json index 7f6a744..d8d5026 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,11 @@ "email": "arkadiusz.kondas@gmail.com" } ], + "autoload": { + "psr-4": { + "": "src/" + } + }, "config": { "bin-dir": "bin" }, diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..d31e033 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,14 @@ + + + + + tests/* + + ​ + diff --git a/src/Phpml/Exception/InvalidArgumentException.php b/src/Phpml/Exception/InvalidArgumentException.php index c88ab50..4ee194b 100644 --- a/src/Phpml/Exception/InvalidArgumentException.php +++ b/src/Phpml/Exception/InvalidArgumentException.php @@ -9,9 +9,9 @@ class InvalidArgumentException extends \Exception /** * @return InvalidArgumentException */ - public static function parametersSizeNotMatch() + public static function sizeNotMatch() { - return new self('Size of parameters not match'); + return new self('Size of given arguments not match'); } } diff --git a/src/Phpml/Metric/Distance.php b/src/Phpml/Metric/Distance.php index e1e64c6..581b73c 100644 --- a/src/Phpml/Metric/Distance.php +++ b/src/Phpml/Metric/Distance.php @@ -16,11 +16,11 @@ class Distance * * @throws InvalidArgumentException */ - public static function euclidean(array $a, array $b): float + public static function euclidean(array $a, array $b): float { if(count($a) != count($b)) { - throw InvalidArgumentException::parametersSizeNotMatch(); + throw InvalidArgumentException::sizeNotMatch(); } $distance = 0; diff --git a/tests/Phpml/Metric/DistanceTest.php b/tests/Phpml/Metric/DistanceTest.php new file mode 100644 index 0000000..947bb81 --- /dev/null +++ b/tests/Phpml/Metric/DistanceTest.php @@ -0,0 +1,18 @@ +