Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

glpi / Vigilo / VigiloTest.php @ bef4271a

History | View | Annotate | Download (617 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
            $new_args[$arg->getName()] = $arg;
15
        }
16

    
17
        $this->name = $name;
18
        $this->args = $new_args;
19
    }
20

    
21
    public function __toString()
22
    {
23
        return self::sprintf(
24
            '<test name="%s">%s</test>',
25
            $this->name,
26
            $this->args
27
        );
28
    }
29
}
30