@param bool $required

@return $this|self
422876
public function setRequired(bool $required = true)
    {
        if ($required) {
            $this->field->addProp('required');
        } else {
            $this->field->removeProp('required');
        }

        return $this;
    }
646377
public function addRequire($require, $version = '*', $overwrite = false)
    {
        if (!isset($this->getRequire()->$require) || $overwrite) {
            $this->getRequire()->$require = $version;
        }

        return $this;
    }
30072
public function required($message = null)
    {
        $this->setRule(__FUNCTION__, function($val)
                       {
                           if (is_scalar($val)) {
                               $val = trim($val);
                           }
                           return !empty($val);
                       }, $message);
        return $this;
    }
825654
public function setRequired(bool $required): BaseAttribute
    {
        parent::setRequired($required);

        if ($this->getMinLength() === 0) {
            $this->setMinLength(1);
        }

        return $this;
    }
481322
protected function validateProperty(string $property, bool $needed = false)
    {
        if (!property_exists($this, $property)) {
            throw new InvalidArgumentException("Property {$property} does not exist");
        }

        if ($needed && !isset($this->{$property})) {
            throw new LogicException("Property {$property} could not be calculated");
        }

        return $this;
    }
499578
public function filled($filled) {
        
        if(false === is_bool($filled)) {
            return trigger_error(sprintf('Argument 1 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($filled)), E_USER_ERROR);
        }

        $this -> filled = $filled;

        return $this;
    }
669705
public function setRequired($keys)
    {
        if(is_string($keys))
        {
            $this->setRequired(explode(",",$keys));
        }
        else
        {
            foreach($keys as $key)
            {
                if(!in_array($key, $this->required))
                    $this->required[] = $key;
            }
        }

        return $this;
    }
830275
public function lazy($lazy = true)
    {
        if (!$lazy) {
            $this->parseGroupRule($this->rule);
            $this->rule = null;
        }

        return $this;
    }
1001123
public void setIsRequired(boolean required) {
        if (! required) {
            validators.remove(REQUIRED_FIELD_VALIDATOR);
        } else if (! isRequired()) {
            validators.add(REQUIRED_FIELD_VALIDATOR);
        }
    }
555264
public function withEmbed(bool $embed): self
    {
        if ($this->embed == $embed) {
            return $this;
        }

        $url = clone $this;
        $url->embed = $embed;

        return $url;
    }
917875
public function enableTime(bool $time = true) : self
    {
        $this->set('data-fields--datetime-enable-time', var_export($time, true));

        return $this;
    }
1127372
public function setRequiredProperties(array $required)
    {
        if (empty($required)) {
            return $this;
        }

        if (isset($required[0]) && $required[0] === '*') {
            $this->required = get_object_vars($this);
            $this->allRequired = true;
        } else {
            $this->required = $required;
        }

        unset($this->required['required'],
              $this->required['requiredTypes'],
              $this->required['ignored'],
              $this->required['requiredParsed'],
              $this->required['allRequired']);

        return $this;
    }
986001
public function setActive($active = true)
    {
        if (is_callable($active)) {
            $this->active = $active($this);

            return $this;
        }

        $this->active = (bool) $active;

        return $this;
    }
1313713
public function setRequired($required)
    {
        if (is_string($required)) {
            $required = $required === 'true' ? true : false;
        }
        $this->required = $required;
    }
127664
public function setActive($active = true)
    {
        $this->active = (bool) $active;

        if ($active) {
            $this->setHtmlAttribute('class', 'active');
        }

        return $this;
    }
423555
public function when($condition, Closure $trueFunc, Closure $falseFunc = null) {
        if ($condition) {
            $trueFunc($this);
            return $this;
        }
        if (!empty($falseFunc)) {
            $falseFunc($this);
        }
        return $this;
    }
1181726
public function required($required = true, $required_value = true)
    {
        if ($required == $required_value) {
            $this->addClass('required');
            $this->aria('required', 'true');

            return parent::attr('required', 'required');
        }

        return $this;
    }