html; if ($value instanceof DeferringDisplayableValue) { $value = $value->resolveDisplayableValue(); } if ($value instanceof Htmlable) { return $value->toHtml(); } if ($value instanceof BackedEnum) { $value = $value->value; } return (static::$encodeUsingFactory ?? function ($value, $doubleEncode) { return static::convert($value, doubleEncode: $doubleEncode); })($value, $this->doubleEncode); } /** * Set the callable that will be used to encode the HTML strings. * * @param callable|null $factory * @return void */ public static function encodeUsing(?callable $factory = null) { static::$encodeUsingFactory = $factory; } /** * Flush the class's global state. * * @return void */ public static function flushState() { static::$encodeUsingFactory = null; } }