Skip to content

Commit eb72147

Browse files
committed
Add special type info to readme
1 parent 999abe1 commit eb72147

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ indent_style = space
1111
indent_size = 4
1212

1313
[*.md]
14+
indent_size = 2
1415
trim_trailing_whitespace = false
1516

1617
[*.yml]

readme.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,35 @@ Serializer::serializeList(iterable): string;
3939
Serializer::serializeDictionary(object): string;
4040
```
4141

42+
### Special Types
43+
`Serializer` will accept `string` or any `Stringable` object as an Item value,
44+
but will throw a `SerializeException` if it contains any characters outside the
45+
printable ASCII range.
46+
47+
Special Item types that should not be encoded as strings must be differentiated
48+
by using a decorating class:
49+
50+
- **Byte Sequences** (`\gapple\StructuredFields\Bytes`)
51+
A string containing binary data.
52+
53+
`Serializer` and `Parser` handle base64 encoding and decoding the provided string.
54+
55+
56+
- **Display Strings** (`\gapple\StructuredFields\DisplayString`)
57+
A string that includes Unicode characters.
58+
59+
`Serializer` and `Parser` handle percent-encoding and decoding non-ascii characters.
60+
61+
62+
- **Tokens** (`\gapple\StructuredFields\Token`)
63+
A short textual word with a restricted character set.
64+
65+
66+
- **Dates** (`\gapple\StructuredFields\Date`)
67+
An integer timestamp
68+
69+
`Serializer` accepts any object that implements `\DateTimeInterface`.
70+
`Parser` will return a `\gapple\StructuredFields\Date` object.
71+
72+
4273
[1]: https://www.rfc-editor.org/rfc/rfc9651.html

0 commit comments

Comments
 (0)