aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/league/html-to-markdown/src/Converter/CommentConverter.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/league/html-to-markdown/src/Converter/CommentConverter.php')
-rw-r--r--vendor/league/html-to-markdown/src/Converter/CommentConverter.php39
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;
}
}