2016-04-04 22:25:27 +02:00
|
|
|
<?php
|
2016-04-04 22:49:54 +02:00
|
|
|
|
|
|
|
declare (strict_types = 1);
|
2016-04-04 22:25:27 +02:00
|
|
|
|
|
|
|
namespace Phpml\Exception;
|
|
|
|
|
|
|
|
class InvalidArgumentException extends \Exception
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @return InvalidArgumentException
|
|
|
|
*/
|
2016-04-18 22:58:43 +02:00
|
|
|
public static function arraySizeNotMatch()
|
2016-04-04 22:25:27 +02:00
|
|
|
{
|
2016-04-18 22:58:43 +02:00
|
|
|
return new self('Size of given arrays not match');
|
2016-04-04 22:25:27 +02:00
|
|
|
}
|
2016-04-06 22:38:08 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $name
|
|
|
|
*
|
|
|
|
* @return InvalidArgumentException
|
|
|
|
*/
|
|
|
|
public static function percentNotInRange($name)
|
|
|
|
{
|
|
|
|
return new self(sprintf('%s must be between 0.0 and 1.0', $name));
|
|
|
|
}
|
2016-04-27 23:04:59 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return InvalidArgumentException
|
|
|
|
*/
|
|
|
|
public static function arrayCantBeEmpty()
|
|
|
|
{
|
|
|
|
return new self('The array has zero elements');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param int $minimumSize
|
|
|
|
*
|
|
|
|
* @return InvalidArgumentException
|
|
|
|
*/
|
|
|
|
public static function arraySizeToSmall($minimumSize = 2)
|
|
|
|
{
|
|
|
|
return new self(sprintf('The array must have at least %s elements', $minimumSize));
|
|
|
|
}
|
2016-04-30 00:58:54 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return InvalidArgumentException
|
|
|
|
*/
|
|
|
|
public static function matrixDimensionsDidNotMatch()
|
|
|
|
{
|
|
|
|
return new self('Matrix dimensions did not match');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return InvalidArgumentException
|
|
|
|
*/
|
|
|
|
public static function inconsistentMatrixSupplied()
|
|
|
|
{
|
|
|
|
return new self('Inconsistent matrix aupplied');
|
|
|
|
}
|
2016-05-01 23:17:09 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return InvalidArgumentException
|
|
|
|
*/
|
|
|
|
public static function invalidClustersNumber()
|
|
|
|
{
|
|
|
|
return new self('Invalid clusters number');
|
|
|
|
}
|
2016-06-14 11:53:58 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return InvalidArgumentException
|
|
|
|
*/
|
|
|
|
public static function invalidStopWordsLanguage(string $language)
|
|
|
|
{
|
|
|
|
return new self(sprintf('Can\'t find %s language for StopWords', $language));
|
|
|
|
}
|
2016-04-04 22:25:27 +02:00
|
|
|
}
|