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 ( 95cebf...03d863 )
by gyeong-won
08:21
created

sessionModel::getLoggedMembers()   D

Complexity

Conditions 13
Paths 304

Size

Total Lines 50
Code Lines 28

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 13
eloc 28
nc 304
nop 1
dl 0
loc 50
rs 4
c 0
b 0
f 0

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/* Copyright (C) NAVER <http://www.navercorp.com> */
3
/**
4
 * @class  sessionModel
5
 * @author NAVER ([email protected])
6
 * @brief The Model class of the session module
7
 */
8
class sessionModel extends session
9
{
10
	/**
11
	 * @brief Initialization
12
	 */
13
	function init()
14
	{
15
	}
16
17
	function getLifeTime()
18
	{
19
		return $this->lifetime;
20
	}
21
22
	function read($session_key)
23
	{
24
		if(!$session_key || !$this->session_started) return;
25
26
		$args = new stdClass();
27
		$args->session_key = $session_key;
28
		$columnList = array('session_key', 'cur_mid', 'val');
29
		$output = executeQuery('session.getSession', $args, $columnList);
30
31
		if(!$output->data)
32
		{
33
			return '';
34
		}
35
36
		return $output->data->val;
37
	}
38
39
	/**
40
	 * @brief Get a list of currently connected users
41
	 * Requires "object" argument because multiple arguments are expected
42
	 * limit_count : the number of objects
43
	 * page : the page number
44
	 * period_time: "n" specifies the time range in minutes since the last update
45
	 * mid: a user who belong to a specified mid
46
	 */
47
	function getLoggedMembers($args)
48
	{
49
		if(!$args->site_srl)
50
		{
51
			$site_module_info = Context::get('site_module_info');
52
			$args->site_srl = (int)$site_module_info->site_srl;
53
		}
54
		if(!$args->list_count) $args->list_count = 20;
55
		if(!$args->page) $args->page = 1;
56
		if(!$args->period_time) $args->period_time = 3;
57
		$args->last_update = date("YmdHis", $_SERVER['REQUEST_TIME'] - $args->period_time*60);
58
59
		$output = executeQueryArray('session.getLoggedMembers', $args);
60
		if(!$output->toBool()) return $output;
61
62
		$member_srls = array();
63
		$member_keys = array();
64
		if(count($output->data))
65
		{
66
			foreach($output->data as $key => $val)
67
			{
68
				$member_srls[$key] = $val->member_srl;
69
				$member_keys[$val->member_srl] = $key;
70
			}
71
		}
72
73
		if(Context::get('is_logged'))
74
		{
75
			$logged_info = Context::get('logged_info');
76
			if(!in_array($logged_info->member_srl, $member_srls))
77
			{
78
				$member_srls[0] = $logged_info->member_srl;
79
				$member_keys[$logged_info->member_srl] = 0;
80
			}
81
		}
82
83
		if(!count($member_srls)) return $output;
84
85
		$member_args->member_srl = implode(',',$member_srls);
0 ignored issues
show
Bug introduced by
The variable $member_args does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
86
		$member_output = executeQueryArray('member.getMembers', $member_args);
87
		if($member_output->data)
88
		{
89
			foreach($member_output->data as $key => $val)
90
			{
91
				$output->data[$member_keys[$val->member_srl]] = $val;
92
			}
93
		}
94
95
		return $output;
96
	}
97
}
98
/* End of file session.model.php */
99
/* Location: ./modules/session/session.model.php */
100