Issues (5)

src/BaseClass.php (1 issue)

1
<?php
2
3
namespace shweshi\LaravelUnsplashWrapper;
4
5
use GuzzleHttp\Client;
6
7
class BaseClass
8
{
9
    /**
10
     * Base url of unsplash api.
11
     *
12
     * @var string
13
     */
14
    private $baseUrl = 'https://api.unsplash.com/';
15
16
    /**
17
     * Response from unsplash api.
18
     */
19
    private $response;
20
21
    /**
22
     * Calls unsplash api.
23
     *
24
     * @param string $url
25
     * @param array  $params
26
     *
27
     * @return mix
28
     */
29
    protected function call($url, $params)
30
    {
31
        $client = new Client([
32
            'base_uri' => $this->baseUrl,
33
        ]);
34
        $response = $client->request('GET', $url, [
35
            'headers' => [
36
                'Authorization'  => 'Client-ID '.config('unsplash.ApplicationID'),
37
            ],
38
            'form_params' => $params,
39
            'query'       => $params,
40
        ]);
41
42
        return $response->getBody();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $response->getBody() returns the type Psr\Http\Message\StreamInterface which is incompatible with the documented return type shweshi\LaravelUnsplashWrapper\mix.
Loading history...
43
    }
44
}
45