Range.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2004-2008 by Konstantin V. Arkhipov                     *
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 
00017     class Range extends BaseRange
00018     {
00019         public function __construct($min = null, $max = null)
00020         {
00021             if ($min !== null)
00022                 Assert::isInteger($min);
00023             
00024             if ($max !== null)
00025                 Assert::isInteger($max);
00026             
00027             parent::__construct($min, $max);
00028         }
00029         
00033         public static function create($min = null, $max = null)
00034         {
00035             return new self($min, $max);
00036         }
00037         
00042         public function setMin($min = null)
00043         {
00044             if ($min !== null)
00045                 Assert::isInteger($min);
00046             else
00047                 return $this;
00048             
00049             return parent::setMin($min);
00050         }
00051         
00056         public function setMax($max = null)
00057         {
00058             if ($max !== null)
00059                 Assert::isInteger($max);
00060             else
00061                 return $this;
00062             
00063             return parent::setMax($max);
00064         }
00065     }
00066 ?>