Completed
Push — master ( 8787ba...721c87 )
by wannanbigpig
05:01 queued 11s
created

Application::handleNotify()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
/*
3
 * This file is part of the wannanbigpig/alipay.
4
 *
5
 * (c) wannanbigpig <[email protected]>
6
 *
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace WannanBigPig\Alipay\Payment;
12
13
use Closure;
14
use WannanBigPig\Alipay\Kernel\ServiceContainer;
15
use WannanBigPig\Alipay\Payment\Notify\Handle;
16
17
/**
18
 * Class Application
19
 *
20
 * @author   liuml  <[email protected]>
21
 * @DateTime 2019-07-18  16:13
22
 *
23
 * @property Pay\Client    $pay
24
 * @property Refund\Client $refund
25
 * @property Bill\Client   $bill
26
 *
27
 * @method mixed pay(array $params)
28
 * @method mixed create(array $params)
29
 * @method mixed preCreate(array $params)
30
 * @method mixed close(string $tradeNo, string $outTradeNo = null, string $operatorId = null)
31
 * @method mixed refund(string $tradeNo, $amount, string $outTradeNo = null, array $params = [])
32
 * @method mixed query(string $tradeNo, string $outTradeNo = null, string $orgPid = null)
33
 * @method mixed cancel(string $tradeNo, string $outTradeNo = null)
34
 * @method mixed orderSettle(string $outRequestNo, string $tradeNo, array $royaltyParameters, string $operatorId = null)
35
 * @method mixed orderInfoSync(string $tradeNo, string $outRequestNo, string $bizType, string $origRequestNo = null, string $orderBizInfo = null)
36
 */
37
class Application extends ServiceContainer
38
{
39
40
    /**
41
     * @var array
42
     */
43
    protected $providers = [
44
        'base' => Base\Client::class,
45
        'pay' => Pay\Client::class,
46
        'refund' => Refund\Client::class,
47
        'bill' => Bill\Client::class,
48
    ];
49
50
    /**
51
     * @param string $name
52
     * @param array  $arguments
53
     *
54
     * @return mixed
55
     */
56
    public function __call($name, $arguments)
57
    {
58
        return call_user_func_array([$this['base'], $name], $arguments);
59
    }
60
61
    /**
62
     * handleNotify.
63
     *
64
     * @param \Closure $closure
65
     *
66
     * @return \Symfony\Component\HttpFoundation\Response
67
     */
68
    public function handleNotify(Closure $closure)
69
    {
70
        return (new Handle($this))->run($closure);
71
    }
72
}
73