FirebaseStub   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 89
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 1
dl 0
loc 89
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 4 1
A push() 0 4 1
A update() 0 4 1
A get() 0 4 1
A delete() 0 4 1
A setResponse() 0 4 1
A getSetResponse() 0 4 1
A getGetResponse() 0 4 1
A getDeleteResponse() 0 4 1
1
<?php
2
3
namespace Firebase;
4
5
/**
6
 * Class FirebaseStub
7
 *
8
 * Stubs the Firebase interface without issuing any cURL requests.
9
 *
10
 * @package Firebase
11
 */
12
class FirebaseStub extends FirebaseLib implements FirebaseInterface
13
{
14
    protected $response;
15
16
    /**
17
     * @param string $path
18
     * @param mixed $data
19
     * @param array $options
20
     * @return mixed
21
     */
22
    public function set(string $path, $data, array $options = [])
23
    {
24
        return $this->getSetResponse();
25
    }
26
27
    /**
28
     * @param string $path
29
     * @param mixed $data
30
     * @param array $options
31
     * @return mixed
32
     */
33
    public function push(string $path, $data, array $options = [])
34
    {
35
        return $this->set($path, $data);
36
    }
37
38
    /**
39
     * @param string $path
40
     * @param mixed $data
41
     * @param array $options
42
     * @return mixed
43
     */
44
    public function update(string $path, $data, array $options = [])
45
    {
46
        return $this->set($path, $data);
47
    }
48
49
    /**
50
     * @param string $path
51
     * @param array $options
52
     * @return mixed
53
     */
54
    public function get(string $path, array $options = [])
55
    {
56
        return $this->getGetResponse();
57
    }
58
59
    /**
60
     * @param string $path
61
     * @param array $options
62
     * @return null
63
     */
64
    public function delete(string $path, array $options = [])
65
    {
66
        return $this->getDeleteResponse();
67
    }
68
69
    /**
70
     * @param $expectedResponse
71
     */
72
    public function setResponse($expectedResponse): void
73
    {
74
        $this->response = $expectedResponse;
75
    }
76
77
    /**
78
     * @return mixed
79
     */
80
    private function getSetResponse()
81
    {
82
        return $this->response;
83
    }
84
85
    /**
86
     * @return mixed
87
     */
88
    private function getGetResponse()
89
    {
90
        return $this->response;
91
    }
92
93
    /**
94
     * @return mixed
95
     */
96
    private function getDeleteResponse()
97
    {
98
        return $this->response;
99
    }
100
}
101