This repository was archived by the owner on Jul 24, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +56
-1
lines changed Expand file tree Collapse file tree 2 files changed +56
-1
lines changed Original file line number Diff line number Diff line change 17
17
use Illuminate \Support \Facades \Bus ;
18
18
use Illuminate \Support \Facades \Config ;
19
19
use Illuminate \Support \Facades \Event ;
20
- use Illuminate \Support \Traits \ForwardsCalls ;
21
20
22
21
/** @mixin EloquentUserProvider */
23
22
class DatabaseUserProvider extends UserProvider
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Adldap \Laravel \Auth ;
4
+
5
+ use Error ;
6
+ use BadMethodCallException ;
7
+
8
+ trait ForwardsCalls
9
+ {
10
+ /**
11
+ * Forward a method call to the given object.
12
+ *
13
+ * @param mixed $object
14
+ * @param string $method
15
+ * @param array $parameters
16
+ *
17
+ * @throws BadMethodCallException
18
+ *
19
+ * @return mixed
20
+ */
21
+ protected function forwardCallTo ($ object , $ method , $ parameters )
22
+ {
23
+ try {
24
+ return $ object ->{$ method }(...$ parameters );
25
+ } catch (Error | BadMethodCallException $ e ) {
26
+ $ pattern = '~^Call to undefined method (?P<class>[^:]+)::(?P<method>[^\(]+)\(\)$~ ' ;
27
+
28
+ if (! preg_match ($ pattern , $ e ->getMessage (), $ matches )) {
29
+ throw $ e ;
30
+ }
31
+
32
+ if ($ matches ['class ' ] != get_class ($ object ) ||
33
+ $ matches ['method ' ] != $ method ) {
34
+ throw $ e ;
35
+ }
36
+
37
+ static ::throwBadMethodCallException ($ method );
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Throw a bad method call exception for the given method.
43
+ *
44
+ * @param string $method
45
+ *
46
+ * @throws BadMethodCallException
47
+ *
48
+ * @return void
49
+ */
50
+ protected static function throwBadMethodCallException ($ method )
51
+ {
52
+ throw new BadMethodCallException (sprintf (
53
+ 'Call to undefined method %s::%s() ' , static ::class, $ method
54
+ ));
55
+ }
56
+ }
You can’t perform that action at this time.
0 commit comments