Completed
Pull Request — master (#44)
by Nate
05:12 queued 02:16
created

NullTypeAdapter::write()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
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\TypeAdapter;
10
11
use Tebru\Gson\Context\ReaderContext;
12
use Tebru\Gson\TypeAdapter;
13
use Tebru\Gson\Context\WriterContext;
14
15
/**
16
 * Class NullTypeAdapter
17
 *
18
 * @author Nate Brunette <[email protected]>
19
 */
20
class NullTypeAdapter extends TypeAdapter
21
{
22
    /**
23
     * Read the next value, convert it to its type and return it
24
     *
25
     * @param null $value
1 ignored issue
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $value is correct as it would always require null to be passed?
Loading history...
26
     * @param ReaderContext $context
27
     * @return null
28
     */
29 1
    public function read($value, ReaderContext $context)
30
    {
31 1
        return null;
32
    }
33
34
    /**
35
     * Write the value to the writer for the type
36
     *
37
     * @param int|null $value
38
     * @param WriterContext $context
39
     * @return void|null
40
     */
41 1
    public function write($value, WriterContext $context)
42
    {
43 1
        return null;
44
    }
45
}
46