Context::getOptions()   A
last analyzed

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 GusApi\Context;
6
7
final class Context implements ContextInterface
8
{
9
    /**
10
     * @var resource
11
     */
12
    private $context;
13
14
    public function __construct()
15
    {
16
        $this->context = stream_context_create();
17
    }
18
19
    public function setOptions(array $options): bool
20
    {
21
        if (function_exists('stream_context_set_options')) {
22
            return stream_context_set_options($this->context, $options);
23
        }
24
25
        return stream_context_set_option($this->context, $options);
26
    }
27
28
    public function setParameters(array $parameters): bool
29
    {
30
        return stream_context_set_params($this->context, $parameters);
31
    }
32
33
    public function getOptions(): array
34
    {
35
        return stream_context_get_options($this->context);
36
    }
37
38
    public function getParameters(): array
39
    {
40
        return stream_context_get_params($this->context);
41
    }
42
43
    public function getContext()
44
    {
45
        return $this->context;
46
    }
47
}
48