- 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
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
public function getObject()
{
$args = func_get_args();
if (empty($args)) {
$this->_throwException('wrong call of method - interface should be as 1st parameter');
}
$interface = array_shift($args);
$class = $this->getInjection($interface);
$argsCnt = count($args);
if ($argsCnt == 0) {
$object = new $class;
}
else if ($argsCnt == 1) {
$object = new $class($args[0]);
}
else if ($argsCnt == 2) {
$object = new $class($args[0], $args[1]);
}
else if ($argsCnt == 3) {
$object = new $class($args[0], $args[1], $args[2]);
}
else if ($argsCnt == 4) {
$object = new $class($args[0], $args[1], $args[2], $args[3]);
}
else if ($argsCnt == 5) {
$object = new $class($args[0], $args[1], $args[2], $args[3], $args[4]);
}
else if ($argsCnt == 6) {
$object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]);
}
else if ($argsCnt == 7) {
$object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6]);
}
else if ($argsCnt == 8) {
$object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7]);
}
else if ($argsCnt == 9) {
$object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8]);
}
else if ($argsCnt == 10) {
$object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9]);
}
else if ($argsCnt == 11) {
$object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10]);
}
else if ($argsCnt == 12) {
$object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10], $args[11]);
}
else if ($argsCnt == 13) {
$object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10], $args[11], $args[12]);
}
else if ($argsCnt == 14) {
$object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10], $args[11], $args[12], $args[13]);
}
else if ($argsCnt == 15) {
$object = new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9], $args[10], $args[11], $args[12], $args[13], $args[14]);
}
else {
$this->_throwException('it looks like you use more than 15 arguments when trying to instantiate an object of class '.$class.' - that\'s ugly');
}
return $object;
}