Método que indica si la firma del documento es o no válida
@return =true si la firma del documento del envío es válida, =null si no se pudo determinar
@author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
@version 2017-04-07
482808
public function checkFirma()
    {
        if (!$this->xml)
            return null;
        // listado de firmas del XML
        $Signatures = $this->xml->documentElement->getElementsByTagName('Signature');
        // verificar firma de SetDTE
        $SetDTE = $this->xml->documentElement->getElementsByTagName('SetDTE')->item(0)->C14N();
        $SignedInfo = $Signatures->item($Signatures->length-1)->getElementsByTagName('SignedInfo')->item(0);
        $DigestValue = $Signatures->item($Signatures->length-1)->getElementsByTagName('DigestValue')->item(0)->nodeValue;
        $SignatureValue = $Signatures->item($Signatures->length-1)->getElementsByTagName('SignatureValue')->item(0)->nodeValue;
        $X509Certificate = $Signatures->item($Signatures->length-1)->getElementsByTagName('X509Certificate')->item(0)->nodeValue;
        if ($X509Certificate[1]==' ' or $X509Certificate[1]=="\t") {
            $lineas = explode("\n", $X509Certificate);
            $X509Certificate = '';
            foreach($lineas as $l) {
                $X509Certificate .= trim($l);
            }
        }
        $X509Certificate = '-----BEGIN CERTIFICATE-----'."\n".wordwrap(trim($X509Certificate), 64, "\n", true)."\n".'-----END CERTIFICATE-----';
        $valid = openssl_verify($SignedInfo->C14N(), base64_decode($SignatureValue), $X509Certificate) === 1 ? true : false;
        return $valid and $DigestValue===base64_encode(sha1($SetDTE, true));
    }
857671
public function is_valid() {
        $ret = false;

        if (is_null($this->division) === false && is_null($this->datafileURI) === false &&
            is_null($this->subscribe) === false && is_null($this->profileUpdate) === false &&
            is_null($this->listLoadName) === false && is_null($this->loadMode) === false &&
            is_null($this->headers) === false && is_null($this->maxErrors) === false &&
            is_null($this->errorType) === false
        ) {
            $ret = true;
        }

        return $ret;
    }
259285
public function isValid() {
		
		$params = $this -> getParameters();
		$file 	= $this -> getFile();

		if(false === isset($params[0])) {
			return trigger_error(sprintf('Missing argument 1 for %s', __METHOD__), E_USER_ERROR);
		}

		if(false === ('-' . intval($params[0]) == '-' . $params[0])) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($params[0])), E_USER_ERROR);
		}

		$dimensions = @getimagesize($file['tmp_name']);

		if(true === is_array($dimensions)) {

			if($dimensions[0] >= $params[0]) {
				return true;
			}
		}

		return false;
	}
615813
public function validarDadosObrigatorios()
    {
        if (null === $this->getValorDocumento()) {
            $this->erros['valor'] = 'Valor do documento é obrigatório';
        }
        if (null === $this->getConvenio()->getBanco()->getAgencia()) {
            $this->erros['agencia'] = 'Agência do banco é obrigatório';
        }
        if (null === $this->getConvenio()->getBanco()->getConta()) {
            $this->erros['conta'] = 'Conta do banco é obrigatório';
        }
        if (null === $this->getConvenio()->getCarteira()->getNumero()) {
            $this->erros['carteira'] = 'Carteira do convênio é obrigatório';
        }
        if (!empty($this->erros)) {
            $dadosFaltantes = implode("', '", array_keys($this->erros));
            throw new \InvalidArgumentException("Faltam dados a serem fornecidos ao boleto. ('{$dadosFaltantes}')");
        }
    }
417359
public function valid()
    {
        if ($this->_useBuffering) {
            $valid = $this->_index < $this->_count;
            if ($valid && $this->_results[$this->_index] !== null) {
                $this->_current = $this->_results[$this->_index];

                return true;
            }
            if (!$valid) {
                return $valid;
            }
        }

        $this->_current = $this->_fetchResult();
        $valid = $this->_current !== false;

        if ($valid && $this->_useBuffering) {
            $this->_results[$this->_index] = $this->_current;
        }
        if (!$valid && $this->_statement !== null) {
            $this->_statement->closeCursor();
        }

        return $valid;
    }
