Completed
Push — caching ( 6c9b2f )
by Nate
03:39
created

CreateFromInstance   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 37
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A construct() 0 3 1
A canCache() 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\ObjectConstructor;
10
11
use Tebru\Gson\Internal\ObjectConstructor;
12
13
/**
14
 * Class CreateFromInstance
15
 *
16
 * @author Nate Brunette <[email protected]>
17
 */
18
final class CreateFromInstance implements ObjectConstructor
19
{
20
    /**
21
     * The already instantiated object
22
     *
23
     * @var object
24
     */
25
    private $object;
26
27
    /**
28
     * Constructor
29
     *
30
     * @param object $object
31
     */
32
    public function __construct($object)
33
    {
34
        $this->object = $object;
35
    }
36
37
    /**
38
     * Returns the instantiated object
39
     *
40
     * @return object
41
     */
42
    public function construct()
43
    {
44
        return $this->object;
45
    }
46
47
    /**
48
     * Return true if object can be written to disk
49
     *
50
     * @return bool
51
     */
52
    public function canCache(): bool
53
    {
54
        return false;
55
    }
56
}
57