Factory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 26
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A make() 0 5 1
A __callStatic() 0 5 1
1
<?php
2
3
/*
4
 * This file is part of the docodeit/wechat.
5
 *
6
 * (c) docodeit <[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 JinWeChat;
13
14
/**
15
 * 入口文件.
16
 *
17
 * @method static OfficialAccount\Application    officialAccount(array $config)
18
 **/
19
class Factory
20
{
21
    /**
22
     * @param $name
23
     * @param array $config
24
     *
25
     * @return mixed
26
     */
27
    public static function make($name, array $config)
28
    {
29
        $application = "\\JinWeChat\\{$name}\\Application";
30
31
        return new $application($config);
32
    }
33
34
    /**
35
     * @param $name
36
     * @param $args
37
     *
38
     * @return mixed
39
     */
40
    public static function __callStatic($name, $args)
41
    {
42
        $name = ucwords(str_replace(['-', '_'], ' ', $name));
43
44
        return self::make($name, ...$args);
0 ignored issues
show
Bug introduced by
$args is expanded, but the parameter $config of JinWeChat\Factory::make() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

44
        return self::make($name, /** @scrutinizer ignore-type */ ...$args);
Loading history...
45
    }
46
}
47