HashNamingStrategy::provideName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 1
1
<?php
2
3
namespace FileNamingResolver\NamingStrategy;
4
5
use FileNamingResolver\FileInfo;
6
7
/**
8
 * @author Victor Bocharsky <[email protected]>
9
 */
10
class HashNamingStrategy extends AbstractHashNamingStrategy
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 3
    public function provideName(FileInfo $srcFileInfo)
16
    {
17 3
        $string = $this->generateUniqueString();
18 3
        $hash = hash($this->algorithm, $string);
19
20 3
        $dstFileInfo = $this->provideNameByHash($srcFileInfo, $hash);
21
22 3
        return $dstFileInfo;
23
    }
24
}
25