aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/league/html-to-markdown/src/Converter/DefaultConverter.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/league/html-to-markdown/src/Converter/DefaultConverter.php')
-rw-r--r--vendor/league/html-to-markdown/src/Converter/DefaultConverter.php27
1 files changed, 10 insertions, 17 deletions
diff --git a/vendor/league/html-to-markdown/src/Converter/DefaultConverter.php b/vendor/league/html-to-markdown/src/Converter/DefaultConverter.php
index 8de0af210..e71dd10cc 100644
--- a/vendor/league/html-to-markdown/src/Converter/DefaultConverter.php
+++ b/vendor/league/html-to-markdown/src/Converter/DefaultConverter.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace League\HTMLToMarkdown\Converter;
use League\HTMLToMarkdown\Configuration;
@@ -8,27 +10,17 @@ use League\HTMLToMarkdown\ElementInterface;
class DefaultConverter implements ConverterInterface, ConfigurationAwareInterface
{
- const DEFAULT_CONVERTER = '_default';
+ public const DEFAULT_CONVERTER = '_default';
- /**
- * @var Configuration
- */
+ /** @var Configuration */
protected $config;
- /**
- * @param Configuration $config
- */
- public function setConfig(Configuration $config)
+ public function setConfig(Configuration $config): void
{
$this->config = $config;
}
- /**
- * @param ElementInterface $element
- *
- * @return string
- */
- public function convert(ElementInterface $element)
+ public function convert(ElementInterface $element): string
{
// If strip_tags is false (the default), preserve tags that don't have Markdown equivalents,
// such as <span> nodes on their own. C14N() canonicalizes the node to a string.
@@ -37,8 +29,9 @@ class DefaultConverter implements ConverterInterface, ConfigurationAwareInterfac
return $element->getValue();
}
- $markdown = html_entity_decode($element->getChildrenAsString());
+ $markdown = \html_entity_decode($element->getChildrenAsString());
+ // Tables are only handled here if TableConverter is not used
if ($element->getTagName() === 'table') {
$markdown .= "\n\n";
}
@@ -49,8 +42,8 @@ class DefaultConverter implements ConverterInterface, ConfigurationAwareInterfac
/**
* @return string[]
*/
- public function getSupportedTags()
+ public function getSupportedTags(): array
{
- return array(self::DEFAULT_CONVERTER);
+ return [self::DEFAULT_CONVERTER];
}
}