Completed
Push — master ( cf24ba...2baed6 )
by WEBEWEB
02:24
created

IOFile::getUniqFilename()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the core-library package.
5
 *
6
 * (c) 2020 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\Core\ThirdParty\OcrLad\Model;
13
14
use SplFileInfo;
15
16
/**
17
 * I/O file.
18
 *
19
 * @author webeweb <https://github.com/webeweb>
20
 * @package WBW\Library\Core\ThirdParty\OcrLad\Model
21
 */
22
class IOFile extends SplFileInfo {
23
24
    /**
25
     * Get an uniq filename.
26
     *
27
     * @return string Returns the uniq filename.
28
     */
29
    protected function getUniqFilename() {
30
        return md5($this->getPathname());
31
    }
32
33
    /**
34
     * Get an uniq filename "der".
35
     *
36
     * @return string Returns the uniq filename "der".
37
     */
38
    public function getUniqFilenameDer() {
39
        return $this->getUniqFilenameWithExtension("der");
40
    }
41
42
    /**
43
     * Get an uniq filename "pdf".
44
     *
45
     * @return string Returns the uniq filename "pdf".
46
     */
47
    public function getUniqFilenamePdf() {
48
        return $this->getUniqFilenameWithExtension("pdf");
49
    }
50
51
    /**
52
     * Get an uniq filename.
53
     *
54
     * @param string $extension The extension.
55
     * @return string Returns the uniq filename.
56
     */
57
    protected function getUniqFilenameWithExtension($extension) {
58
        return $this->getUniqFilename() . ".{$extension}";
59
    }
60
61
    /**
62
     * Get an uniq filename "xml".
63
     *
64
     * @return string Returns the uniq filename "xml".
65
     */
66
    public function getUniqFilenameXml() {
67
        return $this->getUniqFilenameWithExtension("xml");
68
    }
69
}