Suggestions   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
c 1
b 0
f 1
dl 0
loc 23
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A searchFor() 0 5 1
A tagsFor() 0 5 1
1
<?php
2
3
namespace seregazhuk\PinterestBot\Api\Providers;
4
5
use seregazhuk\PinterestBot\Api\Providers\Core\Provider;
6
use seregazhuk\PinterestBot\Helpers\UrlBuilder;
7
8
class Suggestions extends Provider
9
{
10
    /**
11
     * @param string $query
12
     * @return array
13
     */
14
    public function searchFor($query)
15
    {
16
        return (array) $this->get(UrlBuilder::RESOURCE_TYPE_AHEAD_SUGGESTIONS, [
17
            'term' => $query,
18
            'pin_scope' => 'pins'
19
        ]);
20
    }
21
22
    /**
23
     * @param string $query
24
     * @return array
25
     */
26
    public function tagsFor($query)
27
    {
28
        return (array)$this->get(UrlBuilder::RESOURCE_HASHTAG_TYPE_AHEAD_SUGGESTIONS, [
29
            'query' => '#' . $query,
30
            'showPinCount' => true
31
        ]);
32
    }
33
}
34