Passed
Pull Request — master (#3)
by De Cramer
07:09
created

ExecutionContext::getParameters()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Oliverde8\Component\PhpEtl\Model;
6
7
use oliverde8\AssociativeArraySimplified\AssociativeArray;
8
use Oliverde8\Component\PhpEtl\Model\File\FileSystemInterface;
9
10
class ExecutionContext extends LoggerContext
11
{
12
    protected array $parameters;
13
14
    protected FileSystemInterface $fileSystem;
15
16
    /**
17
     * @param array $parameters
18
     * @param FileSystemInterface $fileSystem
19
     */
20
    public function __construct(array $parameters, FileSystemInterface $fileSystem)
21
    {
22
        $this->parameters = $parameters;
23
        $this->fileSystem = $fileSystem;
24
    }
25
26
27
    public function getLoggerContext(array $additionalContextData): array
28
    {
29
        return $additionalContextData + $this->loggerContext;
30
    }
31
32
    public function getParameters(): array
33
    {
34
        return $this->parameters;
35
    }
36
37
    public function getParameter(string $key, $default = null, string $separator = ".")
38
    {
39
        return AssociativeArray::getFromKey($this->parameters, $key, $default, $separator);
40
    }
41
42
    public function setParameter(string $key, $value, string $separator = "."): void
43
    {
44
        AssociativeArray::setFromKey($this->parameters, $key, $value, $separator);
45
    }
46
47
    public function getFileSystem(): FileSystemInterface
48
    {
49
        return $this->fileSystem;
50
    }
51
52
53
54
}