Set field max expansions.

@param string $field
@param int    $maxExpansions

@return $this
542544
public function setFieldMaxExpansions(string $field, int $maxExpansions): self
    {
        return $this->setFieldParam($field, 'max_expansions', $maxExpansions);
    }
1010473
protected function setMaxLength(Field & $field, $length)
    {
        if (($value = intval($length)) > 0) {
            $field->validationRules[] = sprintf('max:%s', $value);
            $field->methodParams[] = $value;
        }

        return $this;
    }
1316396
public function useFields($fields)
    {
        if (is_string($fields)) {
            $fields = explode(',', $fields);
        }
        $this->fields = $fields;

        return $this;
    }
1145142
public function setMaxLength($maxLength)
    {
        if (!is_integer($maxLength)) {
            throw new InvalidArgumentException(
                'Max length must be an integer.'
            );
        }

        if ($maxLength < 0) {
            throw new InvalidArgumentException(
                'Max length must be a positive integer (>=0).'
            );
        }

        $this->maxLength = $maxLength;

        return $this;
    }
162107
public function max($field)
    {
        $field = $field instanceof Raw ? $field->toString() : "`{$field}`";
        return $this->select(new Raw("MAX({$field}) as `aggregation`"))->limit(1)->fetch()->aggregation;
    }
1021695
public function setLimit($limit)
    {
        if (!is_scalar($limit)) {
            $this->limit = self::DEFAULT_LIMIT;

            return $this;
        } else {
            $limit = (int)$limit;
        }

        if ($limit > self::MAX_LIMIT) {
            $this->limit = self::MAX_LIMIT;
        } elseif ($limit < 1) {
            $this->limit = self::DEFAULT_LIMIT;
        } else {
            $this->limit = $limit;
        }

        return $this;
    }
1160793
public function setLimits($offset, $limit, $max = 0, $cutoff = 0)
    {
        assert(is_int($offset));
        assert(is_int($limit));
        assert(is_int($max));
        assert(is_int($cutoff));
        assert($offset >= 0);
        assert($limit > 0);
        assert($max >= 0);
        assert($cutoff >= 0);

        $this->_offset = $offset;
        $this->_limit = $limit;
        if ($max > 0) {
            $this->_maxmatches = $max;
        }
        if ($cutoff > 0) {
            $this->_cutoff = $cutoff;
        }

        return $this;
    }
806804
public function setMax($max)
    {
        if ($max <= 0) {
            throw new InvalidArgumentException(sprintf('Supplied max value: %d must be greater than 0', $max));
        }
        $this->max = $max;
        return $this;
    }
1117955
public function setMaxDepth($maxDepth)
    {
        if (1 === func_num_args() || func_get_arg(1)) {
            @trigger_error(sprintf('%s is deprecated since version 2.1 and will be removed in 3.0. Use %s::enableMaxDepth() and %s::disableMaxDepth() instead.', __METHOD__, __CLASS__, __CLASS__), E_USER_DEPRECATED);
        }
        $this->maxDepth = $maxDepth;

        return $this;
    }
380047
public function setMaxResults($maxResults)
    {
        $this->limit = $maxResults;
        
        if( $this->query instanceof Query )
        {
            $this->query->setMaxResults($maxResults);
        }

        return $this;
    }
744153
public function setMaxStateLength(int $maxStateLength = null): self
    {
        assert($maxStateLength === null || $maxStateLength > 0);

        $this->maxStateLength = $maxStateLength;

        return $this;
    }
1180014
public function setFormatter($field, $formatter, $options = null)
    {
        // support for field names as array
        if (is_array($field)) {
            foreach ($field as $f) {
                $this->setFormatter($f, $formatter, $options);
            }

            return $this;
        }

        if (!isset($this->columns[$field])) {
            throw new BaseException('Cannot format nonexistant field '.$field);
        }

        $this->columns[$field]['type'] = '';
        $this->addFormatter($field, $formatter, $options);
        $this->last_column = $field;

        return $this;
    }
784107
public function setMaxPlays($maxPlays)
    {
        if (is_int($maxPlays) && $maxPlays >= 0) {
            $this->maxPlays = $maxPlays;
        } else {
            $msg = "The 'maxPlays' argument must be a positive (>= 0) integer, '" . gettype($maxPlays) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
877660
public function hmSet($key, $fields)
    {
        if ($this->hasMaxSize()) {
            foreach ($fields as $field => $value) {
                try {
                    if ($this->isLarge($value)) {
                        $fields[$field] = $this->setLargeValue($this->getMappedKey($key, $field), $value, 0, false);
                    }
                } catch (common_Exception $e) {
                    common_Logger::w('Max size value is misconfigured: ' . $e->getMessage());
                }
            }
        }

        return $this->getDriver()->hmSet($key, $fields);
    }
70830
public function setExtends(string $extends, string $alias = null)
    {
        $this->extends = $this->addUse($extends, $alias);

        return $this;
    }
100769
public function setExtensions( $extensions = array() )
	{
		if( !is_array( $extensions ) )
			throw new InvalidArgumentException( 'Extensions must be given as Array.' );

		$pattern	= "";
		if( count( $extensions ) )
		{
			$extensions	= implode( "|", array_values( $extensions ) );
			$pattern	= '@\.'.$extensions.'$@i';
		}
		$this->pattern	= $pattern;
	}
263058
public function setMax(float $max) : self
    {
        $this->getField()->addAttribute('max', (string) $max);

        return $this;
    }