PrimitiveInteger.class.php

Go to the documentation of this file.
00001 <?php
00002 /****************************************************************************
00003  *   Copyright (C) 2004-2008 by Konstantin V. Arkhipov, Anton E. Lebedevich *
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 
00015     class PrimitiveInteger extends PrimitiveNumber
00016     {
00017         const SIGNED_SMALL_MIN = -32768;
00018         const SIGNED_SMALL_MAX = +32767;
00019         
00020         const SIGNED_MIN = -2147483648;
00021         const SIGNED_MAX = +2147483647;
00022         
00023         const SIGNED_BIG_MIN = -9223372036854775808;
00024         const SIGNED_BIG_MAX = 9223372036854775807;
00025         
00026         const UNSIGNED_SMALL_MAX = 65535;
00027         const UNSIGNED_MAX = 4294967295;
00028         
00029         protected function checkNumber($number)
00030         {
00031             Assert::isInteger($number);
00032         }
00033         
00034         protected function castNumber($number)
00035         {
00036             return (int) $number;
00037         }
00038     }
00039 ?>