Set autoomplete attribute with state 'on' or 'off'

@param string $state

@throws FormException

@return Form
354866
public function setAutocomplete(string $state = 'on'): Form
    {
        $states = [
            'on',
            'off'
        ];

        if (!in_array(strtolower($state), $states))
            Throw new FormException('Wrong html form autocomplete attribute state.', 1000);

        $this->attribute['autocomplete'] = $state;

        return $this;
    }
1122264
public function setState($state)
		{
		$r = array_pop($this->states);
		array_push($this->states, $state);
		$this->state = $this->states[count($this->states) - 1];
		return $r;
		}
592282
public function setState(\Haven\PersonaBundle\Entity\State $state = null)
    {
        $this->state = $state;
    
        return $this;
    }
1277681
protected function _addState($state)
    {
        if (!is_string($state) && !($state instanceof Stringable)) {
            throw $this->_createInvalidArgumentException(
                $this->__('Argument is not a valid state.'),
                null,
                null,
                $state
            );
        }

        $this->states[(string) $state] = $state;
    }
1080547
public function setFormEnctype($enctype)
    {
        $enctypes = [
            'application/x-www-form-urlencoded',
            'multipart/form-data',
            'text/plain'
        ];

        // Safety first. Only allow 'post' or 'get' here.
        if (! in_array($enctype, $enctypes)) {
            Throw new FormException('Wrong method set.');
        }

        $this->attribute['formenctype'] = $enctype;

        return $this;
    }
771963
public function setForm($form)
    {
        foreach ($this->fields as $field) {
            $field->setForm($form);
        }
        
        return parent::setForm($form);
    }
552076
def setAutoDefault(self, state):
        
        self._autoDefault = state
        for button in self.buttonBox().buttons():
            button.setAutoDefault(state)
            button.setDefault(state)
1200033
public function setAction($action)
    {
        $this->getTabs()->each(function (TabInterface $tab) use ($action) {
            if ($tab instanceof FormInterface) {
                $tab->setAction($action);
            }
        });

        return $this;
    }
1331977
public function setState(\Core\Entity\State $state = null)
    {
        $this->state = $state;

        return $this;
    }
736594
public function setDebugging( $state = false )
	{
		$existingState = $this->debug;
		$this->debug = $state;
		return $existingState;
	}
1084488
public function jumpToState($state)
    {
        if (!$state instanceof StateInterface) {
            $state = $this->getState($state);
        }

        if (!$this->canJumpToState($state)) {
            throw new StateException(sprintf('Can not jump from state "%s" to "%s".',$this->currentState->getName(), $state->getName()));
        }

        $this->object->setFiniteState($state->getName());
        $this->currentState = $state;
    }
297154
private function _prepareNonSelfIssued(ValidatorState $state): ValidatorState
    {
        // (h.1)
        if ($state->explicitPolicy() > 0) {
            $state = $state->withExplicitPolicy($state->explicitPolicy() - 1);
        }
        // (h.2)
        if ($state->policyMapping() > 0) {
            $state = $state->withPolicyMapping($state->policyMapping() - 1);
        }
        // (h.3)
        if ($state->inhibitAnyPolicy() > 0) {
            $state = $state->withInhibitAnyPolicy(
                $state->inhibitAnyPolicy() - 1);
        }
        return $state;
    }
866335
public function setState($state)
    {
        if (is_int($state)) { $state = self::getStates()[$state]; }
        $state = strtoupper($state);
        if (!in_array($state, self::getStates())) {
            throw new \InvalidArgumentException(sprintf('The "%s" state is not a valid state.', $state));
        }
        $this->state = $state;
        return $this;
    }
347624
public function onInvalid(IState $state = null)
    {
        return $state->isImplementsInterface(IStatePreventable::class)
            ? $state->getOnTerminate()
            : false;
    }
1310776
public function setState($state)
    {
        if (!is_numeric($state)) {
            $errMsg = sprintf('Аргумент должен быть числом. Актуальное значение %s', $state);
            throw new ArgumentNotNumericException($errMsg);
        }
        $this->state = (integer)$state;

        return $this;
    }
948988
public function setRequired( $state ) {
		$this->required = (bool)$state;
		if ( $this->required ) {
			$this->input->setAttributes( [ 'required' => 'required', 'aria-required' => 'true' ] );
			if ( $this->getIndicator() === null ) {
				$this->setIndicator( 'required' );
			}
		} else {
			$this->input->removeAttributes( [ 'required', 'aria-required' ] );
			if ( $this->getIndicator() === 'required' ) {
				$this->setIndicator( null );
			}
		}
		return $this;
	}
794040
public function setState($state)
    {
        $oldState = $this->getState()->getUri();
        if ($oldState == $state) {
            common_Logger::w('Delivery execution ' . $this->getIdentifier() . ' already in state ' . $state);
            return false;
        }
        $this->setData(OntologyDeliveryExecution::PROPERTY_STATUS, $state);
        if ($state == DeliveryExecutionInterface::STATE_FINISHED) {
            $this->setData(OntologyDeliveryExecution::PROPERTY_TIME_END, microtime());
        }
        return $this->service->updateDeliveryExecutionStatus($this, $oldState, $state);
    }