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

Server::isLocalHost()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
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