Skip to content

Commit 05d517c

Browse files
committed
Added the optional file ID parameter.
1 parent f478077 commit 05d517c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/DocFile.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@ class DocFile
1212
{
1313
private string $title;
1414
private string $path;
15+
private string $id;
1516

1617
/**
1718
* @param string $title
1819
* @param string $path
20+
* @param string $id
1921
* @throws FileHelper_Exception
2022
*/
21-
public function __construct(string $title, string $path)
23+
public function __construct(string $title, string $path, string $id='')
2224
{
2325
$this->title = $title;
2426
$this->path = FileHelper::requireFileExists($path);
27+
$this->id = $id;
2528
}
2629

2730
/**
@@ -34,7 +37,11 @@ public function getPath(): string
3437

3538
public function getID() : string
3639
{
37-
return ConvertHelper::string2shortHash($this->path);
40+
if(empty($this->id)) {
41+
$this->id = ConvertHelper::string2shortHash($this->path);
42+
}
43+
44+
return $this->id;
3845
}
3946

4047
/**

0 commit comments

Comments
 (0)