Example #1
0
 /**
  * Builds the corresponding type from the given value. This way, it can also handle
  * arrays-elements.
  * 
  * @param mixed $value the value
  * @return PC_Obj_Type the type
  */
 public static function get_type_by_value($value)
 {
     if (is_array($value)) {
         $array = new self(self::TARRAY, array());
         foreach ($value as $k => $v) {
             $array->set_array_type($k, new PC_Obj_MultiType(self::get_type_by_value($v)));
         }
         return $array;
     }
     $type = self::get_type_by_name(gettype($value));
     $type->set_value($value);
     return $type;
 }