AssembleContext   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 25
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
/*
6
 * This file is part of the FiveLab Resource package
7
 *
8
 * (c) FiveLab
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code
12
 */
13
14
namespace FiveLab\Component\Resource\Assembler\Context;
15
16
/**
17
 * The context for assemble resource.
18
 *
19
 * @author Vitaliy Zhuk <[email protected]>
20
 */
21
class AssembleContext
22
{
23
    /**
24
     * @var mixed
25
     */
26
    private $payload;
27
28
    /**
29
     * Constructor.
30
     *
31
     * @param array $payload
32
     */
33 3
    public function __construct(array $payload = [])
34
    {
35 3
        $this->payload = $payload;
36 3
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41 1
    public function get(string $key, $value = null)
42
    {
43 1
        return $this->payload[$key] ?? $value;
44
    }
45
}
46