Completed
Push — master ( 5a053e...8eeafe )
by Terrence
10:16
created

index.php ➔ printAboutThisPage()   C

Complexity

Conditions 11
Paths 88

Size

Total Lines 76

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 11
nc 88
nop 2
dl 0
loc 76
rs 6.3769
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
// error_reporting(E_ALL); ini_set('display_errors',1);
4
5
require_once __DIR__ . '/../vendor/autoload.php';
6
require_once __DIR__ . '/index-functions.php';
7
8
use CILogon\Service\Util;
9
10
Util::startPHPSession();
11
12
// This array contains the cookies that we do not want to show to the
13
// user because we don't want these cookies to be deleted. The cookie
14
// names are then excluded from the cookie counts, as well as the
15
// list of cookies which could be deleted.
16
$hide = array(
17
    'CSRF',
18
    'PHPSESSID',
19
    'lastaccess',
20
    'myproxyinfo',
21
);
22
23
// Get the value of the 'submit' input element
24
$submit = Util::getGetOrPostVar('submit');
25
Util::unsetSessionVar('submit');
26
27
// Depending on the value of the clicked 'submit' button,
28
// take action and print out HTML.
29
switch ($submit) {
30
    case 'Delete Checked':
31
        deleteChecked();
32
        break; // End case 'Delete Checked'
33
34
    case 'Delete Browser Cookies':
35
        deleteBrowserCookies();
36
        break; // End case 'Delete Browser Cookies'
37
38
    case 'Delete Session Variables':
39
        deleteSessionVariables();
40
        break; // End case 'Delete Session Variables'
41
42
    case 'Delete ALL':
43
        deleteBrowserCookies();
44
        deleteSessionVariables();
45
        break; // End case 'Delete ALL'
46
} // End switch($submit)
47
48
printMainCookiesPage();
49