AdminerFrames   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 20
rs 10
wmc 3
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A headers() 0 7 2
1
<?php
2
3
/** Allow using Adminer inside a frame (disables ClickJacking protection)
4
* @link https://www.adminer.org/plugins/#use
5
* @author Jakub Vrana, http://www.vrana.cz/
6
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
7
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
8
*/
9
class AdminerFrames {
10
	/** @access protected */
11
	var $sameOrigin;
12
	
13
	/**
14
	* @param bool allow running from the same origin only
15
	*/
16
	function __construct($sameOrigin = false) {
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...
17
		$this->sameOrigin = $sameOrigin;
18
	}
19
	
20
	function headers() {
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...
21
		if ($this->sameOrigin) {
22
			header('X-Frame-Options: SameOrigin');
23
		}
24
		header('X-XSS-Protection: 0');
25
		return false;
26
	}
27
	
28
}
29