Exemple #1
0
 /**
  * Returns a Integer object given a PHP native int as parameter.
  *
  * @param int $value
  */
 public function __construct($value)
 {
     $value = filter_var($value, FILTER_VALIDATE_INT);
     if (false === $value) {
         throw new InvalidNativeArgumentException($value, array('int'));
     }
     parent::__construct($value);
 }
Exemple #2
0
 public function __construct($value)
 {
     parent::__construct($value);
     try {
         Assertion::integerish($value);
         $this->value = (int) $value;
     } catch (AssertionInvalidArgumentException $exception) {
         throw new InvalidArgumentException($value);
     }
 }