Factory::make()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the strays/baidu-ai.
5
 *
6
 * (c) strays <[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 Strays\BaiDuAi;
13
14
use Strays\BaiDuAi\Kernel\Support\Str;
15
16
class Factory
17
{
18
    /**
19
     * @param $name
20
     * @param array $config
21
     *
22
     * @return mixed
23
     */
24
    public static function make($name, array $config)
25
    {
26
        $namespace = Str::studly($name);
27
28
        $application = "\\Strays\\BaiDuAi\\{$namespace}\\Application";
29
30
        return new $application($config);
31
    }
32
33
    /**
34
     * @param $name
35
     * @param $arguments
36
     *
37
     * @return mixed
38
     */
39
    public static function __callStatic($name, $arguments)
40
    {
41
        return self::make($name, ...$arguments);
42
    }
43
}
44