src/Thybag/Service/QueryObjectService.php
private function addQueryLine ($rel, $col, $test, $value) {
		// Check tests are usable
		if (!in_array($test, array('!=', '>=', '<=', '<', '>', '=', 'like'))) {
			throw new \Exception('Unrecognized query parameter. Please use <,>,=,>=,<=, != or like');
		}

		// Make sure $rel is lower-case
		$rel = strtolower($rel);

		$test = str_replace(array('!=', '>=', '<=', '<', '>', '=', 'like'), array('Neq', 'Geq', 'Leq', 'Lt', 'Gt', 'Eq', 'Contains'), $test);

		// Create caml
		$caml = $this->where_caml;
		$content = '<FieldRef Name="' . $col . '" /><Value Type="Text">' . htmlspecialchars($value) . '</Value>' . PHP_EOL;
		$caml .= '<' . $test . '>' . $content . '</' . $test . '>';

		// Attach relations
		if ($rel == 'and') {
			$this->where_caml = '<And>' . $caml . '</And>';
		} elseif ($rel == 'or') {
			$this->where_caml = '<Or>' . $caml . '</Or>';
		} elseif ($rel == 'where') {
			$this->where_caml = $caml;
		}

		// return self
		return $this;
	}
private function addQueryLine ($rel, $col, $test, $value) {
		// Check tests are usable
		if (!in_array($test, array('!=', '>=', '<=', '<', '>', '=', 'like'))) {
			throw new \Exception('Unrecognized query parameter. Please use <,>,=,>=,<=, != or like');
		}

		// Make sure $rel is lower-case
		$rel = strtolower($rel);

		$test = str_replace(array('!=', '>=', '<=', '<', '>', '=', 'like'), array('Neq', 'Geq', 'Leq', 'Lt', 'Gt', 'Eq', 'Contains'), $test);

		// Create caml
		$caml = $this->where_caml;
		$content = '<FieldRef Name="' . $col . '" /><Value Type="Text">' . htmlspecialchars($value) . '</Value>' . PHP_EOL;
		$caml .= '<' . $test . '>' . $content . '</' . $test . '>';

		// Attach relations
		if ($rel == 'and') {
			$this->where_caml = '<And>' . $caml . '</And>';
		} elseif ($rel == 'or') {
			$this->where_caml = '<Or>' . $caml . '</Or>';
		} elseif ($rel == 'where') {
			$this->where_caml = $caml;
		}

		// return self
		return $this;
	}
private function addQueryLine ( $ rel , $ col , $ test , $ value ) { // Check tests are usable if ( ! in_array ( $ test , array ( '!=' , '>=' , '<=' , '<' , '>' , '=' , 'like' ) ) ) { throw new \ Exception ( 'Unrecognized query parameter. Please use <,>,=,>=,<=, != or like' ) ; } // Make sure $rel is lower-case $ rel = strtolower ( $ rel ) ; $ test = str_replace ( array ( '!=' , '>=' , '<=' , '<' , '>' , '=' , 'like' ) , array ( 'Neq' , 'Geq' , 'Leq' , 'Lt' , 'Gt' , 'Eq' , 'Contains' ) , $ test ) ; // Create caml $ caml = $ this -> where_caml ; $ content = '<FieldRef Name="' . $ col . '" /><Value Type="Text">' . htmlspecialchars ( $ value ) . '</Value>' . PHP_EOL ; $ caml .= '<' . $ test . '>' . $ content . '</' . $ test . '>' ; // Attach relations if ( $ rel == 'and' ) { $ this -> where_caml = '<And>' . $ caml . '</And>' ; } elseif ( $ rel == 'or' ) { $ this -> where_caml = '<Or>' . $ caml . '</Or>' ; } elseif ( $ rel == 'where' ) { $ this -> where_caml = $ caml ; } // return self return $ this ; }
addQueryLine
Generate CAML for where statements

@param	$rel	Relation AND/OR etc
@param	$col	column to test
@param	$test	comparison type (=,!+,<,>,like)
@param	$value	value to test with
@return	Ref to self
@throws	\Exception	Thrown if $test is unrecognized
addQueryLine Generate CAML for where statements