File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,13 @@ class FileSize
13
13
*/
14
14
private $ bytes ;
15
15
16
+ /**
17
+ * A list of user filesize units previously mapped.
18
+ *
19
+ * @var array
20
+ */
21
+ private $ unitCache = [];
22
+
16
23
/**
17
24
* A mapping of filesize units to lowercase strings.
18
25
*
@@ -151,10 +158,15 @@ public function asAuto($precision = 2)
151
158
*/
152
159
private function lookupUnit ($ unitString )
153
160
{
161
+ if (isset ($ this ->unitCache [$ unitString ])) {
162
+ return $ this ->unitCache [$ unitString ];
163
+ }
164
+
154
165
$ lowerUnitString = strtolower ($ unitString );
155
166
156
167
foreach (self ::$ unitMap as $ key => $ list ) {
157
168
if (in_array ($ lowerUnitString , $ list )) {
169
+ $ this ->unitCache [$ unitString ] = $ key ;
158
170
return $ key ;
159
171
}
160
172
}
Original file line number Diff line number Diff line change 13
13
</testsuite >
14
14
</testsuites >
15
15
16
+ <php >
17
+ <!-- <ini name="memory_limit" value="256M" /> -->
18
+ </php >
19
+
16
20
</phpunit >
You can’t perform that action at this time.
0 commit comments