Factory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
c 1
b 0
f 1
dl 0
loc 28
ccs 6
cts 6
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __callStatic() 0 3 1
A make() 0 7 1
1
<?php
2
3
namespace EasyIM;
4
5
/**
6
 * Class Factory
7
 *
8
 * @method static \EasyIM\TencentIM\Application  TencentIM(array $config)
9
 */
10
class Factory
11
{
12
    /**
13
     * @param string $name
14
     * @param array  $config
15
     *
16
     * @return \EasyIM\Kernel\ServiceContainer
17
     */
18 1
    public static function make($name, array $config)
19
    {
20 1
        $namespace = Kernel\Support\Str::studly($name);
21
22 1
        $application = "\\EasyIM\\{$namespace}\\Application";
23
24 1
        return new $application($config);
25
    }
26
27
    /**
28
     * Dynamically pass methods to the application.
29
     *
30
     * @param string $name
31
     * @param array  $arguments
32
     *
33
     * @return mixed
34
     */
35 1
    public static function __callStatic($name, $arguments)
36
    {
37 1
        return self::make($name, ...$arguments);
0 ignored issues
show
Bug introduced by
$arguments is expanded, but the parameter $config of EasyIM\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

37
        return self::make($name, /** @scrutinizer ignore-type */ ...$arguments);
Loading history...
38
    }
39
}
40