Completed
Push — v0.7 ( 7c9b41...5c4e91 )
by Nate
02:30
created

DefaultSerializationExclusionData   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getContext() 0 3 1
A getObjectToSerialize() 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\WriterContext;
13
14
/**
15
 * Class DefaultSerializationExclusionData
16
 *
17
 * @author Nate Brunette <[email protected]>
18
 */
19
class DefaultSerializationExclusionData implements SerializationExclusionData
20
{
21
    /**
22
     * The object that's currently being serialized
23
     *
24
     * @var object
25
     */
26
    private $objectToSerialize;
27
    /**
28
     * @var WriterContext
29
     */
30
    private $context;
31
32
    /**
33
     * Constructor
34
     *
35
     * @param object $objectToSerialize
36
     * @param WriterContext $context
37
     */
38
    public function __construct($objectToSerialize, WriterContext $context)
39
    {
40
        $this->objectToSerialize = $objectToSerialize;
41 2
        $this->context = $context;
42
    }
43 2
44 2
    /**
45 2
     * Get the object currently being serialized
46
     *
47
     * @return object
48
     */
49
    public function getObjectToSerialize()
50
    {
51
        return $this->objectToSerialize;
52 1
    }
53
54 1
    /**
55
     * Get the writer context
56
     *
57
     * @return WriterContext
58
     */
59
    public function getContext(): WriterContext
60
    {
61
        return $this->context;
62 2
    }
63
}
64