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

Crawler   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 7 2
A __construct() 0 4 3
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