glpi / Vigilo / VigiloTest.php @ b204adb9
History | View | Annotate | Download (632 Bytes)
1 | bef4271a | Thibault Louet | <?php
|
---|---|---|---|
2 | |||
3 | class VigiloTest extends VigiloXml |
||
4 | { |
||
5 | protected $name; |
||
6 | protected $args; |
||
7 | |||
8 | public function __construct($name, array $args = array()) |
||
9 | { |
||
10 | $new_args = array(); |
||
11 | foreach ($args as $arg) { |
||
12 | a5c9df40 | Thibault Louet | if (!is_a($arg, 'VigiloArg')) { |
13 | bef4271a | Thibault Louet | throw new \RuntimeException(); |
14 | a5c9df40 | Thibault Louet | } |
15 | bef4271a | Thibault Louet | $new_args[$arg->getName()] = $arg; |
16 | } |
||
17 | |||
18 | $this->name = $name; |
||
19 | $this->args = $new_args; |
||
20 | } |
||
21 | |||
22 | public function __toString() |
||
23 | { |
||
24 | return self::sprintf( |
||
25 | '<test name="%s">%s</test>',
|
||
26 | $this->name,
|
||
27 | $this->args
|
||
28 | ); |
||
29 | } |
||
30 | } |