Completed
Push — master ( d691dc...d14a3f )
by Rob
02:54
created

integration   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 44
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A testIntegration() 0 32 3
1
<?php
2
3
namespace devtoolboxuk\soteria;
4
5
use PHPUnit\Framework\TestCase;
6
7
class integration extends TestCase
0 ignored issues
show
Coding Style introduced by
This class is not in CamelCase format.

Classes in PHP are usually named in CamelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.

Thus the name database provider becomes DatabaseProvider.

Loading history...
8
{
9
    private $security;
10
11
    function __construct($name = null, array $data = [], $dataName = '')
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for __construct.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
12
    {
13
        parent::__construct($name, $data, $dataName);
14
        $this->security = new SoteriaService();
15
    }
16
17
    function testIntegration()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for testIntegration.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
18
    {
19
//        $xss = $this->security->xss();
20
        $sanitise = $this->security->sanitise();
21
22
23
        echo "\nXSS";
24
        $string = 'Visit my website http://www.doajob.org?redirect=https://www.google.com';
25
//        echo "\nString: " . $string;
26
//        $cleanString = $xss->clean($string);
27
//        echo "\nString: " . $cleanString;
28
//        echo "\n";
29
//        echo "\nXSS Url";
30
//        $string = 'Visit my website http://www.doajob.org?redirect=https://www.google.com';
31
//        echo "\nString: " . $string;
32
//        $cleanString = $xss->cleanUrl($string);
33
//        echo "\nString: " . $cleanString;
34
//        echo "\n";
35
//        echo "\nSanitiser";
36
37
        echo "\nString: " . $sanitise->removeUrl($string);
38
        if ($sanitise->isSanitised()) {
39
            echo "\n1";
40
        }
41
42
        echo "\nString: " . $sanitise->removeUrl("Rob WIlson");
43
        if ($sanitise->isSanitised()) {
44
            echo "\n1";
45
        }
46
47
48
    }
49
50
}
51