Code Duplication    Length = 12-13 lines in 2 locations

src/http/ServerRequest.php 2 locations

@@ 119-131 (lines=13) @@
116
		return [false, ''];
117
	}
118
119
	private function getUser()
120
	{
121
		$checks = [ 
122
			'PHP_AUTH_USER'               => false, 
123
			'REMOTE_USER'                 => false, 
124
			'HTTP_AUTHORIZATION'          => function($v) { list($user,$password)=$this->parseAuthUser($v); return $user; },
125
		];
126
		list($header, $headerValue) = $this->getHeader($checks, 3);
127
		if (isset($checks[$header]) && is_callable($checks[$header])) {
128
			$headerValue = ($checks[$header])($headerValue);
129
		}
130
		return $headerValue;
131
	}
132
133
	private function getPassword()
134
	{
@@ 133-144 (lines=12) @@
130
		return $headerValue;
131
	}
132
133
	private function getPassword()
134
	{
135
		$checks = [ 
136
			'PHP_AUTH_PW'                 => false, 
137
			'HTTP_AUTHORIZATION'          => function($v) { list($user,$password)=$this->parseAuthUser($v); return $password; },
138
		];
139
		list($header, $headerValue) = $this->getHeader($checks, 3);
140
		if (isset($checks[$header]) && is_callable($checks[$header])) {
141
			$headerValue = ($checks[$header])($headerValue);
142
		}
143
		return $headerValue;
144
	}
145
146
	private function parseAuthUser($auth) {
147
		return explode(':',base64_decode(substr($auth, 6)));