diff options
author | nobody <nobody@zotlabs.com> | 2021-06-17 14:57:47 -0700 |
---|---|---|
committer | nobody <nobody@zotlabs.com> | 2021-06-17 14:57:47 -0700 |
commit | efda8aac1d7d90fd7eda4a449332eedf74342951 (patch) | |
tree | 3373c0579168776cccda5224b6b33ce59fa9b274 /vendor/league/html-to-markdown/src/Converter/CommentConverter.php | |
parent | 686530c1873f98d724355bf3f456243b1b7fdadd (diff) | |
parent | a84cec4acddf6804a88fcda52e4437c91785dfb2 (diff) | |
download | volse-hubzilla-efda8aac1d7d90fd7eda4a449332eedf74342951.tar.gz volse-hubzilla-efda8aac1d7d90fd7eda4a449332eedf74342951.tar.bz2 volse-hubzilla-efda8aac1d7d90fd7eda4a449332eedf74342951.zip |
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'vendor/league/html-to-markdown/src/Converter/CommentConverter.php')
-rw-r--r-- | vendor/league/html-to-markdown/src/Converter/CommentConverter.php | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/vendor/league/html-to-markdown/src/Converter/CommentConverter.php b/vendor/league/html-to-markdown/src/Converter/CommentConverter.php index 959381d1b..c69dea551 100644 --- a/vendor/league/html-to-markdown/src/Converter/CommentConverter.php +++ b/vendor/league/html-to-markdown/src/Converter/CommentConverter.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace League\HTMLToMarkdown\Converter; use League\HTMLToMarkdown\Configuration; @@ -8,55 +10,44 @@ use League\HTMLToMarkdown\ElementInterface; class CommentConverter implements ConverterInterface, ConfigurationAwareInterface { - /** - * @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 ($this->shouldPreserve($element)) { return '<!--' . $element->getValue() . '-->'; } + return ''; } /** * @return string[] */ - public function getSupportedTags() + public function getSupportedTags(): array { - return array('#comment'); + return ['#comment']; } - /** - * @param ElementInterface $element - * - * @return bool - */ - private function shouldPreserve(ElementInterface $element) + private function shouldPreserve(ElementInterface $element): bool { $preserve = $this->config->getOption('preserve_comments'); if ($preserve === true) { return true; } - if (is_array($preserve)) { - $value = trim($element->getValue()); - return in_array($value, $preserve); + + if (\is_array($preserve)) { + $value = \trim($element->getValue()); + + return \in_array($value, $preserve, true); } + return false; } } |