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 ( 278e53...818459 )
by gyeong-won
39:17 queued 30:14
created

seoAdminController   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 73
Duplicated Lines 12.33 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 9
loc 73
rs 10
c 0
b 0
f 0
wmc 9
lcom 1
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
C procSeoAdminSaveSetting() 9 70 9

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
class seoAdminController extends seo
3
{
4
	function procSeoAdminSaveSetting()
5
	{
6
		$oModuleController = getController('module');
7
8
		$vars = Context::getRequestVars();
9
		$config = $this->getConfig();
10
11
		if ($vars->setting_section == 'general') {
12
			// 기본 설정
13
			$config->enable = ($vars->enable === 'Y') ? 'Y' : 'N';
0 ignored issues
show
Bug introduced by
The property enable does not seem to exist in BaseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
14
			$config->use_optimize_title = $vars->use_optimize_title;
0 ignored issues
show
Bug introduced by
The property use_optimize_title does not seem to exist in BaseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
15
			$config->site_name = $vars->site_name;
0 ignored issues
show
Bug introduced by
The property site_name does not seem to exist in BaseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
16
			$config->site_slogan = $vars->site_slogan;
0 ignored issues
show
Bug introduced by
The property site_slogan does not seem to exist in BaseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
17
			$config->site_description = $vars->site_description;
0 ignored issues
show
Bug introduced by
The property site_description does not seem to exist in BaseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
18
			$config->site_keywords = $vars->site_keywords;
0 ignored issues
show
Bug introduced by
The property site_keywords does not seem to exist in BaseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
19
20
			if ($vars->site_image) {
21
				$path = _XE_PATH_ . 'files/attach/site_image/';
22
				$ext = strtolower(array_pop(explode('.', $vars->site_image['name'])));
0 ignored issues
show
Bug introduced by
explode('.', $vars->site_image['name']) cannot be passed to array_pop() as the parameter $array expects a reference.
Loading history...
Bug introduced by
The property site_image does not seem to exist in BaseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
23
				$timestamp = time();
24
				$filename = "site_image.{$timestamp}.{$ext}";
25
				FileHandler::copyFile($vars->site_image['tmp_name'], $path . $filename);
26
				$config->site_image = $filename;
27
28
				$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
29 View Code Duplication
				if($oCacheHandler->isSupport()) {
30
					list($width, $height) = @getimagesize($path . $filename);
31
					$site_image_dimension = array(
32
						'width' => $width,
33
						'height' => $height
34
					);
35
					$cache_key = 'seo:site_image';
36
					$oCacheHandler->put($cache_key, $site_image_dimension);
37
				}
38
			}
39
		} elseif ($vars->setting_section == 'analytics') {
0 ignored issues
show
Bug introduced by
The property setting_section does not seem to exist in BaseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
40
			// analytics
41
42
			// Google
43
			$config->ga_id = trim($vars->ga_id);
0 ignored issues
show
Bug introduced by
The property ga_id does not seem to exist in BaseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
44
			$config->ga_except_admin = $vars->ga_except_admin;
0 ignored issues
show
Bug introduced by
The property ga_except_admin does not seem to exist in BaseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
45
46
			// Naver
47
			$config->na_id = trim($vars->na_id);
0 ignored issues
show
Bug introduced by
The property na_id does not seem to exist in BaseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
48
			$config->na_except_admin = $vars->na_except_admin;
0 ignored issues
show
Bug introduced by
The property na_except_admin does not seem to exist in BaseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
49
		} elseif ($vars->setting_section == 'miscellaneous') {
50
			// miscellaneous
51
52
			// Facebook
53
			$config->fb_app_id = trim($vars->fb_app_id);
0 ignored issues
show
Bug introduced by
The property fb_app_id does not seem to exist in BaseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
54
			$config->fb_admins = trim($vars->fb_admins);
0 ignored issues
show
Bug introduced by
The property fb_admins does not seem to exist in BaseObject.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
55
		}
56
57
		$config->site_image_url = NULL;
58
59
		$oModuleController->updateModuleConfig('seo', $config);
60
61
		if($config->enable === 'Y') {
62
			$this->moduleUpdate();
63
		} else {
64
			// Delete Triggers
65
			$oModuleController = getController('module');
66
			$oModuleController->deleteModuleTriggers('seo');
67
		}
68
69
		$this->setMessage('success_updated');
70
		if (Context::get('success_return_url')) {
71
			$this->setRedirectUrl(Context::get('success_return_url'));
72
		}
73
	}
74
}
75
/* !End of file */
76