Passed
Push — master ( 21a5dc...1ca6d2 )
by Nate
40s
created

getObjectToSerialize()   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 0
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\Internal;
10
11
use Tebru\Gson\Exclusion\SerializationExclusionData;
12
use Tebru\Gson\JsonWritable;
13
14
/**
15
 * Class DefaultSerializationExclusionData
16
 *
17
 * @author Nate Brunette <[email protected]>
18
 */
19
class DefaultSerializationExclusionData implements SerializationExclusionData
20
{
21
22
    /**
23
     * @var object
24
     */
25
    private $objectToSerialize;
26
27
    /**
28
     * @var JsonWritable
29
     */
30
    private $writer;
31
32
    /**
33
     * Constructor
34
     *
35
     * @param object $objectToSerialize
36
     * @param JsonWritable $writer
37
     */
38 2
    public function __construct($objectToSerialize, JsonWritable $writer)
39
    {
40 2
        $this->objectToSerialize = $objectToSerialize;
41 2
        $this->writer = $writer;
42 2
    }
43
44
    /**
45
     * Get the object currently being serialized
46
     *
47
     * @return object
48
     */
49 1
    public function getObjectToSerialize()
50
    {
51 1
        return $this->objectToSerialize;
52
    }
53
54
    /**
55
     * Get the current path formatted as json xpath
56
     *
57
     * @return string
58
     */
59 2
    public function getPath(): string
60
    {
61 2
        return $this->writer->getPath();
62
    }
63
}
64