@param array $groupedArgs

@return bool
500916
protected function runGlobalCommands(array $groupedArgs) {
        // run commands that are global but will for sure
        // not generate any output or interrupt the flow
        foreach ($this->getGlobalHiddenCommands() as $command) {
            $command = clone $command;
            $groupedArgs = $this->argumentsMatcher->matchCommand($command, $groupedArgs, false);
            $this->runCommand($command, false);
        }

        // run commands that might generate output or
        // try to interrupt the flow
        foreach ($this->getGlobalNotHiddenCommands() as $command) {
            $command = clone $command;

            // dirty hack, fix later
            // global commands should not steal arguments
            $args = $groupedArgs['arguments'];
            $groupedArgs = $this->argumentsMatcher->matchCommand($command, $groupedArgs, false);
            $groupedArgs['arguments'] = $args;
            $continue = $this->runCommand($command);

            if ($continue === false) {
                return [$groupedArgs, false];
            }
        }

        return [$groupedArgs, true];
    }
1129217
public static function isContiguous(array $ranges)
	{
		$ranges = self::sortArrayOfRanges($ranges);

		for ($i = 0; $i < count($ranges) - 1; $i++)
		{
			if (!$ranges[$i]->abuts($ranges[$i + 1]))
			{
				return false;
			}
		}

		return true;
	}
945109
protected function resolveArgs($methodCallArgs) {
		if (! isset($methodCallArgs[1])) {
			if ($this->arguments === null) {
				return $this->normalizeArgs([]);
			}
			
			return $this->normalizeArgs($this->arguments);
		}
		
		if (isset($methodCallArgs[2])) {
			array_shift($methodCallArgs);
			return $this->normalizeArgs($methodCallArgs);
		}
		
		return $this->normalizeArgs($methodCallArgs[1]);
	}
1127219
public function createGroupConversation($groupName, array $users)
    {
        $group = $this->query()->create([
            'name' => $groupName,
        ]);

        if ($group) {
            $group->users()->attach($users);

            return true;
        }

        return false;
    }
695336
public function gcdm( $args )
	 {
		if( count( $args ) )
		{
			$min = $this->min( $args );
			for( $i=$min; $i>0; $i-- )
			{
				$a = true;
				foreach( $args as $arg )
					if( $arg % $i != 0 )
						$a = false;
				if( $a )
					return $i;
			}
		}
		return false;
	}
954558
protected function isGroupRequested(array $commandGroups): bool
    {
        return (count($this->groupsToBeExecuted) > 0 && (count(array_intersect($this->groupsToBeExecuted, $commandGroups)) > 0));
    }
785273
public function invokeArguments(array $arguments)
    {
        $parsedArguments = $this->argumentParser->parse($arguments, $this->getParameters());

        return call_user_func_array($this->callable, $parsedArguments);
    }
107996
private function preserveOldArgFormat(array $args)
    {
        if (isset($args[0]) && !is_array($args[0])) {
            $args = [$args];
        } elseif (empty($args)) {
            $args = [[]];
        }

        return $args;
    }
314805
public function validate($args)
    {
        $check = $this->normalizeArgs(is_array($args) ? $args : []);

        return is_array($check) ? true : $check;
    }
341442
public function matchArgument(IArgument $argument, array $groupedArgs, $strict = true) {
        $arg = null;

        if (array_has($groupedArgs, 'arguments')) {
            if ($argument->isSingle()) {
                $arg = array_shift($groupedArgs['arguments']);
            } else if ($argument->isMultiple()) {
                $arg = array_get($groupedArgs, 'arguments');
                array_set($groupedArgs, 'arguments', []);
            }
        }

        if ($argument->isRequired() && $strict && ($arg === null || $arg === [])) {
            throw new MissingArgumentValueException(s(
                'Missing argument value "%s".', $argument->getName()
            ));
        }

        $argument->setValue($arg);

        return $groupedArgs;
    }
657639
public function addGroupings( $groupings )
	{
		if( !is_array( $groupings ) )
			throw new InvalidArgumentException( 'An Array should be given.' );
		foreach( $groupings as $grouping )
			$this->addGrouping( $grouping );
	}
