public function setRequired($required)
    {
        $this->required = (boolean) $required;
        if ($this->isRequired()) {
            $this->setAttribute('required');
            return $this;
        }

        if ($this->getAttributes()->containsKey('required')) {
                $this->getAttributes()->remove('required');
        }
        return $this;
    }
public function setRequired($required)
    {
        $this->required = (boolean) $required;
        if ($this->isRequired()) {
            $this->setAttribute('required');
            return $this;
        }

        if ($this->getAttributes()->containsKey('required')) {
                $this->getAttributes()->remove('required');
        }
        return $this;
    }
public function setRequired ( $ required ) { $ this -> required = ( boolean ) $ required ; if ( $ this -> isRequired ( ) ) { $ this -> setAttribute ( 'required' ) ; return $ this ; } if ( $ this -> getAttributes ( ) -> containsKey ( 'required' ) ) { $ this -> getAttributes ( ) -> remove ( 'required' ) ; } return $ this ; }
Sets the required flag for this input

@param boolean $required

@return $this|self|InputInterface
Sets the required flag for this input