protected function inject(\ReflectionFunctionAbstract $reflection, array $args = [])
    {
        // get parameters
        $parameters = $reflection->getParameters();

        // Build argument list
        $arguments = [];
        foreach ($parameters as $parameter) {
            // Get class
            $class = $parameter->getClass();

            // From argument array (class or parameter name)
            $key = $class && isset($args[$class->name]) ? $class->name : $parameter->name;
            if (array_key_exists($key, $args)) {
                $arguments[] = $args[$key];
                unset($args[$key]);
                continue;
            }

            // Delegated Lookup
            if ($class && $this->delegate->has($class->name)) {
                $arguments[] = $this->delegate->get($class->name);
                continue;
            }

            // Real class
            if ($class && class_exists($class->name)) {
                $arguments[] = $this->make($class->name);
                continue;
            }

            // Skip optional parameter with default value
            if ($parameter->isDefaultValueAvailable()) {
                $arguments[] = $parameter->getDefaultValue();
                continue;
            }

            // Couldn't resolve the dependency
            throw new Exceptions\ParameterResolutionException($reflection, $parameter);
        }

        return $arguments;
    }