Sets the method and url and executes a user closure function if given
@param string $url
@param object $closure
@param string $method
@return sFire\HTTP\Client
489614
private function method($url, $closure, $method) {
			
		if(false === is_string($url)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($url)), E_USER_ERROR);
		}

		if(false === is_string($method)) {
			return trigger_error(sprintf('Argument 3 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($method)), E_USER_ERROR);
		}

		$this -> method = $method;
		$this -> url 	= new URLParser($url);
		$this -> options[CURLOPT_CUSTOMREQUEST] = strtoupper($method);

		if(is_object($closure)) {
			call_user_func($closure, $this);
		}

		$this -> send();

		return $this;
	}
884780
public function send($method, $url)
    {
        $this->request = $this->requestFactory->createRequest($method, $this->prepareUrl($url), $this->headers);

        $this->sendRequest();
    }
393917
public function bindCallback(Closure $callback, $query = null) {
        call_user_func_array($callback, [$this, $query]);

        return $this;
    }
190815
protected function setMethod($method) {
        switch ($method) {
            case self::HTTP_METHOD_DELETE:
            case self::HTTP_METHOD_GET:
            case self::HTTP_METHOD_HEAD:
            case self::HTTP_METHOD_OPTIONS:
            case self::HTTP_METHOD_PATCH:
            case self::HTTP_METHOD_POST:
            case self::HTTP_METHOD_PUT:
                $this->method = $method;
                break;
            default:
                throw new InvalidHTTPMethodException($method);
        }
        return $this;
    }
283709
public function byClosure(Closure $closure)
    {
        $this->controller = new Controller();
        if ($this->hasContainer() && method_exists($this->controller, 'raikiri'))
            $this->controller->setContainer($this->raikiri());

        $this->action = $closure->bindTo($this->controller);
    }
908683
public function request($url, $method = 'GET', $options = [])
    {
        $method = strtoupper($method);

        $options = array_merge(self::$defaults, $options);

        Log::debug('Client Request:', compact('url', 'method', 'options'));

        $options['handler'] = $this->getHandler();

        if (property_exists($this, 'baseUri') && !is_null($this->baseUri)) {
            $options['base_uri'] = $this->baseUri;
        }

        $response = $this->getClient()->request($method, $url, $options);

        Log::debug('API response:', [
            'Status' => $response->getStatusCode(),
            'Reason' => $response->getReasonPhrase(),
            'Headers' => $response->getHeaders(),
            'Body' => strval($response->getBody()),
        ]);

        return $response;
    }
176406
protected function createCallback(string $method): \Closure
    {
        return \Closure::bind(static function (...$args) use ($method) {
            return self::$method(...$args);
        }, null, $this->type);
    }
1251018
public static HttpResponse execute(final String url, final String method) {
        return execute(url, method, null, null, new HashMap<>(), new HashMap<>());
    }
345670
public function set( $method )
	{
		$method		= strtoupper( $method );
		if( !in_array( $method, self::$methods ) )
			throw new BadMethodCallException( 'HTTP method "%s" is not supported' );
		$this->method	= $method;
		return $this;
	}
914944
public function bind(string $class, string $method, Closure $closure)
  {
    if (!class_exists($class)) throw new ClassDoesNotExistException("Class {$class} does not exist");

    if (!in_array(
      Extendable::class,
      array_keys((new ReflectionClass($class))->getTraits()))
    ) {
      throw new CannotExtendClassException("Cannot extend \"{$class}::class\"");
    }

    return $class::bind($method, $closure);
  }
1245252
public static function setMethod($method) {

		if(false === is_string($method)) {
  			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($method)), E_USER_ERROR);
  		}

		$_SERVER['REQUEST_METHOD'] = strtoupper($method);
	}
1302374
public function handle($request, Closure $next)
    {
        $reauth = new ReauthLimiter($request);

        if (!$reauth->check()) {
            $request->session()->put('url.intended', $request->url());

            return $this->invalidated($request);
        }

        return $next($request);
    }
744816
protected function setOptions($url, $method, $params, $vars) {
    if(!empty($params)) {
      $url = $url . "?" . http_build_query($params);
    }

    curl_setopt($this->request, CURLOPT_URL, $url);
    curl_setopt($this->request, CURLOPT_HEADER, true);
    curl_setopt($this->request, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($this->request, CURLOPT_FOLLOWLOCATION, true);

    if (in_array($method, array('POST', 'PUT')) || ($method == 'GET' && !empty($vars))) {
      $this->setJSONPayload($vars);
    }

    $headers = array();
    foreach ($this->headers as $key => $value) {
      $headers[] = $key . ':' . $value;
    }

    curl_setopt($this->request, CURLOPT_HTTPHEADER, $headers);
  }
516736
public function client($name, Closure $closure = null)
    {
        if ($this->has($name)) {
            /** @var Service $service */
            $service = $this->services[$name];

            if (is_null($service->getClient())) {
                $client = new Client($service->getWsdl(), $service->getOptions(), $service->getHeaders());
              
                $service->client($client);
            } else {
                $client = $service->getClient();
            }

            return $closure($client);
        }

        throw new ServiceNotFound("Service '" . $name . "' not found.");
    }
589505
public function closureWrapper($closure)
    {
        $dependentService = $this->container->dependentService;
        return function (...$args) use ($closure, $dependentService) {
            return $dependentService->call($closure, $args);
        };
    }
396975
public function handle($request, Closure $next)
    {
        //dd("SecureURL and config = ".Config::get('lasallecmsfrontend.secureURL'));

        if ( (Config::get('lasallecmsfrontend.secureURL')) && (!$request->secure()) ) {
           // return redirect()->secure($request->getRequestUri());
            return redirect("https://{$_SERVER['HTTP_HOST']}" . $request->getRequestUri());
        }

        return $next($request);
    }
1126903
public function run($url = null, $method = null)
    {
        $route = $this->altoRouter->match($url, $method);
        if (!$route) {
            throw new NotFoundException(((isset($_SERVER['REQUEST_URI']) && !empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : (($url != null) ? $url : "/")) . " is not reachable.");
        }
        if (!isset($route['target']['c']) || !isset($route['target']['a']) || !isset($route['params'])) {
            throw new FrameworkException('Internal Framework Error. [!BAD_ROUTER_TARGET]', 001);
        }
        if (is_callable(array($route['target']['c'], 'getInstance'))) {
            $controller = $route['target']['c']::getInstance();
            if (method_exists($controller, $route['target']['a'])) {
                call_user_func(array($controller, $route['target']['a']), array_values($route['params']));
                $controller->response->send();
            } else {
                throw new FrameworkException('Internal Framework Error. [METHOD_DOES_NOT_EXISTS]', 002);
            }
        } else {
            throw new FrameworkException('Internal Framework Error. [CONTROLLER_DOES_NOT_EXISTS]', 003);
        }
    }