Skip to content

Latest commit

 

History

History
39 lines (25 loc) · 907 Bytes

AcceptLanguageMiddlewareFactory.md

File metadata and controls

39 lines (25 loc) · 907 Bytes

AcceptLanguageMiddlewareFactory

without name (default)

<?php

use Chubbyphp\Negotiation\AcceptLanguageMiddleware;
use Chubbyphp\Negotiation\ServiceFactory\AcceptLanguageMiddlewareFactory;
use Psr\Container\ContainerInterface;

/** @var ContainerInterface $container */
$container = ...;

// $container->get(AcceptLanguageNegotiator::class)

$factory = new AcceptLanguageMiddlewareFactory();

$acceptLanguageMiddleware = $factory($container);

with name default

<?php

use Chubbyphp\Negotiation\AcceptLanguageMiddleware;
use Chubbyphp\Negotiation\ServiceFactory\AcceptLanguageMiddlewareFactory;
use Psr\Container\ContainerInterface;

/** @var ContainerInterface $container */
$container = ...;

// $container->get(AcceptLanguageNegotiator::class.'default')

$factory = [AcceptLanguageMiddlewareFactory::class, 'default'];

$acceptLanguageMiddleware = $factory($container);