RewriteMap   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 33
ccs 12
cts 12
cp 1
rs 10
c 1
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getFilename() 0 3 1
A addRewrite() 0 3 1
A getContent() 0 3 1
A __construct() 0 5 1
1
<?php
2
/**
3
 * integer_net GmbH Magento Module
4
 *
5
 * @copyright  Copyright (c) 2020 integer_net GmbH (http://www.integer-net.de/)
6
 * @author     Bernard Delhez <[email protected]>
7
 */
8
9
namespace IntegerNet\RewriteMap\Model;
10
11
class RewriteMap
12
{
13
    /** @var string */
14
    private $rewriteMapFileContent;
15
    /**
16
     * @var int
17
     */
18
    private $storeId;
19
    /**
20
     * @var int
21
     */
22
    private $redirectType;
23
24 7
    public function __construct(int $storeId, int $redirectType)
25
    {
26 7
        $this->rewriteMapFileContent = '';
27 7
        $this->storeId = $storeId;
28 7
        $this->redirectType = $redirectType;
29 7
    }
30
31 3
    public function addRewrite(string $request, string $target)
32
    {
33 3
        $this->rewriteMapFileContent .= sprintf("/%s /%s\n", $request, $target);
34 3
    }
35
36 5
    public function getFilename(): string
37
    {
38 5
        return sprintf('rewrite-map-%s-store-%s.txt', $this->redirectType, $this->storeId);
39
    }
40
41 3
    public function getContent(): string
42
    {
43 3
        return $this->rewriteMapFileContent;
44
    }
45
}
46