@param SitemapPopulateEvent $event

@throws \InvalidArgumentException
349983
private function addUrlsFromRoutes(SitemapPopulateEvent $event)
    {
        $collection = $this->getRouteCollection();
        $container = $event->getUrlContainer();

        foreach ($collection->all() as $name => $route) {
            $options = $this->getOptions($name, $route);

            if (!$options) {
                continue;
            }

            $section = $event->getSection() ?: $this->defaultSection;
            if (isset($options['section'])) {
                $section = $options['section'];
            }

            $container->addUrl(
                $this->getUrlConcrete($name, $options),
                $section
            );
        }
    }
1115665
public function addRequestAttributes(FilterViewBuilderParametersEvent $event)
    {
        $request = $event->getRequest();

        if (!$this->isAdmin($request)) {
            return;
        }

        $parameterBag = $event->getParameters();

        if ($parameterBag->has('locationId') && null !== $parameterBag->get('locationId')) {
            $location = $this->loadLocation($parameterBag->get('locationId'));
            $parameterBag->set('location', $location);
        }

        if ($this->hasContentLanguage($request, $parameterBag)) {
            /** @var Location $location */
            $location = $parameterBag->get('location');

            $languageCode = $parameterBag->get('languageCode') ?? $location->contentInfo->mainLanguageCode;

            $content = $this->loadContent($location->contentInfo->id, $languageCode);
            $parameterBag->set('content', $content);
        }
    }
1348862
public function setEvent($event)
    {
        $allowedValues = $this->getEventAllowableValues();
        if (!in_array($event, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'event', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['event'] = $event;

        return $this;
    }
94741
public function onInit(SiteInitEvent $event)
    {
        // Naive alias lookup for the current page
        $site       = $event->getSite();
        $request    = $event->getRequest();
        $incomming  = $request->query->get('q');

        $nodeId = $this->service->getAliasManager()->matchPath($incomming, $site->getId());
        if ($nodeId) {
            // $_GET['q'] reference will be useless for Drupal 8
            $_GET['q'] = $incomming = 'node/' . $nodeId;
            $request->query->set('q', $incomming);
            $request->attributes->set('_route', $incomming);
        }

        // Set current context to the alias manager
        $this
            ->service
            ->getAliasCacheLookup()
            ->setEnvironment(
                $site->getId(),
                $incomming,
                $request->query->all()
            )
        ;
    }
813123
public static function onFlushPage(Event $event)
    {
        if (self::$onFlushPageAlreadyCalled) {
            return;
        }

        $page = $event->getTarget();
        if (!($page instanceof Page)) {
            return;
        }

        $application = $event->getApplication();
        $em = $application->getEntityManager();
        $uow = $em->getUnitOfWork();
        if ($uow->isScheduledForDelete($page)) {
            return;
        }

        $metadata = $application->getContainer()->get('nestednode.metadata.resolver')->resolve($page);
        $page->setMetaData($metadata);

        if ($uow->isScheduledForInsert($page) || $uow->isScheduledForUpdate($page)) {
            $uow->recomputeSingleEntityChangeSet($em->getClassMetadata('BackBee\NestedNode\Page'), $page);
        } elseif (!$uow->isScheduledForDelete($page)) {
            $uow->computeChangeSet($em->getClassMetadata('BackBee\NestedNode\Page'), $page);
        }

        self::$onFlushPageAlreadyCalled = true;
    }
713573
final protected function raise(DomainEvent $event) : void
    {
        $this->setStateHash($this->calculateNextStateHash($event));
        if ($event instanceof AbstractDomainEvent) {
            AbstractDomainEvent::initEvent($event, $this->getId(), $this->stateHash());
        }
        EventPublisher::instance()->post($event);
    }
97804
public function onSiteCreate(SiteEvent $event)
    {
        $site = $event->getSite();

        $this->service->getNotificationService()->subscribe('site', $site->getId(), $site->getOwnerUserId());
    }
707011
public function handlePublish(AbstractMappingEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof PageDocument || !$this->hasChangedResourceSegment($document)) {
            return;
        }

        $this->routeUpdater->update($document);
    }
1111032
public function onKernelRequest(GetResponseEvent $event)
    {
        $this->setUpRequiredFolders();
        $this->setUpPageTree();
        $this->checkTemplatesSlots();
        $this->setupBootstrapVersion();
        $this->setupConfiguration();
    }
775562
public function checkOptions(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticlePageDocument) {
            return;
        }

        $autoRename = $event->getOption('auto_rename');

        if (false !== $autoRename) {
            throw new \InvalidArgumentException('Persist "ArticlePageDocument" only with option "auto_rename" set to "false" allowed');
        }
    }
243346
public function setInvitedLink(TimelineLinkEvent $event): void
    {
        $action = $event->getAction();

        if ('invited' != $action->getVerb()) {
            return;
        }

        $event = $action->getComponent('indirectComplement')->getData();
        $event->setLink($this->url_generator->generate('bkstg_event_read', [
            'id' => $event->getId(),
            'production_slug' => $event->getGroups()[0]->getSlug(),
        ]));
    }
205344
public function setResponseEvent(ResponseEvent $responseEvent): void
    {
        if ($this->responseEvent) {
            throw new InvalidArgumentException('Call already responded.');
        }

        $responseEvent->setCall($this);
        $this->responseEvent = $responseEvent;
    }
695870
protected function populate($section = null)
    {
        $event = new SitemapPopulateEvent($this, $section);
        $this->dispatcher->dispatch(SitemapPopulateEvent::ON_SITEMAP_POPULATE, $event);
    }
1179065
public function handleMap(MapEvent $event)
    {
        $formatter = $this->getFormatter();
        $map = $event->getMap();

        foreach ($this->pointCollector->collect($map) as $point) {
            $event->addCode($formatter->renderContainerAssignment(
                $map,
                $this->pointRenderer->render($point),
                'base.points',
                $point
            ));
        }
    }
833949
public function preUpdate(MenuInterface $menu, PreUpdateEventArgs $event)
    {
        if (null !== $page = $menu->getPage()) {
            $event->setNewValue('route', $page->getRoute());
        }
        if ($event->hasChangedField('name') && !preg_match(self::NAME_REGEX, $name = $event->getNewValue('name'))) {
            $event->setNewValue('name', Transliterator::urlize(strtolower($name), '_'));
        }
    }
429150
public function checkSiteAccessPermission(BaseInteractiveLoginEvent $event)
    {
        $token = $event->getAuthenticationToken();
        $originalUser = $token->getUser();
        $request = $event->getRequest();
        $siteAccess = $request->attributes->get('siteaccess');
        if (!($originalUser instanceof eZUser && $siteAccess instanceof SiteAccess)) {
            return;
        }

        if (!$this->hasAccess($siteAccess, $originalUser->getUsername())) {
            throw new UnauthorizedSiteAccessException($siteAccess, $originalUser->getUsername());
        }
    }
1012513
public function onPageRendering(BeforePageRenderingEvent $event)
    {
        $response = $event->getResponse();

        $slotContents = $this->renderSlotContents();
        
        if (!is_array($slotContents)) {
            throw new \InvalidArgumentException('"renderSlotContents" method must return an array');
        }

        foreach ($slotContents as $slotContent) {
            $this->renderSlot($response, $slotContent);
        }

        $event->setResponse($response);
    }