11<?php
2+ declare (strict_types=1 );
3+
24namespace EpSDK \Configuration ;
35
46use EpSDK \Exception \JSONDecodingException ;
@@ -28,7 +30,7 @@ class Configuration
2830 * @throws JSONDecodingException Thrown if the file cannot be found or is no valid JSON.
2931 * @since 0.4.0
3032 */
31- public static function addConfigurationFromFile (string $ pathToFile ): bool
33+ public static function addFromFile (string $ pathToFile ): bool
3234 {
3335 $ configurationArray = \json_decode (\file_get_contents ($ pathToFile ), true );
3436 if (null === $ configurationArray ) {
@@ -37,7 +39,7 @@ public static function addConfigurationFromFile(string $pathToFile): bool
3739 }
3840 /** @var array $configurationArray */
3941 foreach ($ configurationArray as $ module => $ configuration ) {
40- self ::extendConfiguration ($ configuration , $ module );
42+ self ::extend ($ configuration , $ module );
4143 }
4244 return true ;
4345 }
@@ -50,12 +52,12 @@ public static function addConfigurationFromFile(string $pathToFile): bool
5052 * @return bool
5153 * @since 0.4.0
5254 */
53- public static function extendConfiguration (array $ configuration , string $ module ): bool
55+ public static function extend (array $ configuration , string $ module ): bool
5456 {
5557 if (isset (self ::$ configuration [$ module ])) {
5658 self ::$ configuration [$ module ] = \array_merge (self ::$ configuration [$ module ], $ configuration );
5759 } else {
58- self ::setConfiguration ($ configuration , $ module );
60+ self ::set ($ configuration , $ module );
5961 }
6062 return true ;
6163 }
@@ -67,12 +69,11 @@ public static function extendConfiguration(array $configuration, string $module)
6769 * @return array
6870 * @since 0.4.0
6971 */
70- public static function getConfiguration (string $ module = null ): array
72+ public static function get (string $ module = null ): array
7173 {
72- if (null === $ module ) {
73- return self ::$ configuration ;
74- }
75- return self ::$ configuration [$ module ] ?? [];
74+ return null === $ module
75+ ? self ::$ configuration
76+ : self ::$ configuration [$ module ] ?? [];
7677 }
7778
7879 /**
@@ -102,7 +103,7 @@ public static function saveToFile(string $fileName, string $module = null): bool
102103 * @return bool
103104 * @since 0.4.0
104105 */
105- public static function setConfiguration (array $ configuration , string $ module = null ): bool
106+ public static function set (array $ configuration , string $ module = null ): bool
106107 {
107108 if (null === $ module ) {
108109 self ::$ configuration = $ configuration ;
@@ -115,10 +116,11 @@ public static function setConfiguration(array $configuration, string $module = n
115116 /**
116117 * Reset the configuration.
117118 *
119+ * @param string $module
118120 * @return bool
119121 * @since 0.4.0
120122 */
121- public static function resetConfiguration (string $ module = null ): bool
123+ public static function reset (string $ module = null ): bool
122124 {
123125 if (null !== $ module ) {
124126 unset(self ::$ configuration [$ module ]);
0 commit comments