Format all dump records into single string with source PHP script file
link element and remove all useless new lines in PHP dumps.
@return array An array with formatted dumps string and boolean about last dump before script exit.
17450
protected static function formatDebugDumps () {
		$dumps = '';
		$lastDump = FALSE;
		$app = static::$app ?: (static::$app = & \MvcCore\Application::GetInstance());
		$appRoot = $app->GetRequest()->GetAppRoot();
		foreach (self::$dumps as $values) {
			list($dumpResult, $lastDumpLocal) = self::formatDebugDump($values, $appRoot);
			$dumps .= $dumpResult;
			if ($lastDumpLocal) $lastDump = $lastDumpLocal;
		}
		return [$dumps, $lastDump];
	}
222414
public function dump()
    {
        $dump = [];
        if ($this->hasParameters()) {
            foreach ($this->parameters as $parameter) {
                $dump[$parameter->getName()] = $parameter->dump();
            }
        }
        return $dump;
    }
1292362
public function dump() {
		$s = $this->serializeNode( $this->root, $this->root, false );
		return substr( $s, 2, -3 ) . "\n";
	}
6113
public function dump() {
		$prev = null;
		$s = '';
		for ( $node = $this->head; $node; $prev = $node, $node = $node->nextAFE ) {
			if ( $node instanceof Marker ) {
				$s .= "MARKER\n";
				continue;
			}
			$s .= $node->getDebugTag();
			if ( $node->nextNoah ) {
				$s .= " (noah sibling: " . $node->nextNoah->getDebugTag() .
					')';
			}
			if ( $node->nextAFE && $node->nextAFE->prevAFE !== $node ) {
				$s .= " (reverse link is wrong!)";
			}
			$s .= "\n";
		}
		if ( $prev !== $this->tail ) {
			$s .= "(tail pointer is wrong!)\n";
		}
		return $s;
	}
1357705
public function toString()
    {
        $array  = array();
        $escape = Driver::$escape_char;

        array_push($array, $this->prefix." ");

        if (is_null($this->fields)) {
            array_push($array, $escape.$this->table.$escape.".* ");
        } else {
            array_push($array, $this->fields);
        }

        array_push($array, " from $escape".$this->table."$escape ");

        if ($this->where) {
            array_push($array, " where ".$this->where);
        }

        if ($this->order) {
            array_push($array, " order by ".$this->order);
        }

        if (!is_null($this->limit) && is_null($this->offset) && Driver::$limit_behaviour == Driver::LIMIT_APPEND) {
            array_push($array, " limit ".$this->limit);
        }

        // basic query
        $query = join(" ", $array);

        if (!is_null($this->limit) && is_null($this->offset) 
            && Driver::$limit_behaviour==Driver::LIMIT_AROUND
            && Driver::$limit_query
        ) {
            $query = str_replace("%query%", $query, Driver::$limit_query);
            $query = str_replace("%limit%", $this->limit, $query);
        }

        if (!is_null($this->limit) && !is_null($this->offset) && Driver::$pagination_query) {
            $query = str_replace("%query%", $query, Driver::$pagination_query);
            $query = str_replace("%from%",  $this->offset, $query);
            $query = str_replace("%to%",    $this->limit, $query);
        }
        return $query;
    }
1239128
protected function formatBoth()
    {
        $data = [];
        $index = 0;

        foreach ($this->getData() as $key => $value) {
            $data[$key] = $value;
            $data[$index] = $value;
            $index++;
        }

        return $data;
    }
544873
public function dump()
    {
        if ($this->hasChildren()) {
            $dump = [];
            foreach ($this->children as $child) {
                $dump[$child->getName()] = $child->dump();
            }
        } elseif (count($this->getValues()) === 1 && (!$this->hasTemplate() || !$this->getTemplate()->multiple_values)) {
            $dump = $this->values[0];
        } else {
            $dump = $this->values;
        }
        return $dump;
    }
