aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/league/html-to-markdown/src/Coerce.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-10-05 11:35:02 +0000
committerMario <mario@mariovavti.com>2023-10-05 11:35:02 +0000
commit044e252d195be7fb9c523e5ab7e5f37eae7f03fd (patch)
treee8fcefdef750aee3e84e2ddb048e1e11a1c4599f /vendor/league/html-to-markdown/src/Coerce.php
parent6920fb2793265e5c9cdcdc8325398b07f216f184 (diff)
downloadvolse-hubzilla-044e252d195be7fb9c523e5ab7e5f37eae7f03fd.tar.gz
volse-hubzilla-044e252d195be7fb9c523e5ab7e5f37eae7f03fd.tar.bz2
volse-hubzilla-044e252d195be7fb9c523e5ab7e5f37eae7f03fd.zip
composer update html to markdown
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');
+ }
+ }
+}