Completed
Pull Request — master (#1414)
by milkmeowo
04:39
created

Application::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 4
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
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
namespace EasyWeChat\OpenWork\Work;
13
14
use EasyWeChat\OpenWork\Application as OpenWork;
15
use EasyWeChat\OpenWork\Work\Auth\AccessToken;
16
use EasyWeChat\Work\Application as Work;
17
18
/**
19
 * Application.
20
 *
21
 * @author xiaomin <[email protected]>
22
 */
23
class Application extends Work
24
{
25
    /**
26
     * Application constructor.
27
     *
28
     * @param string   $authCorpId
29
     * @param string   $permanentCode
30
     * @param OpenWork $component
31
     * @param array    $prepends
32
     */
33 1
    public function __construct(string $authCorpId, string $permanentCode, OpenWork $component, array $prepends = [])
34
    {
35 1
        parent::__construct($component->getConfig(), $prepends + [
36 1
                'access_token' => function ($app) use ($authCorpId, $permanentCode, $component) {
37 1
                    return new AccessToken($app, $authCorpId, $permanentCode, $component);
38 1
                },
39
            ]);
40 1
    }
41
}
42