ILIAS  release_8 Revision v8.24
class.ilXMLResultSetRow.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2
3/*
4 +-----------------------------------------------------------------------------+
5 | ILIAS open source |
6 +-----------------------------------------------------------------------------+
7 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
8 | |
9 | This program is free software; you can redistribute it and/or |
10 | modify it under the terms of the GNU General Public License |
11 | as published by the Free Software Foundation; either version 2 |
12 | of the License, or (at your option) any later version. |
13 | |
14 | This program is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | GNU General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU General Public License |
20 | along with this program; if not, write to the Free Software |
21 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22 +-----------------------------------------------------------------------------+
23*/
24
30{
32 private array $columns = [];
33
40 public function setValue($index, string $value) : void
41 {
42 $this->columns[$index] = $value;
43 }
44
48 public function getColumns() : array
49 {
50 return $this->columns;
51 }
52
56 public function setValues(array $values) : void
57 {
58 $i = 0;
59 foreach ($values as $value) {
60 $this->setValue($i++, (string) $value);
61 }
62 }
63
69 public function getValue($idx) : string
70 {
71 if (is_string($idx) && !array_key_exists($idx, $this->columns)) {
72 throw new DomainException('Invalid index given: ' . $idx);
73 }
74
75 if (is_int($idx) &&
76 ($idx < 0 || $idx >= count($this->columns))) {
77 throw new DomainException("Index too small or too large: " . $idx);
78 }
79
80 return $this->columns[$idx];
81 }
82}
Row Class for XMLResultSet.
setValues(array $values)
Set values from array.
setValue($index, string $value)
set column value
getValue($idx)
Return value for column with specified index.
$index
Definition: metadata.php:145
$i
Definition: metadata.php:41