Ejemplo n.º 1
0
 public function testAssembleWithPort()
 {
     $params = new Parameters(array('SERVER_NAME' => 'test.co.uk', 'SERVER_PORT' => 8080));
     $request = new Request();
     $request->setServer($params);
     $event = new LocaleEvent();
     $event->setLocale('de_DE');
     $event->setUri(new Uri('http://test.co.uk'));
     $event->setRequest($request);
     $strategy = new HostStrategy();
     $strategy->setOptions(array('domain' => 'test.:locale', 'aliases' => array('de' => 'de_DE', 'co.uk' => 'en_GB')));
     $result = $strategy->assemble($event)->getHost();
     $this->assertSame('test.de:8080', $result);
 }
Ejemplo n.º 2
0
 public function assemble($locale, $uri)
 {
     $event = new LocaleEvent(LocaleEvent::EVENT_ASSEMBLE, $this);
     $event->setLocale($locale);
     if ($this->hasSupported()) {
         $event->setSupported($this->getSupported());
     }
     if (!$uri instanceof Uri) {
         $uri = new Uri($uri);
     }
     $event->setUri($uri);
     $events = $this->getEventManager();
     $results = $events->trigger($event);
     if (!$results->stopped()) {
         return $uri;
     }
     return $results->last();
 }