Passed
Push — master ( ed38f6...30aafa )
by Timo
11:15
created

UriStrategyFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 2
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getForPageId() 0 10 1
1
<?php declare(strict_types = 1);
2
3
namespace ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\Helper;
4
5
/***************************************************************
6
 *  Copyright notice
7
 *
8
 *  (c) 2019 Timo Hund <[email protected]>
9
 *  All rights reserved
10
 *
11
 *  This script is part of the TYPO3 project. The TYPO3 project is
12
 *  free software; you can redistribute it and/or modify
13
 *  it under the terms of the GNU General Public License as published by
14
 *  the Free Software Foundation; either version 3 of the License, or
15
 *  (at your option) any later version.
16
 *
17
 *  The GNU General Public License can be found at
18
 *  http://www.gnu.org/copyleft/gpl.html.
19
 *  A copy is found in the textfile GPL.txt and important notices to the license
20
 *  from the author is found in LICENSE.txt distributed with these scripts.
21
 *
22
 *
23
 *  This script is distributed in the hope that it will be useful,
24
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
 *  GNU General Public License for more details.
27
 *
28
 *  This copyright notice MUST APPEAR in all copies of the script!
29
 ***************************************************************/
30
31
use ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\Helper\UriBuilder\AbstractUriStrategy;
32
use ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\Helper\UriBuilder\SolrSiteStrategy;
33
use ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\Helper\UriBuilder\TYPO3SiteStrategy;
34
use ApacheSolrForTypo3\Solr\System\Util\SiteUtility;
35
use TYPO3\CMS\Core\Utility\GeneralUtility;
36
37
/**
38
 * This class is responsible to retrieve an "UriStrategy" the can build uri's for the site where the
39
 * passed page belongs to.
40
 *
41
 * This can be:
42
 * * A TYPO3 site managed with site management
43
 * * A TYPO3 site without site management where the url is build by EXT:solr with L and id param and information from the domain
44
 * record or solr specific configuration.
45
 *
46
 * @package ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\Helper
47
 */
48
class UriStrategyFactory
49
{
50
    /**
51
     * @param integer $pageId
52
     * @oaram array $overrideConfiguration
53
     * @return AbstractUriStrategy
54
     */
55
    public function getForPageId(int $pageId): AbstractUriStrategy
0 ignored issues
show
Unused Code introduced by
The parameter $pageId is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

55
    public function getForPageId(/** @scrutinizer ignore-unused */ int $pageId): AbstractUriStrategy

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
56
    {
57
        // @todo by now using the site urls leads to problems
58
        // since e.g. fallbacks do not work and urls could be indexed that lead to a 404 error
59
        // when this is resolved we could generate the urls with the router of the site for indexing with solr
60
        // if (SiteUtility::getIsSiteManagedSite($pageId)) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
61
        //    return GeneralUtility::makeInstance(TYPO3SiteStrategy::class);
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
62
        // }
63
64
        return GeneralUtility::makeInstance(SolrSiteStrategy::class);
65
    }
66
}