Stats::addField()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace PSolr\Request;
4
5
/**
6
 * @see http://wiki.apache.org/solr/StatsComponent
7
 */
8
class Stats extends SolrRequest implements ComponentInterface
9
{
10
    /**
11
     * {@inheritDoc}
12
     */
13
    public function preMergeParams(SolrRequest $request) {}
14
15
    /**
16
     * {@inheritDoc}
17
     */
18
    public function init()
19
    {
20
        $this->stats();
21
    }
22
23
    /**
24
     * @param bool $stats
25
     *
26
     * @return \PSolr\Request\Stats
27
     *
28
     * @see http://wiki.apache.org/solr/StatsComponent
29
     */
30
    public function stats($stats = true)
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
31
    {
32
        return $this->set('stats', (bool) $stats);
33
    }
34
35
    /**
36
     * @param string $field
37
     *
38
     * @return \PSolr\Request\Stats
39
     *
40
     * @see http://wiki.apache.org/solr/StatsComponent
41
     */
42
    public function addField($field)
43
    {
44
        return $this->add('stats.field', $field);
45
    }
46
47
    /**
48
     * @param string $facet
49
     *
50
     * @return \PSolr\Request\Stats
51
     *
52
     * @see http://wiki.apache.org/solr/StatsComponent
53
     */
54
    public function addFacet($facet)
55
    {
56
        return $this->add('stats.facet', $facet);
57
    }
58
}
59