本文整理汇总了PHP中eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest类的典型用法代码示例。如果您正苦于以下问题:PHP SimplifiedRequest类的具体用法?PHP SimplifiedRequest怎么用?PHP SimplifiedRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SimplifiedRequest类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAnalyseLink
public function testAnalyseLink()
{
$siteAccessURI = '/footestbar';
$semanticURI = '/something/hoho';
$matcher = new URITextMatcher(array('prefix' => 'foo', 'suffix' => 'bar'));
$matcher->setRequest(SimplifiedRequest::fromUrl('http://phoenix-rises.fm/footestbar/blabla'));
$this->assertSame($siteAccessURI . $semanticURI, $matcher->analyseLink($semanticURI));
}
示例2: matchProvider
public function matchProvider()
{
return array(array(SimplifiedRequest::fromUrl('http://example.com'), 'default_sa'), array(SimplifiedRequest::fromUrl('https://example.com'), 'default_sa'), array(SimplifiedRequest::fromUrl('http://example.com/'), 'default_sa'), array(SimplifiedRequest::fromUrl('https://example.com/'), 'default_sa'), array(SimplifiedRequest::fromUrl('http://example.com//'), 'default_sa'), array(SimplifiedRequest::fromUrl('https://example.com//'), 'default_sa'), array(SimplifiedRequest::fromUrl('http://example.com:8080/'), 'default_sa'), array(SimplifiedRequest::fromUrl('http://example.com/first_siteaccess/'), 'first_siteaccess'), array(SimplifiedRequest::fromUrl('http://example.com/?first_siteaccess'), 'default_sa'), array(SimplifiedRequest::fromUrl('http://example.com/?first_sa'), 'default_sa'), array(SimplifiedRequest::fromUrl('http://example.com/first_salt'), 'first_salt'), array(SimplifiedRequest::fromUrl('http://example.com/first_sa.foo'), 'first_sa.foo'), array(SimplifiedRequest::fromUrl('http://example.com/test'), 'test'), array(SimplifiedRequest::fromUrl('http://example.com/test/foo/'), 'test'), array(SimplifiedRequest::fromUrl('http://example.com/test/foo/bar/'), 'test'), array(SimplifiedRequest::fromUrl('http://example.com/test/foo/bar/first_sa'), 'test'), array(SimplifiedRequest::fromUrl('http://example.com/default_sa'), 'default_sa'), array(SimplifiedRequest::fromUrl('http://example.com/first_sa'), 'first_sa'), array(SimplifiedRequest::fromUrl('http://example.com/first_sa/'), 'first_sa'), array(SimplifiedRequest::fromUrl('http://example.com//first_sa//'), 'default_sa'), array(SimplifiedRequest::fromUrl('http://example.com///first_sa///test'), 'default_sa'), array(SimplifiedRequest::fromUrl('http://example.com//first_sa//foo/bar'), 'default_sa'), array(SimplifiedRequest::fromUrl('http://example.com/first_sa/foo'), 'first_sa'), array(SimplifiedRequest::fromUrl('http://example.com:82/first_sa/'), 'first_sa'), array(SimplifiedRequest::fromUrl('http://third_siteaccess/first_sa/'), 'first_sa'), array(SimplifiedRequest::fromUrl('http://first_sa/'), 'first_sa'), array(SimplifiedRequest::fromUrl('https://first_sa/'), 'first_sa'), array(SimplifiedRequest::fromUrl('http://first_sa:81/'), 'first_sa'), array(SimplifiedRequest::fromUrl('http://first_siteaccess/'), 'first_sa'), array(SimplifiedRequest::fromUrl('http://first_siteaccess:82/'), 'first_sa'), array(SimplifiedRequest::fromUrl('http://first_siteaccess:83/'), 'first_sa'), array(SimplifiedRequest::fromUrl('http://first_siteaccess/foo/'), 'foo'), array(SimplifiedRequest::fromUrl('http://first_siteaccess:82/foo/'), 'foo'), array(SimplifiedRequest::fromUrl('http://first_siteaccess:83/foo/'), 'foo'), array(SimplifiedRequest::fromUrl('http://example.com/second_sa'), 'second_sa'), array(SimplifiedRequest::fromUrl('http://example.com/second_sa/'), 'second_sa'), array(SimplifiedRequest::fromUrl('http://example.com/second_sa?param1=foo'), 'second_sa'), array(SimplifiedRequest::fromUrl('http://example.com/second_sa/foo/'), 'second_sa'), array(SimplifiedRequest::fromUrl('http://example.com:82/second_sa/'), 'second_sa'), array(SimplifiedRequest::fromUrl('http://example.com:83/second_sa/'), 'second_sa'), array(SimplifiedRequest::fromUrl('http://first_siteaccess:82/second_sa/'), 'second_sa'), array(SimplifiedRequest::fromUrl('http://first_siteaccess:83/second_sa/'), 'second_sa'));
}
示例3: matchProvider
public function matchProvider()
{
return array(array(SimplifiedRequest::fromUrl('http://fr.ezpublish.dev/eng'), 'fr_eng'), array(SimplifiedRequest::fromUrl('http://ezpublish.dev/eng'), 'fr_eng'), array(SimplifiedRequest::fromUrl('http://fr.ezpublish.dev/fre'), 'fr_eng'), array(SimplifiedRequest::fromUrl('http://fr.ezpublish.dev/'), 'fr_eng'), array(SimplifiedRequest::fromUrl('http://us.ezpublish.dev/eng'), 'fr_eng'), array(SimplifiedRequest::fromUrl('http://us.ezpublish.dev/foo'), false), array(SimplifiedRequest::fromUrl('http://us.ezpublish.dev/fre'), 'fr_jp'), array(SimplifiedRequest::fromUrl('http://jp.ezpublish.dev/foo'), 'fr_jp'), array(SimplifiedRequest::fromUrl('http://ezpublish.dev/fr'), false));
}
示例4: matchProvider
public function matchProvider()
{
return array(array(SimplifiedRequest::fromUrl("http://example.com"), "default_sa"), array(SimplifiedRequest::fromUrl("https://example.com"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/"), "default_sa"), array(SimplifiedRequest::fromUrl("https://example.com/"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com//"), "default_sa"), array(SimplifiedRequest::fromUrl("https://example.com//"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com:8080/"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_siteaccess/"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/?first_siteaccess"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/?first_sa"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_salt"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_sa.foo"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/test"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/test/foo/"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/test/foo/bar/"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/test/foo/bar/first_sa"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/default_sa"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_sa"), "first_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_sa/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_sa//"), "first_sa"), array(SimplifiedRequest::fromUrl("http://example.com//first_sa//"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_sa///test"), "first_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_sa/foo"), "first_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_sa/foo/bar"), "first_sa"), array(SimplifiedRequest::fromUrl("http://example.com:82/first_sa/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://third_siteaccess/first_sa/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://first_sa/"), "first_sa"), array(SimplifiedRequest::fromUrl("https://first_sa/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://first_sa:81/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://first_siteaccess/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://first_siteaccess:82/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://first_siteaccess:83/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://first_siteaccess/foo/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://first_siteaccess:82/foo/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://first_siteaccess:83/foo/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://example.com/second_sa"), "second_sa"), array(SimplifiedRequest::fromUrl("http://example.com/second_sa/"), "second_sa"), array(SimplifiedRequest::fromUrl("http://example.com/second_sa?param1=foo"), "second_sa"), array(SimplifiedRequest::fromUrl("http://example.com/second_sa/foo/"), "second_sa"), array(SimplifiedRequest::fromUrl("http://example.com:82/second_sa/"), "second_sa"), array(SimplifiedRequest::fromUrl("http://example.com:83/second_sa/"), "second_sa"), array(SimplifiedRequest::fromUrl("http://first_siteaccess:82/second_sa/"), "second_sa"), array(SimplifiedRequest::fromUrl("http://first_siteaccess:83/second_sa/"), "second_sa"), array(SimplifiedRequest::fromUrl("http://example.com:81/"), "third_sa"), array(SimplifiedRequest::fromUrl("https://example.com:81/"), "third_sa"), array(SimplifiedRequest::fromUrl("http://example.com:81/foo"), "third_sa"), array(SimplifiedRequest::fromUrl("http://example.com:81/foo/bar"), "third_sa"), array(SimplifiedRequest::fromUrl("http://example.com:82/"), "fourth_sa"), array(SimplifiedRequest::fromUrl("https://example.com:82/"), "fourth_sa"), array(SimplifiedRequest::fromUrl("https://example.com:82/foo"), "fourth_sa"), array(SimplifiedRequest::fromUrl('http://fr.ezpublish.dev/eng'), 'fr_eng'), array(SimplifiedRequest::fromUrl('http://us.ezpublish.dev/fre'), 'fr_us'));
}
示例5: testFromUrl
/**
* @param string $url
* @param \eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest $expectedRequest
*
* @dataProvider fromUrlProvider
* @covers \eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest::fromUrl
*/
public function testFromUrl($url, $expectedRequest)
{
self::assertEquals($expectedRequest, SimplifiedRequest::fromUrl($url));
}
示例6: matchProvider
public function matchProvider()
{
return array(array(SimplifiedRequest::fromUrl("http://example.com"), "default_sa"), array(SimplifiedRequest::fromUrl("https://example.com"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/"), "default_sa"), array(SimplifiedRequest::fromUrl("https://example.com/"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com//"), "default_sa"), array(SimplifiedRequest::fromUrl("https://example.com//"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com:8080/"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_siteaccess/"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/?first_siteaccess"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/?first_sa"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_salt"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_sa.foo"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/test"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/test/foo/"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/test/foo/bar/"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/test/foo/bar/first_sa"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/default_sa"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_sa"), "first_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_sa/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://example.com//first_sa//"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com///first_sa///test"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com//first_sa//foo/bar"), "default_sa"), array(SimplifiedRequest::fromUrl("http://example.com/first_sa/foo"), "first_sa"), array(SimplifiedRequest::fromUrl("http://example.com:82/first_sa/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://third_siteaccess/first_sa/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://first_sa/"), "first_sa"), array(SimplifiedRequest::fromUrl("https://first_sa/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://first_sa:81/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://first_siteaccess/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://first_siteaccess:82/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://first_siteaccess:83/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://first_siteaccess/foo/"), "first_sa"), array(SimplifiedRequest::fromUrl("http://www.example.com/"), "example"), array(SimplifiedRequest::fromUrl("https://www.example.com/"), "example"), array(SimplifiedRequest::fromUrl("http://www.example.com:81/"), "example"), array(SimplifiedRequest::fromUrl("http://www.example.com/"), "example"), array(SimplifiedRequest::fromUrl("http://www.example.com:82/"), "example"), array(SimplifiedRequest::fromUrl("https://www.example.com:83/"), "example"), array(SimplifiedRequest::fromUrl("http://www.example.com/foo/"), "example"), array(SimplifiedRequest::fromUrl("http://example.com/second_sa"), "second_sa"), array(SimplifiedRequest::fromUrl("http://example.com/second_sa/"), "second_sa"), array(SimplifiedRequest::fromUrl("http://example.com/second_sa?param1=foo"), "second_sa"), array(SimplifiedRequest::fromUrl("http://example.com/second_sa/foo/"), "second_sa"), array(SimplifiedRequest::fromUrl("http://example.com:82/second_sa/"), "second_sa"), array(SimplifiedRequest::fromUrl("http://example.com:83/second_sa/"), "second_sa"), array(SimplifiedRequest::fromUrl("http://first_siteaccess:82/second_sa/"), "second_sa"), array(SimplifiedRequest::fromUrl("http://first_siteaccess:83/second_sa/"), "second_sa"));
}
示例7: matchProvider
public function matchProvider()
{
return array(
array( SimplifiedRequest::fromUrl( "http://example.com" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "https://example.com" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "https://example.com/" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com//" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "https://example.com//" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com:8080/" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/first_siteaccess/" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/?first_siteaccess" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/?first_sa" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/first_salt" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/first_sa.foo" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/test" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/test/foo/" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/test/foo/bar/" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/test/foo/bar/first_sa" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/default_sa" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/first_sa" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/first_sa/" ), "first_sa" ),
// Double slashes shouldn't be considered as one
array( SimplifiedRequest::fromUrl( "http://example.com//first_sa//" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com///first_sa///test" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com//first_sa//foo/bar" ), "default_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/first_sa/foo" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com:82/first_sa/" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://third_siteaccess/first_sa/" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://first_sa/" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "https://first_sa/" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://first_sa:81/" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess/" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess:82/" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess:83/" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess/foo/" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess:82/foo/" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess:83/foo/" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess/foobar/" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess//foobar/" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess//footestbar/" ), "first_sa" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess/footestbar/" ), "test" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess/footestbar/foobazbar/" ), "test" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess:82/footestbar/" ), "test" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess:83/footestbar/" ), "test" ),
array( SimplifiedRequest::fromUrl( "http://example.com/second_sa" ), "second_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/second_sa/" ), "second_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/second_sa?param1=foo" ), "second_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com/second_sa/foo/" ), "second_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com:82/second_sa/" ), "second_sa" ),
array( SimplifiedRequest::fromUrl( "http://example.com:83/second_sa/" ), "second_sa" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess:82/second_sa/" ), "second_sa" ),
array( SimplifiedRequest::fromUrl( "http://first_siteaccess:83/second_sa/" ), "second_sa" ),
);
}
示例8: reverseMatchProvider
public function reverseMatchProvider()
{
return array(array('foo', 1, SimplifiedRequest::fromUrl('http://bar.example.com/'), 'foo.example.com'), array('ezdemo_site', 1, SimplifiedRequest::fromUrl('http://ezflow_site.ez.no/'), 'ezdemo_site.ez.no'), array('metalfrance', 2, SimplifiedRequest::fromUrl('http://www.lolart.net/'), 'www.metalfrance.net'), array('fm', 3, SimplifiedRequest::fromUrl('http://www.phoenix-rises.fr/'), 'www.phoenix-rises.fm'));
}
示例9: reverseMatch
public function reverseMatch($siteAccessName)
{
$hostElements = explode('.', $this->request->host);
$elementNumber = $this->elementNumber - 1;
if (!isset($hostElements[$elementNumber])) {
return null;
}
$hostElements[$elementNumber] = $siteAccessName;
$this->request->setHost(implode('.', $hostElements));
return $this;
}
示例10: reverseMatch
/**
* Returns matcher object corresponding to $siteAccessName or null if non applicable.
*
* Limitation: If the element number is > 1, we cannot predict how URI segments are expected to be built.
* So we expect "_" will be reversed to "/"
* e.g. foo_bar => foo/bar with elementNumber == 2
* Hence if number of elements is different than the element number, we report as non matched.
*
* @param string $siteAccessName
*
* @return \eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\URIElement|null
*/
public function reverseMatch($siteAccessName)
{
$elements = $this->elementNumber > 1 ? explode('_', $siteAccessName) : array($siteAccessName);
if (count($elements) !== $this->elementNumber) {
return null;
}
$pathinfo = '/' . implode('/', $elements) . '/' . ltrim($this->request->pathinfo, '/');
$this->request->setPathinfo($pathinfo);
return $this;
}