PostQuery::findOneByShortcode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 2
1
<?php
2
/**
3
 * Created for IG Client.
4
 * User: jakim <[email protected]>
5
 * Date: 23.03.2018
6
 */
7
8
namespace Jakim\Query;
9
10
11
use Jakim\Base\Query;
12
use jakim\ig\Endpoint;
13
use Jakim\Mapper\MediaDetails;
14
use Jakim\Model\Post;
15
16
class PostQuery extends Query
17
{
18
    protected $findOneByShortcode;
19
20
    public function __construct($httpClient, MediaDetails $findOneByShortcode)
21
    {
22
        parent::__construct($httpClient);
23
        $this->findOneByShortcode = $findOneByShortcode;
24
    }
25
26
    public function findOneByShortcode(string $shortCode, $relations = false): Post
27
    {
28
        $url = Endpoint::mediaDetails($shortCode);
29
30
        return $this->createResult($url, $this->findOneByShortcode, $relations);
31
    }
32
}