Completed
Pull Request — master (#182)
by Sergey
06:24 queued 03:23
created

Topics::getInfo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
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\Followable;
7
use seregazhuk\PinterestBot\Api\Traits\HasTopics;
8
9
class Topics extends Provider
10
{
11
    use Followable, HasTopics;
12
13
    /**
14
     * @var array
15
     */
16
    protected $loginRequiredFor = ['follow', 'unFollow'];
17
18
    protected $followUrl   = UrlBuilder::RESOURCE_FOLLOW_INTEREST;
19
    protected $unFollowUrl = UrlBuilder::RESOURCE_UNFOLLOW_INTEREST;
20
21
    protected $entityIdName = 'interest_id';
22
    protected $feedUrl = UrlBuilder::RESOURCE_GET_TOPIC_FEED;
23
24
25
    /**
26
     * Get category info
27
     *
28
     * @param string $topic
29
     * @return array|bool
30
     */
31
    public function getInfo($topic)
32
    {
33
        return $this->execGetRequest(["interest" => $topic], UrlBuilder::RESOURCE_GET_TOPIC);
34
    }
35
36
    /**
37
     * @param $interest
38
     * @return array
39
     */
40
    protected function getFeedRequestData($interest)
41
    {
42
        return [
43
            'interest'  => $interest,
44
            'pins_only' => false,
45
        ];
46
    }
47
}