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

Interests   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 39
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMain() 0 4 1
A getInfo() 0 4 1
A getFeedRequestData() 0 7 1
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