Helper method for validating an argument if it is numeric

@param mixed     $argument
@param string|null $argumentName
@return bool
490019
public static function validate($argument, $argumentName = null)
    {
        if (trim($argument) != null && !is_numeric($argument)) {
            throw new \InvalidArgumentException("$argumentName is not a valid numeric value");
        }
        return true;
    }
733498
protected function checkCommandExists($commandName, $argument = '--version')
    {
        $command = $commandName;
        $argument = (string) $argument;
        if ($argument !== '') {
            $command .= ' '.$argument;
        }
        list($rc, , $stdErr) = $this->run($command);
        if ($rc !== 0) {
            throw new Exception\CommandNotFound($commandName, $stdErr ? $stdErr : null);
        }
    }
1075664
private function detectFlags($argument)
    {
        if ((substr($argument, 0, 2) === '--') && (!strpos($argument, '='))) {
            $this->flags->push(ltrim($argument, '--'));
            return true;
        }
        return false;
    }
1348451
protected function checkStringArgument(array $arguments, $numberOfElements = 1)
    {
        if (!$this->checkFixedArray($arguments, $numberOfElements) || !is_string($arguments[0])) {
            throw new InvalidCommandArgumentException($this, $arguments);
        }
    }
750320
public function error($argument = null)
    {
        if (is_callable($argument)) {
            return parent::error($argument);
        } else {
            if (isset($this->container['response'])) {
                try {
                    return parent::error($argument);
                } catch (\Slim\Exception\Stop $e) {
                    // noop
                }
            } else {
                $this->callErrorHandler($argument);
                // noop
            }
        }
    }
280435
private function getMethodArgument($argument)
    {
        $arg = '__unknown__';
        if ($argument instanceof PyStringNode) {
            $arg = 'PyStringNode $string';
        } elseif ($argument instanceof TableNode) {
            $arg = 'TableNode $table';
        }

        return $arg;
    }
938534
public static function assertNumberFormat($number)
    {
        if (is_float($number)) {
            throw new \InvalidArgumentException(sprintf('The provided value "%s" must be a string, not a float.', $number));
        }
        if (!is_numeric($number)) {
            throw new \InvalidArgumentException(sprintf('The provided value "%s" is not a numeric value.', $number));
        }
    }
390708
public static function validate($argument, $argumentName = null)
    {
        // DEBUG
        //echo "Argument: $argument\n";
        //echo "Argument name: $argumentName\n";

        if ($argument === null) {
            self::throwException($argument, $argumentName);
        }

        if (gettype($argument) != 'string') {
            self::throwException($argument, $argumentName);
        }

        if (gettype($argument) == 'string' && trim($argument) == '') {
            self::throwException($argument, $argumentName);
        }

        if (!in_array($argument, BlockCypherCoinSymbolConstants::COIN_SYMBOL_LIST())) {
            self::throwException($argument, $argumentName);
        }

        return true;
    }
767899
public function has($argument, $alias = null)
    {
        if (isset($this->arguments[$argument])) {
            return true;
        } else
            if (! empty($alias) && isset($this->arguments[$alias])) {
                return true;
            } else {
                return false;
            }
    }
1053379
private function existsParamTagWithArgument($parameters, ArgumentDescriptor $argument)
    {
        foreach ($parameters as $parameter) {
            if ($argument->getName() == $parameter->getVariableName()) {
                return true;
            }
        }

        return false;
    }
637443
public static function isNumeric($value, $format, $args = null, $_ = null) {
        if (!is_numeric($value)) {
            self::vfail($format, array_slice(func_get_args(), 2));
        }
        return $value;
    }
417779
function validate(string $value, \CharlotteDunois\Livia\Commands\Context $context, ?\CharlotteDunois\Livia\Arguments\Argument $arg = null) {
        $groups = $this->client->registry->findGroups($value);
        if(\count($groups) === 1) {
            return true;
        }
        
        $commands = $this->client->registry->findCommands($value);
        if(\count($commands) === 1) {
            return true;
        }
        
        if(\count($groups) === 0 && \count($commands) === 0) {
            return false;
        }
        
        $cmds = (!empty($commands) ? \CharlotteDunois\Livia\Utils\DataHelpers::disambiguation($commands, 'commands', 'name') : '');
        $grps = (!empty($groups) ? \CharlotteDunois\Livia\Utils\DataHelpers::disambiguation($groups, 'groups', 'name') : '');
        
        return $cmds.(!empty($cmds) && !empty($grps) ? \PHP_EOL : '').$grps.\PHP_EOL;
    }
636574
function (argument) {
                    var it = toPrimitive(argument, false);
                    if (typeof it == 'string' && it.length > 2) {
                        it = TRIM ? it.trim() : $trim(it, 3);
                        var first = it.charCodeAt(0)
                            , third, radix, maxCode;
                        if (first === 43 || first === 45) {
                            third = it.charCodeAt(2);
                            if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
                        } else if (first === 48) {
                            switch (it.charCodeAt(1)) {
                                case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i
                                case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i
                                default: return +it;
                            }
                            for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) {
                                code = digits.charCodeAt(i);
                                // parseInt parses a string to a first unavailable symbol
                                // but ToNumber should return NaN if a string contains unavailable symbols
                                if (code < 48 || code > maxCode) return NaN;
                            } return parseInt(digits, radix);
                        }
                    } return +it;
                }
48835
public function validate (& $value, $name = '', $arguments = array())
		{
			$callbackArguments = array_merge(array(& $value), $arguments);

			$returnValue = call_user_func_array($this->callback, $callbackArguments);

			if ($returnValue) {
				return true;
			} else {
				throw new ValidationException($this->getMessage($name));
			}
		}
54228
public function set($argument, $value = null)
    {
        if (!is_array($argument)) {
            $argument = array($argument => $value);
        }

        return $this->setArguments($argument);
    }
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;
    }
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;
    }