Code Duplication    Length = 16-18 lines in 2 locations

lib/UserSettings.php 2 locations

@@ 67-84 (lines=18) @@
64
	 * @param string $type One of the activity types, 'batchtime' or 'self'
65
	 * @return bool|int
66
	 */
67
	public function getUserSetting($user, $method, $type) {
68
		$defaultSetting = $this->getDefaultFromSetting($method, $type);
69
		if (is_bool($defaultSetting)) {
70
			return (bool) $this->config->getUserValue(
71
				$user,
72
				'activity',
73
				'notify_' . $method . '_' . $type,
74
				$defaultSetting
75
			);
76
		}
77
78
		return (int) $this->config->getUserValue(
79
			$user,
80
			'activity',
81
			'notify_' . $method . '_' . $type,
82
			$defaultSetting
83
		);
84
	}
85
86
	/**
87
	 * @param string $method
@@ 91-106 (lines=16) @@
88
	 * @param string $type
89
	 * @return bool|int
90
	 */
91
	public function getConfigSetting($method, $type) {
92
		$defaultSetting = $this->getDefaultFromSetting($method, $type);
93
		if (is_bool($defaultSetting)) {
94
			return (bool) $this->config->getAppValue(
95
				'activity',
96
				'notify_' . $method . '_' . $type,
97
				$defaultSetting
98
			);
99
		}
100
101
		return (int) $this->config->getAppValue(
102
			'activity',
103
			'notify_' . $method . '_' . $type,
104
			$defaultSetting
105
		);
106
	}
107
108
	/**
109
	 * Get a good default setting for a preference