@@ -19,6 +19,9 @@ class FormatCache
1919 // this array caches loose attribute data which are added over time by the presenters
2020 private static array $ actionToRequestParamDataMap = [];
2121
22+ // array that caches Format attribute format strings for actions
23+ private static array $ actionToFormatMap = [];
24+
2225 /**
2326 * @param string $actionPath The presenter class name joined with the name of the action method.
2427 * @return bool Returns whether the loose parameters of the action are cached.
@@ -28,6 +31,33 @@ public static function looseParametersCached(string $actionPath): bool
2831 return array_key_exists ($ actionPath , self ::$ actionToRequestParamDataMap );
2932 }
3033
34+ /**
35+ * @param string $actionPath The presenter class name joined with the name of the action method.
36+ * @return bool Returns whether the action Format attribute string was cached.
37+ */
38+ public static function formatAttributeStringCached (string $ actionPath ): bool
39+ {
40+ return array_key_exists ($ actionPath , self ::$ actionToFormatMap );
41+ }
42+
43+ /**
44+ * @param string $actionPath The presenter class name joined with the name of the action method.
45+ * @param string $format The attribute format string.
46+ */
47+ public static function cacheFormatAttributeString (string $ actionPath , string $ format )
48+ {
49+ self ::$ actionToFormatMap [$ actionPath ] = $ format ;
50+ }
51+
52+ /**
53+ * @param string $actionPath The presenter class name joined with the name of the action method.
54+ * @return bool Returns action Format attribute string.
55+ */
56+ public static function getFormatAttributeString (string $ actionPath ): string
57+ {
58+ return self ::$ actionToFormatMap [$ actionPath ];
59+ }
60+
3161 /**
3262 * @param string $actionPath The presenter class name joined with the name of the action method.
3363 * @return array Returns the cached RequestParamData array of the loose attributes.
0 commit comments