File tree Expand file tree Collapse file tree 2 files changed +51
-1
lines changed
Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change 2323 "autoload" : {
2424 "psr-4" : {
2525 "Leaf\\ " : " src"
26- }
26+ },
27+ "files" : [
28+ " src/functions.php"
29+ ]
2730 },
2831 "minimum-stability" : " stable" ,
2932 "require" : {
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ if (!function_exists ('session ' )) {
4+ /**
5+ * Return session data/object or set session data
6+ *
7+ * @param string|null $key — The session data to set/get
8+ * @param mixed $key — The data to set
9+ */
10+ function session ($ key = null , $ value = null )
11+ {
12+ if (!$ key && !$ value ) {
13+ return new \Leaf \Http \Session ();
14+ }
15+
16+ if (!$ value && ($ key && is_string ($ key ))) {
17+ return \Leaf \Http \Session::get ($ key );
18+ }
19+
20+ if (!$ value && ($ key && is_array ($ key ))) {
21+ return \Leaf \Http \Session::set ($ key );
22+ }
23+
24+ return \Leaf \Http \Session::set ($ key , $ value );
25+ }
26+ }
27+
28+ if (!function_exists ('flash ' )) {
29+ /**
30+ * Return flash data/object or set flash data
31+ *
32+ * @param string|null $key — The flash data to set/get
33+ * @param mixed $key — The data to set
34+ */
35+ function flash ($ key = null , $ value = null )
36+ {
37+ if (!$ key && !$ value ) {
38+ return new \Leaf \Flash ();
39+ }
40+
41+ if (!$ value && is_string ($ key )) {
42+ return \Leaf \Flash::display ($ key );
43+ }
44+
45+ return \Leaf \Flash::set ($ key , $ value );
46+ }
47+ }
You can’t perform that action at this time.
0 commit comments