Passed
Push — master ( 0918f4...5c9a45 )
by Marco
05:55
created

SolrIndexTrait::getCores()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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