Completed
Push — v0.7 ( 21297d...0d3226 )
by Nate
02:43
created

WriterContext   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 30
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A serializeNull() 0 3 1
A setSerializeNull() 0 5 1
1
<?php
2
/*
3
 * Copyright (c) Nate Brunette.
4
 * Distributed under the MIT License (http://opensource.org/licenses/MIT)
5
 */
6
declare(strict_types=1);
7
8
namespace Tebru\Gson\Context;
9
10
/**
11
 * Class JsonReaderContext
12
 *
13
 * Runtime context that can be used during reading
14
 *
15
 * @author Nate Brunette <[email protected]>
16
 */
17
class WriterContext extends Context
18
{
19
    /**
20
     * If nulls should be serialized
21
     *
22
     * @var bool
23
     */
24
    private $serializeNull = false;
25
26
    /**
27
     * If we should serialize null
28
     *
29
     * @return bool
30
     */
31 1
    public function serializeNull(): bool
32
    {
33 1
        return $this->serializeNull;
34
    }
35
36
    /**
37
     * Set if nulls should be serialized
38
     *
39
     * @param bool $serializeNull
40
     * @return Context
41
     */
42 1
    public function setSerializeNull(bool $serializeNull): Context
43
    {
44 1
        $this->serializeNull = $serializeNull;
45
46 1
        return $this;
47
    }
48
}
49