Esempio n. 1
0
 /**
  * An array of headers to pass along with the request
  *
  * @param array $headers
  * @return $this
  */
 protected function withHeaders(array $headers)
 {
     $clean = [];
     foreach ($headers as $key => $value) {
         if (!Str::startsWith($key, ['HTTP_', 'CONTENT_'])) {
             $key = 'HTTP_' . $key;
         }
         $clean[$key] = $value;
     }
     $this->headers = array_merge($this->headers, $clean);
     return $this;
 }
 /**
  * Handle dynamic calls.
  *
  * @param  string $method
  * @param  array $args
  * @return mixed
  */
 public function __call($method, $args)
 {
     if (Str::startsWith($method, 'and')) {
         $method = strtolower(substr($method, 3));
         if (method_exists($this, $method)) {
             return call_user_func_array([$this, $method], $args);
         }
     }
     throw new BadMethodCallException("The '{$method}' method does not exist.");
 }