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

PinterestBot   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 3
Bugs 0 Features 0
Metric Value
dl 0
loc 40
c 3
b 0
f 0
wmc 4
lcom 0
cbo 6
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 1
A makeRequest() 0 6 1
A __construct() 0 3 1
A __clone() 0 3 1
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