Completed
Pull Request — master (#194)
by Sergey
02:57
created

Comments   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 6 1
A delete() 0 6 1
1
<?php
2
3
namespace seregazhuk\PinterestBot\Api\Providers;
4
5
use seregazhuk\PinterestBot\Helpers\UrlBuilder;
6
7
class Comments extends Provider
8
{
9
    /**
10
     * Write a comment for a pin with current id.
11
     *
12
     * @param int    $pinId
13
     * @param string $text  Comment
14
     *
15
     * @return array|bool
16
     */
17
    public function create($pinId, $text)
18
    {
19
        $requestOptions = ['pin_id' => (string)$pinId, 'text' => $text];
20
21
        return $this->execPostRequest($requestOptions, UrlBuilder::RESOURCE_COMMENT_PIN);
22
    }
23
24
    /**
25
     * Delete a comment for a pin with current id.
26
     *
27
     * @param int $pinId
28
     * @param int $commentId
29
     *
30
     * @return bool
31
     */
32
    public function delete($pinId, $commentId)
33
    {
34
        $requestOptions = ['pin_id' => $pinId, 'comment_id' => $commentId];
35
36
        return $this->execPostRequest($requestOptions, UrlBuilder::RESOURCE_COMMENT_DELETE_PIN);
37
    }
38
39
}