Passed
Push — master ( 49e434...6c0612 )
by
unknown
04:29 queued 10s
created

Crawler::__construct()   D

Complexity

Conditions 10
Paths 512

Size

Total Lines 28
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 10
eloc 18
nc 512
nop 4
dl 0
loc 28
rs 4.1777
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\Models\ProblemModel;
14
use Auth;
15
16
class Crawler
17
{
18
    public $data=null;
19
20
    /**
21
     * Initial
22
     *
23
     * @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...
24
     */
25
    public function __construct($name, $action, $con, $cached=false)
26
    {
27
        if ($name=="CodeForces") {
28
            $crawler=new CodeForces($action, $con, $cached);
29
        }
30
        if ($name=="ContestHunter") {
31
            $crawler=new ContestHunter($action, $con, $cached);
32
        }
33
        if ($name=="POJ") {
34
            $crawler=new POJ($action, $con, $cached);
35
        }
36
        if ($name=="PTA") {
37
            $crawler=new PTA($action, $con, $cached);
38
        }
39
        if ($name=="Vijos") {
40
            $crawler=new Vijos($action, $con, $cached);
41
        }
42
        if ($name=="UVa") {
43
            $crawler=new UVa($action, $con, $cached);
44
        }
45
        if ($name=="UVaLive") {
46
            $crawler=new UVaLive($action, $con, $cached);
47
        }
48
        if ($name=="HDU") {
49
            $crawler=new HDU($action, $con, $cached);
50
        }
51
        if (isset($crawler)) {
52
            $this->data=$crawler->data;
53
        }
54
    }
55
}
56