]> git.mxchange.org Git - friendica.git/blob - vendor/league/html-to-markdown/src/Converter/DivConverter.php
Move HTML to Markdown library to Composer
[friendica.git] / vendor / league / html-to-markdown / src / Converter / DivConverter.php
1 <?php
2
3 namespace League\HTMLToMarkdown\Converter;
4
5 use League\HTMLToMarkdown\Configuration;
6 use League\HTMLToMarkdown\ConfigurationAwareInterface;
7 use League\HTMLToMarkdown\ElementInterface;
8
9 class DivConverter implements ConverterInterface, ConfigurationAwareInterface
10 {
11     /**
12      * @var Configuration
13      */
14     protected $config;
15
16     /**
17      * @param Configuration $config
18      */
19     public function setConfig(Configuration $config)
20     {
21         $this->config = $config;
22     }
23
24     /**
25      * @param ElementInterface $element
26      *
27      * @return string
28      */
29     public function convert(ElementInterface $element)
30     {
31         if ($this->config->getOption('strip_tags', false)) {
32             return $element->getValue() . "\n\n";
33         }
34
35         return html_entity_decode($element->getChildrenAsString());
36     }
37
38     /**
39      * @return string[]
40      */
41     public function getSupportedTags()
42     {
43         return array('div');
44     }
45 }