]> git.mxchange.org Git - friendica.git/blob - vendor/league/html-to-markdown/src/Configuration.php
Move HTML to Markdown library to Composer
[friendica.git] / vendor / league / html-to-markdown / src / Configuration.php
1 <?php
2
3 namespace League\HTMLToMarkdown;
4
5 class Configuration
6 {
7     protected $config;
8
9     /**
10      * @param array $config
11      */
12     public function __construct(array $config = array())
13     {
14         $this->config = $config;
15     }
16
17     /**
18      * @param array $config
19      */
20     public function merge(array $config = array())
21     {
22         $this->config = array_replace_recursive($this->config, $config);
23     }
24
25     /**
26      * @param array $config
27      */
28     public function replace(array $config = array())
29     {
30         $this->config = $config;
31     }
32
33     /**
34      * @param string $key
35      * @param mixed  $value
36      */
37     public function setOption($key, $value)
38     {
39         $this->config[$key] = $value;
40     }
41
42     /**
43      * @param string|null $key
44      * @param mixed|null  $default
45      *
46      * @return mixed|null
47      */
48     public function getOption($key = null, $default = null)
49     {
50         if ($key === null) {
51             return $this->config;
52         }
53
54         if (!isset($this->config[$key])) {
55             return $default;
56         }
57
58         return $this->config[$key];
59     }
60 }