protected static function formatDebugDump ($dumpRecord, $appRoot = NULL) {
		$result = '';
		$lastDump = FALSE;
		if ($appRoot === NULL) {
			$app = static::$app ?: (static::$app = & \MvcCore\Application::GetInstance());
			$appRoot = $app->GetRequest()->GetAppRoot();
		}
		$options = $dumpRecord[2];
		$result .= '<div class="item">';
		if ($dumpRecord[1] !== NULL) 
			$result .= '<pre class="title">'.$dumpRecord[1].'</pre>';
		$file = $options['file'];
		$line = $options['line'];
		$displayedFile = str_replace('\\', '/', $file);
		if (strpos($displayedFile, $appRoot) === 0) {
			$displayedFile = substr($displayedFile, strlen($appRoot));
		}
		$link = '<a class="editor" href="editor://open/?file='
			.rawurlencode($file).'&amp;line='.$line.'">'
				.$displayedFile.':'.$line
			.'</a>';
		// make array dumps shorter
		$dump = & $dumpRecord[0];
		$dump = preg_replace("#\n(\s+)\<b\>array\</b\>\s([^\n]+)\n(\s+)(\<i\>\<font )([^\>]+)(\>empty)#m", "<b>array</b> $2 $4$5$6", $dump);
		$dump = preg_replace("#\n(\s+)\<b\>array\</b\>\s([^\n]+)\n(\s+)\.\.\.#m", "<b>array</b> $2 ...", $dump);
		$dump = preg_replace("#\n(\s+)\<b\>array\</b\>\s([^\n]+)\n#m", "<b>array</b> $2\n", $dump);
		// make object dumps shorter
		$dump = preg_replace("#(\<font color='\#)([^']+)'\>\=&gt;\</font\>\s\n\s+([^\n]+)\n\s+\.\.\.#m", "<font color='#$2'>=&gt;</font> $3 ...", $dump);
		$dump = preg_replace("#\n\s+(.*)\<b\>object\</b\>([^\n]+)\n#m", "$1<b>object</b> $2\n", $dump);
		$result .= '<div class="value">'
			.preg_replace("#\[([^\]]*)\]=>([^\n]*)\n(\s*)#", "[$1] => ",
				str_replace("<required>","&lt;required&gt;",$link.$dump)
			)
			.'</div></div>';
		if (isset($dumpRecord[2]['lastDump']) && $dumpRecord[2]['lastDump']) 
			$lastDump = TRUE;
		return [$result, $lastDump];
	}
protected static function formatDebugDump ($dumpRecord, $appRoot = NULL) {
		$result = '';
		$lastDump = FALSE;
		if ($appRoot === NULL) {
			$app = static::$app ?: (static::$app = & \MvcCore\Application::GetInstance());
			$appRoot = $app->GetRequest()->GetAppRoot();
		}
		$options = $dumpRecord[2];
		$result .= '<div class="item">';
		if ($dumpRecord[1] !== NULL) 
			$result .= '<pre class="title">'.$dumpRecord[1].'</pre>';
		$file = $options['file'];
		$line = $options['line'];
		$displayedFile = str_replace('\\', '/', $file);
		if (strpos($displayedFile, $appRoot) === 0) {
			$displayedFile = substr($displayedFile, strlen($appRoot));
		}
		$link = '<a class="editor" href="editor://open/?file='
			.rawurlencode($file).'&amp;line='.$line.'">'
				.$displayedFile.':'.$line
			.'</a>';
		// make array dumps shorter
		$dump = & $dumpRecord[0];
		$dump = preg_replace("#\n(\s+)\<b\>array\</b\>\s([^\n]+)\n(\s+)(\<i\>\<font )([^\>]+)(\>empty)#m", "<b>array</b> $2 $4$5$6", $dump);
		$dump = preg_replace("#\n(\s+)\<b\>array\</b\>\s([^\n]+)\n(\s+)\.\.\.#m", "<b>array</b> $2 ...", $dump);
		$dump = preg_replace("#\n(\s+)\<b\>array\</b\>\s([^\n]+)\n#m", "<b>array</b> $2\n", $dump);
		// make object dumps shorter
		$dump = preg_replace("#(\<font color='\#)([^']+)'\>\=&gt;\</font\>\s\n\s+([^\n]+)\n\s+\.\.\.#m", "<font color='#$2'>=&gt;</font> $3 ...", $dump);
		$dump = preg_replace("#\n\s+(.*)\<b\>object\</b\>([^\n]+)\n#m", "$1<b>object</b> $2\n", $dump);
		$result .= '<div class="value">'
			.preg_replace("#\[([^\]]*)\]=>([^\n]*)\n(\s*)#", "[$1] => ",
				str_replace("<required>","&lt;required&gt;",$link.$dump)
			)
			.'</div></div>';
		if (isset($dumpRecord[2]['lastDump']) && $dumpRecord[2]['lastDump']) 
			$lastDump = TRUE;
		return [$result, $lastDump];
	}
