11<?php
22
3+ declare (strict_types=1 );
4+
35/*
46 * This file is part of the league/commonmark package.
57 *
@@ -27,16 +29,25 @@ public function __construct(array $config = [])
2729 $ this ->config = $ config ;
2830 }
2931
32+ /**
33+ * {@inheritdoc}
34+ */
3035 public function merge (array $ config = []): void
3136 {
3237 $ this ->config = \array_replace_recursive ($ this ->config , $ config );
3338 }
3439
40+ /**
41+ * {@inheritdoc}
42+ */
3543 public function replace (array $ config = []): void
3644 {
3745 $ this ->config = $ config ;
3846 }
3947
48+ /**
49+ * {@inheritdoc}
50+ */
4051 public function get (?string $ key = null , $ default = null )
4152 {
4253 if ($ key === null ) {
@@ -48,13 +59,16 @@ public function get(?string $key = null, $default = null)
4859 return $ this ->getConfigByPath ($ key , $ default );
4960 }
5061
51- if (!isset ($ this ->config [$ key ])) {
62+ if (! isset ($ this ->config [$ key ])) {
5263 return $ default ;
5364 }
5465
5566 return $ this ->config [$ key ];
5667 }
5768
69+ /**
70+ * {@inheritdoc}
71+ */
5872 public function set (string $ key , $ value = null ): void
5973 {
6074 // accept a/b/c as ['a']['b']['c']
@@ -66,17 +80,16 @@ public function set(string $key, $value = null): void
6680 }
6781
6882 /**
69- * @param string $keyPath
70- * @param string|null $default
83+ * @param mixed|null $default
7184 *
7285 * @return mixed|null
7386 */
7487 private function getConfigByPath (string $ keyPath , $ default = null )
7588 {
7689 $ keyArr = \explode ('/ ' , $ keyPath );
77- $ data = $ this ->config ;
90+ $ data = $ this ->config ;
7891 foreach ($ keyArr as $ k ) {
79- if (!\is_array ($ data ) || !isset ($ data [$ k ])) {
92+ if (! \is_array ($ data ) || ! isset ($ data [$ k ])) {
8093 return $ default ;
8194 }
8295
@@ -87,19 +100,18 @@ private function getConfigByPath(string $keyPath, $default = null)
87100 }
88101
89102 /**
90- * @param string $keyPath
91- * @param string|null $value
103+ * @param mixed|null $value
92104 */
93105 private function setByPath (string $ keyPath , $ value = null ): void
94106 {
95- $ keyArr = \explode ('/ ' , $ keyPath );
107+ $ keyArr = \explode ('/ ' , $ keyPath );
96108 $ pointer = &$ this ->config ;
97109 while (($ k = \array_shift ($ keyArr )) !== null ) {
98- if (!\is_array ($ pointer )) {
110+ if (! \is_array ($ pointer )) {
99111 $ pointer = [];
100112 }
101113
102- if (!isset ($ pointer [$ k ])) {
114+ if (! isset ($ pointer [$ k ])) {
103115 $ pointer [$ k ] = null ;
104116 }
105117
0 commit comments