Merge remote-tracking branch 'upstream/4.4' into 4.4-4.5-2014-09-29-13-10-47
[civicrm-core.git] / Civi / CiUtil / ComparisonPrinter.php
1 <?php
2 namespace Civi\CiUtil;
3
4 class ComparisonPrinter {
5 var $headers;
6 var $hasHeader = FALSE;
7
8 function __construct($headers) {
9 $this->headers = $headers;
10 }
11
12 function printHeader() {
13 if ($this->hasHeader) {
14 return;
15 }
16
17 ## LEGEND
18 print "LEGEND\n";
19 $i = 1;
20 foreach ($this->headers as $header) {
21 printf("% 2d: %s\n", $i, $header);
22 $i++;
23 }
24 print "\n";
25
26 ## HEADER
27 printf("%-90s ", 'TEST NAME');
28 $i = 1;
29 foreach ($this->headers as $header) {
30 printf("%-10d ", $i);
31 $i++;
32 }
33 print "\n";
34
35 $this->hasHeader = TRUE;
36 }
37
38 function printRow($test, $values) {
39 $this->printHeader();
40 printf("%-90s ", $test);
41 foreach ($values as $value) {
42 printf("%-10s ", $value);
43 }
44 print "\n";
45 }
46 }