Created
January 24, 2009 05:06
-
-
Save ahutchings/51345 to your computer and use it in GitHub Desktop.
HTML Formatting of PHP_Codesniffer XML Results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | |
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=utf-8" /> | |
<title>PHP_CodeSniffer</title> | |
<style type="text/css"> | |
div { | |
font-family: arial; | |
font-size: 0.9em; | |
padding: 3px; | |
margin: 0 5px 7px 5px; | |
clear: both; | |
} | |
.error { | |
color: #EF3D23; | |
background: #FDF5F3; | |
border: 2px solid #EF3D23; | |
} | |
.warning { | |
background: #FFFED0; | |
border: 2px solid #F7D140; | |
display: none; | |
} | |
</style> | |
</head> | |
<body> | |
<?php | |
$xml = simplexml_load_file('phpcs.xml'); | |
foreach ($xml->file as $file) { | |
echo "<h3>".$file['name']." (".$file['errors']." errors, ".$file['warnings']." warnings)</h3>"; | |
foreach ($file->error as $error) { | |
echo "<div class='error'><b>Error</b> (line ".$error['line'].")<br />".$error."</div>\n"; | |
} | |
foreach ($file->warning as $warning) { | |
echo "<div class='warning'><b>Warning</b> (line ".$warning['line'].")<br />".$warning."</div>\n"; | |
} | |
} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment