Completed
Pull Request — master (#433)
by Albin
10:58
created

SafeLocal   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A computeKey() 0 4 1
A computePath() 0 4 1
1
<?php
2
3
namespace Gaufrette\Adapter\Local;
4
5
/**
6
 * Safe local adapter that encodes key to avoid the use of the directories
7
 * structure.
8
 *
9
 * @author  Antoine Hérault <[email protected]>
10
 */
11
class SafeLocal extends Local
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function computeKey($path)
17
    {
18
        return base64_decode(parent::computeKey($path));
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    protected function computePath($key)
25
    {
26
        return parent::computePath(base64_encode($key));
27
    }
28
}
29