Passed
Pull Request — master (#26)
by Wanderson
02:55
created

Server   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isLocalHost() 0 5 2
A getName() 0 3 1
1
<?php
2
3
namespace Win\Utils;
4
5
/**
6
 * Utilitário de informações do servidor
7
 */
8
abstract class Server
9
{
10
	/** @return bool */
11
	public static function isLocalHost()
12
	{
13
		$localAddress = ['localhost', '127.0.0.1', '::1', '', null];
14
15
		return in_array(static::getName(), $localAddress) || false !== strpos(static::getName(), '192.168');
16
	}
17
18
	/** @return string */
19
	public static function getName()
20
	{
21
		return Input::server('SERVER_NAME', FILTER_SANITIZE_STRING);
22
	}
23
}
24