Turn a array of columns into a comma separated identifier list suitable for being passed into a RETURNING
@param array $returning
@return string
161447
protected static function getReturningClause( QuoteInterface $quoting, array $returning = null, $table = '' )
    {
        if( $returning === null ) {
            return 'RETURNING *';
        } elseif ( $returning === array() ) {
            return '';
        } elseif( !empty( $table ) ) {
            foreach( $returning as &$value ) {
                $value = "{$table}.{$value}";
            }
        }

        return "RETURNING ". implode(
            ',',
            $returning = array_map(
                array( $quoting, 'quoteIdent' ),
                $returning
            )
        );
    }
509931
public function flatten($array, $return = array())
	{
		//loop through the multi-dimensional array flattening the array value
		foreach ($array as $key => $value) 
		{
			//flatten is array element is a value or element
			if( is_array($value) || is_object($value))
			{
				//return 
				$return = self::flatten($value, $return);

			}
			else
			{
				$return[] = $value;

			}

		}

		//set the value of the $outputElement
		$this->outputElement = $return;

		//return this self same class
		return $this;

	}
314238
public function toArray()
    {
        $returnValue = array();

        

		//sort columns:
		$this->sortColumns();

		foreach($this->rows as $rowId => $cells){
			$returnValue[$rowId] = array();

			foreach($this->columns as $columnId => $column){
				if($column->hasAdapter()){

					//fill content with adapter:
					$data = null;
					if(isset($returnValue[$rowId][$columnId])){
						$data = $returnValue[$rowId][$columnId];
					}else if(isset($cells[$columnId])){
						$data = $cells[$columnId];
					}
					$returnValue[$rowId][$columnId] = $column->getAdaptersData($rowId, $data);

				}else if(isset($cells[$columnId])){

					if($cells[$columnId] instanceof tao_helpers_grid_Grid){
						$returnValue[$rowId][$columnId] = $cells[$columnId]->toArray();
					}else{
						$returnValue[$rowId][$columnId] = $cells[$columnId];
					}

				}else{
					$returnValue[$rowId][$columnId] = null;//empty cell
				}
			}

		}
        

        return (array) $returnValue;
    }
814862
protected function where(array $where): string
	{
		if(is_array($where['column']))
		{
			$column = '(' . $this->columns($where['column'], false) . ')';

			$value = is_array($where['value']) ? '(' . $this->params($where['value']) . ')' : $this->param($where['value']);

			return $column . ' ' . $where['operator'] . ' ' . $value;
		}

		return $this->column($where['column']) . ' ' . $where['operator'] . ' ' . $this->param($where['value']);
	}
1120056
public function format(array $input)
    {
        $output = $this->formatString;

        foreach ($input as $key => $value)
        {
            if (!isset($this->map[$key])) {
                continue;
            }

            if (is_array($value)) {
                $value = implode('\n\t', $value);
            }
            $output = str_replace($this->map[$key], $value, $output);
        }

        return $output;
    }
500996
public function columns(array $columns, bool $allowAlias = false): string
	{
		$pieces = [];

		foreach($columns as $column)
		{
			$pieces[] = $this->column($column, $allowAlias);
		}

		return implode(', ', $pieces);
	}
250198
public function getColumnList($columns, $delim = ',')
    {
        $list = array();
        foreach ($columns as $col) {
            if ($col instanceof Column) {
                $col = $col->getName();
            }
            $list[] = $col;
        }

        return implode($delim, $list);
    }
1092618
public static function ArrayAsAttributes($Array) {
      $Return = '';
      foreach($Array as $Property => $Value) {
         $Return .= ' ' . $Property . '="' . $Value . '"';
      }
      return $Return;
   }
240873
protected function formatWhere(array $where) : string {
    $where_clause = '';

    foreach ($where as $column => $value) {
      $logical_operator = null;

      if (is_numeric($column) && is_array($value)) {
        $where_clause .= "`{$value[0]}` {$value[1]} :where_{$value[0]}";
      } else if (is_numeric($column) && is_string($value)) {
        $logical_operator = $value;
      } else {
        $where_clause .= "`{$column}` = :where_{$column}";
      }

      $next_value = next($where);
      $next_key = key($where);

      if ( $next_value !== false && !is_null($next_key) && (!is_numeric($next_key) || !is_string($next_value)) )  {
        $logical_operator = $logical_operator ?? '&&';

        $where_clause .= " {$logical_operator} ";
      }
    }

    return $where_clause;
  }
112838
public function formatString($input)
    {
        if (is_array($input)) {
            $input = join(', ', $input);
        }
        $output = strip_tags($input);
        $output = str_replace(array("'", "\r", "\n"), array("''", ' ', ' '), $output);
        //$output = "'" . $output . "'";
        return $output;
    }
1004918
static function createSignatureBaseFromArray($array, $returnAsArray = false) {
		$linearizedArray = self::createSignatureBaseRecursion($array);
		if ($returnAsArray) {
			return $linearizedArray;
		}
		return implode('|', $linearizedArray);
	}
557664
public function buildColumns($columns)
    {
        if (!is_array($columns)) {
            if (strpos($columns, '(') !== false) {
                return $columns;
            } else {
                $columns = preg_split('/\s*,\s*/', $columns, -1, PREG_SPLIT_NO_EMPTY);
            }
        }
        foreach ($columns as $i => $column) {
            if ($column instanceof Expression) {
                $columns[$i] = $column->expression;
            } elseif (strpos($column, '(') === false) {
                $columns[$i] = $this->db->quoteColumnName($column);
            }
        }

        return is_array($columns) ? implode(', ', $columns) : $columns;
    }
1320113
public function processColumnListing($results)
    {
        return array_values(array_map(function ($result)
        {
            $result = (object) $result;

            return $result->column_name;

        }, $results));
    }
1006459
protected function normalizeColumn(string $input): string
    {
        if ($this->columnHasAlias($input)) {
            list($rawColumn, $rawAlias) = explode('AS', $input);
        } else {
            $rawColumn = $input;
            $rawAlias = '';
        }

        $column = $this->getQuotedName(trim($rawColumn));

        return empty($rawAlias) ?
            $column :
            $this->columnAs($column, $this->getQuotedName(trim($rawAlias)));
    }
905450
public static function ColumnGroup()
	{
		$code	= "";
		$cols	= array();
		$args	= func_get_args( );
		if( is_array( $args[0] ) )
			$args	= $args[0];
		if( preg_match( "@,@", $args[0] ) )
			$args	= explode( ",", $args[0] );
		if( sizeof( $args ) )
		{
			foreach( $args as $arg )
				$cols[] = "<col width=\"".$arg."\"/>";
			$cols	= implode( "", $cols );
			$code	= "<colgroup>".$cols."</colgroup>";
		}
		return $code;	
	}
1328423
protected function implodeArrayToAString(array $input)
    {
        $output = implode(', ', array_map(
            function ($v, $k) {
                if (is_array($v)) {
                    return $k.'[]='.implode('&'.$k.'[]=', $v);
                } else {
                    return $k.'='.$v;
                }
            },
            $input,
            array_keys($input)
        ));

        return $output;
    }
518901
public function formatTableOptions(array $options) {
        $output = [];

        foreach ($this->formatAttributes($options) as $key => $value) {
            if ($this->hasClause($key)) {
                $option = sprintf($this->getClause($key), $value);

            } else {
                $option = $this->getKeyword($key);

                if ($value !== true) {
                    $option .= ' ' . $value;
                }
            }

            $output[] = $option;
        }

        return implode(' ', $output);
    }