Container   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 6
c 2
b 0
f 0
lcom 0
cbo 1
dl 0
loc 70
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A offsetExists() 0 4 1
A offsetGet() 0 4 1
A set() 0 8 1
A offsetSet() 0 8 1
A offsetUnset() 0 8 1
1
<?php
2
3
namespace Geekish\Slimbox;
4
5
use ArrayAccess;
6
use BadMethodCallException;
7
use mindplay\unbox\Configuration;
8
use mindplay\unbox\Container as Unbox;
9
use mindplay\unbox\ContainerException;
10
11
final class Container extends Unbox implements ArrayAccess
12
{
13
    /**
14
     * @param Configuration $config
15
     */
16
    public function __construct(Configuration $config)
17
    {
18
        parent::__construct($config);
19
    }
20
21
    /********************************************************************************
22
     * ArrayAccess interface
23
     *******************************************************************************/
24
25
    /**
26
     * @inheritDoc
27
     */
28
    public function offsetExists($key)
29
    {
30
        return $this->has($key);
31
    }
32
33
    /**
34
     * @inheritDoc
35
     */
36
    public function offsetGet($key)
37
    {
38
        return $this->get($key);
39
    }
40
41
    /**
42
     * @inheritDoc
43
     */
44
    public function offsetSet($key, $value)
45
    {
46
        throw new BadMethodCallException(sprintf(
47
            "%s does not support ArrayAccess::offsetSet, you must use %s to configure and create the container",
48
            __CLASS__,
49
            ContainerFactory::class
50
        ));
51
    }
52
53
    /**
54
     * @inheritDoc
55
     */
56
    public function offsetUnset($key)
57
    {
58
        throw new BadMethodCallException(sprintf(
59
            "%s does not support ArrayAccess::offsetUnset(), you must use %s to configure and create the container",
60
            __CLASS__,
61
            ContainerFactory::class
62
        ));
63
    }
64
65
    /********************************************************************************
66
     * Slim Container "compatibility"
67
     *******************************************************************************/
68
69
    /**
70
     * @inheritDoc
71
     */
72
    public function set($key, $value)
0 ignored issues
show
Unused Code introduced by
The parameter $key is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $value is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
73
    {
74
        throw new BadMethodCallException(sprintf(
75
            "%s does not support set() method, you must use %s to configure and create the container",
76
            __CLASS__,
77
            ContainerFactory::class
78
        ));
79
    }
80
}
81