Voting

: max(six, seven)?
(Example: nine)

The Note You're Voting On

richard dot t dot rohrig at gmail dot com
6 years ago
Example of how to use getClass() in conjunction with getConstructor() to build the dependencies of a class. 
private function buildDependencies(ReflectionClass $reflection)
 {
 $constructor = $reflection->getConstructor();
 if (!$constructor) {
 return [];
 }
 $params = $constructor->getParameters();
 return array_map(function ($param) {
 $className = $param->getClass();
 if (!$className) {
 throw new Exception();
 }
 $className = $param->getClass()->getName();
 return $this->make($className);
 }, $params);
 }

<< Back to user notes page

AltStyle によって変換されたページ (->オリジナル) /