Completed
Push — master ( 450f6c...ad56b7 )
by Stefan
05:07
created

Config::make()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Gemz\HttpClient;
4
5
use Gemz\HttpClient\Contracts\Options;
6
7
class Config
8
{
9
    use Options;
10
11
    /** @var array<mixed> */
12
    protected $options = [];
13
14
    /** @var string */
15
    protected $bodyFormat = 'json';
16
17
    /** @var bool */
18
    protected $throwErrors = false;
19
20
    /**
21
     * @return Config
22
     */
23
    public static function make()
24
    {
25
        return new self();
26
    }
27
28
    /**
29
     * Config constructor
30
     */
31
    public function __construct()
32
    {
33
        $this->setDefaults();
34
    }
35
36
    /**
37
     * @return $this
38
     */
39
    protected function setDefaults(): self
40
    {
41
        $this->asJson();
42
43
        return $this;
44
    }
45
46
    /**
47
     * Config as array
48
     *
49
     * @return array<String|Array>
50
     */
51
    public function toArray(): array
52
    {
53
        return $this->options;
54
    }
55
}
56