26756
protected function validateEntityIdFile()
    {
        $field = 'entity_id';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if (!isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Entity ID');

        if (!is_numeric($value)) {
            $this->setErrorInteger($field, $label);
            return false;
        }

        if (strlen($value) > 10) {
            $this->setErrorLengthRange($field, $label, 0, 10);
            return false;
        }

        return true;
    }
1044063
public function isValid() {
        if ($this->isValid === null) $this->isValid = $this->validate();
        return $this->isValid;
    }
872297
public boolean isValid() {
        if (valid == null) {
            valid = (this.resource != null);
            if (valid) {
                valid = (getResourceResolver().getResource(getPath()) != null);
            }
        }
        return valid;
    }
905037
protected function validateFile()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->file->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('File'));
            return false;
        }

        $this->setSubmitted('update', $data);
        return true;
    }
1100171
public function validate(){
        if(count($this->fieldsState) == 0){
            //Si no hay datos devuelve TRUE
            return TRUE;
        }
        else{
            //Si hay datos valida sus reglas            
            //El formulario empieza siendo valido
            $form_valid= TRUE;            
            //Recorro todos los datos y sus reglas
            foreach ($this->fieldsState as $fieldState) {
                $valid= TRUE;                
                //Recorro cada regla del dato
                foreach ($fieldState['rules'] as $rule) {
                    //Ve el tipo de regla, con o sin parametros
                    if (count(explode('[', $rule)) > 1){
                        //Si hay reglas con parametros, separa la regla y su parametro               
                        $vars= explode('[', $rule);
                        $rule= $vars[0];
                        $var= explode(']', $vars[1]);
                        $var= $var[0];
                        //Realiza el llamado a la funcion correspondiente
                        $valid= call_user_func_array(array($this, $rule), array($fieldState['name'], $fieldState['value'], $var));
                    }
                    else{
                        //Regla sin parametros
                        //Realiza el llamado a la funcion correspondiente
                        $valid= call_user_func_array(array($this, $rule), array($fieldState['name'], $fieldState['value']));
                    }
                    
                    //Si una regla ya no es valida, no reviso las demas
                    if(!$valid){
                        //Asigno al campo Valido del dato FALSE
                        $name= $fieldState['name'];
                        $this->fieldsState["$name"]['valid']= FALSE;
                        break;
                    }
                }                
                //Actualizo el valor de formulario_valido de manera que si ya es falso se mantiene en falso
                $form_valid= $form_valid && $valid;
            }            
            return $form_valid;
        }
    }
812128
public boolean isValid() {
		NodeList nodes = xmlDoc.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature");

		if (nodes == null || nodes.getLength() == 0) {
			logger.debug("Can't find signature in document");
			return false;
		}

		if (setIdAttributeExists()) {
			tagIdAttributes(xmlDoc);
		}

		X509Certificate cert = certificate.getX509Cert();
		DOMValidateContext ctx = new DOMValidateContext(cert.getPublicKey(), nodes.item(0));
		XMLSignatureFactory sigF = XMLSignatureFactory.getInstance("DOM");

		XMLSignature xmlSignature;
		try {
			xmlSignature = sigF.unmarshalXMLSignature(ctx);
		} catch (Exception e) {
			logger.debug("Could not unmarshalXMLSignature", e);
			xmlSignature = null;
		}
		if (xmlSignature == null) {
			return false;
		}
		try {
			return xmlSignature.validate(ctx);
		} catch (XMLSignatureException e) {
			logger.debug("Could not validate signature", e);
		}
		return false;
	}
