File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the PHP-UNDERSCORE package.
5
+ *
6
+ * (c) Jitendra Adhikari <[email protected] >
7
+ * <https://github.com/adhocore>
8
+ *
9
+ * Licensed under MIT license.
10
+ */
11
+
12
+ namespace Ahc \Underscore ;
13
+
14
+ /**
15
+ * Source: Laravel HigherOrderProxy
16
+ *
17
+ * @link https://github.com/laravel/framework/pull/16267
18
+ */
19
+ class HigherOrderMessage
20
+ {
21
+ protected $ underscore ;
22
+ protected $ method ;
23
+
24
+ public function __construct (UnderscoreBase $ underscore , $ method )
25
+ {
26
+ $ this ->underscore = $ underscore ;
27
+ $ this ->method = $ method ;
28
+ }
29
+
30
+ public function __call ($ method , $ args )
31
+ {
32
+ $ this ->underscore ->{$ this ->method }(function ($ item ) use ($ method , $ args ) {
33
+ return \call_user_func_array ([$ item , $ method ], $ args );
34
+ });
35
+ }
36
+
37
+ public function __get ($ prop )
38
+ {
39
+ $ this ->underscore ->{$ this ->method }(function ($ item ) use ($ prop ) {
40
+ $ props = \array_column ([$ item ], $ prop );
41
+
42
+ return $ props ? $ props [0 ] : null ;
43
+ });
44
+ }
45
+ }
You can’t perform that action at this time.
0 commit comments