1 | <?php |
||
10 | abstract class AbstractHashNamingStrategy extends AbstractNamingStrategy |
||
11 | { |
||
12 | const ALGORITHM_MD5 = 'md5'; |
||
13 | const ALGORITHM_SHA1 = 'sha1'; |
||
14 | |||
15 | /** |
||
16 | * @var string Hash algorithm |
||
17 | */ |
||
18 | protected $algorithm; |
||
19 | |||
20 | /** |
||
21 | * @var int Count of parts |
||
22 | */ |
||
23 | protected $partCount; |
||
24 | |||
25 | /** |
||
26 | * @var int Length of each part |
||
27 | */ |
||
28 | protected $partLength; |
||
29 | |||
30 | /** |
||
31 | * @var bool |
||
32 | */ |
||
33 | protected $shouldFullFilenameBeKept; |
||
34 | |||
35 | /** |
||
36 | * @param string $algorithm |
||
37 | * @param int $partCount |
||
38 | * @param int $partLength |
||
39 | * @param bool $shouldFullFilenameBeKept |
||
40 | */ |
||
41 | 16 | public function __construct($algorithm = self::ALGORITHM_MD5, $partCount = 2, $partLength = 2, $shouldFullFilenameBeKept = false) |
|
48 | |||
49 | /** |
||
50 | * @param FileInfo $srcFileInfo |
||
51 | * @param string $hash |
||
52 | * |
||
53 | * @return FileInfo |
||
54 | */ |
||
55 | 6 | public function provideNameByHash(FileInfo $srcFileInfo, $hash) |
|
74 | |||
75 | /** |
||
76 | * @return string |
||
77 | */ |
||
78 | 2 | public function getAlgorithm() |
|
82 | |||
83 | /** |
||
84 | * @return int |
||
85 | */ |
||
86 | 2 | public function getPartCount() |
|
90 | |||
91 | /** |
||
92 | * @return int |
||
93 | */ |
||
94 | 2 | public function getPartLength() |
|
98 | |||
99 | /** |
||
100 | * @return boolean |
||
101 | */ |
||
102 | 2 | public function shouldFullFilenameBeKept() |
|
106 | } |
||
107 |