public static function registerServices(Application $app)
    {
        $file = $app['wise.options']['config']['services'];

        if ('prod' !== $app['wise.options']['mode']) {
            $file .= '_' . $app['wise.options']['mode'];
        }

        $file .= '.' . $app['wise.options']['type'];

        /** @var $wise Wise */
        $wise = $app['wise'];
        $services = $wise->load($file);

        unset($services['parameters']);
        unset($services['imports']);

        foreach ($services as $name => $service) {
            if (null === $service) {
                continue;
            }

            if (!isset($service['class'])) {
                throw InvalidArgumentException::format(
                    'The service "%s" did not specify its "class".',
                    $name
                );
            }

            if (!isset($service['parameters'])) {
                $service['parameters'] = array();
            }

            $app->register(new $service['class'](), $service['parameters']);
        }
    }