Checks that the value is at most the date $max.
@param $max mixed the minimum date.
@param $msg string the error message.
971940
public function maxDate($max, $msg)
    {
        if(is_numeric($max)) { // Probably an epoch.
            $max = new \DateTime('@' . $max);
        }
        else {
            $max = new \DateTime($max);
        }
        
        try {
            $dt = new \DateTime($this->_value, new \DateTimeZone("UTC"));
        }
        catch(Exception $e) {
            $this->_errors[] = $msg;
        }
        
        if($dt > $max) {
            $this->_errors[] = $msg;
        }
        
        return $this;
    }
159173
protected function writeOutput($msg, $min=0, $max=null)
    {
        if (!$this->shouldWriteOutput($min, $max)) {
            return;
        }

        return $this->getOutput()->write($msg);
    }
893514
public function float($msg)
    {
        if(filter_var($this->_value, FILTER_VALIDATE_FLOAT) === FALSE) {
            $this->_errors[] = $msg;
        }
        return $this;
    }
422053
protected static function check($value, $min, $max)
    {
        $length = strlen($value);

        if ($length < $min)
            return self::STATUS_WARNING;

        if ($min <= $length && $length <= $max)
            return self::STATUS_GOOD;

        return self::STATUS_DANGER;
    }
1352296
public function sendMessage(Message $msg)
    {
        $this->lastOutboundActivity = microtime(true);
        $this->dispatchMessage($msg, 'Send');
    }
792831
public static function checkDatetimeFormat($field, $format, $msg)
    {
        $date = date($format, strtotime($field));
        if ($field !== $date) {
            throw new MsgException($msg);
        }
    }
140145
protected function _validator_max($input, $value, $max) {
		if (!is_string($value) && !is_integer($value) && !is_float($value)) return false;
		if (is_string($value)) $value = (int)$value;
		return $value <= $max;
	}
1195376
protected function parseError($msg) {
        $args = func_get_args();

        if (count($args) > 1) {
            array_shift($args);
            $msg = vsprintf($msg, $args);
        }

        $line = $this->scanner->currentLine();
        $col = $this->scanner->columnOffset();
        $this->events->parseError($msg, $line, $col);
        return false;
    }
144963
public function warn($msg) {
		$this->mailMessage(self::LEVEL_WARN, $msg);

		if($this->checkLevel($this->loglevels, self::LEVEL_WARN) !== true)
			return;

		$this->writeMessage(self::LEVEL_WARN, $msg);
	}
1036167
public function pack($msg)
    {
        if (!$msg instanceof Message) {
            trigger_error("Given parameter is not a message instance.",
                          E_USER_ERROR);
            return;
        }

        // Set value using serialzed message.
        $this->value = $msg->serializeToString();

        // Set type url.
        $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
        $desc = $pool->getDescriptorByClassName(get_class($msg));
        $fully_qualifed_name = $desc->getFullName();
        $this->type_url = GPBUtil::TYPE_URL_PREFIX.substr(
            $fully_qualifed_name, 1, strlen($fully_qualifed_name));
    }
203691
public function setMax($max)
    {
        if (null === $max) {
            $this->_max = null;
        } else if ($max < $this->_min) {
            /**
             * @see Zend_Validate_Exception
             */
            include_once 'Zend/Validate/Exception.php';
            throw new Zend_Validate_Exception(
                "The maximum must be greater than or equal to the minimum length, but "
                . "$max < $this->_min"
            );
        } else {
            $this->_max = (integer) $max;
        }

        return $this;
    }
1347357
public static function isGt($value, $max)
    {
        is_array($max) && $max = $max[0];
        if (!is_numeric($value)) {
            return false;
        } elseif (function_exists('bccomp')) {
            return bccomp($value, $max, 14) == 1;
        } else {
            return $value > $max;
        }
    }
1071777
public function integer($msg)
    {
        if(filter_var($this->_value, FILTER_VALIDATE_INT) === FALSE) {
            $this->_errors[] = $msg;
        }
        return $this;
    }
1190125
public static function isLengthBetween($value, $min, $max)
    {
        if (is_array($min)) {
            $max = $min[1];
            $min = $min[0];
        }

        if (self::isLengthGte($value, $min) && self::isLengthLte($value, $max)) {
            return true;
        }

        return false;
    }
1352870
public function betweenLength($min, $max, $msg)
    {
        $this->minLength($min, $msg);
        $this->maxLength($max, $msg);
        return $this;
    }
828826
public function checkBetween($value, $min, $max)
    {
        return $this->checkMin($value, $min) && $this->checkMax($value, $max);
    }
619654
public static function spinner(string $msg = '', $ended = false): void
    {
        static $chars = '-\|/';
        static $counter = 0;
        static $lastTime = null;

        $tpl = (Cli::isSupportColor() ? "\x0D\x1B[2K" : "\x0D\r") . '%s';

        if ($ended) {
            printf($tpl, $msg);
            return;
        }

        $now = \microtime(true);

        if (null === $lastTime || ($lastTime < $now - 0.1)) {
            $lastTime = $now;
            // echo $chars[$counter];
            printf($tpl, $chars[$counter] . $msg);
            $counter++;

            if ($counter > \strlen($chars) - 1) {
                $counter = 0;
            }
        }
    }