aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/league/html-to-markdown/src/Converter/HardBreakConverter.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/league/html-to-markdown/src/Converter/HardBreakConverter.php')
-rw-r--r--vendor/league/html-to-markdown/src/Converter/HardBreakConverter.php30
1 files changed, 11 insertions, 19 deletions
diff --git a/vendor/league/html-to-markdown/src/Converter/HardBreakConverter.php b/vendor/league/html-to-markdown/src/Converter/HardBreakConverter.php
index 1be10bd63..45e89682e 100644
--- a/vendor/league/html-to-markdown/src/Converter/HardBreakConverter.php
+++ b/vendor/league/html-to-markdown/src/Converter/HardBreakConverter.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace League\HTMLToMarkdown\Converter;
use League\HTMLToMarkdown\Configuration;
@@ -8,35 +10,25 @@ use League\HTMLToMarkdown\ElementInterface;
class HardBreakConverter 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
{
$return = $this->config->getOption('hard_break') ? "\n" : " \n";
$next = $element->getNext();
if ($next) {
- $next_value = $next->getValue();
- if ($next_value) {
- if (in_array(substr($next_value, 0, 2), array('- ', '* ', '+ '))) {
+ $nextValue = $next->getValue();
+ if ($nextValue) {
+ if (\in_array(\substr($nextValue, 0, 2), ['- ', '* ', '+ '], true)) {
$parent = $element->getParent();
- if ($parent && $parent->getTagName() == 'li') {
+ if ($parent && $parent->getTagName() === 'li') {
$return .= '\\';
}
}
@@ -49,8 +41,8 @@ class HardBreakConverter implements ConverterInterface, ConfigurationAwareInterf
/**
* @return string[]
*/
- public function getSupportedTags()
+ public function getSupportedTags(): array
{
- return array('br');
+ return ['br'];
}
}