Scraper::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php namespace MtGTutor\Console;
2
3
use Goutte\Client;
4
5
/**
6
 * Class Scraper
7
 * @package MtGTutor\Console
8
 */
9
class Scraper
10
{
11
    /**
12
     * @var \Goutte\Client
13
     */
14
    protected $client;
15
16
    /**
17
     * Scraper constructor.
18
     * @param \Goutte\Client $client
19
     */
20 24
    public function __construct(Client $client)
21
    {
22 24
        $this->setClient($client);
23 24
    }
24
25
    /**
26
     * @return \Goutte\Client
27
     */
28
    public function getClient()
29
    {
30
        return $this->client;
31
    }
32
33
    /**
34
     * @param \Goutte\Client $client
35
     */
36 24
    public function setClient(Client $client)
37
    {
38 24
        $this->client = $client;
39 24
    }
40
41
    /**
42
     * @param null   $uri
43
     * @param string $method
44
     * @return \Symfony\Component\DomCrawler\Crawler
45
     */
46
    public function request($uri = null, $method = 'GET')
47
    {
48
        return $this->client->request($method, $uri);
49
    }
50
51
    /**
52
     * @param $link
53
     * @return \Symfony\Component\DomCrawler\Crawler
54
     */
55
    public function click($link)
56
    {
57
        return $this->client->click($link);
58
    }
59
}
60