- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
protected function CreateClass($className, $params) {
switch (count($params)) {
case 0:
return new $className();
break;
case 1:
return new $className($params[0]);
break;
case 2:
return new $className($params[0], $params[1]);
break;
case 3:
return new $className($params[0], $params[1], $params[2]);
break;
case 4:
return new $className($params[0], $params[1], $params[2], $params[3]);
break;
case 5:
return new $className($params[0], $params[1], $params[2], $params[3], $params[4]);
break;
case 6:
return new $className($params[0], $params[1], $params[2], $params[3], $params[4], $params[5]);
break;
case 7:
return new $className($params[0], $params[1], $params[2], $params[3], $params[4], $params[5], $params[6]);
break;
case 8:
return new $className($params[0], $params[1], $params[2], $params[3], $params[4], $params[5], $params[6], $params[7]);
break;
case 9:
return new $className($params[0], $params[1], $params[2], $params[3], $params[4], $params[5], $params[6], $params[7], $params[8]);
break;
case 10:
return new $className($params[0], $params[1], $params[2], $params[3], $params[4], $params[5], $params[6], $params[7], $params[8], $params[9]);
break;
default:
echo "Too many arguments";
return null;
break;
}
}
bormand 11.05.2014 14:08 # 0
Itareo 11.05.2014 14:11 # 0
myaut 11.05.2014 14:53 # +5
bormand 11.05.2014 14:55 # +10
guest 13.05.2014 15:27 # +1