diff --git a/Verbraucher_extern/module.php b/Verbraucher_extern/module.php index 8c7eaf1..31172b9 100644 --- a/Verbraucher_extern/module.php +++ b/Verbraucher_extern/module.php @@ -87,22 +87,23 @@ class Verbraucher_extern extends IPSModule return array_values(array_unique($kombinationen)); } + private function findCombinationRecursive($power, $values, $currentCombination, $startIndex, &$result) { + if ($power == 0) { + $result = $currentCombination; + return true; + } + if ($power < 0) { + return false; + } + } private function findCombination($power, $values) { $result = []; - $found = findCombinationRecursive($power, $values, [], 0, $result); + $found = $this->findCombinationRecursive($power, $values, [], 0, $result); return $found ? $result : null; } - private function findCombinationRecursive($power, $values, $currentCombination, $startIndex, &$result) { - if ($power == 0) { - $result = $currentCombination; - return true; - } - if ($power < 0) { - return false; - } - } + private function find($target, $values, $current, &$result) { if ($target == 0) { $result[] = $current;