Last active
August 29, 2015 14:21
-
-
Save hikari-no-yume/91bab2265cab5879d534 to your computer and use it in GitHub Desktop.
11SR-7: Hypertext Transfer Protocol Message Specification (Working Draft)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace Room11\Standard\11SR7\HttpMessage\Interface { | |
/** | |
* @description A class to represent a Hypertext Transfer Protocol request | |
* @link https://standards.room11.php.committee/11sr-7/http-message-specification/working-draft/interface | |
* @see https://tools.ietf.org/html/rfc7540 | |
* @version Working Draft | |
* @author Room 11 International Professional PHP: Hypertext Preprocessor Standards Working Group Technical Association | |
* @copyright Copyright (c) 2010–2015 Collaborators of the Room 11 International Professional PHP: Hypertext Preprocessor Standards Working Group Technical Association | |
*/ | |
interface HTTPRequestInterface { | |
/** | |
* @param $request string The content of the HTTP request | |
* @return \Room11\Standard\11SR7\HttpMessage\Interface\HTTPRequestInterface | |
*/ | |
public static function createFromHyperTextTransferProtocolRequestContentString(string $request): self; | |
/** | |
* @description Obtains the content of the HTTP request | |
* @return string The content of the HTTP request | |
*/ | |
public function getRequestString(): string; | |
/** | |
* @description Produces a new HTTP request with a new content | |
* @param $request The content of the new HTTP request | |
* @return \Room11\Standard\11SR7\HttpMessage\Interface\HTTPRequestInterface | |
*/ | |
public function withRequestString(string $request): self; | |
} | |
} | |
namespace Room11\Standard\11SR7\HttpMessage\Implementation { | |
/** | |
* @description A class to represent a Hypertext Transfer Protocol request | |
* @link https://standards.room11.php.committee/11sr-7/http-message-specification/working-draft/implementation | |
* @see https://tools.ietf.org/html/rfc7540 | |
* @version Working Draft | |
* @author Room 11 International Professional PHP: Hypertext Preprocessor Standards Working Group Technical Association | |
* @copyright Copyright (c) 2010–2015 Collaborators of the Room 11 International Professional PHP: Hypertext Preprocessor Standards Working Group Technical Association | |
*/ | |
class HTTPRequestImplementation implements \Room11\Standard\11SR7\HttpMessage\Interface\HTTPRequestInterface { | |
/** | |
* @var string $request The content of the HTTP request | |
* @internal | |
*/ | |
private string $request; | |
/** | |
* @param $request string The content of the HTTP request | |
* @return void | |
* @internal | |
*/ | |
private function __construct(string $request): void { | |
$this->request = $request; | |
} | |
/** | |
* @param $request string The content of the HTTP request | |
* @return \Room11\Standard\11SR7\HttpMessage\Interface\HTTPRequestInterface | |
*/ | |
public static function createFromHyperTextTransferProtocolRequestContentString(string $request): \Room11\Standard\11SR7\HttpMessage\Interface\HTTPRequestInterface { | |
return new self($request); | |
} | |
/** | |
* @description Obtains the content of the HTTP request | |
* @return string The content of the HTTP request | |
*/ | |
public function getRequestString(): string { | |
return $this->request; | |
} | |
/** | |
* @description Produces a new HTTP request with a new content | |
* @param $request The content of the new HTTP request | |
* @return \Room11\Standard\11SR7\HttpMessage\Interface\HTTPRequestInterface | |
*/ | |
public function withRequestString(string $request): self { | |
return new self($request); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not PSR compliant. cv-pls