Checks if given file data is valid FidaVista/XML bank statement
@param string $statement file contents that need to be checked
@return boolean
509537
public static function isFidaVista($statement) {

        $result = false;
        $domDocument = new \DOMDocument();
        libxml_use_internal_errors(true);
        
        try {
            //$domDocument->loadXML($statement);
            if ($domDocument->loadXML($statement) == true) {
                $node = $domDocument->childNodes->item(0);
                
                if ($node->nodeName === 'FIDAVISTA') {
                    $result = true;
                }
            }
        } catch (Exception $exc) {
            $result = false;
        } finally {
            unset($domDocument);
        }
        
        return $result;
    }
469426
public function validateXMLStructure() {

        // Create and load XML file
        $parser = new DOMDocument();
        $contents = file_get_contents($this->path);
        if (strpos($contents, '<STATEMENTS>')) {
            //delete the removed STATEMENTS section, it would not validate
            $contents = preg_replace('|<STATEMENTS>.*</STATEMENTS>|s', '', $contents);
        }

        // Let's capture errors
        $olderrormode = libxml_use_internal_errors(true);

        // Clear XML error flag so that we don't incorrectly report failure
        // when a previous xml parse failed
        libxml_clear_errors();

        $parser->loadXML($contents);
        // Only validate if we have a schema
        if (!empty($this->schema) && file_exists($this->schema)) {
            $parser->schemaValidate($this->schema);
        }
        // Check for errors
        $errors = libxml_get_errors();

        // Stop capturing errors
        libxml_use_internal_errors($olderrormode);

        // Prepare errors
        if (!empty($errors)) {
            // Create one structure to store errors
            $structure = new xmldb_structure($this->path);
            // Add errors to structure
            $structure->errormsg = 'XML Error: ';
            foreach ($errors as $error) {
                $structure->errormsg .= sprintf("%s at line %d. ",
                                                 trim($error->message, "\n\r\t ."),
                                                 $error->line);
            }
            // Add structure to file
            $this->xmldb_structure = $structure;
            // Check has failed
            return false;
        }

        return true;
    }
857232
public function parse_query(string $statement): ?array
  {
    if ( $this->parser === null ){
      $this->parser = new \PHPSQLParser\PHPSQLParser();
    }
    try {
      $r = $this->parser->parse($statement);
      if ( !count($r) ){
        return null;
      }
      if ( isset($r['BRACKET']) && (\count($r) === 1) ){
        return null;
      }
      return $r;
    }
    catch ( \Exception $e ){
      $this->log('Impossible to parse the query '.$statement);
    }
    return null;
  }
1085852
public function isValid($value, $file = null)
    {
        $directories = $this->getDirectory(true);
        if (($file !== null) and (!empty($file['destination']))) {
            $directories[] = $file['destination'];
        } else if (!isset($file['name'])) {
            $file['name'] = $value;
        }

        foreach ($directories as $directory) {
            if (empty($directory)) {
                continue;
            }

            $check = true;
            if (file_exists($directory . DIRECTORY_SEPARATOR . $file['name'])) {
                $this->_throw($file, self::DOES_EXIST);
                return false; 
            }
        }

        if (!isset($check)) {
            $this->_throw($file, self::DOES_EXIST);
            return false; 
        }

        return true;
    }
545715
public function remove( $statement, EditInfo $editInfo = null ) {
		if( is_string( $statement ) ) {
			$guid = $statement;
		} else if ( $statement instanceof StatementGuid ) {
			$guid = $statement->getSerialization();
		} else if ( $statement instanceof Statement ) {
			$guid = $statement->getGuid();
		} else {
			throw new UnexpectedValueException( 'Could not get statement guid from $statement' );
		}
		if( !is_string( $guid ) ) {
			throw new UnexpectedValueException( 'Unexpected statement guid got from $statement' );
		}

		$params = array(
			'claim' => $guid,
		);

		$this->api->postRequest( 'wbremoveclaims', $params, $editInfo );
		return true;
	}
