Completed
Push — master ( 0f5404...9fd863 )
by Sergey
08:17 queued 05:42
created

BoardSections   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A forBoard() 0 4 1
A create() 0 10 1
A edit() 0 9 1
A delete() 0 4 1
1
<?php
2
3
namespace seregazhuk\PinterestBot\Api\Providers;
4
5
use seregazhuk\PinterestBot\Api\Providers\Core\Provider;
6
use seregazhuk\PinterestBot\Helpers\UrlBuilder;
7
8
class BoardSections extends Provider
9
{
10
    /**
11
     * @param string $boardId
12
     * @return array|bool
13
     */
14
    public function forBoard($boardId)
15
    {
16
        return $this->get(UrlBuilder::RESOURCE_GET_BOARD_SECTIONS, ['board_id' => $boardId]);
17
    }
18
19
    /**
20
     * @param string $boardId
21
     * @param string $title
22
     * @return bool
23
     */
24
    public function create($boardId, $title)
25
    {
26
        $requestOptions = [
27
            'board_id' => $boardId,
28
            'name' => $title,
29
            'initial_pins' => []
30
        ];
31
32
        return $this->post(UrlBuilder::RESOURCE_ADD_BOARD_SECTION, $requestOptions);
33
    }
34
35
    /**
36
     * @param string $sectionId
37
     * @param string $title
38
     * @return bool
39
     */
40
    public function edit($sectionId, $title)
41
    {
42
        $requestOptions = [
43
            'section_id' => $sectionId,
44
            'name' => $title,
45
        ];
46
47
        return $this->post(UrlBuilder::RESOURCE_EDIT_BOARD_SECTION, $requestOptions);
48
    }
49
50
    /**
51
     * @param string $sectionId
52
     * @return bool
53
     */
54
    public function delete($sectionId)
55
    {
56
        return $this->post(UrlBuilder::RESOURCE_DELETE_BOARD_SECTION, ['section_id' => $sectionId]);
57
    }
58
}
59