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

Crawler::__construct()   F

Complexity

Conditions 11
Paths 1024

Size

Total Lines 31
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 11
eloc 20
nc 1024
nop 4
dl 0
loc 31
rs 3.15
c 0
b 0
f 0

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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