Commit 2ab88f78 authored by tufengqi's avatar tufengqi

格式化代码

parent a7f959fd
......@@ -101,8 +101,8 @@ class TCurlClient extends \Thrift\Transport\TTransport
*/
public function __construct($host, $port = 80, $uri_no_func = '', $scheme = 'http')
{
if ((TStringFuncFactory::create()->strlen($uri_no_func) > 0) && ($uri_no_func {
0} != '/')) {
if ((TStringFuncFactory::create()->strlen($uri_no_func) > 0) && ($uri_no_func{
0} != '/')) {
$uri_no_func = '/' . $uri_no_func;
}
$this->scheme_ = $scheme;
......
......@@ -103,8 +103,8 @@ class TGuzzleClient extends \Thrift\Transport\TTransport
*/
public function __construct($host, $port = 80, $uri_no_func = '', $scheme = 'http')
{
if ((TStringFuncFactory::create()->strlen($uri_no_func) > 0) && ($uri_no_func {
0} != '/')) {
if ((TStringFuncFactory::create()->strlen($uri_no_func) > 0) && ($uri_no_func{
0} != '/')) {
$uri_no_func = '/' . $uri_no_func;
}
$this->scheme_ = $scheme;
......@@ -202,7 +202,7 @@ class TGuzzleClient extends \Thrift\Transport\TTransport
*/
public function flush()
{
// God, PHP really has some esoteric ways of doing simple things.
// God, PHP really has some esoteric ways of doing simple things.
$host = $this->host_ . ($this->port_ != 80 ? ':' . $this->port_ : '');
$fullUrl = $this->scheme_ . "://" . $host . $this->uri_;
......
......@@ -99,8 +99,8 @@ class THttpClient extends \Thrift\Transport\TTransport
*/
public function __construct($host, $port = 80, $uri_no_func = '', $scheme = 'http')
{
if ((TStringFuncFactory::create()->strlen($uri_no_func) > 0) && ($uri_no_func {
0} != '/')) {
if ((TStringFuncFactory::create()->strlen($uri_no_func) > 0) && ($uri_no_func{
0} != '/')) {
$uri_no_func = '/' . $uri_no_func;
}
$this->scheme_ = $scheme;
......@@ -174,13 +174,13 @@ class THttpClient extends \Thrift\Transport\TTransport
if ($md['timed_out']) {
throw new TTransportException(
'THttpClient: timed out reading ' . $len . ' bytes from ' .
$this->host_ . ':' . $this->port_ . $this->uri_,
$this->host_ . ':' . $this->port_ . $this->uri_,
TTransportException::TIMED_OUT
);
} else {
throw new TTransportException(
'THttpClient: Could not read ' . $len . ' bytes from ' .
$this->host_ . ':' . $this->port_ . $this->uri_,
$this->host_ . ':' . $this->port_ . $this->uri_,
TTransportException::UNKNOWN
);
}
......
<?php
namespace fpf\thrift;
use Thrift\Type\TMessageType;
......@@ -9,6 +10,7 @@ class ThriftAsyncDetailInstanse
private $promise = null;
private $class_name = '';
private $func_name = '';
public function __construct($promise, $protocol, $class_name, $func_name)
{
$this->promise = $promise;
......
......@@ -14,14 +14,9 @@ use Thrift\Factory\TStringFuncFactory;
class ThriftAsyncServiceFactoryProxy
{
private $instance = null;
private $transport = null;
private $socket = null;
private $promise = null;
private $protocol_list = null;
private $request_base_params = null;
private $tem_class_name = '';
private $class_name = '';
private $func_name = '';
const BINARY = 0;
const JSON = 1;
......@@ -92,7 +87,7 @@ class ThriftAsyncServiceFactoryProxy
goto doEnd;
}
doEnd :
if ($error) {
if ($error) {
return ResponseApi::arrFail($error);
}
return ResponseApi::arrSuccess([$tem_arr[1], $matches[1]]);
......
......@@ -2,8 +2,6 @@
namespace fpf\thrift;
use fpf\thrift\ThriftAsyncServiceFactoryProxy;
class ThriftServiceFactory
{
......@@ -18,6 +16,7 @@ class ThriftServiceFactory
self::$sync_services[$class_name] = new ThriftServiceFactoryProxy($class_name);
return self::$sync_services[$class_name];
}
public static function getAsyncService($class_name)
{
if (!empty(self::$async_services[$class_name])) {
......
......@@ -18,7 +18,6 @@ class ThriftServiceFactoryProxy
{
$service_default_protocol = Yii::$app->fpf->getConfig('service_default_protocol', 'thrift_service');
$service_default_hosts = Yii::$app->fpf->getConfig('service_default_hosts', 'thrift_service');
$service_default_failure_policy = Yii::$app->fpf->getConfig('service_default_failure_policy', 'thrift_service');
$service_module_hosts = Yii::$app->fpf->getConfig('service_module_hosts', 'thrift_service');
$check_ret = $this->checkService($class_name);
if (true === $check_ret[BaseConstant::ERROR]) {
......@@ -78,7 +77,7 @@ class ThriftServiceFactoryProxy
goto doEnd;
}
doEnd :
if ($error) {
if ($error) {
return ResponseApi::arrFail($error);
}
return ResponseApi::arrSuccess([$tem_arr[1], $matches[1]]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment