GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Uri::current()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
nc 3
nop 0
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
1
<?php
2
/**
3
 * Pimf
4
 *
5
 * @copyright Copyright (c)  Gjero Krsteski (http://krsteski.de)
6
 * @license   http://opensource.org/licenses/MIT MIT
7
 */
8
namespace Pimf;
9
10
use Pimf\Util\Character as Str;
11
12
/**
13
 * URI
14
 *
15
 * @package Pimf
16
 * @author  Gjero Krsteski <[email protected]>
17
 */
18
class Uri
19
{
20
21
    /**
22
     * @var string
23
     */
24
    private static $pathInfo;
25
26
    /**
27
     * @var string
28
     */
29
    private static $requestUri;
30
31
    /**
32
     * The URI for the current request.
33
     *
34
     * @var string
35
     */
36
    public static $uri;
37
38
    /**
39
     * The URI segments for the current request.
40
     *
41
     * @var array
42
     */
43
    public static $segments = array();
44
45
    /**
46
     * @param string $pathInfo
47
     * @param string $requestUri
48
     */
49
    public static function setup($pathInfo, $requestUri)
50
    {
51
        self::$pathInfo = $pathInfo;
52
        self::$requestUri = $requestUri;
53
    }
54
55
    /**
56
     * Get the full URI including the query string.
57
     *
58
     * @return string
59
     */
60
    public static function full()
61
    {
62
        return self::$requestUri;
63
    }
64
65
    /**
66
     * Get the URI for the current request.
67
     *
68
     * @return string
69
     */
70
    public static function current()
71
    {
72
        if (!is_null(static::$uri)) {
73
            return static::$uri;
74
        }
75
76
        //Format a given URI.
77
        $uri = trim(self::$pathInfo, '/') ?: '/';
78
79
        //Set the URI segments for the request.
80
        $segments = explode('/', trim($uri, '/'));
81
        static::$segments = array_diff($segments, array(''));
82
83
        return static::$uri = $uri;
84
    }
85
86
    /**
87
     * Determine if the current URI matches a given pattern.
88
     *
89
     * @param  string $pattern
90
     *
91
     * @return bool
92
     */
93
    public static function is($pattern)
94
    {
95
        return Str::is($pattern, static::current());
96
    }
97
}
98