Returns the query portion as a string or array

@param 	$toArray    boolean	    If TRUE return an array. Default FALSE
@return  string|array    The query string; e.g., `foo=bar&baz=dib`.
432845
public function getQuery($toArray = false)
    {
        $result = $toArray ? $this->_query : http_build_query($this->_query, '', '&');
        return $result;
    }
1034433
private function parseDeepCondition(array $parameters, $toArray = FALSE)
	{
		$opcond = [];

		foreach ($parameters as $key => $param) {
			$ccond = is_int($key) ? $this->parseCondition($param) : $this->parseCondition($key, $param);

			if ($toArray) {
				$opcond[] = $ccond;
			} else {
				reset($ccond);
				$opcond[key($ccond)] = current($ccond);
			}
		}

		return $opcond;
	}
100704
public static function array_to_object($arr)
    {
        if (gettype($arr) != 'array') {
            return $arr;
        }
        foreach ($arr as $k => $v) {
            if (gettype($v) == 'array' || getType($v) == 'object') {
                $arr[$k] = self::array_to_object($v);
            }
        }
        return (object)$arr;
    }
1074498
function toArray()
    {
        $parse = array(
            'scheme'    => $this->getScheme(),
            'user_info' => $this->getUserInfo(),
            'host'      => $this->getHost(),
            'port'      => $this->getPort(),
            'path'      => $this->getPath(),
            'query'     => $this->getQuery()->toString(),
            'fragment'  => $this->getFragment(),
            
            'authority' => $this->getAuthority(),
        );

        return $parse;
    }
932111
private function parseQuery($query)
	{
		$string = '';
		if (is_array($query))
		{
			foreach ($query as $index => $value)
			{
				$string .= !empty($string) ? ' AND ' : '';
				$string .= $index . ':' . $value;
			}
		}
		else
		{
			$string = 'id:' . $query;
		}
		return $string;
	}
332692
protected function getArrayInternal()
    {
        if ($this->isArray($this->resource)) {
            return $this->resource;
        }

        return $this->parseJsonString($this->resource);
    }
1364692
public function __tostring ()
    {
        if (is_null($this->queryElements))
        {
            return "";
        }

        $query = [];

        foreach ($this->queryElements as $soqlKey => $value)
        {
            $value = (is_array($value)) ? implode(self::DELIMITER, $value) : $value;

            $query[] = sprintf("%s=%s", $soqlKey, $value);
        }

        return implode("&", $query);
    }
620830
public function query($array)
	{
		$array['action'] = 'query';
		$array['format'] = 'php';

		$apiResult = $this->session->get($this->api.'?'.http_build_query($array));

		return unserialize($apiResult->body);
	}
981566
public function buildQueryString($args = array()) {
		$args = array_merge($args, array("token" => $this->token));
		
		$query = "";
		if (isset($args)) {
			while (list($key, $val) = each($args)) {
				if ( strlen($query) > 0 ) {
					$query .= "&";
				} else {
					$query .= "?";
				}
				$query .= $key . '=' . $val;
			}
		}
		return $query;
	}
315339
private function makeQueryString($query = array())
	{
		$subject = $query[0];
		$operator = $query[1];
		$operand = $query[2];

		switch ($operator)
		{
			case '=':
				$string = $subject . ':' . $operand;
			break;
		}

		return $string;
	}
617940
public function toQuery() : array
	{
		$array = [];

		foreach (get_object_vars($this) as $name => $value)
		{
			if (null === $value)
			{
				continue;
			}

			if (is_array($value))
			{
				if (count($value))
				{
					foreach ($value as $v)
					{
						$array[] = [
							'name'     => $name . '[]',
							'contents' => $v
						];
					}
				}
			}
			else
			{
				$array[] = [
					'name'     => $name,
					'contents' => $value
				];
			}
		}

		return $array;
	}
804455
public function toArray($is_numeric_index = true ,$itemToArray = false)
    {

        $array = array();
        foreach ($this->_items as $item) {
            if (!$is_numeric_index) {
                $id = (string) $item->getId();
                if ($itemToArray) {
                    $item = $item->toArray();
                }
                $array[$id] = $item;
            } else {
                if ($itemToArray) {
                    $item = $item->toArray();
                }
                $array[] = $item;
            }
        }

        return $array;

    }
635606
public function getPath($toArray = false)
    {
        $result = $toArray ? $this->_path : $this->_pathEncode($this->_path);
        return $result;
    }
1356222
public function processFilter($toArray = true)
    {
        if ($this->builder) {
            call_user_func($this->builder, $this);
        }

        return $this->filter->execute($toArray);
    }
1287604
public function getSqlWhereBoth($toApps)
    {
        $appWheres = array();
        $epiWheres = array();

        foreach ($this->_subFilters as $filterObject) {
            if ($filterObject instanceof AppointmentFilterInterface) {
                $toApp = $filterObject->preferAppointmentSql();

                if ($toApp) {
                    $where = $filterObject->getSqlAppointmentsWhere();
                } else {
                    $where = $filterObject->getSqlEpisodeWhere();
                }
                if ($where == parent::MATCH_ALL_SQL) {
                    return parent::MATCH_ALL_SQL;
                } elseif ($where !== parent::NO_MATCH_SQL) {
                    if ($toApp) {
                        $appWheres[] = $where;
                    } else {
                        $epiWheres[] = $where;
                    }
                }
            }
        }

        if ($toApps) {
            $wheres = $appWheres;

            if ($epiWheres) {
                $wheres[] = sprintf(
                        "gap_id_episode IN (SELECT gec_episode_of_care_id FROM gems__episodes_of_care WHERE %s)",
                        implode($this->glue, $epiWheres)
                        );
            }
        } else {
            $wheres = $epiWheres;

            if ($appWheres) {
                $wheres[] = sprintf(
                        "gec_episode_of_care_id IN (SELECT gap_id_episode FROM gems__appointments WHERE %s)",
                        implode($this->glue, $appWheres)
                        );
            }
        }

        if ($wheres) {
            if (1 == count($wheres)) {
                return reset($wheres);
            }
            return '(' . implode($this->glue, $wheres) . ')';
        } else {
            return parent::NO_MATCH_SQL;
        }
    }
1230661
public function to_query_string($array)
	{
		$temp = array();

		foreach ($array as $key => $value)
		{
			if (is_string($key) && !is_array($value))
			{
				$temp[] = rawurlencode($key) . '=' . rawurlencode($value);
			}
		}

		return implode('&', $temp);
	}
282801
private function getReplacementString($from, $to)
    {
        if (is_array($from) && is_array($to)) {
            if (count($from) == count($to)) {
                $sedStrings = [];
                $fromSize = count($from);
                for ($i = 0; $i < $fromSize; $i++) {
                    $sedStrings[] = $this->getReplacementCommand($from[$i], $to[$i]);
                }
                return implode(';', $sedStrings);
            } else {
                throw new InvalidArgumentException("Number of items in 'fromText' (" . count($from) . ") is different to 'toText' (" . count($to) . ")");
            }
        } elseif (is_array($from) || is_array($to)) {
            throw new InvalidArgumentException("Only one of fromText or toText is an array, both should be arrays or string");
        } else {
            return $this->getReplacementCommand($from, $to);
        }
    }