Completed
Pull Request — master (#182)
by Sergey
02:55
created

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