Passed
Push — master ( 21960d...c0d8f1 )
by Simon
08:28
created

SchemaFactoryExtension   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 7
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A onBeforeFilterFields() 0 8 1
1
<?php
2
/**
3
 * Class SchemaFactoryExtension|Firesphere\SolrPermissions\Extensions\SchemaFactoryExtension Add the member view
4
 * permission field to the schema
5
 *
6
 * @package Firesphere\SolrPermissions\Extensions
7
 * @author Simon `Firesphere` Erkelens; Marco `Sheepy` Hermo
8
 * @copyright Copyright (c) 2018 - now() Firesphere & Sheepy
9
 */
10
11
namespace Firesphere\SolrPermissions\Extensions;
12
13
use Firesphere\SolrSearch\Factories\SchemaFactory;
0 ignored issues
show
Bug introduced by
The type Firesphere\SolrSearch\Factories\SchemaFactory 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...
14
use SilverStripe\Core\Extension;
15
use SilverStripe\ORM\ArrayList;
16
17
/**
18
 * Class \Firesphere\SolrPermissions\Extensions\SchemaFactoryExtension
19
 *
20
 * Extension class to add the default filters for the MemberView
21
 *
22
 * @package Firesphere\SolrPermissions\Extensions
23
 * @property SchemaFactory|SchemaFactoryExtension $owner
24
 */
25
class SchemaFactoryExtension extends Extension
26
{
27
28
    /**
29
     * Add the MemberView field to Solr for filtering on members
30
     *
31
     * @param ArrayList $return
32
     */
33
    public function onBeforeFilterFields(ArrayList $return)
34
    {
35
        $return->push([
36
            'Field'       => 'MemberView',
37
            'Type'        => 'string',
38
            'Indexed'     => 'true',
39
            'Stored'      => 'true',
40
            'MultiValued' => 'true',
41
        ]);
42
    }
43
}
44