Skip to content

Commit

Permalink
[Form] refactor Guess
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobion committed Aug 28, 2012
1 parent 6c5eca7 commit 219ed5e
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions Guess/Guess.php
Expand Up @@ -46,17 +46,6 @@ abstract class Guess
*/
const LOW_CONFIDENCE = 0;

/**
* The list of allowed confidence values
* @var array
*/
private static $confidences = array(
self::VERY_HIGH_CONFIDENCE,
self::HIGH_CONFIDENCE,
self::MEDIUM_CONFIDENCE,
self::LOW_CONFIDENCE,
);

/**
* The confidence about the correctness of the value
*
Expand Down Expand Up @@ -101,8 +90,9 @@ public static function getBestGuess(array $guesses)
*/
public function __construct($confidence)
{
if (!in_array($confidence, self::$confidences)) {
throw new \InvalidArgumentException(sprintf('The confidence should be one of "%s"', implode('", "', self::$confidences)));
if (self::VERY_HIGH_CONFIDENCE !== $confidence && self::HIGH_CONFIDENCE !== $confidence &&
self::MEDIUM_CONFIDENCE !== $confidence && self::LOW_CONFIDENCE !== $confidence) {
throw new \InvalidArgumentException('The confidence should be one of the constants defined in Guess.');
}

$this->confidence = $confidence;
Expand Down

0 comments on commit 219ed5e

Please sign in to comment.