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

Interests::getPinsFor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
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\HasRelatedTopics;
9
10
class Interests extends Provider
11
{
12
    use HasRelatedTopics, HasFeed;
13
14
    protected $feedUrl = UrlBuilder::RESOURCE_GET_CATEGORY_FEED;
15
16
    /**
17
     * Get list of main categories
18
     * 
19
     * @return array|bool
20
     */
21
    public function main()
22
    {
23
        return $this->execGetRequest(["category_types" => "main"], UrlBuilder::RESOURCE_GET_CATEGORIES);
24
    }
25
26
    /**
27
     * Get category info
28
     *
29
     * @param string $category
30
     * @return array|bool
31
     */
32
    public function info($category)
33
    {
34
        return $this->execGetRequest(["category" => $category], UrlBuilder::RESOURCE_GET_CATEGORY);
35
    }
36
37
    /**
38
     * Returns a feed of pins.
39
     *
40
     * @param string $interest
41
     * @param int $limit
42
     * @return Generator
43
     */
44 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...
45
    {
46
       $data = [
47
           'feed'             => $interest,
48
           'is_category_feed' => true,
49
       ];
50
51
        return $this->getFeed($data, UrlBuilder::RESOURCE_GET_CATEGORY_FEED, $limit);
52
    }
53
}
54