Completed
Push — master ( e9ef07...05c89c )
by Sergey
02:57 queued 23s
created

PinterestBot::makeRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace seregazhuk\PinterestBot\Factories;
4
5
use seregazhuk\PinterestBot\Bot;
6
use seregazhuk\PinterestBot\Api\Request;
7
use seregazhuk\PinterestBot\Api\Response;
8
use seregazhuk\PinterestBot\Api\CurlHttpClient;
9
use seregazhuk\PinterestBot\Helpers\Cookies;
10
use seregazhuk\PinterestBot\Api\ProvidersContainer;
11
12
class PinterestBot
13
{
14
    /**
15
     * Initializes Bot instance and all its dependencies.
16
     *
17
     * @return Bot
18
     */
19
    public static function create()
20
    {
21
        $request = self::makeRequest();
22
23
        $providersContainer = new ProvidersContainer($request, new Response());
24
25
        return new Bot($providersContainer);
26
    }
27
28
    /**
29
     * @return Request
30
     */
31
    protected static function makeRequest()
32
    {
33
        $httpClient = new CurlHttpClient(new Cookies());
34
35
        return new Request($httpClient);
36
    }
37
38
    /**
39
     * @codeCoverageIgnore
40
     */
41
    private function __construct()
42
    {
43
    }
44
45
    /**
46
     * @codeCoverageIgnore
47
     */
48
    private function __clone()
49
    {
50
    }
51
}
52