@@ -64,11 +64,13 @@ public function create(string $className, array $bindings = []) {
64
64
65
65
// Does the class have a constructor?
66
66
if ($ class ->getConstructor () !== null ) {
67
- $ ctr = $ class ->getConstructor ();
68
- $ params = $ ctr ->getParameters ();
67
+ $ ctr = $ class ->getConstructor ();
68
+ $ params = $ ctr ->getParameters ();
69
69
70
70
// Create the new class from the parameters.
71
- return $ class ->newInstanceArgs ($ this ->getParameters ($ params , $ bindings ));
71
+ return $ class ->newInstanceArgs (
72
+ $ this ->getParameters ($ params , $ bindings )
73
+ );
72
74
}
73
75
74
76
// No constructor, so just return a new instance.
@@ -86,18 +88,20 @@ public function create(string $className, array $bindings = []) {
86
88
*/
87
89
private function getParameters (array $ params , array $ bindings ): array {
88
90
// Get all the parameters that the class require, if any.
89
- return array_map (function ($ param ) use ($ bindings ) {
90
- $ type = $ this ->getTypeHint ($ param );
91
- if (array_key_exists ($ type , $ bindings )) {
92
- return $ bindings [$ type ];
93
- }
91
+ return array_map (
92
+ function ($ param ) use ($ bindings ) {
93
+ $ type = $ this ->getTypeHint ($ param );
94
+ if (array_key_exists ($ type , $ bindings )) {
95
+ return $ bindings [$ type ];
96
+ }
94
97
95
- if ($ this ->container ->has ($ type )) {
96
- return $ this ->container ->get ($ type );
97
- }
98
+ if ($ this ->container ->has ($ type )) {
99
+ return $ this ->container ->get ($ type );
100
+ }
98
101
99
- return $ this ->create ($ type , $ bindings );
100
- }, $ params );
102
+ return $ this ->create ($ type , $ bindings );
103
+ }, $ params
104
+ );
101
105
}
102
106
103
107
/**
0 commit comments