GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 135708...2b55b1 )
by gyeong-won
07:51
created

VirtualXMLDisplayHandler::toDoc()   C

Complexity

Conditions 8
Paths 48

Size

Total Lines 45
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 25
nc 48
nop 1
dl 0
loc 45
rs 5.3846
c 0
b 0
f 0
1
<?php
2
/* Copyright (C) NAVER <http://www.navercorp.com> */
3
4
class VirtualXMLDisplayHandler
5
{
6
	/**
7
	 * Produce virtualXML compliant content given a module object.\n
8
	 * @param ModuleObject $oModule the module object
9
	 * @return string
10
	 */
11
	function toDoc(&$oModule)
12
	{
13
		$error = $oModule->getError();
14
		$message = $oModule->getMessage();
15
		$redirect_url = $oModule->get('redirect_url');
16
		$request_uri = Context::get('xeRequestURI');
17
		$request_url = Context::getRequestUri();
18
		$output = new stdClass();
19
20
		if(substr_compare($request_url, '/', -1) !== 0)
21
		{
22
			$request_url .= '/';
23
		}
24
25
		if($error === 0)
26
		{
27
			if($message != 'success') $output->message = $message;
28
29
			$output->url = ($redirect_url) ? $redirect_url : $request_uri;
30
		}
31
		else
32
		{
33
			if($message != 'fail') $output->message = $message;
34
		}
35
36
		$html = array();
37
		$html[] = '<!DOCTYPE html><html><head><title>Moved...</title><meta charset="utf-8" /><script>';
38
39
		if($output->message)
40
		{
41
			$html[] = 'alert(' . json_encode($output->message, JSON_UNESCAPED_SLASHES) . ');';
42
		}
43
44
		if($output->url)
45
		{
46
			$url = json_encode(preg_replace('/#(.+)$/i', '', $output->url), JSON_UNESCAPED_SLASHES);
47
			$html[] = 'var win = (window.opener) ? window.opener : window.parent;';
48
			$html[] = 'win.location.href = ' . $url;
49
			$html[] = 'if(window.opener) self.close();';
50
		}
51
52
		$html[] = '</script></head></html>';
53
54
		return join(PHP_EOL, $html);
55
	}
56
57
}
58
/* End of file VirtualXMLDisplayHandler.class.php */
59
/* Location: ./classes/display/VirtualXMLDisplayHandler.class.php */
60