Skip to content

Commit

Permalink
update namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Nov 12, 2018
1 parent 4834d35 commit 1b71ea9
Show file tree
Hide file tree
Showing 39 changed files with 144 additions and 168 deletions.
32 changes: 0 additions & 32 deletions .editorconfig

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ class MyResponse extends Response {

## License

[MIT](License)
[MIT](LICENSE)
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"autoload": {
"psr-4": {
"PhpComp\\Http\\" : "src/"
"PhpComp\\Http\\Message\\" : "src/"
}
},
"suggest": {
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="Inhere Http Test Suite">
Expand Down
4 changes: 2 additions & 2 deletions src/Body.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* Time: 18:02
*/

namespace Inhere\Http;
namespace PhpComp\Http\Message;

use Inhere\Http\Component\TempStream;
use PhpComp\Http\Message\Component\TempStream;

/**
* Body
Expand Down
4 changes: 2 additions & 2 deletions src/Component/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* Time: 下午2:04
*/

namespace Inhere\Http\Component;
namespace PhpComp\Http\Message\Component;

/**
* Class Collection
* @package Inhere\Http\Component
* @package PhpComp\Http\Message\Component
*/
class Collection extends \ArrayObject
{
Expand Down
6 changes: 3 additions & 3 deletions src/Component/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
* File: Environment.php
*/

namespace Inhere\Http\Component;
namespace PhpComp\Http\Message\Component;

/**
* mock 环境信息
* Class Environment
* @package Inhere\Http\Component
* @package PhpComp\Http\Message\Component
*/
class Environment extends Collection
{
Expand All @@ -35,7 +35,7 @@ public static function mock(array $userData = []): self
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8',
'HTTP_ACCEPT_CHARSET' => 'utf-8;q=0.7,*;q=0.3',
'HTTP_USER_AGENT' => 'Slim Framework',
'HTTP_USER_AGENT' => 'MY Framework',
'REMOTE_ADDR' => '127.0.0.1',
'REQUEST_TIME' => \time(),
'REQUEST_TIME_FLOAT' => \microtime(true),
Expand Down
6 changes: 3 additions & 3 deletions src/Component/InputStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
* Time: 下午12:29
*/

namespace Inhere\Http\Component;
namespace PhpComp\Http\Message\Component;

use Inhere\Http\Stream;
use PhpComp\Http\Message\Stream;

/**
* Class InputStream
* @package Inhere\Http\Component
* @package PhpComp\Http\Message\Component
*/
class InputStream extends Stream
{
Expand Down
6 changes: 3 additions & 3 deletions src/Component/MemoryStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
* Time: 22:25
*/

namespace Inhere\Http\Component;
namespace PhpComp\Http\Message\Component;

use Inhere\Http\Stream;
use PhpComp\Http\Message\Stream;

/**
* Class MemoryStream
* @package Inhere\Http\Component
* @package PhpComp\Http\Message\Component
*/
class MemoryStream extends Stream
{
Expand Down
6 changes: 3 additions & 3 deletions src/Component/TempStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
* Time: 下午12:29
*/

namespace Inhere\Http\Component;
namespace PhpComp\Http\Message\Component;

use Inhere\Http\Stream;
use PhpComp\Http\Message\Stream;

/**
* Class TempStream
* @package Inhere\Http
* @package PhpComp\Http\Message
*/
class TempStream extends Stream
{
Expand Down
6 changes: 3 additions & 3 deletions src/Cookies.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
* @from slim3
*/

namespace Inhere\Http;
namespace PhpComp\Http\Message;

use Inhere\Http\Component\Collection;
use PhpComp\Http\Message\Component\Collection;

/**
* Class Cookies
* @package Inhere\Http
* @package PhpComp\Http\Message
*
* Cookies:
*
Expand Down
6 changes: 3 additions & 3 deletions src/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
* Time: 19:02
*/

namespace Inhere\Http;
namespace PhpComp\Http\Message;

use Inhere\Http\Component\Collection;
use PhpComp\Http\Message\Component\Collection;

/**
* Class Headers
* @package Inhere\Http
* @package PhpComp\Http\Message
*/
class Headers extends Collection
{
Expand Down
13 changes: 7 additions & 6 deletions src/HttpFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
* Time: 13:20
*/

namespace Inhere\Http;
namespace PhpComp\Http\Message;

use Inhere\Http\Component\Collection;
use Inhere\Http\Request\RequestBody;
use PhpComp\Http\Message\Component\Collection;
use PhpComp\Http\Message\Request\RequestBody;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
Expand All @@ -19,7 +19,7 @@

/**
* Class HttpFactory
* @package Inhere\Http
* @package PhpComp\Http\Message
* @link https://github.com/php-fig/fig-standards/blob/master/proposed/http-factory/http-factory.md
*/
class HttpFactory
Expand Down Expand Up @@ -204,7 +204,8 @@ public static function createUploadedFile(
int $error = \UPLOAD_ERR_OK,
string $clientFilename = null,
string $clientMediaType = null
): UploadedFileInterface {
): UploadedFileInterface
{
return new UploadedFile($file, $clientFilename, $clientMediaType, $size, $error);
}

Expand Down Expand Up @@ -316,7 +317,7 @@ public static function createHeadersFromArray($env): Headers
/**
* If HTTP_AUTHORIZATION does not exist tries to get it from
* getallheaders() when available.
* @param Collection $env The Slim application Collection
* @param Collection $env The application Collection
* @return Collection
*/
public static function determineAuthorization($env): Collection
Expand Down
4 changes: 2 additions & 2 deletions src/HttpUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
* Time: 15:24
*/

namespace Inhere\Http;
namespace PhpComp\Http\Message;

use Psr\Http\Message\ResponseInterface;

/**
* Class HttpUtil
* @package Inhere\Http
* @package PhpComp\Http\Message
*/
class HttpUtil
{
Expand Down
4 changes: 2 additions & 2 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* Time: 13:12
*/

namespace Inhere\Http;
namespace PhpComp\Http\Message;

use Inhere\Http\Traits\MessageTrait;
use PhpComp\Http\Message\Traits\MessageTrait;
use Psr\Http\Message\MessageInterface;

/**
Expand Down
11 changes: 6 additions & 5 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
* @ref Slim 3
*/

namespace Inhere\Http;
namespace PhpComp\Http\Message;

use Inhere\Http\Request\RequestBody;
use Inhere\Http\Traits\RequestHeadersTrait;
use Inhere\Http\Traits\RequestTrait;
use PhpComp\Http\Message\Request\RequestBody;
use PhpComp\Http\Message\Traits\RequestHeadersTrait;
use PhpComp\Http\Message\Traits\RequestTrait;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UriInterface;
Expand Down Expand Up @@ -47,7 +47,8 @@ public function __construct(
StreamInterface $body = null,
string $protocol = 'HTTP',
string $protocolVersion = '1.1'
) {
)
{
$this->initialize($protocol, $protocolVersion, $headers, $body ?: new RequestBody());
$this->initializeRequest($uri, $method);

Expand Down
8 changes: 4 additions & 4 deletions src/Request/ExtendedRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* Time: 下午11:43
*/

namespace Inhere\Http\Request;
namespace PhpComp\Http\Message\Request;

use Inhere\Http\ServerRequest;
use Inhere\Http\Traits\ExtendedRequestTrait;
use PhpComp\Http\Message\ServerRequest;
use PhpComp\Http\Message\Traits\ExtendedRequestTrait;

/**
* Class ExtendedRequest
* @package Inhere\Http\Request
* @package PhpComp\Http\Message\Request
*/
class ExtendedRequest extends ServerRequest
{
Expand Down
6 changes: 3 additions & 3 deletions src/Request/RequestBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* Time: 14:31
*/

namespace Inhere\Http\Request;
namespace PhpComp\Http\Message\Request;

use Inhere\Http\Stream;
use PhpComp\Http\Message\Stream;

/**
* Class RequestBody
* Provides a PSR-7 implementation of a reusable raw request body
* @package Inhere\Http\Request
* @package PhpComp\Http\Message\Request
*/
class RequestBody extends Stream
{
Expand Down
14 changes: 8 additions & 6 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
* @from Slim 3
*/

namespace Inhere\Http;
namespace PhpComp\Http\Message;

use Inhere\Http\Traits\CookiesTrait;
use Inhere\Http\Traits\MessageTrait;
use PhpComp\Http\Message\Traits\CookiesTrait;
use PhpComp\Http\Message\Traits\MessageTrait;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;

/**
* Class Response
* response for handshake
* @package Inhere\Http
* @package PhpComp\Http\Message
* @property int $status
* @property string $statusMsg
*
Expand Down Expand Up @@ -138,7 +138,8 @@ public static function make(
StreamInterface $body = null,
string $protocol = 'HTTP',
string $protocolVersion = '1.1'
): Response {
): Response
{
return new static($status, $headers, $cookies, $body, $protocol, $protocolVersion);
}

Expand All @@ -159,7 +160,8 @@ public function __construct(
StreamInterface $body = null,
string $protocol = 'HTTP',
string $protocolVersion = '1.1'
) {
)
{
$this->setCookies($cookies);
$this->initialize($protocol, $protocolVersion, $headers, $body ?: new Body());

Expand Down
8 changes: 4 additions & 4 deletions src/Response/ExtendedResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* Time: 下午11:43
*/

namespace Inhere\Http\Response;
namespace PhpComp\Http\Message\Response;

use Inhere\Http\Response;
use Inhere\Http\Traits\ExtendedResponseTrait;
use PhpComp\Http\Message\Response;
use PhpComp\Http\Message\Traits\ExtendedResponseTrait;

/**
* Class ExtendedResponse
* @package Inhere\Http\Response
* @package PhpComp\Http\Message\Response
*/
class ExtendedResponse extends Response
{
Expand Down
4 changes: 2 additions & 2 deletions src/Response/InjectContentTypeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* Time: 下午12:25
*/

namespace Inhere\Http\Response;
namespace PhpComp\Http\Message\Response;

/**
* Trait InjectContentTypeTrait
* @package Inhere\Http\Response
* @package PhpComp\Http\Message\Response
* @from https://github.com/zendframework/zend-diactoros/blob/master/src/Response/InjectContentTypeTrait.php
*/
trait InjectContentTypeTrait
Expand Down
Loading

0 comments on commit 1b71ea9

Please sign in to comment.