Passed
Push — master ( 0756b4...22a454 )
by Gabor
06:47
created

InMemoryDriver::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * WebHemi.
4
 *
5
 * PHP version 5.6
6
 *
7
 * @copyright 2012 - 2016 Gixx-web (http://www.gixx-web.com)
8
 * @license   https://opensource.org/licenses/MIT The MIT License (MIT)
9
 *
10
 * @link      http://www.gixx-web.com
11
 */
12
namespace WebHemi\Adapter\Data\InMemory;
13
14
use WebHemi\Adapter\Data\DataDriverInterface;
15
16
/**
17
 * Class InMemoryDriver.
18
 *
19
 * Implements the DataDriverInterface, so the Dependency Injector can reference it.
20
 *
21
 * @codeCoverageIgnore - simple array setter/getter.
22
 */
23
class InMemoryDriver implements DataDriverInterface
24
{
25
    /** @var array */
26
    private $data = [];
27
28
    /**
29
     * InMemoryDriver constructor.
30
     *
31
     * @param array|null $data
32
     */
33
    public function __construct(array $data = null)
34
    {
35
        if (!empty($data)) {
36
            $this->data = $data;
37
        }
38
    }
39
40
    /**
41
     * Get data.
42
     *
43
     * @return array
44
     */
45
    public function toArray()
46
    {
47
        return $this->data;
48
    }
49
}
50