Passed
Pull Request — master (#103)
by Chenyi
04:00
created

Crawler::__construct()   C

Complexity

Conditions 9
Paths 256

Size

Total Lines 25
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 9
eloc 16
nc 256
nop 4
dl 0
loc 25
rs 6.5222
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Controllers\VirtualCrawler;
4
5
use App\Http\Controllers\VirtualCrawler\CodeForces\CodeForces;
6
use App\Http\Controllers\VirtualCrawler\ContestHunter\ContestHunter;
7
use App\Http\Controllers\VirtualCrawler\POJ\POJ;
8
use App\Http\Controllers\VirtualCrawler\PTA\PTA;
9
use App\Http\Controllers\VirtualCrawler\Vijos\Vijos;
10
use App\Http\Controllers\VirtualCrawler\UVa\UVa;
11
use App\Models\ProblemModel;
12
use Auth;
13
14
class Crawler
15
{
16
    public $data=null;
17
18
    /**
19
     * Initial
20
     *
21
     * @return Response
0 ignored issues
show
Bug introduced by
The type App\Http\Controllers\VirtualCrawler\Response was not found. Did you mean Response? If so, make sure to prefix the type with \.
Loading history...
22
     */
23
    public function __construct($name, $action, $con, $cached=false)
24
    {
25
        if ($name=="CodeForces") {
26
            $crawler=new CodeForces($action, $con, $cached);
27
        }
28
        if ($name=="ContestHunter") {
29
            $crawler=new ContestHunter($action, $con, $cached);
30
        }
31
        if ($name=="POJ") {
32
            $crawler=new POJ($action, $con, $cached);
33
        }
34
        if ($name=="PTA") {
35
            $crawler=new PTA($action, $con, $cached);
36
        }
37
        if ($name=="Vijos") {
38
            $crawler=new Vijos($action, $con, $cached);
39
        }
40
        if ($name=="UVa") {
41
            $crawler=new UVa($action, $con, $cached);
42
        }
43
        if ($name=="HDU") {
44
            $crawler=new HDU($action, $con, $cached);
45
        }
46
        if (isset($crawler)) {
47
            $this->data=$crawler->data;
48
        }
49
    }
50
}
51