77 */
88namespace UserFrosting \Sprinkle \Core \Alert ;
99
10+ use Illuminate \Cache \TaggedCache ;
11+ use UserFrosting \I18n \MessageTranslator ;
12+ use UserFrosting \Support \Repository \Repository ;
13+
1014/**
11- * CacheAlertStream Class
12- *
13- * Implements a message stream for use between HTTP requests, with i18n support via the MessageTranslator class
14- * Using the cache system to store the alerts. Note that the tags are added each time instead of the constructor
15- * since the session_id can change when the user logs in or out
15+ * CacheAlertStream Class
16+ * Implements a message stream for use between HTTP requests, with i18n
17+ * support via the MessageTranslator class using the cache system to store
18+ * the alerts. Note that the tags are added each time instead of the
19+ * constructor since the session_id can change when the user logs in or out
1620 *
17- * @author Louis Charette
21+ * @author Louis Charette
1822 */
1923class CacheAlertStream extends AlertStream
2024{
2125 /**
22- * @var Illuminate\\Cache\\*Store Object We use the cache object so that added messages will automatically appear in the cache.
26+ * @var TaggedCache Object We use the cache object so that added messages will automatically appear in the cache.
2327 */
2428 protected $ cache ;
2529
2630 /**
27- * @var Illuminate\\Cache\\*Store Object We use the cache object so that added messages will automatically appear in the cache.
31+ * @var Repository Object We use the cache object so that added messages will automatically appear in the cache.
2832 */
2933 protected $ config ;
3034
3135 /**
32- * Create a new message stream.
36+ * Create a new message stream.
37+ *
38+ * @param string $messagesKey Store the messages under this key
39+ * @param MessageTranslator|null $translator
40+ * @param TaggedCache $cache
41+ * @param Repository $config
3342 */
34- public function __construct ($ messagesKey , $ translator = null , $ cache , $ config )
43+ public function __construct ($ messagesKey , MessageTranslator $ translator = null , TaggedCache $ cache , Repository $ config )
3544 {
3645 $ this ->cache = $ cache ;
3746 $ this ->config = $ config ;
3847 parent ::__construct ($ messagesKey , $ translator );
3948 }
4049
4150 /**
42- * Get the messages from this message stream.
51+ * Get the messages from this message stream.
4352 *
44- * @return array An array of messages, each of which is itself an array containing "type" and "message" fields.
53+ * @return array An array of messages, each of which is itself an array containing "type" and "message" fields.
4554 */
4655 public function messages ()
4756 {
@@ -53,15 +62,20 @@ public function messages()
5362 }
5463
5564 /**
56- * Clear all messages from this message stream.
65+ * Clear all messages from this message stream.
66+ *
67+ * @return void
5768 */
5869 public function resetMessageStream ()
5970 {
6071 $ this ->cache ->tags ([$ this ->config ['cache.prefix ' ], "_s " .session_id ()])->forget ($ this ->messagesKey );
6172 }
6273
6374 /**
64- * Save messages to the stream
75+ * Save messages to the stream
76+ *
77+ * @param string $messages The message
78+ * @return void
6579 */
6680 protected function saveMessages ($ messages )
6781 {
0 commit comments