public function build($classNameOrSpecification, $serviceName = '')
    {
        /*
         * Builds uses static factory method
         */
        if (false !== strpos($classNameOrSpecification, '::')) {
            $specification = explode('::', $classNameOrSpecification);
            $className     = $specification[0];
            $factoryMethod = $specification[1];
            if (! class_exists($className, true)) {
                throw new RuntimeException(
                    sprintf(
                        'Factory "%s" not found.',
                        $className
                    )
                );
            }
            if (! is_callable([$className, $factoryMethod])) {
                throw new RuntimeException(
                    sprintf(
                        'Factory method "%s" of class "%s" is not callable.',
                        $factoryMethod,
                        $className
                    )
                );
            }
            if (count($specification) > 2) {
                /*
                 * The special case of factory specification.
                 * Abstract Factory takes the service name as an argument.
                 *
                 * Abstract factory method specification
                 * as 'FactoryClassName::methodName::'
                 */
                $instance = call_user_func(
                    [$className, $factoryMethod],
                    (string) $serviceName
                );
            } else {
                /*
                 * Calls the factory method.
                 *
                 * Factory method specification
                 * as 'FactoryClassName::methodName'
                 */
                $instance = call_user_func([$className, $factoryMethod]);
            }

        /*
         * Builds uses "new" operator
         */
        } else {
            $className = $classNameOrSpecification;
            if (! class_exists($className, true)) {
                throw new RuntimeException(
                    sprintf(
                        'Class "%s" not found.',
                        $className
                    )
                );
            }
            $instance = new $className();
        }

        return $instance;
    }