diff --git a/composer.json b/composer.json index 11758fe..8af5837 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,9 @@ "psr/http-message": "The package containing the PSR-7 interfaces" }, "autoload": { - "psr-4": { - "Fig\\Http\\Message\\": "src/" - } + "files": [ + "constants.php" + ] }, "extra": { "branch-alias": { diff --git a/src/StatusCodeInterface.php b/constants.php similarity index 81% rename from src/StatusCodeInterface.php rename to constants.php index 99b7e78..ba44bf9 100644 --- a/src/StatusCodeInterface.php +++ b/constants.php @@ -1,6 +1,38 @@ + * use Fig\Http\Message\Request; + * + * class RequestFactory + * { + * public static function factory( + * $uri = '/', + * $method = Request\METHOD_GET, + * $data = [] + * ) { + * } + * } + * + */ +namespace Fig\Http\Message\Request +{ + const METHOD_HEAD = 'HEAD'; + const METHOD_GET = 'GET'; + const METHOD_POST = 'POST'; + const METHOD_PUT = 'PUT'; + const METHOD_PATCH = 'PATCH'; + const METHOD_DELETE = 'DELETE'; + const METHOD_PURGE = 'PURGE'; + const METHOD_OPTIONS = 'OPTIONS'; + const METHOD_TRACE = 'TRACE'; + const METHOD_CONNECT = 'CONNECT'; +} + /** * Defines constants for common HTTP status code. @@ -26,15 +58,17 @@ * Usage: * * - * class ResponseFactory implements StatusCodeInterface + * use Fig\Http\Message\Response; + * + * class ResponseFactory * { - * public function createResponse($code = self::STATUS_OK) + * public function createResponse($code = Response\STATUS_OK) * { * } * } * */ -interface StatusCodeInterface +namespace Response { // Informational 1xx const STATUS_CONTINUE = 100; diff --git a/src/RequestMethodInterface.php b/src/RequestMethodInterface.php deleted file mode 100644 index 97d9a93..0000000 --- a/src/RequestMethodInterface.php +++ /dev/null @@ -1,34 +0,0 @@ - - * class RequestFactory implements RequestMethodInterface - * { - * public static function factory( - * $uri = '/', - * $method = self::METHOD_GET, - * $data = [] - * ) { - * } - * } - * - */ -interface RequestMethodInterface -{ - const METHOD_HEAD = 'HEAD'; - const METHOD_GET = 'GET'; - const METHOD_POST = 'POST'; - const METHOD_PUT = 'PUT'; - const METHOD_PATCH = 'PATCH'; - const METHOD_DELETE = 'DELETE'; - const METHOD_PURGE = 'PURGE'; - const METHOD_OPTIONS = 'OPTIONS'; - const METHOD_TRACE = 'TRACE'; - const METHOD_CONNECT = 'CONNECT'; -}