Suggestions::searchFor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
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