Lines
n/a
0 / 0
Functions and Methods
n/a
0 / 0
Classes and Traits
n/a
0 / 0
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace BlueprintAU\Radiant\Database\ValueCodecs; | |
| 6 | ||
| 7 | /** | |
| 8 | * Adapts values between PHP and the database driver. | |
| 9 | * | |
| 10 | * `encode()` converts PHP values for the write/bind path, and `decode()` | |
| 11 | * converts driver values for the read path. Dialect-specific codecs (e.g. | |
| 12 | * Postgres' microsecond datetime format) implement this to keep the SQL | |
| 13 | * layer driver-agnostic. | |
| 14 | */ | |
| 15 | interface ValueCodecInterface | |
| 16 | { | |
| 17 | /** | |
| 18 | * PHP value → driver value (write/bind path; the value is the field cast's output). | |
| 19 | * | |
| 20 | * @param string|int|float|bool|null|\DateTimeInterface $value | |
| 21 | * @return string|int|float|bool|null | |
| 22 | */ | |
| 23 | public function encode(string|int|float|bool|null|\DateTimeInterface $value): string|int|float|bool|null; | |
| 24 | ||
| 25 | /** | |
| 26 | * Driver value → PHP value (read path; the value is the field cast's input). | |
| 27 | * | |
| 28 | * @param string|int|float|bool|null $value | |
| 29 | * @return string|int|float|bool|null | |
| 30 | */ | |
| 31 | public function decode(string|int|float|bool|null $value): string|int|float|bool|null; | |
| 32 | } |