src/KPhoen/Provider/NegotiationServiceProvider.php
public function register(Application $app)
    {
        $this->app = $app;

        $app['negotiator'] = $app->share(function ($app) {
            return new \Negotiation\Negotiator();
        });

        $app['language.negotiator'] = $app->share(function ($app) {
            return new \Negotiation\LanguageNegotiator();
        });

        $customFormats = $this->customFormats;

        $app['format.negotiator'] = $app->share(function ($app) use($customFormats) {
            $negotiator = new \Negotiation\FormatNegotiator();

            // add new formats
            foreach ($customFormats as $name => $mimeTypes) {
                $negotiator->registerFormat($name, $mimeTypes, true);
            }

            return $negotiator;
        });
    }
public function register(Application $app)
    {
        $this->app = $app;

        $app['negotiator'] = $app->share(function ($app) {
            return new \Negotiation\Negotiator();
        });

        $app['language.negotiator'] = $app->share(function ($app) {
            return new \Negotiation\LanguageNegotiator();
        });

        $customFormats = $this->customFormats;

        $app['format.negotiator'] = $app->share(function ($app) use($customFormats) {
            $negotiator = new \Negotiation\FormatNegotiator();

            // add new formats
            foreach ($customFormats as $name => $mimeTypes) {
                $negotiator->registerFormat($name, $mimeTypes, true);
            }

            return $negotiator;
        });
    }
public function register ( Application $ app ) { $ this -> app = $ app ; $ app [ 'negotiator' ] = $ app -> share ( function ( $ app ) { return new \ Negotiation \ Negotiator ( ) ; } ) ; $ app [ 'language.negotiator' ] = $ app -> share ( function ( $ app ) { return new \ Negotiation \ LanguageNegotiator ( ) ; } ) ; $ customFormats = $ this -> customFormats ; $ app [ 'format.negotiator' ] = $ app -> share ( function ( $ app ) use ( $ customFormats ) { $ negotiator = new \ Negotiation \ FormatNegotiator ( ) ; // add new formats foreach ( $ customFormats as $ name => $ mimeTypes ) { $ negotiator -> registerFormat ( $ name , $ mimeTypes , true ) ; } return $ negotiator ; } ) ; }
Register the services in the application.

@param Application $app The application.
Register the services in the application .