Completed
Pull Request — master (#44)
by Nate
04:08 queued 02:15
created

NullTypeAdapter::write()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * Copyright (c) Nate Brunette.
4
 * Distributed under the MIT License (http://opensource.org/licenses/MIT)
5
 */
6
7
declare(strict_types=1);
8
9
namespace Tebru\Gson;
10
11
/**
12
 * Class NullTypeAdapter
13
 *
14
 * @author Nate Brunette <[email protected]>
15
 */
16
class NullTypeAdapter extends TypeAdapter
17
{
18
    /**
19
     * Read the next value, convert it to its type and return it
20
     *
21
     * @param JsonReadable $reader
22
     * @return void|null
23
     */
24
    public function read(JsonReadable $reader): void
25
    {
26
        $reader->nextNull();
27
    }
28 1
29
    /**
30 1
     * Write the value to the writer for the type
31 1
     *
32
     * @param JsonWritable $writer
33
     * @param mixed $value
34
     * @return void
35
     */
36
    public function write(JsonWritable $writer, $value): void
37
    {
38
        $writer->writeNull();
39
    }
40
}
41