Test Setup Failed
Push — master ( d37a6a...512c0e )
by Carlos
03:19
created

Authorized::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 0
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
 * Authorized.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
 * @author    lixiao <[email protected]>
22
 * @copyright 2016
23
 *
24
 * @see      https://github.com/overtrue
25
 * @see      http://overtrue.me
26
 */
27
28
namespace EasyWeChat\OpenPlatform\EventHandlers;
29
30
use EasyWeChat\OpenPlatform\Authorization;
31
use EasyWeChat\Support\Collection;
32
33
class Authorized implements EventHandler
34
{
35
    /**
36
     * @var Authorization
37
     */
38
    protected $authorization;
39
40
    public function __construct(Authorization $authorization)
41
    {
42
        $this->authorization = $authorization;
43
    }
44
45
    /**
46
     * {@inheritdoc}.
47
     */
48
    public function handle(Collection $message)
49
    {
50
        $this->authorization->setFromAuthMessage($message);
51
        return $this->authorization->handleAuthorization();
52
    }
53
}
54