ContextTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getContext() 0 4 1
A addContext() 0 4 1
1
<?php
2
/**
3
 * Spiral, Core Components
4
 *
5
 * @author Wolfy-J
6
 */
7
8
namespace Spiral\ORM\Commands\Traits;
9
10
/**
11
 * Provides ability to carry context.
12
 */
13
trait ContextTrait
14
{
15
    /**
16
     * @var array
17
     */
18
    private $context = [];
19
20
    /**
21
     * @return array
22
     */
23
    public function getContext(): array
24
    {
25
        return $this->context;
26
    }
27
28
    /**
29
     * @param string $name
30
     * @param mixed  $value
31
     */
32
    public function addContext(string $name, $value)
33
    {
34
        $this->context[$name] = $value;
35
    }
36
}