Lines 100.00% 7 / 7
Methods 100.00% 3 / 3
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 [BlueprintAU\Radiant\Database\ValueCodecs\DefaultValueCodec] encode 100.00% 5 / 5 100.00% 1 / 1 2
 [BlueprintAU\Radiant\Database\ValueCodecs\DefaultValueCodec] decode 100.00% 1 / 1 100.00% 1 / 1 1
18final class PostgresValueCodec extends DefaultValueCodec
19{
20    /**
21     * @param  string  $timezone
22     */
23    public function __construct(string $timezone = 'UTC')
24    {
25        parent::__construct('Y-m-d H:i:s.u', $timezone);
26    }
27}

Inherited from BlueprintAU\Radiant\Database\ValueCodecs\DefaultValueCodec

34    public function encode(string|int|float|bool|null|\DateTimeInterface $value): string|int|float|bool|null
35    {
36        // Raw-path bindings may carry a DateTimeInterface (e.g. a Carbon in a
37        // where clause); normalize to the codec's timezone and format it
38        // explicitly rather than relying on PDO's implicit stringification.
39        // createFromInterface() yields a fresh instance, so the caller's
40        // object is never mutated.
41        if ($value instanceof \DateTimeInterface) {
42            return \DateTimeImmutable::createFromInterface($value)
43                ->setTimezone(new \DateTimeZone($this->timezone))
44                ->format($this->datetimeFormat);
45        }
46
47        return $value;
48    }
57    public function decode(string|int|float|bool|null $value): string|int|float|bool|null
58    {
59        return $value;
60    }