INFRA-132 - CRM/Widget - Convert single-line @param to multi-line
[civicrm-core.git] / Civi / CiUtil / CSVParser.php
CommitLineData
1ea1fd20
TO
1<?php
2namespace Civi\CiUtil;
3
4/**
5 * Parse phpunit result files
6 */
7class CSVParser {
8
9 /**
10 * @param string $csvContent content; each row in the row csv should start with two cells:
11 * - cell 0: the test name
12 * - cell 1: the test status
13 * @return array (string $testName => string $status)
14 */
15 public static function parseResults($csvContent) {
16 $fh = fopen('php://memory', 'r+');
17 fwrite($fh, $csvContent);
18 rewind($fh);
19
20 $results = array();
21 while (($r = fgetcsv($fh)) !== FALSE) {
22 $name = str_replace('.', '::', trim($r[0]));
23 $status = trim($r[1]);
24 $results[$name] = $status;
25 }
26
27 return $results;
28 }
29
ef10e0b5 30}