Completed
Push — master ( b86db6...b3547a )
by Sergey
39s
created

Topics::getPinsFor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 14
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 14
loc 14
rs 9.4285
cc 1
eloc 8
nc 1
nop 2
1
<?php
2
3
namespace seregazhuk\PinterestBot\Api\Providers;
4
5
use seregazhuk\PinterestBot\Helpers\UrlBuilder;
6
use seregazhuk\PinterestBot\Api\Traits\Followable;
7
use seregazhuk\PinterestBot\Api\Traits\HasRelatedTopics;
8
9
class Topics extends Provider
10
{
11
    use Followable, HasRelatedTopics;
12
13
    /**
14
     * @var array
15
     */
16
    protected $loginRequiredFor = ['follow', 'unFollow'];
17
18
    protected $followUrl   = UrlBuilder::RESOURCE_FOLLOW_INTEREST;
19
    protected $unFollowUrl = UrlBuilder::RESOURCE_UNFOLLOW_INTEREST;
20
21
    protected $entityIdName = 'interest_id';
22
23
24
25
    /**
26
     * Get category info
27
     *
28
     * @param string $topic
29
     * @return array|bool
30
     */
31
    public function getInfo($topic)
32
    {
33
        return $this->execGetRequest(["interest" => $topic], UrlBuilder::RESOURCE_GET_TOPIC);
34
    }
35
36
    /**
37
     * Returns a feed of pins
38
     * @param string $interest
39
     * @param int $limit
40
     * @return array|bool
41
     */
42 View Code Duplication
    public function getPinsFor($interest, $limit = 0)
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...
43
    {
44
        $params = [
45
            'data' => [
46
                'interest'  => $interest,
47
                'pins_only' => false,
48
            ],
49
            'url' => UrlBuilder::RESOURCE_GET_TOPIC_FEED
50
        ];
51
52
        return $this->getPaginatedResponse(
53
            $params, $limit
54
        );
55
    }
56
}