GoogleDataStore   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 41
ccs 9
cts 9
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A save() 0 7 1
A getData() 0 4 1
1
<?php
2
3
namespace Previewtechs\HTTP\AccessLogger\Providers;
4
5
use GDS\Store;
6
use Previewtechs\HTTP\AccessLogger\StorageInterface;
7
8
/**
9
 * Class GoogleDataStore
10
 * @package Previewtechs\HTTP\AccessLogger\Providers
11
 */
12
class GoogleDataStore implements StorageInterface
13
{
14
    /**
15
     * @var array
16
     */
17
    public $data = [];
18
19
    /**
20
     * @var Store $gds
21
     */
22
    private $gds;
23
24
    /**
25
     * GoogleDataStore constructor.
26
     * @param $client
27
     */
28 3
    public function __construct($client)
29
    {
30 3
        $this->gds = $client;
31 3
    }
32
33
    /**
34
     * @param array $data
35
     * @return mixed
36
     */
37 1
    public function save($data = [])
38
    {
39 1
        $this->data = $data;
40
41 1
        $entities = $this->gds->createEntity($this->data);
42 1
        return $this->gds->upsert($entities);
43
    }
44
45
    /**
46
     * @return array
47
     */
48 1
    public function getData()
49
    {
50 1
        return $this->data;
51
    }
52
}
53