Passed
Push — master ( c51b25...7397f7 )
by Simon
07:37
created

SolrIndex::getIndexName()   A

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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
4
namespace SilverStripe\FullTextSearch\Solr;
5
6
use Firesphere\SolrSearch\Indexes\BaseIndex;
7
use SilverStripe\CMS\Model\SiteTree;
0 ignored issues
show
Bug introduced by
The type SilverStripe\CMS\Model\SiteTree was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
/**
10
 * Class SolrIndex
11
 * This class serves as a stub to make migration from Fulltext Search easier
12
 *
13
 * @package SilverStripe\FullTextSearch\Solr
14
 */
15
class SolrIndex extends BaseIndex
16
{
17
    /**
18
     * Add the SiteTree class by default
19
     */
20
    public function init()
21
    {
22
        $this->addClass(SiteTree::class);
23
        return parent::init();
0 ignored issues
show
Bug introduced by
Are you sure the usage of parent::init() targeting Firesphere\SolrSearch\Indexes\BaseIndex::init() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
24
    }
25
26
    /**
27
     * Return the classname by default
28
     * @return string
29
     */
30
    public function getIndexName()
31
    {
32
        return static::class;
33
    }
34
}
35