Completed
Pull Request — master (#2)
by Joao
05:22
created

NoSqlDocument   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 0
dl 0
loc 86
ccs 0
cts 37
cp 0
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getIdDocument() 0 4 1
A setIdDocument() 0 5 1
A getCollection() 0 4 1
A setCollection() 0 5 1
A getDocument() 0 4 1
A setDocument() 0 5 1
A addSubDocument() 0 4 1
1
<?php
2
3
namespace ByJG\AnyDataset;
4
5
class NoSqlDocument
6
{
7
    protected $idDocument;
8
9
    protected $collection;
10
11
    protected $document;
12
13
    protected $subDocument = [];
14
15
16
    /**
17
     * NoSqlDocument constructor.
18
     *
19
     * @param $idDocument
20
     * @param $collection
21
     * @param array $document
22
     */
23
    public function __construct($idDocument = null, $collection = null, $document = [])
24
    {
25
        $this->idDocument = $idDocument;
26
        $this->collection = $collection;
27
28
        $this->setDocument($document);
29
    }
30
31
    /**
32
     * @return null
33
     */
34
    public function getIdDocument()
35
    {
36
        return $this->idDocument;
37
    }
38
39
    /**
40
     * @param null $idDocument
41
     * @return $this
42
     */
43
    public function setIdDocument($idDocument)
44
    {
45
        $this->idDocument = $idDocument;
46
        return $this;
47
    }
48
49
    /**
50
     * @return null
51
     */
52
    public function getCollection()
53
    {
54
        return $this->collection;
55
    }
56
57
    /**
58
     * @param null $collection
59
     * @return $this
60
     */
61
    public function setCollection($collection)
62
    {
63
        $this->collection = $collection;
64
        return $this;
65
    }
66
67
68
    /**
69
     * @return array
70
     */
71
    public function getDocument()
72
    {
73
        return $this->document;
74
    }
75
76
    /**
77
     * @param array $document
78
     * @return $this
79
     */
80
    public function setDocument($document)
81
    {
82
        $this->document = $document;
83
        return $this;
84
    }
85
86
    public function addSubDocument(NoSqlDocument $document)
87
    {
88
        $this->subDocument[] = $document;
89
    }
90
}
91