getQuery() public method

public getQuery ( ) : string
return string
コード例 #1
0
ファイル: UriTest.php プロジェクト: amphp/artax
 /**
  * @dataProvider provideUris
  */
 public function testUri($rawUri, $expectedVals)
 {
     $uri = new Uri($rawUri);
     $this->assertEquals($expectedVals['scheme'], $uri->getScheme());
     $this->assertEquals($expectedVals['host'], $uri->getHost());
     $this->assertEquals($expectedVals['user'], $uri->getUser());
     $this->assertEquals($expectedVals['pass'], $uri->getPass());
     $this->assertEquals($expectedVals['port'], $uri->getPort());
     $this->assertEquals($expectedVals['path'], $uri->getPath());
     $this->assertEquals($expectedVals['query'], $uri->getQuery());
     $this->assertEquals($expectedVals['fragment'], $uri->getFragment());
 }
コード例 #2
0
ファイル: Client.php プロジェクト: softwarevamp/artax
 /**
  * @TODO Send absolute URIs in the request line when using a proxy server
  *       Right now this doesn't matter because all proxy requests use a CONNECT
  *       tunnel but this likely will not always be the case.
  */
 private function generateRawRequestHeaders(Request $request)
 {
     $uri = $request->getUri();
     $uri = new Uri($uri);
     $requestUri = $uri->getPath() ?: '/';
     if ($query = $uri->getQuery()) {
         $requestUri .= '?' . $query;
     }
     $str = $request->getMethod() . ' ' . $requestUri . ' HTTP/' . $request->getProtocol() . "\r\n";
     foreach ($request->getAllHeaders() as $field => $valueArr) {
         foreach ($valueArr as $value) {
             $str .= "{$field}: {$value}\r\n";
         }
     }
     $str .= "\r\n";
     return $str;
 }