Code Duplication    Length = 16-18 lines in 2 locations

lib/UserSettings.php 2 locations

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