Passed
Push — develop ( c9190c...f3da94 )
by Jens
04:27
created

getFolderPath()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 3
rs 10
1
<?php
2
function getDocumentSlug($path, $document)
3
{
4
    return substr($path, 1) . ($path === '/' ? '' : '/') . $document->slug;
5
}
6
7
function getEditDocumentLink($request, $cmsPrefix, $path, $document)
8
{
9
    return $request::$subfolders . $cmsPrefix . '/documents/edit-document?slug=' . getDocumentSlug($path, $document);
10
}
11
12
function getDeleteDocumentLink($request, $cmsPrefix, $path, $document)
13
{
14
    return $request::$subfolders . $cmsPrefix . '/documents/delete-document?slug=' . getDocumentSlug($path, $document);
15
}
16
17
function getPublishDocumentLink($request, $cmsPrefix, $path, $document)
18
{
19
    return $request::$subfolders . $cmsPrefix . '/documents/publish-document?slug=' . getDocumentSlug($path, $document);
20
}
21
22
function getUnpublishDocumentLink($request, $cmsPrefix, $path, $document)
23
{
24
    return $request::$subfolders . $cmsPrefix . '/documents/unpublish-document?slug=' . getDocumentSlug($path, $document);
25
}
26
27
function getFolderPath($path, $document)
28
{
29
    return $path . ($path === '/' ? '' : '/') . $document->slug;
30
}
31
32
function openFolderLink($path, $document)
33
{
34
    return '?path=' . getFolderPath($path, $document);
35
}
36
37
function getFolderSlug($path)
38
{
39
    return substr($path, 1);
40
}
41
42
function getDeleteFolderLink($request, $cmsPrefix, $path, $document)
43
{
44
    return $request::$subfolders . $cmsPrefix . '/documents/delete-folder?slug=' . getFolderSlug($path) . ($path === '/' ? '' : '/') . $document->slug;
45
}
46
47
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...