Ejemplo n.º 1
0
 public function testRequestAllowsSettingOfParameterContainer()
 {
     $request = new Request();
     $p = new \Zend\Stdlib\Parameters();
     $request->setQuery($p);
     $request->setPost($p);
     $request->setFile($p);
     $request->setServer($p);
     $request->setEnv($p);
     $this->assertSame($p, $request->query());
     $this->assertSame($p, $request->post());
     $this->assertSame($p, $request->file());
     $this->assertSame($p, $request->server());
     $this->assertSame($p, $request->env());
 }
Ejemplo n.º 2
0
 /**
  * HTTP GET METHOD (static)
  *
  * @param  string $url
  * @param  array $query
  * @param  array $headers
  * @return Response|boolean
  */
 public static function get($url, $query = array(), $headers = array(), $body = null)
 {
     if (empty($url)) {
         return false;
     }
     $request = new Request();
     $request->setUri($url);
     $request->setMethod(Request::METHOD_GET);
     if (!empty($query) && is_array($query)) {
         $request->query()->fromArray($query);
     }
     if (!empty($headers) && is_array($headers)) {
         $request->headers()->addHeaders($headers);
     }
     if (!empty($body)) {
         $request->setBody($body);
     }
     return self::getStaticClient()->send($request);
 }