Passed
Pull Request — master (#164)
by Simon
07:56 queued 02:02
created

SolrIndexTrait::setBatchLength()   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 1
dl 0
loc 3
rs 10
1
<?php
2
3
4
namespace Firesphere\SolrSearch\Traits;
5
6
7
use Firesphere\SolrSearch\Indexes\BaseIndex;
8
use Firesphere\SolrSearch\Services\SolrCoreService;
9
use Firesphere\SolrSearch\Tasks\SolrIndexTask;
10
11
/**
12
 * Trait SolrIndexTrait
13
 * Getters and Setters for the SolrIndexTask
14
 *
15
 * @package Firesphere\SolrSearch\Traits
16
 */
17
trait SolrIndexTrait
18
{
19
    /**
20
     * Debug mode enabled, default false
21
     *
22
     * @var bool
23
     */
24
    protected $debug = false;
25
    /**
26
     * Singleton of {@link SolrCoreService}
27
     *
28
     * @var SolrCoreService
29
     */
30
    protected $service;
31
    /**
32
     * @var BaseIndex Current core being indexed
33
     */
34
    protected $index;
35
    /**
36
     * @var int Number of CPU cores available
37
     */
38
    protected $cores = 1;
39
    /**
40
     * Default batch length
41
     *
42
     * @var int
43
     */
44
    protected $batchLength = 1;
45
46
    /**
47
     * Set the {@link SolrCoreService}
48
     *
49
     * @param SolrCoreService $service
50
     * @return self
51
     */
52
    public function setService(SolrCoreService $service): self
53
    {
54
        $this->service = $service;
55
56
        return $this;
57
    }
58
59
    /**
60
     * Set the debug mode
61
     *
62
     * @param bool $debug
63
     * @return self
64
     */
65
    public function setDebug(bool $debug): self
66
    {
67
        $this->debug = $debug;
68
69
        return $this;
70
    }
71
72
    /**
73
     * @return BaseIndex
74
     */
75
    public function getIndex(): BaseIndex
76
    {
77
        return $this->index;
78
    }
79
80
    /**
81
     * @param BaseIndex $index
82
     */
83
    public function setIndex(BaseIndex $index): void
84
    {
85
        $this->index = $index;
86
    }
87
88
    /**
89
     * @return int
90
     */
91
    public function getCores(): int
92
    {
93
        return $this->cores;
94
    }
95
96
    /**
97
     * @param int $cores
98
     */
99
    public function setCores(int $cores): void
100
    {
101
        $this->cores = $cores;
102
    }
103
104
    /**
105
     * @return int
106
     */
107
    public function getBatchLength(): int
108
    {
109
        return $this->batchLength;
110
    }
111
112
    /**
113
     * @param int $batchLength
114
     */
115
    public function setBatchLength(int $batchLength): void
116
    {
117
        $this->batchLength = $batchLength;
118
    }
119
}