Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Nov 24, 2018
1 parent 5777e94 commit e079461
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ composer require php-comp/http-client
### 创建客户端实例

```php

// use factory
$client = Client::factory([
'driver' => 'curl', // stream, fsock, file, co, co2
Expand Down
4 changes: 2 additions & 2 deletions src/Curl/CurlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use PhpComp\Http\Client\AbstractClient;
use PhpComp\Http\Client\ClientUtil;
use PhpComp\Http\Client\Error\ClientException;
use PhpComp\Http\Client\Traits\RawResponseParserTrait;
use PhpComp\Http\Client\Traits\ParseRawResponseTrait;

/**
* Class Curl
Expand All @@ -36,7 +36,7 @@
*/
class CurlClient extends AbstractClient implements CurlClientInterface
{
use RawResponseParserTrait;
use ParseRawResponseTrait;

// ssl auth type
const SSL_TYPE_CERT = 'cert';
Expand Down
4 changes: 2 additions & 2 deletions src/FOpenClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace PhpComp\Http\Client;

use PhpComp\Http\Client\Error\ClientException;
use PhpComp\Http\Client\Traits\RawResponseParserTrait;
use PhpComp\Http\Client\Traits\ParseRawResponseTrait;
use PhpComp\Http\Client\Traits\StreamContextBuildTrait;

/**
Expand All @@ -18,7 +18,7 @@
*/
class FOpenClient extends AbstractClient
{
use RawResponseParserTrait, StreamContextBuildTrait;
use ParseRawResponseTrait, StreamContextBuildTrait;

/**
* The network resource handle, it's created by:
Expand Down
4 changes: 2 additions & 2 deletions src/FSockClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
use PhpComp\Http\Client\Error\ClientException;
use PhpComp\Http\Client\Error\RequestException;
use PhpComp\Http\Client\Traits\BuildRawHttpRequestTrait;
use PhpComp\Http\Client\Traits\RawResponseParserTrait;
use PhpComp\Http\Client\Traits\ParseRawResponseTrait;

/**
* Class FSockClient - powered by func fsockopen()
* @package PhpComp\Http\Client
*/
class FSockClient extends AbstractClient
{
use BuildRawHttpRequestTrait, RawResponseParserTrait;
use BuildRawHttpRequestTrait, ParseRawResponseTrait;

/**
* @see https://secure.php.net/manual/zh/function.stream-get-meta-data.php
Expand Down
4 changes: 2 additions & 2 deletions src/FileClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace PhpComp\Http\Client;

use PhpComp\Http\Client\Error\ClientException;
use PhpComp\Http\Client\Traits\RawResponseParserTrait;
use PhpComp\Http\Client\Traits\ParseRawResponseTrait;
use PhpComp\Http\Client\Traits\StreamContextBuildTrait;

/**
Expand All @@ -18,7 +18,7 @@
*/
class FileClient extends AbstractClient
{
use StreamContextBuildTrait, RawResponseParserTrait;
use StreamContextBuildTrait, ParseRawResponseTrait;

/**
* @return bool
Expand Down
4 changes: 2 additions & 2 deletions src/StreamClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
use PhpComp\Http\Client\Error\ClientException;
use PhpComp\Http\Client\Error\RequestException;
use PhpComp\Http\Client\Traits\BuildRawHttpRequestTrait;
use PhpComp\Http\Client\Traits\RawResponseParserTrait;
use PhpComp\Http\Client\Traits\ParseRawResponseTrait;

/**
* Class StreamClient
* @package PhpComp\Http\Client
*/
class StreamClient extends AbstractClient
{
use BuildRawHttpRequestTrait, RawResponseParserTrait;
use BuildRawHttpRequestTrait, ParseRawResponseTrait;

/**
* stream context. it's create by stream_context_create()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
namespace PhpComp\Http\Client\Traits;

/**
* Trait RawResponseParserTrait
* Trait ParseRawResponseTrait
* @package PhpComp\Http\Client\Traits
*/
trait RawResponseParserTrait
trait ParseRawResponseTrait
{
/**
* The curl exec response data string. contains headers and body
Expand Down Expand Up @@ -89,6 +89,7 @@ protected function parseResponseHeaders(array &$headers)
// \preg_match('#(.*?)\:\s(.*)#', $header, $matches);
// $this->responseHeaders[$matches[1]] = $matches[2];
list($name, $value) = \explode(': ', $header);
$name = \ucwords($name);
$this->responseHeaders[$name] = $value;
}
}
Expand Down

0 comments on commit e079461

Please sign in to comment.