protected static function formatDebugDump ( $ dumpRecord , $ appRoot = NULL ) { $ result = '' ; $ lastDump = FALSE ; if ( $ appRoot === NULL ) { $ app = static :: $ app ? : ( static :: $ app = & \ MvcCore \ Application :: GetInstance ( ) ) ; $ appRoot = $ app -> GetRequest ( ) -> GetAppRoot ( ) ; } $ options = $ dumpRecord [ 2 ] ; $ result .= '<div class="item">' ; if ( $ dumpRecord [ 1 ] !== NULL ) $ result .= '<pre class="title">' . $ dumpRecord [ 1 ] . '</pre>' ; $ file = $ options [ 'file' ] ; $ line = $ options [ 'line' ] ; $ displayedFile = str_replace ( '\\' , '/' , $ file ) ; if ( strpos ( $ displayedFile , $ appRoot ) === 0 ) { $ displayedFile = substr ( $ displayedFile , strlen ( $ appRoot ) ) ; } $ link = '<a class="editor" href="editor://open/?file=' . rawurlencode ( $ file ) . '&amp;line=' . $ line . '">' . $ displayedFile . ':' . $ line . '</a>' ; // make array dumps shorter $ dump = & $ dumpRecord [ 0 ] ; $ dump = preg_replace ( "#\n(\s+)\<b\>array\</b\>\s([^\n]+)\n(\s+)(\<i\>\<font )([^\>]+)(\>empty)#m" , "<b>array</b> $2 $4$5$6" , $ dump ) ; $ dump = preg_replace ( "#\n(\s+)\<b\>array\</b\>\s([^\n]+)\n(\s+)\.\.\.#m" , "<b>array</b> $2 ..." , $ dump ) ; $ dump = preg_replace ( "#\n(\s+)\<b\>array\</b\>\s([^\n]+)\n#m" , "<b>array</b> $2\n" , $ dump ) ; // make object dumps shorter $ dump = preg_replace ( "#(\<font color='\#)([^']+)'\>\=&gt;\</font\>\s\n\s+([^\n]+)\n\s+\.\.\.#m" , "<font color='#$2'>=&gt;</font> $3 ..." , $ dump ) ; $ dump = preg_replace ( "#\n\s+(.*)\<b\>object\</b\>([^\n]+)\n#m" , "$1<b>object</b> $2\n" , $ dump ) ; $ result .= '<div class="value">' . preg_replace ( "#\[([^\]]*)\]=>([^\n]*)\n(\s*)#" , "[$1] => " , str_replace ( "<required>" , "&lt;required&gt;" , $ link . $ dump ) ) . '</div></div>' ; if ( isset ( $ dumpRecord [ 2 ] [ 'lastDump' ] ) && $ dumpRecord [ 2 ] [ 'lastDump' ] ) $ lastDump = TRUE ; return [ $ result , $ lastDump ] ; }
Format one dump record into single string with source PHP script file
link element and remove all useless new lines in PHP dumps.
@param array $dumpRecord Dump record from `self::$dumps` with items under indexes: `0` => dump string, `1` => title, `2` => options.
@param string|NULL $appRoot
@return array An array with formatted dump string and boolean about last dump before script exit.
Format one dump record into single string with source PHP script file link element and remove all useless new lines in PHP dumps .