Completed
Push — master ( 5a6cbe...c8e6dd )
by Dmitry
05:03
created

Clear::run()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 0
cts 11
cp 0
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 3
nop 1
crap 12
1
<?php
2
3
namespace Basis\Job\Tarantool;
4
5
use Tarantool\Client;
6
use Tarantool\Schema\Index;
7
8
class Clear
9
{
10
    public function run(Client $client)
11
    {
12
        $schema = $client->getSpace('_vspace');
13
        $response = $schema->select([], Index::SPACE_NAME);
14
        $data = $response->getData();
15
        foreach ($data as $row) {
16
            if ($row[1] == 0) {
17
                // user space
18
                $client->evaluate('box.space.'.$row[2].':drop{}');
19
            }
20
        }
21
    }
22
}
23