AbstractStorage::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of Transfer.
5
 *
6
 * For the full copyright and license information, please view the LICENSE file located
7
 * in the root directory.
8
 */
9
10
namespace Transfer\Storage;
11
12
use Transfer\Storage\Hashing\HashingStrategyInterface;
13
use Transfer\Storage\Hashing\StandardHashingStrategy;
14
15
/**
16
 * Abstract storage.
17
 */
18
abstract class AbstractStorage implements StorageInterface
19
{
20
    /**
21
     * @var HashingStrategyInterface Hashing strategy
22
     */
23
    protected $hashingStrategy;
24
25
    /**
26
     * @param HashingStrategyInterface|null $hashingStrategy Hashing strategy
27
     */
28 24
    public function __construct(HashingStrategyInterface $hashingStrategy = null)
29
    {
30 24
        $this->hashingStrategy = $hashingStrategy;
31
32 24
        if ($this->hashingStrategy === null) {
33 24
            $this->hashingStrategy = new StandardHashingStrategy();
34 24
        }
35 24
    }
36
}
37