Passed
Push — master ( 34feb7...8dc288 )
by wannanbigpig
02:47
created

Application   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 63
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setMethod() 0 5 1
A __construct() 0 3 1
A __call() 0 3 1
A verify() 0 3 1
1
<?php
2
/**
3
 * Application.php
4
 *
5
 * Created by PhpStorm.
6
 *
7
 * author: liuml  <[email protected]>
8
 * DateTime: 2019-04-04  16:31
9
 */
10
11
namespace WannanBigPig\Alipay\Notify;
12
13
use WannanBigPig\Alipay\Kernel\Support\Support;
14
use WannanBigPig\Supports\Exceptions;
15
16
class Application
17
{
18
    use Notify;
19
20
    /**
21
     * @var string
22
     */
23
    const SUCCESS = 'success';
24
25
    /**
26
     * @var string
27
     */
28
    const FAIL = 'fail';
29
30
    /**
31
     * @var string
32
     */
33
    protected $method = '';
34
35
    /**
36
     * Application constructor.
37
     */
38 1
    public function __construct()
39
    {
40 1
        $this->setMethod();
41 1
    }
42
43
    /**
44
     * __call
45
     *
46
     * @param $name
47
     * @param $arguments
48
     *
49
     * @return mixed
50
     */
51 1
    public function __call($name, $arguments)
52
    {
53 1
        return call_user_func([$this, $name], ...$arguments);
54
    }
55
56
    /**
57
     * setMethod
58
     */
59 1
    protected function setMethod()
60
    {
61 1
        Support::$config->set('event', [
62 1
            'driver' => 'Notify',
63 1
            'method' => $this->method,
64
        ]);
65 1
    }
66
67
    /**
68
     * verify
69
     *
70
     * @param  mixed  $data
71
     *
72
     * @return bool
73
     *
74
     * @throws Exceptions\InvalidArgumentException
75
     */
76 1
    public function verify($data = null)
77
    {
78 1
        return Support::notifyVerify($data);
79
    }
80
}
81