Completed
Push — master ( a6c8f9...b97be3 )
by Vladimir
03:52 queued 19s
created

PermalinkDocument::sanitizePermalink()   B

Complexity

Conditions 3
Paths 4

Size

Total Lines 30
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 3

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 30
rs 8.8571
ccs 11
cts 11
cp 1
cc 3
eloc 11
nc 4
nop 1
crap 3
1
<?php
2
3
/**
4
 * @copyright 2017 Vladimir Jimenez
5
 * @license   https://github.com/allejo/stakx/blob/master/LICENSE.md MIT
6
 */
7
8
namespace allejo\stakx\Document;
9
10
/**
11
 * A document that will have a permalink.
12
 */
13
interface PermalinkDocument
14
{
15
    /**
16
     * If a document has extra redirects defined in a special manner, overload this function.
17
     *
18
     * @return void
19
     */
20
    public function handleSpecialRedirects();
21
22
    /**
23
     * Get the destination of where this Content Item would be written to when the website is compiled.
24
     *
25
     * @return string
26
     */
27
    public function getTargetFile();
28
29
    /**
30
     * Get the permalink of this Content Item.
31
     *
32
     * @return string
33
     */
34
    public function getPermalink();
35
36
    /**
37
     * Get an array of URLs that will redirect to.
38
     *
39
     * @return string[]
40
     */
41
    public function getRedirects();
42
43
    /**
44
     * Get the relative path to the file, with respect to the site root.
45
     *
46
     * @return string
47
     */
48
    public function getRelativeFilePath();
49
50
    /**
51
     * Build the permalink from whatever information is available.
52
     *
53
     * For example, this function can take information from FrontMatter and build the permalink from there.
54
     *
55
     * @param bool $force Permalinks are often cached internal; set to true to force the permalink to be rebuilt.
56
     *
57
     * @return void
58
     */
59
    public function buildPermalink($force = false);
60
}
61