/** * Test the query extract * * @param string $uriString * @param array $parts * @dataProvider validUriStringProviderWithPart */ public function testQueries(string $uriString, array $parts) { $uri = new Uri($uriString); if (array_key_exists('queries', $parts)) { $this->assertEquals($parts['queries'], $uri->getQueries()); } else { $this->assertEmpty($uri->getQueries()); } }
/** * @return array */ public function getQueries() : array { return $this->uri->getQueries(); }
/** * */ 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)); } } }