Skip to content

Commit 99604a8

Browse files
committed
[main] Add more concepts
1 parent 19e24d4 commit 99604a8

10 files changed

+164
-2
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.2.0] - 2023-04-30
9+
### Added
10+
- Concepts:
11+
- ForwardedParameters
12+
- LinkRelations
13+
- Preferences
14+
- RangeUnits
15+
- TransferCodings
16+
817
## [2.1.0] - 2023-04-30
918
### Added
1019
- More concepts:

README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ public const MAX_AGE = 'max-age';
7272
public const GZIP = 'gzip';
7373
```
7474

75+
### Example for `ForwardedParameters.php`
76+
77+
```php
78+
/**
79+
* Forwarded parameter for
80+
*
81+
* The "for" parameter is used to disclose information about the client that initiated the request and
82+
* subsequent proxies in a chain of proxies.
83+
*
84+
* @see https://webconcepts.info/specs/IETF/RFC/7239
85+
* @see https://datatracker.ietf.org/doc/html/rfc7239#section-5.2
86+
*/
87+
public const FOR = 'for';
88+
```
89+
7590
### Example for `HeaderFields.php`
7691
```php
7792
/**
@@ -89,6 +104,21 @@ public const GZIP = 'gzip';
89104
public const CONTENT_TYPE = 'Content-Type';
90105
```
91106

107+
### Example for `LinkRelations.php`
108+
109+
```php
110+
/**
111+
* Link relation canonical
112+
*
113+
* The target (canonical) IRI MUST identify content that is either duplicative or a superset of the content at
114+
* the context (referring) IRI.
115+
*
116+
* @see https://webconcepts.info/specs/IETF/RFC/6596
117+
* @see https://datatracker.ietf.org/doc/html/rfc6596#section-3
118+
*/
119+
public const CANONICAL = 'canonical';
120+
```
121+
92122
### Example for `MediaTypes.php`
93123

94124
```php
@@ -113,6 +143,37 @@ public const CONTENT_TYPE = 'Content-Type';
113143
public const APPLICATION_JSON = 'application/json';
114144
```
115145

146+
### Example for `Preferences.php`
147+
148+
```php
149+
/**
150+
* Preference wait
151+
*
152+
* The "wait" preference can be used to establish an upper bound on the length of time, in seconds, the client
153+
* expects it will take the server to process the request once it has been received.
154+
*
155+
* @see https://webconcepts.info/specs/IETF/RFC/7240
156+
* @see https://datatracker.ietf.org/doc/html/rfc7240#section-4.3
157+
*/
158+
public const WAIT = 'wait';
159+
```
160+
161+
### Example for `RangeUnits.php`
162+
163+
```php
164+
/**
165+
* Range unit bytes
166+
*
167+
* Since representation data is transferred in payloads as a sequence of octets, a byte range is a meaningful
168+
* substructure for any representation transferable over HTTP. The "bytes" range unit is defined for expressing
169+
* subranges of the data's octet sequence.
170+
*
171+
* @see https://webconcepts.info/specs/IETF/RFC/7233
172+
* @see https://datatracker.ietf.org/doc/html/rfc7233#section-2.1
173+
*/
174+
public const BYTES = 'bytes';
175+
```
176+
116177
### Example for `RequestMethods.php`
117178

118179
```php
@@ -150,3 +211,20 @@ public const MESSAGE_404 = 'Not Found';
150211
public const STATUS_NOT_FOUND = self::STATUS_404;
151212
public const MESSAGE_NOT_FOUND = self::MESSAGE_404;
152213
```
214+
215+
### Example for `TransferCodings.php`
216+
217+
```php
218+
/**
219+
* Transfer coding chunked
220+
*
221+
* The chunked transfer coding wraps the payload body in order to transfer it as a series of chunks, each with
222+
* its own size indicator, followed by an OPTIONAL trailer containing header fields. Chunked enables content
223+
* streams of unknown size to be transferred as a sequence of length-delimited buffers, which enables the sender
224+
* to retain connection persistence and the recipient to know when it has received the entire message.
225+
*
226+
* @see https://webconcepts.info/specs/IETF/RFC/7230
227+
* @see https://datatracker.ietf.org/doc/html/rfc7230#section-4.1
228+
*/
229+
public const CHUNKED = 'chunked';
230+
```

bin/http_generate.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@
1212
use CryptoScythe\Http\Generator\Renderer\AuthenticationSchemesRenderer;
1313
use CryptoScythe\Http\Generator\Renderer\CacheDirectivesRenderer;
1414
use CryptoScythe\Http\Generator\Renderer\ContentCodingsRenderer;
15+
use CryptoScythe\Http\Generator\Renderer\ForwardedParametersRenderer;
1516
use CryptoScythe\Http\Generator\Renderer\HeaderFieldsRenderer;
17+
use CryptoScythe\Http\Generator\Renderer\LinkRelationsRenderer;
1618
use CryptoScythe\Http\Generator\Renderer\MediaTypesRenderer;
19+
use CryptoScythe\Http\Generator\Renderer\PreferencesRenderer;
20+
use CryptoScythe\Http\Generator\Renderer\RangeUnitsRenderer;
1721
use CryptoScythe\Http\Generator\Renderer\RequestMethodsRenderer;
1822
use CryptoScythe\Http\Generator\Renderer\StatusCodeRenderer;
23+
use CryptoScythe\Http\Generator\Renderer\TransferCodingsRenderer;
1924

2025
set_error_handler(
2126
function (int $severity, string $message, string $file, int $line): void {
@@ -60,18 +65,42 @@ function (int $severity, string $message, string $file, int $line): void {
6065
new ContentCodingsRenderer(),
6166
$namespace,
6267
),
68+
new Definition(
69+
'http-forwarded-parameter.json',
70+
'ForwardedParameters',
71+
new ForwardedParametersRenderer(),
72+
$namespace,
73+
),
6374
new Definition(
6475
'http-header.json',
6576
'HeaderFields',
6677
new HeaderFieldsRenderer(),
6778
$namespace,
6879
),
80+
new Definition(
81+
'link-relation.json',
82+
'LinkRelations',
83+
new LinkRelationsRenderer(),
84+
$namespace,
85+
),
6986
new Definition(
7087
'media-type.json',
7188
'MediaTypes',
7289
new MediaTypesRenderer(),
7390
$namespace,
7491
),
92+
new Definition(
93+
'http-preference.json',
94+
'Preferences',
95+
new PreferencesRenderer(),
96+
$namespace,
97+
),
98+
new Definition(
99+
'http-range-unit.json',
100+
'RangeUnits',
101+
new RangeUnitsRenderer(),
102+
$namespace,
103+
),
75104
new Definition(
76105
'http-method.json',
77106
'RequestMethods',
@@ -84,6 +113,12 @@ function (int $severity, string $message, string $file, int $line): void {
84113
new StatusCodeRenderer(),
85114
$namespace,
86115
),
116+
new Definition(
117+
'http-transfer-coding.json',
118+
'TransferCodings',
119+
new TransferCodingsRenderer(),
120+
$namespace,
121+
),
87122
];
88123

89124
echo 'Generating classes' . PHP_EOL;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "crypto_scythe/http_generator",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "HTTP header fields, media types and status codes",
55
"license": "MIT",
66
"keywords": [

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace CryptoScythe\Http\Generator\Renderer;
4+
5+
final class ForwardedParametersRenderer extends AbstractRenderer
6+
{
7+
protected const HEADLINE_INTRO = 'Forwarded parameter';
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace CryptoScythe\Http\Generator\Renderer;
4+
5+
final class LinkRelationsRenderer extends AbstractRenderer
6+
{
7+
protected const HEADLINE_INTRO = 'Link relation';
8+
}

src/Renderer/PreferencesRenderer.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace CryptoScythe\Http\Generator\Renderer;
4+
5+
final class PreferencesRenderer extends AbstractRenderer
6+
{
7+
protected const HEADLINE_INTRO = 'Preference';
8+
}

src/Renderer/RangeUnitsRenderer.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace CryptoScythe\Http\Generator\Renderer;
4+
5+
final class RangeUnitsRenderer extends AbstractRenderer
6+
{
7+
protected const HEADLINE_INTRO = 'Range unit';
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace CryptoScythe\Http\Generator\Renderer;
4+
5+
class TransferCodingsRenderer extends AbstractRenderer
6+
{
7+
protected const HEADLINE_INTRO = 'Transfer coding';
8+
}

0 commit comments

Comments
 (0)