748645
protected function validateMissingArguments(array $arguments): bool
    {
        $missingArguments = \array_filter($arguments, function ($argument) {
            return empty($this->argument($argument));
        });

        if (\count($missingArguments) > 1) {
            throw new RuntimeException(\sprintf('Not enough arguments (missing: "%s").', \implode(', ', $missingArguments)));
        }

        return true;
    }
466019
private function flattenArgs($args, $level = 0, &$count = 0)
    {
        $result = [];
        foreach ($args as $key => $value) {
            if (++$count > 10000) {
                return ['array', '*SKIPPED over 10000 entries*'];
            }
            if ($value instanceof \__PHP_Incomplete_Class) {
                // is_object() returns false on PHP<=7.1
                $result[$key] = ['incomplete-object', $this->getClassNameFromIncomplete($value)];
            } elseif (is_object($value)) {
                $result[$key] = ['object', get_class($value)];
            } elseif (is_array($value)) {
                if ($level > 10) {
                    $result[$key] = ['array', '*DEEP NESTED ARRAY*'];
                } else {
                    $result[$key] = ['array', $this->flattenArgs($value, $level + 1, $count)];
                }
            } elseif (null === $value) {
                $result[$key] = ['null', null];
            } elseif (is_bool($value)) {
                $result[$key] = ['boolean', $value];
            } elseif (is_int($value)) {
                $result[$key] = ['integer', $value];
            } elseif (is_float($value)) {
                $result[$key] = ['float', $value];
            } elseif (is_resource($value)) {
                $result[$key] = ['resource', get_resource_type($value)];
            } else {
                $result[$key] = ['string', (string)$value];
            }
        }

        return $result;
    }
208340
public function groupBy($groupKeys)
    {
        if (is_string($groupKeys))
        {
            $groupKeys = $this->stringArgumentToArray($groupKeys);
        }

        foreach ($groupKeys as $groupKey) 
        {
            $this->groups[] = $groupKey;
        }

        return $this;
    }
316916
public static function sortArgs(array &$args) {
        ksort($args);
        foreach ($args as $key => $val) {
            if (is_array($val)) {
                ksort($val);
                $args [ $key ] = $val;
                self::sortArgs($val);
            }
        }
    }
1104159
public function matches(array $matchers, array $arguments): bool
    {
        $argumentCount = count($arguments);
        $index = 0;

        foreach ($matchers as $matcher) {
            if ($matcher instanceof WildcardMatcher) {
                $matchCount = 0;
                $innerMatcher = $matcher->matcher();

                while (
                    $index < $argumentCount &&
                    $innerMatcher->matches($arguments[$index])
                ) {
                    ++$matchCount;
                    ++$index;
                }

                $maximumArguments = $matcher->maximumArguments();

                $isMatch =
                    (
                        $maximumArguments < 0 ||
                        $matchCount <= $maximumArguments
                    ) &&
                    $matchCount >= $matcher->minimumArguments();

                if (!$isMatch) {
                    return false;
                }

                continue;
            }

            if (
                $index >= $argumentCount ||
                !$matcher->matches($arguments[$index])
            ) {
                return false;
            }

            ++$index;
        }

        return $index === $argumentCount;
    }
1219767
protected function doSet($key, $grouping, $value)
    {
        //  Check that it's a valid key/grouping pair
        if (!isset($this->notifications[$grouping]->options[$key])) {
            $this->setError($grouping . '/' . $key . ' is not a valid group/key pair.');
            return false;
        }

        // --------------------------------------------------------------------------

        $oDb = Factory::service('Database');
        $oDb->where('key', $key);
        $oDb->where('grouping', $grouping);
        if ($oDb->count_all_results($this->table)) {
            $oDb->where('grouping', $grouping);
            $oDb->where('key', $key);
            $oDb->set('value', json_encode($value));
            $oDb->update($this->table);
        } else {
            $oDb->set('grouping', $grouping);
            $oDb->set('key', $key);
            $oDb->set('value', json_encode($value));
            $oDb->insert($this->table);
        }
    }