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 |
|
|
|
|
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
|
|
|
|