Passed
Branch tests1.5 (1e45fa)
by Wanderson
01:17
created

Header::getAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Win\Request;
4
5
use Win\Data\Data;
6
7
/**
8
 * Header HTTP
9
 */
10
class Header extends Data {
11
12
	private static $headers = [];
13
14
	public static function getAll() {
15
		return static::$headers;
0 ignored issues
show
Bug introduced by
Since $headers is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $headers to at least protected.
Loading history...
16
	}
17
18
	public static function set($key, $value) {
19
		static::$headers[$key] = $value;
0 ignored issues
show
Bug introduced by
Since $headers is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $headers to at least protected.
Loading history...
20
	}
21
22
	/**
23
	 * Adiciona no 'HTTP Header' os valores que foram adicionados
24
	 * @codeCoverageIgnore
25
	 */
26
	public static function run() {
27
		foreach (static::$headers as $key => $value) {
0 ignored issues
show
Bug introduced by
Since $headers is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $headers to at least protected.
Loading history...
28
			header($key . ':' . $value);
29
		}
30
		if (key_exists('location', static::$headers)) {
31
			die();
1 ignored issue
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
32
		}
33
	}
34
35
}
36