Passed
Pull Request — release-11.5.x (#3206)
by Michael
40:59 queued 01:38
created

Path   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 5
c 0
b 0
f 0
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A isValidSolrPath() 0 9 3
1
<?php
2
3
/*
4
 * This file is part of the TYPO3 CMS project.
5
 *
6
 * It is free software; you can redistribute it and/or modify it under
7
 * the terms of the GNU General Public License, either version 2
8
 * of the License, or any later version.
9
 *
10
 * For the full copyright and license information, please read the
11
 * LICENSE.txt file that was distributed with this source code.
12
 *
13
 * The TYPO3 project - inspiring people to share!
14
 */
15
16
namespace ApacheSolrForTypo3\Solr\System\Validator;
17
18
/**
19
 * Class Path is used for Solr Path related methods
20
 *
21
 * @author Thomas Hohn <[email protected]>
22
 */
23
class Path
24
{
25
26
    /**
27
     * Validate that a path is a valid Solr Path
28
     *
29
     * @param string $path
30
     * @return bool
31
     */
32 4
    public function isValidSolrPath($path)
33
    {
34 4
        $path = trim($path);
35
36 4
        if ((!empty($path)) && (preg_match('/^[^*?"<>|:#]*$/', $path))) {
37 1
            return true;
38
        }
39
40 3
        return false;
41
    }
42
}
43