aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/league/html-to-markdown/src/Coerce.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-11-25 17:12:28 +0100
committerMario <mario@mariovavti.com>2023-11-25 17:12:28 +0100
commit0fd8e02a884a2b040dca62ab5d9674db5f6a070b (patch)
tree586ee43f32f6f14368c09026f21dcd3244ea24b6 /vendor/league/html-to-markdown/src/Coerce.php
parent82e704ec5b107823c09f1387e9091adee53a4c2d (diff)
parent55c4bfb67009c598f25b1a8189604bfffa73dfbb (diff)
downloadvolse-hubzilla-0fd8e02a884a2b040dca62ab5d9674db5f6a070b.tar.gz
volse-hubzilla-0fd8e02a884a2b040dca62ab5d9674db5f6a070b.tar.bz2
volse-hubzilla-0fd8e02a884a2b040dca62ab5d9674db5f6a070b.zip
Merge branch '8.8RC'8.8
Diffstat (limited to 'vendor/league/html-to-markdown/src/Coerce.php')
-rw-r--r--vendor/league/html-to-markdown/src/Coerce.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/league/html-to-markdown/src/Coerce.php b/vendor/league/html-to-markdown/src/Coerce.php
new file mode 100644
index 000000000..4fb0450a0
--- /dev/null
+++ b/vendor/league/html-to-markdown/src/Coerce.php
@@ -0,0 +1,35 @@
+<?php
+
+declare(strict_types=1);
+
+namespace League\HTMLToMarkdown;
+
+/**
+ * @internal
+ */
+final class Coerce
+{
+ private function __construct()
+ {
+ }
+
+ /**
+ * @param mixed $val
+ */
+ public static function toString($val): string
+ {
+ switch (true) {
+ case \is_string($val):
+ return $val;
+ case \is_bool($val):
+ case \is_float($val):
+ case \is_int($val):
+ case $val === null:
+ return \strval($val);
+ case \is_object($val) && \method_exists($val, '__toString'):
+ return $val->__toString();
+ default:
+ throw new \InvalidArgumentException('Cannot coerce this value to string');
+ }
+ }
+}