Completed
Push — master ( 930ba5...99d635 )
by Narcotic
29:20
created

NullModel   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 110
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 9
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 110
ccs 0
cts 19
cp 0
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getRepository() 0 4 1
A find() 0 4 1
A findAll() 0 4 1
A insertRecord() 0 4 1
A updateRecord() 0 4 1
A deleteRecord() 0 4 1
A getEntityClass() 0 4 1
A getConnectionName() 0 4 1
A setRepository() 0 4 1
1
<?php
2
/**
3
 * null model
4
 */
5
6
namespace Graviton\SecurityBundle\User\Model;
7
8
use Doctrine\ODM\MongoDB\DocumentRepository;
9
use Graviton\RestBundle\Model\ModelInterface;
10
use Symfony\Component\HttpFoundation\Request;
11
12
/**
13
 * Class NullModel
14
 *
15
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
16
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
17
 * @link     http://swisscom.ch
18
 */
19
class NullModel implements ModelInterface
20
{
21
    /**
22
     * @var DocumentRepository
23
     */
24
    private $repository;
25
26
    /**
27
     * Set document repository
28
     *
29
     * @param DocumentRepository $repository document repo
30
     *
31
     * @return void
32
     */
33
    public function setRepository(DocumentRepository $repository)
34
    {
35
        $this->repository = $repository;
36
    }
37
38
    /**
39
     * get repository instance
40
     *
41
     * @return DocumentRepository
42
     */
43
    public function getRepository()
44
    {
45
        return $this->repository;
46
    }
47
48
    /**
49
     * Find a single record by id
50
     *
51
     * @param string $id Record-Id
52
     *
53
     * @return Object
0 ignored issues
show
Documentation introduced by
Should the return type not be object|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
54
     */
55
    public function find($id)
56
    {
57
        return;
58
    }
59
60
    /**
61
     * Find all records
62
     *
63
     * @param \Symfony\Component\HttpFoundation\Request $request Request object
64
     *
65
     * @return Object[]
66
     */
67
    public function findAll(Request $request)
68
    {
69
        return array();
70
    }
71
72
    /**
73
     * Insert a new Record
74
     *
75
     * @param Object $entity Entity
76
     *
77
     * @return Object
0 ignored issues
show
Documentation introduced by
Should the return type not be object|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
78
     */
79
    public function insertRecord($entity)
80
    {
81
        return $this->find($entity->getId());
82
    }
83
84
    /**
85
     * Update an existing entity
86
     *
87
     * @param string $id     id of entity to update
88
     * @param Object $entity entity with new data
89
     *
90
     * @return Object
0 ignored issues
show
Documentation introduced by
Should the return type not be object|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
91
     */
92
    public function updateRecord($id, $entity)
93
    {
94
        return;
95
    }
96
97
    /**
98
     * Delete a record by id
99
     *
100
     * @param Number $id Record-Id
101
     *
102
     * @return null|Object
103
     */
104
    public function deleteRecord($id)
105
    {
106
        return null;
107
    }
108
109
    /**
110
     * Get the name of entity class
111
     *
112
     * @return string
113
     */
114
    public function getEntityClass()
115
    {
116
        return '';
117
    }
118
119
    /**
120
     * Get the connection name
121
     *
122
     * @return string
123
     */
124
    public function getConnectionName()
125
    {
126
        return '';
127
    }
128
}
129