PHP Class Networking\InitCmsBundle\EventListener\LocaleListener

Author: Yorkie Chadwick ([email protected])
Inheritance: implements Symfony\Component\EventDispatcher\EventSubscriberInterface
Afficher le fichier Open project: networking/init-cms-bundle Class Usage Examples

Protected Properties

Свойство Type Description
$accessMap Symfony\Component\Security\Http\AccessMapInterface
$availableLanguages array
$defaultLocale string
$router string

Méthodes publiques

Méthode Description
__construct ( Symfony\Component\Security\Http\AccessMapInterface $accessMap, array $availableLanguages, string $defaultLocale = 'en', Symfony\Component\Routing\RouterInterface $router = null )
getBrowserAcceptLanguages ( Request $request ) : array get browser accept languages
getPreferredLocale ( Request $request ) : string get preferred locale
getSubscribedEvents ( ) : array
onKernelRequest ( GetResponseEvent $event )
onSecurityInteractiveLogin ( Symfony\Component\Security\Http\Event\InteractiveLoginEvent $event )
splitHttpAcceptHeader ( string $header ) : array split http accept header

Méthodes protégées

Méthode Description
guessFrontendLocale ( mixed $locales ) : string guess frontend locale
matchLocaleInAvailableLanguages ( $locale ) : string try to match browser language with available languages

Method Details

__construct() public méthode

public __construct ( Symfony\Component\Security\Http\AccessMapInterface $accessMap, array $availableLanguages, string $defaultLocale = 'en', Symfony\Component\Routing\RouterInterface $router = null )
$accessMap Symfony\Component\Security\Http\AccessMapInterface
$availableLanguages array
$defaultLocale string
$router Symfony\Component\Routing\RouterInterface

getBrowserAcceptLanguages() public méthode

get browser accept languages
public getBrowserAcceptLanguages ( Request $request ) : array
$request Symfony\Component\HttpFoundation\Request
Résultat array

getPreferredLocale() public méthode

get preferred locale
public getPreferredLocale ( Request $request ) : string
$request Symfony\Component\HttpFoundation\Request
Résultat string

getSubscribedEvents() public static méthode

public static getSubscribedEvents ( ) : array
Résultat array

guessFrontendLocale() protected méthode

guess frontend locale
protected guessFrontendLocale ( mixed $locales ) : string
$locales mixed
Résultat string

matchLocaleInAvailableLanguages() protected méthode

try to match browser language with available languages
protected matchLocaleInAvailableLanguages ( $locale ) : string
$locale
Résultat string

onKernelRequest() public méthode

public onKernelRequest ( GetResponseEvent $event )
$event Symfony\Component\HttpKernel\Event\GetResponseEvent

onSecurityInteractiveLogin() public méthode

public onSecurityInteractiveLogin ( Symfony\Component\Security\Http\Event\InteractiveLoginEvent $event )
$event Symfony\Component\Security\Http\Event\InteractiveLoginEvent

splitHttpAcceptHeader() public méthode

split http accept header
public splitHttpAcceptHeader ( string $header ) : array
$header string
Résultat array

Property Details

$accessMap protected_oe property

protected AccessMapInterface,Symfony\Component\Security\Http $accessMap
Résultat Symfony\Component\Security\Http\AccessMapInterface

$availableLanguages protected_oe property

protected array $availableLanguages
Résultat array

$defaultLocale protected_oe property

protected string $defaultLocale
Résultat string

$router protected_oe property

protected string $router
Résultat string