File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 33namespace RonasIT \Support \AutoDoc \Traits ;
44
55use ReflectionMethod ;
6- use ReflectionFunctionAbstract ;
6+ use ReflectionFunction ;
77use ReflectionParameter ;
8+ use Illuminate \Support \Arr ;
9+ use ReflectionFunctionAbstract ;
10+ use Illuminate \Container \Container ;
811
912trait GetDependenciesTrait
1013{
@@ -34,6 +37,17 @@ protected function transformDependency(ReflectionParameter $parameter)
3437 return null ;
3538 }
3639
37- return interface_exists ($ class ->name ) ? get_class (app ($ class ->name )) : $ class ->name ;
40+ return interface_exists ($ class ->name ) ? $ this ->getClassByInterface ($ class ->name ) : $ class ->name ;
41+ }
42+
43+ protected function getClassByInterface ($ interfaceName )
44+ {
45+ $ bindings = Container::getInstance ()->getBindings ();
46+
47+ $ implementation = Arr::get ($ bindings , "{$ interfaceName }.concrete " );
48+
49+ $ classFields = (new ReflectionFunction ($ implementation ))->getStaticVariables ();
50+
51+ return $ classFields ['concrete ' ];
3852 }
3953}
You can’t perform that action at this time.
0 commit comments