ContainerInterface::add()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of Graze DataStructure
4
 *
5
 * Copyright (c) 2014 Nature Delivered Ltd. <http://graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @see  http://github.com/graze/data-structure/blob/master/LICENSE
11
 * @link http://github.com/graze/data-structure
12
 */
13
14
namespace Graze\DataStructure\Container;
15
16
use Graze\DataStructure\Exception\RegisteredKeyException;
17
use IteratorAggregate;
18
use ArrayAccess;
19
20
interface ContainerInterface extends IteratorAggregate, ArrayAccess
21
{
22
    /**
23
     * @param string $key
24
     * @param mixed $value
25
     *
26
     * @throws RegisteredKeyException If value with `$key` is already registered
27
     *
28
     * @return ContainerInterface
29
     */
30
    public function add($key, $value);
31
32
    /**
33
     * @param callable $fn
34
     */
35
    public function forAll(callable $fn);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
36
37
    /**
38
     * @param string $key
39
     *
40
     * @return mixed
41
     */
42
    public function get($key);
43
44
    /**
45
     * @return array
46
     */
47
    public function getAll();
48
49
    /**
50
     * @param string $key
51
     *
52
     * @return bool
53
     */
54
    public function has($key);
55
56
    /**
57
     * @param string $key
58
     * @param mixed $value
59
     *
60
     * @return ContainerInterface
61
     */
62
    public function set($key, $value);
63
64
    /**
65
     * @param string $key
66
     *
67
     * @return ContainerInterface
68
     */
69
    public function remove($key);
70
}
71