Completed
Pull Request — master (#19)
by Sergey
03:32
created

Boards   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 4
Bugs 2 Features 0
Metric Value
wmc 5
c 4
b 2
f 0
lcom 1
cbo 7
dl 0
loc 40
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A my() 0 10 1
A getScope() 0 4 1
A getEntityIdName() 0 4 1
A getFollowUrl() 0 4 1
A getUnfFollowUrl() 0 4 1
1
<?php
2
3
namespace seregazhuk\PinterestBot\Api\Providers;
4
5
use seregazhuk\PinterestBot\Helpers\Providers\FollowHelper;
6
use seregazhuk\PinterestBot\Helpers\Providers\SearchHelper;
7
use seregazhuk\PinterestBot\Api\Request;
8
use seregazhuk\PinterestBot\Helpers\UrlHelper;
9
use seregazhuk\PinterestBot\Helpers\Requests\BoardHelper;
10
11
class Boards extends Provider
12
{
13
    use SearchHelper, FollowHelper;
14
15
    /**
16
     * Get all logged-in user boards
17
     *
18
     * @return array|bool
19
     */
20
    public function my()
21
    {
22
        $this->request->checkLoggedIn();
23
24
        $get = BoardHelper::createBoardsInfoRequest();
25
        $getString = UrlHelper::buildRequestString($get);
26
        $response = $this->request->exec(UrlHelper::RESOURCE_GET_BOARDS."?{$getString}");
27
28
        return $this->response->getData($response, 'all_boards');
29
    }
30
31
    protected function getScope()
32
    {
33
        return 'boards';
34
    }
35
36
    protected function getEntityIdName()
37
    {
38
        return Request::BOARD_ENTITY_ID;
39
    }
40
41
    protected function getFollowUrl()
42
    {
43
        return UrlHelper::RESOURCE_FOLLOW_BOARD;
44
    }
45
46
    protected function getUnfFollowUrl()
47
    {
48
        return UrlHelper::RESOURCE_UNFOLLOW_BOARD;
49
    }
50
}