Completed
Push — master ( 9a4a9d...9fe695 )
by Paweł
02:34 queued 10s
created

MediaGraphqlQuery   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A findMedia() 0 8 1
1
<?php
2
/**
3
 * Created for IG Client.
4
 * User: jakim <[email protected]>
5
 * Date: 09/09/2019
6
 */
7
8
namespace Jakim\Query;
9
10
11
use Jakim\Base\Query;
12
use jakim\ig\Endpoint;
13
use Jakim\Mapper\EdgeMedia;
14
use Jakim\Model\MediaCollection;
15
16
class MediaGraphqlQuery extends Query
17
{
18
    protected $findMedia;
19
20
    public function __construct($httpClient, EdgeMedia $findMedia)
21
    {
22
        parent::__construct($httpClient);
23
        $this->findMedia = $findMedia;
24
    }
25
26
    public function findMedia(string $queryHash, array $variables): MediaCollection
27
    {
28
        $url = Endpoint::createUrl('/graphql/query/', [
29
            'query_hash' => $queryHash,
30
            'variables' => $variables,
31
        ]);
32
33
        return $this->createResult($url, $this->findMedia, true);
34
    }
35
}