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

Url   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 9
dl 0
loc 27
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A account() 0 3 1
A post() 0 3 1
A location() 0 8 2
A tag() 0 3 1
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
}