src/Simplex/Container.php
private function register(array $providers, array $values)
    {
        foreach ($providers as $provider) {

            $factories = $provider->getFactories();

            foreach ($factories as $key => $callable) {
                $this[$key] = function (ContainerInterface $c) use ($callable) {
                    return call_user_func($callable, $c);
                };
            }

        }

        foreach ($providers as $provider) {

            $extensions = $provider->getExtensions();

            foreach ($extensions as $key => $callable) {

                if (isset($this->keys[$key])) {
                    // Extend a previous entry
                    $this[$key] = $this->extend($key, function ($previous, ContainerInterface $c) use ($callable) {
                        return call_user_func($callable, $c, $previous);
                    });
                } else {
                    $this[$key] = function (ContainerInterface $c) use ($callable) {
                        return call_user_func($callable, $c);
                    };
                }
            }

        }

        foreach ($values as $key => $value) {
            $this[$key] = $value;
        }
    }
private function register(array $providers, array $values)
    {
        foreach ($providers as $provider) {

            $factories = $provider->getFactories();

            foreach ($factories as $key => $callable) {
                $this[$key] = function (ContainerInterface $c) use ($callable) {
                    return call_user_func($callable, $c);
                };
            }

        }

        foreach ($providers as $provider) {

            $extensions = $provider->getExtensions();

            foreach ($extensions as $key => $callable) {

                if (isset($this->keys[$key])) {
                    // Extend a previous entry
                    $this[$key] = $this->extend($key, function ($previous, ContainerInterface $c) use ($callable) {
                        return call_user_func($callable, $c, $previous);
                    });
                } else {
                    $this[$key] = function (ContainerInterface $c) use ($callable) {
                        return call_user_func($callable, $c);
                    };
                }
            }

        }

        foreach ($values as $key => $value) {
            $this[$key] = $value;
        }
    }
Registers service providers.

@param array $providers the list of service providers to register
@param array $values An array of values that customizes the providers

@return void