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

Boards::unFollow()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 7
loc 7
rs 9.4286
cc 1
eloc 4
nc 1
nop 1
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 SearchProvider
11
{
12
    /**
13
     * Get all logged-in user boards
14
     *
15
     * @return array|bool
16
     */
17
    public function my()
18
    {
19
        $this->request->checkLoggedIn();
20
21
        $get = BoardHelper::createBoardsInfoRequest();
22
        $getString = UrlHelper::buildRequestString($get);
23
        $response = $this->request->exec(UrlHelper::RESOURCE_GET_BOARDS."?{$getString}");
24
25
        return $this->response->getData($response, 'all_boards');
26
    }
27
28
    /**
29
     * Follow board by boardID
30
     *
31
     * @param int $boardId
32
     * @return bool
33
     */
34 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...
35
    {
36
        $this->request->checkLoggedIn();
37
38
        $response = $this->request->followMethodCall($boardId, Request::BOARD_ENTITY_ID, UrlHelper::RESOURCE_FOLLOW_BOARD);
39
        return $this->response->checkResponse($response);
40
    }
41
42
    /**
43
     * Unfollow board by boardID
44
     *
45
     * @param int $boardId
46
     * @return bool
47
     */
48 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...
49
    {
50
        $this->request->checkLoggedIn();
51
52
        $response = $this->request->followMethodCall($boardId, Request::BOARD_ENTITY_ID, UrlHelper::RESOURCE_UNFOLLOW_BOARD);
53
        return $this->response->checkResponse($response);
54
    }
55
56
    protected function getScope()
57
    {
58
        return 'boards';
59
    }
60
}