FloatRange.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2009 by Denis M. Gabaidulin                             *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation; either version 3 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  ***************************************************************************/
00011 
00012     final class FloatRange extends BaseRange
00013     {
00014         public function __construct($min = null, $max = null)
00015         {
00016             if ($min !== null)
00017                 Assert::isFloat($min);
00018             
00019             if ($max !== null)
00020                 Assert::isFloat($max);
00021             
00022             parent::__construct($min, $max);
00023         }
00024         
00028         public static function create($min = null, $max = null)
00029         {
00030             return new self($min, $max);
00031         }
00032         
00037         public function setMin($min = null)
00038         {
00039             if ($min !== null)
00040                 Assert::isFloat($min);
00041             else
00042                 return $this;
00043             
00044             return parent::setMin($min);
00045         }
00046         
00051         public function setMax($max = null)
00052         {
00053             if ($max !== null)
00054                 Assert::isFloat($max);
00055             else
00056                 return $this;
00057             
00058             return parent::setMax($max);
00059         }
00060     }
00061 ?>