Completed
Push — master ( 549acb...017947 )
by frey
11s
created

Suite::createAuthorizerApplication()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
nc 1
nop 2
dl 0
loc 12
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
namespace EntWeChat\Suite;
4
5
use EntWeChat\Support\Traits\PrefixedContainer;
6
7
/**
8
 * Class Suite.
9
 *
10
 * @property \EntWeChat\Suite\Api\BaseApi          $api
11
 * @property \EntWeChat\Suite\Api\PreAuthorization $pre_auth
12
 * @property \EntWeChat\Suite\Guard                $server
13
 * @property \EntWeChat\Suite\AccessToken          $access_token
14
 *
15
 * @method \EntWeChat\Support\Collection getAuthorizationInfo($authCode = null)
16
 * @method \EntWeChat\Support\Collection getAuthorizerInfo($authorizerCorpId, $permanentCode)
17
 * @method \EntWeChat\Support\Collection setAuthorizerOption($preAuthCode, $sessionInfo)
18
 */
19
class Suite
20
{
21
    use PrefixedContainer;
22
23
    /**
24
     * Create an instance of the EntWeChat for the given authorizer.
25
     *
26
     * @param string $corpId        Authorizer CorpId
0 ignored issues
show
Documentation introduced by
There is no parameter named $corpId. Did you maybe mean $authorizerCorpId?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
27
     * @param string $permanentCode Authorizer permanent-code
28
     *
29
     * @return \EntWeChat\Foundation\Application
30
     */
31
    public function createAuthorizerApplication($authorizerCorpId, $permanentCode)
32
    {
33
        $this->fetch('authorization')
34
             ->setAuthorizerCorpId($authorizerCorpId)
35
             ->setAuthorizerPermanentCode($permanentCode);
36
37
        $application = $this->fetch('app');
38
        $application['access_token'] = $this->fetch('authorizer_access_token');
39
        $application['oauth'] = $this->fetch('oauth');
40
41
        return $application;
42
    }
43
44
    /**
45
     * Quick access to the base-api.
46
     *
47
     * @param string $method
48
     * @param array  $args
49
     *
50
     * @return mixed
51
     */
52
    public function __call($method, $args)
53
    {
54
        return call_user_func_array([$this->api, $method], $args);
55
    }
56
}
57