Ejemplo n.º 1
0
 /**
  * Test InvalidArgumentException on removeQueries
  */
 public function testRemoveQuerystringException()
 {
     $this->setExpectedException('InvalidArgumentException');
     $uri = new Uri('http://example.com/?test=1');
     $uri->removeQueries([1]);
 }
Ejemplo n.º 2
0
 /**
  *
  */
 protected function alterBeforeRender()
 {
     if ($this->csrf) {
         $this->addCsrf();
     }
     // remove all questring of current form
     if ($this->getMethod() == 'GET') {
         $this->add(new Hidden($this->getName(), '1'));
         $uri = new Uri($this->getAction());
         if ($uri->getQueries()) {
             $remove = [];
             foreach ($uri->getQueries() as $key => $value) {
                 if (isset($this->values[$key]) || isset($this->values[$key . '[]'])) {
                     $remove[] = $key;
                 }
             }
             $this->setAction((string) $uri->removeQueries($remove));
         }
     }
 }