File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
5
5
The format is based on [ Keep a Changelog] [ keepachangelog ] and this project adheres to [ Semantic Versioning] [ semver ] .
6
6
7
+ ## v4.3.0
8
+
9
+ ### Added
10
+
11
+ - Add global function: ` remoteStaticCall `
12
+
7
13
## v4.2.0
8
14
9
15
### Added
Original file line number Diff line number Diff line change @@ -156,3 +156,28 @@ function class_uses_recursive($class): array
156
156
return array_unique ($ results );
157
157
}
158
158
}
159
+
160
+
161
+ if (!function_exists ('remoteStaticCall ' )) {
162
+ /**
163
+ * Returns result of an object's method if it exists in the object.
164
+ *
165
+ * @param string|object|null $class
166
+ * @param string $method
167
+ * @param mixed ...$params
168
+ *
169
+ * @return mixed
170
+ */
171
+ function remoteStaticCall (object |string |null $ class , string $ method , mixed ...$ params ): mixed
172
+ {
173
+ if (!$ class ) {
174
+ return null ;
175
+ }
176
+
177
+ if (is_object ($ class ) || (is_string ($ class ) && class_exists ($ class ))) {
178
+ return $ class ::$ method (...$ params );
179
+ }
180
+
181
+ return null ;
182
+ }
183
+ }
You can’t perform that action at this time.
0 commit comments