You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
640 B
PHTML

5 years ago
<?php
namespace AliyunMNS;
use AliyunMNS\Exception\MnsException;
use AliyunMNS\Responses\BaseResponse;
class AsyncCallback
{
protected $succeedCallback;
protected $failedCallback;
public function __construct(callable $succeedCallback, callable $failedCallback)
{
$this->succeedCallback = $succeedCallback;
$this->failedCallback = $failedCallback;
}
public function onSucceed(BaseResponse $result)
{
return call_user_func($this->succeedCallback, $result);
}
public function onFailed(MnsException $e)
{
return call_user_func($this->failedCallback, $e);
}
}
?>