RegularAccess::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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