Ejemplo n.º 1
0
 /**
  * @param $method
  * @param $arguments
  * @return array|Argument[]
  */
 private function normalize($method, $arguments)
 {
     $normalized = [];
     $reflection = new \ReflectionMethod($this->class, $method);
     foreach ($reflection->getParameters() as $i => $parameter) {
         if (array_key_exists($i, $arguments)) {
             $argument = $arguments[$i];
             if ($argument instanceof Argument) {
                 $normalized[] = $argument;
             } else {
                 $normalized[] = Argument::exact($argument);
             }
         } else {
             if ($parameter->isDefaultValueAvailable()) {
                 $normalized[] = Argument::exact($parameter->getDefaultValue());
             }
         }
     }
     return $normalized;
 }