PostQuery   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A findOneByShortcode() 0 5 1
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
}