544932
public function valid()
    {

        if ($this->container['orderId'] === null) {
            return false;
        }
        if ($this->container['typeId'] === null) {
            return false;
        }
        if ($this->container['regionId'] === null) {
            return false;
        }
        if ($this->container['locationId'] === null) {
            return false;
        }
        if ($this->container['range'] === null) {
            return false;
        }
        $allowedValues = $this->getRangeAllowableValues();
        if (!in_array($this->container['range'], $allowedValues)) {
            return false;
        }
        if ($this->container['isBuyOrder'] === null) {
            return false;
        }
        if ($this->container['price'] === null) {
            return false;
        }
        if ($this->container['volumeTotal'] === null) {
            return false;
        }
        if ($this->container['volumeRemain'] === null) {
            return false;
        }
        if ($this->container['issued'] === null) {
            return false;
        }
        if ($this->container['state'] === null) {
            return false;
        }
        $allowedValues = $this->getStateAllowableValues();
        if (!in_array($this->container['state'], $allowedValues)) {
            return false;
        }
        if ($this->container['minVolume'] === null) {
            return false;
        }
        if ($this->container['walletDivision'] === null) {
            return false;
        }
        if ($this->container['walletDivision'] > 7) {
            return false;
        }
        if ($this->container['walletDivision'] < 1) {
            return false;
        }
        if ($this->container['duration'] === null) {
            return false;
        }
        if ($this->container['escrow'] === null) {
            return false;
        }
        return true;
    }
386904
public function ejecutar()
    {
        // Validamos la sentencia a ejecutar
        if (empty($this->sentencia)) {
            if ($this->arrojarExcepciones) {
                throw new \InvalidArgumentException('La sentencia a ejecutar se encuentra vacia.');
            }

            return false;
        }

        // Ejecutamos la sentencia
        $resultado = $this->pdo->exec($this->sentencia);

        if ($resultado === false) {
            if ($this->arrojarExcepciones) {
                $error_info = $this->pdo->errorInfo();
                throw new Excepcion($error_info[2], [
                    'sentencia' => $this->sentencia,
                    'error_codigo' => $error_info[0],
                ], $error_info[1]);
            }

            return false;
        }

        return $resultado;
    }
324193
public function isValid()
    {
        return $this->getID() != null && $this->getURL() != null && $this->getLocalPath() != null;
    }
874416
protected function validatePathFile()
    {
        $field = 'path';
        $value = $this->getSubmitted($field);

        if ($this->isExcluded($field) || $this->isError()) {
            return null;
        }

        if (!isset($value) && $this->isUpdating()) {
            return null;
        }

        $label = $this->translation->text('File');

        if (empty($value)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        if (!is_readable(gplcart_file_absolute($value))) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        return true;
    }
236363
function valid()
    {
        list($this->_fieldId, $this->_field) = each($this->_fields);
        return $this->_fieldId !== null;
    }
71565
public function validate()
    {
        // we don't validate for empty upload fields yet
        if (empty($this->tmpFile['name'])) {
            return true;
        }

        // Check file upload
        if (!$this->isValidUpload()) {
            $this->errors[] = _t('SilverStripe\\Assets\\File.NOVALIDUPLOAD', 'File is not a valid upload');
            return false;
        }

        // Check file isn't empty
        if ($this->isFileEmpty()) {
            $this->errors[] = _t('SilverStripe\\Assets\\File.NOFILESIZE', 'Filesize is zero bytes.');
            return false;
        }

        // filesize validation
        if (!$this->isValidSize()) {
            $arg = File::format_size($this->getAllowedMaxFileSize($this->getFileExtension()));
            $this->errors[] = _t(
                'SilverStripe\\Assets\\File.TOOLARGE',
                'Filesize is too large, maximum {size} allowed',
                'Argument 1: Filesize (e.g. 1MB)',
                array('size' => $arg)
            );
            return false;
        }

        // extension validation
        if (!$this->isValidExtension()) {
            $this->errors[] = _t(
                'SilverStripe\\Assets\\File.INVALIDEXTENSION_SHORT_EXT',
                'Extension \'{extension}\' is not allowed',
                [ 'extension' => $this->getFileExtension() ]
            );
            return false;
        }

        return true;
    }