.

Cast Class Reference
[Lib]

Cast helper routines. More...

List of all members.

Static Public Member Functions

static  datetime ($string)
  Static.
static  float ($val)
  Static.
static  int ($val)
  Static.
static  string ($value)
  Static.

Detailed Description

Cast helper routines.

Author:
Gerd Riesselmann

Definition at line 8 of file cast.cls.php.


Member Function Documentation

static Cast::datetime ( string  )  [static]

Static.

Converts string retrieved from PHP to date

Parameters:
String  Anything that possible can be interpreted as a date
Returns:
date

Definition at line 36 of file cast.cls.php.

00036                                                  {
00037                 return GyroDate::datetime($string);
00038         }
static Cast::float ( val  )  [static]

Static.

Forces the given param to be float.

Parameters:
mixed  The value to convert
bool  True, if languange specific seperators should be acknowledged
Returns:
Float

Definition at line 26 of file cast.cls.php.

00026                                            {
00027                 return (is_numeric($val) ? floatval($val) : 0.0);
00028         }
static Cast::int ( val  )  [static]

Static.

Forces the given param to be integer.

Parameters:
mixes 
Returns:
Integer

Definition at line 15 of file cast.cls.php.

00015                                          {
00016                 return (is_numeric($val) ? intval($val) : 0);
00017         }
static Cast::string ( value  )  [static]

Static.

Converts given expression to string

Definition at line 43 of file cast.cls.php.

00043                                               {
00044                 if (is_string($value)) {
00045                         return $value;
00046                 }
00047                 if (is_array($value)) {
00048                         return '';
00049                 }
00050                 else if (is_object($value)) {
00051                         if ($value->__toString) {
00052                                 return $value->__toString();
00053                         }
00054                         else {
00055                                 return strval($value);
00056                         }
00057                 }
00058                 return strval($value);
00059         }

The documentation for this class was generated from the following file: