Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

glpi / Vigilo / VigiloTest.php @ 79397eb3

History | View | Annotate | Download (632 Bytes)

1
<?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
            if (!is_a($arg, 'VigiloArg')) {
13
                    throw new \RuntimeException();
14
            }
15
            $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
}