Set the decorated model

@param   ControllerToolbarInterface $delegate The decorated toolbar
@return  ControllerToolbarDecorator
@throws \InvalidArgumentException If the delegate is not a toolbar
977537
public function setDelegate($delegate)
    {
        if (!$delegate instanceof ControllerToolbarInterface) {
            throw new \InvalidArgumentException('Delegate: '.get_class($delegate).' does not implement ControllerToolbarInterface');
        }

        return parent::setDelegate($delegate);
    }
1221742
public function setToolName($toolName)
    {
        if (Format::isString256($toolName) === true) {
            $this->toolName = $toolName;
        } else {
            $msg = "The toolName argument must be a string with at most 256 characters.";
            throw new InvalidArgumentException($msg);
        }
    }
865116
public function updateDelegates(Models\Delegates $delegates)
    {
        $resource = 'delegates';
        $response = $this->sendPutRequest($resource, $delegates->toArray());
        $delegateResponse = new Models\UpdateDelegateResponse($response);
        return $delegateResponse->getDelegates();
    }
439524
public function set($key, $value)
	{
		if ( ! $value instanceof Toggle)
		{
			throw new \InvalidArgumentException('You can only add Toggle objects to a ToggleGroup.');
		}

		return parent::set($key, $value);
	}
654458
public function setRole($role)
    {
        $allowed_values = array('fleet_commander', 'wing_commander', 'squad_commander', 'squad_member');
        if ((!in_array($role, $allowed_values))) {
            throw new \InvalidArgumentException("Invalid value for 'role', must be one of 'fleet_commander', 'wing_commander', 'squad_commander', 'squad_member'");
        }
        $this->container['role'] = $role;

        return $this;
    }
751723
public function model(Model $model)
    {
        // Check if the model is searchable before setting the query builder model
        $traits = class_uses_recursive(get_class($model));

        if (!isset($traits[Searchable::class])) {
            throw new InvalidArgumentException(get_class($model).' does not use the searchable trait');
        }

        $this->type($model->getDocumentType());

        if ($index = $model->getDocumentIndex()) {
            $this->index($index);
        }

        $this->model = $model;

        return $this;
    }
569770
public function setController($controller)
        {
            if (null !== $controller && !is_string($controller)) {
                throw new Exception(
                    'Invalid argument: $controller must be a string or null'
                );
            }

            $this->_controller = $controller;
            $this->_hrefCache  = null;

            return $this;
        }
492506
public function removeToolbar(ControllerToolbarInterface $toolbar)
    {
        if($this->hasToolbar($toolbar->getType()))
        {
            unset($this->__toolbars[$toolbar->getType()]);

            if ($this->inherits(__NAMESPACE__.'\CommandMixin')) {
                $this->removeCommandHandler($toolbar);
            }
        }

        return $this->getMixer();
    }
1147557
protected function getDelegateHydrator(): callable
    {
        $delegate = [$this, static::DEFAULT_DELEGATE_HYDRATE_METHOD_NAME];

        if (!is_callable($delegate, false, $callable_name)) {
            throw InvalidDelegateException::forNonCallable($callable_name);
        }

        return $delegate;
    }
424205
public function setDelegate($delegate)
    {
        if (!$delegate instanceof KTemplateEngineInterface) {
            throw new InvalidArgumentException('Delegate: '.get_class($delegate).' does not implement TemplateEngineInterface');
        }

        return parent::setDelegate($delegate);
    }
1185428
protected function setLocation()
    {
        if (!isset($this->job)) {
            throw new \InvalidArgumentException('cannot create a viewModel for Templates without aa $job');
        }
        $location = $this->job->getLocation();
        $this->container['location'] = isset($location)?$location:'';
        return $this;
    }
810431
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
    {
        $operation = $this->getOperation($request);

        $arguments = [];
        foreach ($operation->getParameters() as $parameter) {
            $arguments[] = $request->getAttribute($parameter->getName());
        }

        $result = call_user_func_array($this->commands[$operation->getId()], $arguments);

        return $delegate->process($request->withAttribute(self::ATTRIBUTE, $result));
    }
1174951
public function withTable(string $tableName) : TableWidgetDefiner
    {
        if (!isset($this->tables[$tableName])) {
            throw InvalidArgumentException::format(
                'Invalid table name supplied to %s: expecting one of (%s), \'%s\' given',
                __METHOD__, Debug::formatValues(array_keys($this->tables)), $tableName
            );
        }

        return new TableWidgetDefiner($this->name, $this->label, $this->authSystem, $this->requiredPermissions, $this->tables[$tableName], $this->callback);
    }
336787
public function setOption($key, $value)
    {
        if (!in_array($key, $this->availableOptions)) {
            throw new Exception\InvalidArgumentException('Invalid option for Tooltip');
        }

        if (is_bool($value)) {
            $value = $value ? 'true' : 'false';
        }

        if (!is_string($value)) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Invalid value for Tooltip, expected boolean or string, got "%s"',
                gettype($value)
            ));
        }

        $this->getElement()->addAttribute("data-$key", $value);

        return $this;
    }
741013
public function setTemplate($template)
    {
        if (empty($template)) {
            $this->template = null;
            return $this;
        }

        if (!is_string($template)) {
            throw new InvalidArgumentException(
                'Handler view template must be a string identifier.'
            );
        }

        $this->template = $template;
        return $this;
    }
428675
public function setMasterKeyPairProvider($provider)
    {
        if (isset($this->masterKeyPairProvider)) {
            throw new InvalidCallException('Setting read-only property: ' . get_class($this) . '::masterKeyPairProvider');
        }
        if (is_array($provider)) {
            $provider = Yii::createObject($provider);
        }

        $this->masterKeyPairProvider = $provider;
    }
120190
public void setDelegate(Object delegate) {
        this.delegate = delegate;
        this.metaClass = InvokerHelper.getMetaClass(delegate.getClass());
    }