Passed
Push — master ( eb1715...d132f1 )
by Paweł
03:15
created

Url::location()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
1
<?php
2
/**
3
 * Created for IG Monitoring.
4
 * User: jakim <[email protected]>
5
 * Date: 19.02.2018
6
 */
7
8
namespace jakim\ig;
9
10
11
class Url
12
{
13
    public static $baseUrl = 'https://www.instagram.com';
14
15
    public static function account($username)
16
    {
17
        return static::$baseUrl . str_replace('{username}', $username, '/{username}/');
18
    }
19
20
    public static function post($shortCode)
21
    {
22
        return static::$baseUrl . str_replace('{shortcode}', $shortCode, '/p/{shortcode}/');
23
    }
24
25
    public static function location($id, $slug = null)
26
    {
27
        $url = static::$baseUrl . str_replace('{id}', $id, '/explore/locations/{id}/');
28
        if ($slug) {
29
            $url .= "{$slug}/";
30
        }
31
32
        return $url;
33
    }
34
35
    public static function tag($tag)
36
    {
37
        return static::$baseUrl . str_replace('{tag}', $tag, '/explore/tags/{tag}/');
38
    }
39
}