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

Boards::getScope()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace seregazhuk\PinterestBot\Api\Providers;
4
5
use seregazhuk\PinterestBot\Api\Request;
6
use seregazhuk\PinterestBot\Helpers\UrlHelper;
7
use seregazhuk\PinterestBot\Helpers\SearchHelper;
8
use seregazhuk\PinterestBot\Helpers\Requests\BoardHelper;
9
10
class Boards extends Provider
11
{
12
    use SearchHelper;
13
14
    /**
15
     * Get all logged-in user boards
16
     *
17
     * @return array|bool
18
     */
19
    public function my()
20
    {
21
        $this->request->checkLoggedIn();
22
23
        $get = BoardHelper::createBoardsInfoRequest();
24
        $getString = UrlHelper::buildRequestString($get);
25
        $response = $this->request->exec(UrlHelper::RESOURCE_GET_BOARDS."?{$getString}");
26
27
        return $this->response->getData($response, 'all_boards');
28
    }
29
30
    /**
31
     * Follow board by boardID
32
     *
33
     * @param int $boardId
34
     * @return bool
35
     */
36 View Code Duplication
    public function follow($boardId)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37
    {
38
        $this->request->checkLoggedIn();
39
40
        $response = $this->request->followMethodCall($boardId, Request::BOARD_ENTITY_ID, UrlHelper::RESOURCE_FOLLOW_BOARD);
41
        return $this->response->checkResponse($response);
42
    }
43
44
    /**
45
     * Unfollow board by boardID
46
     *
47
     * @param int $boardId
48
     * @return bool
49
     */
50 View Code Duplication
    public function unFollow($boardId)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
51
    {
52
        $this->request->checkLoggedIn();
53
54
        $response = $this->request->followMethodCall($boardId, Request::BOARD_ENTITY_ID, UrlHelper::RESOURCE_UNFOLLOW_BOARD);
55
        return $this->response->checkResponse($response);
56
    }
57
58
    protected function getScope()
59
    {
60
        return 'boards';
61
    }
62
}