Set the maximum number of points that the candidate is allowed to select.

@param integer $maxChoices A positive (>= 0) integer.
@throws \InvalidArgumentException If $maxChoices is not a positive integer.
552772
public function setMaxChoices($maxChoices)
    {
        if (is_int($maxChoices) === true && $maxChoices >= 0) {
            $this->maxChoices = $maxChoices;
        } else {
            $msg = "The 'maxChoices' argument must be a positive (>= 0) integer, '" . gettype($maxChoices) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
570888
public function setOptions ($options = array())
	{
		// make sure we've got an array for $this->options (could be null)
		if (!is_array($this->options))
		{
			$this->options = array();
		}
		
		// make sure we've gotten a proper argument
		if (!is_array($options))
		{
			throw new InvalidArgumentException ('setOptions requires an array');
		}
		
		// we've yet to init the default options, so create them here
		if (sizeof($this->options) == 0)
		{
			$defaultOptions = array 
			(
				'resizeUp'				=> false,
				'jpegQuality'			=> 100,
				'correctPermissions'	=> false,
				'preserveAlpha'			=> true,
				'alphaMaskColor'		=> array (255, 255, 255),
				'preserveTransparency'	=> true,
				'transparencyMaskColor'	=> array (0, 0, 0)
			);
		}
		// otherwise, let's use what we've got already
		else
		{
			$defaultOptions = $this->options;
		}
		
		$this->options = array_merge($defaultOptions, $options);
	}
1213939
public function setMaxAttempts($attempts)
    {
        if (null !== $attempts && $attempts < 1) {
            throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
        }

        $this->attempts = $attempts;

        return $this;
    }
1031749
public function addChoices(array $choices)
    {
        foreach ($choices as $choiceIdent => $choice) {
            $this->addChoice($choiceIdent, $choice);
        }

        return $this;
    }
50339
final public function setMaxFetchAttempts($attempts)
    {
        if (!is_int($attempts) || $attempts < 1) {
            throw new \InvalidArgumentException('Fetch attempts must be greater than or equal to 1.');
        }

        $this->maxFetchAttempts = $attempts;

        return $this;
    }
245840
public function setIds(array $ids): void
    {
        if (empty($ids)) {
            throw new \InvalidArgumentException('At least one ID must be specified');
        }

        foreach ($ids as $id) {
            if (!\is_int($id)) {
                throw new \InvalidArgumentException('All IDs must be integers');
            }
        }

        $this->ids = $ids;
    }
665744
public function setSortConditions(array $sortConditions)
    {
        foreach ($sortConditions as $sortCondition) {
            if (! is_array($sortCondition)) {
                throw new InvalidArgumentException('Sort condition have to be an array');
            }

            if (! array_key_exists('column', $sortCondition)) {
                throw new InvalidArgumentException('Sort condition missing array key column');
            }
        }

        $this->sortConditions = $sortConditions;
    }
1004077
public function setMaxDate($maxDate)
    {
        $date = \DateTime::createFromFormat(self::MAX_DATE_FORMAT, $maxDate);
        $isValid = $date && $date->format(self::MAX_DATE_FORMAT) == $maxDate;

        if (!$isValid) {
            throw new \InvalidArgumentException('Maximum payment date must be in that format: '.self::MAX_DATE_FORMAT);
        }

        $this->maxDate = $maxDate;
    }
226329
public function setValues($values)
    {
        if ((null !== $values) && (false === is_array($values))) {
            if (false === ($values instanceof ArrayAccess)) {
                throw new InvalidArgumentException(
                    'The value of $values is not an array or an instance of ArrayAccess.'
                );
            }
        }

        $this->values = $values;
    }
727513
public function setOptions($options)
    {
        if (!is_int($options) && !is_null($options)) {
            throw new InvalidArgumentException('Invalid options.');
        }

        $this->options = $options ?: 0;

        $this->handleChangedParameters();

        return $this;
    }
310636
public function setChoices(array $choices) {
		if (empty($choices)) {
			return false;
		}

		$this->deleteChoices();

		// Ignore access (necessary in case a group admin is editing the poll of another group member)
		$ia = elgg_set_ignore_access(true);

		$i = 0;
		foreach ($choices as $choice) {
			$poll_choice = new ElggObject();
			$poll_choice->owner_guid = $this->owner_guid;
			$poll_choice->container_guid = $this->container_guid;
			$poll_choice->subtype = "poll_choice";
			$poll_choice->text = $choice;
			$poll_choice->display_order = $i*10;
			$poll_choice->access_id = $this->access_id;
			$poll_choice->save();

			add_entity_relationship($poll_choice->guid, 'poll_choice', $this->guid);
			$i += 1;
		}

		elgg_set_ignore_access($ia);
	}
886578
public function max($max)
    {
        if (isset($this->min) && $this->min > $max) {
            throw new \InvalidArgumentException(sprintf('You cannot define a max(%s) as you already have a min(%s)', $max, $this->min));
        }
        $this->max = $max;

        return $this;
    }
823091
public function setMin(int $min): void{
        if($this->max < $min){
            throw new \InvalidArgumentException();
        }

        $this->min  = $min;
    }
579589
public function setRange($min, $max)
	{
		$min = filter_var($min, FILTER_VALIDATE_INT);
		$max = filter_var($max, FILTER_VALIDATE_INT);

		if ($min === false)
		{
			throw new InvalidArgumentException('Argument 1 passed to ' . __METHOD__ . ' must be an integer');
		}

		if ($max === false)
		{
			throw new InvalidArgumentException('Argument 2 passed to ' . __METHOD__ . ' must be an integer');
		}

		if ($min > $max)
		{
			throw new InvalidArgumentException('Invalid range: min (' . $min . ') > max (' . $max . ')');
		}

		$this->vars['min'] = $min;
		$this->vars['max'] = $max;
	}
163785
public function setLimits(array $limits = [])
    {
        if (empty($limits)) {
            throw new ListingException("You must provide at least one limit option");
        }

        $this->limits = array_values($limits);

        return $this;
    }
1099048
public function setMatchMax($matchMax)
    {
        if (is_int($matchMax) === true && $matchMax >= 0) {
            $this->matchMax = $matchMax;
        } else {
            $msg = "The 'matchMax' argument must be a positive integer, '" . gettype($matchMax) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
1087395
function setMaxPointsTeam($max, $multicall = false)
    {
        if (!is_int($max)) {
            throw new InvalidArgumentException('max = ' . print_r($max, true));
        }

        return $this->execute(ucfirst(__FUNCTION__), array($max), $multicall);
    }