PHP 클래스 Bolt\Canonical

- Provide a getter to get the canonical url for the current request. - Update the RequestContext with the scheme/host override from the config. Note: Updating the RequestContext also applies to the UrlGenerator.
저자: Carson Full ([email protected])
상속: implements Symfony\Component\EventDispatcher\EventSubscriberInterface
파일 보기 프로젝트 열기: bolt/bolt 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$requestContext Symfony\Component\Routing\RequestContext
$requestStack Symfony\Component\HttpFoundation\RequestStack
$urlGenerator Symfony\Component\Routing\Generator\UrlGeneratorInterface

공개 메소드들

메소드 설명
__construct ( Symfony\Component\HttpFoundation\RequestStack $requestStack, Symfony\Component\Routing\RequestContext $requestContext, Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator, string | null $override = null ) Constructor.
getSubscribedEvents ( )
getUrl ( ) : string | null Returns the canonical url for the current request, or null if called outside of the request cycle.
onRequest ( GetResponseEvent $event ) Sets the scheme and host overrides (if any) on the RequestContext.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( Symfony\Component\HttpFoundation\RequestStack $requestStack, Symfony\Component\Routing\RequestContext $requestContext, Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator, string | null $override = null )
$requestStack Symfony\Component\HttpFoundation\RequestStack
$requestContext Symfony\Component\Routing\RequestContext
$urlGenerator Symfony\Component\Routing\Generator\UrlGeneratorInterface
$override string | null An optional scheme/host override.

getSubscribedEvents() 공개 정적인 메소드

public static getSubscribedEvents ( )

getUrl() 공개 메소드

Returns the canonical url for the current request, or null if called outside of the request cycle.
public getUrl ( ) : string | null
리턴 string | null

onRequest() 공개 메소드

This needs to happen after RouterListener as that sets the scheme and host from the request. To override we need to be after that.
public onRequest ( GetResponseEvent $event )
$event Symfony\Component\HttpKernel\Event\GetResponseEvent

프로퍼티 상세

$requestContext 보호되어 있는 프로퍼티

protected RequestContext,Symfony\Component\Routing $requestContext
리턴 Symfony\Component\Routing\RequestContext

$requestStack 보호되어 있는 프로퍼티

protected RequestStack,Symfony\Component\HttpFoundation $requestStack
리턴 Symfony\Component\HttpFoundation\RequestStack

$urlGenerator 보호되어 있는 프로퍼티

protected UrlGeneratorInterface,Symfony\Component\Routing\Generator $urlGenerator
리턴 Symfony\Component\Routing\Generator\UrlGeneratorInterface