4d7bdc286f63b0b36bf342c55bced1c88b8fe4c1
[GitHub/WoltLab/WCF.git] /
1 <?php
2 namespace wcf\system\option\user\group;
3
4 /**
5 * InfiniteInverseIntegerUserGroupOptionType is an implementation of IUserGroupOptionType
6 * for integer values.
7 * The merge of option values returns -1 if all values are -1 otherwise the lowest value.
8 *
9 * @author Marcel Werk
10 * @copyright 2001-2011 WoltLab GmbH
11 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
12 * @package com.woltlab.wcf
13 * @subpackage system.option.user.group
14 * @category Community Framework
15 */
16 class InfiniteInverseIntegerUserGroupOptionType extends InverseIntegerUserGroupOptionType {
17 /**
18 * @see wcf\system\option\user\group\IUserGroupOptionType::merge()
19 */
20 public function merge(array $values) {
21 foreach ($values as $key => $value) {
22 if ($value == -1) unset($values[$key]);
23 }
24
25 if (count($values) == 0) return -1;
26 return min($values);
27 }
28 }