RegularAccess   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 6
c 1
b 0
f 0
dl 0
loc 51
ccs 8
cts 8
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 1
A has() 0 3 1
A delete() 0 3 1
A set() 0 3 1
1
<?php
2
3
/**
4
 * Bluz Framework Component
5
 *
6
 * @copyright Bluz PHP Team
7
 * @link      https://github.com/bluzphp/framework
8
 */
9
10
declare(strict_types=1);
11
12
namespace Bluz\Container;
13
14
/**
15
 * Implements regular access to container
16
 *
17
 * @package  Bluz\Common
18
 * @author   Anton Shevchuk
19
 */
20
trait RegularAccess
21
{
22
    use Container;
23
24
    /**
25
     * Set key/value pair
26
     *
27
     * @param string $key
28
     * @param  mixed  $value
29
     *
30
     * @return void
31
     */
32 1
    public function set(string $key, mixed $value): void
33
    {
34 1
        $this->doSetContainer($key, $value);
35
    }
36
37
    /**
38
     * Get value by key
39
     *
40
     * @param string $key
41
     *
42
     * @return mixed
43
     */
44 1
    public function get(string $key): mixed
45
    {
46 1
        return $this->doGetContainer($key);
47
    }
48
49
    /**
50
     * Check contains key in container
51
     *
52
     * @param string $key
53
     *
54
     * @return bool
55
     */
56 1
    public function has(string $key): bool
57
    {
58 1
        return $this->doContainsContainer($key);
59
    }
60
61
    /**
62
     * Delete value by key
63
     *
64
     * @param string $key
65
     *
66
     * @return void
67
     */
68 1
    public function delete(string $key): void
69
    {
70 1
        $this->doDeleteContainer($key);
71
    }
72
}
73