Passed
Branch feature/babel (9a8402)
by John
03:52
created

Crawler::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Babel\Crawl;
4
5
use App\Models\ProblemModel;
6
use Auth;
7
8
class Crawler
9
{
10
    public $data=null;
11
12
    /**
13
     * Initial
14
     *
15
     * @return Response
0 ignored issues
show
Bug introduced by
The type App\Babel\Crawl\Response was not found. Did you mean Response? If so, make sure to prefix the type with \.
Loading history...
16
     */
17
    public function __construct($conf)
18
    {
19
        $crawler=self::create($conf);
20
        if (!is_null($crawler) && isset($crawler)) $this->data=$crawler->data;
21
    }
22
23
    public static function create($conf) {
24
        $name=$conf["name"];
25
        $className = "App\\Babel\\Extension\\$name\\Crawler";
26
        if(class_exists($className)) {
27
            return new $className($conf);
28
        } else {
29
            return null;
30
        }
31
    }
32
}
33