rename exception named constructor name

This commit is contained in:
Arkadiusz Kondas 2016-04-18 22:58:43 +02:00
parent ded28def2d
commit b04cf220bd
7 changed files with 8 additions and 8 deletions

View File

@ -27,7 +27,7 @@ class ArrayDataset implements Dataset
public function __construct(array $samples, array $labels)
{
if (count($samples) != count($labels)) {
throw InvalidArgumentException::sizeNotMatch();
throw InvalidArgumentException::arraySizeNotMatch();
}
$this->samples = $samples;

View File

@ -9,9 +9,9 @@ class InvalidArgumentException extends \Exception
/**
* @return InvalidArgumentException
*/
public static function sizeNotMatch()
public static function arraySizeNotMatch()
{
return new self('Size of given arguments not match');
return new self('Size of given arrays not match');
}
/**

View File

@ -20,7 +20,7 @@ class Accuracy
public static function score(array $actualLabels, array $predictedLabels, bool $normalize = true)
{
if (count($actualLabels) != count($predictedLabels)) {
throw InvalidArgumentException::sizeNotMatch();
throw InvalidArgumentException::arraySizeNotMatch();
}
$score = 0;

View File

@ -20,7 +20,7 @@ class Chebyshev implements Distance
public function distance(array $a, array $b): float
{
if (count($a) !== count($b)) {
throw InvalidArgumentException::sizeNotMatch();
throw InvalidArgumentException::arraySizeNotMatch();
}
$differences = [];

View File

@ -20,7 +20,7 @@ class Euclidean implements Distance
public function distance(array $a, array $b): float
{
if (count($a) !== count($b)) {
throw InvalidArgumentException::sizeNotMatch();
throw InvalidArgumentException::arraySizeNotMatch();
}
$distance = 0;

View File

@ -20,7 +20,7 @@ class Manhattan implements Distance
public function distance(array $a, array $b): float
{
if (count($a) !== count($b)) {
throw InvalidArgumentException::sizeNotMatch();
throw InvalidArgumentException::arraySizeNotMatch();
}
$distance = 0;

View File

@ -33,7 +33,7 @@ class Minkowski implements Distance
public function distance(array $a, array $b): float
{
if (count($a) !== count($b)) {
throw InvalidArgumentException::sizeNotMatch();
throw InvalidArgumentException::arraySizeNotMatch();
}
$distance = 0;