Total Complexity | 14 |
Total Lines | 68 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | class Server { |
||
15 | |||
16 | |||
17 | public $header; |
||
18 | public $domain; |
||
19 | |||
20 | //check cache |
||
21 | public function cache() { |
||
22 | |||
23 | $cache = 0; |
||
24 | if ( is_array( $this->header ) ) { |
||
|
|||
25 | if ( array_key_exists( "Cache-Control", $this->header ) ) { |
||
26 | $cache_val = $this->header["Cache-Control"]; |
||
27 | if ( $cache_val ) { |
||
28 | $cache = 1; |
||
29 | } |
||
30 | } |
||
31 | } |
||
32 | return $cache; |
||
33 | } |
||
34 | |||
35 | |||
36 | //check if modified since |
||
37 | public function if_mod() { |
||
38 | |||
39 | $if_mod = 0; |
||
40 | if ( is_array( $this->header ) ) { |
||
41 | if ( array_key_exists( "Last-Modified", $this->header ) ) { |
||
42 | $if_mod = 1; |
||
43 | } |
||
44 | } |
||
45 | return $if_mod; |
||
46 | } |
||
47 | |||
48 | |||
49 | //check keep alive |
||
50 | public function alive() { |
||
51 | |||
52 | $alive = 0; |
||
53 | if ( is_array( $this->header ) ) { |
||
54 | if ( array_key_exists( "Connection", $this->header ) ) { |
||
55 | $connection = $this->header["Connection"]; |
||
56 | if ( $connection == "Keep-Alive" ) { |
||
57 | $alive = 1; |
||
58 | } |
||
59 | } |
||
60 | } |
||
61 | return $alive; |
||
62 | } |
||
63 | |||
64 | |||
65 | //check gZip compression |
||
66 | public function gzip() { |
||
67 | |||
68 | $gzip = 0; |
||
69 | $encode = $_SERVER['HTTP_ACCEPT_ENCODING']; |
||
70 | if ( substr( $encode, 0, 4 ) == 'gzip' ) { |
||
71 | $gzip = 1; |
||
72 | } |
||
73 | return $gzip; |
||
74 | } |
||
75 | |||
76 | |||
77 | //Get the IP address |
||
78 | public function IP() { |
||
82 | } |
||
83 | } |
||
84 | ?> |
||
85 |