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 — master ( 423fe8...f48289 )
by gyeong-won
15:56 queued 08:14
created

addon   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 119
Duplicated Lines 22.69 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 27
loc 119
rs 10
c 0
b 0
f 0
wmc 13
lcom 0
cbo 3

4 Methods

Rating   Name   Duplication   Size   Complexity  
A moduleInstall() 0 16 1
B checkUpdate() 27 27 4
C moduleUpdate() 0 44 7
A recompileCache() 0 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/* Copyright (C) NAVER <http://www.navercorp.com> */
3
4
/**
5
 * High class of addon modules
6
 * @author NAVER ([email protected])
7
 */
8
class addon extends ModuleObject
9
{
10
11
	/**
12
	 * Implement if additional tasks are necessary when installing
13
	 *
14
	 * @return Object
15
	 */
16
	function moduleInstall()
17
	{
18
		// Register to add a few
19
		$oAddonController = getAdminController('addon');
20
		$oAddonController->doInsert('autolink', 0, 'site', 'Y');
21
		$oAddonController->doInsert('blogapi');
22
		$oAddonController->doInsert('member_communication', 0, 'site', 'Y');
23
		$oAddonController->doInsert('member_extra_info', 0, 'site', 'Y');
24
		$oAddonController->doInsert('mobile', 0, 'site', 'Y');
25
		$oAddonController->doInsert('resize_image', 0, 'site', 'Y');
26
		$oAddonController->doInsert('openid_delegation_id');
27
		$oAddonController->doInsert('point_level_icon');
28
29
		$oAddonController->makeCacheFile(0);
30
		return new Object();
31
	}
32
33
	/**
34
	 * A method to check if successfully installed
35
	 *
36
	 * @return bool
37
	 */
38 View Code Duplication
	function checkUpdate()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
	{
40
		$oDB = DB::getInstance();
41
		$oModuleModel = getModel('module');
0 ignored issues
show
Unused Code introduced by
$oModuleModel is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
42
		$oModuleController = getController('module');
43
		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
44
		{
45
			if(!$oDB->isColumnExists("addons", "is_used_m"))
46
			{
47
				return TRUE;
48
			}
49
			if(!$oDB->isColumnExists("addons_site", "is_used_m"))
50
			{
51
				return TRUE;
52
			}
53
54
			// 2011. 7. 29. add is_fixed column
55
			if(!$oDB->isColumnExists('addons', 'is_fixed'))
56
			{
57
				return TRUE;
58
			}
59
60
			$oModuleController->insertUpdatedLog($version_update_id);
61
		}
62
63
		return FALSE;
64
	}
65
66
	/**
67
	 * Execute update
68
	 *
69
	 * @return Object
70
	 */
71
	function moduleUpdate()
72
	{
73
		$oDB = DB::getInstance();
74
75
		$oModuleModel = getModel('module');
76
		$oModuleController = getController('module');
77
		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
78
		if($oModuleModel->needUpdate($version_update_id))
79
		{
80
			if(!$oDB->isColumnExists("addons", "is_used_m"))
81
			{
82
				$oDB->addColumn("addons", "is_used_m", "char", 1, "N", TRUE);
83
			}
84
			if(!$oDB->isColumnExists("addons_site", "is_used_m"))
85
			{
86
				$oDB->addColumn("addons_site", "is_used_m", "char", 1, "N", TRUE);
87
			}
88
89
			// 2011. 7. 29. add is_fixed column
90
			if(!$oDB->isColumnExists('addons', 'is_fixed'))
91
			{
92
				$oDB->addColumn('addons', 'is_fixed', 'char', 1, 'N', TRUE);
93
94
				// move addon info to addon_site table
95
				$output = executeQueryArray('addon.getAddons');
96
				if($output->data)
97
				{
98
					foreach($output->data as $row)
99
					{
100
						$args = new stdClass();
101
						$args->site_srl = 0;
102
						$args->addon = $row->addon;
103
						$args->is_used = $row->is_used;
104
						$args->is_used_m = $row->is_used_m;
105
						$args->extra_vars = $row->extra_vars;
106
						executeQuery('addon.insertSiteAddon', $args);
107
					}
108
				}
109
			}
110
			$oModuleController->insertUpdatedLog($version_update_id);
111
		}
112
113
		return new Object(0, 'success_updated');
114
	}
115
116
	/**
117
	 * Re-generate the cache file
118
	 *
119
	 * @return Object
120
	 */
121
	function recompileCache()
122
	{
123
124
	}
125
126
}
127
/* End of file addon.class.php */
128
/* Location: ./modules/addon/addon.class.php */
129