Completed
Pull Request — master (#16)
by Gordon
02:18
created

BulkIndexDirtyJob   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 7
c 1
b 0
f 0
dl 0
loc 26
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setup() 0 3 1
A getTitle() 0 3 1
A process() 0 6 1
A hyrdate() 0 3 1
1
<?php declare(strict_types = 1);
2
3
/**
4
 * Created by PhpStorm.
5
 * User: gordon
6
 * Date: 25/3/2561
7
 * Time: 17:01 น.
8
 */
9
10
namespace Suilven\FreeTextSearch\QueuedJob;
11
12
use Suilven\FreeTextSearch\Helper\BulkIndexingHelper;
13
use Symbiote\QueuedJobs\Services\AbstractQueuedJob;
14
15
class BulkIndexDirtyJob extends AbstractQueuedJob
16
{
17
18
    // variable $indexName cannot be declared here, because serialization of the job does not store this variable
19
20
    public function getTitle(): string
21
    {
22
        return 'Bulk Index Dirty DataObjects';
23
    }
24
25
    public function hyrdate($newIndexName)
26
    {
27
        $this->indexName = $newIndexName;
0 ignored issues
show
Bug Best Practice introduced by
The property indexName does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
28
    }
29
30
    public function setup(): void
31
    {
32
        $this->totalSteps = 1;
33
    }
34
35
    public function process(): void
36
    {
37
        $helper = new BulkIndexingHelper();
38
        $helper->bulkIndex($this->indexName, true);
39
40
        $this->isComplete = true;
41
    }
42
}
43