00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00016 abstract class PrimitiveNumber extends FiltrablePrimitive
00017 {
00018 abstract protected function checkNumber($number);
00019 abstract protected function castNumber($number);
00020
00021 public function import($scope)
00022 {
00023 if (!BasePrimitive::import($scope))
00024 return null;
00025
00026 try {
00027 $this->checkNumber($scope[$this->name]);
00028 } catch (WrongArgumentException $e) {
00029 return false;
00030 }
00031
00032 $this->value = $this->castNumber($scope[$this->name]);
00033
00034 $this->selfFilter();
00035
00036 if (
00037 !(null !== $this->min && $this->value < $this->min)
00038 && !(null !== $this->max && $this->value > $this->max)
00039 ) {
00040 return true;
00041 } else {
00042 $this->value = null;
00043 }
00044
00045 return false;
00046 }
00047 }
00048 ?>