Sulu\Component\Webspace\Manager\WebspaceManager::findPortalInformationByUrl PHP Метод

findPortalInformationByUrl() публичный Метод

public findPortalInformationByUrl ( $url, $environment )
    public function findPortalInformationByUrl($url, $environment)
    {
        $portalInformations = $this->getWebspaceCollection()->getPortalInformations($environment);
        foreach ($portalInformations as $portalInformation) {
            if ($this->matchUrl($url, $portalInformation->getUrl())) {
                return $portalInformation;
            }
        }
        return;
    }

Usage Example

Пример #1
0
 public function testRedirectUrl()
 {
     $portalInformation = $this->webspaceManager->findPortalInformationByUrl('www.sulu.at/test/test', 'prod');
     $this->assertEquals('sulu.at', $portalInformation->getRedirect());
     $this->assertEquals('www.sulu.at', $portalInformation->getUrl());
     /** @var Webspace $webspace */
     $webspace = $portalInformation->getWebspace();
     $this->assertEquals('Sulu CMF', $webspace->getName());
     $this->assertEquals('sulu_io', $webspace->getKey());
     $this->assertEquals('sulu_io', $webspace->getSecurity()->getSystem());
     $this->assertCount(2, $webspace->getLocalizations());
     $this->assertEquals('en', $webspace->getLocalizations()[0]->getLanguage());
     $this->assertEquals('us', $webspace->getLocalizations()[0]->getCountry());
     $this->assertEquals('auto', $webspace->getLocalizations()[0]->getShadow());
     $this->assertEquals('de', $webspace->getLocalizations()[1]->getLanguage());
     $this->assertEquals('at', $webspace->getLocalizations()[1]->getCountry());
     $this->assertEquals('', $webspace->getLocalizations()[1]->getShadow());
     $this->assertEquals('sulu', $webspace->getTheme()->getKey());
 }