重定向
@param string $url
@param int $time
@return Response
@throws \Exception
776873
public function redirect($url, $time = 0) {
        if (app('request')->wantsJson()) {
            return $this->json([
                'code' => 302,
                'status' => __('failure'),
                'errors' => '重定向',
                'url' => url()->to($url)
            ]);
        }
        return Factory::response()
            ->redirect(url()->to($url), $time);
    }
1105738
public function refresh(String $url = NULL, Int $time = 0, Array $data = NULL, Bool $exit = false)
    {
        $this->location($url, $time, $data, $exit, __FUNCTION__);
    }
1185319
public function getResponseHTTPCode(Url $url)
    {
        try {
            $this->authenticate($url);
            $verb = $url->getOption('verb', 'GET');

            $this
                ->client
                ->request($verb, $url->getPath());

            $result = $this
                ->client
                ->getResponse()
                ->getStatusCode();
        } catch (AccessDeniedHttpException $e) {
            $result = $e->getStatusCode();
        } catch (Exception $e) {
            $result = 'ERR';
        }

        $this->expireAuthentication($url);

        return $result;
    }
621338
public static function info(String $message, String $time = NULL)
	{
		return 	self::report(__FUNCTION__, $message, NULL, $time);
	}
152886
public function touch($file, $time = null)
    {
        global $php_errormsg;

        if (null === $time) {
            $error = @touch($file);
        } else {
            $error = @touch($file, $time);
        }

        if (false === $error) { // FAILED.
            // Add error from php to end of log message. $php_errormsg.
            $msg = "FileSystem::touch() FAILED. Cannot touch '$file'. $php_errormsg";
            throw new Exception($msg);
        }
    }
285913
public static function critical(String $message, String $time = NULL)
	{
		return self::report(__FUNCTION__, $message, NULL, $time);
	}
1005973
public function url($url)
    {
        if (filter_var($url, FILTER_VALIDATE_URL)) {
            return $this->set('CURLOPT_URL', $url)->process();
        }
        throw new Exception('Target URL is required.', 500);
    }
1131682
public static function emergency(String $message, String $time = NULL)
	{
		return self::report(__FUNCTION__, $message, NULL, $time);
	}
1031416
public function timeout($time = null) {
		if ($time !== null) {
			$this->_timeout = $time;
		}
		return $this->_timeout;
	}
715937
private function gateway($url)
	{
        if($this->method == 'POST') {
            $result = $this->createClient()->post($url);
        }
        else {
            $result = $this->createClient()->get($url);
        }

		if($result->getStatusCode() != 200) {
			throw new Exception(trans('location::errors.no_connect'));
		}

		$this->response = $result->getBody()->getContents();

		return $this->response;
	}
741514
public function request(string $method, string $url): Response
    {
        return $this->client->request($method, $url, $this->options);
    }
1136936
public function setTime($time): Timezone
    {
        if (is_string($time)) {
            $time = strtotime($time);
        }

        $this->time = $time - $this->offset;
        return $this;
    }
1209689
public function send($url)
    {
        /** @var $response PageIndexerResponse */
        $response = GeneralUtility::makeInstance(PageIndexerResponse::class);
        $decodedResponse = $this->getUrlAndDecodeResponse($url, $response);

        if ($decodedResponse['requestId'] != $this->requestId) {
            throw new \RuntimeException(
                'Request ID mismatch. Request ID was ' . $this->requestId . ', received ' . $decodedResponse['requestId'] . '. Are requests cached?',
                1351260655
            );
        }

        $response->setRequestId($decodedResponse['requestId']);

        if (!is_array($decodedResponse['actionResults'])) {
            // nothing to parse
            return $response;
        }

        foreach ($decodedResponse['actionResults'] as $action => $actionResult) {
            $response->addActionResult($action, $actionResult);
        }

        return $response;
    }
455742
static function init( $time=null )
    {
        if (self::$start == null || $time != null)
        {
            if ($time == null)
            {
                $time = microtime(true);
            }
            self::$start = $time;
        }
        if (self::$hostname == null)
        {
            self::$hostname = gethostname();
        }
        if (self::$script_name == null && isset($_SERVER['SCRIPT_NAME']))
        {
            self::$script_name = $_SERVER['SCRIPT_NAME'];
        }
        if (self::$server_name == null && isset($_SERVER['SERVER_NAME']))
        {
            self::$server_name = $_SERVER['SERVER_NAME'];
        }
        if ( !self::$shutdown_registered )
        {
            self::$shutdown_registered = true;
            register_shutdown_function('pinba::flush');
        }

    }
952854
public function setUrl($url)
    {
        if (filter_var($url, FILTER_VALIDATE_URL) !== $url) {
            throw new \Exception('Invalid URL: '.$url);
        }
        $this->url = $url;
    }
692876
function onTimer($timerId)
    {
        $now = time();
        //echo "timer $interval\n";
        foreach ($this->wait_requests as $id => $request)
        {
            if ($request->time < $now - $this->request_timeout)
            {
                $response = new Swoole\Response;
                $response->setHeader('Access-Control-Allow-Origin', $this->origin);
                $response->body = json_encode(array('success' => 0, 'text' => 'timeout'));
                $this->response($request, $response);
                unset($this->wait_requests[$id]);
            }
        }
    }
606351
public function request($url)
    {
        try {
            $resp = $this->guzzle->get($url);
            return (string) $resp->getBody();
        } catch (RequestException $e) {
            $response = $e->getResponse();
            throw new HttpException($response ? $response->getBody() : null, $e->getMessage(), $e->getCode(), $e);
        } catch (TransferException $e) {
            throw new HttpException('', $e->getMessage(), $e->getCode(), $e);
        }
    }