1027671
protected static function makeStatement($statement)
    {
        $self  = self::getInstance();

        $optionWhere = (!empty($self->optionWhere)) ? " WHERE ". substr(implode("", $self->optionWhere), 4) : null;
        $optionJoin  = implode("", $self->optionJoin);
        $optionOrder = $self->optionOrder;
        $optionLimit = $self->optionLimit;

        return $statement.$optionJoin.$optionWhere.$optionOrder.$optionLimit;
    }
186130
public function query($statement) {
		try {
			$stmt = $this->pdo->query($statement);
			return new QueryResult($stmt, $this->pdo);
		} catch (PDOException $e) {
			throw $this->exceptionAdapter->adapt($e, $statement);
		}
	}
623891
private function _checkdatabase($database)
    {

        if (count($this->_collection) == 0) {
            $this->_collection[$database] = new $database();

            return $this->_collection[$database];
        }

        $new = false;
        foreach ($this->_collection as $db) {
            if ($db === $database) continue;
            $new = true;
        }

        if ($new === true) {
            $this->_collection[$database] = new $database();
        }

        return false;
    }
927530
private static function isValidUriQuery(?string $query): bool
    {
        if ($query === null || $query === '') {
            return true;
        }

        // http://tools.ietf.org/html/rfc3986#section-3.4
        // query = *( pchar / "/" / "?" )
        // pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
        $pattern = sprintf(
            '/\A(?:[%s%s\/?:@]|(?:%s))*\z/i',
            'a-z0-9\-._~',
            '!$&\'()*+,;=',
            '%[a-f0-9]{2}'
        );

        return !!preg_match($pattern, $query);
    }
742248
protected function logStatement( $statement ){
		if( !$this->logFileStatements )
			return;
		$statement	= preg_replace( "@(\r)?\n@", " ", $statement );
		$message	= time()." ".getEnv( 'REMOTE_ADDR' )." ".$statement."\n";
		error_log( $message, 3, $this->logFileStatements);
	}
87618
public static function isFileEmpty($file)
    {
        if (!is_file($file)) {
            throw new RuntimeException(sprintf('Invalid file path supplied'));
        }

        return mb_strlen(file_get_contents($file, 2), 'UTF-8') > 0 ? false : true;
    }
241010
private function validateExecutable($file)
    {
        if (!file_exists($file) || !is_executable($file)) {
            throw new InvalidExecutableException(sprintf('File does not exist or is not executable: %s', $file));
        }

        return true;
    }
401211
private static function isEndQuote($statement)
    {
        $trimmed = Multibyte::trim($statement);
        $first = mb_substr($statement, 0, 1);

        return in_array($trimmed, ['"', '\''])
            || (
                in_array($first, ['"', '\''])
                && mb_substr($statement, 1, 1) === ' '
                && ctype_lower(mb_substr($statement, 2, 1)) === true
            );
    }
832624
public static function is_valid_preset($xml) {
        $dom = new DOMDocument();
        if (!$dom->loadXML($xml)) {
            return false;
        } else {
            $val = @$dom->schemaValidate(__DIR__.'/../role_schema.xml');
            if (!$val) {
                return false;
            }
        }
        return true;
    }
853660
protected function getStatement($statement)
    {
        $key = $this->getStatementKey($statement);
    	$sth = null;
    	
    	if (!empty($this->statements[$key])){
    		$sth = $this->statements[$key];
    	}
    	else{
    		$sth = $this->dbConnector->prepare($statement);
    		$this->statements[$key] = $sth;
    	}
    	
    	return $sth;

    }
1288792
public function isRequestValid(TransactionInterface $transaction)
    {
        $checkUrl = $transaction->get('check');

        $checkPrivate = $this->generateUrlCheck($transaction->getOrder());

        return $checkUrl === $checkPrivate;
    }
1353398
public function exec($statement) {
		$ociPdoStatement = $this->query($statement);
		$count = $ociPdoStatement->rowCount();
		$ociPdoStatement->closeCursor();

		return $count;
	}