Interests::pins()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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