summaryrefslogtreecommitdiffstats
path: root/admin/survey/minify/vendor/mrclay/props-dic/src/Props/Pimple.php
blob: a3b1abfb01284d4bc98eaf7929b0835d51caa540 (plain) (blame)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php

namespace Props;

/**
 * A version of Pimple that uses property access instead of array access
 *
 * @author Steve Clay <steve@mrclay.org>
 */
class Pimple extends \Pimple\Container
{
    /**
     * Sets a parameter or an object.
     *
     * @param  string            $id    The unique identifier for the parameter or object
     * @param  mixed             $value The value of the parameter or a closure to define an object
     * @throws \RuntimeException Prevent override of a frozen service
     */
    public function __set($id, $value)
    {
        $this->offsetSet($id, $value);
    }

    /**
     * Gets a parameter or an object.
     *
     * @param string $id The unique identifier for the parameter or object
     * @return mixed The value of the parameter or an object
     * @throws \InvalidArgumentException if the identifier is not defined
     */
    public function __get($id)
    {
        return $this->offsetGet($id);
    }

    /**
     * Checks if a parameter or an object is set.
     *
     * @param string $id The unique identifier for the parameter or object
     * @return Boolean
     */
    public function __isset($id)
    {
        return $this->offsetExists($id);
    }

    /**
     * Unsets a parameter or an object.
     *
     * @param string $id The unique identifier for the parameter or object
     */
    public function __unset($id)
    {
        $this->offsetUnset($id);
    }
}