-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.php
More file actions
75 lines (51 loc) · 1.51 KB
/
helpers.php
File metadata and controls
75 lines (51 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
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
67
68
69
70
71
72
73
74
75
<?php
function getInstance($object, $arguments = array()){
switch(count($arguments)){
case 0:
return new $object;
break;
case 1:
return new $object($arguments[0]);
break;
case 2:
return new $object($arguments[0], $arguments[1]);
break;
case 3:
return new $object($arguments[0], $arguments[1], $arguments[2]);
break;
case 4:
return new $object($arguments[0],
$arguments[1],
$arguments[2],
$arguments[3]);
break;
case 5:
return new $object($arguments[0],
$arguments[1],
$arguments[2],
$arguments[3],
$arguments[4]);
break;
case 6:
return new $object($arguments[0],
$arguments[1],
$arguments[2],
$arguments[3],
$arguments[4],
$arguments[5]);
break;
case 7:
return new $object($arguments[0],
$arguments[1],
$arguments[2],
$arguments[3],
$arguments[4],
$arguments[5],
$arguments[6]);
break;
default:
throw new \Exception('Call to instantiate ' .get_class($oject) .' failed,
cannot use more than 7 arguments');
break;
}
}