DeleteSearchable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 16
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 8 2
1
<?php
2
/**
3
 * @link https://github.com/vuongxuongminh/yii2-searchable
4
 * @copyright Copyright (c) 2019 Vuong Xuong Minh
5
 * @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php)
6
 */
7
8
namespace vxm\searchable\queue;
9
10
/**
11
 * Class DeleteSearchable support delete searchable index data via worker.
12
 *
13
 * @author Vuong Minh <[email protected]>
14
 * @since 1.0.0
15
 */
16
class DeleteSearchable extends Job
17
{
18
19
    /**
20
     * @inheritDoc
21
     */
22
    protected function resolve(array $models): void
23
    {
24
        if (!empty($models)) {
25
26
            $modelClass = get_class(current($models));
27
            $modelClass::getSearchable()->delete($models);
28
        }
29
    }
30
31
}
32