Completed
Pull Request — master (#399)
by Anton
04:06
created

RegularAccess   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 43
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0

4 Methods

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