11<?php
22namespace PhpUnitConversion ;
33
4- use PhpUnitConversion \ Unit ;
4+ use PhpUnitConversion ;
55
66abstract class Map
77{
@@ -11,12 +11,16 @@ abstract class Map
1111 protected static $ paths = [[__DIR__ . '/Unit/ ' , __NAMESPACE__ . '\\Unit ' , false , null ]];
1212
1313 /** @var array */
14- public static $ map = [];
14+ protected static $ map = [];
1515
1616 /** @var array */
17- public static $ values = [];
17+ protected static $ values = [];
1818
19- public static function &value ($ mapType )
19+ /**
20+ * @param string $mapType
21+ * @return array
22+ */
23+ protected static function &value ($ mapType )
2024 {
2125 return static ::$ values [$ mapType ];
2226 }
@@ -32,13 +36,21 @@ public static function add($path, $namespace = '', $unitType = '')
3236 self ::$ paths [] = [$ path , $ namespace , false , $ unitType ];
3337 }
3438
39+ /**
40+ * @return void
41+ */
42+ public static function resetValues ()
43+ {
44+ self ::$ values = [];
45+ }
46+
3547 /**
3648 * @return void
3749 */
3850 public static function reset ()
3951 {
4052 self ::$ map = [];
41- self ::$ values = [] ;
53+ self ::resetValues () ;
4254 }
4355
4456 /**
@@ -61,6 +73,8 @@ public static function load()
6173 if (self ::loadPath ($ path , $ namespace , $ unitType )) {
6274 self ::$ paths [$ k ][2 ] = true ;
6375 $ newlyLoaded = true ;
76+
77+ self ::resetValues ();
6478 }
6579 }
6680 }
@@ -72,7 +86,7 @@ public static function load()
7286 * @param string $namespace
7387 * @return string
7488 */
75- public static function loadPath ($ path , $ namespace = '' , $ unitType = '' )
89+ protected static function loadPath ($ path , $ namespace = '' , $ unitType = '' )
7690 {
7791 if (is_file ($ path )) {
7892 $ classes = self ::loadFile ($ path , $ namespace );
@@ -94,7 +108,7 @@ public static function loadPath($path, $namespace = '', $unitType = '')
94108 * @param string $namespace
95109 * @return array
96110 */
97- public static function loadDirectory ($ directory , $ namespace = '' )
111+ protected static function loadDirectory ($ directory , $ namespace = '' )
98112 {
99113 $ classes = [];
100114 foreach (glob ($ directory . '/* ' . self ::PHP_EXTENSION ) as $ file ) {
@@ -114,7 +128,7 @@ public static function loadDirectory($directory, $namespace = '')
114128 * @param string $namespace
115129 * @return string|array
116130 */
117- public static function loadFile ($ file , $ namespace = '' )
131+ protected static function loadFile ($ file , $ namespace = '' )
118132 {
119133 if (file_exists ($ file )) {
120134 $ fileName = basename ($ file , self ::PHP_EXTENSION );
0 commit comments