for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the overtrue/wechat.
*
* (c) overtrue <[email protected]>
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace EasyWeChat\Payment\Notify;
use Symfony\Component\HttpFoundation\Response;
class Scanned extends Handler
{
protected $check = false;
/**
* @var string|null
protected $alert;
* @param string $message
* @return $this
public function alert(string $message)
$this->alert = $message;
return $this;
}
* @param callable $callback
* @return \Symfony\Component\HttpFoundation\Response
public function handle(callable $callback): Response
$result = $callback->__invoke($this->getMessage(), [$this, 'fail'], [$this, 'alert']);
__invoke
$callback
callable
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.
$attributes = [
'result_code' => is_null($this->alert) && is_null($this->fail) ? static::SUCCESS : static::FAIL,
'err_code_des' => $this->alert,
];
if (is_null($this->alert) && is_string($result)) {
$attributes += [
'appid' => $this->app['config']->app_id,
'mch_id' => $this->app['config']->mch_id,
'nonce_str' => uniqid(),
'prepay_id' => $result,
return $this->respondWith($attributes, true)->toResponse();
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.