for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace tinymeng\OAuth2\Connector;
use tinymeng\tools\HttpRequest;
trait GatewayTrait
{
/**
* headers
* @var array
*/
protected $headers = [];
* @return array
public function getHeaders(): array
return $this->headers;
}
* @var 缓存处理
缓存处理
0
protected $cache;
* Description: 执行GET请求操作
* @author: JiaMeng <[email protected]>
* Updater:
* @param $url
* @param array $params
* @param array $headers
* @return string
protected function get($url, $params = [], $headers = [])
return HttpRequest::httpGet($url, $params,$headers);
* Description: 执行POST请求操作
* @return mixed
protected function post($url, $params = [], $headers = [])
return HttpRequest::httpPost($url, $params,$headers);
public function setCache($cache)
$this->cache = $cache;
return $this;
protected function getTokenFromCache($key)
return $this->cache ? $this->cache->get($key) : null;
protected function setTokenToCache($key, $token, $expires = 7200)
if ($this->cache) {
$this->cache->set($key, $token, $expires);