Completed
Push — master ( 760626...81d11d )
by Carlos
02:46
created

EventHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 0
cts 4
cp 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of the overtrue/wechat.
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
/**
13
 * EventHandler.php.
14
 *
15
 * Part of Overtrue\WeChat.
16
 *
17
 * For the full copyright and license information, please view the LICENSE
18
 * file that was distributed with this source code.
19
 *
20
 * @author    mingyoung <[email protected]>
21
 * @copyright 2016
22
 *
23
 * @see      https://github.com/overtrue
24
 * @see      http://overtrue.me
25
 */
26
27
namespace EasyWeChat\OpenPlatform\EventHandlers;
28
29
use EasyWeChat\OpenPlatform\VerifyTicket;
30
use EasyWeChat\Support\Collection;
31
32
abstract class EventHandler
33
{
34
    /**
35
     * Component verify ticket instance.
36
     *
37
     * @var \EasyWeChat\OpenPlatform\VerifyTicket
38
     */
39
    protected $verifyTicket;
40
41
    /**
42
     * EventHandler constructor.
43
     *
44
     * @param VerifyTicket $verifyTicket
45
     */
46
    public function __construct(VerifyTicket $verifyTicket)
47
    {
48
        $this->verifyTicket = $verifyTicket;
49
    }
50
51
    /**
52
     * Handle event.
53
     *
54
     * @param Collection $message
55
     *
56
     * @return mixed
57
     */
58
    abstract public function handle(Collection $message);
59
60
    /**
61
     * Forward handle.
62
     *
63
     * @param Collection $message
64
     *
65
     * @return Collection
66
     */
67
    public function forward(Collection $message)
68
    {
69
        //
70
        return $message;
71
    }
72
}
73