summaryrefslogtreecommitdiffstats
path: root/lib/kolab_client_api_result.php
blob: 51410262700271946ed210d2841c40b4bef05573 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php

class kolab_client_api_result
{
    /**
     * @var array
     */
    private $data = array();

    private $error_code;
    private $error_str;


    public function __construct($data = array(), $error_code = null, $error_str = null)
    {
        if (is_array($data) && isset($data['result'])) {
            $this->data = $data['result'];
        }

        $this->error_code = $error_code;
        $this->error_str = $error_str;
    }

    public function get_error_code()
    {
        return $this->error_code;
    }

    public function get_error_str()
    {
        return $this->error_str;
    }

    public function get($name = null)
    {
        if ($name !== null) {
            return isset($this->data[$name]) ? $this->data[$name] : null;
        }

        return $this->data;
    }
}