We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 118ed65 commit ce3e63eCopy full SHA for ce3e63e
src/helpers.php
@@ -0,0 +1,25 @@
1
+<?php
2
+
3
+if (! function_exists('tap')) {
4
+ /**
5
+ * Call the given Closure with the given value then return the value.
6
+ *
7
+ * @param mixed $value
8
+ * @param callable|null $callback
9
+ * @return mixed
10
+ */
11
+ function tap($value, $callback = null)
12
+ {
13
+ if (is_null($callback)) {
14
+ if (class_exists(\Illuminate\Support\HigherOrderTapProxy::class)) {
15
+ return new \HigherOrderTapProxy\HigherOrderTapProxy($value);
16
+ }
17
18
+ return new \ZhenMu\Support\Utils\HigherOrderTapProxy($value);
19
20
21
+ $callback($value);
22
23
+ return $value;
24
25
+}
0 commit comments