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.

Redirect   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 41
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A toPreviousViewedPageAfterLogin() 0 4 1
A home() 0 4 1
A to() 0 4 1
1
<?php
2
3
/**
4
 * Class Redirect
5
 *
6
 * Simple abstraction for redirecting the user to a certain page
7
 */
8
class Redirect
9
{
10
    /**
11
     * To the last visited page before user logged in (useful when people are on a certain page inside your application
12
     * and then want to log in (to edit or comment something for example) and don't to be redirected to the main page).
13
     *
14
     * This is just a bulletproof version of Redirect::to(), redirecting to an ABSOLUTE URL path like
15
     * "http://www.mydomain.com/user/profile", useful as people had problems with the RELATIVE URL path generated
16
     * by Redirect::to() when using HUGE inside sub-folders.
17
     *
18
     * @param $path string
19
     */
20
    public static function toPreviousViewedPageAfterLogin($path)
21
    {
22
        header('location: http://' . $_SERVER['HTTP_HOST'] . '/' . $path);
23
    }
24
25
    /**
26
     * To the homepage
27
     */
28
    public static function home()
29
    {
30
        header("location: " . Config::get('URL'));
31
    }
32
33
    /**
34
     * To the defined page, uses a relative path (like "user/profile")
35
     *
36
     * Redirects to a RELATIVE path, like "user/profile" (which works very fine unless you are using HUGE inside tricky
37
     * sub-folder structures)
38
     *
39
     * @see https://github.com/panique/huge/issues/770
40
     * @see https://github.com/panique/huge/issues/754
41
     *
42
     * @param $path string
43
     */
44
    public static function to($path)
45
    {
46
        header("location: " . Config::get('URL') . $path);
47
    }
48
}
49