867328
public function toString()
    {
        $query = '';

        if ($this->sql) {
            return $this->sql;
        }

        switch ($this->type) {
            case 'element':
                $query .= (string) $this->element;
                break;

            case 'select':
                $query .= (string) $this->select;
                $query .= (string) $this->from;

                if ($this->join) {
                    // Special case for joins
                    foreach ($this->join as $join) {
                        $query .= (string) $join;
                    }
                }

                if ($this->where) {
                    $query .= (string) $this->where;
                }

                if ($this->group) {
                    $query .= (string) $this->group;
                }

                if ($this->having) {
                    $query .= (string) $this->having;
                }

                if ($this->order) {
                    $query .= (string) $this->order;
                }

                break;

            case 'union':
                $query .= (string) $this->union;
                break;

            case 'delete':
                $query .= (string) $this->delete;
                $query .= (string) $this->from;

                if ($this->join) {
                    // Special case for joins
                    foreach ($this->join as $join) {
                        $query .= (string) $join;
                    }
                }

                if ($this->where) {
                    $query .= (string) $this->where;
                }

                break;

            case 'update':
                $query .= (string) $this->update;

                if ($this->join) {
                    // Special case for joins
                    foreach ($this->join as $join) {
                        $query .= (string) $join;
                    }
                }

                $query .= (string) $this->set;

                if ($this->where) {
                    $query .= (string) $this->where;
                }

                break;

            case 'insert':
                $query .= (string) $this->insert;

                // Set method
                if ($this->set) {
                    $query .= (string) $this->set;
                } elseif ($this->values) {
                    // Columns-Values method
                    if ($this->columns) {
                        $query .= (string) $this->columns;
                    }

                    $elements = $this->values->getElements();

                    if (!($elements[0] instanceof $this)) {
                        $query .= ' VALUES ';
                    }

                    $query .= (string) $this->values;
                }

                break;

            case 'call':
                $query .= (string) $this->call;
                break;

            case 'exec':
                $query .= (string) $this->exec;
                break;
        }

        // Process Limit
        $query = $this->processLimit($query, $this->limit, $this->offset);

        if ($this->suffix) {
            $query .= ' ' . (string) $this->suffix;
        }

        if ($this->type === 'select' && $this->alias !== null) {
            $query = sprintf('(%s) AS %s', $query, $this->alias);
        }

        return $query;
    }
1144201
public function outputAr()
    {
        $aOut = [];

        foreach ($this->aEntries as $aEntry) {

            $sTemp = !empty($aEntry['tag']) ? '<' . $aEntry['tag'] . ' ' : '<meta ';
            unset($aEntry['tag']);
            foreach ($aEntry as $sKey => $sValue) {

                $sTemp .= $sKey . '="' . $sValue . '" ';
            }
            $sTemp  = trim($sTemp) . '>';
            $aOut[] = $sTemp;
        }

        return $aOut;
    }
356957
public function dumpParameters()
    {
        $parameters = [];

        foreach ($this->parameters as $parameterName => $parameterValue) {
            $parameters[$parameterName] = [
                'value'      => $parameterValue
            ];
        }

        return $parameters;
    }
712887
public function dump() {
		$s = '';
		for ( $i = 0; $i < $this->length(); $i++ ) {
			$item = $this->item( $i );
			$s .= "$i. " . $item->getDebugTag();
			if ( $i === $this->length() - 1 && $item !== $this->current ) {
				$s .= " CURRENT POINTER INCORRECT";
			}
			$s .= "\n";
		}
		return $s;
	}
