Skip to content

Commit 5d414d6

Browse files
committed
Tweaked the ID hashing.
1 parent ca5f663 commit 5d414d6

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/DocFile.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,16 @@ public function __construct(string $title, string $path, string $id='')
2424
{
2525
$this->title = $title;
2626
$this->path = FileHelper::requireFileExists($path);
27-
$this->id = $id;
27+
$this->id = $this->resolveID($id);
28+
}
29+
30+
private function resolveID(string $id) : string
31+
{
32+
if(empty($id)) {
33+
$id = $this->path;
34+
}
35+
36+
return ConvertHelper::string2shortHash($id);
2837
}
2938

3039
/**
@@ -37,10 +46,6 @@ public function getPath(): string
3746

3847
public function getID() : string
3948
{
40-
if(empty($this->id)) {
41-
$this->id = ConvertHelper::string2shortHash($this->path);
42-
}
43-
4449
return $this->id;
4550
}
4651

0 commit comments

Comments
 (0)