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

Topics::info()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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