813210
public function dump()
	{
		$tables   = App::get('db')->getTableList();
		$prefix   = App::get('db')->getPrefix();
		$excludes = [];
		$now      = new Date;
		$exclude  = '';
		$includes = (array)$this->arguments->getOpt('include-table', []);

		if (!$this->arguments->getOpt('all-tables'))
		{
			$this->output->addLine('Dumping database with all prefixed tables included');
			foreach ($tables as $table)
			{
				if (strpos($table, $prefix) !== 0 && !in_array(str_replace('#__', $prefix, $table), $includes))
				{
					$excludes[] = Config::get('db') . '.' . $table;
				}
				elseif (in_array(str_replace('#__', $prefix, $table), $includes))
				{
					$this->output->addLine('Also including `' . $table . '`');
				}
			}

			// Build exclude list string
			$exclude = '--ignore-table=' . implode(' --ignore-table=', $excludes);
		}
		else
		{
			$this->output->addLine('Dumping database with all tables included');
		}

		// Add save location option

		$home     = getenv('HOME');
		$hostname = gethostname();
		$filename = tempnam($home, "{$hostname}.mysql.dump." . $now->format('Y.m.d') . ".sql.");

		// Build command
		$cmd = "mysqldump -u " . Config::get('user') . " -p'" . Config::get('password') . "' " . Config::get('db') . " --routines {$exclude} > {$filename}";

		exec($cmd);

		// Print out location of file
		$this->output->addLine('File saved to: ' . $filename, 'success');
	}
626373
public function dump()
    {
        $isFirst = $this->dumpFlag('first', $this->isFirst());
        $isCurrent = $this->dumpFlag('current', $this->isCurrent());
        $isPrevious = $this->dumpFlag('prev', $this->isPrevious());
        $isNext = $this->dumpFlag('next', $this->isNext());
        $isLast = $this->dumpFlag('last', $this->isLast());

        $number = str_pad((string)$this->number(), 10, ' ', STR_PAD_LEFT);

        $flags = "$isCurrent|$isFirst|$isLast|$isPrevious|$isNext";

        $string = str_pad("'$this'", 10, ' ', STR_PAD_LEFT);

        $offset = str_pad((string)$this->getOffset(), 20, ' ', STR_PAD_LEFT);

        return "Page #$number $string offset:$offset flags:$flags";
    }
267438
public function dumpParameters()
    {
        $parameters = [];
        foreach ($this->getParameters() as $parameter) {
            $string = '';
            if ($parameter->isArray()) {
                $string .= 'array ';
            } elseif ($parameter->getClass()) {
                $string .= $parameter->getClass()->name.' ';
            }
            if ($parameter->isPassedByReference()) {
                $string .= '&';
            }
            $string .= '$'.$parameter->name;
            if ($parameter->isOptional()) {
                $string .= ' = '.var_export($parameter->getDefaultValue(), true);
            }
            $parameters[] = $string;
        }

        return '('.implode(', ', $parameters).')';
    }
868248
protected function getFormatOptionsFromPost()
    {
        $presetMode = post('format_preset');

        $options = [
            'delimiter' => null,
            'enclosure' => null,
            'escape' => null,
            'encoding' => null
        ];

        if ($presetMode == 'custom') {
            $options['delimiter'] = post('format_delimiter');
            $options['enclosure'] = post('format_enclosure');
            $options['escape'] = post('format_escape');
            $options['encoding'] = post('format_encoding');
        }

        return $options;
    }
550249
public function toString()
    {
        $params = $this->toArray();
        $filename = $params['filename'];
        $extension = $params['extension'];
        unset($params['filename'], $params['extension']);

        ksort($params);
        $mapping = array_flip($this->argMapping);
        $defaults = $this->argDefaults;

        $nameArray = array();
        foreach($params as $key => $value){
            //remove value if as same as default setting
            if($value !== null && $value !== $defaults[$key]){
                $nameArray[$mapping[$key]] = $mapping[$key] . '_' . $value;
            }
        }
        $nameArray = $nameArray ? ',' . implode(',', $nameArray) : '';
        return $filename . $nameArray . '.' . $extension;
    }
1040582
public function dumpTokens() {
		$result = "";
		foreach ($this->tokens as $token) {
			$result .= $token->toString() . PHP_EOL;
		}
		return $result;
	}