Esempio n. 1
0
 /**
  * @param $value
  */
 public function __construct($value)
 {
     if (!is_int($value)) {
         throw new InvalidTypeException($value, ['integer']);
     }
     parent::__construct($value);
 }
Esempio n. 2
0
 /**
  * @param double $value
  */
 public function __construct($value, $round = null)
 {
     if (!filter_var($value, FILTER_VALIDATE_FLOAT)) {
         throw new InvalidTypeException($value, ['float']);
     }
     $value = $round ? $this->round($value, $round) : $value;
     $this->round = $round;
     parent::__construct($value);
 }
Esempio n. 3
0
 /**
  * @param $value
  * @param int    $leading
  */
 public function __construct($value, $leading = 2)
 {
     parent::__construct(str_pad($value, strlen((string) $value) + $leading, "0", STR_PAD_LEFT));
 }
Esempio n. 4
0
 /**
  * @param  Mathematical $mathematical
  * @return bool
  */
 public function inRange(Mathematical $mathematical)
 {
     return $this->minimum <= $mathematical->getValue() && $this->maximum >= $mathematical->getValue();
 }