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

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