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

DefaultSerializationExclusionData   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 43
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getObjectToSerialize() 0 3 1
A getPath() 0 3 1
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