BinaryFileCache   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A readFile() 0 4 1
A putMetadataInCache() 0 5 1
1
<?php
2
3
namespace As3\Modlr\Metadata\Cache;
4
5
use As3\Modlr\Metadata\EntityMetadata;
6
7
/**
8
 * Caches and retrieves EntityMetadata objects from the file system using igbinary serialization.
9
 *
10
 * @author Jacob Bare <[email protected]>
11
 */
12
class BinaryFileCache extends FileCache
13
{
14
    /**
15
     * The cache type file prefix.
16
     *
17
     * @var string
18
     */
19
    protected $cachePrefix = 'BinaryCache';
20
21
    /**
22
     * The file extension.
23
     *
24
     * @var string
25
     */
26
    protected $extension = 'bin';
27
28
    /**
29
     * {@inheritDoc}
30
     */
31
    protected function readFile($file)
32
    {
33
        return igbinary_unserialize(file_get_contents($file));
34
    }
35
36
    /**
37
     * {@inheritDoc}
38
     */
39
    public function putMetadataInCache(EntityMetadata $metadata)
40
    {
41
        $this->writeFile($metadata, igbinary_serialize($metadata));
42
        return $this;
43
    }
44
}
45