Passed
Pull Request — master (#125)
by Chenyi
22:46
created

Crawler   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
F __construct() 0 31 11
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\Http\Controllers\VirtualCrawler\HDU\HDU;
12
use App\Http\Controllers\VirtualCrawler\UVaLive\UVaLive;
13
use App\Http\Controllers\VirtualCrawler\SPOJ\SPOJ;
14
use App\Models\ProblemModel;
15
use Auth;
16
17
class Crawler
18
{
19
    public $data=null;
20
21
    /**
22
     * Initial
23
     *
24
     * @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...
25
     */
26
    public function __construct($name, $action, $con, $cached=false)
27
    {
28
        if ($name=="CodeForces") {
29
            $crawler=new CodeForces($action, $con, $cached);
30
        }
31
        if ($name=="ContestHunter") {
32
            $crawler=new ContestHunter($action, $con, $cached);
33
        }
34
        if ($name=="POJ") {
35
            $crawler=new POJ($action, $con, $cached);
36
        }
37
        if ($name=="PTA") {
38
            $crawler=new PTA($action, $con, $cached);
39
        }
40
        if ($name=="Vijos") {
41
            $crawler=new Vijos($action, $con, $cached);
42
        }
43
        if ($name=="UVa") {
44
            $crawler=new UVa($action, $con, $cached);
45
        }
46
        if ($name=="UVaLive") {
47
            $crawler=new UVaLive($action, $con, $cached);
48
        }
49
        if ($name=="HDU") {
50
            $crawler=new HDU($action, $con, $cached);
51
        }
52
        if ($name=="SPOJ") {
53
            $crawler=new SPOJ($action, $con, $cached);
54
        }
55
        if (isset($crawler)) {
56
            $this->data=$crawler->data;
57
        }
58
    }
59
}
60