Passed
Pull Request — master (#2755)
by Rafael
03:55
created

__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.0156

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 4
ccs 3
cts 4
cp 0.75
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 2
crap 1.0156
1
<?php
2
declare(strict_types=1);
3
4
/*
5
 * This file is part of the TYPO3 CMS project.
6
 *
7
 * It is free software; you can redistribute it and/or modify it under
8
 * the terms of the GNU General Public License, either version 2
9
 * of the License, or any later version.
10
 *
11
 * For the full copyright and license information, please read the
12
 * LICENSE.txt file that was distributed with this source code.
13
 *
14
 * The TYPO3 project - inspiring people to share!
15
 */
16
17
namespace ApacheSolrForTypo3\Solr\Event\Routing;
18
19
use Psr\Http\Message\UriInterface;
20
21
/**
22
 * This event will triggered before start to replace placeholder inside of cached URLs
23
 *
24
 * @author Lars Tode <[email protected]>
25
 */
26
class BeforeReplaceVariableInCachedUrlEvent
27
{
28
    /**
29
     * @var UriInterface
30
     */
31
    protected $uri;
32
33
    /**
34
     * Routing is enabled
35
     *
36
     * @var bool
37
     */
38
    protected $routing = false;
39
40
    /**
41
     * BeforeReplaceVariableInCachedUrlEvent constructor.
42
     * @param UriInterface $uri
43
     * @param bool $routing
44
     */
45 35
    public function __construct(UriInterface $uri, bool $routing = false)
46
    {
47 35
        $this->uri = $uri;
48 35
        $this->routing = $routing;
49 35
    }
50
51
    /**
52
     * Returns the URI
53
     *
54
     * @return UriInterface
55
     */
56 35
    public function getUri(): UriInterface
57
    {
58 35
        return $this->uri;
59
    }
60
61
    /**
62
     * Replace the URI object
63
     *
64
     * @param UriInterface $uri
65
     */
66
    public function replaceUri(UriInterface  $uri)
67
    {
68
        $this->uri = $uri;
69
    }
70
71
    /**
72
     * @return bool
73
     */
74 35
    public function hasRouting(): bool
75
    {
76 35
        return $this->routing;
77
    }
78
}
79