1
<?php
2

3
/*
4
 * This file is part of the Solarium package.
5
 *
6
 * For the full copyright and license information, please view the COPYING
7
 * file that was distributed with this source code.
8
 */
9

10
namespace Solarium\QueryType\Analysis\Result;
11

12
use Solarium\Core\Query\Result\QueryType as BaseResult;
13

14
/**
15
 * Analysis field query result.
16
 */
17
class Field extends BaseResult implements \IteratorAggregate, \Countable
18
{
19
    /**
20
     * List instances array.
21
     *
22
     * @var array
23
     */
24
    protected $items;
25

26
    /**
27
     * Status code returned by Solr.
28
     *
29
     * @var int
30
     */
31
    protected $status;
32

33
    /**
34
     * Solr index queryTime.
35
     *
36
     * This doesn't include things like the HTTP responsetime. Purely the Solr
37
     * query execution time.
38
     *
39
     * @var int
40
     */
41
    protected $queryTime;
42

43
    /**
44
     * Get Solr status code.
45
     *
46
     * This is not the HTTP status code! The normal value for success is 0.
47
     *
48
     * @return int
49
     */
50 12
    public function getStatus(): int
51
    {
52 12
        $this->parseResponse();
53

54 12
        return $this->status;
55
    }
56

57
    /**
58
     * Get Solr query time.
59
     *
60
     * This doesn't include things like the HTTP responsetime. Purely the Solr
61
     * query execution time.
62
     *
63
     * @return int
64
     */
65 12
    public function getQueryTime(): int
66
    {
67 12
        $this->parseResponse();
68

69 12
        return $this->queryTime;
70
    }
71

72
    /**
73
     * Get all lists.
74
     *
75
     * @return array
76
     */
77 12
    public function getLists(): array
78
    {
79 12
        $this->parseResponse();
80

81 12
        return $this->items;
82
    }
83

84
    /**
85
     * IteratorAggregate implementation.
86
     *
87
     * @return \ArrayIterator
88
     */
89 12
    public function getIterator(): \ArrayIterator
90
    {
91 12
        $this->parseResponse();
92

93 12
        return new \ArrayIterator($this->items);
94
    }
95

96
    /**
97
     * Countable implementation.
98
     *
99
     * @return int
100
     */
101 12
    public function count(): int
102
    {
103 12
        $this->parseResponse();
104

105 12
        return \count($this->items);
106
    }
107
}

Read our documentation on viewing source code .

Loading