public function required($options) {
        if ((is_array($options) || (!is_array($options) && $options))) {
            if ((is_array($this->elementData) && (empty($this->elementData) || (empty($this->elementData[0]) && count($this->elementData) === 1))) ||
                    (!is_array($this->elementData) && trim($this->elementData) === '')) {
                if (is_bool($options))
                    $this->addError('Field is required');
                else if (is_array($options) && isset($options['message'])) {
                    $this->addError($options['message']);
                } else
                    $this->addError((!is_array($options) && !is_object($options)) ? $options : 'Field is required');
                return false;
            }
            return true;
        }
        return true;
    }
public function required($options) {
        if ((is_array($options) || (!is_array($options) && $options))) {
            if ((is_array($this->elementData) && (empty($this->elementData) || (empty($this->elementData[0]) && count($this->elementData) === 1))) ||
                    (!is_array($this->elementData) && trim($this->elementData) === '')) {
                if (is_bool($options))
                    $this->addError('Field is required');
                else if (is_array($options) && isset($options['message'])) {
                    $this->addError($options['message']);
                } else
                    $this->addError((!is_array($options) && !is_object($options)) ? $options : 'Field is required');
                return false;
            }
            return true;
        }
        return true;
    }
public function required ( $ options ) { if ( ( is_array ( $ options ) || ( ! is_array ( $ options ) && $ options ) ) ) { if ( ( is_array ( $ this -> elementData ) && ( empty ( $ this -> elementData ) || ( empty ( $ this -> elementData [ 0 ] ) && count ( $ this -> elementData ) === 1 ) ) ) || ( ! is_array ( $ this -> elementData ) && trim ( $ this -> elementData ) === '' ) ) { if ( is_bool ( $ options ) ) $ this -> addError ( 'Field is required' ) ; else if ( is_array ( $ options ) && isset ( $ options [ 'message' ] ) ) { $ this -> addError ( $ options [ 'message' ] ) ; } else $ this -> addError ( ( ! is_array ( $ options ) && ! is_object ( $ options ) ) ? $ options : 'Field is required' ) ; return false ; } return true ; } return true ; }
Makes an element required
@param string $name Name of the element to filter
@param boolean|string|array $options Boolean indicates required or not.
String indicates required with custom message.
Array indicates required and has options
@return boolean
Makes an element required