@@ -242,8 +242,8 @@ public static function onInsight($func) {
242242 * ```
243243 *
244244 * @param string $funcName Name of defined function
245- * @param array $data Array of parameters passed to function
246- * @param User $user Request user
245+ * @param array $params Array of parameters passed to function
246+ * @param \LeanCloud\ User $user Request user
247247 * @param array $meta Optional parameters that will be passed to
248248 * user function
249249 * @return mixed
@@ -258,6 +258,26 @@ public static function run($funcName, $params, $user=null, $meta=array()) {
258258 return call_user_func ($ func , $ params , $ user , $ meta );
259259 }
260260
261+ /**
262+ * Invokes a remote cloud function
263+ *
264+ * Example:
265+ *
266+ * ```php
267+ * LeanEngine::runRemote("sayHello", array("name" => "alice"));
268+ * ```
269+ *
270+ * @param string $funcName Name of defined function
271+ * @param array $params Array of parameters passed to function
272+ * @param string $sessionToken run this function as the user corresponding to this session token
273+ *
274+ * @return array JSON decoded associated array
275+ * @see self::run
276+ */
277+ public static function runRemote ($ funcName , $ params , $ sessionToken =null ) {
278+ return Client::post ("/functions/ {$ funcName }" , $ params , $ sessionToken );
279+ }
280+
261281 /**
262282 * Start cloud function Stand-alone mode, start to process request.
263283 */
@@ -288,8 +308,8 @@ public static function stop() {
288308 *
289309 * @param string $className Classname
290310 * @param string $hookName Hook name, e.g. beforeUpdate
291- * @param LeanObject $object The object of attached hook
292- * @param User $user Request user
311+ * @param \LeanCloud\ LeanObject $object The object of attached hook
312+ * @param \LeanCloud\ User $user Request user
293313 * @param array $meta Optional parameters that will be passed to
294314 * user function
295315 * @return mixed
@@ -310,9 +330,10 @@ public static function runHook($className, $hookName, $object,
310330 /**
311331 * Run hook when a user logs in
312332 *
313- * @param User $user The user object that tries to login
333+ * @param \LeanCloud\ User $user The user object that tries to login
314334 * @param array $meta Optional parameters that will be passed to
315335 * user function
336+ * @return mixed
316337 * @throws FunctionError
317338 * @see self::onLogin
318339 */
@@ -324,9 +345,10 @@ public static function runOnLogin($user, $meta=array()) {
324345 * Run hook when user verified by Email or SMS
325346 *
326347 * @param string $type Either "sms" or "email", case-sensitive
327- * @param User $user The verifying user
348+ * @param \LeanCloud\ User $user The verifying user
328349 * @param array $meta Optional parameters that will be passed to
329350 * user function
351+ * @return mixed
330352 * @throws FunctionError
331353 * @see self::onVerified
332354 */
0 commit comments