StaticSiteMOSSURLProcessor::getDescription()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace PhpTek\Exodus\Processor;
4
5
use PhpTek\Exodus\Tool\StaticSiteUrlProcessor;
6
use PhpTek\Exodus\Processor\StaticSiteURLProcessorDropExtensions;
7
8
/**
9
 * Processor for MOSS URLs (Microsoft Office Sharepoint Server)
10
 * @todo Move into a "Processors" namespace
11
 */
12
class StaticSiteMOSSURLProcessor extends StaticSiteURLProcessorDropExtensions implements StaticSiteUrlProcessor
13
{
14
    /**
15
     *
16
     * @return string
17
     */
18
    public function getName(): string
19
    {
20
        return "Microsoft Sharepoint Processor";
21
    }
22
23
    /**
24
     *
25
     * @return string
26
     */
27
    public function getDescription(): string
28
    {
29
        return "Removes '/Pages/',  file-extensions and trailing slashes from URIs.";
30
    }
31
32
    /**
33
     *
34
     * @param array $urlData
35
     * @return array
36
     */
37
    public function processURL(array $urlData): array
38
    {
39
        if (!is_array($urlData) || empty($urlData['url'])) {
0 ignored issues
show
introduced by
The condition is_array($urlData) is always true.
Loading history...
40
            return [];
41
        }
42
43
        $url = str_ireplace('/Pages/', '/', $urlData['url']);
44
        $urlData = [
45
            'url' => $url,
46
            'mime' => $urlData['mime'],
47
        ];
48
49
        return parent::processURL($urlData);
50
    }
51
}
52