Completed
Pull Request — master (#140)
by Christopher
03:07 queued 55s
created

routes-legacy.php ➔ legacyRouteAddUser()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
cc 3
nc 2
nop 3
dl 8
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace TechWilk\Rota;
4
5 View Code Duplication
function legacyRouteAddUser($request, $response, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
6
{
7
    if (!empty($args['action']) && $args['action'] == 'edit') {
8
        return $response->withStatus(308)->withHeader('Location', $this->router->pathFor('user-me'));
0 ignored issues
show
Bug introduced by
The variable $this does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
9
    }
10
11
    return $response->withStatus(308)->withHeader('Location', $this->router->pathFor('user-new'));
12
}
13
14
$app->get('/old/addUser.php', 'legacyRouteAddUser');
15
$app->get('/addUser.php', 'legacyRouteAddUser');
16
17
function legacyRouteUsers($request, $response, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
{
19
    return $response->withStatus(308)->withHeader('Location', $this->router->pathFor('users'));
0 ignored issues
show
Bug introduced by
The variable $this does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
20
}
21
22
$app->get('/old/users.php', 'legacyRouteUsers');
23
$app->get('/users.php', 'legacyRouteUsers');
24
25
function legacyRouteCalendarTokens($request, $response, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
{
27
    return $response->withStatus(308)->withHeader('Location', $this->router->pathFor('user-calendars'));
0 ignored issues
show
Bug introduced by
The variable $this does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
28
}
29
30
$app->get('/old/calendarTokens.php', 'legacyRouteAddTokens');
31
$app->get('/calendarTokens.php', 'legacyRouteAddTokens');
32
33 View Code Duplication
function legacyRoutePassword($request, $response, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
34
{
35
    if (!empty($args['id'])) {
36
        return $response->withStatus(308)->withHeader('Location', $this->router->pathFor('user-password'));
0 ignored issues
show
Bug introduced by
The variable $this does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
37
    }
38
39
    return $response->withStatus(308)->withHeader('Location', $this->router->pathFor('user-me'));
40
}
41
42
$app->get('/old/editPassword.php', 'legacyRoutePassword');
43
$app->get('/editPassword.php', 'legacyRoutePassword');
44
45
function legacyRouteEvent($request, $response, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
46
{
47
    $eventId = (int) $args['id'];
48
49
    return $response->withStatus(308)->withHeader('Location', $this->router->pathFor('event', ['id' => $eventId]));
0 ignored issues
show
Bug introduced by
The variable $this does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
50
}
51
52
$app->get('/old/event.php', 'legacyRouteEvent');
53
$app->get('/event.php', 'legacyRouteEvent');
54
55
function legacyRouteLogin($request, $response, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
56
{
57
    return $response->withStatus(308)->withHeader('Location', $this->router->pathFor('login'));
0 ignored issues
show
Bug introduced by
The variable $this does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
58
}
59
60
$app->get('/old/login.php', 'legacyRouteLogin');
61
$app->get('/login.php', 'legacyRouteLogin');
62
63
function legacyRouteLogout($request, $response, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
64
{
65
    return $response->withStatus(308)->withHeader('Location', $this->router->pathFor('logout'));
0 ignored issues
show
Bug introduced by
The variable $this does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
66
}
67
68
$app->get('/old/logout.php', 'legacyRouteLogout');
69
$app->get('/logout.php', 'legacyRouteLogout');
70
71
function legacyRouteResources($request, $response, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
72
{
73
    return $response->withStatus(308)->withHeader('Location', $this->router->pathFor('resources'));
0 ignored issues
show
Bug introduced by
The variable $this does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
74
}
75
76
$app->get('/old/resources.php', 'legacyRouteResources');
77
$app->get('/resources.php', 'legacyRouteResources');
78