ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
RISWriter.php
Go to the documentation of this file.
1<?php
2namespace LibRIS;
3
19class RISWriter {
20
21 public function __construct() {}
22
31 public function writeRecords($records) {
32 $buffer = array();
33 foreach ($records as $record) {
34 $buffer[] = $this->writeRecord($record);
35 }
36 return implode(RISReader::RIS_EOL, $buffer);
37 }
38
49 public function writeRecord($tags) {
50 $buffer = array();
51 $fmt = '%s - %s';
52
53 $buffer[] = sprintf($fmt, 'TY', $tags['TY'][0]);
54 unset($tags['TY']);
55
56 foreach ($tags as $tag => $values) {
57 foreach ($values as $value) {
58 $buffer[] = sprintf($fmt, $tag, $value);
59 }
60 }
61 $buffer[] = 'ER - ';
62
63 return implode(RISReader::RIS_EOL, $buffer);
64 }
65
66}
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
Class for writing RIS data.
Definition: RISWriter.php:19
writeRecords($records)
Write a series of records to a single RIS string.
Definition: RISWriter.php:31
writeRecord($tags)
Write a single record as an RIS string.
Definition: RISWriter.php:49
This is a library for parsing RIS files.
$records
Definition: simple_test.php:22