Total Complexity | 4 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
11 | trait ParametersAwareTrait |
||
12 | { |
||
13 | /** |
||
14 | * @var ParametersInterface<mixed> |
||
15 | */ |
||
16 | protected ParametersInterface $params; |
||
17 | |||
18 | /** |
||
19 | * Set the parameters collection |
||
20 | * |
||
21 | * @param ParametersInterface<mixed> $params |
||
22 | */ |
||
23 | public function setParameters(ParametersInterface $params): void |
||
24 | { |
||
25 | $this->params = $params; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Return the parameters collection |
||
30 | * |
||
31 | * @return ParametersInterface<mixed> |
||
32 | */ |
||
33 | public function getParameters(): ParametersInterface |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Return a single parameter value by $name or if not found $default |
||
40 | * |
||
41 | * @param string $name |
||
42 | * @param mixed $default |
||
43 | * |
||
44 | * @return mixed |
||
45 | */ |
||
46 | public function getParam(string $name, $default = null) |
||
47 | { |
||
48 | return $this->params->getParam($name, $default); |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Set a single parameter value by $name |
||
53 | * |
||
54 | * @param string $name |
||
55 | * @param mixed $value |
||
56 | */ |
||
57 | public function setParam(string $name, $value): void |
||
60 | } |
||
61 | } |
||
62 |