4c8595e666795e39fe71af4676fce9bd8e6d0203
[GitHub/WoltLab/WCF.git] /
1 <?php
2 namespace wcf\system\option\user\group;
3
4 /**
5 * User group option type implementation for integer input fields.
6 *
7 * The merge of option values returns -1 if all values are -1 otherwise the lowest
8 * value.
9 *
10 * @author Marcel Werk
11 * @copyright 2001-2013 WoltLab GmbH
12 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
13 * @package com.woltlab.wcf
14 * @subpackage system.option.user.group
15 * @category Community Framework
16 */
17 class InfiniteInverseIntegerUserGroupOptionType extends InverseIntegerUserGroupOptionType {
18 /**
19 * @see wcf\system\option\user\group\IUserGroupOptionType::diff()
20 */
21 public function diff($defaultValue, $groupValue) {
22 return $this->merge($defaultValue, $groupValue);
23 }
24
25 /**
26 * @see wcf\system\option\user\group\IUserGroupOptionType::merge()
27 */
28 public function merge($defaultValue, $groupValue) {
29 if (($defaultValue == -1 && $groupValue == -1) || ($defaultValue == $groupValue)) {
30 return null;
31 }
32
33 return min($defaultValue, $groupValue);
34 }
35 }