GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 2.9 ( 0fedc1...47b4c9 )
by Thorsten
15:08
created

PMF_Search_Elasticsearch::update()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 1
nc 1
nop 1
1
<?php
2
3
use Elasticsearch\Client;
4
5
/**
6
 * phpMyFAQ Elasticsearch based search classes.
7
 *
8
 * PHP Version 5.5
9
 *
10
 * This Source Code Form is subject to the terms of the Mozilla Public License,
11
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
12
 * obtain one at http://mozilla.org/MPL/2.0/.
13
 *
14
 * @category  phpMyFAQ
15
 * @author    Thorsten Rinne <[email protected]>
16
 * @copyright 2015 phpMyFAQ Team
17
 * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
18
 * @link      http://www.phpmyfaq.de
19
 * @since     2015-12-25
20
 */
21
if (!defined('IS_VALID_PHPMYFAQ')) {
22
    exit();
23
}
24
25
/**
26
 * PMF_Search_Elasticsearch.
27
 *
28
 * @category  phpMyFAQ
29
 * @author    Thorsten Rinne <[email protected]>
30
 * @copyright 2015 phpMyFAQ Team
31
 * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
32
 * @link      http://www.phpmyfaq.de
33
 * @since     2015-12-25
34
 */
35
class PMF_Search_Elasticsearch extends PMF_Search_Abstract implements PMF_Search_Interface
36
{
37
    /** @var Client */
38
    private $client = null;
39
40
    /** @var array */
41
    private $esConfig = [];
42
43
    /**
44
     * Elasticsearch mapping
45
     *
46
     * @var array
47
     */
48
    private $mappings = [
0 ignored issues
show
Unused Code introduced by
The property $mappings is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
49
        'faqs' => [
50
            '_source' => [
51
                'enabled' => true
52
            ],
53
            'properties' => [
54
                'id' => [
55
                    'type' => 'integer'
56
                ],
57
                'question' => [
58
                    'type' => 'string',
59
                    'analyzer' => 'standard'
60
                ],
61
                'answer' => [
62
                    'type' => 'string',
63
                    'analyzer' => 'standard'
64
                ],
65
                'keywords' => [
66
                    'type' => 'string',
67
                    'analyzer' => 'standard'
68
                ],
69
                'categories' => [
70
                    'type' => 'string',
71
                    'analyzer' => 'standard'
72
                ]
73
            ]
74
        ]
75
    ];
76
77
    /**
78
     * Constructor.
79
     *
80
     * @param PMF_Configuration
81
     */
82
    public function __construct(PMF_Configuration $config)
83
    {
84
        parent::__construct($config);
85
86
        $this->client = $this->_config->getElasticsearch();
87
        $this->esConfig = $this->_config->getElasticsearchConfig();
88
    }
89
90
    /**
91
     * Prepares the search and executes it.
92
     *
93
     * @param string $searchTerm Search term
94
     *
95
     * @return resource
96
     *
97
     * @throws PMF_Search_Exception
98
     */
99
    public function search($searchTerm)
100
    {
101
102
    }
103
}
104